@probnaya/057-cli 1.1.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.md +112 -10
- package/README.md +19 -10
- package/dist/assets/index-BQjibITq.js +649 -0
- package/dist/index.html +1 -1
- package/dist-server/057.mjs +109 -60
- package/package.json +3 -2
- package/dist/assets/index-JB-esYG9.js +0 -646
|
@@ -0,0 +1,649 @@
|
|
|
1
|
+
(function(){const i=document.createElement("link").relList;if(i&&i.supports&&i.supports("modulepreload"))return;for(const u of document.querySelectorAll('link[rel="modulepreload"]'))l(u);new MutationObserver(u=>{for(const f of u)if(f.type==="childList")for(const d of f.addedNodes)d.tagName==="LINK"&&d.rel==="modulepreload"&&l(d)}).observe(document,{childList:!0,subtree:!0});function s(u){const f={};return u.integrity&&(f.integrity=u.integrity),u.referrerPolicy&&(f.referrerPolicy=u.referrerPolicy),u.crossOrigin==="use-credentials"?f.credentials="include":u.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function l(u){if(u.ep)return;u.ep=!0;const f=s(u);fetch(u.href,f)}})();var Tc={exports:{}},Js={};var Cm;function bx(){if(Cm)return Js;Cm=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.fragment");function s(l,u,f){var d=null;if(f!==void 0&&(d=""+f),u.key!==void 0&&(d=""+u.key),"key"in u){f={};for(var h in u)h!=="key"&&(f[h]=u[h])}else f=u;return u=f.ref,{$$typeof:n,type:l,key:d,ref:u!==void 0?u:null,props:f}}return Js.Fragment=i,Js.jsx=s,Js.jsxs=s,Js}var Om;function xx(){return Om||(Om=1,Tc.exports=bx()),Tc.exports}var v=xx(),Ac={exports:{}},pe={};var zm;function Sx(){if(zm)return pe;zm=1;var n=Symbol.for("react.transitional.element"),i=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),u=Symbol.for("react.profiler"),f=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"),b=Symbol.for("react.lazy"),x=Symbol.for("react.activity"),R=Symbol.iterator;function $(T){return T===null||typeof T!="object"?null:(T=R&&T[R]||T["@@iterator"],typeof T=="function"?T:null)}var L={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},O=Object.assign,j={};function X(T,k,F){this.props=T,this.context=k,this.refs=j,this.updater=F||L}X.prototype.isReactComponent={},X.prototype.setState=function(T,k){if(typeof T!="object"&&typeof T!="function"&&T!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,T,k,"setState")},X.prototype.forceUpdate=function(T){this.updater.enqueueForceUpdate(this,T,"forceUpdate")};function Q(){}Q.prototype=X.prototype;function H(T,k,F){this.props=T,this.context=k,this.refs=j,this.updater=F||L}var U=H.prototype=new Q;U.constructor=H,O(U,X.prototype),U.isPureReactComponent=!0;var J=Array.isArray;function W(){}var A={H:null,A:null,T:null,S:null},w=Object.prototype.hasOwnProperty;function G(T,k,F){var Z=F.ref;return{$$typeof:n,type:T,key:k,ref:Z!==void 0?Z:null,props:F}}function te(T,k){return G(T.type,k,T.props)}function ne(T){return typeof T=="object"&&T!==null&&T.$$typeof===n}function le(T){var k={"=":"=0",":":"=2"};return"$"+T.replace(/[=:]/g,function(F){return k[F]})}var Ge=/\/+/g;function de(T,k){return typeof T=="object"&&T!==null&&T.key!=null?le(""+T.key):k.toString(36)}function oe(T){switch(T.status){case"fulfilled":return T.value;case"rejected":throw T.reason;default:switch(typeof T.status=="string"?T.then(W,W):(T.status="pending",T.then(function(k){T.status==="pending"&&(T.status="fulfilled",T.value=k)},function(k){T.status==="pending"&&(T.status="rejected",T.reason=k)})),T.status){case"fulfilled":return T.value;case"rejected":throw T.reason}}throw T}function z(T,k,F,Z,ue){var he=typeof T;(he==="undefined"||he==="boolean")&&(T=null);var me=!1;if(T===null)me=!0;else switch(he){case"bigint":case"string":case"number":me=!0;break;case"object":switch(T.$$typeof){case n:case i:me=!0;break;case b:return me=T._init,z(me(T._payload),k,F,Z,ue)}}if(me)return ue=ue(T),me=Z===""?"."+de(T,0):Z,J(ue)?(F="",me!=null&&(F=me.replace(Ge,"$&/")+"/"),z(ue,k,F,"",function(hn){return hn})):ue!=null&&(ne(ue)&&(ue=te(ue,F+(ue.key==null||T&&T.key===ue.key?"":(""+ue.key).replace(Ge,"$&/")+"/")+me)),k.push(ue)),1;me=0;var $e=Z===""?".":Z+":";if(J(T))for(var Re=0;Re<T.length;Re++)Z=T[Re],he=$e+de(Z,Re),me+=z(Z,k,F,he,ue);else if(Re=$(T),typeof Re=="function")for(T=Re.call(T),Re=0;!(Z=T.next()).done;)Z=Z.value,he=$e+de(Z,Re++),me+=z(Z,k,F,he,ue);else if(he==="object"){if(typeof T.then=="function")return z(oe(T),k,F,Z,ue);throw k=String(T),Error("Objects are not valid as a React child (found: "+(k==="[object Object]"?"object with keys {"+Object.keys(T).join(", ")+"}":k)+"). If you meant to render a collection of children, use an array instead.")}return me}function Y(T,k,F){if(T==null)return T;var Z=[],ue=0;return z(T,Z,"","",function(he){return k.call(F,he,ue++)}),Z}function ae(T){if(T._status===-1){var k=T._result;k=k(),k.then(function(F){(T._status===0||T._status===-1)&&(T._status=1,T._result=F)},function(F){(T._status===0||T._status===-1)&&(T._status=2,T._result=F)}),T._status===-1&&(T._status=0,T._result=k)}if(T._status===1)return T._result.default;throw T._result}var be=typeof reportError=="function"?reportError:function(T){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var k=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof T=="object"&&T!==null&&typeof T.message=="string"?String(T.message):String(T),error:T});if(!window.dispatchEvent(k))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",T);return}console.error(T)},De={map:Y,forEach:function(T,k,F){Y(T,function(){k.apply(this,arguments)},F)},count:function(T){var k=0;return Y(T,function(){k++}),k},toArray:function(T){return Y(T,function(k){return k})||[]},only:function(T){if(!ne(T))throw Error("React.Children.only expected to receive a single React element child.");return T}};return pe.Activity=x,pe.Children=De,pe.Component=X,pe.Fragment=s,pe.Profiler=u,pe.PureComponent=H,pe.StrictMode=l,pe.Suspense=m,pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,pe.__COMPILER_RUNTIME={__proto__:null,c:function(T){return A.H.useMemoCache(T)}},pe.cache=function(T){return function(){return T.apply(null,arguments)}},pe.cacheSignal=function(){return null},pe.cloneElement=function(T,k,F){if(T==null)throw Error("The argument must be a React element, but you passed "+T+".");var Z=O({},T.props),ue=T.key;if(k!=null)for(he in k.key!==void 0&&(ue=""+k.key),k)!w.call(k,he)||he==="key"||he==="__self"||he==="__source"||he==="ref"&&k.ref===void 0||(Z[he]=k[he]);var he=arguments.length-2;if(he===1)Z.children=F;else if(1<he){for(var me=Array(he),$e=0;$e<he;$e++)me[$e]=arguments[$e+2];Z.children=me}return G(T.type,ue,Z)},pe.createContext=function(T){return T={$$typeof:d,_currentValue:T,_currentValue2:T,_threadCount:0,Provider:null,Consumer:null},T.Provider=T,T.Consumer={$$typeof:f,_context:T},T},pe.createElement=function(T,k,F){var Z,ue={},he=null;if(k!=null)for(Z in k.key!==void 0&&(he=""+k.key),k)w.call(k,Z)&&Z!=="key"&&Z!=="__self"&&Z!=="__source"&&(ue[Z]=k[Z]);var me=arguments.length-2;if(me===1)ue.children=F;else if(1<me){for(var $e=Array(me),Re=0;Re<me;Re++)$e[Re]=arguments[Re+2];ue.children=$e}if(T&&T.defaultProps)for(Z in me=T.defaultProps,me)ue[Z]===void 0&&(ue[Z]=me[Z]);return G(T,he,ue)},pe.createRef=function(){return{current:null}},pe.forwardRef=function(T){return{$$typeof:h,render:T}},pe.isValidElement=ne,pe.lazy=function(T){return{$$typeof:b,_payload:{_status:-1,_result:T},_init:ae}},pe.memo=function(T,k){return{$$typeof:g,type:T,compare:k===void 0?null:k}},pe.startTransition=function(T){var k=A.T,F={};A.T=F;try{var Z=T(),ue=A.S;ue!==null&&ue(F,Z),typeof Z=="object"&&Z!==null&&typeof Z.then=="function"&&Z.then(W,be)}catch(he){be(he)}finally{k!==null&&F.types!==null&&(k.types=F.types),A.T=k}},pe.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},pe.use=function(T){return A.H.use(T)},pe.useActionState=function(T,k,F){return A.H.useActionState(T,k,F)},pe.useCallback=function(T,k){return A.H.useCallback(T,k)},pe.useContext=function(T){return A.H.useContext(T)},pe.useDebugValue=function(){},pe.useDeferredValue=function(T,k){return A.H.useDeferredValue(T,k)},pe.useEffect=function(T,k){return A.H.useEffect(T,k)},pe.useEffectEvent=function(T){return A.H.useEffectEvent(T)},pe.useId=function(){return A.H.useId()},pe.useImperativeHandle=function(T,k,F){return A.H.useImperativeHandle(T,k,F)},pe.useInsertionEffect=function(T,k){return A.H.useInsertionEffect(T,k)},pe.useLayoutEffect=function(T,k){return A.H.useLayoutEffect(T,k)},pe.useMemo=function(T,k){return A.H.useMemo(T,k)},pe.useOptimistic=function(T,k){return A.H.useOptimistic(T,k)},pe.useReducer=function(T,k,F){return A.H.useReducer(T,k,F)},pe.useRef=function(T){return A.H.useRef(T)},pe.useState=function(T){return A.H.useState(T)},pe.useSyncExternalStore=function(T,k,F){return A.H.useSyncExternalStore(T,k,F)},pe.useTransition=function(){return A.H.useTransition()},pe.version="19.2.8",pe}var _m;function of(){return _m||(_m=1,Ac.exports=Sx()),Ac.exports}var K=of(),Mc={exports:{}},er={},Rc={exports:{}},Dc={};var Um;function wx(){return Um||(Um=1,(function(n){function i(z,Y){var ae=z.length;z.push(Y);e:for(;0<ae;){var be=ae-1>>>1,De=z[be];if(0<u(De,Y))z[be]=Y,z[ae]=De,ae=be;else break e}}function s(z){return z.length===0?null:z[0]}function l(z){if(z.length===0)return null;var Y=z[0],ae=z.pop();if(ae!==Y){z[0]=ae;e:for(var be=0,De=z.length,T=De>>>1;be<T;){var k=2*(be+1)-1,F=z[k],Z=k+1,ue=z[Z];if(0>u(F,ae))Z<De&&0>u(ue,F)?(z[be]=ue,z[Z]=ae,be=Z):(z[be]=F,z[k]=ae,be=k);else if(Z<De&&0>u(ue,ae))z[be]=ue,z[Z]=ae,be=Z;else break e}}return Y}function u(z,Y){var ae=z.sortIndex-Y.sortIndex;return ae!==0?ae:z.id-Y.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var d=Date,h=d.now();n.unstable_now=function(){return d.now()-h}}var m=[],g=[],b=1,x=null,R=3,$=!1,L=!1,O=!1,j=!1,X=typeof setTimeout=="function"?setTimeout:null,Q=typeof clearTimeout=="function"?clearTimeout:null,H=typeof setImmediate<"u"?setImmediate:null;function U(z){for(var Y=s(g);Y!==null;){if(Y.callback===null)l(g);else if(Y.startTime<=z)l(g),Y.sortIndex=Y.expirationTime,i(m,Y);else break;Y=s(g)}}function J(z){if(O=!1,U(z),!L)if(s(m)!==null)L=!0,W||(W=!0,le());else{var Y=s(g);Y!==null&&oe(J,Y.startTime-z)}}var W=!1,A=-1,w=5,G=-1;function te(){return j?!0:!(n.unstable_now()-G<w)}function ne(){if(j=!1,W){var z=n.unstable_now();G=z;var Y=!0;try{e:{L=!1,O&&(O=!1,Q(A),A=-1),$=!0;var ae=R;try{t:{for(U(z),x=s(m);x!==null&&!(x.expirationTime>z&&te());){var be=x.callback;if(typeof be=="function"){x.callback=null,R=x.priorityLevel;var De=be(x.expirationTime<=z);if(z=n.unstable_now(),typeof De=="function"){x.callback=De,U(z),Y=!0;break t}x===s(m)&&l(m),U(z)}else l(m);x=s(m)}if(x!==null)Y=!0;else{var T=s(g);T!==null&&oe(J,T.startTime-z),Y=!1}}break e}finally{x=null,R=ae,$=!1}Y=void 0}}finally{Y?le():W=!1}}}var le;if(typeof H=="function")le=function(){H(ne)};else if(typeof MessageChannel<"u"){var Ge=new MessageChannel,de=Ge.port2;Ge.port1.onmessage=ne,le=function(){de.postMessage(null)}}else le=function(){X(ne,0)};function oe(z,Y){A=X(function(){z(n.unstable_now())},Y)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(z){z.callback=null},n.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):w=0<z?Math.floor(1e3/z):5},n.unstable_getCurrentPriorityLevel=function(){return R},n.unstable_next=function(z){switch(R){case 1:case 2:case 3:var Y=3;break;default:Y=R}var ae=R;R=Y;try{return z()}finally{R=ae}},n.unstable_requestPaint=function(){j=!0},n.unstable_runWithPriority=function(z,Y){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var ae=R;R=z;try{return Y()}finally{R=ae}},n.unstable_scheduleCallback=function(z,Y,ae){var be=n.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?be+ae:be):ae=be,z){case 1:var De=-1;break;case 2:De=250;break;case 5:De=1073741823;break;case 4:De=1e4;break;default:De=5e3}return De=ae+De,z={id:b++,callback:Y,priorityLevel:z,startTime:ae,expirationTime:De,sortIndex:-1},ae>be?(z.sortIndex=ae,i(g,z),s(m)===null&&z===s(g)&&(O?(Q(A),A=-1):O=!0,oe(J,ae-be))):(z.sortIndex=De,i(m,z),L||$||(L=!0,W||(W=!0,le()))),z},n.unstable_shouldYield=te,n.unstable_wrapCallback=function(z){var Y=R;return function(){var ae=R;R=Y;try{return z.apply(this,arguments)}finally{R=ae}}}})(Dc)),Dc}var Nm;function Ex(){return Nm||(Nm=1,Rc.exports=wx()),Rc.exports}var Cc={exports:{}},wt={};var km;function Tx(){if(km)return wt;km=1;var n=of();function i(m){var g="https://react.dev/errors/"+m;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var b=2;b<arguments.length;b++)g+="&args[]="+encodeURIComponent(arguments[b])}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 l={d:{f:s,r:function(){throw Error(i(522))},D:s,C:s,L:s,m:s,X:s,S:s,M:s},p:0,findDOMNode:null},u=Symbol.for("react.portal");function f(m,g,b){var x=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:x==null?null:""+x,children:m,containerInfo:g,implementation:b}}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 wt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,wt.createPortal=function(m,g){var b=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 f(m,g,null,b)},wt.flushSync=function(m){var g=d.T,b=l.p;try{if(d.T=null,l.p=2,m)return m()}finally{d.T=g,l.p=b,l.d.f()}},wt.preconnect=function(m,g){typeof m=="string"&&(g?(g=g.crossOrigin,g=typeof g=="string"?g==="use-credentials"?g:"":void 0):g=null,l.d.C(m,g))},wt.prefetchDNS=function(m){typeof m=="string"&&l.d.D(m)},wt.preinit=function(m,g){if(typeof m=="string"&&g&&typeof g.as=="string"){var b=g.as,x=h(b,g.crossOrigin),R=typeof g.integrity=="string"?g.integrity:void 0,$=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;b==="style"?l.d.S(m,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:x,integrity:R,fetchPriority:$}):b==="script"&&l.d.X(m,{crossOrigin:x,integrity:R,fetchPriority:$,nonce:typeof g.nonce=="string"?g.nonce:void 0})}},wt.preinitModule=function(m,g){if(typeof m=="string")if(typeof g=="object"&&g!==null){if(g.as==null||g.as==="script"){var b=h(g.as,g.crossOrigin);l.d.M(m,{crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&l.d.M(m)},wt.preload=function(m,g){if(typeof m=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var b=g.as,x=h(b,g.crossOrigin);l.d.L(m,b,{crossOrigin:x,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})}},wt.preloadModule=function(m,g){if(typeof m=="string")if(g){var b=h(g.as,g.crossOrigin);l.d.m(m,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else l.d.m(m)},wt.requestFormReset=function(m){l.d.r(m)},wt.unstable_batchedUpdates=function(m,g){return m(g)},wt.useFormState=function(m,g,b){return d.H.useFormState(m,g,b)},wt.useFormStatus=function(){return d.H.useHostTransitionStatus()},wt.version="19.2.8",wt}var Lm;function Ax(){if(Lm)return Cc.exports;Lm=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Cc.exports=Tx(),Cc.exports}var jm;function Mx(){if(jm)return er;jm=1;var n=Ex(),i=of(),s=Ax();function l(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(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(f(e)!==e)throw Error(l(188))}function g(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(l(188));return t!==e?null:e}for(var a=e,r=t;;){var o=a.return;if(o===null)break;var c=o.alternate;if(c===null){if(r=o.return,r!==null){a=r;continue}break}if(o.child===c.child){for(c=o.child;c;){if(c===a)return m(o),e;if(c===r)return m(o),t;c=c.sibling}throw Error(l(188))}if(a.return!==r.return)a=o,r=c;else{for(var p=!1,y=o.child;y;){if(y===a){p=!0,a=o,r=c;break}if(y===r){p=!0,r=o,a=c;break}y=y.sibling}if(!p){for(y=c.child;y;){if(y===a){p=!0,a=c,r=o;break}if(y===r){p=!0,r=c,a=o;break}y=y.sibling}if(!p)throw Error(l(189))}}if(a.alternate!==r)throw Error(l(190))}if(a.tag!==3)throw Error(l(188));return a.stateNode.current===a?e:t}function b(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=b(e),t!==null)return t;e=e.sibling}return null}var x=Object.assign,R=Symbol.for("react.element"),$=Symbol.for("react.transitional.element"),L=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),X=Symbol.for("react.profiler"),Q=Symbol.for("react.consumer"),H=Symbol.for("react.context"),U=Symbol.for("react.forward_ref"),J=Symbol.for("react.suspense"),W=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),w=Symbol.for("react.lazy"),G=Symbol.for("react.activity"),te=Symbol.for("react.memo_cache_sentinel"),ne=Symbol.iterator;function le(e){return e===null||typeof e!="object"?null:(e=ne&&e[ne]||e["@@iterator"],typeof e=="function"?e:null)}var Ge=Symbol.for("react.client.reference");function de(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ge?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case O:return"Fragment";case X:return"Profiler";case j:return"StrictMode";case J:return"Suspense";case W:return"SuspenseList";case G:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case L:return"Portal";case H:return e.displayName||"Context";case Q:return(e._context.displayName||"Context")+".Consumer";case U:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case A:return t=e.displayName||null,t!==null?t:de(e.type)||"Memo";case w:t=e._payload,e=e._init;try{return de(e(t))}catch{}}return null}var oe=Array.isArray,z=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},be=[],De=-1;function T(e){return{current:e}}function k(e){0>De||(e.current=be[De],be[De]=null,De--)}function F(e,t){De++,be[De]=e.current,e.current=t}var Z=T(null),ue=T(null),he=T(null),me=T(null);function $e(e,t){switch(F(he,t),F(ue,e),F(Z,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Wp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Wp(t),e=Jp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}k(Z),F(Z,e)}function Re(){k(Z),k(ue),k(he)}function hn(e){e.memoizedState!==null&&F(me,e);var t=Z.current,a=Jp(t,e.type);t!==a&&(F(ue,e),F(Z,a))}function Mn(e){ue.current===e&&(k(Z),k(ue)),me.current===e&&(k(me),Qs._currentValue=ae)}var Oi,Mt;function kt(e){if(Oi===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Oi=t&&t[1]||"",Mt=-1<a.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+Oi+e+Mt}var Ee=!1;function Kt(e,t){if(!e||Ee)return"";Ee=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var 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 _=N}Reflect.construct(e,[],V)}else{try{V.call()}catch(N){_=N}e.call(V.prototype)}}else{try{throw Error()}catch(N){_=N}(V=e())&&typeof V.catch=="function"&&V.catch(function(){})}}catch(N){if(N&&_&&typeof N.stack=="string")return[N.stack,_.stack]}return[null,null]}};r.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var o=Object.getOwnPropertyDescriptor(r.DetermineComponentFrameRoot,"name");o&&o.configurable&&Object.defineProperty(r.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var c=r.DetermineComponentFrameRoot(),p=c[0],y=c[1];if(p&&y){var S=p.split(`
|
|
4
|
+
`),C=y.split(`
|
|
5
|
+
`);for(o=r=0;r<S.length&&!S[r].includes("DetermineComponentFrameRoot");)r++;for(;o<C.length&&!C[o].includes("DetermineComponentFrameRoot");)o++;if(r===S.length||o===C.length)for(r=S.length-1,o=C.length-1;1<=r&&0<=o&&S[r]!==C[o];)o--;for(;1<=r&&0<=o;r--,o--)if(S[r]!==C[o]){if(r!==1||o!==1)do if(r--,o--,0>o||S[r]!==C[o]){var B=`
|
|
6
|
+
`+S[r].replace(" at new "," at ");return e.displayName&&B.includes("<anonymous>")&&(B=B.replace("<anonymous>",e.displayName)),B}while(1<=r&&0<=o);break}}}finally{Ee=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?kt(a):""}function ee(e,t){switch(e.tag){case 26:case 27:case 5:return kt(e.type);case 16:return kt("Lazy");case 13:return e.child!==t&&t!==null?kt("Suspense Fallback"):kt("Suspense");case 19:return kt("SuspenseList");case 0:case 15:return Kt(e.type,!1);case 11:return Kt(e.type.render,!1);case 1:return Kt(e.type,!0);case 31:return kt("Activity");default:return""}}function P(e){try{var t="",a=null;do t+=ee(e,a),a=e,e=e.return;while(e);return t}catch(r){return`
|
|
7
|
+
Error generating stack: `+r.message+`
|
|
8
|
+
`+r.stack}}var ye=Object.prototype.hasOwnProperty,Ce=n.unstable_scheduleCallback,Qe=n.unstable_cancelCallback,Pe=n.unstable_shouldYield,Qt=n.unstable_requestPaint,Ve=n.unstable_now,pn=n.unstable_getCurrentPriorityLevel,xt=n.unstable_ImmediatePriority,Lt=n.unstable_UserBlockingPriority,Rn=n.unstable_NormalPriority,la=n.unstable_LowPriority,Dn=n.unstable_IdlePriority,zi=n.log,Tt=n.unstable_setDisableYieldValue,ft=null,qe=null;function St(e){if(typeof zi=="function"&&Tt(e),qe&&typeof qe.setStrictMode=="function")try{qe.setStrictMode(ft,e)}catch{}}var tt=Math.clz32?Math.clz32:ls,_i=Math.log,Ui=Math.LN2;function ls(e){return e>>>=0,e===0?32:31-(_i(e)/Ui|0)|0}var pr=256,mr=262144,gr=4194304;function Ni(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 yr(e,t,a){var r=e.pendingLanes;if(r===0)return 0;var o=0,c=e.suspendedLanes,p=e.pingedLanes;e=e.warmLanes;var y=r&134217727;return y!==0?(r=y&~c,r!==0?o=Ni(r):(p&=y,p!==0?o=Ni(p):a||(a=y&~e,a!==0&&(o=Ni(a))))):(y=r&~c,y!==0?o=Ni(y):p!==0?o=Ni(p):a||(a=r&~e,a!==0&&(o=Ni(a)))),o===0?0:t!==0&&t!==o&&(t&c)===0&&(c=o&-o,a=t&-t,c>=a||c===32&&(a&4194048)!==0)?t:o}function us(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function rv(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function Uf(){var e=gr;return gr<<=1,(gr&62914560)===0&&(gr=4194304),e}function fu(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function os(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function lv(e,t,a,r,o,c){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 B=31-tt(a),V=1<<B;y[B]=0,S[B]=-1;var _=C[B];if(_!==null)for(C[B]=null,B=0;B<_.length;B++){var N=_[B];N!==null&&(N.lane&=-536870913)}a&=~V}r!==0&&Nf(e,r,0),c!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=c&~(p&~t))}function Nf(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var r=31-tt(t);e.entangledLanes|=t,e.entanglements[r]=e.entanglements[r]|1073741824|a&261930}function kf(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var r=31-tt(a),o=1<<r;o&t|e[r]&t&&(e[r]|=t),a&=~o}}function Lf(e,t){var a=t&-t;return a=(a&42)!==0?1:du(a),(a&(e.suspendedLanes|t))!==0?0:a}function du(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 hu(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function jf(){var e=Y.p;return e!==0?e:(e=window.event,e===void 0?32:wm(e.type))}function Bf(e,t){var a=Y.p;try{return Y.p=e,t()}finally{Y.p=a}}var Jn=Math.random().toString(36).slice(2),mt="__reactFiber$"+Jn,Rt="__reactProps$"+Jn,ua="__reactContainer$"+Jn,pu="__reactEvents$"+Jn,uv="__reactListeners$"+Jn,ov="__reactHandles$"+Jn,Gf="__reactResources$"+Jn,cs="__reactMarker$"+Jn;function mu(e){delete e[mt],delete e[Rt],delete e[pu],delete e[uv],delete e[ov]}function oa(e){var t=e[mt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[ua]||a[mt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=rm(e);e!==null;){if(a=e[mt])return a;e=rm(e)}return t}e=a,a=e.parentNode}return null}function ca(e){if(e=e[mt]||e[ua]){var t=e.tag;if(t===5||t===6||t===13||t===31||t===26||t===27||t===3)return e}return null}function fs(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(l(33))}function fa(e){var t=e[Gf];return t||(t=e[Gf]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function dt(e){e[cs]=!0}var $f=new Set,If={};function ki(e,t){da(e,t),da(e+"Capture",t)}function da(e,t){for(If[e]=t,e=0;e<t.length;e++)$f.add(t[e])}var cv=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Vf={},Ff={};function fv(e){return ye.call(Ff,e)?!0:ye.call(Vf,e)?!1:cv.test(e)?Ff[e]=!0:(Vf[e]=!0,!1)}function vr(e,t,a){if(fv(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var r=t.toLowerCase().slice(0,5);if(r!=="data-"&&r!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function br(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function Cn(e,t,a,r){if(r===null)e.removeAttribute(a);else{switch(typeof r){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+r)}}function Pt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Hf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function dv(e,t,a){var r=Object.getOwnPropertyDescriptor(e.constructor.prototype,t);if(!e.hasOwnProperty(t)&&typeof r<"u"&&typeof r.get=="function"&&typeof r.set=="function"){var o=r.get,c=r.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return o.call(this)},set:function(p){a=""+p,c.call(this,p)}}),Object.defineProperty(e,t,{enumerable:r.enumerable}),{getValue:function(){return a},setValue:function(p){a=""+p},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function gu(e){if(!e._valueTracker){var t=Hf(e)?"checked":"value";e._valueTracker=dv(e,t,""+e[t])}}function qf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=Hf(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function xr(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var hv=/[\n"\\]/g;function Zt(e){return e.replace(hv,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function yu(e,t,a,r,o,c,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=""+Pt(t)):e.value!==""+Pt(t)&&(e.value=""+Pt(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?vu(e,p,Pt(t)):a!=null?vu(e,p,Pt(a)):r!=null&&e.removeAttribute("value"),o==null&&c!=null&&(e.defaultChecked=!!c),o!=null&&(e.checked=o&&typeof o!="function"&&typeof o!="symbol"),y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.name=""+Pt(y):e.removeAttribute("name")}function Yf(e,t,a,r,o,c,p,y){if(c!=null&&typeof c!="function"&&typeof c!="symbol"&&typeof c!="boolean"&&(e.type=c),t!=null||a!=null){if(!(c!=="submit"&&c!=="reset"||t!=null)){gu(e);return}a=a!=null?""+Pt(a):"",t=t!=null?""+Pt(t):a,y||t===e.value||(e.value=t),e.defaultValue=t}r=r??o,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=y?e.checked:!!r,e.defaultChecked=!!r,p!=null&&typeof p!="function"&&typeof p!="symbol"&&typeof p!="boolean"&&(e.name=p),gu(e)}function vu(e,t,a){t==="number"&&xr(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function ha(e,t,a,r){if(e=e.options,t){t={};for(var o=0;o<a.length;o++)t["$"+a[o]]=!0;for(a=0;a<e.length;a++)o=t.hasOwnProperty("$"+e[a].value),e[a].selected!==o&&(e[a].selected=o),o&&r&&(e[a].defaultSelected=!0)}else{for(a=""+Pt(a),t=null,o=0;o<e.length;o++){if(e[o].value===a){e[o].selected=!0,r&&(e[o].defaultSelected=!0);return}t!==null||e[o].disabled||(t=e[o])}t!==null&&(t.selected=!0)}}function Xf(e,t,a){if(t!=null&&(t=""+Pt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Pt(a):""}function Kf(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(l(92));if(oe(r)){if(1<r.length)throw Error(l(93));r=r[0]}a=r}a==null&&(a=""),t=a}a=Pt(t),e.defaultValue=a,r=e.textContent,r===a&&r!==""&&r!==null&&(e.value=r),gu(e)}function pa(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var pv=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function Qf(e,t,a){var r=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?r?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":r?e.setProperty(t,a):typeof a!="number"||a===0||pv.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Pf(e,t,a){if(t!=null&&typeof t!="object")throw Error(l(62));if(e=e.style,a!=null){for(var r in a)!a.hasOwnProperty(r)||t!=null&&t.hasOwnProperty(r)||(r.indexOf("--")===0?e.setProperty(r,""):r==="float"?e.cssFloat="":e[r]="");for(var o in t)r=t[o],t.hasOwnProperty(o)&&a[o]!==r&&Qf(e,o,r)}else for(var c in t)t.hasOwnProperty(c)&&Qf(e,c,t[c])}function bu(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var mv=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),gv=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Sr(e){return gv.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}function On(){}var xu=null;function Su(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var ma=null,ga=null;function Zf(e){var t=ca(e);if(t&&(e=t.stateNode)){var a=e[Rt]||null;e:switch(e=t.stateNode,t.type){case"input":if(yu(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Zt(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var o=r[Rt]||null;if(!o)throw Error(l(90));yu(r,o.value,o.defaultValue,o.defaultValue,o.checked,o.defaultChecked,o.type,o.name)}}for(t=0;t<a.length;t++)r=a[t],r.form===e.form&&qf(r)}break e;case"textarea":Xf(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&ha(e,!!a.multiple,t,!1)}}}var wu=!1;function Wf(e,t,a){if(wu)return e(t,a);wu=!0;try{var r=e(t);return r}finally{if(wu=!1,(ma!==null||ga!==null)&&(ul(),ma&&(t=ma,e=ga,ga=ma=null,Zf(t),e)))for(t=0;t<e.length;t++)Zf(e[t])}}function ds(e,t){var a=e.stateNode;if(a===null)return null;var r=a[Rt]||null;if(r===null)return null;a=r[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(e=e.type,r=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!r;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(l(231,t,typeof a));return a}var zn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Eu=!1;if(zn)try{var hs={};Object.defineProperty(hs,"passive",{get:function(){Eu=!0}}),window.addEventListener("test",hs,hs),window.removeEventListener("test",hs,hs)}catch{Eu=!1}var ei=null,Tu=null,wr=null;function Jf(){if(wr)return wr;var e,t=Tu,a=t.length,r,o="value"in ei?ei.value:ei.textContent,c=o.length;for(e=0;e<a&&t[e]===o[e];e++);var p=a-e;for(r=1;r<=p&&t[a-r]===o[c-r];r++);return wr=o.slice(e,1<r?1-r:void 0)}function Er(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 Tr(){return!0}function ed(){return!1}function Dt(e){function t(a,r,o,c,p){this._reactName=a,this._targetInst=o,this.type=r,this.nativeEvent=c,this.target=p,this.currentTarget=null;for(var y in e)e.hasOwnProperty(y)&&(a=e[y],this[y]=a?a(c):c[y]);return this.isDefaultPrevented=(c.defaultPrevented!=null?c.defaultPrevented:c.returnValue===!1)?Tr:ed,this.isPropagationStopped=ed,this}return x(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=Tr)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Tr)},persist:function(){},isPersistent:Tr}),t}var Li={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ar=Dt(Li),ps=x({},Li,{view:0,detail:0}),yv=Dt(ps),Au,Mu,ms,Mr=x({},ps,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Du,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!==ms&&(ms&&e.type==="mousemove"?(Au=e.screenX-ms.screenX,Mu=e.screenY-ms.screenY):Mu=Au=0,ms=e),Au)},movementY:function(e){return"movementY"in e?e.movementY:Mu}}),td=Dt(Mr),vv=x({},Mr,{dataTransfer:0}),bv=Dt(vv),xv=x({},ps,{relatedTarget:0}),Ru=Dt(xv),Sv=x({},Li,{animationName:0,elapsedTime:0,pseudoElement:0}),wv=Dt(Sv),Ev=x({},Li,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),Tv=Dt(Ev),Av=x({},Li,{data:0}),nd=Dt(Av),Mv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Rv={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},Dv={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Cv(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Dv[e])?!!t[e]:!1}function Du(){return Cv}var Ov=x({},ps,{key:function(e){if(e.key){var t=Mv[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Er(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?Rv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Du,charCode:function(e){return e.type==="keypress"?Er(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Er(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),zv=Dt(Ov),_v=x({},Mr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),id=Dt(_v),Uv=x({},ps,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Du}),Nv=Dt(Uv),kv=x({},Li,{propertyName:0,elapsedTime:0,pseudoElement:0}),Lv=Dt(kv),jv=x({},Mr,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Bv=Dt(jv),Gv=x({},Li,{newState:0,oldState:0}),$v=Dt(Gv),Iv=[9,13,27,32],Cu=zn&&"CompositionEvent"in window,gs=null;zn&&"documentMode"in document&&(gs=document.documentMode);var Vv=zn&&"TextEvent"in window&&!gs,ad=zn&&(!Cu||gs&&8<gs&&11>=gs),sd=" ",rd=!1;function ld(e,t){switch(e){case"keyup":return Iv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ud(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ya=!1;function Fv(e,t){switch(e){case"compositionend":return ud(t);case"keypress":return t.which!==32?null:(rd=!0,sd);case"textInput":return e=t.data,e===sd&&rd?null:e;default:return null}}function Hv(e,t){if(ya)return e==="compositionend"||!Cu&&ld(e,t)?(e=Jf(),wr=Tu=ei=null,ya=!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 ad&&t.locale!=="ko"?null:t.data;default:return null}}var qv={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function od(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!qv[e.type]:t==="textarea"}function cd(e,t,a,r){ma?ga?ga.push(r):ga=[r]:ma=r,t=ml(t,"onChange"),0<t.length&&(a=new Ar("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var ys=null,vs=null;function Yv(e){Yp(e,0)}function Rr(e){var t=fs(e);if(qf(t))return e}function fd(e,t){if(e==="change")return t}var dd=!1;if(zn){var Ou;if(zn){var zu="oninput"in document;if(!zu){var hd=document.createElement("div");hd.setAttribute("oninput","return;"),zu=typeof hd.oninput=="function"}Ou=zu}else Ou=!1;dd=Ou&&(!document.documentMode||9<document.documentMode)}function pd(){ys&&(ys.detachEvent("onpropertychange",md),vs=ys=null)}function md(e){if(e.propertyName==="value"&&Rr(vs)){var t=[];cd(t,vs,e,Su(e)),Wf(Yv,t)}}function Xv(e,t,a){e==="focusin"?(pd(),ys=t,vs=a,ys.attachEvent("onpropertychange",md)):e==="focusout"&&pd()}function Kv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Rr(vs)}function Qv(e,t){if(e==="click")return Rr(t)}function Pv(e,t){if(e==="input"||e==="change")return Rr(t)}function Zv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var jt=typeof Object.is=="function"?Object.is:Zv;function bs(e,t){if(jt(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),r=Object.keys(t);if(a.length!==r.length)return!1;for(r=0;r<a.length;r++){var o=a[r];if(!ye.call(t,o)||!jt(e[o],t[o]))return!1}return!0}function gd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function yd(e,t){var a=gd(e);e=0;for(var r;a;){if(a.nodeType===3){if(r=e+a.textContent.length,e<=t&&r>=t)return{node:a,offset:t-e};e=r}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=gd(a)}}function vd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?vd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function bd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=xr(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=xr(e.document)}return t}function _u(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var Wv=zn&&"documentMode"in document&&11>=document.documentMode,va=null,Uu=null,xs=null,Nu=!1;function xd(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Nu||va==null||va!==xr(r)||(r=va,"selectionStart"in r&&_u(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),xs&&bs(xs,r)||(xs=r,r=ml(Uu,"onSelect"),0<r.length&&(t=new Ar("onSelect","select",null,t,a),e.push({event:t,listeners:r}),t.target=va)))}function ji(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var ba={animationend:ji("Animation","AnimationEnd"),animationiteration:ji("Animation","AnimationIteration"),animationstart:ji("Animation","AnimationStart"),transitionrun:ji("Transition","TransitionRun"),transitionstart:ji("Transition","TransitionStart"),transitioncancel:ji("Transition","TransitionCancel"),transitionend:ji("Transition","TransitionEnd")},ku={},Sd={};zn&&(Sd=document.createElement("div").style,"AnimationEvent"in window||(delete ba.animationend.animation,delete ba.animationiteration.animation,delete ba.animationstart.animation),"TransitionEvent"in window||delete ba.transitionend.transition);function Bi(e){if(ku[e])return ku[e];if(!ba[e])return e;var t=ba[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in Sd)return ku[e]=t[a];return e}var wd=Bi("animationend"),Ed=Bi("animationiteration"),Td=Bi("animationstart"),Jv=Bi("transitionrun"),eb=Bi("transitionstart"),tb=Bi("transitioncancel"),Ad=Bi("transitionend"),Md=new Map,Lu="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(" ");Lu.push("scrollEnd");function mn(e,t){Md.set(e,t),ki(t,[e])}var Dr=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)},Wt=[],xa=0,ju=0;function Cr(){for(var e=xa,t=ju=xa=0;t<e;){var a=Wt[t];Wt[t++]=null;var r=Wt[t];Wt[t++]=null;var o=Wt[t];Wt[t++]=null;var c=Wt[t];if(Wt[t++]=null,r!==null&&o!==null){var p=r.pending;p===null?o.next=o:(o.next=p.next,p.next=o),r.pending=o}c!==0&&Rd(a,o,c)}}function Or(e,t,a,r){Wt[xa++]=e,Wt[xa++]=t,Wt[xa++]=a,Wt[xa++]=r,ju|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Bu(e,t,a,r){return Or(e,t,a,r),zr(e)}function Gi(e,t){return Or(e,null,null,t),zr(e)}function Rd(e,t,a){e.lanes|=a;var r=e.alternate;r!==null&&(r.lanes|=a);for(var o=!1,c=e.return;c!==null;)c.childLanes|=a,r=c.alternate,r!==null&&(r.childLanes|=a),c.tag===22&&(e=c.stateNode,e===null||e._visibility&1||(o=!0)),e=c,c=c.return;return e.tag===3?(c=e.stateNode,o&&t!==null&&(o=31-tt(a),e=c.hiddenUpdates,r=e[o],r===null?e[o]=[t]:r.push(t),t.lane=a|536870912),c):null}function zr(e){if(50<Vs)throw Vs=0,Ko=null,Error(l(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var Sa={};function nb(e,t,a,r){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bt(e,t,a,r){return new nb(e,t,a,r)}function Gu(e){return e=e.prototype,!(!e||!e.isReactComponent)}function _n(e,t){var a=e.alternate;return a===null?(a=Bt(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function Dd(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 _r(e,t,a,r,o,c){var p=0;if(r=e,typeof e=="function")Gu(e)&&(p=1);else if(typeof e=="string")p=lx(e,a,Z.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case G:return e=Bt(31,a,t,o),e.elementType=G,e.lanes=c,e;case O:return $i(a.children,o,c,t);case j:p=8,o|=24;break;case X:return e=Bt(12,a,t,o|2),e.elementType=X,e.lanes=c,e;case J:return e=Bt(13,a,t,o),e.elementType=J,e.lanes=c,e;case W:return e=Bt(19,a,t,o),e.elementType=W,e.lanes=c,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case H:p=10;break e;case Q:p=9;break e;case U:p=11;break e;case A:p=14;break e;case w:p=16,r=null;break e}p=29,a=Error(l(130,e===null?"null":typeof e,"")),r=null}return t=Bt(p,a,t,o),t.elementType=e,t.type=r,t.lanes=c,t}function $i(e,t,a,r){return e=Bt(7,e,r,t),e.lanes=a,e}function $u(e,t,a){return e=Bt(6,e,null,t),e.lanes=a,e}function Cd(e){var t=Bt(18,null,null,0);return t.stateNode=e,t}function Iu(e,t,a){return t=Bt(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Od=new WeakMap;function Jt(e,t){if(typeof e=="object"&&e!==null){var a=Od.get(e);return a!==void 0?a:(t={value:e,source:t,stack:P(t)},Od.set(e,t),t)}return{value:e,source:t,stack:P(t)}}var wa=[],Ea=0,Ur=null,Ss=0,en=[],tn=0,ti=null,vn=1,bn="";function Un(e,t){wa[Ea++]=Ss,wa[Ea++]=Ur,Ur=e,Ss=t}function zd(e,t,a){en[tn++]=vn,en[tn++]=bn,en[tn++]=ti,ti=e;var r=vn;e=bn;var o=32-tt(r)-1;r&=~(1<<o),a+=1;var c=32-tt(t)+o;if(30<c){var p=o-o%5;c=(r&(1<<p)-1).toString(32),r>>=p,o-=p,vn=1<<32-tt(t)+o|a<<o|r,bn=c+e}else vn=1<<c|a<<o|r,bn=e}function Vu(e){e.return!==null&&(Un(e,1),zd(e,1,0))}function Fu(e){for(;e===Ur;)Ur=wa[--Ea],wa[Ea]=null,Ss=wa[--Ea],wa[Ea]=null;for(;e===ti;)ti=en[--tn],en[tn]=null,bn=en[--tn],en[tn]=null,vn=en[--tn],en[tn]=null}function _d(e,t){en[tn++]=vn,en[tn++]=bn,en[tn++]=ti,vn=t.id,bn=t.overflow,ti=e}var gt=null,Fe=null,Me=!1,ni=null,nn=!1,Hu=Error(l(519));function ii(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ws(Jt(t,e)),Hu}function Ud(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[mt]=e,t[Rt]=r,a){case"dialog":Se("cancel",t),Se("close",t);break;case"iframe":case"object":case"embed":Se("load",t);break;case"video":case"audio":for(a=0;a<Hs.length;a++)Se(Hs[a],t);break;case"source":Se("error",t);break;case"img":case"image":case"link":Se("error",t),Se("load",t);break;case"details":Se("toggle",t);break;case"input":Se("invalid",t),Yf(t,r.value,r.defaultValue,r.checked,r.defaultChecked,r.type,r.name,!0);break;case"select":Se("invalid",t);break;case"textarea":Se("invalid",t),Kf(t,r.value,r.defaultValue,r.children)}a=r.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||r.suppressHydrationWarning===!0||Pp(t.textContent,a)?(r.popover!=null&&(Se("beforetoggle",t),Se("toggle",t)),r.onScroll!=null&&Se("scroll",t),r.onScrollEnd!=null&&Se("scrollend",t),r.onClick!=null&&(t.onclick=On),t=!0):t=!1,t||ii(e,!0)}function Nd(e){for(gt=e.return;gt;)switch(gt.tag){case 5:case 31:case 13:nn=!1;return;case 27:case 3:nn=!0;return;default:gt=gt.return}}function Ta(e){if(e!==gt)return!1;if(!Me)return Nd(e),Me=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||oc(e.type,e.memoizedProps)),a=!a),a&&Fe&&ii(e),Nd(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Fe=sm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Fe=sm(e)}else t===27?(t=Fe,yi(e.type)?(e=pc,pc=null,Fe=e):Fe=t):Fe=gt?sn(e.stateNode.nextSibling):null;return!0}function Ii(){Fe=gt=null,Me=!1}function qu(){var e=ni;return e!==null&&(_t===null?_t=e:_t.push.apply(_t,e),ni=null),e}function ws(e){ni===null?ni=[e]:ni.push(e)}var Yu=T(null),Vi=null,Nn=null;function ai(e,t,a){F(Yu,t._currentValue),t._currentValue=a}function kn(e){e._currentValue=Yu.current,k(Yu)}function Xu(e,t,a){for(;e!==null;){var r=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,r!==null&&(r.childLanes|=t)):r!==null&&(r.childLanes&t)!==t&&(r.childLanes|=t),e===a)break;e=e.return}}function Ku(e,t,a,r){var o=e.child;for(o!==null&&(o.return=e);o!==null;){var c=o.dependencies;if(c!==null){var p=o.child;c=c.firstContext;e:for(;c!==null;){var y=c;c=o;for(var S=0;S<t.length;S++)if(y.context===t[S]){c.lanes|=a,y=c.alternate,y!==null&&(y.lanes|=a),Xu(c.return,a,e),r||(p=null);break e}c=y.next}}else if(o.tag===18){if(p=o.return,p===null)throw Error(l(341));p.lanes|=a,c=p.alternate,c!==null&&(c.lanes|=a),Xu(p,a,e),p=null}else p=o.child;if(p!==null)p.return=o;else for(p=o;p!==null;){if(p===e){p=null;break}if(o=p.sibling,o!==null){o.return=p.return,p=o;break}p=p.return}o=p}}function Aa(e,t,a,r){e=null;for(var o=t,c=!1;o!==null;){if(!c){if((o.flags&524288)!==0)c=!0;else if((o.flags&262144)!==0)break}if(o.tag===10){var p=o.alternate;if(p===null)throw Error(l(387));if(p=p.memoizedProps,p!==null){var y=o.type;jt(o.pendingProps.value,p.value)||(e!==null?e.push(y):e=[y])}}else if(o===me.current){if(p=o.alternate,p===null)throw Error(l(387));p.memoizedState.memoizedState!==o.memoizedState.memoizedState&&(e!==null?e.push(Qs):e=[Qs])}o=o.return}e!==null&&Ku(t,e,a,r),t.flags|=262144}function Nr(e){for(e=e.firstContext;e!==null;){if(!jt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Fi(e){Vi=e,Nn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yt(e){return kd(Vi,e)}function kr(e,t){return Vi===null&&Fi(e),kd(e,t)}function kd(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Nn===null){if(e===null)throw Error(l(308));Nn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Nn=Nn.next=t;return a}var ib=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,r){e.push(r)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},ab=n.unstable_scheduleCallback,sb=n.unstable_NormalPriority,st={$$typeof:H,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qu(){return{controller:new ib,data:new Map,refCount:0}}function Es(e){e.refCount--,e.refCount===0&&ab(sb,function(){e.controller.abort()})}var Ts=null,Pu=0,Ma=0,Ra=null;function rb(e,t){if(Ts===null){var a=Ts=[];Pu=0,Ma=ec(),Ra={status:"pending",value:void 0,then:function(r){a.push(r)}}}return Pu++,t.then(Ld,Ld),t}function Ld(){if(--Pu===0&&Ts!==null){Ra!==null&&(Ra.status="fulfilled");var e=Ts;Ts=null,Ma=0,Ra=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function lb(e,t){var a=[],r={status:"pending",value:null,reason:null,then:function(o){a.push(o)}};return e.then(function(){r.status="fulfilled",r.value=t;for(var o=0;o<a.length;o++)(0,a[o])(t)},function(o){for(r.status="rejected",r.reason=o,o=0;o<a.length;o++)(0,a[o])(void 0)}),r}var jd=z.S;z.S=function(e,t){xp=Ve(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&rb(e,t),jd!==null&&jd(e,t)};var Hi=T(null);function Zu(){var e=Hi.current;return e!==null?e:Ie.pooledCache}function Lr(e,t){t===null?F(Hi,Hi.current):F(Hi,t.pool)}function Bd(){var e=Zu();return e===null?null:{parent:st._currentValue,pool:e}}var Da=Error(l(460)),Wu=Error(l(474)),jr=Error(l(542)),Br={then:function(){}};function Gd(e){return e=e.status,e==="fulfilled"||e==="rejected"}function $d(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(On,On),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Vd(e),e;default:if(typeof t.status=="string")t.then(On,On);else{if(e=Ie,e!==null&&100<e.shellSuspendCounter)throw Error(l(482));e=t,e.status="pending",e.then(function(r){if(t.status==="pending"){var o=t;o.status="fulfilled",o.value=r}},function(r){if(t.status==="pending"){var o=t;o.status="rejected",o.reason=r}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Vd(e),e}throw Yi=t,Da}}function qi(e){try{var t=e._init;return t(e._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(Yi=a,Da):a}}var Yi=null;function Id(){if(Yi===null)throw Error(l(459));var e=Yi;return Yi=null,e}function Vd(e){if(e===Da||e===jr)throw Error(l(483))}var Ca=null,As=0;function Gr(e){var t=As;return As+=1,Ca===null&&(Ca=[]),$d(Ca,e,t)}function Ms(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function $r(e,t){throw t.$$typeof===R?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Fd(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 r(M){for(var E=new Map;M!==null;)M.key!==null?E.set(M.key,M):E.set(M.index,M),M=M.sibling;return E}function o(M,E){return M=_n(M,E),M.index=0,M.sibling=null,M}function c(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=$u(D,M.mode,I),E.return=M,E):(E=o(E,D),E.return=M,E)}function S(M,E,D,I){var ce=D.type;return ce===O?B(M,E,D.props.children,I,D.key):E!==null&&(E.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===w&&qi(ce)===E.type)?(E=o(E,D.props),Ms(E,D),E.return=M,E):(E=_r(D.type,D.key,D.props,null,M.mode,I),Ms(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=Iu(D,M.mode,I),E.return=M,E):(E=o(E,D.children||[]),E.return=M,E)}function B(M,E,D,I,ce){return E===null||E.tag!==7?(E=$i(D,M.mode,I,ce),E.return=M,E):(E=o(E,D),E.return=M,E)}function V(M,E,D){if(typeof E=="string"&&E!==""||typeof E=="number"||typeof E=="bigint")return E=$u(""+E,M.mode,D),E.return=M,E;if(typeof E=="object"&&E!==null){switch(E.$$typeof){case $:return D=_r(E.type,E.key,E.props,null,M.mode,D),Ms(D,E),D.return=M,D;case L:return E=Iu(E,M.mode,D),E.return=M,E;case w:return E=qi(E),V(M,E,D)}if(oe(E)||le(E))return E=$i(E,M.mode,D,null),E.return=M,E;if(typeof E.then=="function")return V(M,Gr(E),D);if(E.$$typeof===H)return V(M,kr(M,E),D);$r(M,E)}return null}function _(M,E,D,I){var ce=E!==null?E.key:null;if(typeof D=="string"&&D!==""||typeof D=="number"||typeof D=="bigint")return ce!==null?null:y(M,E,""+D,I);if(typeof D=="object"&&D!==null){switch(D.$$typeof){case $:return D.key===ce?S(M,E,D,I):null;case L:return D.key===ce?C(M,E,D,I):null;case w:return D=qi(D),_(M,E,D,I)}if(oe(D)||le(D))return ce!==null?null:B(M,E,D,I,null);if(typeof D.then=="function")return _(M,E,Gr(D),I);if(D.$$typeof===H)return _(M,E,kr(M,D),I);$r(M,D)}return null}function N(M,E,D,I,ce){if(typeof I=="string"&&I!==""||typeof I=="number"||typeof I=="bigint")return M=M.get(D)||null,y(E,M,""+I,ce);if(typeof I=="object"&&I!==null){switch(I.$$typeof){case $:return M=M.get(I.key===null?D:I.key)||null,S(E,M,I,ce);case L:return M=M.get(I.key===null?D:I.key)||null,C(E,M,I,ce);case w:return I=qi(I),N(M,E,D,I,ce)}if(oe(I)||le(I))return M=M.get(D)||null,B(E,M,I,ce,null);if(typeof I.then=="function")return N(M,E,D,Gr(I),ce);if(I.$$typeof===H)return N(M,E,D,kr(E,I),ce);$r(E,I)}return null}function ie(M,E,D,I){for(var ce=null,Oe=null,re=E,ve=E=0,Ae=null;re!==null&&ve<D.length;ve++){re.index>ve?(Ae=re,re=null):Ae=re.sibling;var ze=_(M,re,D[ve],I);if(ze===null){re===null&&(re=Ae);break}e&&re&&ze.alternate===null&&t(M,re),E=c(ze,E,ve),Oe===null?ce=ze:Oe.sibling=ze,Oe=ze,re=Ae}if(ve===D.length)return a(M,re),Me&&Un(M,ve),ce;if(re===null){for(;ve<D.length;ve++)re=V(M,D[ve],I),re!==null&&(E=c(re,E,ve),Oe===null?ce=re:Oe.sibling=re,Oe=re);return Me&&Un(M,ve),ce}for(re=r(re);ve<D.length;ve++)Ae=N(re,M,ve,D[ve],I),Ae!==null&&(e&&Ae.alternate!==null&&re.delete(Ae.key===null?ve:Ae.key),E=c(Ae,E,ve),Oe===null?ce=Ae:Oe.sibling=Ae,Oe=Ae);return e&&re.forEach(function(wi){return t(M,wi)}),Me&&Un(M,ve),ce}function fe(M,E,D,I){if(D==null)throw Error(l(151));for(var ce=null,Oe=null,re=E,ve=E=0,Ae=null,ze=D.next();re!==null&&!ze.done;ve++,ze=D.next()){re.index>ve?(Ae=re,re=null):Ae=re.sibling;var wi=_(M,re,ze.value,I);if(wi===null){re===null&&(re=Ae);break}e&&re&&wi.alternate===null&&t(M,re),E=c(wi,E,ve),Oe===null?ce=wi:Oe.sibling=wi,Oe=wi,re=Ae}if(ze.done)return a(M,re),Me&&Un(M,ve),ce;if(re===null){for(;!ze.done;ve++,ze=D.next())ze=V(M,ze.value,I),ze!==null&&(E=c(ze,E,ve),Oe===null?ce=ze:Oe.sibling=ze,Oe=ze);return Me&&Un(M,ve),ce}for(re=r(re);!ze.done;ve++,ze=D.next())ze=N(re,M,ve,ze.value,I),ze!==null&&(e&&ze.alternate!==null&&re.delete(ze.key===null?ve:ze.key),E=c(ze,E,ve),Oe===null?ce=ze:Oe.sibling=ze,Oe=ze);return e&&re.forEach(function(vx){return t(M,vx)}),Me&&Un(M,ve),ce}function Be(M,E,D,I){if(typeof D=="object"&&D!==null&&D.type===O&&D.key===null&&(D=D.props.children),typeof D=="object"&&D!==null){switch(D.$$typeof){case $:e:{for(var ce=D.key;E!==null;){if(E.key===ce){if(ce=D.type,ce===O){if(E.tag===7){a(M,E.sibling),I=o(E,D.props.children),I.return=M,M=I;break e}}else if(E.elementType===ce||typeof ce=="object"&&ce!==null&&ce.$$typeof===w&&qi(ce)===E.type){a(M,E.sibling),I=o(E,D.props),Ms(I,D),I.return=M,M=I;break e}a(M,E);break}else t(M,E);E=E.sibling}D.type===O?(I=$i(D.props.children,M.mode,I,D.key),I.return=M,M=I):(I=_r(D.type,D.key,D.props,null,M.mode,I),Ms(I,D),I.return=M,M=I)}return p(M);case L:e:{for(ce=D.key;E!==null;){if(E.key===ce)if(E.tag===4&&E.stateNode.containerInfo===D.containerInfo&&E.stateNode.implementation===D.implementation){a(M,E.sibling),I=o(E,D.children||[]),I.return=M,M=I;break e}else{a(M,E);break}else t(M,E);E=E.sibling}I=Iu(D,M.mode,I),I.return=M,M=I}return p(M);case w:return D=qi(D),Be(M,E,D,I)}if(oe(D))return ie(M,E,D,I);if(le(D)){if(ce=le(D),typeof ce!="function")throw Error(l(150));return D=ce.call(D),fe(M,E,D,I)}if(typeof D.then=="function")return Be(M,E,Gr(D),I);if(D.$$typeof===H)return Be(M,E,kr(M,D),I);$r(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=o(E,D),I.return=M,M=I):(a(M,E),I=$u(D,M.mode,I),I.return=M,M=I),p(M)):a(M,E)}return function(M,E,D,I){try{As=0;var ce=Be(M,E,D,I);return Ca=null,ce}catch(re){if(re===Da||re===jr)throw re;var Oe=Bt(29,re,null,M.mode);return Oe.lanes=I,Oe.return=M,Oe}}}var Xi=Fd(!0),Hd=Fd(!1),si=!1;function Ju(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eo(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ri(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function li(e,t,a){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(_e&2)!==0){var o=r.pending;return o===null?t.next=t:(t.next=o.next,o.next=t),r.pending=t,t=zr(e),Rd(e,null,a),t}return Or(e,r,t,a),zr(e)}function Rs(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,kf(e,a)}}function to(e,t){var a=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,a===r)){var o=null,c=null;if(a=a.firstBaseUpdate,a!==null){do{var p={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};c===null?o=c=p:c=c.next=p,a=a.next}while(a!==null);c===null?o=c=t:c=c.next=t}else o=c=t;a={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:c,shared:r.shared,callbacks:r.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var no=!1;function Ds(){if(no){var e=Ra;if(e!==null)throw e}}function Cs(e,t,a,r){no=!1;var o=e.updateQueue;si=!1;var c=o.firstBaseUpdate,p=o.lastBaseUpdate,y=o.shared.pending;if(y!==null){o.shared.pending=null;var S=y,C=S.next;S.next=null,p===null?c=C:p.next=C,p=S;var B=e.alternate;B!==null&&(B=B.updateQueue,y=B.lastBaseUpdate,y!==p&&(y===null?B.firstBaseUpdate=C:y.next=C,B.lastBaseUpdate=S))}if(c!==null){var V=o.baseState;p=0,B=C=S=null,y=c;do{var _=y.lane&-536870913,N=_!==y.lane;if(N?(Te&_)===_:(r&_)===_){_!==0&&_===Ma&&(no=!0),B!==null&&(B=B.next={lane:0,tag:y.tag,payload:y.payload,callback:null,next:null});e:{var ie=e,fe=y;_=t;var Be=a;switch(fe.tag){case 1:if(ie=fe.payload,typeof ie=="function"){V=ie.call(Be,V,_);break e}V=ie;break e;case 3:ie.flags=ie.flags&-65537|128;case 0:if(ie=fe.payload,_=typeof ie=="function"?ie.call(Be,V,_):ie,_==null)break e;V=x({},V,_);break e;case 2:si=!0}}_=y.callback,_!==null&&(e.flags|=64,N&&(e.flags|=8192),N=o.callbacks,N===null?o.callbacks=[_]:N.push(_))}else N={lane:_,tag:y.tag,payload:y.payload,callback:y.callback,next:null},B===null?(C=B=N,S=V):B=B.next=N,p|=_;if(y=y.next,y===null){if(y=o.shared.pending,y===null)break;N=y,y=N.next,N.next=null,o.lastBaseUpdate=N,o.shared.pending=null}}while(!0);B===null&&(S=V),o.baseState=S,o.firstBaseUpdate=C,o.lastBaseUpdate=B,c===null&&(o.shared.lanes=0),di|=p,e.lanes=p,e.memoizedState=V}}function qd(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Yd(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)qd(a[e],t)}var Oa=T(null),Ir=T(0);function Xd(e,t){e=Hn,F(Ir,e),F(Oa,t),Hn=e|t.baseLanes}function io(){F(Ir,Hn),F(Oa,Oa.current)}function ao(){Hn=Ir.current,k(Oa),k(Ir)}var Gt=T(null),an=null;function ui(e){var t=e.alternate;F(nt,nt.current&1),F(Gt,e),an===null&&(t===null||Oa.current!==null||t.memoizedState!==null)&&(an=e)}function so(e){F(nt,nt.current),F(Gt,e),an===null&&(an=e)}function Kd(e){e.tag===22?(F(nt,nt.current),F(Gt,e),an===null&&(an=e)):oi()}function oi(){F(nt,nt.current),F(Gt,Gt.current)}function $t(e){k(Gt),an===e&&(an=null),k(nt)}var nt=T(0);function Vr(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||dc(a)||hc(a)))return t}else if(t.tag===19&&(t.memoizedProps.revealOrder==="forwards"||t.memoizedProps.revealOrder==="backwards"||t.memoizedProps.revealOrder==="unstable_legacy-backwards"||t.memoizedProps.revealOrder==="together")){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}var Ln=0,ge=null,Le=null,rt=null,Fr=!1,za=!1,Ki=!1,Hr=0,Os=0,_a=null,ub=0;function We(){throw Error(l(321))}function ro(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!jt(e[a],t[a]))return!1;return!0}function lo(e,t,a,r,o,c){return Ln=c,ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,z.H=e===null||e.memoizedState===null?zh:Eo,Ki=!1,c=a(r,o),Ki=!1,za&&(c=Pd(t,a,r,o)),Qd(e),c}function Qd(e){z.H=Us;var t=Le!==null&&Le.next!==null;if(Ln=0,rt=Le=ge=null,Fr=!1,Os=0,_a=null,t)throw Error(l(300));e===null||lt||(e=e.dependencies,e!==null&&Nr(e)&&(lt=!0))}function Pd(e,t,a,r){ge=e;var o=0;do{if(za&&(_a=null),Os=0,za=!1,25<=o)throw Error(l(301));if(o+=1,rt=Le=null,e.updateQueue!=null){var c=e.updateQueue;c.lastEffect=null,c.events=null,c.stores=null,c.memoCache!=null&&(c.memoCache.index=0)}z.H=_h,c=t(a,r)}while(za);return c}function ob(){var e=z.H,t=e.useState()[0];return t=typeof t.then=="function"?zs(t):t,e=e.useState()[0],(Le!==null?Le.memoizedState:null)!==e&&(ge.flags|=1024),t}function uo(){var e=Hr!==0;return Hr=0,e}function oo(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function co(e){if(Fr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}Fr=!1}Ln=0,rt=Le=ge=null,za=!1,Os=Hr=0,_a=null}function At(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return rt===null?ge.memoizedState=rt=e:rt=rt.next=e,rt}function it(){if(Le===null){var e=ge.alternate;e=e!==null?e.memoizedState:null}else e=Le.next;var t=rt===null?ge.memoizedState:rt.next;if(t!==null)rt=t,Le=e;else{if(e===null)throw ge.alternate===null?Error(l(467)):Error(l(310));Le=e,e={memoizedState:Le.memoizedState,baseState:Le.baseState,baseQueue:Le.baseQueue,queue:Le.queue,next:null},rt===null?ge.memoizedState=rt=e:rt=rt.next=e}return rt}function qr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function zs(e){var t=Os;return Os+=1,_a===null&&(_a=[]),e=$d(_a,e,t),t=ge,(rt===null?t.memoizedState:rt.next)===null&&(t=t.alternate,z.H=t===null||t.memoizedState===null?zh:Eo),e}function Yr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return zs(e);if(e.$$typeof===H)return yt(e)}throw Error(l(438,String(e)))}function fo(e){var t=null,a=ge.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var r=ge.alternate;r!==null&&(r=r.updateQueue,r!==null&&(r=r.memoCache,r!=null&&(t={data:r.data.map(function(o){return o.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=qr(),ge.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),r=0;r<e;r++)a[r]=te;return t.index++,a}function jn(e,t){return typeof t=="function"?t(e):t}function Xr(e){var t=it();return ho(t,Le,e)}function ho(e,t,a){var r=e.queue;if(r===null)throw Error(l(311));r.lastRenderedReducer=a;var o=e.baseQueue,c=r.pending;if(c!==null){if(o!==null){var p=o.next;o.next=c.next,c.next=p}t.baseQueue=o=c,r.pending=null}if(c=e.baseState,o===null)e.memoizedState=c;else{t=o.next;var y=p=null,S=null,C=t,B=!1;do{var V=C.lane&-536870913;if(V!==C.lane?(Te&V)===V:(Ln&V)===V){var _=C.revertLane;if(_===0)S!==null&&(S=S.next={lane:0,revertLane:0,gesture:null,action:C.action,hasEagerState:C.hasEagerState,eagerState:C.eagerState,next:null}),V===Ma&&(B=!0);else if((Ln&_)===_){C=C.next,_===Ma&&(B=!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=c):S=S.next=V,ge.lanes|=_,di|=_;V=C.action,Ki&&a(c,V),c=C.hasEagerState?C.eagerState:a(c,V)}else _={lane:V,revertLane:C.revertLane,gesture:C.gesture,action:C.action,hasEagerState:C.hasEagerState,eagerState:C.eagerState,next:null},S===null?(y=S=_,p=c):S=S.next=_,ge.lanes|=V,di|=V;C=C.next}while(C!==null&&C!==t);if(S===null?p=c:S.next=y,!jt(c,e.memoizedState)&&(lt=!0,B&&(a=Ra,a!==null)))throw a;e.memoizedState=c,e.baseState=p,e.baseQueue=S,r.lastRenderedState=c}return o===null&&(r.lanes=0),[e.memoizedState,r.dispatch]}function po(e){var t=it(),a=t.queue;if(a===null)throw Error(l(311));a.lastRenderedReducer=e;var r=a.dispatch,o=a.pending,c=t.memoizedState;if(o!==null){a.pending=null;var p=o=o.next;do c=e(c,p.action),p=p.next;while(p!==o);jt(c,t.memoizedState)||(lt=!0),t.memoizedState=c,t.baseQueue===null&&(t.baseState=c),a.lastRenderedState=c}return[c,r]}function Zd(e,t,a){var r=ge,o=it(),c=Me;if(c){if(a===void 0)throw Error(l(407));a=a()}else a=t();var p=!jt((Le||o).memoizedState,a);if(p&&(o.memoizedState=a,lt=!0),o=o.queue,yo(eh.bind(null,r,o,e),[e]),o.getSnapshot!==t||p||rt!==null&&rt.memoizedState.tag&1){if(r.flags|=2048,Ua(9,{destroy:void 0},Jd.bind(null,r,o,a,t),null),Ie===null)throw Error(l(349));c||(Ln&127)!==0||Wd(r,t,a)}return a}function Wd(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=ge.updateQueue,t===null?(t=qr(),ge.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Jd(e,t,a,r){t.value=a,t.getSnapshot=r,th(t)&&nh(e)}function eh(e,t,a){return a(function(){th(t)&&nh(e)})}function th(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!jt(e,a)}catch{return!0}}function nh(e){var t=Gi(e,2);t!==null&&Ut(t,e,2)}function mo(e){var t=At();if(typeof e=="function"){var a=e;if(e=a(),Ki){St(!0);try{a()}finally{St(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:jn,lastRenderedState:e},t}function ih(e,t,a,r){return e.baseState=a,ho(e,Le,typeof r=="function"?r:jn)}function cb(e,t,a,r,o){if(Pr(e))throw Error(l(485));if(e=t.action,e!==null){var c={payload:o,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(p){c.listeners.push(p)}};z.T!==null?a(!0):c.isTransition=!1,r(c),a=t.pending,a===null?(c.next=t.pending=c,ah(t,c)):(c.next=a.next,t.pending=a.next=c)}}function ah(e,t){var a=t.action,r=t.payload,o=e.state;if(t.isTransition){var c=z.T,p={};z.T=p;try{var y=a(o,r),S=z.S;S!==null&&S(p,y),sh(e,t,y)}catch(C){go(e,t,C)}finally{c!==null&&p.types!==null&&(c.types=p.types),z.T=c}}else try{c=a(o,r),sh(e,t,c)}catch(C){go(e,t,C)}}function sh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){rh(e,t,r)},function(r){return go(e,t,r)}):rh(e,t,a)}function rh(e,t,a){t.status="fulfilled",t.value=a,lh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,ah(e,a)))}function go(e,t,a){var r=e.pending;if(e.pending=null,r!==null){r=r.next;do t.status="rejected",t.reason=a,lh(t),t=t.next;while(t!==r)}e.action=null}function lh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function uh(e,t){return t}function oh(e,t){if(Me){var a=Ie.formState;if(a!==null){e:{var r=ge;if(Me){if(Fe){t:{for(var o=Fe,c=nn;o.nodeType!==8;){if(!c){o=null;break t}if(o=sn(o.nextSibling),o===null){o=null;break t}}c=o.data,o=c==="F!"||c==="F"?o:null}if(o){Fe=sn(o.nextSibling),r=o.data==="F!";break e}}ii(r)}r=!1}r&&(t=a[0])}}return a=At(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:uh,lastRenderedState:t},a.queue=r,a=Dh.bind(null,ge,r),r.dispatch=a,r=mo(!1),c=wo.bind(null,ge,!1,r.queue),r=At(),o={state:t,dispatch:null,action:e,pending:null},r.queue=o,a=cb.bind(null,ge,o,c,a),o.dispatch=a,r.memoizedState=e,[t,a,!1]}function ch(e){var t=it();return fh(t,Le,e)}function fh(e,t,a){if(t=ho(e,t,uh)[0],e=Xr(jn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=zs(t)}catch(p){throw p===Da?jr:p}else r=t;t=it();var o=t.queue,c=o.dispatch;return a!==t.memoizedState&&(ge.flags|=2048,Ua(9,{destroy:void 0},fb.bind(null,o,a),null)),[r,c,e]}function fb(e,t){e.action=t}function dh(e){var t=it(),a=Le;if(a!==null)return fh(t,a,e);it(),t=t.memoizedState,a=it();var r=a.queue.dispatch;return a.memoizedState=e,[t,r,!1]}function Ua(e,t,a,r){return e={tag:e,create:a,deps:r,inst:t,next:null},t=ge.updateQueue,t===null&&(t=qr(),ge.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(r=a.next,a.next=e,e.next=r,t.lastEffect=e),e}function hh(){return it().memoizedState}function Kr(e,t,a,r){var o=At();ge.flags|=e,o.memoizedState=Ua(1|t,{destroy:void 0},a,r===void 0?null:r)}function Qr(e,t,a,r){var o=it();r=r===void 0?null:r;var c=o.memoizedState.inst;Le!==null&&r!==null&&ro(r,Le.memoizedState.deps)?o.memoizedState=Ua(t,c,a,r):(ge.flags|=e,o.memoizedState=Ua(1|t,c,a,r))}function ph(e,t){Kr(8390656,8,e,t)}function yo(e,t){Qr(2048,8,e,t)}function db(e){ge.flags|=4;var t=ge.updateQueue;if(t===null)t=qr(),ge.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 db({ref:t,nextImpl:e}),function(){if((_e&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function gh(e,t){return Qr(4,2,e,t)}function yh(e,t){return Qr(4,4,e,t)}function vh(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 bh(e,t,a){a=a!=null?a.concat([e]):null,Qr(4,4,vh.bind(null,t,e),a)}function vo(){}function xh(e,t){var a=it();t=t===void 0?null:t;var r=a.memoizedState;return t!==null&&ro(t,r[1])?r[0]:(a.memoizedState=[e,t],e)}function Sh(e,t){var a=it();t=t===void 0?null:t;var r=a.memoizedState;if(t!==null&&ro(t,r[1]))return r[0];if(r=e(),Ki){St(!0);try{e()}finally{St(!1)}}return a.memoizedState=[r,t],r}function bo(e,t,a){return a===void 0||(Ln&1073741824)!==0&&(Te&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=wp(),ge.lanes|=e,di|=e,a)}function wh(e,t,a,r){return jt(a,t)?a:Oa.current!==null?(e=bo(e,a,r),jt(e,t)||(lt=!0),e):(Ln&42)===0||(Ln&1073741824)!==0&&(Te&261930)===0?(lt=!0,e.memoizedState=a):(e=wp(),ge.lanes|=e,di|=e,t)}function Eh(e,t,a,r,o){var c=Y.p;Y.p=c!==0&&8>c?c:8;var p=z.T,y={};z.T=y,wo(e,!1,t,a);try{var S=o(),C=z.S;if(C!==null&&C(y,S),S!==null&&typeof S=="object"&&typeof S.then=="function"){var B=lb(S,r);_s(e,t,B,Ft(e))}else _s(e,t,r,Ft(e))}catch(V){_s(e,t,{then:function(){},status:"rejected",reason:V},Ft())}finally{Y.p=c,p!==null&&y.types!==null&&(p.types=y.types),z.T=p}}function hb(){}function xo(e,t,a,r){if(e.tag!==5)throw Error(l(476));var o=Th(e).queue;Eh(e,o,t,ae,a===null?hb:function(){return Ah(e),a(r)})}function Th(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:ae,baseState:ae,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jn,lastRenderedState:ae},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:jn,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function Ah(e){var t=Th(e);t.next===null&&(t=e.alternate.memoizedState),_s(e,t.next.queue,{},Ft())}function So(){return yt(Qs)}function Mh(){return it().memoizedState}function Rh(){return it().memoizedState}function pb(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=Ft();e=ri(a);var r=li(t,e,a);r!==null&&(Ut(r,t,a),Rs(r,t,a)),t={cache:Qu()},e.payload=t;return}t=t.return}}function mb(e,t,a){var r=Ft();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Pr(e)?Ch(t,a):(a=Bu(e,t,a,r),a!==null&&(Ut(a,e,r),Oh(a,t,r)))}function Dh(e,t,a){var r=Ft();_s(e,t,a,r)}function _s(e,t,a,r){var o={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(Pr(e))Ch(t,o);else{var c=e.alternate;if(e.lanes===0&&(c===null||c.lanes===0)&&(c=t.lastRenderedReducer,c!==null))try{var p=t.lastRenderedState,y=c(p,a);if(o.hasEagerState=!0,o.eagerState=y,jt(y,p))return Or(e,t,o,0),Ie===null&&Cr(),!1}catch{}if(a=Bu(e,t,o,r),a!==null)return Ut(a,e,r),Oh(a,t,r),!0}return!1}function wo(e,t,a,r){if(r={lane:2,revertLane:ec(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Pr(e)){if(t)throw Error(l(479))}else t=Bu(e,a,r,2),t!==null&&Ut(t,e,2)}function Pr(e){var t=e.alternate;return e===ge||t!==null&&t===ge}function Ch(e,t){za=Fr=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function Oh(e,t,a){if((a&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,a|=r,t.lanes=a,kf(e,a)}}var Us={readContext:yt,use:Yr,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};Us.useEffectEvent=We;var zh={readContext:yt,use:Yr,useCallback:function(e,t){return At().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:ph,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Kr(4194308,4,vh.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Kr(4194308,4,e,t)},useInsertionEffect:function(e,t){Kr(4,2,e,t)},useMemo:function(e,t){var a=At();t=t===void 0?null:t;var r=e();if(Ki){St(!0);try{e()}finally{St(!1)}}return a.memoizedState=[r,t],r},useReducer:function(e,t,a){var r=At();if(a!==void 0){var o=a(t);if(Ki){St(!0);try{a(t)}finally{St(!1)}}}else o=t;return r.memoizedState=r.baseState=o,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:o},r.queue=e,e=e.dispatch=mb.bind(null,ge,e),[r.memoizedState,e]},useRef:function(e){var t=At();return e={current:e},t.memoizedState=e},useState:function(e){e=mo(e);var t=e.queue,a=Dh.bind(null,ge,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:vo,useDeferredValue:function(e,t){var a=At();return bo(a,e,t)},useTransition:function(){var e=mo(!1);return e=Eh.bind(null,ge,e.queue,!0,!1),At().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=ge,o=At();if(Me){if(a===void 0)throw Error(l(407));a=a()}else{if(a=t(),Ie===null)throw Error(l(349));(Te&127)!==0||Wd(r,t,a)}o.memoizedState=a;var c={value:a,getSnapshot:t};return o.queue=c,ph(eh.bind(null,r,c,e),[e]),r.flags|=2048,Ua(9,{destroy:void 0},Jd.bind(null,r,c,a,t),null),a},useId:function(){var e=At(),t=Ie.identifierPrefix;if(Me){var a=bn,r=vn;a=(r&~(1<<32-tt(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Hr++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=ub++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:So,useFormState:oh,useActionState:oh,useOptimistic:function(e){var t=At();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=wo.bind(null,ge,!0,a),a.dispatch=t,[e,t]},useMemoCache:fo,useCacheRefresh:function(){return At().memoizedState=pb.bind(null,ge)},useEffectEvent:function(e){var t=At(),a={impl:e};return t.memoizedState=a,function(){if((_e&2)!==0)throw Error(l(440));return a.impl.apply(void 0,arguments)}}},Eo={readContext:yt,use:Yr,useCallback:xh,useContext:yt,useEffect:yo,useImperativeHandle:bh,useInsertionEffect:gh,useLayoutEffect:yh,useMemo:Sh,useReducer:Xr,useRef:hh,useState:function(){return Xr(jn)},useDebugValue:vo,useDeferredValue:function(e,t){var a=it();return wh(a,Le.memoizedState,e,t)},useTransition:function(){var e=Xr(jn)[0],t=it().memoizedState;return[typeof e=="boolean"?e:zs(e),t]},useSyncExternalStore:Zd,useId:Mh,useHostTransitionStatus:So,useFormState:ch,useActionState:ch,useOptimistic:function(e,t){var a=it();return ih(a,Le,e,t)},useMemoCache:fo,useCacheRefresh:Rh};Eo.useEffectEvent=mh;var _h={readContext:yt,use:Yr,useCallback:xh,useContext:yt,useEffect:yo,useImperativeHandle:bh,useInsertionEffect:gh,useLayoutEffect:yh,useMemo:Sh,useReducer:po,useRef:hh,useState:function(){return po(jn)},useDebugValue:vo,useDeferredValue:function(e,t){var a=it();return Le===null?bo(a,e,t):wh(a,Le.memoizedState,e,t)},useTransition:function(){var e=po(jn)[0],t=it().memoizedState;return[typeof e=="boolean"?e:zs(e),t]},useSyncExternalStore:Zd,useId:Mh,useHostTransitionStatus:So,useFormState:dh,useActionState:dh,useOptimistic:function(e,t){var a=it();return Le!==null?ih(a,Le,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:fo,useCacheRefresh:Rh};_h.useEffectEvent=mh;function To(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:x({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var Ao={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=Ft(),o=ri(r);o.payload=t,a!=null&&(o.callback=a),t=li(e,o,r),t!==null&&(Ut(t,e,r),Rs(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=Ft(),o=ri(r);o.tag=1,o.payload=t,a!=null&&(o.callback=a),t=li(e,o,r),t!==null&&(Ut(t,e,r),Rs(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=Ft(),r=ri(a);r.tag=2,t!=null&&(r.callback=t),t=li(e,r,a),t!==null&&(Ut(t,e,a),Rs(t,e,a))}};function Uh(e,t,a,r,o,c,p){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(r,c,p):t.prototype&&t.prototype.isPureReactComponent?!bs(a,r)||!bs(o,c):!0}function Nh(e,t,a,r){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,r),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,r),t.state!==e&&Ao.enqueueReplaceState(t,t.state,null)}function Qi(e,t){var a=t;if("ref"in t){a={};for(var r in t)r!=="ref"&&(a[r]=t[r])}if(e=e.defaultProps){a===t&&(a=x({},a));for(var o in e)a[o]===void 0&&(a[o]=e[o])}return a}function kh(e){Dr(e)}function Lh(e){console.error(e)}function jh(e){Dr(e)}function Zr(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function Bh(e,t,a){try{var r=e.onCaughtError;r(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(o){setTimeout(function(){throw o})}}function Mo(e,t,a){return a=ri(a),a.tag=3,a.payload={element:null},a.callback=function(){Zr(e,t)},a}function Gh(e){return e=ri(e),e.tag=3,e}function $h(e,t,a,r){var o=a.type.getDerivedStateFromError;if(typeof o=="function"){var c=r.value;e.payload=function(){return o(c)},e.callback=function(){Bh(t,a,r)}}var p=a.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){Bh(t,a,r),typeof o!="function"&&(hi===null?hi=new Set([this]):hi.add(this));var y=r.stack;this.componentDidCatch(r.value,{componentStack:y!==null?y:""})})}function gb(e,t,a,r,o){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&Aa(t,a,o,!0),a=Gt.current,a!==null){switch(a.tag){case 31:case 13:return an===null?ol():a.alternate===null&&Je===0&&(Je=3),a.flags&=-257,a.flags|=65536,a.lanes=o,r===Br?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([r]):t.add(r),Zo(e,r,o)),!1;case 22:return a.flags|=65536,r===Br?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([r])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([r]):a.add(r)),Zo(e,r,o)),!1}throw Error(l(435,a.tag))}return Zo(e,r,o),ol(),!1}if(Me)return t=Gt.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=o,r!==Hu&&(e=Error(l(422),{cause:r}),ws(Jt(e,a)))):(r!==Hu&&(t=Error(l(423),{cause:r}),ws(Jt(t,a))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,r=Jt(r,a),o=Mo(e.stateNode,r,o),to(e,o),Je!==4&&(Je=2)),!1;var c=Error(l(520),{cause:r});if(c=Jt(c,a),Is===null?Is=[c]:Is.push(c),Je!==4&&(Je=2),t===null)return!0;r=Jt(r,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=o&-o,a.lanes|=e,e=Mo(a.stateNode,r,e),to(a,e),!1;case 1:if(t=a.type,c=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||c!==null&&typeof c.componentDidCatch=="function"&&(hi===null||!hi.has(c))))return a.flags|=65536,o&=-o,a.lanes|=o,o=Gh(o),$h(o,e,a,r),to(a,o),!1}a=a.return}while(a!==null);return!1}var Ro=Error(l(461)),lt=!1;function vt(e,t,a,r){t.child=e===null?Hd(t,null,a,r):Xi(t,e.child,a,r)}function Ih(e,t,a,r,o){a=a.render;var c=t.ref;if("ref"in r){var p={};for(var y in r)y!=="ref"&&(p[y]=r[y])}else p=r;return Fi(t),r=lo(e,t,a,p,c,o),y=uo(),e!==null&&!lt?(oo(e,t,o),Bn(e,t,o)):(Me&&y&&Vu(t),t.flags|=1,vt(e,t,r,o),t.child)}function Vh(e,t,a,r,o){if(e===null){var c=a.type;return typeof c=="function"&&!Gu(c)&&c.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=c,Fh(e,t,c,r,o)):(e=_r(a.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(c=e.child,!ko(e,o)){var p=c.memoizedProps;if(a=a.compare,a=a!==null?a:bs,a(p,r)&&e.ref===t.ref)return Bn(e,t,o)}return t.flags|=1,e=_n(c,r),e.ref=t.ref,e.return=t,t.child=e}function Fh(e,t,a,r,o){if(e!==null){var c=e.memoizedProps;if(bs(c,r)&&e.ref===t.ref)if(lt=!1,t.pendingProps=r=c,ko(e,o))(e.flags&131072)!==0&&(lt=!0);else return t.lanes=e.lanes,Bn(e,t,o)}return Do(e,t,a,r,o)}function Hh(e,t,a,r){var o=r.children,c=e!==null?e.memoizedState:null;if(e===null&&t.stateNode===null&&(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.mode==="hidden"){if((t.flags&128)!==0){if(c=c!==null?c.baseLanes|a:a,e!==null){for(r=t.child=e.child,o=0;r!==null;)o=o|r.lanes|r.childLanes,r=r.sibling;r=o&~c}else r=0,t.child=null;return qh(e,t,c,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Lr(t,c!==null?c.cachePool:null),c!==null?Xd(t,c):io(),Kd(t);else return r=t.lanes=536870912,qh(e,t,c!==null?c.baseLanes|a:a,a,r)}else c!==null?(Lr(t,c.cachePool),Xd(t,c),oi(),t.memoizedState=null):(e!==null&&Lr(t,null),io(),oi());return vt(e,t,o,a),t.child}function Ns(e,t){return e!==null&&e.tag===22||t.stateNode!==null||(t.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),t.sibling}function qh(e,t,a,r,o){var c=Zu();return c=c===null?null:{parent:st._currentValue,pool:c},t.memoizedState={baseLanes:a,cachePool:c},e!==null&&Lr(t,null),io(),Kd(t),e!==null&&Aa(e,t,r,!0),t.childLanes=o,null}function Wr(e,t){return t=el({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Yh(e,t,a){return Xi(t,e.child,null,a),e=Wr(t,t.pendingProps),e.flags|=2,$t(t),t.memoizedState=null,e}function yb(e,t,a){var r=t.pendingProps,o=(t.flags&128)!==0;if(t.flags&=-129,e===null){if(Me){if(r.mode==="hidden")return e=Wr(t,r),t.lanes=536870912,Ns(null,e);if(so(t),(e=Fe)?(e=am(e,nn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ti!==null?{id:vn,overflow:bn}:null,retryLane:536870912,hydrationErrors:null},a=Cd(e),a.return=t,t.child=a,gt=t,Fe=null)):e=null,e===null)throw ii(t);return t.lanes=536870912,null}return Wr(t,r)}var c=e.memoizedState;if(c!==null){var p=c.dehydrated;if(so(t),o)if(t.flags&256)t.flags&=-257,t=Yh(e,t,a);else if(t.memoizedState!==null)t.child=e.child,t.flags|=128,t=null;else throw Error(l(558));else if(lt||Aa(e,t,a,!1),o=(a&e.childLanes)!==0,lt||o){if(r=Ie,r!==null&&(p=Lf(r,a),p!==0&&p!==c.retryLane))throw c.retryLane=p,Gi(e,p),Ut(r,e,p),Ro;ol(),t=Yh(e,t,a)}else e=c.treeContext,Fe=sn(p.nextSibling),gt=t,Me=!0,ni=null,nn=!1,e!==null&&_d(t,e),t=Wr(t,r),t.flags|=4096;return t}return e=_n(e.child,{mode:r.mode,children:r.children}),e.ref=t.ref,t.child=e,e.return=t,e}function Jr(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(l(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function Do(e,t,a,r,o){return Fi(t),a=lo(e,t,a,r,void 0,o),r=uo(),e!==null&&!lt?(oo(e,t,o),Bn(e,t,o)):(Me&&r&&Vu(t),t.flags|=1,vt(e,t,a,o),t.child)}function Xh(e,t,a,r,o,c){return Fi(t),t.updateQueue=null,a=Pd(t,r,a,o),Qd(e),r=uo(),e!==null&&!lt?(oo(e,t,c),Bn(e,t,c)):(Me&&r&&Vu(t),t.flags|=1,vt(e,t,a,c),t.child)}function Kh(e,t,a,r,o){if(Fi(t),t.stateNode===null){var c=Sa,p=a.contextType;typeof p=="object"&&p!==null&&(c=yt(p)),c=new a(r,c),t.memoizedState=c.state!==null&&c.state!==void 0?c.state:null,c.updater=Ao,t.stateNode=c,c._reactInternals=t,c=t.stateNode,c.props=r,c.state=t.memoizedState,c.refs={},Ju(t),p=a.contextType,c.context=typeof p=="object"&&p!==null?yt(p):Sa,c.state=t.memoizedState,p=a.getDerivedStateFromProps,typeof p=="function"&&(To(t,a,p,r),c.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof c.getSnapshotBeforeUpdate=="function"||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(p=c.state,typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount(),p!==c.state&&Ao.enqueueReplaceState(c,c.state,null),Cs(t,r,c,o),Ds(),c.state=t.memoizedState),typeof c.componentDidMount=="function"&&(t.flags|=4194308),r=!0}else if(e===null){c=t.stateNode;var y=t.memoizedProps,S=Qi(a,y);c.props=S;var C=c.context,B=a.contextType;p=Sa,typeof B=="object"&&B!==null&&(p=yt(B));var V=a.getDerivedStateFromProps;B=typeof V=="function"||typeof c.getSnapshotBeforeUpdate=="function",y=t.pendingProps!==y,B||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(y||C!==p)&&Nh(t,c,r,p),si=!1;var _=t.memoizedState;c.state=_,Cs(t,r,c,o),Ds(),C=t.memoizedState,y||_!==C||si?(typeof V=="function"&&(To(t,a,V,r),C=t.memoizedState),(S=si||Uh(t,a,S,r,_,C,p))?(B||typeof c.UNSAFE_componentWillMount!="function"&&typeof c.componentWillMount!="function"||(typeof c.componentWillMount=="function"&&c.componentWillMount(),typeof c.UNSAFE_componentWillMount=="function"&&c.UNSAFE_componentWillMount()),typeof c.componentDidMount=="function"&&(t.flags|=4194308)):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=r,t.memoizedState=C),c.props=r,c.state=C,c.context=p,r=S):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{c=t.stateNode,eo(e,t),p=t.memoizedProps,B=Qi(a,p),c.props=B,V=t.pendingProps,_=c.context,C=a.contextType,S=Sa,typeof C=="object"&&C!==null&&(S=yt(C)),y=a.getDerivedStateFromProps,(C=typeof y=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(p!==V||_!==S)&&Nh(t,c,r,S),si=!1,_=t.memoizedState,c.state=_,Cs(t,r,c,o),Ds();var N=t.memoizedState;p!==V||_!==N||si||e!==null&&e.dependencies!==null&&Nr(e.dependencies)?(typeof y=="function"&&(To(t,a,y,r),N=t.memoizedState),(B=si||Uh(t,a,B,r,_,N,S)||e!==null&&e.dependencies!==null&&Nr(e.dependencies))?(C||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(r,N,S),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(r,N,S)),typeof c.componentDidUpdate=="function"&&(t.flags|=4),typeof c.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof c.componentDidUpdate!="function"||p===e.memoizedProps&&_===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&_===e.memoizedState||(t.flags|=1024),t.memoizedProps=r,t.memoizedState=N),c.props=r,c.state=N,c.context=S,r=B):(typeof c.componentDidUpdate!="function"||p===e.memoizedProps&&_===e.memoizedState||(t.flags|=4),typeof c.getSnapshotBeforeUpdate!="function"||p===e.memoizedProps&&_===e.memoizedState||(t.flags|=1024),r=!1)}return c=r,Jr(e,t),r=(t.flags&128)!==0,c||r?(c=t.stateNode,a=r&&typeof a.getDerivedStateFromError!="function"?null:c.render(),t.flags|=1,e!==null&&r?(t.child=Xi(t,e.child,null,o),t.child=Xi(t,null,a,o)):vt(e,t,a,o),t.memoizedState=c.state,e=t.child):e=Bn(e,t,o),e}function Qh(e,t,a,r){return Ii(),t.flags|=256,vt(e,t,a,r),t.child}var Co={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Oo(e){return{baseLanes:e,cachePool:Bd()}}function zo(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Vt),e}function Ph(e,t,a){var r=t.pendingProps,o=!1,c=(t.flags&128)!==0,p;if((p=c)||(p=e!==null&&e.memoizedState===null?!1:(nt.current&2)!==0),p&&(o=!0,t.flags&=-129),p=(t.flags&32)!==0,t.flags&=-33,e===null){if(Me){if(o?ui(t):oi(),(e=Fe)?(e=am(e,nn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ti!==null?{id:vn,overflow:bn}:null,retryLane:536870912,hydrationErrors:null},a=Cd(e),a.return=t,t.child=a,gt=t,Fe=null)):e=null,e===null)throw ii(t);return hc(e)?t.lanes=32:t.lanes=536870912,null}var y=r.children;return r=r.fallback,o?(oi(),o=t.mode,y=el({mode:"hidden",children:y},o),r=$i(r,o,a,null),y.return=t,r.return=t,y.sibling=r,t.child=y,r=t.child,r.memoizedState=Oo(a),r.childLanes=zo(e,p,a),t.memoizedState=Co,Ns(null,r)):(ui(t),_o(t,y))}var S=e.memoizedState;if(S!==null&&(y=S.dehydrated,y!==null)){if(c)t.flags&256?(ui(t),t.flags&=-257,t=Uo(e,t,a)):t.memoizedState!==null?(oi(),t.child=e.child,t.flags|=128,t=null):(oi(),y=r.fallback,o=t.mode,r=el({mode:"visible",children:r.children},o),y=$i(y,o,a,null),y.flags|=2,r.return=t,y.return=t,r.sibling=y,t.child=r,Xi(t,e.child,null,a),r=t.child,r.memoizedState=Oo(a),r.childLanes=zo(e,p,a),t.memoizedState=Co,t=Ns(null,r));else if(ui(t),hc(y)){if(p=y.nextSibling&&y.nextSibling.dataset,p)var C=p.dgst;p=C,r=Error(l(419)),r.stack="",r.digest=p,ws({value:r,source:null,stack:null}),t=Uo(e,t,a)}else if(lt||Aa(e,t,a,!1),p=(a&e.childLanes)!==0,lt||p){if(p=Ie,p!==null&&(r=Lf(p,a),r!==0&&r!==S.retryLane))throw S.retryLane=r,Gi(e,r),Ut(p,e,r),Ro;dc(y)||ol(),t=Uo(e,t,a)}else dc(y)?(t.flags|=192,t.child=e.child,t=null):(e=S.treeContext,Fe=sn(y.nextSibling),gt=t,Me=!0,ni=null,nn=!1,e!==null&&_d(t,e),t=_o(t,r.children),t.flags|=4096);return t}return o?(oi(),y=r.fallback,o=t.mode,S=e.child,C=S.sibling,r=_n(S,{mode:"hidden",children:r.children}),r.subtreeFlags=S.subtreeFlags&65011712,C!==null?y=_n(C,y):(y=$i(y,o,a,null),y.flags|=2),y.return=t,r.return=t,r.sibling=y,t.child=r,Ns(null,r),r=t.child,y=e.child.memoizedState,y===null?y=Oo(a):(o=y.cachePool,o!==null?(S=st._currentValue,o=o.parent!==S?{parent:S,pool:S}:o):o=Bd(),y={baseLanes:y.baseLanes|a,cachePool:o}),r.memoizedState=y,r.childLanes=zo(e,p,a),t.memoizedState=Co,Ns(e.child,r)):(ui(t),a=e.child,e=a.sibling,a=_n(a,{mode:"visible",children:r.children}),a.return=t,a.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=a,t.memoizedState=null,a)}function _o(e,t){return t=el({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function el(e,t){return e=Bt(22,e,null,t),e.lanes=0,e}function Uo(e,t,a){return Xi(t,e.child,null,a),e=_o(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Zh(e,t,a){e.lanes|=t;var r=e.alternate;r!==null&&(r.lanes|=t),Xu(e.return,t,a)}function No(e,t,a,r,o,c){var p=e.memoizedState;p===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:r,tail:a,tailMode:o,treeForkCount:c}:(p.isBackwards=t,p.rendering=null,p.renderingStartTime=0,p.last=r,p.tail=a,p.tailMode=o,p.treeForkCount=c)}function Wh(e,t,a){var r=t.pendingProps,o=r.revealOrder,c=r.tail;r=r.children;var p=nt.current,y=(p&2)!==0;if(y?(p=p&1|2,t.flags|=128):p&=1,F(nt,p),vt(e,t,r,a),r=Me?Ss:0,!y&&e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Zh(e,a,t);else if(e.tag===19)Zh(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(o){case"forwards":for(a=t.child,o=null;a!==null;)e=a.alternate,e!==null&&Vr(e)===null&&(o=a),a=a.sibling;a=o,a===null?(o=t.child,t.child=null):(o=a.sibling,a.sibling=null),No(t,!1,o,a,c,r);break;case"backwards":case"unstable_legacy-backwards":for(a=null,o=t.child,t.child=null;o!==null;){if(e=o.alternate,e!==null&&Vr(e)===null){t.child=o;break}e=o.sibling,o.sibling=a,a=o,o=e}No(t,!0,a,null,c,r);break;case"together":No(t,!1,null,null,void 0,r);break;default:t.memoizedState=null}return t.child}function Bn(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),di|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Aa(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(l(153));if(t.child!==null){for(e=t.child,a=_n(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=_n(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function ko(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&Nr(e)))}function vb(e,t,a){switch(t.tag){case 3:$e(t,t.stateNode.containerInfo),ai(t,st,e.memoizedState.cache),Ii();break;case 27:case 5:hn(t);break;case 4:$e(t,t.stateNode.containerInfo);break;case 10:ai(t,t.type,t.memoizedProps.value);break;case 31:if(t.memoizedState!==null)return t.flags|=128,so(t),null;break;case 13:var r=t.memoizedState;if(r!==null)return r.dehydrated!==null?(ui(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Ph(e,t,a):(ui(t),e=Bn(e,t,a),e!==null?e.sibling:null);ui(t);break;case 19:var o=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(Aa(e,t,a,!1),r=(a&t.childLanes)!==0),o){if(r)return Wh(e,t,a);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),F(nt,nt.current),r)break;return null;case 22:return t.lanes=0,Hh(e,t,a,t.pendingProps);case 24:ai(t,st,e.memoizedState.cache)}return Bn(e,t,a)}function Jh(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)lt=!0;else{if(!ko(e,a)&&(t.flags&128)===0)return lt=!1,vb(e,t,a);lt=(e.flags&131072)!==0}else lt=!1,Me&&(t.flags&1048576)!==0&&zd(t,Ss,t.index);switch(t.lanes=0,t.tag){case 16:e:{var r=t.pendingProps;if(e=qi(t.elementType),t.type=e,typeof e=="function")Gu(e)?(r=Qi(e,r),t.tag=1,t=Kh(null,t,e,r,a)):(t.tag=0,t=Do(null,t,e,r,a));else{if(e!=null){var o=e.$$typeof;if(o===U){t.tag=11,t=Ih(null,t,e,r,a);break e}else if(o===A){t.tag=14,t=Vh(null,t,e,r,a);break e}}throw t=de(e)||e,Error(l(306,t,""))}}return t;case 0:return Do(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,o=Qi(r,t.pendingProps),Kh(e,t,r,o,a);case 3:e:{if($e(t,t.stateNode.containerInfo),e===null)throw Error(l(387));r=t.pendingProps;var c=t.memoizedState;o=c.element,eo(e,t),Cs(t,r,null,a);var p=t.memoizedState;if(r=p.cache,ai(t,st,r),r!==c.cache&&Ku(t,[st],a,!0),Ds(),r=p.element,c.isDehydrated)if(c={element:r,isDehydrated:!1,cache:p.cache},t.updateQueue.baseState=c,t.memoizedState=c,t.flags&256){t=Qh(e,t,r,a);break e}else if(r!==o){o=Jt(Error(l(424)),t),ws(o),t=Qh(e,t,r,a);break e}else for(e=t.stateNode.containerInfo,e.nodeType===9?e=e.body:e=e.nodeName==="HTML"?e.ownerDocument.body:e,Fe=sn(e.firstChild),gt=t,Me=!0,ni=null,nn=!0,a=Hd(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Ii(),r===o){t=Bn(e,t,a);break e}vt(e,t,r,a)}t=t.child}return t;case 26:return Jr(e,t),e===null?(a=cm(t.type,null,t.pendingProps,null))?t.memoizedState=a:Me||(a=t.type,e=t.pendingProps,r=gl(he.current).createElement(a),r[mt]=t,r[Rt]=e,bt(r,a,e),dt(r),t.stateNode=r):t.memoizedState=cm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return hn(t),e===null&&Me&&(r=t.stateNode=lm(t.type,t.pendingProps,he.current),gt=t,nn=!0,o=Fe,yi(t.type)?(pc=o,Fe=sn(r.firstChild)):Fe=o),vt(e,t,t.pendingProps.children,a),Jr(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Me&&((o=r=Fe)&&(r=Kb(r,t.type,t.pendingProps,nn),r!==null?(t.stateNode=r,gt=t,Fe=sn(r.firstChild),nn=!1,o=!0):o=!1),o||ii(t)),hn(t),o=t.type,c=t.pendingProps,p=e!==null?e.memoizedProps:null,r=c.children,oc(o,c)?r=null:p!==null&&oc(o,p)&&(t.flags|=32),t.memoizedState!==null&&(o=lo(e,t,ob,null,null,a),Qs._currentValue=o),Jr(e,t),vt(e,t,r,a),t.child;case 6:return e===null&&Me&&((e=a=Fe)&&(a=Qb(a,t.pendingProps,nn),a!==null?(t.stateNode=a,gt=t,Fe=null,e=!0):e=!1),e||ii(t)),null;case 13:return Ph(e,t,a);case 4:return $e(t,t.stateNode.containerInfo),r=t.pendingProps,e===null?t.child=Xi(t,null,r,a):vt(e,t,r,a),t.child;case 11:return Ih(e,t,t.type,t.pendingProps,a);case 7:return vt(e,t,t.pendingProps,a),t.child;case 8:return vt(e,t,t.pendingProps.children,a),t.child;case 12:return vt(e,t,t.pendingProps.children,a),t.child;case 10:return r=t.pendingProps,ai(t,t.type,r.value),vt(e,t,r.children,a),t.child;case 9:return o=t.type._context,r=t.pendingProps.children,Fi(t),o=yt(o),r=r(o),t.flags|=1,vt(e,t,r,a),t.child;case 14:return Vh(e,t,t.type,t.pendingProps,a);case 15:return Fh(e,t,t.type,t.pendingProps,a);case 19:return Wh(e,t,a);case 31:return yb(e,t,a);case 22:return Hh(e,t,a,t.pendingProps);case 24:return Fi(t),r=yt(st),e===null?(o=Zu(),o===null&&(o=Ie,c=Qu(),o.pooledCache=c,c.refCount++,c!==null&&(o.pooledCacheLanes|=a),o=c),t.memoizedState={parent:r,cache:o},Ju(t),ai(t,st,o)):((e.lanes&a)!==0&&(eo(e,t),Cs(t,null,null,a),Ds()),o=e.memoizedState,c=t.memoizedState,o.parent!==r?(o={parent:r,cache:r},t.memoizedState=o,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=o),ai(t,st,r)):(r=c.cache,ai(t,st,r),r!==o.cache&&Ku(t,[st],a,!0))),vt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(l(156,t.tag))}function Gn(e){e.flags|=4}function Lo(e,t,a,r,o){if((t=(e.mode&32)!==0)&&(t=!1),t){if(e.flags|=16777216,(o&335544128)===o)if(e.stateNode.complete)e.flags|=8192;else if(Mp())e.flags|=8192;else throw Yi=Br,Wu}else e.flags&=-16777217}function ep(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!mm(t))if(Mp())e.flags|=8192;else throw Yi=Br,Wu}function tl(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Uf():536870912,e.lanes|=t,ja|=t)}function ks(e,t){if(!Me)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var r=null;a!==null;)a.alternate!==null&&(r=a),a=a.sibling;r===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:r.sibling=null}}function He(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,r=0;if(t)for(var o=e.child;o!==null;)a|=o.lanes|o.childLanes,r|=o.subtreeFlags&65011712,r|=o.flags&65011712,o.return=e,o=o.sibling;else for(o=e.child;o!==null;)a|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=e,o=o.sibling;return e.subtreeFlags|=r,e.childLanes=a,t}function bb(e,t,a){var r=t.pendingProps;switch(Fu(t),t.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return He(t),null;case 1:return He(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),kn(st),Re(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Ta(t)?Gn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,qu())),He(t),null;case 26:var o=t.type,c=t.memoizedState;return e===null?(Gn(t),c!==null?(He(t),ep(t,c)):(He(t),Lo(t,o,null,r,a))):c?c!==e.memoizedState?(Gn(t),He(t),ep(t,c)):(He(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Gn(t),He(t),Lo(t,o,e,r,a)),null;case 27:if(Mn(t),a=he.current,o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Gn(t);else{if(!r){if(t.stateNode===null)throw Error(l(166));return He(t),null}e=Z.current,Ta(t)?Ud(t):(e=lm(o,r,a),t.stateNode=e,Gn(t))}return He(t),null;case 5:if(Mn(t),o=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==r&&Gn(t);else{if(!r){if(t.stateNode===null)throw Error(l(166));return He(t),null}if(c=Z.current,Ta(t))Ud(t);else{var p=gl(he.current);switch(c){case 1:c=p.createElementNS("http://www.w3.org/2000/svg",o);break;case 2:c=p.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;default:switch(o){case"svg":c=p.createElementNS("http://www.w3.org/2000/svg",o);break;case"math":c=p.createElementNS("http://www.w3.org/1998/Math/MathML",o);break;case"script":c=p.createElement("div"),c.innerHTML="<script><\/script>",c=c.removeChild(c.firstChild);break;case"select":c=typeof r.is=="string"?p.createElement("select",{is:r.is}):p.createElement("select"),r.multiple?c.multiple=!0:r.size&&(c.size=r.size);break;default:c=typeof r.is=="string"?p.createElement(o,{is:r.is}):p.createElement(o)}}c[mt]=t,c[Rt]=r;e:for(p=t.child;p!==null;){if(p.tag===5||p.tag===6)c.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=c;e:switch(bt(c,o,r),o){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&Gn(t)}}return He(t),Lo(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,a),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&Gn(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(l(166));if(e=he.current,Ta(t)){if(e=t.stateNode,a=t.memoizedProps,r=null,o=gt,o!==null)switch(o.tag){case 27:case 5:r=o.memoizedProps}e[mt]=t,e=!!(e.nodeValue===a||r!==null&&r.suppressHydrationWarning===!0||Pp(e.nodeValue,a)),e||ii(t,!0)}else e=gl(e).createTextNode(r),e[mt]=t,t.stateNode=e}return He(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=Ta(t),a!==null){if(e===null){if(!r)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[mt]=t}else Ii(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;He(t),e=!1}else a=qu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?($t(t),t):($t(t),null);if((t.flags&128)!==0)throw Error(l(558))}return He(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Ta(t),r!==null&&r.dehydrated!==null){if(e===null){if(!o)throw Error(l(318));if(o=t.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(l(317));o[mt]=t}else Ii(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;He(t),o=!1}else o=qu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?($t(t),t):($t(t),null)}return $t(t),(t.flags&128)!==0?(t.lanes=a,t):(a=r!==null,e=e!==null&&e.memoizedState!==null,a&&(r=t.child,o=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(o=r.alternate.memoizedState.cachePool.pool),c=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),c!==o&&(r.flags|=2048)),a!==e&&a&&(t.child.flags|=8192),tl(t,t.updateQueue),He(t),null);case 4:return Re(),e===null&&ac(t.stateNode.containerInfo),He(t),null;case 10:return kn(t.type),He(t),null;case 19:if(k(nt),r=t.memoizedState,r===null)return He(t),null;if(o=(t.flags&128)!==0,c=r.rendering,c===null)if(o)ks(r,!1);else{if(Je!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=Vr(e),c!==null){for(t.flags|=128,ks(r,!1),e=c.updateQueue,t.updateQueue=e,tl(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Dd(a,e),a=a.sibling;return F(nt,nt.current&1|2),Me&&Un(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ve()>rl&&(t.flags|=128,o=!0,ks(r,!1),t.lanes=4194304)}else{if(!o)if(e=Vr(c),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,tl(t,e),ks(r,!0),r.tail===null&&r.tailMode==="hidden"&&!c.alternate&&!Me)return He(t),null}else 2*Ve()-r.renderingStartTime>rl&&a!==536870912&&(t.flags|=128,o=!0,ks(r,!1),t.lanes=4194304);r.isBackwards?(c.sibling=t.child,t.child=c):(e=r.last,e!==null?e.sibling=c:t.child=c,r.last=c)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=Ve(),e.sibling=null,a=nt.current,F(nt,o?a&1|2:a&1),Me&&Un(t,r.treeForkCount),e):(He(t),null);case 22:case 23:return $t(t),ao(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(a&536870912)!==0&&(t.flags&128)===0&&(He(t),t.subtreeFlags&6&&(t.flags|=8192)):He(t),a=t.updateQueue,a!==null&&tl(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==a&&(t.flags|=2048),e!==null&&k(Hi),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),kn(st),He(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function xb(e,t){switch(Fu(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return kn(st),Re(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Mn(t),null;case 31:if(t.memoizedState!==null){if($t(t),t.alternate===null)throw Error(l(340));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if($t(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));Ii()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return k(nt),null;case 4:return Re(),null;case 10:return kn(t.type),null;case 22:case 23:return $t(t),ao(),e!==null&&k(Hi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return kn(st),null;case 25:return null;default:return null}}function tp(e,t){switch(Fu(t),t.tag){case 3:kn(st),Re();break;case 26:case 27:case 5:Mn(t);break;case 4:Re();break;case 31:t.memoizedState!==null&&$t(t);break;case 13:$t(t);break;case 19:k(nt);break;case 10:kn(t.type);break;case 22:case 23:$t(t),ao(),e!==null&&k(Hi);break;case 24:kn(st)}}function Ls(e,t){try{var a=t.updateQueue,r=a!==null?a.lastEffect:null;if(r!==null){var o=r.next;a=o;do{if((a.tag&e)===e){r=void 0;var c=a.create,p=a.inst;r=c(),p.destroy=r}a=a.next}while(a!==o)}}catch(y){ke(t,t.return,y)}}function ci(e,t,a){try{var r=t.updateQueue,o=r!==null?r.lastEffect:null;if(o!==null){var c=o.next;r=c;do{if((r.tag&e)===e){var p=r.inst,y=p.destroy;if(y!==void 0){p.destroy=void 0,o=t;var S=a,C=y;try{C()}catch(B){ke(o,S,B)}}}r=r.next}while(r!==c)}}catch(B){ke(t,t.return,B)}}function np(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Yd(t,a)}catch(r){ke(e,e.return,r)}}}function ip(e,t,a){a.props=Qi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){ke(e,t,r)}}function js(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof a=="function"?e.refCleanup=a(r):a.current=r}}catch(o){ke(e,t,o)}}function xn(e,t){var a=e.ref,r=e.refCleanup;if(a!==null)if(typeof r=="function")try{r()}catch(o){ke(e,t,o)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(o){ke(e,t,o)}else a.current=null}function ap(e){var t=e.type,a=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&r.focus();break e;case"img":a.src?r.src=a.src:a.srcSet&&(r.srcset=a.srcSet)}}catch(o){ke(e,e.return,o)}}function jo(e,t,a){try{var r=e.stateNode;Vb(r,e.type,a,t),r[Rt]=t}catch(o){ke(e,e.return,o)}}function sp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&yi(e.type)||e.tag===4}function Bo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||sp(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 Go(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=On));else if(r!==4&&(r===27&&yi(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(Go(e,t,a),e=e.sibling;e!==null;)Go(e,t,a),e=e.sibling}function nl(e,t,a){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(r!==4&&(r===27&&yi(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(nl(e,t,a),e=e.sibling;e!==null;)nl(e,t,a),e=e.sibling}function rp(e){var t=e.stateNode,a=e.memoizedProps;try{for(var r=e.type,o=t.attributes;o.length;)t.removeAttributeNode(o[0]);bt(t,r,a),t[mt]=e,t[Rt]=a}catch(c){ke(e,e.return,c)}}var $n=!1,ut=!1,$o=!1,lp=typeof WeakSet=="function"?WeakSet:Set,ht=null;function Sb(e,t){if(e=e.containerInfo,lc=El,e=bd(e),_u(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var r=a.getSelection&&a.getSelection();if(r&&r.rangeCount!==0){a=r.anchorNode;var o=r.anchorOffset,c=r.focusNode;r=r.focusOffset;try{a.nodeType,c.nodeType}catch{a=null;break e}var p=0,y=-1,S=-1,C=0,B=0,V=e,_=null;t:for(;;){for(var N;V!==a||o!==0&&V.nodeType!==3||(y=p+o),V!==c||r!==0&&V.nodeType!==3||(S=p+r),V.nodeType===3&&(p+=V.nodeValue.length),(N=V.firstChild)!==null;)_=V,V=N;for(;;){if(V===e)break t;if(_===a&&++C===o&&(y=p),_===c&&++B===r&&(S=p),(N=V.nextSibling)!==null)break;V=_,_=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(uc={focusedElem:e,selectionRange:a},El=!1,ht=t;ht!==null;)if(t=ht,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ht=e;else for(;ht!==null;){switch(t=ht,c=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++)o=e[a],o.ref.impl=o.nextImpl;break;case 11:case 15:break;case 1:if((e&1024)!==0&&c!==null){e=void 0,a=t,o=c.memoizedProps,c=c.memoizedState,r=a.stateNode;try{var ie=Qi(a.type,o);e=r.getSnapshotBeforeUpdate(ie,c),r.__reactInternalSnapshotBeforeUpdate=e}catch(fe){ke(a,a.return,fe)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)fc(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":fc(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(l(163))}if(e=t.sibling,e!==null){e.return=t.return,ht=e;break}ht=t.return}}function up(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:Vn(e,a),r&4&&Ls(5,a);break;case 1:if(Vn(e,a),r&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(p){ke(a,a.return,p)}else{var o=Qi(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){ke(a,a.return,p)}}r&64&&np(a),r&512&&js(a,a.return);break;case 3:if(Vn(e,a),r&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Yd(e,t)}catch(p){ke(a,a.return,p)}}break;case 27:t===null&&r&4&&rp(a);case 26:case 5:Vn(e,a),t===null&&r&4&&ap(a),r&512&&js(a,a.return);break;case 12:Vn(e,a);break;case 31:Vn(e,a),r&4&&fp(e,a);break;case 13:Vn(e,a),r&4&&dp(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Ob.bind(null,a),Pb(e,a))));break;case 22:if(r=a.memoizedState!==null||$n,!r){t=t!==null&&t.memoizedState!==null||ut,o=$n;var c=ut;$n=r,(ut=t)&&!c?Fn(e,a,(a.subtreeFlags&8772)!==0):Vn(e,a),$n=o,ut=c}break;case 30:break;default:Vn(e,a)}}function op(e){var t=e.alternate;t!==null&&(e.alternate=null,op(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&mu(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 Ye=null,Ct=!1;function In(e,t,a){for(a=a.child;a!==null;)cp(e,t,a),a=a.sibling}function cp(e,t,a){if(qe&&typeof qe.onCommitFiberUnmount=="function")try{qe.onCommitFiberUnmount(ft,a)}catch{}switch(a.tag){case 26:ut||xn(a,t),In(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:ut||xn(a,t);var r=Ye,o=Ct;yi(a.type)&&(Ye=a.stateNode,Ct=!1),In(e,t,a),Ys(a.stateNode),Ye=r,Ct=o;break;case 5:ut||xn(a,t);case 6:if(r=Ye,o=Ct,Ye=null,In(e,t,a),Ye=r,Ct=o,Ye!==null)if(Ct)try{(Ye.nodeType===9?Ye.body:Ye.nodeName==="HTML"?Ye.ownerDocument.body:Ye).removeChild(a.stateNode)}catch(c){ke(a,t,c)}else try{Ye.removeChild(a.stateNode)}catch(c){ke(a,t,c)}break;case 18:Ye!==null&&(Ct?(e=Ye,nm(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),qa(e)):nm(Ye,a.stateNode));break;case 4:r=Ye,o=Ct,Ye=a.stateNode.containerInfo,Ct=!0,In(e,t,a),Ye=r,Ct=o;break;case 0:case 11:case 14:case 15:ci(2,a,t),ut||ci(4,a,t),In(e,t,a);break;case 1:ut||(xn(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&ip(a,t,r)),In(e,t,a);break;case 21:In(e,t,a);break;case 22:ut=(r=ut)||a.memoizedState!==null,In(e,t,a),ut=r;break;default:In(e,t,a)}}function fp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{qa(e)}catch(a){ke(t,t.return,a)}}}function dp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{qa(e)}catch(a){ke(t,t.return,a)}}function wb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new lp),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new lp),t;default:throw Error(l(435,e.tag))}}function il(e,t){var a=wb(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var o=zb.bind(null,e,r);r.then(o,o)}})}function Ot(e,t){var a=t.deletions;if(a!==null)for(var r=0;r<a.length;r++){var o=a[r],c=e,p=t,y=p;e:for(;y!==null;){switch(y.tag){case 27:if(yi(y.type)){Ye=y.stateNode,Ct=!1;break e}break;case 5:Ye=y.stateNode,Ct=!1;break e;case 3:case 4:Ye=y.stateNode.containerInfo,Ct=!0;break e}y=y.return}if(Ye===null)throw Error(l(160));cp(c,p,o),Ye=null,Ct=!1,c=o.alternate,c!==null&&(c.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)hp(t,e),t=t.sibling}var gn=null;function hp(e,t){var a=e.alternate,r=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Ot(t,e),zt(e),r&4&&(ci(3,e,e.return),Ls(3,e),ci(5,e,e.return));break;case 1:Ot(t,e),zt(e),r&512&&(ut||a===null||xn(a,a.return)),r&64&&$n&&(e=e.updateQueue,e!==null&&(r=e.callbacks,r!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?r:a.concat(r))));break;case 26:var o=gn;if(Ot(t,e),zt(e),r&512&&(ut||a===null||xn(a,a.return)),r&4){var c=a!==null?a.memoizedState:null;if(r=e.memoizedState,a===null)if(r===null)if(e.stateNode===null){e:{r=e.type,a=e.memoizedProps,o=o.ownerDocument||o;t:switch(r){case"title":c=o.getElementsByTagName("title")[0],(!c||c[cs]||c[mt]||c.namespaceURI==="http://www.w3.org/2000/svg"||c.hasAttribute("itemprop"))&&(c=o.createElement(r),o.head.insertBefore(c,o.querySelector("head > title"))),bt(c,r,a),c[mt]=e,dt(c),r=c;break e;case"link":var p=hm("link","href",o).get(r+(a.href||""));if(p){for(var y=0;y<p.length;y++)if(c=p[y],c.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&c.getAttribute("rel")===(a.rel==null?null:a.rel)&&c.getAttribute("title")===(a.title==null?null:a.title)&&c.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){p.splice(y,1);break t}}c=o.createElement(r),bt(c,r,a),o.head.appendChild(c);break;case"meta":if(p=hm("meta","content",o).get(r+(a.content||""))){for(y=0;y<p.length;y++)if(c=p[y],c.getAttribute("content")===(a.content==null?null:""+a.content)&&c.getAttribute("name")===(a.name==null?null:a.name)&&c.getAttribute("property")===(a.property==null?null:a.property)&&c.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&c.getAttribute("charset")===(a.charSet==null?null:a.charSet)){p.splice(y,1);break t}}c=o.createElement(r),bt(c,r,a),o.head.appendChild(c);break;default:throw Error(l(468,r))}c[mt]=e,dt(c),r=c}e.stateNode=r}else pm(o,e.type,e.stateNode);else e.stateNode=dm(o,r,e.memoizedProps);else c!==r?(c===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):c.count--,r===null?pm(o,e.type,e.stateNode):dm(o,r,e.memoizedProps)):r===null&&e.stateNode!==null&&jo(e,e.memoizedProps,a.memoizedProps)}break;case 27:Ot(t,e),zt(e),r&512&&(ut||a===null||xn(a,a.return)),a!==null&&r&4&&jo(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Ot(t,e),zt(e),r&512&&(ut||a===null||xn(a,a.return)),e.flags&32){o=e.stateNode;try{pa(o,"")}catch(ie){ke(e,e.return,ie)}}r&4&&e.stateNode!=null&&(o=e.memoizedProps,jo(e,o,a!==null?a.memoizedProps:o)),r&1024&&($o=!0);break;case 6:if(Ot(t,e),zt(e),r&4){if(e.stateNode===null)throw Error(l(162));r=e.memoizedProps,a=e.stateNode;try{a.nodeValue=r}catch(ie){ke(e,e.return,ie)}}break;case 3:if(bl=null,o=gn,gn=yl(t.containerInfo),Ot(t,e),gn=o,zt(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{qa(t.containerInfo)}catch(ie){ke(e,e.return,ie)}$o&&($o=!1,pp(e));break;case 4:r=gn,gn=yl(e.stateNode.containerInfo),Ot(t,e),zt(e),gn=r;break;case 12:Ot(t,e),zt(e);break;case 31:Ot(t,e),zt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,il(e,r)));break;case 13:Ot(t,e),zt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(sl=Ve()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,il(e,r)));break;case 22:o=e.memoizedState!==null;var S=a!==null&&a.memoizedState!==null,C=$n,B=ut;if($n=C||o,ut=B||S,Ot(t,e),ut=B,$n=C,zt(e),r&8192)e:for(t=e.stateNode,t._visibility=o?t._visibility&-2:t._visibility|1,o&&(a===null||S||$n||ut||Pi(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){S=a=t;try{if(c=S.stateNode,o)p=c.style,typeof p.setProperty=="function"?p.setProperty("display","none","important"):p.display="none";else{y=S.stateNode;var V=S.memoizedProps.style,_=V!=null&&V.hasOwnProperty("display")?V.display:null;y.style.display=_==null||typeof _=="boolean"?"":(""+_).trim()}}catch(ie){ke(S,S.return,ie)}}}else if(t.tag===6){if(a===null){S=t;try{S.stateNode.nodeValue=o?"":S.memoizedProps}catch(ie){ke(S,S.return,ie)}}}else if(t.tag===18){if(a===null){S=t;try{var N=S.stateNode;o?im(N,!0):im(S.stateNode,!1)}catch(ie){ke(S,S.return,ie)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(a=r.retryQueue,a!==null&&(r.retryQueue=null,il(e,a))));break;case 19:Ot(t,e),zt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,il(e,r)));break;case 30:break;case 21:break;default:Ot(t,e),zt(e)}}function zt(e){var t=e.flags;if(t&2){try{for(var a,r=e.return;r!==null;){if(sp(r)){a=r;break}r=r.return}if(a==null)throw Error(l(160));switch(a.tag){case 27:var o=a.stateNode,c=Bo(e);nl(e,c,o);break;case 5:var p=a.stateNode;a.flags&32&&(pa(p,""),a.flags&=-33);var y=Bo(e);nl(e,y,p);break;case 3:case 4:var S=a.stateNode.containerInfo,C=Bo(e);Go(e,C,S);break;default:throw Error(l(161))}}catch(B){ke(e,e.return,B)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function pp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;pp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function Vn(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)up(e,t.alternate,t),t=t.sibling}function Pi(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),Pi(t);break;case 1:xn(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&ip(t,t.return,a),Pi(t);break;case 27:Ys(t.stateNode);case 26:case 5:xn(t,t.return),Pi(t);break;case 22:t.memoizedState===null&&Pi(t);break;case 30:Pi(t);break;default:Pi(t)}e=e.sibling}}function Fn(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var r=t.alternate,o=e,c=t,p=c.flags;switch(c.tag){case 0:case 11:case 15:Fn(o,c,a),Ls(4,c);break;case 1:if(Fn(o,c,a),r=c,o=r.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(C){ke(r,r.return,C)}if(r=c,o=r.updateQueue,o!==null){var y=r.stateNode;try{var S=o.shared.hiddenCallbacks;if(S!==null)for(o.shared.hiddenCallbacks=null,o=0;o<S.length;o++)qd(S[o],y)}catch(C){ke(r,r.return,C)}}a&&p&64&&np(c),js(c,c.return);break;case 27:rp(c);case 26:case 5:Fn(o,c,a),a&&r===null&&p&4&&ap(c),js(c,c.return);break;case 12:Fn(o,c,a);break;case 31:Fn(o,c,a),a&&p&4&&fp(o,c);break;case 13:Fn(o,c,a),a&&p&4&&dp(o,c);break;case 22:c.memoizedState===null&&Fn(o,c,a),js(c,c.return);break;case 30:break;default:Fn(o,c,a)}t=t.sibling}}function Io(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&&Es(a))}function Vo(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Es(e))}function yn(e,t,a,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)mp(e,t,a,r),t=t.sibling}function mp(e,t,a,r){var o=t.flags;switch(t.tag){case 0:case 11:case 15:yn(e,t,a,r),o&2048&&Ls(9,t);break;case 1:yn(e,t,a,r);break;case 3:yn(e,t,a,r),o&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Es(e)));break;case 12:if(o&2048){yn(e,t,a,r),e=t.stateNode;try{var c=t.memoizedProps,p=c.id,y=c.onPostCommit;typeof y=="function"&&y(p,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(S){ke(t,t.return,S)}}else yn(e,t,a,r);break;case 31:yn(e,t,a,r);break;case 13:yn(e,t,a,r);break;case 23:break;case 22:c=t.stateNode,p=t.alternate,t.memoizedState!==null?c._visibility&2?yn(e,t,a,r):Bs(e,t):c._visibility&2?yn(e,t,a,r):(c._visibility|=2,Na(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),o&2048&&Io(p,t);break;case 24:yn(e,t,a,r),o&2048&&Vo(t.alternate,t);break;default:yn(e,t,a,r)}}function Na(e,t,a,r,o){for(o=o&&((t.subtreeFlags&10256)!==0||!1),t=t.child;t!==null;){var c=e,p=t,y=a,S=r,C=p.flags;switch(p.tag){case 0:case 11:case 15:Na(c,p,y,S,o),Ls(8,p);break;case 23:break;case 22:var B=p.stateNode;p.memoizedState!==null?B._visibility&2?Na(c,p,y,S,o):Bs(c,p):(B._visibility|=2,Na(c,p,y,S,o)),o&&C&2048&&Io(p.alternate,p);break;case 24:Na(c,p,y,S,o),o&&C&2048&&Vo(p.alternate,p);break;default:Na(c,p,y,S,o)}t=t.sibling}}function Bs(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,r=t,o=r.flags;switch(r.tag){case 22:Bs(a,r),o&2048&&Io(r.alternate,r);break;case 24:Bs(a,r),o&2048&&Vo(r.alternate,r);break;default:Bs(a,r)}t=t.sibling}}var Gs=8192;function ka(e,t,a){if(e.subtreeFlags&Gs)for(e=e.child;e!==null;)gp(e,t,a),e=e.sibling}function gp(e,t,a){switch(e.tag){case 26:ka(e,t,a),e.flags&Gs&&e.memoizedState!==null&&ux(a,gn,e.memoizedState,e.memoizedProps);break;case 5:ka(e,t,a);break;case 3:case 4:var r=gn;gn=yl(e.stateNode.containerInfo),ka(e,t,a),gn=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Gs,Gs=16777216,ka(e,t,a),Gs=r):ka(e,t,a));break;default:ka(e,t,a)}}function yp(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 $s(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];ht=r,bp(r,e)}yp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)vp(e),e=e.sibling}function vp(e){switch(e.tag){case 0:case 11:case 15:$s(e),e.flags&2048&&ci(9,e,e.return);break;case 3:$s(e);break;case 12:$s(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,al(e)):$s(e);break;default:$s(e)}}function al(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var r=t[a];ht=r,bp(r,e)}yp(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:ci(8,t,t.return),al(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,al(t));break;default:al(t)}e=e.sibling}}function bp(e,t){for(;ht!==null;){var a=ht;switch(a.tag){case 0:case 11:case 15:ci(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var r=a.memoizedState.cachePool.pool;r!=null&&r.refCount++}break;case 24:Es(a.memoizedState.cache)}if(r=a.child,r!==null)r.return=a,ht=r;else e:for(a=e;ht!==null;){r=ht;var o=r.sibling,c=r.return;if(op(r),r===a){ht=null;break e}if(o!==null){o.return=c,ht=o;break e}ht=c}}}var Eb={getCacheForType:function(e){var t=yt(st),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a},cacheSignal:function(){return yt(st).controller.signal}},Tb=typeof WeakMap=="function"?WeakMap:Map,_e=0,Ie=null,xe=null,Te=0,Ne=0,It=null,fi=!1,La=!1,Fo=!1,Hn=0,Je=0,di=0,Zi=0,Ho=0,Vt=0,ja=0,Is=null,_t=null,qo=!1,sl=0,xp=0,rl=1/0,ll=null,hi=null,ct=0,pi=null,Ba=null,qn=0,Yo=0,Xo=null,Sp=null,Vs=0,Ko=null;function Ft(){return(_e&2)!==0&&Te!==0?Te&-Te:z.T!==null?ec():jf()}function wp(){if(Vt===0)if((Te&536870912)===0||Me){var e=mr;mr<<=1,(mr&3932160)===0&&(mr=262144),Vt=e}else Vt=536870912;return e=Gt.current,e!==null&&(e.flags|=32),Vt}function Ut(e,t,a){(e===Ie&&(Ne===2||Ne===9)||e.cancelPendingCommit!==null)&&(Ga(e,0),mi(e,Te,Vt,!1)),os(e,a),((_e&2)===0||e!==Ie)&&(e===Ie&&((_e&2)===0&&(Zi|=a),Je===4&&mi(e,Te,Vt,!1)),Sn(e))}function Ep(e,t,a){if((_e&6)!==0)throw Error(l(327));var r=!a&&(t&127)===0&&(t&e.expiredLanes)===0||us(e,t),o=r?Rb(e,t):Po(e,t,!0),c=r;do{if(o===0){La&&!r&&mi(e,t,0,!1);break}else{if(a=e.current.alternate,c&&!Ab(a)){o=Po(e,t,!1),c=!1;continue}if(o===2){if(c=t,e.errorRecoveryDisabledLanes&c)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;o=Is;var S=y.current.memoizedState.isDehydrated;if(S&&(Ga(y,p).flags|=256),p=Po(y,p,!1),p!==2){if(Fo&&!S){y.errorRecoveryDisabledLanes|=c,Zi|=c,o=4;break e}c=_t,_t=o,c!==null&&(_t===null?_t=c:_t.push.apply(_t,c))}o=p}if(c=!1,o!==2)continue}}if(o===1){Ga(e,0),mi(e,t,0,!0);break}e:{switch(r=e,c=o,c){case 0:case 1:throw Error(l(345));case 4:if((t&4194048)!==t)break;case 6:mi(r,t,Vt,!fi);break e;case 2:_t=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(o=sl+300-Ve(),10<o)){if(mi(r,t,Vt,!fi),yr(r,0,!0)!==0)break e;qn=t,r.timeoutHandle=em(Tp.bind(null,r,a,_t,ll,qo,t,Vt,Zi,ja,fi,c,"Throttled",-0,0),o);break e}Tp(r,a,_t,ll,qo,t,Vt,Zi,ja,fi,c,null,-0,0)}}break}while(!0);Sn(e)}function Tp(e,t,a,r,o,c,p,y,S,C,B,V,_,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:On},gp(t,c,V);var ie=(c&62914560)===c?sl-Ve():(c&4194048)===c?xp-Ve():0;if(ie=ox(V,ie),ie!==null){qn=c,e.cancelPendingCommit=ie(_p.bind(null,e,t,c,a,r,o,p,y,S,B,V,null,_,N)),mi(e,c,p,!C);return}}_p(e,t,c,a,r,o,p,y,S)}function Ab(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var r=0;r<a.length;r++){var o=a[r],c=o.getSnapshot;o=o.value;try{if(!jt(c(),o))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function mi(e,t,a,r){t&=~Ho,t&=~Zi,e.suspendedLanes|=t,e.pingedLanes&=~t,r&&(e.warmLanes|=t),r=e.expirationTimes;for(var o=t;0<o;){var c=31-tt(o),p=1<<c;r[c]=-1,o&=~p}a!==0&&Nf(e,a,t)}function ul(){return(_e&6)===0?(Fs(0),!1):!0}function Qo(){if(xe!==null){if(Ne===0)var e=xe.return;else e=xe,Nn=Vi=null,co(e),Ca=null,As=0,e=xe;for(;e!==null;)tp(e.alternate,e),e=e.return;xe=null}}function Ga(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,qb(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),qn=0,Qo(),Ie=e,xe=a=_n(e.current,null),Te=t,Ne=0,It=null,fi=!1,La=us(e,t),Fo=!1,ja=Vt=Ho=Zi=di=Je=0,_t=Is=null,qo=!1,(t&8)!==0&&(t|=t&32);var r=e.entangledLanes;if(r!==0)for(e=e.entanglements,r&=t;0<r;){var o=31-tt(r),c=1<<o;t|=e[o],r&=~c}return Hn=t,Cr(),a}function Ap(e,t){ge=null,z.H=Us,t===Da||t===jr?(t=Id(),Ne=3):t===Wu?(t=Id(),Ne=4):Ne=t===Ro?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,It=t,xe===null&&(Je=1,Zr(e,Jt(t,e.current)))}function Mp(){var e=Gt.current;return e===null?!0:(Te&4194048)===Te?an===null:(Te&62914560)===Te||(Te&536870912)!==0?e===an:!1}function Rp(){var e=z.H;return z.H=Us,e===null?Us:e}function Dp(){var e=z.A;return z.A=Eb,e}function ol(){Je=4,fi||(Te&4194048)!==Te&&Gt.current!==null||(La=!0),(di&134217727)===0&&(Zi&134217727)===0||Ie===null||mi(Ie,Te,Vt,!1)}function Po(e,t,a){var r=_e;_e|=2;var o=Rp(),c=Dp();(Ie!==e||Te!==t)&&(ll=null,Ga(e,t)),t=!1;var p=Je;e:do try{if(Ne!==0&&xe!==null){var y=xe,S=It;switch(Ne){case 8:Qo(),p=6;break e;case 3:case 2:case 9:case 6:Gt.current===null&&(t=!0);var C=Ne;if(Ne=0,It=null,$a(e,y,S,C),a&&La){p=0;break e}break;default:C=Ne,Ne=0,It=null,$a(e,y,S,C)}}Mb(),p=Je;break}catch(B){Ap(e,B)}while(!0);return t&&e.shellSuspendCounter++,Nn=Vi=null,_e=r,z.H=o,z.A=c,xe===null&&(Ie=null,Te=0,Cr()),p}function Mb(){for(;xe!==null;)Cp(xe)}function Rb(e,t){var a=_e;_e|=2;var r=Rp(),o=Dp();Ie!==e||Te!==t?(ll=null,rl=Ve()+500,Ga(e,t)):La=us(e,t);e:do try{if(Ne!==0&&xe!==null){t=xe;var c=It;t:switch(Ne){case 1:Ne=0,It=null,$a(e,t,c,1);break;case 2:case 9:if(Gd(c)){Ne=0,It=null,Op(t);break}t=function(){Ne!==2&&Ne!==9||Ie!==e||(Ne=7),Sn(e)},c.then(t,t);break e;case 3:Ne=7;break e;case 4:Ne=5;break e;case 7:Gd(c)?(Ne=0,It=null,Op(t)):(Ne=0,It=null,$a(e,t,c,7));break;case 5:var p=null;switch(xe.tag){case 26:p=xe.memoizedState;case 5:case 27:var y=xe;if(p?mm(p):y.stateNode.complete){Ne=0,It=null;var S=y.sibling;if(S!==null)xe=S;else{var C=y.return;C!==null?(xe=C,cl(C)):xe=null}break t}}Ne=0,It=null,$a(e,t,c,5);break;case 6:Ne=0,It=null,$a(e,t,c,6);break;case 8:Qo(),Je=6;break e;default:throw Error(l(462))}}Db();break}catch(B){Ap(e,B)}while(!0);return Nn=Vi=null,z.H=r,z.A=o,_e=a,xe!==null?0:(Ie=null,Te=0,Cr(),Je)}function Db(){for(;xe!==null&&!Pe();)Cp(xe)}function Cp(e){var t=Jh(e.alternate,e,Hn);e.memoizedProps=e.pendingProps,t===null?cl(e):xe=t}function Op(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Xh(a,t,t.pendingProps,t.type,void 0,Te);break;case 11:t=Xh(a,t,t.pendingProps,t.type.render,t.ref,Te);break;case 5:co(t);default:tp(a,t),t=xe=Dd(t,Hn),t=Jh(a,t,Hn)}e.memoizedProps=e.pendingProps,t===null?cl(e):xe=t}function $a(e,t,a,r){Nn=Vi=null,co(t),Ca=null,As=0;var o=t.return;try{if(gb(e,o,t,a,Te)){Je=1,Zr(e,Jt(a,e.current)),xe=null;return}}catch(c){if(o!==null)throw xe=o,c;Je=1,Zr(e,Jt(a,e.current)),xe=null;return}t.flags&32768?(Me||r===1?e=!0:La||(Te&536870912)!==0?e=!1:(fi=e=!0,(r===2||r===9||r===3||r===6)&&(r=Gt.current,r!==null&&r.tag===13&&(r.flags|=16384))),zp(t,e)):cl(t)}function cl(e){var t=e;do{if((t.flags&32768)!==0){zp(t,fi);return}e=t.return;var a=bb(t.alternate,t,Hn);if(a!==null){xe=a;return}if(t=t.sibling,t!==null){xe=t;return}xe=t=e}while(t!==null);Je===0&&(Je=5)}function zp(e,t){do{var a=xb(e.alternate,e);if(a!==null){a.flags&=32767,xe=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){xe=e;return}xe=e=a}while(e!==null);Je=6,xe=null}function _p(e,t,a,r,o,c,p,y,S){e.cancelPendingCommit=null;do fl();while(ct!==0);if((_e&6)!==0)throw Error(l(327));if(t!==null){if(t===e.current)throw Error(l(177));if(c=t.lanes|t.childLanes,c|=ju,lv(e,a,c,p,y,S),e===Ie&&(xe=Ie=null,Te=0),Ba=t,pi=e,qn=a,Yo=c,Xo=o,Sp=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,_b(Rn,function(){return jp(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=z.T,z.T=null,o=Y.p,Y.p=2,p=_e,_e|=4;try{Sb(e,t,a)}finally{_e=p,Y.p=o,z.T=r}}ct=1,Up(),Np(),kp()}}function Up(){if(ct===1){ct=0;var e=pi,t=Ba,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=z.T,z.T=null;var r=Y.p;Y.p=2;var o=_e;_e|=4;try{hp(t,e);var c=uc,p=bd(e.containerInfo),y=c.focusedElem,S=c.selectionRange;if(p!==y&&y&&y.ownerDocument&&vd(y.ownerDocument.documentElement,y)){if(S!==null&&_u(y)){var C=S.start,B=S.end;if(B===void 0&&(B=C),"selectionStart"in y)y.selectionStart=C,y.selectionEnd=Math.min(B,y.value.length);else{var V=y.ownerDocument||document,_=V&&V.defaultView||window;if(_.getSelection){var N=_.getSelection(),ie=y.textContent.length,fe=Math.min(S.start,ie),Be=S.end===void 0?fe:Math.min(S.end,ie);!N.extend&&fe>Be&&(p=Be,Be=fe,fe=p);var M=yd(y,fe),E=yd(y,Be);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>Be?(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}}El=!!lc,uc=lc=null}finally{_e=o,Y.p=r,z.T=a}}e.current=t,ct=2}}function Np(){if(ct===2){ct=0;var e=pi,t=Ba,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=z.T,z.T=null;var r=Y.p;Y.p=2;var o=_e;_e|=4;try{up(e,t.alternate,t)}finally{_e=o,Y.p=r,z.T=a}}ct=3}}function kp(){if(ct===4||ct===3){ct=0,Qt();var e=pi,t=Ba,a=qn,r=Sp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ct=5:(ct=0,Ba=pi=null,Lp(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(hi=null),hu(a),t=t.stateNode,qe&&typeof qe.onCommitFiberRoot=="function")try{qe.onCommitFiberRoot(ft,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=z.T,o=Y.p,Y.p=2,z.T=null;try{for(var c=e.onRecoverableError,p=0;p<r.length;p++){var y=r[p];c(y.value,{componentStack:y.stack})}}finally{z.T=t,Y.p=o}}(qn&3)!==0&&fl(),Sn(e),o=e.pendingLanes,(a&261930)!==0&&(o&42)!==0?e===Ko?Vs++:(Vs=0,Ko=e):Vs=0,Fs(0)}}function Lp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Es(t)))}function fl(){return Up(),Np(),kp(),jp()}function jp(){if(ct!==5)return!1;var e=pi,t=Yo;Yo=0;var a=hu(qn),r=z.T,o=Y.p;try{Y.p=32>a?32:a,z.T=null,a=Xo,Xo=null;var c=pi,p=qn;if(ct=0,Ba=pi=null,qn=0,(_e&6)!==0)throw Error(l(331));var y=_e;if(_e|=4,vp(c.current),mp(c,c.current,p,a),_e=y,Fs(0,!1),qe&&typeof qe.onPostCommitFiberRoot=="function")try{qe.onPostCommitFiberRoot(ft,c)}catch{}return!0}finally{Y.p=o,z.T=r,Lp(e,t)}}function Bp(e,t,a){t=Jt(a,t),t=Mo(e.stateNode,t,2),e=li(e,t,2),e!==null&&(os(e,2),Sn(e))}function ke(e,t,a){if(e.tag===3)Bp(e,e,a);else for(;t!==null;){if(t.tag===3){Bp(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(hi===null||!hi.has(r))){e=Jt(a,e),a=Gh(2),r=li(t,a,2),r!==null&&($h(a,r,t,e),os(r,2),Sn(r));break}}t=t.return}}function Zo(e,t,a){var r=e.pingCache;if(r===null){r=e.pingCache=new Tb;var o=new Set;r.set(t,o)}else o=r.get(t),o===void 0&&(o=new Set,r.set(t,o));o.has(a)||(Fo=!0,o.add(a),e=Cb.bind(null,e,t,a),t.then(e,e))}function Cb(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ie===e&&(Te&a)===a&&(Je===4||Je===3&&(Te&62914560)===Te&&300>Ve()-sl?(_e&2)===0&&Ga(e,0):Ho|=a,ja===Te&&(ja=0)),Sn(e)}function Gp(e,t){t===0&&(t=Uf()),e=Gi(e,t),e!==null&&(os(e,t),Sn(e))}function Ob(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),Gp(e,a)}function zb(e,t){var a=0;switch(e.tag){case 31:case 13:var r=e.stateNode,o=e.memoizedState;o!==null&&(a=o.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(l(314))}r!==null&&r.delete(t),Gp(e,a)}function _b(e,t){return Ce(e,t)}var dl=null,Ia=null,Wo=!1,hl=!1,Jo=!1,gi=0;function Sn(e){e!==Ia&&e.next===null&&(Ia===null?dl=Ia=e:Ia=Ia.next=e),hl=!0,Wo||(Wo=!0,Nb())}function Fs(e,t){if(!Jo&&hl){Jo=!0;do for(var a=!1,r=dl;r!==null;){if(e!==0){var o=r.pendingLanes;if(o===0)var c=0;else{var p=r.suspendedLanes,y=r.pingedLanes;c=(1<<31-tt(42|e)+1)-1,c&=o&~(p&~y),c=c&201326741?c&201326741|1:c?c|2:0}c!==0&&(a=!0,Fp(r,c))}else c=Te,c=yr(r,r===Ie?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(c&3)===0||us(r,c)||(a=!0,Fp(r,c));r=r.next}while(a);Jo=!1}}function Ub(){$p()}function $p(){hl=Wo=!1;var e=0;gi!==0&&Hb()&&(e=gi);for(var t=Ve(),a=null,r=dl;r!==null;){var o=r.next,c=Ip(r,t);c===0?(r.next=null,a===null?dl=o:a.next=o,o===null&&(Ia=a)):(a=r,(e!==0||(c&3)!==0)&&(hl=!0)),r=o}ct!==0&&ct!==5||Fs(e),gi!==0&&(gi=0)}function Ip(e,t){for(var a=e.suspendedLanes,r=e.pingedLanes,o=e.expirationTimes,c=e.pendingLanes&-62914561;0<c;){var p=31-tt(c),y=1<<p,S=o[p];S===-1?((y&a)===0||(y&r)!==0)&&(o[p]=rv(y,t)):S<=t&&(e.expiredLanes|=y),c&=~y}if(t=Ie,a=Te,a=yr(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(Ne===2||Ne===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Qe(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||us(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&Qe(r),hu(a)){case 2:case 8:a=Lt;break;case 32:a=Rn;break;case 268435456:a=Dn;break;default:a=Rn}return r=Vp.bind(null,e),a=Ce(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&Qe(r),e.callbackPriority=2,e.callbackNode=null,2}function Vp(e,t){if(ct!==0&&ct!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(fl()&&e.callbackNode!==a)return null;var r=Te;return r=yr(e,e===Ie?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Ep(e,r,t),Ip(e,Ve()),e.callbackNode!=null&&e.callbackNode===a?Vp.bind(null,e):null)}function Fp(e,t){if(fl())return null;Ep(e,t,!0)}function Nb(){Yb(function(){(_e&6)!==0?Ce(xt,Ub):$p()})}function ec(){if(gi===0){var e=Ma;e===0&&(e=pr,pr<<=1,(pr&261888)===0&&(pr=256)),gi=e}return gi}function Hp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Sr(""+e)}function qp(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function kb(e,t,a,r,o){if(t==="submit"&&a&&a.stateNode===o){var c=Hp((o[Rt]||null).action),p=r.submitter;p&&(t=(t=p[Rt]||null)?Hp(t.formAction):p.getAttribute("formAction"),t!==null&&(c=t,p=null));var y=new Ar("action","action",null,r,o);e.push({event:y,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(gi!==0){var S=p?qp(o,p):new FormData(o);xo(a,{pending:!0,data:S,method:o.method,action:c},null,S)}}else typeof c=="function"&&(y.preventDefault(),S=p?qp(o,p):new FormData(o),xo(a,{pending:!0,data:S,method:o.method,action:c},c,S))},currentTarget:o}]})}}for(var tc=0;tc<Lu.length;tc++){var nc=Lu[tc],Lb=nc.toLowerCase(),jb=nc[0].toUpperCase()+nc.slice(1);mn(Lb,"on"+jb)}mn(wd,"onAnimationEnd"),mn(Ed,"onAnimationIteration"),mn(Td,"onAnimationStart"),mn("dblclick","onDoubleClick"),mn("focusin","onFocus"),mn("focusout","onBlur"),mn(Jv,"onTransitionRun"),mn(eb,"onTransitionStart"),mn(tb,"onTransitionCancel"),mn(Ad,"onTransitionEnd"),da("onMouseEnter",["mouseout","mouseover"]),da("onMouseLeave",["mouseout","mouseover"]),da("onPointerEnter",["pointerout","pointerover"]),da("onPointerLeave",["pointerout","pointerover"]),ki("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),ki("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),ki("onBeforeInput",["compositionend","keypress","textInput","paste"]),ki("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),ki("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),ki("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Hs="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),Bb=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Hs));function Yp(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var r=e[a],o=r.event;r=r.listeners;e:{var c=void 0;if(t)for(var p=r.length-1;0<=p;p--){var y=r[p],S=y.instance,C=y.currentTarget;if(y=y.listener,S!==c&&o.isPropagationStopped())break e;c=y,o.currentTarget=C;try{c(o)}catch(B){Dr(B)}o.currentTarget=null,c=S}else for(p=0;p<r.length;p++){if(y=r[p],S=y.instance,C=y.currentTarget,y=y.listener,S!==c&&o.isPropagationStopped())break e;c=y,o.currentTarget=C;try{c(o)}catch(B){Dr(B)}o.currentTarget=null,c=S}}}}function Se(e,t){var a=t[pu];a===void 0&&(a=t[pu]=new Set);var r=e+"__bubble";a.has(r)||(Xp(t,e,2,!1),a.add(r))}function ic(e,t,a){var r=0;t&&(r|=4),Xp(a,e,r,t)}var pl="_reactListening"+Math.random().toString(36).slice(2);function ac(e){if(!e[pl]){e[pl]=!0,$f.forEach(function(a){a!=="selectionchange"&&(Bb.has(a)||ic(a,!1,e),ic(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[pl]||(t[pl]=!0,ic("selectionchange",!1,t))}}function Xp(e,t,a,r){switch(wm(t)){case 2:var o=dx;break;case 8:o=hx;break;default:o=bc}a=o.bind(null,t,a,e),o=void 0,!Eu||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(o=!0),r?o!==void 0?e.addEventListener(t,a,{capture:!0,passive:o}):e.addEventListener(t,a,!0):o!==void 0?e.addEventListener(t,a,{passive:o}):e.addEventListener(t,a,!1)}function sc(e,t,a,r,o){var c=r;if((t&1)===0&&(t&2)===0&&r!==null)e:for(;;){if(r===null)return;var p=r.tag;if(p===3||p===4){var y=r.stateNode.containerInfo;if(y===o)break;if(p===4)for(p=r.return;p!==null;){var S=p.tag;if((S===3||S===4)&&p.stateNode.containerInfo===o)return;p=p.return}for(;y!==null;){if(p=oa(y),p===null)return;if(S=p.tag,S===5||S===6||S===26||S===27){r=c=p;continue e}y=y.parentNode}}r=r.return}Wf(function(){var C=c,B=Su(a),V=[];e:{var _=Md.get(e);if(_!==void 0){var N=Ar,ie=e;switch(e){case"keypress":if(Er(a)===0)break e;case"keydown":case"keyup":N=zv;break;case"focusin":ie="focus",N=Ru;break;case"focusout":ie="blur",N=Ru;break;case"beforeblur":case"afterblur":N=Ru;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=td;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":N=bv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":N=Nv;break;case wd:case Ed:case Td:N=wv;break;case Ad:N=Lv;break;case"scroll":case"scrollend":N=yv;break;case"wheel":N=Bv;break;case"copy":case"cut":case"paste":N=Tv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":N=id;break;case"toggle":case"beforetoggle":N=$v}var fe=(t&4)!==0,Be=!fe&&(e==="scroll"||e==="scrollend"),M=fe?_!==null?_+"Capture":null:_;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=ds(E,M),I!=null&&fe.push(qs(E,I,D))),Be)break;E=E.return}0<fe.length&&(_=new N(_,ie,null,a,B),V.push({event:_,listeners:fe}))}}if((t&7)===0){e:{if(_=e==="mouseover"||e==="pointerover",N=e==="mouseout"||e==="pointerout",_&&a!==xu&&(ie=a.relatedTarget||a.fromElement)&&(oa(ie)||ie[ua]))break e;if((N||_)&&(_=B.window===B?B:(_=B.ownerDocument)?_.defaultView||_.parentWindow:window,N?(ie=a.relatedTarget||a.toElement,N=C,ie=ie?oa(ie):null,ie!==null&&(Be=f(ie),fe=ie.tag,ie!==Be||fe!==5&&fe!==27&&fe!==6)&&(ie=null)):(N=null,ie=C),N!==ie)){if(fe=td,I="onMouseLeave",M="onMouseEnter",E="mouse",(e==="pointerout"||e==="pointerover")&&(fe=id,I="onPointerLeave",M="onPointerEnter",E="pointer"),Be=N==null?_:fs(N),D=ie==null?_:fs(ie),_=new fe(I,E+"leave",N,a,B),_.target=Be,_.relatedTarget=D,I=null,oa(B)===C&&(fe=new fe(M,E+"enter",ie,a,B),fe.target=D,fe.relatedTarget=Be,I=fe),Be=I,N&&ie)t:{for(fe=Gb,M=N,E=ie,D=0,I=M;I;I=fe(I))D++;I=0;for(var ce=E;ce;ce=fe(ce))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&&Kp(V,_,N,fe,!1),ie!==null&&Be!==null&&Kp(V,Be,ie,fe,!0)}}e:{if(_=C?fs(C):window,N=_.nodeName&&_.nodeName.toLowerCase(),N==="select"||N==="input"&&_.type==="file")var Oe=fd;else if(od(_))if(dd)Oe=Pv;else{Oe=Kv;var re=Xv}else N=_.nodeName,!N||N.toLowerCase()!=="input"||_.type!=="checkbox"&&_.type!=="radio"?C&&bu(C.elementType)&&(Oe=fd):Oe=Qv;if(Oe&&(Oe=Oe(e,C))){cd(V,Oe,a,B);break e}re&&re(e,_,C),e==="focusout"&&C&&_.type==="number"&&C.memoizedProps.value!=null&&vu(_,"number",_.value)}switch(re=C?fs(C):window,e){case"focusin":(od(re)||re.contentEditable==="true")&&(va=re,Uu=C,xs=null);break;case"focusout":xs=Uu=va=null;break;case"mousedown":Nu=!0;break;case"contextmenu":case"mouseup":case"dragend":Nu=!1,xd(V,a,B);break;case"selectionchange":if(Wv)break;case"keydown":case"keyup":xd(V,a,B)}var ve;if(Cu)e:{switch(e){case"compositionstart":var Ae="onCompositionStart";break e;case"compositionend":Ae="onCompositionEnd";break e;case"compositionupdate":Ae="onCompositionUpdate";break e}Ae=void 0}else ya?ld(e,a)&&(Ae="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ae="onCompositionStart");Ae&&(ad&&a.locale!=="ko"&&(ya||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&ya&&(ve=Jf()):(ei=B,Tu="value"in ei?ei.value:ei.textContent,ya=!0)),re=ml(C,Ae),0<re.length&&(Ae=new nd(Ae,e,null,a,B),V.push({event:Ae,listeners:re}),ve?Ae.data=ve:(ve=ud(a),ve!==null&&(Ae.data=ve)))),(ve=Vv?Fv(e,a):Hv(e,a))&&(Ae=ml(C,"onBeforeInput"),0<Ae.length&&(re=new nd("onBeforeInput","beforeinput",null,a,B),V.push({event:re,listeners:Ae}),re.data=ve)),kb(V,e,C,a,B)}Yp(V,t)})}function qs(e,t,a){return{instance:e,listener:t,currentTarget:a}}function ml(e,t){for(var a=t+"Capture",r=[];e!==null;){var o=e,c=o.stateNode;if(o=o.tag,o!==5&&o!==26&&o!==27||c===null||(o=ds(e,a),o!=null&&r.unshift(qs(e,o,c)),o=ds(e,t),o!=null&&r.push(qs(e,o,c))),e.tag===3)return r;e=e.return}return[]}function Gb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Kp(e,t,a,r,o){for(var c=t._reactName,p=[];a!==null&&a!==r;){var y=a,S=y.alternate,C=y.stateNode;if(y=y.tag,S!==null&&S===r)break;y!==5&&y!==26&&y!==27||C===null||(S=C,o?(C=ds(a,c),C!=null&&p.unshift(qs(a,C,S))):o||(C=ds(a,c),C!=null&&p.push(qs(a,C,S)))),a=a.return}p.length!==0&&e.push({event:t,listeners:p})}var $b=/\r\n?/g,Ib=/\u0000|\uFFFD/g;function Qp(e){return(typeof e=="string"?e:""+e).replace($b,`
|
|
9
|
+
`).replace(Ib,"")}function Pp(e,t){return t=Qp(t),Qp(e)===t}function je(e,t,a,r,o,c){switch(a){case"children":typeof r=="string"?t==="body"||t==="textarea"&&r===""||pa(e,r):(typeof r=="number"||typeof r=="bigint")&&t!=="body"&&pa(e,""+r);break;case"className":br(e,"class",r);break;case"tabIndex":br(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":br(e,a,r);break;case"style":Pf(e,r,c);break;case"data":if(t!=="object"){br(e,"data",r);break}case"src":case"href":if(r===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(r==null||typeof r=="function"||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Sr(""+r),e.setAttribute(a,r);break;case"action":case"formAction":if(typeof r=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof c=="function"&&(a==="formAction"?(t!=="input"&&je(e,t,"name",o.name,o,null),je(e,t,"formEncType",o.formEncType,o,null),je(e,t,"formMethod",o.formMethod,o,null),je(e,t,"formTarget",o.formTarget,o,null)):(je(e,t,"encType",o.encType,o,null),je(e,t,"method",o.method,o,null),je(e,t,"target",o.target,o,null)));if(r==null||typeof r=="symbol"||typeof r=="boolean"){e.removeAttribute(a);break}r=Sr(""+r),e.setAttribute(a,r);break;case"onClick":r!=null&&(e.onclick=On);break;case"onScroll":r!=null&&Se("scroll",e);break;case"onScrollEnd":r!=null&&Se("scrollend",e);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(l(61));if(a=r.__html,a!=null){if(o.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"multiple":e.multiple=r&&typeof r!="function"&&typeof r!="symbol";break;case"muted":e.muted=r&&typeof r!="function"&&typeof r!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(r==null||typeof r=="function"||typeof r=="boolean"||typeof r=="symbol"){e.removeAttribute("xlink:href");break}a=Sr(""+r),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""+r):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":r&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":r===!0?e.setAttribute(a,""):r!==!1&&r!=null&&typeof r!="function"&&typeof r!="symbol"?e.setAttribute(a,r):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":r!=null&&typeof r!="function"&&typeof r!="symbol"&&!isNaN(r)&&1<=r?e.setAttribute(a,r):e.removeAttribute(a);break;case"rowSpan":case"start":r==null||typeof r=="function"||typeof r=="symbol"||isNaN(r)?e.removeAttribute(a):e.setAttribute(a,r);break;case"popover":Se("beforetoggle",e),Se("toggle",e),vr(e,"popover",r);break;case"xlinkActuate":Cn(e,"http://www.w3.org/1999/xlink","xlink:actuate",r);break;case"xlinkArcrole":Cn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",r);break;case"xlinkRole":Cn(e,"http://www.w3.org/1999/xlink","xlink:role",r);break;case"xlinkShow":Cn(e,"http://www.w3.org/1999/xlink","xlink:show",r);break;case"xlinkTitle":Cn(e,"http://www.w3.org/1999/xlink","xlink:title",r);break;case"xlinkType":Cn(e,"http://www.w3.org/1999/xlink","xlink:type",r);break;case"xmlBase":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:base",r);break;case"xmlLang":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",r);break;case"xmlSpace":Cn(e,"http://www.w3.org/XML/1998/namespace","xml:space",r);break;case"is":vr(e,"is",r);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=mv.get(a)||a,vr(e,a,r))}}function rc(e,t,a,r,o,c){switch(a){case"style":Pf(e,r,c);break;case"dangerouslySetInnerHTML":if(r!=null){if(typeof r!="object"||!("__html"in r))throw Error(l(61));if(a=r.__html,a!=null){if(o.children!=null)throw Error(l(60));e.innerHTML=a}}break;case"children":typeof r=="string"?pa(e,r):(typeof r=="number"||typeof r=="bigint")&&pa(e,""+r);break;case"onScroll":r!=null&&Se("scroll",e);break;case"onScrollEnd":r!=null&&Se("scrollend",e);break;case"onClick":r!=null&&(e.onclick=On);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!If.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(o=a.endsWith("Capture"),t=a.slice(2,o?a.length-7:void 0),c=e[Rt]||null,c=c!=null?c[a]:null,typeof c=="function"&&e.removeEventListener(t,c,o),typeof r=="function")){typeof c!="function"&&c!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,r,o);break e}a in e?e[a]=r:r===!0?e.setAttribute(a,""):vr(e,a,r)}}}function bt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Se("error",e),Se("load",e);var r=!1,o=!1,c;for(c in a)if(a.hasOwnProperty(c)){var p=a[c];if(p!=null)switch(c){case"src":r=!0;break;case"srcSet":o=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:je(e,t,c,p,a,null)}}o&&je(e,t,"srcSet",a.srcSet,a,null),r&&je(e,t,"src",a.src,a,null);return;case"input":Se("invalid",e);var y=c=p=o=null,S=null,C=null;for(r in a)if(a.hasOwnProperty(r)){var B=a[r];if(B!=null)switch(r){case"name":o=B;break;case"type":p=B;break;case"checked":S=B;break;case"defaultChecked":C=B;break;case"value":c=B;break;case"defaultValue":y=B;break;case"children":case"dangerouslySetInnerHTML":if(B!=null)throw Error(l(137,t));break;default:je(e,t,r,B,a,null)}}Yf(e,c,y,S,C,p,o,!1);return;case"select":Se("invalid",e),r=p=c=null;for(o in a)if(a.hasOwnProperty(o)&&(y=a[o],y!=null))switch(o){case"value":c=y;break;case"defaultValue":p=y;break;case"multiple":r=y;default:je(e,t,o,y,a,null)}t=c,a=p,e.multiple=!!r,t!=null?ha(e,!!r,t,!1):a!=null&&ha(e,!!r,a,!0);return;case"textarea":Se("invalid",e),c=o=r=null;for(p in a)if(a.hasOwnProperty(p)&&(y=a[p],y!=null))switch(p){case"value":r=y;break;case"defaultValue":o=y;break;case"children":c=y;break;case"dangerouslySetInnerHTML":if(y!=null)throw Error(l(91));break;default:je(e,t,p,y,a,null)}Kf(e,r,o,c);return;case"option":for(S in a)a.hasOwnProperty(S)&&(r=a[S],r!=null)&&(S==="selected"?e.selected=r&&typeof r!="function"&&typeof r!="symbol":je(e,t,S,r,a,null));return;case"dialog":Se("beforetoggle",e),Se("toggle",e),Se("cancel",e),Se("close",e);break;case"iframe":case"object":Se("load",e);break;case"video":case"audio":for(r=0;r<Hs.length;r++)Se(Hs[r],e);break;case"image":Se("error",e),Se("load",e);break;case"details":Se("toggle",e);break;case"embed":case"source":case"link":Se("error",e),Se("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(C in a)if(a.hasOwnProperty(C)&&(r=a[C],r!=null))switch(C){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:je(e,t,C,r,a,null)}return;default:if(bu(t)){for(B in a)a.hasOwnProperty(B)&&(r=a[B],r!==void 0&&rc(e,t,B,r,a,void 0));return}}for(y in a)a.hasOwnProperty(y)&&(r=a[y],r!=null&&je(e,t,y,r,a,null))}function Vb(e,t,a,r){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var o=null,c=null,p=null,y=null,S=null,C=null,B=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:r.hasOwnProperty(N)||je(e,t,N,null,r,V)}}for(var _ in r){var N=r[_];if(V=a[_],r.hasOwnProperty(_)&&(N!=null||V!=null))switch(_){case"type":c=N;break;case"name":o=N;break;case"checked":C=N;break;case"defaultChecked":B=N;break;case"value":p=N;break;case"defaultValue":y=N;break;case"children":case"dangerouslySetInnerHTML":if(N!=null)throw Error(l(137,t));break;default:N!==V&&je(e,t,_,N,r,V)}}yu(e,p,y,S,C,B,c,o);return;case"select":N=p=y=_=null;for(c in a)if(S=a[c],a.hasOwnProperty(c)&&S!=null)switch(c){case"value":break;case"multiple":N=S;default:r.hasOwnProperty(c)||je(e,t,c,null,r,S)}for(o in r)if(c=r[o],S=a[o],r.hasOwnProperty(o)&&(c!=null||S!=null))switch(o){case"value":_=c;break;case"defaultValue":y=c;break;case"multiple":p=c;default:c!==S&&je(e,t,o,c,r,S)}t=y,a=p,r=N,_!=null?ha(e,!!a,_,!1):!!r!=!!a&&(t!=null?ha(e,!!a,t,!0):ha(e,!!a,a?[]:"",!1));return;case"textarea":N=_=null;for(y in a)if(o=a[y],a.hasOwnProperty(y)&&o!=null&&!r.hasOwnProperty(y))switch(y){case"value":break;case"children":break;default:je(e,t,y,null,r,o)}for(p in r)if(o=r[p],c=a[p],r.hasOwnProperty(p)&&(o!=null||c!=null))switch(p){case"value":_=o;break;case"defaultValue":N=o;break;case"children":break;case"dangerouslySetInnerHTML":if(o!=null)throw Error(l(91));break;default:o!==c&&je(e,t,p,o,r,c)}Xf(e,_,N);return;case"option":for(var ie in a)_=a[ie],a.hasOwnProperty(ie)&&_!=null&&!r.hasOwnProperty(ie)&&(ie==="selected"?e.selected=!1:je(e,t,ie,null,r,_));for(S in r)_=r[S],N=a[S],r.hasOwnProperty(S)&&_!==N&&(_!=null||N!=null)&&(S==="selected"?e.selected=_&&typeof _!="function"&&typeof _!="symbol":je(e,t,S,_,r,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)_=a[fe],a.hasOwnProperty(fe)&&_!=null&&!r.hasOwnProperty(fe)&&je(e,t,fe,null,r,_);for(C in r)if(_=r[C],N=a[C],r.hasOwnProperty(C)&&_!==N&&(_!=null||N!=null))switch(C){case"children":case"dangerouslySetInnerHTML":if(_!=null)throw Error(l(137,t));break;default:je(e,t,C,_,r,N)}return;default:if(bu(t)){for(var Be in a)_=a[Be],a.hasOwnProperty(Be)&&_!==void 0&&!r.hasOwnProperty(Be)&&rc(e,t,Be,void 0,r,_);for(B in r)_=r[B],N=a[B],!r.hasOwnProperty(B)||_===N||_===void 0&&N===void 0||rc(e,t,B,_,r,N);return}}for(var M in a)_=a[M],a.hasOwnProperty(M)&&_!=null&&!r.hasOwnProperty(M)&&je(e,t,M,null,r,_);for(V in r)_=r[V],N=a[V],!r.hasOwnProperty(V)||_===N||_==null&&N==null||je(e,t,V,_,r,N)}function Zp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Fb(){if(typeof performance.getEntriesByType=="function"){for(var e=0,t=0,a=performance.getEntriesByType("resource"),r=0;r<a.length;r++){var o=a[r],c=o.transferSize,p=o.initiatorType,y=o.duration;if(c&&y&&Zp(p)){for(p=0,y=o.responseEnd,r+=1;r<a.length;r++){var S=a[r],C=S.startTime;if(C>y)break;var B=S.transferSize,V=S.initiatorType;B&&Zp(V)&&(S=S.responseEnd,p+=B*(S<y?1:(y-C)/(S-C)))}if(--r,t+=8*(c+p)/(o.duration/1e3),e++,10<e)break}}if(0<e)return t/e/1e6}return navigator.connection&&(e=navigator.connection.downlink,typeof e=="number")?e:5}var lc=null,uc=null;function gl(e){return e.nodeType===9?e:e.ownerDocument}function Wp(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 Jp(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 oc(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var cc=null;function Hb(){var e=window.event;return e&&e.type==="popstate"?e===cc?!1:(cc=e,!0):(cc=null,!1)}var em=typeof setTimeout=="function"?setTimeout:void 0,qb=typeof clearTimeout=="function"?clearTimeout:void 0,tm=typeof Promise=="function"?Promise:void 0,Yb=typeof queueMicrotask=="function"?queueMicrotask:typeof tm<"u"?function(e){return tm.resolve(null).then(e).catch(Xb)}:em;function Xb(e){setTimeout(function(){throw e})}function yi(e){return e==="head"}function nm(e,t){var a=t,r=0;do{var o=a.nextSibling;if(e.removeChild(a),o&&o.nodeType===8)if(a=o.data,a==="/$"||a==="/&"){if(r===0){e.removeChild(o),qa(t);return}r--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")r++;else if(a==="html")Ys(e.ownerDocument.documentElement);else if(a==="head"){a=e.ownerDocument.head,Ys(a);for(var c=a.firstChild;c;){var p=c.nextSibling,y=c.nodeName;c[cs]||y==="SCRIPT"||y==="STYLE"||y==="LINK"&&c.rel.toLowerCase()==="stylesheet"||a.removeChild(c),c=p}}else a==="body"&&Ys(e.ownerDocument.body);a=o}while(a);qa(t)}function im(e,t){var a=e;e=0;do{var r=a.nextSibling;if(a.nodeType===1?t?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(t?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),r&&r.nodeType===8)if(a=r.data,a==="/$"){if(e===0)break;e--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||e++;a=r}while(a)}function fc(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":fc(a),mu(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function Kb(e,t,a,r){for(;e.nodeType===1;){var o=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!r&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(r){if(!e[cs])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(c=e.getAttribute("rel"),c==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(c!==o.rel||e.getAttribute("href")!==(o.href==null||o.href===""?null:o.href)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin)||e.getAttribute("title")!==(o.title==null?null:o.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(c=e.getAttribute("src"),(c!==(o.src==null?null:o.src)||e.getAttribute("type")!==(o.type==null?null:o.type)||e.getAttribute("crossorigin")!==(o.crossOrigin==null?null:o.crossOrigin))&&c&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var c=o.name==null?null:""+o.name;if(o.type==="hidden"&&e.getAttribute("name")===c)return e}else return e;if(e=sn(e.nextSibling),e===null)break}return null}function Qb(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=sn(e.nextSibling),e===null))return null;return e}function am(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=sn(e.nextSibling),e===null))return null;return e}function dc(e){return e.data==="$?"||e.data==="$~"}function hc(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState!=="loading"}function Pb(e,t){var a=e.ownerDocument;if(e.data==="$~")e._reactRetry=t;else if(e.data!=="$?"||a.readyState!=="loading")t();else{var r=function(){t(),a.removeEventListener("DOMContentLoaded",r)};a.addEventListener("DOMContentLoaded",r),e._reactRetry=r}}function sn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="$~"||t==="&"||t==="F!"||t==="F")break;if(t==="/$"||t==="/&")return null}}return e}var pc=null;function sm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return sn(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function rm(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 lm(e,t,a){switch(t=gl(a),e){case"html":if(e=t.documentElement,!e)throw Error(l(452));return e;case"head":if(e=t.head,!e)throw Error(l(453));return e;case"body":if(e=t.body,!e)throw Error(l(454));return e;default:throw Error(l(451))}}function Ys(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);mu(e)}var rn=new Map,um=new Set;function yl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Yn=Y.d;Y.d={f:Zb,r:Wb,D:Jb,C:ex,L:tx,m:nx,X:ax,S:ix,M:sx};function Zb(){var e=Yn.f(),t=ul();return e||t}function Wb(e){var t=ca(e);t!==null&&t.tag===5&&t.type==="form"?Ah(t):Yn.r(e)}var Va=typeof document>"u"?null:document;function om(e,t,a){var r=Va;if(r&&typeof t=="string"&&t){var o=Zt(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),um.has(o)||(um.add(o),e={rel:e,crossOrigin:a,href:t},r.querySelector(o)===null&&(t=r.createElement("link"),bt(t,"link",e),dt(t),r.head.appendChild(t)))}}function Jb(e){Yn.D(e),om("dns-prefetch",e,null)}function ex(e,t){Yn.C(e,t),om("preconnect",e,t)}function tx(e,t,a){Yn.L(e,t,a);var r=Va;if(r&&e&&t){var o='link[rel="preload"][as="'+Zt(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+Zt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+Zt(a.imageSizes)+'"]')):o+='[href="'+Zt(e)+'"]';var c=o;switch(t){case"style":c=Fa(e);break;case"script":c=Ha(e)}rn.has(c)||(e=x({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),rn.set(c,e),r.querySelector(o)!==null||t==="style"&&r.querySelector(Xs(c))||t==="script"&&r.querySelector(Ks(c))||(t=r.createElement("link"),bt(t,"link",e),dt(t),r.head.appendChild(t)))}}function nx(e,t){Yn.m(e,t);var a=Va;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Zt(r)+'"][href="'+Zt(e)+'"]',c=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=Ha(e)}if(!rn.has(c)&&(e=x({rel:"modulepreload",href:e},t),rn.set(c,e),a.querySelector(o)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Ks(c)))return}r=a.createElement("link"),bt(r,"link",e),dt(r),a.head.appendChild(r)}}}function ix(e,t,a){Yn.S(e,t,a);var r=Va;if(r&&e){var o=fa(r).hoistableStyles,c=Fa(e);t=t||"default";var p=o.get(c);if(!p){var y={loading:0,preload:null};if(p=r.querySelector(Xs(c)))y.loading=5;else{e=x({rel:"stylesheet",href:e,"data-precedence":t},a),(a=rn.get(c))&&mc(e,a);var S=p=r.createElement("link");dt(S),bt(S,"link",e),S._p=new Promise(function(C,B){S.onload=C,S.onerror=B}),S.addEventListener("load",function(){y.loading|=1}),S.addEventListener("error",function(){y.loading|=2}),y.loading|=4,vl(p,t,r)}p={type:"stylesheet",instance:p,count:1,state:y},o.set(c,p)}}}function ax(e,t){Yn.X(e,t);var a=Va;if(a&&e){var r=fa(a).hoistableScripts,o=Ha(e),c=r.get(o);c||(c=a.querySelector(Ks(o)),c||(e=x({src:e,async:!0},t),(t=rn.get(o))&&gc(e,t),c=a.createElement("script"),dt(c),bt(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},r.set(o,c))}}function sx(e,t){Yn.M(e,t);var a=Va;if(a&&e){var r=fa(a).hoistableScripts,o=Ha(e),c=r.get(o);c||(c=a.querySelector(Ks(o)),c||(e=x({src:e,async:!0,type:"module"},t),(t=rn.get(o))&&gc(e,t),c=a.createElement("script"),dt(c),bt(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},r.set(o,c))}}function cm(e,t,a,r){var o=(o=he.current)?yl(o):null;if(!o)throw Error(l(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Fa(a.href),a=fa(o).hoistableStyles,r=a.get(t),r||(r={type:"style",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Fa(a.href);var c=fa(o).hoistableStyles,p=c.get(e);if(p||(o=o.ownerDocument||o,p={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},c.set(e,p),(c=o.querySelector(Xs(e)))&&!c._p&&(p.instance=c,p.state.loading=5),rn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},rn.set(e,a),c||rx(o,e,a,p.state))),t&&r===null)throw Error(l(528,""));return p}if(t&&r!==null)throw Error(l(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=Ha(a),a=fa(o).hoistableScripts,r=a.get(t),r||(r={type:"script",instance:null,count:0,state:null},a.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(l(444,e))}}function Fa(e){return'href="'+Zt(e)+'"'}function Xs(e){return'link[rel="stylesheet"]['+e+"]"}function fm(e){return x({},e,{"data-precedence":e.precedence,precedence:null})}function rx(e,t,a,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),bt(t,"link",a),dt(t),e.head.appendChild(t))}function Ha(e){return'[src="'+Zt(e)+'"]'}function Ks(e){return"script[async]"+e}function dm(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Zt(a.href)+'"]');if(r)return t.instance=r,dt(r),r;var o=x({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),dt(r),bt(r,"style",o),vl(r,a.precedence,e),t.instance=r;case"stylesheet":o=Fa(a.href);var c=e.querySelector(Xs(o));if(c)return t.state.loading|=4,t.instance=c,dt(c),c;r=fm(a),(o=rn.get(o))&&mc(r,o),c=(e.ownerDocument||e).createElement("link"),dt(c);var p=c;return p._p=new Promise(function(y,S){p.onload=y,p.onerror=S}),bt(c,"link",r),t.state.loading|=4,vl(c,a.precedence,e),t.instance=c;case"script":return c=Ha(a.src),(o=e.querySelector(Ks(c)))?(t.instance=o,dt(o),o):(r=a,(o=rn.get(c))&&(r=x({},a),gc(r,o)),e=e.ownerDocument||e,o=e.createElement("script"),dt(o),bt(o,"link",r),e.head.appendChild(o),t.instance=o);case"void":return null;default:throw Error(l(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,vl(r,a.precedence,e));return t.instance}function vl(e,t,a){for(var r=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),o=r.length?r[r.length-1]:null,c=o,p=0;p<r.length;p++){var y=r[p];if(y.dataset.precedence===t)c=y;else if(c!==o)break}c?c.parentNode.insertBefore(e,c.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function mc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function gc(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var bl=null;function hm(e,t,a){if(bl===null){var r=new Map,o=bl=new Map;o.set(a,r)}else o=bl,r=o.get(a),r||(r=new Map,o.set(a,r));if(r.has(e))return r;for(r.set(e,null),a=a.getElementsByTagName(e),o=0;o<a.length;o++){var c=a[o];if(!(c[cs]||c[mt]||e==="link"&&c.getAttribute("rel")==="stylesheet")&&c.namespaceURI!=="http://www.w3.org/2000/svg"){var p=c.getAttribute(t)||"";p=e+p;var y=r.get(p);y?y.push(c):r.set(p,[c])}}return r}function pm(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function lx(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;return t.rel==="stylesheet"?(e=t.disabled,typeof t.precedence=="string"&&e==null):!0;case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function mm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ux(e,t,a,r){if(a.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var o=Fa(r.href),c=t.querySelector(Xs(o));if(c){t=c._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=xl.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=c,dt(c);return}c=t.ownerDocument||t,r=fm(r),(o=rn.get(o))&&mc(r,o),c=c.createElement("link"),dt(c);var p=c;p._p=new Promise(function(y,S){p.onload=y,p.onerror=S}),bt(c,"link",r),a.instance=c}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(a,t),(t=a.state.preload)&&(a.state.loading&3)===0&&(e.count++,a=xl.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var yc=0;function ox(e,t){return e.stylesheets&&e.count===0&&wl(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&wl(e,e.stylesheets),e.unsuspend){var c=e.unsuspend;e.unsuspend=null,c()}},6e4+t);0<e.imgBytes&&yc===0&&(yc=62500*Fb());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&wl(e,e.stylesheets),e.unsuspend)){var c=e.unsuspend;e.unsuspend=null,c()}},(e.imgBytes>yc?50:800)+t);return e.unsuspend=a,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(o)}}:null}function xl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)wl(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var Sl=null;function wl(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,Sl=new Map,t.forEach(cx,e),Sl=null,xl.call(e))}function cx(e,t){if(!(t.state.loading&4)){var a=Sl.get(e);if(a)var r=a.get(null);else{a=new Map,Sl.set(e,a);for(var o=e.querySelectorAll("link[data-precedence],style[data-precedence]"),c=0;c<o.length;c++){var p=o[c];(p.nodeName==="LINK"||p.getAttribute("media")!=="not all")&&(a.set(p.dataset.precedence,p),r=p)}r&&a.set(null,r)}o=t.instance,p=o.getAttribute("data-precedence"),c=a.get(p)||r,c===r&&a.set(null,o),a.set(p,o),this.count++,r=xl.bind(this),o.addEventListener("load",r),o.addEventListener("error",r),c?c.parentNode.insertBefore(o,c.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(o,e.firstChild)),t.state.loading|=4}}var Qs={$$typeof:H,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function fx(e,t,a,r,o,c,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=fu(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=fu(0),this.hiddenUpdates=fu(null),this.identifierPrefix=r,this.onUncaughtError=o,this.onCaughtError=c,this.onRecoverableError=p,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=S,this.incompleteTransitions=new Map}function gm(e,t,a,r,o,c,p,y,S,C,B,V){return e=new fx(e,t,a,p,S,C,B,V,y),t=1,c===!0&&(t|=24),c=Bt(3,null,null,t),e.current=c,c.stateNode=e,t=Qu(),t.refCount++,e.pooledCache=t,t.refCount++,c.memoizedState={element:r,isDehydrated:a,cache:t},Ju(c),e}function ym(e){return e?(e=Sa,e):Sa}function vm(e,t,a,r,o,c){o=ym(o),r.context===null?r.context=o:r.pendingContext=o,r=ri(t),r.payload={element:a},c=c===void 0?null:c,c!==null&&(r.callback=c),a=li(e,r,t),a!==null&&(Ut(a,e,t),Rs(a,e,t))}function bm(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function vc(e,t){bm(e,t),(e=e.alternate)&&bm(e,t)}function xm(e){if(e.tag===13||e.tag===31){var t=Gi(e,67108864);t!==null&&Ut(t,e,67108864),vc(e,67108864)}}function Sm(e){if(e.tag===13||e.tag===31){var t=Ft();t=du(t);var a=Gi(e,t);a!==null&&Ut(a,e,t),vc(e,t)}}var El=!0;function dx(e,t,a,r){var o=z.T;z.T=null;var c=Y.p;try{Y.p=2,bc(e,t,a,r)}finally{Y.p=c,z.T=o}}function hx(e,t,a,r){var o=z.T;z.T=null;var c=Y.p;try{Y.p=8,bc(e,t,a,r)}finally{Y.p=c,z.T=o}}function bc(e,t,a,r){if(El){var o=xc(r);if(o===null)sc(e,t,r,Tl,a),Em(e,r);else if(mx(o,e,t,a,r))r.stopPropagation();else if(Em(e,r),t&4&&-1<px.indexOf(e)){for(;o!==null;){var c=ca(o);if(c!==null)switch(c.tag){case 3:if(c=c.stateNode,c.current.memoizedState.isDehydrated){var p=Ni(c.pendingLanes);if(p!==0){var y=c;for(y.pendingLanes|=2,y.entangledLanes|=2;p;){var S=1<<31-tt(p);y.entanglements[1]|=S,p&=~S}Sn(c),(_e&6)===0&&(rl=Ve()+500,Fs(0))}}break;case 31:case 13:y=Gi(c,2),y!==null&&Ut(y,c,2),ul(),vc(c,2)}if(c=xc(r),c===null&&sc(e,t,r,Tl,a),c===o)break;o=c}o!==null&&r.stopPropagation()}else sc(e,t,r,null,a)}}function xc(e){return e=Su(e),Sc(e)}var Tl=null;function Sc(e){if(Tl=null,e=oa(e),e!==null){var t=f(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 Tl=e,null}function wm(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(pn()){case xt:return 2;case Lt:return 8;case Rn:case la:return 32;case Dn:return 268435456;default:return 32}default:return 32}}var wc=!1,vi=null,bi=null,xi=null,Ps=new Map,Zs=new Map,Si=[],px="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function Em(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":Ps.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":Zs.delete(t.pointerId)}}function Ws(e,t,a,r,o,c){return e===null||e.nativeEvent!==c?(e={blockedOn:t,domEventName:a,eventSystemFlags:r,nativeEvent:c,targetContainers:[o]},t!==null&&(t=ca(t),t!==null&&xm(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function mx(e,t,a,r,o){switch(t){case"focusin":return vi=Ws(vi,e,t,a,r,o),!0;case"dragenter":return bi=Ws(bi,e,t,a,r,o),!0;case"mouseover":return xi=Ws(xi,e,t,a,r,o),!0;case"pointerover":var c=o.pointerId;return Ps.set(c,Ws(Ps.get(c)||null,e,t,a,r,o)),!0;case"gotpointercapture":return c=o.pointerId,Zs.set(c,Ws(Zs.get(c)||null,e,t,a,r,o)),!0}return!1}function Tm(e){var t=oa(e.target);if(t!==null){var a=f(t);if(a!==null){if(t=a.tag,t===13){if(t=d(a),t!==null){e.blockedOn=t,Bf(e.priority,function(){Sm(a)});return}}else if(t===31){if(t=h(a),t!==null){e.blockedOn=t,Bf(e.priority,function(){Sm(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 Al(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=xc(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);xu=r,a.target.dispatchEvent(r),xu=null}else return t=ca(a),t!==null&&xm(t),e.blockedOn=a,!1;t.shift()}return!0}function Am(e,t,a){Al(e)&&a.delete(t)}function gx(){wc=!1,vi!==null&&Al(vi)&&(vi=null),bi!==null&&Al(bi)&&(bi=null),xi!==null&&Al(xi)&&(xi=null),Ps.forEach(Am),Zs.forEach(Am)}function Ml(e,t){e.blockedOn===t&&(e.blockedOn=null,wc||(wc=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,gx)))}var Rl=null;function Mm(e){Rl!==e&&(Rl=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Rl===e&&(Rl=null);for(var t=0;t<e.length;t+=3){var a=e[t],r=e[t+1],o=e[t+2];if(typeof r!="function"){if(Sc(r||a)===null)continue;break}var c=ca(a);c!==null&&(e.splice(t,3),t-=3,xo(c,{pending:!0,data:o,method:a.method,action:r},r,o))}}))}function qa(e){function t(S){return Ml(S,e)}vi!==null&&Ml(vi,e),bi!==null&&Ml(bi,e),xi!==null&&Ml(xi,e),Ps.forEach(t),Zs.forEach(t);for(var a=0;a<Si.length;a++){var r=Si[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<Si.length&&(a=Si[0],a.blockedOn===null);)Tm(a),a.blockedOn===null&&Si.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(r=0;r<a.length;r+=3){var o=a[r],c=a[r+1],p=o[Rt]||null;if(typeof c=="function")p||Mm(a);else if(p){var y=null;if(c&&c.hasAttribute("formAction")){if(o=c,p=c[Rt]||null)y=p.formAction;else if(Sc(o)!==null)continue}else y=p.action;typeof y=="function"?a[r+1]=y:(a.splice(r,3),r-=3),Mm(a)}}}function Rm(){function e(c){c.canIntercept&&c.info==="react-transition"&&c.intercept({handler:function(){return new Promise(function(p){return o=p})},focusReset:"manual",scroll:"manual"})}function t(){o!==null&&(o(),o=null),r||setTimeout(a,20)}function a(){if(!r&&!navigation.transition){var c=navigation.currentEntry;c&&c.url!=null&&navigation.navigate(c.url,{state:c.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var r=!1,o=null;return navigation.addEventListener("navigate",e),navigation.addEventListener("navigatesuccess",t),navigation.addEventListener("navigateerror",t),setTimeout(a,100),function(){r=!0,navigation.removeEventListener("navigate",e),navigation.removeEventListener("navigatesuccess",t),navigation.removeEventListener("navigateerror",t),o!==null&&(o(),o=null)}}}function Ec(e){this._internalRoot=e}Dl.prototype.render=Ec.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var a=t.current,r=Ft();vm(a,r,e,t,null,null)},Dl.prototype.unmount=Ec.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;vm(e.current,2,null,e,null,null),ul(),t[ua]=null}};function Dl(e){this._internalRoot=e}Dl.prototype.unstable_scheduleHydration=function(e){if(e){var t=jf();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&&Tm(e)}};var Dm=i.version;if(Dm!=="19.2.8")throw Error(l(527,Dm,"19.2.8"));Y.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(l(188)):(e=Object.keys(e).join(","),Error(l(268,e)));return e=g(t),e=e!==null?b(e):null,e=e===null?null:e.stateNode,e};var yx={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Cl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Cl.isDisabled&&Cl.supportsFiber)try{ft=Cl.inject(yx),qe=Cl}catch{}}return er.createRoot=function(e,t){if(!u(e))throw Error(l(299));var a=!1,r="",o=kh,c=Lh,p=jh;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(r=t.identifierPrefix),t.onUncaughtError!==void 0&&(o=t.onUncaughtError),t.onCaughtError!==void 0&&(c=t.onCaughtError),t.onRecoverableError!==void 0&&(p=t.onRecoverableError)),t=gm(e,1,!1,null,null,a,r,null,o,c,p,Rm),e[ua]=t.current,ac(e),new Ec(t)},er.hydrateRoot=function(e,t,a){if(!u(e))throw Error(l(299));var r=!1,o="",c=kh,p=Lh,y=jh,S=null;return a!=null&&(a.unstable_strictMode===!0&&(r=!0),a.identifierPrefix!==void 0&&(o=a.identifierPrefix),a.onUncaughtError!==void 0&&(c=a.onUncaughtError),a.onCaughtError!==void 0&&(p=a.onCaughtError),a.onRecoverableError!==void 0&&(y=a.onRecoverableError),a.formState!==void 0&&(S=a.formState)),t=gm(e,1,!0,t,a??null,r,o,S,c,p,y,Rm),t.context=ym(null),a=t.current,r=Ft(),r=du(r),o=ri(r),o.callback=null,li(a,o,r),a=r,t.current.lanes=a,os(t,a),Sn(t),e[ua]=t.current,ac(e),new Dl(t)},er.version="19.2.8",er}var Bm;function Rx(){if(Bm)return Mc.exports;Bm=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Mc.exports=Mx(),Mc.exports}var Dx=Rx();const Xe={interactions:"interactions",steps:"steps",errors:"errors",retries:"retries",cpuMs:"cpu.ms",tokensInput:"tokens.input",tokensOutput:"tokens.output",tokensCacheRead:"tokens.cacheRead",tokensReasoning:"tokens.reasoning"};function Tn(n,i){const s=n[i];return typeof s=="number"&&Number.isFinite(s)?s:void 0}function Kl(n,i){for(const[s,l]of Object.entries(i)){if(typeof l!="number"||!Number.isFinite(l))continue;const u=s;n[u]=(n[u]??0)+l}}const Cx=[Xe.tokensInput,Xe.tokensOutput,Xe.tokensCacheRead];function fn(n){let i=0,s=!1;for(const l of Cx){const u=Tn(n,l);u!==void 0&&(s=!0,i+=u)}return s?i:void 0}function Wa(n){return{input:Tn(n,Xe.tokensInput)??0,output:Tn(n,Xe.tokensOutput)??0,cacheRead:Tn(n,Xe.tokensCacheRead)??0,reasoning:Tn(n,Xe.tokensReasoning)??0}}function L0(n){const i=fn(n.measures);if(i!==void 0)return Gm(i/1e3,200);const s=Tn(n.measures,Xe.cpuMs);if(s!==void 0)return Gm(s/1e3,200)}function on(n){return Tn(n.measures,Xe.interactions)}function cf(n){return Tn(n.measures,Xe.steps)??0}function ia(n){return Tn(n.measures,Xe.errors)??0}function Yc(n){return Tn(n.measures,Xe.retries)??0}function Gm(n,i){return Math.min(1,Math.log1p(Math.max(0,n))/Math.log1p(i))}const Ox=new Set(["running","waiting"]);function j0(n){return Ox.has(n)}function Gl(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 B0=9e4;function $m(n,i){if(n.waitingSince===void 0)return;const s=n.waitingSince,l=Math.max(s,i);n.waitingMs+=l-s,n.waits.push({start:s,end:l})}function zx(n,i){const s=`${i.source.id}:${i.source.instance}`;let l=n.sources.get(s);l||(l={id:i.source.id,instance:i.source.instance,origin:i.source.instance,firstSeenAt:i.occurredAt,lastSeenAt:i.occurredAt,events:0,strata:{}},n.sources.set(s,l)),l.events++,i.occurredAt<l.firstSeenAt&&(l.firstSeenAt=i.occurredAt),i.occurredAt>l.lastSeenAt&&(l.lastSeenAt=i.occurredAt),i.stratum&&(l.strata[i.stratum]=(l.strata[i.stratum]??0)+1);const u=i.provenance?.sourceVersion;u&&(l.sourceVersions?l.sourceVersions.includes(u)||l.sourceVersions.push(u):l.sourceVersions=[u])}function _x(n,i){if(n.seen.has(i.id))return;n.seen.add(i.id),i.occurredAt>n.now&&(n.now=i.occurredAt),zx(n,i);const s=i.core??{},l=i.occurredAt;switch(i.subject.type){case"machine":{if(n.machines.has(i.subject.id))break;const u={id:i.subject.id,name:s.machineName??i.subject.id,kind:s.machineKind??"laptop",parentId:s.parentId,firstSeenAt:l};n.machines.set(u.id,u);break}case"session":{if(i.kind==="began"){const u=n.sessions.get(i.subject.id);if(u){u.parentId===void 0&&s.parentId&&(u.parentId=s.parentId),u.projectLabel===void 0&&s.projectLabel&&(u.projectLabel=s.projectLabel),u.taskLabel===void 0&&s.taskLabel&&(u.taskLabel=s.taskLabel);break}const f={id:i.subject.id,machineId:s.machineId??"",label:s.label,projectLabel:s.projectLabel,taskLabel:s.taskLabel,context:i.attrs?.context??s.label??"",executor:s.executor,model:s.model,startedAt:l,executionIds:[],parentId:s.parentId};n.sessions.set(f.id,f)}else if(i.kind==="ended"){const u=n.sessions.get(i.subject.id);u&&(u.endedAt=l)}break}case"execution":Ux(n,i,l);break;case"process":Nx(n,i,l);break;case"artifact":{if(n.artifacts.has(i.subject.id))break;n.artifacts.set(i.subject.id,{id:i.subject.id,kind:"file",path:s.label??i.subject.id,firstSeenAt:l});break}}}function Ux(n,i,s){const l=i.core??{},u=i.subject.id;if(i.kind==="began"){if(n.executions.has(u))return;const d={id:u,sessionId:l.sessionId??l.parentId??"",machineId:l.machineId??"",label:l.label??u,executor:l.executor??"unknown",model:l.model,status:"running",startedAt:s,lastActivityAt:s,measures:{},waitingMs:0,waits:[],parentId:l.parentId,depth:l.depth??0,startBasis:i.basis,boundsAssumption:i.assumption};l.measures&&Kl(d.measures,l.measures),n.executions.set(u,d),n.active.add(u),n.sessions.get(d.sessionId)?.executionIds.push(u);return}const f=n.executions.get(u);if(f)switch(i.kind){case"progressed":{l.measures&&Kl(f.measures,l.measures),f.lastActivityAt=s,f.status==="idle"&&(f.status="running",n.active.add(u));break}case"blocked":{if(!j0(f.status))break;f.status="waiting",f.waitingSince=s,f.waitReason=l.blockedOn??"input",f.lastActivityAt=s;break}case"resumed":{$m(f,s),f.status="running",f.waitingSince=void 0,f.waitReason=void 0,f.lastActivityAt=s,n.active.add(u);break}case"ended":{const d=l.outcome==="error";f.status=d?"failed":"completed",f.endedAt=s,f.endBasis=i.basis,i.assumption&&!f.boundsAssumption&&(f.boundsAssumption=i.assumption),f.lastActivityAt=s,f.outcome=l.outcome??"completed",d&&(f.failure={code:l.failureCode??"ERROR",message:l.failureMessage??"Execution failed"}),$m(f,s),f.waitingSince=void 0,f.waitReason=void 0,n.active.delete(u);break}case"observed":f.lastActivityAt=Math.max(f.lastActivityAt,s);break}}function Nx(n,i,s){const l=i.core??{},u=i.subject.id,f=Number(i.attrs?.["os.pid"]??0);if(i.kind==="began"){if(n.processes.has(u))return;const h={id:u,machineId:l.machineId??"",pid:f,ppid:typeof i.attrs?.["os.ppid"]=="number"?i.attrs["os.ppid"]:void 0,command:l.label??l.executor??String(f),startedAt:s,lastSeenAt:s,status:"running",measures:{}};l.measures&&Kl(h.measures,l.measures),n.processes.set(u,h);return}const d=n.processes.get(u);if(d)if(i.kind==="observed"||i.kind==="progressed"){if(d.lastSeenAt=Math.max(d.lastSeenAt,s),l.measures){const h=l.measures[Xe.cpuMs];typeof h=="number"&&(d.measures[Xe.cpuMs]=h);const{[Xe.cpuMs]:m,...g}=l.measures;Kl(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 kx(n,i){for(let s=0;s<i.length;s++)_x(n,i[s])}function Lx(n,i){i>n.now&&(n.now=i),i=n.now;for(const s of n.active){const l=n.executions.get(s);if(!l){n.active.delete(s);continue}l.status==="running"&&i-l.lastActivityAt>B0&&(l.status="idle")}}const Ht=n=>({value:n,basis:"measured"}),Ol=(n,i)=>({value:n,basis:"inferred",assumption:i});function ff(n){if(n.length===0)return[];n.sort((s,l)=>s.start-l.start);const i=[{start:n[0].start,end:n[0].end}];for(let s=1;s<n.length;s++){const l=n[s],u=i[i.length-1];l.start<=u.end?l.end>u.end&&(u.end=l.end):i.push({start:l.start,end:l.end})}return i}function Im(n){let i=0;for(const s of n)i+=s.end-s.start;return i}function jx(n,i){const s=[];let l=0,u=0;for(;l<n.length&&u<i.length;){const f=Math.max(n[l].start,i[u].start),d=Math.min(n[l].end,i[u].end);f<d&&s.push({start:f,end:d}),n[l].end<i[u].end?l++:u++}return s}function G0(n){if(n.length===0)return{peak:0,at:0};const i=[];for(const f of n)i.push({t:f.start,d:1}),i.push({t:f.end,d:-1});i.sort((f,d)=>f.t-d.t||f.d-d.d);let s=0,l=0,u=i[0].t;for(const f of i)s+=f.d,s>l&&(l=s,u=f.t);return{peak:l,at:u}}function Bx(n){if(n.length===0)return;const i=[...n].sort((l,u)=>l-u),s=i.length>>1;return i.length%2?i[s]:(i[s-1]+i[s])/2}const $0=6e4;function au(n,i){return n.endedAt!==void 0?{start:n.startedAt,end:n.endedAt}:{start:n.startedAt,end:n.status==="idle"?Math.max(n.startedAt,n.lastActivityAt):i}}function Gx(n){const i=[];for(const s of n.executions.values()){s.depth===0&&i.push({start:s.startedAt-$0,end:s.startedAt});for(const l of s.waits)i.push({start:l.start,end:l.end});s.waitingSince!==void 0&&i.push({start:s.waitingSince,end:n.now})}return ff(i)}function I0(n){const i=n.now,s=[...n.executions.values()];let l=0,u=0,f=0,d=0,h=0,m=0,g=0,b=0;const x=[],R=new Map;for(const W of s){l+=cf(W),u+=fn(W.measures)??0,f+=on(W)??0,W.status==="completed"?d++:W.status==="failed"?h++:W.status==="waiting"?m++:W.status==="idle"&&g++;const A=au(W,i);x.push(A),b+=W.waitingMs,W.waitingSince!==void 0&&(b+=Math.max(0,i-W.waitingSince));let w=R.get(W.machineId);w||(w={machineId:W.machineId,executions:0,tokens:0,computeTime:0},R.set(W.machineId,w)),w.executions++,w.tokens+=fn(W.measures)??0,w.computeTime+=A.end-A.start}const $=ff(x.map(W=>({...W}))),L=Gx(n),O=Im(jx($,L)),{peak:j,at:X}=G0(x),Q=$x(n),H=Math.max(0,Q.length-1);let U=null;for(const W of Q)(!U||W.end-W.start>U.end-U.start)&&(U=W);let J=0;for(const W of n.sessions.values())W.executionIds.some(A=>n.executions.has(A))&&J++;return{requests:Ht(l),sessions:Ht(J),executions:Ht(s.length),tokens:Ht(u),toolCalls:Ht(f),timeInFlight:Ol(Im($),"Wall-clock time during which at least one run was in flight, merged so parallel runs are not double-counted. A run still open counts to now while it is running or waiting, and only to its last output once it has gone idle. In flight is not computing: it includes a run waiting on a tool, a model or a person."),humanAgentOverlap:Ol(O,`Time in flight intersecting a window when you were plausibly present: the ${$0/1e3}s before you sent a message, and any approval from ask to answer.`),peakConcurrency:Ht(j),peakConcurrencyAt:Ht(X),contextSwitches:Ol(H,"Transitions between working directories, ordered by time. A directory is the closest thing the source has to a project."),longestFocus:Ol(U,"Longest unbroken stretch spent in one working directory."),waitingOnYou:Ht(b),completed:Ht(d),failed:Ht(h),waiting:Ht(m),idle:Ht(g),byMachine:R,contextSpans:Q,transfers:Ht(n.transfers.size)}}function $x(n){const i=[];for(const l of n.executions.values()){const u=n.sessions.get(l.sessionId);u&&i.push({context:u.context,...au(l,n.now)})}i.sort((l,u)=>l.start-u.start);const s=[];for(const l of i){const u=s[s.length-1];u&&u.context===l.context&&l.start<=u.end?l.end>u.end&&(u.end=l.end):u&&u.context===l.context?l.start-u.end<=Ix?u.end=Math.max(u.end,l.end):s.push({context:l.context,start:l.start,end:l.end}):s.push({context:l.context,start:l.start,end:l.end})}return s}const Ix=15*6e4;function Vx(n){return{key:n,runs:0,tokens:0,tokenRuns:0,medianRuns:0,computeMs:0,failed:0,waitingMs:0,toolCalls:0}}function Oc(n,i){const s=new Map,l=new Map;for(const u of n.executions.values()){const f=i(u,n.sessions.get(u.sessionId));if(f===void 0)continue;let d=s.get(f);d||(d=Vx(f),s.set(f,d)),d.runs++;const h=fn(u.measures);if(h!==void 0&&(d.tokens+=h,d.tokenRuns++,u.endedAt!==void 0)){let g=l.get(f);g||(g=[],l.set(f,g)),g.push(h)}const m=au(u,n.now);d.computeMs+=m.end-m.start,d.waitingMs+=u.waitingMs,d.toolCalls+=on(u)??0,u.status==="failed"&&d.failed++}for(const[u,f]of l){const d=s.get(u);d&&(d.medianTokens=Bx(f),d.medianRuns=f.length)}return[...s.values()].sort((u,f)=>f.computeMs-u.computeMs)}function Fx(n){const i={input:0,output:0,cacheRead:0,reasoning:0,total:0};for(const s of n.executions.values()){const l=Wa(s.measures);i.input+=l.input,i.output+=l.output,i.cacheRead+=l.cacheRead,i.reasoning+=l.reasoning}return i.total=i.input+i.output+i.cacheRead+i.reasoning,i}function Hx(n){const i={count:0,totalMs:0,longestMs:0,openNow:0};for(const s of n.executions.values()){for(const l of s.waits){i.count++;const u=l.end-l.start;i.totalMs+=u,u>i.longestMs&&(i.longestMs=u)}if(s.waitingSince!==void 0){i.openNow++;const l=n.now-s.waitingSince;i.totalMs+=l,l>i.longestMs&&(i.longestMs=l)}}return i}function qx(n){const i={toolCalls:0,toolErrors:0,retries:0,failed:0,interrupted:0,completed:0};for(const s of n.executions.values())i.toolCalls+=on(s)??0,i.toolErrors+=ia(s),i.retries+=Yc(s),s.status==="failed"?i.failed++:s.outcome==="interrupted"?i.interrupted++:s.outcome==="completed"&&i.completed++;return i}function Yx(n){const i=[];for(const f of n.executions.values())i.push(au(f,n.now));if(i.length===0)return[];const s=ff(i.map(f=>({...f}))),l=new Date(n.dayStart);l.setMinutes(0,0,0);const u=[];for(let f=l.getTime();f<n.now;f+=36e5){const d=f+36e5;let h=0;for(const b of s){const x=Math.max(b.start,f),R=Math.min(b.end,d);R>x&&(h+=R-x)}let m=0;const g=[];for(const b of i)b.start<d&&b.end>f&&(m++,g.push({start:Math.max(b.start,f),end:Math.min(b.end,d)}));u.push({hour:new Date(f).getHours(),runs:m,computeMs:h,peak:G0(g).peak})}return u}const V0=1e3,Vm=60*V0;function Ke(n){if(!Number.isFinite(n)||n<=0)return"0m";if(n<Vm)return`${Math.max(1,Math.round(n/V0))}s`;const i=Math.round(n/Vm),s=Math.floor(i/60),l=i%60;return s===0?`${l}m`:l===0?`${s}h`:`${s}h ${l}m`}function ot(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 es(n,i="NOT OBSERVED"){return n===void 0?i:ot(n)}function Xx(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 Ja(n){const i=new Date(n);return`${String(i.getHours()).padStart(2,"0")}:${String(i.getMinutes()).padStart(2,"0")}`}function lr(n){const i=n.split("/").filter(Boolean);return i[i.length-1]??n}const $l=6e4,Kx=60*$l;function F0(n,i){const s=[],l=i.contextSpans,u=i.longestFocus.value,f=Math.max(1,n.now-n.dayStart),d=i.timeInFlight.value/f;let h;if(i.executions.value===0)return{headline:"QUIET",clauses:["No runs observed in this window."]};if(i.peakConcurrency.value>=3?h="PARALLEL":l.length>=6?h="FRAGMENTED":u&&u.end-u.start>2*Kx?h="SUSTAINED":d<.15?h="SPARSE":h="SERIAL",i.peakConcurrency.value>=2?s.push(`Up to ${i.peakConcurrency.value} runs in flight at once; ${Ke(i.timeInFlight.value)} of wall-clock time had a run in flight.`):s.push(`Runs happened one at a time, across ${Ke(i.timeInFlight.value)} of wall-clock time.`),u&&s.push(`The longest unbroken stretch was ${Ke(u.end-u.start)} in ${lr(u.context)}.`),l.length>1){const m=new Set(l.map(g=>g.context)).size;s.push(`Attention moved ${i.contextSwitches.value} ${i.contextSwitches.value===1?"time":"times"} across ${m} ${m===1?"context":"contexts"}.`)}if(i.waitingOnYou.value>$l&&s.push(`${Ke(i.waitingOnYou.value)} was spent with a run waiting on your answer.`),i.humanAgentOverlap.value>$l){const m=Math.round(i.humanAgentOverlap.value/Math.max(1,i.timeInFlight.value)*100);s.push(`About ${m}% of that time overlapped a window when you were present; no presence was observed in the rest.`)}else i.timeInFlight.value>5*$l&&s.push("Runs were in flight almost entirely outside the moments you were observably present.");if(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 m=[...i.byMachine.values()].sort((g,b)=>b.computeTime-g.computeTime).map(g=>`${n.machines.get(g.machineId)?.name??g.machineId} ${Ke(g.computeTime)}`);s.push(`Compute was split across ${m.join(", ")}.`)}return{headline:h,clauses:s}}function Qx(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 Ql(n,i=0){return Qx(n+"#"+i)%1e5/1e5}const zc=[{x:430,y:508,extentX:300,extentY:186},{x:838,y:322,extentX:186,extentY:116}];function Px(n){if(n<zc.length)return zc[n];const s=-.9+(n-zc.length)*1.15;return{x:620+Math.cos(s)*520,y:300+Math.sin(s)*250,extentX:150,extentY:94}}function Zx(n){const i=s=>s==="laptop"?0:s==="desktop"?1:2;return[...n].sort((s,l)=>i(s.kind)-i(l.kind)||s.firstSeenAt-l.firstSeenAt||(s.id<l.id?-1:s.id>l.id?1:0))}function Fm(n,i){const s=Ql(i,1),l=Ql(i,2),u=s*Math.PI*2+l*2.399963,f=.34+.46*Math.sqrt(l);return{x:n.x+Math.cos(u)*n.extentX*f,y:n.y+Math.sin(u)*n.extentY*f}}const wn={spanX:1160,strataTop:812,strataHeight:360},Wx=3,Jx=4,Hm=30,e1=74;function H0(n){return Hm+n*(e1-Hm)}function qm(n,i,s){let l=null,u=1/0;for(const d of n.disturbances){const h=H0(d.extent),m=i-d.x,g=(s-d.y)*1.5,b=Math.hypot(m,g);b<h*1.3&&b<u&&(u=b,l={kind:"disturbance",id:d.id,x:d.x,y:d.y})}if(l)return l;for(const d of n.couplings){const h=n.masses.find(O=>O.id===d.fromMassId),m=n.masses.find(O=>O.id===d.toMassId);if(!h||!m)continue;const g=m.x-h.x,b=m.y-h.y,x=g*g+b*b;if(x===0)continue;const R=((i-h.x)*g+(s-h.y)*b)/x;if(R<.05||R>.95)continue;const $=h.x+g*R,L=h.y+b*R;if(Math.hypot(i-$,(s-L)*1.5)<50)return{kind:"coupling",id:d.id,x:$,y:L}}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 f=wn.strataTop;if(s>=f&&s<=f+wn.strataHeight){const d=Math.max(1,n.masses.length),h=wn.strataHeight/d,m=Math.min(d-1,Math.floor((s-f)/h)),g=i/wn.spanX;let b=null,x=1/0;const R=Wx/wn.spanX,$=Jx/wn.spanX;for(const L of n.strata){if(L.lane!==m)continue;const O=Math.max(R,L.endFraction-L.startFraction);g<L.startFraction-$||g>L.startFraction+O+$||O<x&&(x=O,b={kind:"stratum",id:L.id,x:i,y:s})}if(b)return b}return null}const Ym=64,t1=8,n1=8,Xm=16,Km=.45;function i1(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 Qm=.32;function a1(n){const i=L0(n),s=n.depth>0?.62:1;return i===void 0?Qm*s:Math.min(1,(Qm+.68*i)*s)}function s1(n,i){const s=Math.max(1,(n.endedAt??i)-n.startedAt),l=(on(n)??0)/(s/6e4);return Math.min(1,.25+l/24)}function Pm(n){return(n.status==="failed"?3:n.status==="waiting"?2:n.status==="running"?1:0)*1e15+n.lastActivityAt}function r1(n){const i=new Set,s=new Set,l=new Map,u=new Map,f=(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"?l.set(h.id,m.id):h.type==="session"&&m.type==="execution"&&l.set(m.id,h.id)):g==="same-as"&&h.type==="execution"&&m.type==="execution"&&(i.add(h.id),i.add(m.id),f(u,h.id,m.id),f(u,m.id,h.id))}return{resolvedExecutions:i,sessionsWithProcess:s,runObservesSession:l,sameExecution:u}}function l1(n,i){const l=n.startBasis===void 0?.5:n.startBasis==="measured"?1:0,u=n.endBasis===void 0?.5:n.endBasis==="measured"?1:0,f=n.endedAt===void 0?l:(l+u)/2,d=L0(n)===void 0?0:1,h=i.resolvedExecutions.has(n.id)||i.sessionsWithProcess.has(n.sessionId)?1:0;return(1+f+d+h)/4}function Zm(n){let i=1;for(const s of n)i*=1-Math.min(1,Math.max(0,s));return 1-i}function Wm(n,i,s,l){const u=Math.max(n,s),f=Math.min(i,l);if(f<u)return 0;const d=Math.max(i,l)-Math.min(n,s);return d<=0?1:(f-u)/d}function u1(n){const i=n.now,s=Zx(n.machines.values()).slice(0,t1),l=new Map,u=[];let f=1;const d=new Map;for(const A of n.executions.values()){const w=(d.get(A.machineId)??0)+1;d.set(A.machineId,w),w>f&&(f=w)}s.forEach((A,w)=>{const G=Px(w);l.set(A.id,G),u.push({id:A.id,name:A.name,kind:A.kind,x:G.x,y:G.y,extentX:G.extentX,extentY:G.extentY,prominence:(d.get(A.id)??0)/f,seed:Ql(A.id,7)})});const h=45e3,m=[];for(const A of n.executions.values())(A.status==="completed"||A.status==="failed")&&i-(A.endedAt??i)>h||A.status==="idle"&&i-A.lastActivityAt>h*4||l.has(A.machineId)&&m.push(A);m.length>Ym&&(m.sort((A,w)=>Pm(w)-Pm(A)),m.length=Ym);const g=r1(n),b=A=>{const w=l.get(A.machineId),{x:G,y:te}=Fm(w,A.id),ne=n.sessions.get(A.sessionId);return{id:A.id,massId:A.machineId,sessionId:A.sessionId,x:G,y:te,extent:a1(A),energy:i1(A,i),rate:s1(A,i),phase:Ql(A.id,3)*Math.PI*2,status:A.status,label:A.label,projectLabel:ne?.projectLabel,taskLabel:ne?.taskLabel,statusSince:A.waitingSince??A.endedAt??A.startedAt,articulation:l1(A,g),shoulder:0,observers:1}},x=new Set(m.map(A=>A.id)),R=new Set,$=[],L=A=>[A.startedAt,A.endedAt??i];for(const A of[...m].sort((w,G)=>w.id<G.id?-1:1)){if(R.has(A.id))continue;const w=[A];R.add(A.id);for(let de=0;de<w.length;de++)for(const oe of g.sameExecution.get(w[de].id)??[])!x.has(oe)||R.has(oe)||(R.add(oe),w.push(n.executions.get(oe)));if(w.length===1){$.push(b(A));continue}const G=w.map(b),te=G.reduce((de,oe)=>oe.articulation>de.articulation||oe.articulation===de.articulation&&oe.id<de.id?oe:de);let ne=1;const[le,Ge]=L(n.executions.get(te.id));for(const de of w){const[oe,z]=L(de);ne=Math.min(ne,Wm(le,Ge,oe,z))}$.push({...te,extent:Math.max(...G.map(de=>de.extent)),energy:Math.max(...G.map(de=>de.energy)),articulation:Zm(G.map(de=>de.articulation)),shoulder:Math.min(Km,1-ne),observers:w.length})}const O=new Map;for(const A of $){if(g.runObservesSession.has(A.id))continue;const w=O.get(A.sessionId);w?w.push(A):O.set(A.sessionId,[A])}const j=new Map,X=[];for(const A of $){const w=g.runObservesSession.get(A.id),G=w?O.get(w):void 0;if(!w||!G||G.length===0){if(X.push(A),w){const z=O.get(A.sessionId);z?z.push(A):O.set(A.sessionId,[A])}continue}const te=n.executions.get(A.id);let ne=1/0,le=-1/0;for(const z of G){const[Y,ae]=L(n.executions.get(z.id));ne=Math.min(ne,Y),le=Math.max(le,ae)}const[Ge,de]=L(te),oe=j.get(w)??{articulations:[],coincidence:1};oe.articulations.push(A.articulation),oe.coincidence=Math.min(oe.coincidence,Wm(Ge,de,ne,le)),j.set(w,oe)}const Q=[];for(const A of[...O.keys()].sort()){const w=O.get(A),G=n.sessions.get(A);if(!G||w.length===0)continue;let te=0,ne=0;for(const z of w)te+=z.x,ne+=z.y;te/=w.length,ne/=w.length;let le=0,Ge=0;for(const z of w){const Y=H0(z.extent);le=Math.max(le,Math.abs(z.x-te)+Y*1.5),Ge=Math.max(Ge,Math.abs(z.y-ne)+Y)}const de=j.get(A),oe=Math.max(...w.map(z=>z.articulation));Q.push({id:A,massId:w[0].massId,x:te,y:ne,extentX:Math.max(le,52),extentY:Math.max(Ge,36),presence:1,articulation:de?Zm([oe,...de.articulations]):oe,parentId:G.parentId,empty:!1,shoulder:de?Math.min(Km,1-de.coincidence):0,observers:1+(de?.articulations.length??0),label:G.label??G.executor??A,projectLabel:G.projectLabel,taskLabel:G.taskLabel})}for(const A of[...n.sessions.values()].sort((w,G)=>w.id<G.id?-1:1)){if(A.executionIds.length>0||A.endedAt!==void 0&&i-A.endedAt>h)continue;const w=l.get(A.machineId);if(!w)continue;const{x:G,y:te}=Fm(w,`session-presence:${A.id}`);Q.push({id:A.id,massId:A.machineId,x:G,y:te,extentX:64,extentY:42,presence:1,articulation:g.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(Q.length>Xm){const A=w=>w.empty?0:O.get(w.id)?.length??0;Q.sort((w,G)=>A(G)-A(w)||(w.id<G.id?-1:1)),Q.length=Xm}const H=[];for(const A of n.transfers.values())if(A.endedAt===void 0&&!(!l.has(A.fromMachineId)||!l.has(A.toMachineId))){if(H.length>=n1)break;H.push({id:A.id,fromMassId:A.fromMachineId,toMassId:A.toMachineId,energy:1,label:A.label})}const U=new Map;s.forEach((A,w)=>U.set(A.id,w));const J=Math.max(1,n.dayEnd-n.dayStart),W=[];for(const A of n.executions.values()){const w=U.get(A.machineId);if(w===void 0)continue;const G=(A.startedAt-n.dayStart)/J,te=((A.endedAt??i)-n.dayStart)/J;W.push({id:A.id,massId:A.machineId,lane:w,startFraction:Math.max(0,Math.min(1,G)),endFraction:Math.max(0,Math.min(1,te)),status:A.status,label:A.label})}return{time:i,masses:u,disturbances:X,plinths:Q,couplings:H,strata:W}}const Il="synthetic";let o1=0;const Nt=(n,i,s,l)=>({id:`syn:${(o1++).toString(36)}`,source:{id:Il,instance:"replay"},occurredAt:n,observedAt:n,clock:"wall",kind:i,subject:s,core:l,basis:"measured",stratum:"stored-semantics"});function c1(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 Xa=6e4,f1=60*Xa,Jm=["~/atlas","~/harbour-cli","~/ledger","~/studio-site"],eg=[{id:"macbook",name:"MACBOOK",kind:"laptop",firstSeenAt:0},{id:"mini",name:"MINI-PC",kind:"desktop",firstSeenAt:0}];function tg(n,i){return{[Xe.tokensInput]:Math.round(400+i()*3e3*n),[Xe.tokensOutput]:Math.round(60+i()*500*n),[Xe.tokensCacheRead]:Math.round(1200+i()*9e3*n),[Xe.tokensReasoning]:Math.round(20+i()*300*n)}}function d1(n={}){const i=n.seed??57,s=n.dayStart??Date.parse("2026-08-29T07:00:00Z"),l=n.duration??15*f1,u=n.runCount??24,f=n.failureRate??.09,d=n.waitRate??.2,h=s+l,m=c1(i),g=[];for(const $ of eg)g.push(Nt(s,"began",{type:"machine",id:$.id},{machineName:$.name,machineKind:$.kind}));const b=Math.max(1,Math.round(u/4));let x=0,R=0;for(let $=0;$<b;$++){const L=s+$/b*l+m()*20*Xa,O=2+Math.floor(m()*4);for(let j=0;j<O;j++){const X=eg[m()<.66?0:1],Q=Jm[Math.floor(m()*Jm.length)],H=`syn-session-${x++}`,U=L+j*(2+m()*9)*Xa;if(U>h)continue;const J=m()<.7?"deepseek-v4-flash":"deepseek-v4";g.push({...Nt(U,"began",{type:"session",id:H},{machineId:X.id,executor:Il,model:J}),attrs:{context:Q}});const W=`syn-proc-${R++}`,A=Q.split("/").pop().toUpperCase();g.push(Nt(U,"began",{type:"execution",id:W},{machineId:X.id,sessionId:H,label:A,executor:Il,model:J,depth:0}));const w=m()<.35,G=(w?25+m()*95:2+m()*14)*Xa,te=Math.max(1,Math.ceil(G/(B0*.6))),ne=w?4:1;let le=U;const Ge=G/te;for(let oe=0;oe<te&&(le+=Ge,!(le>h));oe++)g.push(Nt(le,"progressed",{type:"execution",id:W},{measures:{...tg(ne,m),[Xe.interactions]:Math.floor(m()*4),[Xe.errors]:m()<.06?1:0,[Xe.steps]:1}}));if(m()<d){const oe=U+G*(.35+m()*.3),z=oe+(1+m()*18)*Xa;oe<h&&(g.push(Nt(oe,"blocked",{type:"execution",id:W},{blockedOn:"approval"})),z<h&&g.push(Nt(z,"resumed",{type:"execution",id:W})))}if(w&&m()<.5){const oe=`syn-proc-${R++}`,z=U+G*.25,Y=z+G*.4;z<h&&g.push(Nt(z,"began",{type:"execution",id:oe},{machineId:X.id,sessionId:H,label:`${A} · SUB`,executor:Il,model:J,parentId:W,depth:1}),Nt((z+Y)/2,"progressed",{type:"execution",id:oe},{measures:{...tg(1,m),[Xe.interactions]:3,[Xe.steps]:4}}),Nt(Math.min(h,Y),"ended",{type:"execution",id:oe},{outcome:"completed"}))}const de=Math.min(h,U+G);if(m()<f?g.push(Nt(de,"ended",{type:"execution",id:W},{outcome:"error",failureCode:"TRANSPORT",failureMessage:"Provider request failed"})):g.push(Nt(de,"ended",{type:"execution",id:W},{outcome:"completed"})),g.push(Nt(de,"ended",{type:"session",id:H})),X.id==="mini"&&m()<.3){const oe=de+3e4,z=oe+(1+m()*4)*Xa;if(z<h){const Y=`syn-xfer-${R}`;g.push({...Nt(oe,"began",{type:"artifact",id:Y},{label:"ARTIFACT SYNC",machineId:"mini"}),attrs:{"syn.transfer":!0,"syn.from":"mini","syn.to":"macbook","syn.bytes":Math.round(2e8+m()*3e9)}},{...Nt(z,"ended",{type:"artifact",id:Y}),attrs:{"syn.transfer":!0}})}}}}return g.sort(($,L)=>$.occurredAt-L.occurredAt),{events:g,dayStart:s,dayEnd:h}}class h1{constructor(i={},s=180){this.timeScale=s;const l=d1(i);this.script=l.events,this.dayStart=l.dayStart,this.dayEnd=l.dayEnd,this.simNow=l.dayStart}timeScale;script;dayStart;dayEnd;cursor=0;simNow;timer=null;listener=null;batch=[];info(){return{id:"synthetic",name:"SYNTHETIC",kind:"synthetic",detail:`${this.script.length} events · ${this.timeScale}× replay`}}bounds(){return{dayStart:this.dayStart,dayEnd:this.dayEnd}}now(){return this.simNow}advanceTo(i){for(this.simNow=Math.max(this.simNow,i),this.batch.length=0;this.cursor<this.script.length&&this.script[this.cursor].occurredAt<=i;)this.batch.push(this.script[this.cursor++]);return this.batch.length&&this.listener&&this.listener(this.batch),this.batch}get exhausted(){return this.cursor>=this.script.length}subscribe(i){this.listener=i;const s=Date.now();return this.timer=setInterval(()=>{const l=this.dayStart+(Date.now()-s)*this.timeScale;this.advanceTo(l),this.exhausted&&this.timer&&(clearInterval(this.timer),this.timer=null)},250),()=>{this.timer&&clearInterval(this.timer),this.timer=null,this.listener=null}}simTimeAt(i,s){return this.dayStart+(s-i)*this.timeScale}}function ng(n){const i=Gl(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),j0(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 p1(){const n=await fetch("/api/state");if(!n.ok)throw new Error(`state failed: ${n.status}`);return n.json()}async function Xc(n,i){try{const s=await fetch(`/api/collect?from=${n}&to=${i}`),l=await s.json().catch(()=>({}));return{ok:s.ok,fault:l.fault,error:l.error}}catch(s){return{ok:!1,error:s instanceof Error?s.message:String(s)}}}async function Kc(n,i){const s=await fetch(`/api/world?from=${n}&to=${i}`);if(!s.ok)throw new Error(`world failed: ${s.status}`);return s.json()}async function 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 g1=4e3,y1=3;class v1{constructor(i,s,l={}){this.initial=i,this.state=s,this.options=l,this.lastCollect=i.to}initial;state;options;timer=null;stopped=!1;lastCollect;generation=0;failures=0;trouble=null;get pollMs(){return this.options.pollMs??g1}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(ng(this.initial.world),this.initial.waits)});const s=async()=>{if(this.stopped)return;this.running=!0;const l=++this.generation;try{const u=Date.now(),f=await Xc(this.lastCollect,u);f.fault&&this.report({kind:"store-fault",message:f.fault.message,detail:f.fault.remedy,consecutiveFailures:0});const d=await Kc(this.initial.from,u);if(this.stopped||l!==this.generation)return;this.lastCollect=u,this.failures=0,f.fault||this.report(null),i(ng(d.world),d.waits)}catch(u){this.failures++,this.failures>=y1&&this.report({kind:"capture-failing",message:`capture has failed ${this.failures} times in a row`,detail:u instanceof Error?u.message:String(u),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 df=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 dn extends df{constructor(i){super({...i,severity:"error"}),this.name="ValidationError"}}function b1(n){return new df({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 x1(n,i){if(!n)return;const s=(i??[]).filter(l=>!n.has(l));if(s.length)throw b1(s)}const S1={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 fr(n){const i=globalThis.GPUBufferUsage;return n.reduce((s,l)=>s|w1(l,i),0)}function w1(n,i){const s=n.toUpperCase();return i?.[s]??S1[n]}function ig(){return globalThis.GPUMapMode?.READ??1}const E1={copy_src:1,copy_dst:2,texture_binding:4,storage_binding:8,render_attachment:16};function T1(n){const i=globalThis.GPUTextureUsage;return n.reduce((s,l)=>s|A1(l,i),0)}function A1(n,i){const s=n.toUpperCase();return i?.[s]??E1[n]}function q0(n){return"__vgpuMockBytes"in n}function ag(n){return"__vgpuMockBytes"in n}let M1=1;function su(n){return Object.freeze({kind:n,id:M1++})}class ru{callbacks=new Set;destroyed=!1;onDestroy(i,s){return this.destroyed?(s(i),()=>{}):(this.callbacks.add(s),()=>{this.callbacks.delete(s)})}emit(i){if(this.destroyed)return!1;this.destroyed=!0;const s=[...this.callbacks];this.callbacks.clear();for(const l of s)l(i);return!0}}class Ri{device;gpu;options;ownership;destroySignal=new ru;identity=su("buffer");destroyed=!1;constructor(i,s,l,u="owned"){this.device=i,this.gpu=s,this.options=l,this.ownership=u,Object.defineProperty(this,"assertUsable",{value:f=>this.#e(f)})}get resourceIdentity(){return this.identity}onDestroy(i){return this.destroySignal.onDestroy(this,i)}#e(i="Buffer"){if(this.destroyed)throw new dn({code:"VGPU-BUFFER-DISPOSED",message:"Buffer is destroyed.",where:i,fix:"Wrap or create a live GPUBuffer before using it."});this.device.assertUsable(i)}write(i,s=0){this.#e("Buffer.write"),this.ownership==="external"&&this.validateExternalOperation("write",s,i.byteLength,"copy_dst");try{this.device.queue.writeBuffer(this.gpu,s,i)}catch(l){throw this.ownership!=="external"?l:zl("Buffer.write","The external GPUBuffer rejected the write operation.",l)}}async read(i,s=0){this.#e("Buffer.read"),this.ownership==="external"&&this.validateExternalOperation("read",s,i,"copy_src");try{const l=await this.device.readback.read(this.gpu,i,s);return this.#e("Buffer.read"),l}catch(l){throw l instanceof dn||this.ownership!=="external"?l:zl("Buffer.read","The external GPUBuffer rejected the read operation.",l)}}destroy(){this.destroyed||(this.destroyed=!0,this.destroySignal.emit(this),this.ownership==="owned"&&!q0(this.gpu)&&this.gpu.destroy())}dispose(){this.destroy()}validateExternalOperation(i,s,l,u){if(!(Number.isSafeInteger(s)&&s>=0&&s%4===0&&Number.isSafeInteger(l)&&l>=0&&l%4===0&&s<=this.options.size&&l<=this.options.size-s))throw zl(`Buffer.${i}`,"External buffer offsets and lengths must be non-negative, 4-byte aligned, and within the buffer size.");if((this.gpu.usage&fr([u]))===0)throw zl(`Buffer.${i}`,`External buffer is missing ${u.toUpperCase()} usage.`)}}function zl(n,i,s){return new dn({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 R1(n){if(O1(n))throw z1();const i={version:1,mappings:[]},s={version:1,modules:[{path:"<runtime>",text:n}],diagnostics:[],sourceMap:i,cacheKey:D1(n)};return{kind:"wgsl",wgsl:n,source:{text:n,path:"<runtime>",imports:[]},ast:s,sourceMap:i,diagnostics:[],cacheKey:s.cacheKey,entryPoints:C1(n),stats:{lines:n.split(/\r?\n/).length,bytes:new TextEncoder().encode(n).byteLength,bindGroups:0}}}function D1(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 C1(n){const i=[],s=/@(vertex|fragment|compute)\s+fn\s+([A-Za-z_][A-Za-z0-9_]*)/g;for(const l of n.matchAll(s))i.push(l[2]);return i}function O1(n){const i=n.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"").trimStart();return i.startsWith("import ")||i.startsWith("import{")}function z1(){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 sg=fr(["copy_dst","map_read"]);class _1{device;constructor(i){this.device=i}async read(i,s,l){if(q0(i))return i.__vgpuMockBytes.slice(l,l+s).buffer;const u=this.device.createBuffer({size:s,usage:sg});try{const f=this.device.createCommandEncoder();f.copyBufferToBuffer(i,l,u,0,s),this.device.queue.submit([f.finish()]),await u.mapAsync(ig());const d=u.getMappedRange().slice(0);return rg(u),d}finally{lg(u)}}async readTexture(i,s,l){const[u,f]=s,d=Pl(l,"Readback.readTexture"),h=d.bytesPerPixel,m=U1(u*h,256),g=m*f,b=this.device.createBuffer({size:g,usage:sg});let x;try{const R=this.device.createCommandEncoder();R.copyTextureToBuffer({texture:i},{buffer:b,bytesPerRow:m,rowsPerImage:f},{width:u,height:f}),this.device.queue.submit([R.finish()]),await b.mapAsync(ig());const $=new Uint8Array(b.getMappedRange());x=new Uint8Array(u*f*h);for(let L=0;L<f;L++){const O=L*m,j=L*u*h;x.set($.subarray(O,O+u*h),j)}rg(b)}finally{lg(b)}return d.swizzle==="bgra-to-rgba"&&Y0(x),x}destroy(){}}function rg(n){try{n.unmap()}catch{}}function lg(n){try{n.destroy()}catch{}}function U1(n,i){return Math.ceil(n/i)*i}const ug={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 Pl(n,i){const s=ug[n];if(s)return s;throw new dn({code:"VGPU-CORE-UNSUPPORTED-FORMAT",message:`Texture.read does not support format ${n}. Supported formats: ${Object.keys(ug).join(", ")}.`,where:i})}function N1(n,i,s="Texture.readFloats"){const l=Pl(i,s),u=l.bytesPerPixel/l.components,f=Math.floor(n.byteLength/u),d=new Float32Array(f),h=new DataView(n.buffer,n.byteOffset,n.byteLength);for(let m=0;m<f;m++)l.componentType==="unorm8"?d[m]=h.getUint8(m)/255:l.componentType==="float16"?d[m]=k1(h.getUint16(m*2,!0)):d[m]=h.getFloat32(m*4,!0);return d}function k1(n){const i=n&32768?-1:1,s=n>>10&31,l=n&1023;return s===0?i*l*2**-24:s===31?l===0?i*Number.POSITIVE_INFINITY:Number.NaN:i*(l+1024)*2**(s-25)}function L1(n,i,s){const l=n.slice(0,i[0]*i[1]*s.bytesPerPixel);return s.swizzle==="bgra-to-rgba"&&Y0(l),l}function Y0(n){for(let i=0;i<n.length;i+=4){const s=n[i];n[i]=n[i+2],n[i+2]=s}}function j1(n){return{size:n,usage:fr(["copy_src","copy_dst"])}}class B1{gpu;guard;constructor(i,s=()=>{}){this.gpu=i,this.guard=s}writeBuffer(i,s,l){this.guard("Queue.writeBuffer"),this.gpu.writeBuffer(i,s,l)}async flush(){this.guard("Queue.flush"),await this.gpu.onSubmittedWorkDone?.(),this.guard("Queue.flush")}}class G1{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 $1=Symbol.for("vgpu/Texture"),I1=Symbol.for("vgpu/Texture/resizeLock");class as{device;ownership;[$1]=!0;destroySignal=new ru;identity=su("texture");currentGpu;currentOptions;defaultView=null;resizeLock;destroyed=!1;constructor(i,s,l,u="owned"){this.device=i,this.ownership=u,this.currentGpu=s,this.currentOptions=l,Object.defineProperty(this,I1,{value:f=>{this.resizeLock=f}})}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 dn({code:"VGPU-CORE-EXTERNAL-TEXTURE",message:"Texture wraps an externally owned GPUTexture and cannot be resized.",where:"Texture.resize"});if(this.resizeLock)throw new dn({code:"VGPU-CORE-TEXTURE-RESIZE-LOCKED",message:this.resizeLock,where:"Texture.resize"});const s=this.options.size[2]??1,l=i[2]??s;if(this.options.size[0]===i[0]&&this.options.size[1]===i[1]&&s===l)return!1;const u=i[2]===void 0&&this.options.size[2]===void 0?[i[0],i[1]]:[i[0],i[1],l],f={...this.options,size:u},d=this.gpu;return this.currentGpu=this.device.gpu.createTexture(X0(f)),this.currentOptions=f,this.defaultView=null,d.destroy(),!0}async read(){this.assertAlive("Texture.read");const i=Pl(this.options.format,"Texture.read");if(ag(this.gpu))return L1(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 Pl(this.options.format,"Texture.readFloats"),N1(await this.read(),this.options.format)}destroy(){this.destroyed||(this.destroyed=!0,this.defaultView=null,this.destroySignal.emit(this),this.ownership!=="external"&&(ag(this.gpu)||this.gpu.destroy()))}dispose(){this.destroy()}assertAlive(i="Texture"){if(this.destroyed)throw new dn({code:"VGPU-CORE-TEXTURE-DESTROYED",message:"Texture is destroyed",where:i});this.device.assertUsable?.(i)}}function X0(n){const i={label:n.label,size:{width:n.size[0],height:n.size[1],depthOrArrayLayers:n.size[2]??1},format:n.format,usage:T1(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 V1{gpu;adapterInfo;queue;readback;isCompatibilityMode;scopes=[];ownership;state="alive";lossInfo;observeLoss=!0;constructor(i,s=null,l="owned",u={}){this.gpu=i,this.adapterInfo=s,Object.defineProperty(this,"assertUsable",{value:h=>this.#e(h)}),this.ownership=typeof l=="string"?l:"owned";const f=typeof l=="string"?u:l;this.isCompatibilityMode=f.isCompatibilityMode??!1,this.queue=new B1(i.queue,h=>this.#e(h)),this.readback=new _1(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"?R1(i):i;return new G1(this.gpu.createShaderModule({code:s.wgsl}),s)}createTexture(i){return this.#e("Device.createTexture"),new as(this,this.gpu.createTexture(X0(i)),i)}createBuffer(i){this.#e("Device.createBuffer");const s=F1(i);s&&this.captureError(s);const l=s?j1(Math.max(4,i.size||4)):H1(i);return new Ri(this,this.gpu.createBuffer(l),i)}wrapBuffer(i){if(this.#e("Device.wrapBuffer"),!Y1(i))throw new dn({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:K1(i.usage),...i.label?{label:i.label}:{}};return new Ri(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]??q1(s)??null}#e(i){if(this.state==="alive")return;if(this.state==="disposed")throw new dn({code:"VGPU-DEVICE-DISPOSED",message:"The GPU device wrapper has been disposed.",where:i,fix:"Create a new Gpu instance before performing more work."});const s=this.lossInfo?.reason,l=this.lossInfo?.message;throw new dn({code:"VGPU-DEVICE-LOST",message:`The GPU device was lost${s?` (${s})`:""}${l?`: ${l}`:"."}`,where:i,cause:this.lossInfo})}destroy(){if(this.state==="disposed")return;const i=this.state==="lost";this.state="disposed",this.observeLoss=!1,this.scopes.length=0,this.readback.destroy(),this.ownership==="owned"&&!i&&this.gpu.destroy()}dispose(){this.destroy()}captureError(i){const s=this.scopes.at(-1);if(s)s.push(i);else throw i}}function F1(n){return!Number.isFinite(n.size)||n.size<=0?og("Buffer size must be greater than zero."):n.usage.length===0?og("Buffer usage must not be empty."):null}function og(n){return new dn({code:"VGPU-CORE-INVALID-USAGE",message:n,where:"Device.createBuffer"})}function H1(n){return{label:n.label,size:n.size,usage:fr(n.usage)}}function q1(n){return n?new dn({code:"VGPU-CORE-VALIDATION",message:n.message,where:"GPUDevice.popErrorScope",cause:n}):null}function Y1(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 X1=["map_read","map_write","copy_src","copy_dst","index","vertex","uniform","storage","indirect","query_resolve"];function K1(n){return X1.filter(i=>(n&fr([i]))!==0)}const K0=new WeakMap,Q1=new WeakMap;function P1(n,i){return K0.set(n,Z1(i)),n}function sr(n){return K0.get(n)}function Q0(n){return Q1.get(n)}function Z1(n){return{entries:n.entries.map(i=>({...i}))}}let se=class extends df{};function W1(n,i,s,l,u,f){const d=i==="vertex"?"Vertex":"Fragment",h=i==="vertex"?"VERTEX":"FRAGMENT",m=`maxStorageBuffersIn${d}Stage`;return new se({code:`VGPU-LIMIT-STORAGE-${h}`,message:`${d} entry '${s}' in '${n}' uses ${l} storage buffer(s), but device limit ${m} is ${u}.`,fix:i==="vertex"?`Request init({ requiredLimits: { ${m}: ${l} } }) if the adapter supports it, or move vertex data to geometry(gpu, ...) vertex streams.`:`Request init({ requiredLimits: { ${m}: ${l} } }) if the adapter supports it, or reduce fragment storage buffers.`,where:`${n}.pipelineLayout`,detail:{stage:i,entryPoint:s,count:l,limit:u,bindings:f.map(({name:g,group:b,binding:x})=>({name:g,group:b,binding:x}))}})}function J1(n,i,s,l,u){return new se({code:"VGPU-SET-TEXTURE-FILTERABILITY",message:`${l} (${s}) cannot satisfy filtering texture '${i.name}' @group(${i.group}) @binding(${i.binding}).`,fix:"Use a filterable format; request float32-filterable for rgba32float when supported; or use textureLoad without a sampler.",where:`${n}.set`,detail:{format:s,group:i.group,binding:i.binding,bindingName:i.name,resourceName:l,samplerName:u?.name,samplerGroup:u?.group,samplerBinding:u?.binding}})}function eS(n,i){const s=DS(n,i);return new se({code:"VGPU-R1-BINDING-NEVER-SET",message:`Unset \`${i.name}\` @group(${i.group}) @binding(${i.binding}) in '${n}'. Fix: ${s}; or ${n}.group(${i.group}, bindGroup).`,where:`${n}.draw`})}function P0(n,i){const s=i==="lib"?"lib-owned by its first JS set()":"user-owned by its first resource set()",l=i==="lib"?`Fix: pass a resource from the start: wave.set({ ${n}: new Uniform(gpu.device, { size: 4 }) }).`:`Fix: pass JS values from the first set(): wave.set({ ${n}: jsValue }).`;return new se({code:"VGPU-R1-OWNERSHIP-FLIP",message:`\`${n}\` is ${s}; ownership cannot change. ${l}`,where:"set"})}function tS(n,i){return new se({code:"VGPU-R4-GROUP-CLAIMED",message:`group ${i} of '${n}' is claimed; set() cannot update it.`,fix:`Call set() first, or build from ${n}.layout(${i}); pass dynamic offsets to p.draw().`,where:`${n}.set`})}function nS(n,i,s,l){return new se({code:"VGPU-R4-GROUP-INCOMPATIBLE",message:`claimed group ${i} in '${n}' is incompatible: ${s}.`,fix:`Build from ${n}.layout(${i}, { dynamicOffsets? }) then call ${n}.group(${i}, bindGroup).`,where:`${n}.group`,cause:l})}function is(n,i,s){return new se({code:"VGPU-R4-GROUP-VALIDATION",message:`WebGPU rejected claimed group ${i} in '${n}'.`,fix:`Build from ${n}.layout(${i}); pass offsets via p.draw(draw, { offsets: { ${i}: [...] } }).`,where:`${n}.draw`,cause:s,detail:{drawLabel:n,group:i}})}function cg(n,i){return new se({code:"VGPU-BLEND-INVALID",message:`Invalid blend '${String(i)}' in '${n}'.`,fix:'Use "alpha", "additive", "premultiplied", or { color, alpha? } components.',where:"draw"})}function fg(n,i){return new se({code:"VGPU-BLEND-CONSTANT-INVALID",message:`Invalid blendConstant in '${n}': ${i}`,fix:'Use [r, g, b, a] finite numbers with a blend whose color or alpha uses "constant"/"one-minus-constant"; omit it to keep the pass default (0, 0, 0, 0).',where:"draw"})}function dg(n,i){return new se({code:"VGPU-WRITEMASK-INVALID",message:`Invalid writeMask ${i} in '${n}'.`,fix:"Use an array of r/g/b/a; omit it for all channels.",where:"draw"})}function Qc(n,i,s="draw"){return new se({code:"VGPU-COLORS-INVALID",message:`Invalid colors in '${n}': ${i}`,fix:"Use one { blend?, writeMask? } or null entry per color attachment of the target, aligned by index; omit colors to apply the top-level blend/writeMask to every attachment.",where:s})}function iS(n,i){return new se({code:"VGPU-CULL-INVALID",message:`Invalid cull '${String(i)}' in '${n}'.`,fix:'Use "none", "front", or "back"; omit it for no culling.',where:"draw"})}function aS(n,i){return new se({code:"VGPU-FRONTFACE-INVALID",message:`Invalid frontFace '${String(i)}' in '${n}'.`,fix:'Use "ccw" or "cw"; omit it for counter-clockwise.',where:"draw"})}function hg(n,i){return new se({code:"VGPU-UNCLIPPED-DEPTH-INVALID",message:`Invalid unclippedDepth in '${n}': ${i}`,fix:'Use a boolean. unclippedDepth: true needs the "depth-clip-control" device feature — request it with init({ requiredFeatures: ["depth-clip-control"] }) on an adapter that supports it. Omit the option to keep depth clipping.',where:"draw"})}function Xn(n,i){return new se({code:"VGPU-DEPTH-INVALID",message:`Invalid depth in '${n}': ${i}`,fix:'Use false or { write?, compare?, bias?, biasSlopeScale?, biasClamp? }; omit it for { write: true, compare: "less-equal" }.',where:"draw"})}function ts(n,i,s="draw"){return new se({code:"VGPU-STENCIL-INVALID",message:`Invalid stencil in '${n}': ${i}`,fix:`Use { front?, back?, readMask?, writeMask?, ref? } with GPUCompareFunction/GPUStencilOperation faces and u32 masks, against a target whose depth format has a stencil aspect (depth: "depth24plus-stencil8"); omit it for WebGPU's pass-through defaults.`,where:s})}function Vl(n,i,s="draw"){return new se({code:"VGPU-MULTISAMPLE-INVALID",message:`Invalid multisample in '${n}': ${i}`,fix:"Use { alphaToCoverage?, mask? }: alphaToCoverage needs a target created with msaa: true, and mask must be an integer in [0, 0xFFFFFFFF] (bits above the target's sampleCount are ignored). Omit multisample for full-coverage defaults.",where:s})}function _l(n,i,s="draw"){return new se({code:"VGPU-CONSTANTS-INVALID",message:`Invalid constants in '${n}': ${i}`,fix:"Key WGSL `override` constants by name, or by the decimal string of N when the declaration has @id(N); values are finite numbers or booleans, converted to the override's WGSL type (bool/i32/u32/f32/f16). Every override without a default value must be provided. Omit constants to keep the WGSL defaults.",where:s})}function Fl(n,i,s="draw"){return new se({code:"VGPU-ENTRY-INVALID",message:`Invalid entry in '${n}': ${i}`,fix:"Name an entry point declared in the shader with the matching stage — { vertex?, fragment? } strings for draw, one @compute name string for compute. Omit entry (or a field) to use the first entry point of that stage.",where:s})}function Ka(n,i,s){return new se({code:"VGPU-INDIRECT-INVALID",message:`Invalid indirect in '${n}': ${i}`,fix:"Pass a storage buffer created with storage(gpu, bytes, { indirect: true }) — bare, or as { buffer, offset? } with a 4-aligned byte offset — sized so the GPU-read arguments fit: 16 bytes for drawIndirect, 20 for drawIndexedIndirect, 12 for dispatchWorkgroupsIndirect. Omit indirect to use CPU-side counts.",where:s})}function sS(){return new se({code:"VGPU-PASS-PRESERVE-MSAA",message:"clear:false cannot preserve MSAA; use a non-MSAA target.",fix:"Use non-MSAA for accumulation.",where:"Frame.pass"})}function pg(n,i="expected a number in [0, 1].",s='Use 1 (default), or 0 with depth: { compare: "greater" } for reversed-Z.'){return new se({code:"VGPU-PASS-CLEARDEPTH-INVALID",message:`clearDepth received ${String(n)}; ${i}`,fix:s,where:"Frame.pass"})}function Kn(n){return new se({code:"VGPU-PASS-VIEWPORT-INVALID",message:`Invalid viewport: ${n}`,fix:"Use { x?, y?, width, height, minDepth?, maxDepth? } finite numbers within device limits; omit it for the full target.",where:"Frame.pass"})}function _c(n){return new se({code:"VGPU-PASS-SCISSOR-INVALID",message:`Invalid scissor: ${n}`,fix:"Use [x, y, width, height] non-negative integers with x + width and y + height within the target's current pixel size; omit it for the full target.",where:"Frame.pass"})}function rS(){return new se({code:"VGPU-PASS-PRESERVE-CLEARDEPTH",message:"clear:false preserves depth; clearDepth cannot apply.",fix:"Remove clearDepth, or let the pass clear.",where:"Frame.pass"})}function mg(n){return new se({code:"VGPU-PASS-CLEARSTENCIL-INVALID",message:`clearStencil ${n}`,fix:`Use an integer in [0, 0xFFFFFFFF] on a target whose depth format has a stencil aspect, e.g. depth: "depth24plus-stencil8"; the value is masked to the stencil aspect's bit width.`,where:"Frame.pass"})}function lS(){return new se({code:"VGPU-PASS-PRESERVE-CLEARSTENCIL",message:"clear:false preserves stencil; clearStencil cannot apply.",fix:"Remove clearStencil, or let the pass clear.",where:"Frame.pass"})}function na(n,i,s="Frame.pass"){return new se({code:"VGPU-PASS-DEPTH-READONLY",message:`depthReadOnly ${n}`,fix:i,where:s})}function uS(){return new se({code:"VGPU-PASS-DEPTH-READONLY-MSAA",message:`depthReadOnly cannot read an MSAA target's depth: multisampled depth is stored with storeOp "discard", so a read-only pass tests against discarded contents.`,fix:"Use a non-MSAA target for read-only depth, or drop depthReadOnly and let the pass own its depth.",where:"Frame.pass"})}function Qa(n,i,s="timer"){return new se({code:"VGPU-TIMER-INVALID",message:`Invalid timer use: ${n}`,fix:i,where:s})}function oS(n,i){return new se({code:"VGPU-TIMER-CAPACITY",message:`frame exceeds ${n} timed spans; a timer holds one timestamp query set and WebGPU createQuerySet requires count <= ${i} (2 queries per span).`,fix:"Time fewer passes per frame, or spread timing across frames.",where:"Frame.pass"})}function cS(n,i,s="visibility"){return new se({code:"VGPU-VIS-INVALID",message:`Invalid visibility use: ${n}`,fix:i,where:s})}function fS(){return new se({code:"VGPU-QUERY-NO-VISIBILITY",message:"occlusion() needs the pass to be opened with a visibility instance; the render pass has no occlusionQuerySet to write into.",fix:"Open the pass with f.pass({ target, visibility: vis }, ...) using the visibility(gpu) instance that created the query handle.",where:"FramePass.occlusion"})}function dS(){return new se({code:"VGPU-QUERY-NESTED",message:"occlusion() cannot nest inside an active occlusion() body; WebGPU allows one active occlusion query per pass at a time.",fix:"Encode each occlusion scope sequentially: p.occlusion(a, ...); p.occlusion(b, ...).",where:"FramePass.occlusion"})}function Pc(n="Frame.pass"){return new se({code:"VGPU-TARGET-REQUIRED",message:"Target required. Fix: pass surface(gpu, canvas) or target(gpu, { size }) as { target }.",where:n})}function hS(n,i,s,l){return new se({code:n,message:`${n}: ${s}`,fix:l,where:i})}function hf(n,i){return hS("VGPU-MESH-RANGE-INVALID",n,i,"Use index ranges for indexed geometries, vertex ranges otherwise, within geometry counts.")}function pS(n){return new se({code:"VGPU-PIPELINE-LAYOUT-GAP",message:`Pipeline bind group ${n} is missing.`,fix:"Use consecutive @group() indices starting at 0.",where:"pipeline layout"})}function tr(n,i,s){return new se({code:"VGPU-COMPILE-FAILED",message:"WebGPU pipeline compilation failed.",fix:"Check WGSL, vertex layouts, and target signature.",where:n,cause:i,detail:s?{signature:s}:void 0})}function gg(n){return new se({code:"VGPU-COMPILE-DISPOSED",message:"GPU disposed during pipeline compilation.",where:n})}function Ul(n,i){return new se({code:"VGPU-COMPILE-SIGNATURE-INVALID",message:`Invalid TargetSignature: ${i}`,fix:"Pass { colors, depth?, sampleCount?:1|4 } or a Target.",where:n})}function mS(n){return new se({code:"VGPU-TARGET-DEPTH-STENCIL-ONLY",message:`depth received '${n}'; stencil-only depth targets are not supported yet.`,fix:'Use a format with a depth aspect such as "depth24plus" or "depth24plus-stencil8".',where:"target"})}function Z0(){return new se({code:"VGPU-TARGET-SIZE-REQUIRED",message:"Target size required. Fix: target(gpu, { size: [w,h] }); update surface-derived targets in onResize.",where:"target"})}function W0(n){return new se({code:"VGPU-SURFACE-NOT-IN-FRAME",message:"Surface targets are only available inside frame(gpu).",fix:"surface passes must run inside frame(gpu, ...); precompile against an offscreen target(gpu, ...) instead",where:n})}function gS(){return new se({code:"VGPU-SURFACE-CONTEXT",message:"Canvas WebGPU context failed. Fix: check navigator.gpu and remove any existing 2d/webgl context.",where:"surface"})}function yS(n){return new se({code:"VGPU-SURFACE-DUPLICATE",message:`Canvas already has surface${n?` '${n}'`:""}. Fix: reuse or dispose it.`,where:"surface"})}function vS(n){return new se({code:"VGPU-SURFACE-DISPOSED",message:`Surface '${n??"surface"}' is disposed. Fix: call surface(gpu, canvas).`,where:"surface"})}function bS(){return new se({code:"VGPU-SURFACE-AUTORESIZE-UNSUPPORTED",message:"autoResize needs clientWidth. Fix: call surface.resize([w,h]) for OffscreenCanvas; onResize still fires.",where:"surface"})}function xS(n){return new se({code:"VGPU-SURFACE-RESIZE-REENTRANT",message:`Cannot resize this surface${n?` '${n}'`:""} in onResize. Fix: resize derived targets only.`,where:"surface.resize"})}function SS(n){return new se({code:"VGPU-CLEAR-COLOR-INVALID",message:`Invalid ${n}: expected four finite numbers.`,fix:"Assign [r, g, b, a] or a GPUColor object ({ r, g, b, a }).",where:n})}function J0(){return new se({code:"VGPU-FRAME-REENTRANT",message:"Nested frame(gpu) is invalid. Fix: queue work for the next frame.",where:"frame"})}function wS(n,i){return new se({code:"VGPU-QUERY-READBACK",message:`${n} dropped a query readback: ${AS(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 yg(n){return new se({code:"VGPU-FRAME-CANCELED",message:"the frame was canceled; its command encoder was dropped and nothing more can be encoded or submitted on it.",fix:"Open a new frame(gpu) for further work; cancel() is the last operation on a frame.",where:n})}function ES(n){return new se({code:"VGPU-FRAME-PASS-ACTIVE",message:"the frame cannot be canceled while a pass callback is active.",fix:"Return from the frame.pass(...) callback first, then call frame.cancel(); this keeps pass descriptor resources alive until the pass is closed.",where:n})}function TS(n){return new se({code:"VGPU-FRAME-SUBMITTED",message:"the frame was already submitted; submitted GPU work cannot be canceled.",fix:"Call cancel() only on a frame you decided not to submit; the frame you did submit needs no cleanup.",where:n})}function Zn(n,i,s){return new se({code:"VGPU-R1-BINDING-INCOMPATIBLE-RESOURCE",message:`binding \`${n.name}\` @group(${n.group}) @binding(${n.binding}) needs ${i}.`,fix:s,where:"set"})}function Yt(n,i,s){return new se({code:"VGPU-RING1-UNSUPPORTED",message:i,fix:s,where:n})}function Nl(n){return MS(n)&&n.version!==1?new se({code:"VGPU-SHADER-SOURCE-INVALID",message:`VGPU-SHADER-SOURCE-INVALID: unsupported ShaderSource v${String(n.version)}; expected v1. Fix: update vgpu or regenerate it.`,where:"shader source"}):new se({code:"VGPU-SHADER-SOURCE-INVALID",message:`VGPU-SHADER-SOURCE-INVALID: expected WGSL or { version, wgsl }, got ${RS(n)}. Fix: configure @vgpu/wgsl loader-vite or loader-webpack.`,where:"shader source"})}function AS(n){return n instanceof Error?`${n.name}: ${n.message}`:String(n)}function MS(n){return typeof n=="object"&&n!==null&&"version"in n}function RS(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 DS(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 vg=["scheduler","resource","service"];function lu(n){return{name:n}}const ey=new WeakMap;function CS(n){const i=ey.get(n);if(!i)throw new se({code:"VGPU-GPU-FOREIGN",message:"This object was not created by init(); it has no vgpu kernel.",fix:"Pass the gpu returned by init() from vgpu, vgpu/node or vgpu/mock.",where:"gpu"});return i}class OS{device;#e=new Map;#t=new Map(vg.map(i=>[i,new Set]));#n=new Set;#i=new Set;#a=new Set;#s=!1;constructor(i){this.device=i}get disposed(){return this.#s}service(i,s){const l=this.#e.get(i);if(l!==void 0)return l;const u=s(this);return this.#e.set(i,u),u}peekService(i){return this.#e.get(i)}own(i,s){const l=this.#t.get(i);return l.add(s),()=>{l.delete(s)}}addErrorListener(i){return this.#n.add(i),()=>{this.#n.delete(i)}}reportError(i){if(this.#s)return Promise.resolve();const s=Promise.resolve().then(()=>{const l=[...this.#n];if(!l.length){console.error(i);return}for(const u of l)try{u(i)}catch(f){console.error(f)}});return this.trackDelivery(s)}trackDelivery(i){const s=Promise.resolve(i).then(()=>{},l=>{console.error(l)});return this.#i.add(s),s.finally(()=>this.#i.delete(s)),s}registerSettledSource(i){return this.#a.add(i),()=>{this.#a.delete(i)}}async settled(){const i=[...this.#i,...[...this.#a].flatMap(s=>s())];await Promise.allSettled(i)}dispose(){if(!this.#s){this.#s=!0;for(const i of vg){const s=this.#t.get(i);for(const l of[...s])l();s.clear()}this.#e.clear(),this.#a.clear(),this.#n.clear(),this.device.dispose()}}}function zS(n){const i=new OS(n),s={device:n,gpu:n.gpu,get disposed(){return i.disposed},onError:l=>i.addErrorListener(l),settled:()=>i.settled(),dispose:()=>{i.dispose()}};return ey.set(s,i),s}async function _S(n,i={},s){return zS(await US(n,i,s))}async function US(n,i,s){return i.adapter||s?(i.adapter??s()).requestDevice(i):NS(i)}async function NS(n){const s=await globalThis.navigator.gpu?.requestAdapter({powerPreference:n.powerPreference});if(!s)throw Yt("init","navigator.gpu.requestAdapter() returned null.");x1(s.features,n.requiredFeatures);const l=await s.requestDevice({requiredFeatures:n.requiredFeatures,requiredLimits:n.requiredLimits});return new V1(l,s.info??null)}function pt(n,i){n.assertUsable(i)}function bg(n,i){n.assertUsable(i)}const ty=Symbol("vgpu.bindingResource");function kS(n){return typeof(typeof n=="object"&&n!==null?n[ty]:void 0)=="function"?n:void 0}const Zc=Symbol("vgpu.geometry.layoutResolver");function Wn(n,i){const s=CS(n);if(s.disposed)throw LS(i);return s}function LS(n){return new se({code:"VGPU-GPU-DISPOSED",message:`${n}() ran after gpu.dispose(); the device and everything it owned are gone.`,fix:"Create resources before disposing the gpu, or init() a new one.",where:n})}function jS(n,i){let s=()=>{};const l=i({trackSettled:u=>{n.trackDelivery(u)},errorSink:u=>n.reportError(u),onDispose:()=>{s()}});return s=n.own("resource",()=>l.dispose()),l}function ny(n,i,s,l){const u=n.own("resource",()=>s(i));return l?.(u),i}class iy extends Error{code;line;column;severity;metadata;relatedDiagnostics;fix;where;cause;constructor(i,s,l=1,u=1,f="error"){super(s),this.name="VGPUError",this.code=i,this.line=l,this.column=u,this.severity=f}}function BS(n,i,s={}){const l=new iy(n,i,s.line??1,s.column??1,s.severity??"error");return s.fix!==void 0&&(l.fix=s.fix),s.where!==void 0&&(l.where=s.where),s.cause!==void 0&&(l.cause=s.cause),s.metadata!==void 0&&(l.metadata=s.metadata),l}function et(n,i,s=1,l=1){return new iy(n,i,s,l)}const GS=new Set(["fn","struct","const","alias","var","override"]);function $S(n){const i=[],s=[],l=[];let u=0,f=!1,d=0;for(;u<n.length;){const h=n[u];if(h.text==="{"){d++,u++;continue}if(h.text==="}"){d=Math.max(0,d-1),u++;continue}if(ay(h)){u++;continue}if(d>0){u++;continue}if(h.text==="import"){if(f)throw et("VGPU-WGSL-IMP-ORDER","Imports must precede declarations",h.line,h.column);const[x,R]=IS(n,u);i.push(x),u=R;continue}if(h.text==="export"&&n[u+1]?.text==="{")throw et("VGPU-WGSL-EXP-REEXPORT-CYCLE","Re-export cycles are not supported",h.line,h.column);if(h.text==="@"&&n[u+2]?.text==="export"&&n[u+3]?.text==="@")throw et("VGPU-WGSL-EXP-NOTDECL","Repeated export attributes",h.line,h.column);const m=h.text==="export"||h.text==="@"&&n[u+2]?.text==="export",g=m?VS(n,h.text==="export"?u+1:u+3):u,b=n[g];if(b&&GS.has(b.text)){const x=FS(n,g);s.push({name:x,localName:x,kind:b.text}),m&&l.push({name:x,localName:x,kind:b.text}),f=!0}u++}return{imports:i,exports:l,locals:s}}function IS(n,i){let s=i+1;const l=[];if(n[s]?.text==="{"){for(s++;n[s]&&n[s].text!=="}";){if(ay(n[s])){s++;continue}const d=Nc(n[s]);let h=d;s++,n[s]?.text==="as"&&(h=Nc(n[s+1]),s+=2),l.push({imported:d,local:h}),n[s]?.text===","&&s++}s++,Uc(n[s],"from"),s++}else if(n[s]?.text==="*")Uc(n[s+1],"as"),l.push({imported:"*",local:Nc(n[s+2]),namespace:!0}),s+=3,Uc(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 u=n[s];if(u?.kind!=="string")throw et("VGPU-WGSL-RES-NOTFOUND","Import path must be a string",u?.line,u?.column);const f=u.text.slice(1,-1);return s++,n[s]?.text===";"&&s++,[{from:f,bindings:l,start:n[i].start,end:n[s-1].end},s]}function VS(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 FS(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 Uc(n,i){if(n?.text!==i)throw et("VGPU-WGSL-IMP-DEFAULT",`Expected ${i}`,n?.line,n?.column)}function Nc(n){if(n?.kind!=="ident")throw et("VGPU-WGSL-IMP-DEFAULT","Expected identifier",n?.line,n?.column);return n.text}function ay(n){return n.kind==="lineComment"||n.kind==="blockComment"}function HS(n,i){return i==="uniform"||i==="storage"?"buffer":n.kind==="sampler"?"sampler":n.kind==="texture"?n.textureKind==="texture_external"?"externalTexture":"texture":"unknown"}function qS(n,i,s,l,u){if(n==="buffer")return YS(i,s,u);if(l.kind==="sampler")return XS(l);if(l.kind==="texture")return l.textureKind==="texture_external"?{kind:"externalTexture",externalTexture:{}}:l.textureKind.startsWith("texture_storage_")?KS(l):QS(l)}function YS(n,i,s){return{kind:"buffer",buffer:{type:n==="uniform"?"uniform":i==="read"?"read-only-storage":"storage",hasDynamicOffset:!1,minBindingSize:s?.size}}}function XS(n){return{kind:"sampler",sampler:{type:n.comparison?"comparison":"filtering"}}}function KS(n){return{kind:"storageTexture",storageTexture:{access:ZS(n.access),format:n.texelFormat??"rgba8unorm",viewDimension:sy(n.dimension)}}}function QS(n){return{kind:"texture",texture:{sampleType:PS(n),viewDimension:sy(n.dimension),multisampled:n.dimension==="multisampled_2d"||n.dimension==="depth_multisampled_2d"}}}function PS(n){if(n.textureKind.startsWith("texture_depth_"))return"depth";const i=n.sampleType;return i?.kind==="scalar"&&i.name==="i32"?"sint":i?.kind==="scalar"&&i.name==="u32"?"uint":"unfilterable-float"}function sy(n){switch(n){case"1d":return"1d";case"2d_array":case"depth_2d_array":return"2d-array";case"cube":case"depth_cube":return"cube";case"cube_array":case"depth_cube_array":return"cube-array";case"3d":return"3d";default:return"2d"}}function ZS(n){return n==="read"?"read-only":n==="read_write"?"read-write":"write-only"}const un=(1n<<64n)-1n,ta=11400714785074694791n,ir=14029467366897019727n,xg=1609587929392839161n,ry=9650029242287828579n,Sg=2870177450012600261n;function WS(n,i=0n){const s=new TextEncoder().encode(n);let l=0,u;if(s.length>=32){let f=i+ta+ir,d=i+ir,h=i,m=i-ta;const g=s.length-32;do f=Pa(f,nr(s,l)),l+=8,d=Pa(d,nr(s,l)),l+=8,h=Pa(h,nr(s,l)),l+=8,m=Pa(m,nr(s,l)),l+=8;while(l<=g);u=Mi(f,1n)+Mi(d,7n)+Mi(h,12n)+Mi(m,18n),u=kl(u,f),u=kl(u,d),u=kl(u,h),u=kl(u,m)}else u=i+Sg;for(u=u+BigInt(s.length)&un;l+8<=s.length;)u^=Pa(0n,nr(s,l)),u=Mi(u,27n)*ta+ry&un,l+=8;for(l+4<=s.length&&(u^=JS(s,l)*ta&un,u=Mi(u,23n)*ir+xg&un,l+=4);l<s.length;)u^=BigInt(s[l])*Sg&un,u=Mi(u,11n)*ta&un,l++;return u^=u>>33n,u=u*ir&un,u^=u>>29n,u=u*xg&un,u^=u>>32n,u.toString(16).padStart(16,"0")}function Pa(n,i){return Mi(n+i*ir&un,31n)*ta&un}function kl(n,i){return n^=Pa(0n,i),n*ta+ry&un}function Mi(n,i){return(n<<i|n>>64n-i)&un}function nr(n,i){let s=0n;for(let l=7;l>=0;l--)s=(s<<8n)+BigInt(n[i+l]);return s}function JS(n,i){return BigInt(n[i])|BigInt(n[i+1])<<8n|BigInt(n[i+2])<<16n|BigInt(n[i+3])<<24n}function ew(n){return WS(n)}function tw(n){return ew(n).slice(0,8)}function nw(n,i){return`_vgsl_${tw(n)}__${i}`}function Xt(n,i){const s=n.find(f=>f.name===i);if(!s)return;const l=s.args.map(f=>f.text).join(""),u=Number(l.replace(/[ui]$/,""));return Number.isFinite(u)?u:void 0}function pf(n){const i=[[]];let s=0,l=0;for(const u of n){if(u.text==="<"?s++:u.text===">"?s=Math.max(0,s-1):u.text==="("?l++:u.text===")"&&(l=Math.max(0,l-1)),u.text===","&&s===0&&l===0){i.push([]);continue}i[i.length-1].push(u)}return i.map(ly).filter(u=>u.length>0)}function ly(n){let i=0,s=n.length;for(;i<s&&n[i].text===",";)i++;for(;s>i&&n[s-1].text===",";)s--;return n.slice(i,s)}function iw(n){if(n!==void 0&&uy(n))return Number(n.replace(/[ui]$/,""))}function uy(n){return/^(0|[1-9][0-9]*)([ui])?$/.test(n)}function oy(n){if(n==="read"||n==="write"||n==="read_write")return n}function aw(n){return["f32","f16","i32","u32","bool"].find(i=>i===n)}function sw(n){return{kind:"scalar",name:n==="f"?"f32":n==="h"?"f16":n==="i"?"i32":"u32"}}function cy(n){return n==="f16"?2:4}function sa(n,i){return Math.ceil(i/n)*n}function En(n){const i=ly(n);if(i.length===0)throw et("VGPU-WGSL-REFLECT-TYPE","Expected WGSL type");const s=i.map(f=>f.text).join(""),l=rw(s);if(l)return l;if(i[1]?.text==="<"){const f=i[0].text,d=pf(i.slice(2,-1)),h=lw(f,d);if(h)return h}const u=uw(s);return u||ow(s)}function rw(n){const i=aw(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:sw(s[2])};const l=n.match(/^mat([234])x([234])([fh])$/);if(l){const u=l[3]==="h"?{kind:"scalar",name:"f16"}:{kind:"scalar",name:"f32"};return{kind:"matrix",columns:Number(l[1]),rows:Number(l[2]),element:u}}}function lw(n,i){if(n==="array"){const s=i[1]?.map(u=>u.text).join(""),l=s===void 0?void 0:iw(s);return{kind:"array",element:En(i[0]??[]),count:l,countExpression:s}}if(n==="atomic")return{kind:"atomic",element:En(i[0]??[])};if(n==="vec2"||n==="vec3"||n==="vec4")return{kind:"vector",width:Number(n.slice(3)),element:En(i[0]??[])};if(/^mat[234]x[234]$/.test(n))return{kind:"matrix",columns:Number(n[3]),rows:Number(n[5]),element:En(i[0]??[])};if(n==="ptr")return{kind:"ptr",addressSpace:i[0]?.map(s=>s.text).join("")??"",element:En(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:oy(i[1]?.map(s=>s.text).join(""))};if(n.startsWith("texture_"))return{kind:"texture",textureKind:n,dimension:n.slice(8),sampleType:i[0]?En(i[0]):void 0}}function uw(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 ow(n){return{kind:"identifier",name:n}}function Ci(n){if(n?.kind!=="ident"&&n?.kind!=="keyword")throw et("VGPU-WGSL-REFLECT-PARSE","Expected identifier",n?.line,n?.column);return n.text}function ra(n,i,s){for(let l=i;l<n.length;l++)if(n[l].text===s)return l;throw et("VGPU-WGSL-REFLECT-PARSE",`Expected ${s}`,n[i]?.line,n[i]?.column)}function cw(n,i,s,l){for(let u=i;u<s;u++)if(n[u].text===l)return u}function uu(n,i,s){let l=0;for(let u=i;u<n.length;u++)if((n[u].text==="{"||n[u].text==="(")&&l++,(n[u].text==="}"||n[u].text===")")&&(l=Math.max(0,l-1)),l===0&&n[u].text===s)return u;return n.length}function mf(n,i){const s=n[i].text,l=s==="("?")":s==="{"?"}":">";let u=0;for(let f=i;f<n.length;f++)if(n[f].text===s&&u++,n[f].text===l&&(u--,u===0))return f;throw et("VGPU-WGSL-REFLECT-PARSE",`Unclosed ${s}`,n[i]?.line,n[i]?.column)}function gf(n,i){const s=[];let l=i;for(;n[l]?.text==="@";){const u=n[l],f=Ci(n[l+1]);l+=2;let d=[];if(n[l]?.text==="("){const h=mf(n,l);d=n.slice(l+1,h),l=h+1}s.push({name:f,args:d,token:u})}return[s,l]}function ns(n){switch(n.kind){case"scalar":return n.name;case"identifier":return n.name;case"vector":return`vec${n.width}<${ns(n.element)}>`;case"matrix":return`mat${n.columns}x${n.rows}<${ns(n.element)}>`;case"array":return`array<${ns(n.element)}${n.count===void 0?"":`,${n.count}`}>`;default:return n.kind}}function fw(n){const i=n.find(l=>l.name==="workgroup_size");if(!i)return;const s=pf(i.args).map(l=>Number(l.map(u=>u.text).join("")));return[s[0]??1,s[1]??1,s[2]??1]}function dw(n,i){if(n[i]?.text!=="<")return{after:i};const s=ra(n,i,">"),l=pf(n.slice(i+1,s)).map(u=>u.map(f=>f.text).join(""));return{addressSpace:l[0],access:oy(l[1]),after:s+1}}function hw(n){const i=[],s=[],l=[],u=[],f=[],d=[],h=n.tokens.filter(b=>b.kind!=="lineComment"&&b.kind!=="blockComment");let m=0,g=0;for(;m<h.length;){const b=h[m];if(b.text==="{"){g++,m++;continue}if(b.text==="}"){g=Math.max(0,g-1),m++;continue}if(g>0){m++;continue}const x=m,[R,$]=gf(h,m);m=$,h[m]?.text==="export"&&m++;const L=h[m]?.text;if(L==="enable"){h[m+1]?.kind==="ident"&&d.push(h[m+1].text),m=uu(h,m,";")+1;continue}if(L==="struct"){const O=pw(n,h,m);O.item&&i.push(O.item),m=O.next;continue}if(L==="alias"){const O=mw(n,h,m);O.item&&s.push(O.item),m=O.next;continue}if(L==="var"){const O=gw(n,h,m,R);O.item&&l.push(O.item),m=O.next;continue}if(L==="fn"){const O=yw(n,h,m,R);O.item&&u.push(O.item),m=O.next;continue}if(L==="override"){const O=bw(h,m,R);O.item&&f.push(O.item),m=O.next;continue}m=Math.max(x+1,m+1)}return{structs:i,aliases:s,vars:l,entries:u,overrides:f,features:d}}function pw(n,i,s,l){const u=Ci(i[s+1]),f=ra(i,s+2,"{"),d=mf(i,f);return{item:{name:u,originalName:u,mangledName:yf(n,u,"struct"),members:xw(i.slice(f+1,d)),path:n.path},next:d+1}}function mw(n,i,s,l){const u=Ci(i[s+1]),f=ra(i,s+2,"="),d=uu(i,f+1,";");return{item:{name:u,originalName:u,mangledName:yf(n,u,"alias"),target:En(i.slice(f+1,d)),path:n.path},next:d+1}}function gw(n,i,s,l){const{addressSpace:u,access:f,after:d}=dw(i,s+1),h=Ci(i[d]),m=ra(i,d+1,":"),g=uu(i,m+1,";");return{item:{path:n.path,name:h,mangledName:Sw(l)?h:yf(n,h,"var"),attrs:l,addressSpace:u,access:f,type:En(i.slice(m+1,g))},next:g+1}}function yw(n,i,s,l){const u=Ci(i[s+1]),f=l.find(m=>m.name==="vertex"||m.name==="fragment"||m.name==="compute")?.name;if(!f)return{item:void 0,next:s+1};const d=ra(i,s+2,"("),h=mf(i,d);return{item:{name:u,mangledName:u,stage:f,workgroupSize:fw(l),path:n.path,params:vw(i.slice(d+1,h))},next:h+1}}function vw(n){const i=[];let s=0;for(;s<n.length;){const[l,u]=gf(n,s);if(s=u,!n[s]||n[s].text===","){s++;continue}const f=Ci(n[s]),d=ra(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:f,attrs:l,type:En(n.slice(d+1,h))}),s=h+1}return i}function bw(n,i,s){const l=Ci(n[i+1]),u=uu(n,i+1,";"),f=cw(n,i+2,u,"=");return{item:{name:l,mangledName:l,id:Xt(s,"id"),defaultValue:f===void 0?void 0:n.slice(f+1,u).map(d=>d.text).join("")},next:u+1}}function xw(n){const i=[];let s=0;for(;s<n.length;){const[l,u]=gf(n,s);if(s=u,!n[s]||n[s].text===","||n[s].text===";"){s++;continue}const f=Ci(n[s]),d=ra(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:f,attrs:l,type:En(n.slice(d+1,h)),align:Xt(l,"align"),size:Xt(l,"size")}),s=h+1}return i}function yf(n,i,s){return s==="override"?i:nw(n.path,i)}function Sw(n){return Xt(n,"group")!==void 0||Xt(n,"binding")!==void 0}const ww="literal length required for auto layout; use draw.group(n, bg) manual binding",Ew="VGPUError: `bool` is not host-shareable in uniform/storage. Fix: use `u32` (0 | 1) → struct Params { enabled: u32 }",fy="use a manual group claim (`draw.group(n, bg)`)";function Tw(n=1,i=1){return et("VGPU-WGSL-REFLECT-ARRAY-LENGTH",ww,n,i)}function dy(n=1,i=1){return et("VGPU-WGSL-REFLECT-BOOL-HOST-SHAREABLE",Ew,n,i)}function Zl(n,i,s=1,l=1){return et("VGPU-WGSL-REFLECT-UNKNOWN-TYPE",`type '${n}' is unknown in ${i}; ${fy}`,s,l)}function wg(n,i,s=1,l=1){return et("VGPU-WGSL-REFLECT-NS-TYPE",`type '${n}' is a namespace-member import; use a named import or manual @group(1+) binding`,s,l)}function hy(n,i=1,s=1){return et("VGPU-WGSL-REFLECT-NON-HOST-SHAREABLE",`Type ${n} is not host-shareable; ${fy}`,i,s)}const ss="naga-standard";function Aw(n,i,s){const l=new Map;for(const d of i){const h=new Map;for(const m of[...d.structs,...d.aliases])h.set(m.originalName,{path:m.path,name:m.originalName,mangledName:m.mangledName,kind:"members"in m?"struct":"alias"});l.set(d.structs[0]?.path??d.aliases[0]?.path??d.vars[0]?.path??"",h)}const u=new Map(n.map(d=>[d.path,l.get(d.path)??new Map])),f=new Map;for(const d of n){const h=new Map(u.get(d.path));for(const m of d.parsed.imports)Mw(d,m,h,n,u);f.set(d.path,h)}return f}function Mw(n,i,s,l,u,f){const d=Dw(i,n.path,l),h=u.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 Rw(n,i){const s=new Map,l=new Map,u=new Map;for(const f of n){for(const d of f.structs){const h={name:d.name,mangledName:d.mangledName,members:d.members.map(m=>({name:m.name,type:aa(m.type,d.path,i),align:m.align,size:m.size}))};s.set(d.mangledName,h),u.set(d.mangledName,h)}for(const d of f.aliases){const h={name:d.name,mangledName:d.mangledName,target:aa(d.target,d.path,i)};l.set(d.mangledName,h),u.set(d.mangledName,h)}}return{structs:s,aliases:l,byMangled:u}}function aa(n,i,s,l){switch(n.kind){case"identifier":{const u=n.name.indexOf(".");if(u>0){const d=n.name.slice(0,u);if(s.get(i)?.get(d)?.kind==="namespace")throw wg(n.name)}const f=s.get(i)?.get(n.name);if(f?.kind==="namespace")throw wg(n.name);if(!f)throw Zl(n.name,i);return{kind:"identifier",name:f.name,mangledName:f.mangledName}}case"array":case"atomic":case"vector":case"matrix":case"ptr":return{...n,element:aa(n.element,i,s)};case"texture":return{...n,sampleType:n.sampleType?aa(n.sampleType,i,s):void 0};default:return n}}function rs(n,i){if(!i||n.kind!=="identifier")return n;const s=i.aliases.get(n.mangledName??n.name);return s?rs(s.target,i):n}function Wc(n,i){const s=rs(n,i);switch(s.kind){case"array":case"atomic":case"vector":case"matrix":case"ptr":return{...s,element:Wc(s.element,i)};case"texture":return{...s,sampleType:s.sampleType?Wc(s.sampleType,i):void 0};default:return s}}function Dw(n,i,s,l){const u=void 0;if(u!==void 0&&s.some(g=>g.path===u))return u;const f=n.from,d=i.slice(0,i.lastIndexOf("/")+1),h=f.startsWith("/")?f:Cw(`${d}${f}`);return[f,h].find(g=>s.some(b=>b.path===g))??u??h}function Cw(n){const i=n.startsWith("/"),s=[];for(const l of n.split("/"))!l||l==="."||(l===".."?s.pop():s.push(l));return`${i?"/":""}${s.join("/")}`}function dr(n,i,s=ns(n),l=s,u){const f=u?Wc(n,u):n;return Ow(f,i,s,l,u)}function Ow(n,i,s,l,u){switch(n.kind){case"scalar":return zw(n,i,s,l);case"atomic":return _w(n,i,s,l);case"vector":return Uw(n,i,s,l,u);case"matrix":return Nw(n,i,s,l,u);case"array":return kw(n,i,s,l,u);case"identifier":return jw(n,i,s,l,u);default:throw hy(ns(n))}}function zw(n,i,s,l){const u=cy(n.name);if(n.name==="bool")throw dy();return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:u,size:u}}function _w(n,i,s,l){return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:4,size:4}}function Uw(n,i,s,l,u){const d=dr(n.element,i,s,l,u).size??4,h=n.width===2?d*2:d*4;return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:h,size:d*n.width}}function Nw(n,i,s,l,u){const f={kind:"vector",width:n.rows,element:n.element},d=dr(f,i,`${s}[]`,`${l}[]`,u),h=sa(d.align,d.size??0);return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:d.align,size:h*n.columns,stride:h,element:d}}function kw(n,i,s,l,u){Lw(n.countExpression);const f=dr(n.element,i,`${s}[]`,`${l}[]`,u),d=sa(ur(n.element,i,u),f.size??0);return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:ur(n,i,u),size:n.count===void 0?void 0:d*n.count,stride:d,element:f,runtimeSized:n.count===void 0}}function Lw(n){if(n!==void 0&&!uy(n))throw Tw()}function jw(n,i,s,l,u){if(!u)throw Zl(n.name,"<unknown>");const f=u.structs.get(n.mangledName??n.name);if(!f)throw Zl(n.name,"<unknown>");const d=[];let h=0,m=1;for(const b of f.members){const x=Bw(b,i,h,u);d.push(x.member),h=Gw(i,b.type,x.offset,x.member.size??0,u),m=Math.max(m,x.member.align)}const g=Iw(i,m);return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:g,size:sa(g,h),members:d}}function Bw(n,i,s,l){const u=dr(n.type,i,n.name,n.name,l),f=Math.max(ur(n.type,i,l),n.align??1),d=Math.max(u.size??0,n.size??0),h=sa(f,s);return{member:{name:n.name,offset:h,align:f,size:d,type:n.type,layout:u,explicitAlign:n.align,explicitSize:n.size},offset:h}}function Gw(n,i,s,l,u){return s+(n==="uniform"&&$w(i,u)?sa(16,l):l)}function $w(n,i){const s=rs(n,i);return s.kind==="identifier"&&i.structs.has(s.mangledName??s.name)}function Iw(n,i){return n==="uniform"?sa(16,i):i}function ur(n,i,s){const l=s?rs(n,s):n,u=Hl(l,i,s);return i==="uniform"&&Vw(l,s)?sa(16,u):u}function Vw(n,i){return n.kind==="array"||n.kind==="identifier"&&!!i?.structs.get(n.mangledName??n.name)}function Hl(n,i,s){const l=s?rs(n,s):n;switch(l.kind){case"scalar":return Fw(l.name);case"atomic":return 4;case"vector":return l.width===2?Hl(l.element,i,s)*2:Hl(l.element,i,s)*4;case"matrix":return Hl({kind:"vector",width:l.rows,element:l.element},i,s);case"array":return ur(l.element,i,s);case"identifier":return Hw(l,i,s);default:throw hy(ns(l))}}function Fw(n){if(n==="bool")throw dy();return cy(n)}function Hw(n,i,s){const l=s?.structs.get(n.mangledName??n.name);if(!l)throw Zl(n.name,"<unknown>");return Math.max(1,...l.members.map(u=>Math.max(ur(u.type,i,s),u.align??1)))}const qw=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"]),Yw=new Set(["import","export","from","as"]),py=new Set([...qw,...Yw]),Xw=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"]),Kw=new Set(["binding_array"]),Qw=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"]),Pw=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"]),Zw=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"]),Ww=new Set(["align","binding","blend_src","builtin","compute","diagnostic","fragment","group","id","interpolate","invariant","location","must_use","size","vertex","workgroup_size"]),Jw=new Set(["function","private","storage","uniform","workgroup"]),e2=new Set(["read","read_write","write"]),t2=new Set(["bgra8unorm","r32float","r32sint","r32uint","rg32float","rg32sint","rg32uint","rgba16float","rgba16sint","rgba16uint","rgba32float","rgba32sint","rgba32uint","rgba8sint","rgba8snorm","rgba8uint","rgba8unorm"]);[...py,...Xw,...Kw,...Qw,...Pw,...Zw,...Ww,...Jw,...e2,...t2];const n2="VGPU-WGSL-IDENT-NONASCII",i2="https://github.com/vercel-labs/vgpu/issues/294";function a2(n,i){const s=[];let l=0,u=1,f=1;const d=(m,g,b,x,R)=>s.push({kind:m,text:n.slice(g,b),start:g,end:b,line:x,column:R}),h=()=>{n[l]===`
|
|
10
|
+
`?(u++,f=1):f++,l++};for(;l<n.length;){const m=n[l];if(/\s/.test(m)){h();continue}const g=l,b=u,x=f;if(m==="/"&&n[l+1]==="/"){for(;l<n.length&&n[l]!==`
|
|
11
|
+
`;)h();d("lineComment",g,l,b,x);continue}if(m==="/"&&n[l+1]==="*"){let R=0;for(;l<n.length;){if(n[l]==="/"&&n[l+1]==="*"){R++,h(),h();continue}if(n[l]==="*"&&n[l+1]==="/"){if(R--,h(),h(),R===0){d("blockComment",g,l,b,x);break}continue}h()}if(R!==0)throw et("VGPU-WGSL-LEX-UNTERM-COMMENT","Unterminated block comment",b,x);continue}if(m==='"'||m==="'"){const R=m;for(h();l<n.length&&n[l]!==R;){if(n[l]===`
|
|
12
|
+
`)throw et("VGPU-WGSL-LEX-UNTERM-STRING","Unterminated string",b,x);n[l]==="\\"&&h(),h()}if(l>=n.length)throw et("VGPU-WGSL-LEX-UNTERM-STRING","Unterminated string",b,x);h(),d("string",g,l,b,x);continue}if(/[A-Za-z_]/.test(m)){for(;l<n.length&&/[A-Za-z0-9_]/.test(n[l]);)h();const R=n.slice(g,l);d(py.has(R)?"keyword":"ident",g,l,b,x);continue}if(/[0-9]/.test(m)||m==="."&&/[0-9]/.test(n[l+1]??"")){for(m==="."&&h();l<n.length;){const R=n[l];if(/[A-Za-z0-9_.]/.test(R)){h();continue}if((R==="+"||R==="-")&&r2(n[l-1])&&/[0-9]/.test(n[l+1]??"")){h();continue}break}d("number",g,l,b,x);continue}if(m.charCodeAt(0)>127)throw s2(n,l,u,f,i);h(),d("punct",g,l,b,x)}return s}function s2(n,i,s,l,u){let f=i;for(;f>0&&Eg(n[f-1]);)f--;let d=i+1;for(;d<n.length&&Eg(n[d]);)d++;const h=n.slice(f,d),m=l-(i-f),g=u===void 0?"":` in ${u}`,b=BS(n2,`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 ${i2}`,line:s,column:m});return b.range={file:u,start:{line:s,column:m}},b}function Eg(n){return n.charCodeAt(0)>127||/[A-Za-z0-9_]/.test(n)}function r2(n){return n==="e"||n==="E"||n==="p"||n==="P"}const l2=/^_vgsl_[0-9a-f]{8,16}__[A-Za-z_][A-Za-z0-9_]*$/,u2=new Set(["fn","struct","const","alias","var","override"]);function my(n){return new o2(n).analyze()}class o2{tokens;scopes=[];declarations=[];references=[];functions=[];preserved=new Map;symbolsByScope=new Map;moduleFallbackReasons=[];pendingSymbols=[];moduleScopeId;constructor(i){this.tokens=i,this.moduleScopeId=this.createScope("module",void 0,void 0,0)}analyze(){this.collectTopLevel();for(const i of this.functions)this.walkFunction(i);return{tokens:this.tokens,scopes:this.scopes,declarations:this.declarations,references:this.references,functions:this.functions,preservedTokens:[...this.preserved.entries()].map(([i,s])=>({tokenIndex:i,reason:s})),fallback:{wholeModule:this.moduleFallbackReasons.length>0,reasons:this.moduleFallbackReasons}}}collectTopLevel(){let i=0;for(let s=0;s<this.tokens.length;s++){const l=this.tokens[s];if(!Qn(l)){if(l.text==="{"){i++;continue}if(l.text==="}"){i--,i<0&&(this.moduleFallback("unmatched top-level closing brace",s),i=0);continue}if(i===0){if(l.text==="@"){s=this.preserveAttribute(s);continue}if(l.text==="enable"||l.text==="requires"||l.text==="diagnostic"||l.text==="const_assert"){s=this.preserveStatement(s,"directive");continue}if(l.text!=="export"){if(l.text==="struct"){s=this.collectStruct(s);continue}if(l.text==="fn"){s=this.collectFunction(s);continue}if(l.text==="const"||l.text==="alias"||l.text==="var"||l.text==="override"){s=this.preserveGlobalDeclaration(s);continue}l.kind==="keyword"&&!u2.has(l.text)&&this.moduleFallback(`unexpected top-level keyword '${l.text}'`,s)}}}}i!==0&&this.moduleFallback("unclosed top-level brace",this.tokens.length-1),this.scopes[this.moduleScopeId].endToken=Math.max(0,this.tokens.length-1)}collectStruct(i){const s=this.nextSig(i);if(s===void 0||this.tokens[s]?.kind!=="ident")return this.moduleFallback("struct without name",i),i;this.preserveToken(s,"global");const l=this.nextSig(s);if(l===void 0||this.tokens[l]?.text!=="{")return this.moduleFallback("struct without body",i),s;const u=this.findMatching(l,"{","}");if(u===void 0)return this.moduleFallback("unclosed struct body",l),l;for(let f=l;f<=u;f++)this.tokens[f]?.kind==="ident"&&this.preserveToken(f,"struct");return u}collectFunction(i){const s=this.nextSig(i);if(s===void 0||this.tokens[s]?.kind!=="ident")return this.moduleFallback("function without name",i),i;const l=this.tokens[s].text,u=l2.test(l)&&!this.hasEntryAttributeBefore(i);this.addDeclaration(l,"function",s,this.moduleScopeId,void 0,u),u||this.preserveToken(s,"global");const f=this.nextSig(s);if(f===void 0||this.tokens[f]?.text!=="(")return this.moduleFallback("function without parameter list",s),s;const d=this.findMatching(f,"(",")");if(d===void 0)return this.moduleFallback("unclosed function parameter list",f),f;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,f);return this.functions.push({id:this.functions.length,name:l,nameTokenIndex:s,scopeId:g,bodyStartToken:h,bodyEndToken:m,skipped:!1,fallbackReasons:[]}),this.collectParams(f,d,g,this.functions.length-1),this.scopes[g].endToken=m,m}collectParams(i,s,l,u){for(let f=i+1;f<s;f++){const d=this.tokens[f];if(!Qn(d)){if(d.text==="@"){f=this.preserveAttribute(f);continue}if(d.kind==="ident"&&this.nextSig(f)!==void 0&&this.tokens[this.nextSig(f)]?.text===":"){this.addDeclaration(d.text,"param",f,l,u,!0);const h=this.nextSig(f);f=this.preserveTypeFrom(h+1,[",",")"],s)}}}}preserveFunctionSignatureTail(i,s){for(let l=i;l<s;l++){const u=this.tokens[l];if(!Qn(u)){if(u.text==="@"){l=this.preserveAttribute(l);continue}u.kind==="ident"&&this.preserveToken(l,"type")}}}preserveGlobalDeclaration(i){let s=i+1;if(this.tokens[i]?.text==="var"){const f=this.nextSig(i);if(f!==void 0&&this.tokens[f]?.text==="<"){const d=this.findMatching(f,"<",">");if(d===void 0)return this.moduleFallback("unparseable top-level var template",f),f;this.preserveRange(f,d,"type"),s=d+1}}const l=this.findNextIdent(s);l!==void 0&&(this.preserveToken(l,"global"),this.addDeclaration(this.tokens[l].text,"global",l,this.moduleScopeId,void 0,!1));const u=this.findStatementEnd(i);for(let f=i;f<=u;f++)this.tokens[f]?.kind==="ident"&&this.preserveToken(f,"global");return u}walkFunction(i){const s=[this.moduleScopeId,i.scopeId],l=[],u=(h,m)=>{const g=this.createScope(h,s[s.length-1],i.id,m);return s.push(g),g},f=h=>{if(s.length<=2){this.functionFallback(i,"scope frame underflow",h);return}const m=s.pop();return this.scopes[m].endToken=h,m};u("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 b=this.nextSig(h);b!==void 0&&this.tokens[b]?.kind==="ident"&&this.preserveToken(b,"member");continue}if(m.text==="enable"||m.text==="requires"||m.text==="diagnostic"){h=this.preserveStatement(h,"directive");continue}if(m.text==="for"){const b=u("for-init",h),x=this.nextSig(h);(x===void 0||this.tokens[x]?.text!=="(")&&this.functionFallback(i,"for without parenthesized header",h),l.push({scopeId:b,headerDepth:0,awaitingBody:!1});continue}const g=l[l.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 b=c2(l,x=>x.awaitingBody&&x.bodyDepth===void 0);b&&(b.bodyDepth=d),u("block",h);continue}if(m.text==="}"){const b=d;for(f(h),d--;l.length>0&&l[l.length-1].bodyDepth===b;)f(h),l.pop();d<0&&this.functionFallback(i,"unmatched closing brace",h);continue}if(m.text===":"){h=this.preserveTypeFrom(h+1,["=",";",",",")","{"],i.bodyEndToken);continue}if(m.text==="-"&&this.tokens[this.nextSig(h)??-1]?.text===">"){h=this.preserveTypeFrom((this.nextSig(h)??h)+1,["{"],i.bodyEndToken);continue}if(m.text==="let"||m.text==="const"||m.text==="var"){h=this.collectLocalDeclaration(h,s[s.length-1],i);continue}if(m.kind==="ident"&&!this.preserved.has(h)){const b=this.resolve(m.text,s);b!==void 0?this.references.push({name:m.text,tokenIndex:h,declarationId:b,scopeId:s[s.length-1],functionId:i.id}):this.preserveToken(h,"unknown")}}for(;s.length>2;)f(i.bodyEndToken)}collectLocalDeclaration(i,s,l){const u=this.tokens[i].text;let f=i+1;if(u==="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(l,"unparseable var template",m),m;this.preserveRange(m,g,"type"),f=g+1}}const d=this.findNextIdent(f);if(d===void 0||d>=l.bodyEndToken)return this.functionFallback(l,`${u} without identifier`,i),i;this.addDeclaration(this.tokens[d].text,u,d,s,l.id,!0,this.findStatementEnd(i));const h=this.nextSig(d);return h!==void 0&&this.tokens[h]?.text===":"?this.preserveTypeFrom(h+1,["=",";",",",")"],l.bodyEndToken):d}addDeclaration(i,s,l,u,f,d,h){const m=this.declarations.length;return this.declarations.push({id:m,name:i,kind:s,tokenIndex:l,scopeId:u,functionId:f,safeToRename:d}),h!==void 0?this.pendingSymbols.push({name:i,id:m,scopeId:u,activateAfter:h}):this.activateSymbol(i,m,u),m}activatePendingSymbols(i){for(let s=this.pendingSymbols.length-1;s>=0;s--){const l=this.pendingSymbols[s];l.activateAfter>=i||(this.activateSymbol(l.name,l.id,l.scopeId),this.pendingSymbols.splice(s,1))}}activateSymbol(i,s,l){let u=this.symbolsByScope.get(l);u||(u=new Map,this.symbolsByScope.set(l,u)),u.has(i)||u.set(i,s)}resolve(i,s){for(let l=s.length-1;l>=0;l--){const u=this.symbolsByScope.get(s[l])?.get(i);if(u!==void 0)return u}}preserveAttribute(i){this.preserveToken(i,"attribute");const s=this.nextSig(i);if(s===void 0)return i;this.preserveToken(s,"attribute");const l=this.nextSig(s);if(l===void 0||this.tokens[l]?.text!=="(")return s;const u=this.findMatching(l,"(",")");return u===void 0?(this.preserveRange(l,l,"attribute"),l):(this.preserveRange(l,u,"attribute"),u)}preserveTypeFrom(i,s,l){let u=0,f=0,d=0,h=i-1;for(let m=i;m<l;m++){const g=this.tokens[m];if(!Qn(g)){if(u===0&&f===0&&d===0&&s.includes(g.text))return Math.max(i-1,m-1);if(g.text==="<")u++;else if(g.text===">")u=Math.max(0,u-1);else if(g.text==="(")f++;else if(g.text===")"){if(f===0&&s.includes(")"))return Math.max(i-1,m-1);f=Math.max(0,f-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 l=this.findStatementEnd(i);return this.preserveRange(i,l,s),l}preserveRange(i,s,l){for(let u=i;u<=s;u++)this.tokens[u]&&this.tokens[u].kind!=="lineComment"&&this.tokens[u].kind!=="blockComment"&&this.preserveToken(u,l)}preserveToken(i,s){this.preserved.has(i)||this.preserved.set(i,s)}createScope(i,s,l,u){const f=this.scopes.length;return this.scopes.push({id:f,kind:i,parentId:s,functionId:l,startToken:u}),f}nextSig(i){for(let s=i+1;s<this.tokens.length;s++)if(!Qn(this.tokens[s]))return s}findNextIdent(i){for(let s=i;s<this.tokens.length;s++){const l=this.tokens[s];if(!Qn(l)){if(l.kind==="ident")return s;if(l.text!=="@")return}}}findNextText(i,s){for(let l=i;l<this.tokens.length;l++)if(!Qn(this.tokens[l])&&this.tokens[l].text===s)return l}findStatementEnd(i){let s=0;for(let l=i;l<this.tokens.length;l++){const u=this.tokens[l].text;if(u==="(")s++;else if(u===")")s=Math.max(0,s-1);else if(s===0&&(u===";"||u==="{"||u==="}"))return l}return this.tokens.length-1}findMatching(i,s,l){let u=0;for(let f=i;f<this.tokens.length;f++){const d=this.tokens[f].text;if(d===s&&u++,d===l&&(u--,u===0))return f}}hasEntryAttributeBefore(i){for(let s=i-1;s>=0;s--){const l=this.tokens[s];if(!Qn(l)){if(l.text===")"||l.kind==="ident"||l.text==="@"){const u=l.text;if(u==="compute"||u==="vertex"||u==="fragment")return!0;continue}break}}return!1}moduleFallback(i,s){this.moduleFallbackReasons.push(`${i} at token ${s}`)}functionFallback(i,s,l){i.skipped=!0,i.fallbackReasons.push(`${s} at token ${l}`)}}function c2(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 f2=new Set(["textureSample","textureSampleBias","textureSampleLevel","textureSampleGrad","textureGather","textureSampleBaseClampToEdge"]),d2=new Set(["textureSampleCompare","textureSampleCompareLevel","textureGatherCompare"]);function h2(n,i,s){const l=new Map;for(let u=0;u<n.length;u++){const f=n[u],d=i[u],h=my(f.tokens),m=new Map;for(const b of d.vars){const x=Xt(b.attrs,"group"),R=Xt(b.attrs,"binding"),$=h.declarations.find(L=>L.kind==="global"&&L.name===b.name);x!==void 0&&R!==void 0&&$&&m.set($.id,{group:x,binding:R})}const g=new Map;for(const b of h.declarations){if(b.kind!=="function")continue;const x=h.functions.find(R=>R.nameTokenIndex===b.tokenIndex);x&&g.set(b.id,x.id)}for(const b of d.entries){const x=h.functions.find(O=>O.name===b.name),R=[];let $=h.fallback.wholeModule||!x;!$&&x&&($=!gy(x.id,new Map,new Set,h,m,g,R));const L=x?v2(x.id,h,m,g):s.map(Jc);l.set(b,$?b2(s,L):x2(R))}}return l}function gy(n,i,s,l,u,f,d){const h=l.functions[n];if(!h||h.skipped)return!1;const m=`${n}|${[...i].map(([x,R])=>`${x}:${R.group}:${R.binding}`).join(",")}`;if(s.has(m))return!0;s.add(m);const g=l.references.filter(x=>x.functionId===n),b=new Map(g.map(x=>[x.tokenIndex,x]));for(let x=h.bodyStartToken+1;x<h.bodyEndToken;x++){const R=l.tokens[x]?.text,$=f2.has(R??"")?"filtering":d2.has(R??"")?"comparison":void 0,L=b.get(x),O=L&&f.get(L.declarationId);if(!$&&O===void 0)continue;const j=y2(l,x);if(j===void 0||l.tokens[j]?.text!=="(")continue;const X=g2(l,j);if(!X)return!1;const Q=X.map(([H,U])=>p2(H,U,l,u,i));if($){const H=R==="textureGather"&&!m2(X[0],l,u,i)?1:0,U=Q[H],J=Q[H+1];if(!U||!J)return!1;d.push({texture:U,sampler:J,mode:$})}else{const H=l.declarations.filter(J=>J.kind==="param"&&J.functionId===O).sort((J,W)=>J.tokenIndex-W.tokenIndex),U=new Map;for(let J=0;J<H.length;J++)Q[J]&&U.set(H[J].id,Q[J]);if(!gy(O,U,s,l,u,f,d))return!1}}return!0}function p2(n,i,s,l,u){for(const f of s.references){if(f.tokenIndex<n||f.tokenIndex>i)continue;const d=l.get(f.declarationId)??u.get(f.declarationId);if(d)return d}}function m2(n,i,s,l){const u=i.references.find(f=>f.tokenIndex>=n[0]&&f.tokenIndex<=n[1]);return u?.tokenIndex===n[0]?s.get(u.declarationId)??l.get(u.declarationId):void 0}function g2(n,i){const s=[];let l=1,u=0,f=0,d=0,h=i+1;for(let m=i+1;m<n.tokens.length;m++){const g=n.tokens[m].text;if(g==="(")l++;else if(g===")"){if(l--,l===0)return s.push([h,m-1]),s}else g==="["?u++:g==="]"?u--:g==="{"?f++:g==="}"?f--:g==="<"?d++:g===">"?d--:g===","&&l===1&&u===0&&f===0&&d===0&&(s.push([h,m-1]),h=m+1)}}function y2(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 v2(n,i,s,l){const u=[n],f=new Set,d=new Map;for(;u.length;){const h=u.pop();if(!f.has(h)){f.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 b=l.get(m.declarationId);b!==void 0&&u.push(b)}}}return[...d.values()]}function b2(n,i){const s=new Set(i.map(d=>`${d.group}:${d.binding}`)),l=n.filter(d=>s.has(`${d.group}:${d.binding}`)),u=l.filter(d=>d.bindingLayout?.kind==="texture"&&d.bindingLayout.texture.sampleType==="unfilterable-float"&&!d.bindingLayout.texture.multisampled),f=l.filter(d=>d.bindingLayout?.kind==="sampler"&&d.bindingLayout.sampler.type==="filtering");return u.flatMap(d=>f.map(h=>({texture:Jc(d),sampler:Jc(h),mode:"filtering"})))}function Jc(n){return{group:n.group,binding:n.binding}}function x2(n){const i=new Set;return n.filter(s=>{const l=`${s.texture.group}:${s.texture.binding}:${s.sampler.group}:${s.sampler.binding}:${s.mode}`;return i.has(l)?!1:(i.add(l),!0)})}function S2(n,i){const s=n.map(hw),l=Aw(n,s),u=Rw(s,l),f=[],d=[];for(const g of s)for(const b of g.vars){const x=Xt(b.attrs,"group"),R=Xt(b.attrs,"binding");if(x===void 0||R===void 0)continue;const $=aa(b.type,b.path,l),L=HS($,b.addressSpace),O=b.addressSpace==="uniform"||b.addressSpace==="storage"?dr($,b.addressSpace,b.name,b.mangledName,u):void 0;O&&d.push(O),f.push({group:x,binding:R,name:b.name,mangledName:b.mangledName,type:$,kind:L,addressSpace:b.addressSpace,access:b.access,struct:$.kind==="identifier"?u.structs.get($.mangledName??$.name):void 0,layout:O,bindingLayout:qS(L,b.addressSpace,b.access,$,O)})}f.sort((g,b)=>g.group-b.group||g.binding-b.binding);const h=w2(n,s,f),m=h2(n,s,f);return{bindings:f,entryPoints:s.flatMap(g=>g.entries.map(b=>E2(b,s.flatMap(x=>x.structs),l,u,h.get(b)??f,m.get(b)??[]))),overrides:s.flatMap(g=>g.overrides),featuresRequired:[...new Set(s.flatMap(g=>g.features))],aliases:[...u.aliases.values()],structs:[...u.structs.values()],hostShareableLayouts:d}}function w2(n,i,s){const l=new Map;for(let u=0;u<n.length;u++){const f=n[u],d=i[u],h=my(f.tokens),m=h.fallback.wholeModule,g=new Map;for(const x of h.declarations){if(x.kind!=="function")continue;const R=h.functions.find($=>$.nameTokenIndex===x.tokenIndex);R&&g.set(x.id,R.id)}const b=new Map;for(const x of d.vars){const R=Xt(x.attrs,"group"),$=Xt(x.attrs,"binding");if(R===void 0||$===void 0)continue;const L=h.declarations.find(O=>O.kind==="global"&&O.name===x.name);L&&b.set(L.id,{group:R,binding:$})}for(const x of d.entries){const R=h.functions.find(j=>j.name===x.name);if(m||!R){l.set(x,s);continue}const $=[R.id],L=new Set,O=new Map;for(;$.length;){const j=$.pop();if(!L.has(j)&&(L.add(j),!!h.functions[j]))for(const X of h.references){if(X.functionId!==j)continue;const Q=b.get(X.declarationId);Q&&O.set(`${Q.group}:${Q.binding}`,Q);const H=g.get(X.declarationId);H!==void 0&&$.push(H)}}l.set(x,[...O.values()].sort((j,X)=>j.group-X.group||j.binding-X.binding))}}return l}function E2(n,i,s,l,u,f){return{name:n.name,mangledName:n.mangledName,stage:n.stage,...n.workgroupSize?{workgroupSize:n.workgroupSize}:{},bindings:u.map(({group:d,binding:h})=>({group:d,binding:h})),samplingPairs:f,...n.stage==="vertex"?{inputs:T2(n,i,s,l)}:{}}}function T2(n,i,s,l){const u=[];for(const f of n.params){if(Tg(f.attrs,"builtin"))continue;const d=aa(f.type,n.path,s),h=Xt(f.attrs,"location");if(h!==void 0){u.push({name:f.name,location:h,type:d});continue}const m=rs(d,l);if(m.kind!=="identifier")continue;const g=i.find(x=>x.mangledName===(m.mangledName??m.name)),b=l.structs.get(m.mangledName??m.name);if(g)for(let x=0;x<g.members.length;x++){const R=g.members[x];if(Tg(R.attrs,"builtin"))continue;const $=Xt(R.attrs,"location");$!==void 0&&u.push({name:R.name,location:$,type:b?.members[x]?.type??aa(R.type,g.path,s)})}}return u}function Tg(n,i){return n.some(s=>s.name===i)}function yy(n,i="<runtime>"){const s=a2(n,i),l=$S(s);if(l.imports.length>0)throw et("VGPU-WGSL-REFLECT-SOURCE-IMPORT","reflectSource() accepts a single raw WGSL string; use resolveShader() for WGSL import graphs.");return S2([{path:i,source:n,tokens:s,parsed:l}])}function vy(){const n=new Map;return{getOrCreate(i,s,l,u){const f=l.map(ef),d=`${i}:${s}:${f.join("|")}`,h=n.get(d);if(h)return h.bindGroup;const m=u();return n.set(d,{identities:f,bindGroup:m}),m},evictIdentity(i){const s=ef(i);for(const[l,u]of n)u.identities.includes(s)&&n.delete(l)},clearDraw(i){const s=`${i}:`;for(const l of n.keys())l.startsWith(s)&&n.delete(l)},dispose(){n.clear()}}}function ef(n){return typeof n=="string"||typeof n=="number"?String(n):`${n.kind}:${n.id}`}function Wl(n,i,s){const l=n[i];if(!l)throw new se({code:"VGPU-REFLECT-ENTRY-METADATA-MISSING",message:`Entry point '${n.name}' has no reflected ${i}.`,fix:"Pass the reflection from reflectSource()/resolveShader().",where:s});return l}const Jl=new WeakMap;function rr(n,i){if(!n.gpu.pushErrorScope||!n.gpu.popErrorScope)return;n.gpu.pushErrorScope("validation");const s=Jl.get(n.gpu);s?s.push(i):Jl.set(n.gpu,[i])}function cn(n){const i=Jl.get(n.gpu);if(!i?.length||!n.gpu.popErrorScope)return;const s=i.pop();return i.length||Jl.delete(n.gpu),{context:s,error:n.gpu.popErrorScope()}}function by(n){const i=[];let s=cn(n);for(;s;)i.push(s),s=cn(n);return i}function A2(n){const i=cn(n);i&&bf(i)}function xy(n){for(const i of by(n))bf(i)}function qt(n){for(const i of n)bf(i)}function vf(n){return n.gpu.queue.onSubmittedWorkDone?.()??Promise.resolve()}function Sy(n,i=[],s={}){return R2(n,i,s.errorSink??D2)}function eu(n,i){return{context:n.context,error:M2(n.error,i.error)}}async function M2(n,i){const s=await Promise.allSettled([n,i]);for(const u of s)if(u.status==="fulfilled"&&u.value)return u.value;const l=s.find(u=>u.status==="rejected");if(l?.status==="rejected")throw l.reason;return null}async function R2(n,i,s){await vf(n);for(const l of i)try{const u=await l.error;u&&await s(is(l.context.label,l.context.group,u))}catch(u){await s(is(l.context.label,l.context.group,u))}}function bf(n){n.error.catch(()=>{})}function D2(n){console.error(n)}function wy(n,i,s,l){try{i.end()}catch(u){const f=by(n);qt(s),qt(f),s.length=0;const d=f[0]?.context??l;throw d?is(d.label,d.group,u):u}}let C2=1;const Ag=new WeakMap;function O2(n){return n===null||typeof n!="object"||ArrayBuffer.isView(n)||n instanceof ArrayBuffer||Array.isArray(n)?!0:n instanceof Ri||n instanceof as?!1:!Ty(n)}function tf(n){return typeof n!="object"||n===null||Array.isArray(n)||ArrayBuffer.isView(n)||n instanceof ArrayBuffer||n instanceof Ri||n instanceof as?!1:!Ty(n)}function Mg(n,i,s){switch(n.bindingLayout?.kind){case"buffer":return z2(n,i,s);case"texture":return _2(n,i,s);case"sampler":return U2(n,i);case"storageTexture":throw Zn(n,"storage texture","Pass a storage-compatible texture.");case"externalTexture":throw Zn(n,"external texture","Pass a compatible GPUExternalTexture.");default:throw Zn(n,"reflected resource","Fix shader reflection bindingLayout.")}}function z2(n,i,s){const l=kS(i);if(l)return l[ty](n,s.sourceHint);if(i instanceof Ri)return bg(i,`${s.sourceHint}.set`),k2(n,i.options.usage),{resource:{buffer:i.gpu},identity:i.resourceIdentity,unsubscribe:u=>i.onDestroy(u)};if(j2(i))return bg(i.buffer,`${s.sourceHint}.set`),{resource:{buffer:i.gpu,offset:0,size:i.size},identity:i.buffer.resourceIdentity,unsubscribe:u=>i.buffer.onDestroy(u)};if(My(i))return{resource:i,identity:or(i.buffer)};if(xf(i))return{resource:{buffer:i},identity:or(i)};throw Zn(n,"buffer",`Pass a compatible Buffer/Uniform: ${n.name}.set({ ${n.name}: gpu.device.createBuffer(...) }).`)}function _2(n,i,s){const l=Ey(i);if(l){const u=l.color;Rg(n,u,s);const f=l.onTexturesRecreated?.bind(l);return{resource:u.createView(),identity:u.resourceIdentity,unsubscribe:d=>l.onDestroy(d),onRecreate:f?d=>f(d):void 0}}if(i instanceof as)return L2(n,i.usage),Rg(n,i,s),{resource:i.createView(),identity:i.resourceIdentity,unsubscribe:u=>i.onDestroy(u)};if(Ay(i))return{resource:i.createView(),identity:i.resourceIdentity??or(i)};if(typeof i=="object"&&i!==null)return{resource:i,identity:or(i)};throw Zn(n,"texture/target",`Pass a Texture or Target: ${n.name}.set({ ${n.name}: scene.color }) or set({ ${n.name}: scene }).`)}function U2(n,i){if(N2(i))return{resource:i,identity:or(i)};throw Zn(n,"sampler",`Use the cached sampler: set({ ${n.name}: sampler(gpu) }).`)}function N2(n){return typeof n!="object"||n===null||n instanceof Ri||n instanceof as?!1:!xf(n)&&!My(n)&&!Ay(n)&&!Ey(n)}function k2(n,i){const s=n.bindingLayout?.kind==="buffer"?n.bindingLayout.buffer.type:void 0;if(s==="uniform"&&!i.includes("uniform"))throw Zn(n,"uniform buffer","Create with usage: ['uniform','copy_dst'].");if((s==="storage"||s==="read-only-storage")&&!i.includes("storage"))throw Zn(n,"storage buffer","Create with usage: ['storage','copy_dst'].")}function L2(n,i){if(!i.includes("texture_binding")&&!i.includes("render_attachment"))throw Zn(n,"sampled texture","Use texture_binding usage or a sampleable Target.")}function Rg(n,i,s){if(!(!s.filterableTexture||s.float32Filterable)&&(i.format==="r32float"||i.format==="rg32float"||i.format==="rgba32float"))throw J1(s.sourceHint,n,i.format,i.label??"texture",s.pairedSampler)}function Ey(n){if(typeof n!="object"||n===null)return;const i=n;if(!(!i.resourceIdentity||!i.color||typeof i.onDestroy!="function"))return i}function Ty(n){const i=n;return"gpu"in i||"bindGroup"in i||"createView"in i||"resourceIdentity"in i}function or(n){if(typeof n!="object"||n===null)return`value:${String(n)}`;let i=Ag.get(n);return i||(i={kind:"external",id:C2++},Ag.set(n,i)),i}function j2(n){return typeof n=="object"&&n!==null&&"gpu"in n&&"size"in n&&"buffer"in n&&n.buffer instanceof Ri}function Ay(n){return typeof n=="object"&&n!==null&&typeof n.createView=="function"}function My(n){return typeof n=="object"&&n!==null&&"buffer"in n&&xf(n.buffer)}function xf(n){return typeof n=="object"&&n!==null&&"size"in n&&"usage"in n&&typeof n.destroy=="function"}function B2(n,i){G2(n);const s=new ArrayBuffer(n.size);return Sf(new DataView(s),n,0,i),s}function G2(n){if(n.size===void 0)throw Yt("set",`No se puede inferir byteLength para layout runtime-sized '${n.name}'.`)}function Sf(n,i,s,l){if(i.members)return $2(n,i.members,s,l);I2(n,i,s,l)}function $2(n,i,s,l){const u=l;for(const f of i)Sf(n,f.layout,s+f.offset,u?.[f.name])}function I2(n,i,s,l){switch(i.type.kind){case"scalar":return wf(n,s,i.type.name,l);case"vector":return V2(n,s,i.type,l);case"matrix":return F2(n,i,s,l);case"array":return H2(n,i,s,l);default:throw Yt("set",`No hay writer para layout ${i.type.kind}.`)}}function wf(n,i,s,l){s==="f32"?n.setFloat32(i,Number(l??0),!0):s==="i32"?n.setInt32(i,Number(l??0),!0):s==="u32"||s==="bool"?n.setUint32(i,s==="bool"?l?1:0:Number(l??0),!0):n.setUint16(i,q2(Number(l??0)),!0)}function V2(n,i,s,l){const u=l,f=Ry(s.element);for(let d=0;d<s.width;d++)wf(n,i+d*f,Ef(s.element),u?.[d]??0)}function F2(n,i,s,l){const u=i.type,f=l,d=Ry(u.element),h=i.stride??16;for(let m=0;m<u.columns;m++)for(let g=0;g<u.rows;g++)wf(n,s+m*h+g*d,Ef(u.element),f?.[m*u.rows+g]??0)}function H2(n,i,s,l){const u=l,f=i.stride??i.element?.size??0;if(!i.element)throw Yt("set","Array layout sin element layout.");for(let d=0;d<(u?.length??0);d++)Sf(n,i.element,s+d*f,u[d])}function Ry(n){return Ef(n)==="f16"?2:4}function Ef(n){if(n.kind!=="scalar")throw Yt("set",`Expected scalar, got ${n.kind}`);return n.name}function q2(n){const i=new Float32Array(1),s=new Uint32Array(i.buffer);i[0]=n;const l=s[0],u=l>>16&32768,f=l&8388607,d=l>>23&255;if(d===255)return u|(f?32256:31744);const h=d-127+15;return h>=31?u|31744:h<=0?h<-10?u:u|(f|8388608)>>1-h+13:u|h<<10|f>>13}const Dg=new WeakMap;function Y2(n,i){const s=new Map,l=new Set;for(const f of i){const d=f.stage==="vertex"?1:f.stage==="fragment"?2:4;for(const h of Wl(f,"bindings","visibility")){const m=`${h.group}:${h.binding}`;s.set(m,(s.get(m)??0)|d)}for(const h of Wl(f,"samplingPairs","visibility"))h.mode==="filtering"&&l.add(`${h.texture.group}:${h.texture.binding}`)}const u=f=>s.get(`${f.group}:${f.binding}`)??0;return Object.defineProperty(u,"filterable",{value:l}),u}function Dy(n,i,s=Tf){return n.flatMap(l=>{if(l.group!==i)return[];const u=s(l);return u===0?[]:[{binding:l.binding,visibility:u,...Q2(l,s.filterable?.has(`${l.group}:${l.binding}`)??!1)}]})}function X2(n,i,s,l=Tf){const u=new Map,f=s.bindings.filter(h=>l(h)!==0).map(h=>h.group),d=Math.max(-1,...f);for(let h=0;h<=d;h++)u.set(h,K2(n,i,s,h,l));return u}function K2(n,i,s,l,u=Tf){return Cy(n,`${i}.group${l}.bgl`,Dy(s.bindings,l,u))}function Cy(n,i,s){let l=Dg.get(n.gpu);l||(l=new Map,Dg.set(n.gpu,l));const u=JSON.stringify(s),f=l.get(u);if(f)return f;const d=P1(n.gpu.createBindGroupLayout({label:i,entries:s}),{entries:s});return l.set(u,d),d}function Q2(n,i){const s=n.bindingLayout;if(!s)throw Yt("bindGroupLayout",`Binding '${n.name}' does not have a reflected bindingLayout.`);return i&&s.kind==="texture"&&s.texture.sampleType==="unfilterable-float"&&!s.texture.multisampled?{texture:{...s.texture,sampleType:"float"}}:P2(s)}function P2(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 Tf(n){const i=globalThis.GPUShaderStage,s=i?.VERTEX??1,l=i?.FRAGMENT??2,u=i?.COMPUTE??4;return n.kind==="buffer"?s|l|u:l|u}function Z2(n){const i=W2(n.reflection),s=[...n.bindGroupLayouts.keys()].sort((w,G)=>w-G),l=new Map;function u(w){const G=[];for(const[te,ne]of Object.entries(w))G.push(...d(te,ne));return G}function f(w){const G=n.bindGroupLayouts.get(w.info.group);return!!G&&!!sr(G)?.entries.some(te=>te.binding===w.info.binding)}function d(w,G){const te=i.get(w);if(te)return h(te,w,G);const ne=J2(w,i,n.label);if(!ne)throw Yt(`${n.label}.set`,`Binding '${w}' does not exist in '${n.label}'.`);return m(ne,w,G)}function h(w,G,te){J(w.info.group);const ne=Cg(w.info,te);Og(w,G,ne);const le=ql(w.identity);return ne==="lib"?g(w,iE(w.libValue,te)):x(w,te),f(w)?kc(w,le):[]}function m(w,G,te){J(w.info.group);const ne=Cg(w.info,te);if(Og(w,G,ne),eE(w,G,ne),ne!=="lib")throw Yt(`${n.label}.set`,`Member '${G}' needs a JS value; set resource '${w.info.name}' instead.`);const le=ql(w.identity);return g(w,{...aE(w.libValue),[G]:te}),f(w)?kc(w,le):[]}function g(w,G){const te=A(w);w.libValue=G;const ne=B2(te,G);w.buffer||W(w,te.size),w.bytes=ne,w.buffer.write(ne,0)}function b(w){const G=sr(n.bindGroupLayouts.get(w.group))?.entries.find(le=>le.binding===w.binding),te=n.reflection.entryPoints.flatMap(le=>Wl(le,"samplingPairs",n.label)).find(le=>le.mode==="filtering"&&le.texture.group===w.group&&le.texture.binding===w.binding),ne=te&&n.reflection.bindings.find(le=>le.group===te.sampler.group&&le.binding===te.sampler.binding);return{sourceHint:n.label,filterableTexture:G?.texture?.sampleType==="float",float32Filterable:n.device.features.has("float32-filterable"),pairedSampler:ne}}function x(w,G){const te=Mg(w.info,G,b(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,G))}function R(w,G){const te=ql(w.identity);w.identity&&n.cache.evictIdentity(w.identity);const ne=Mg(w.info,G,b(w.info));if(w.unsubscribe?.(),w.unsubscribeRecreate?.(),w.resource=ne.resource,w.identity=ne.identity,w.unsubscribe=ne.unsubscribe?.(()=>{w.identity&&n.cache.evictIdentity(w.identity)}),w.unsubscribeRecreate=ne.onRecreate?.(()=>R(w,G)),f(w))for(const le of kc(w,te))n.onIdentityChange?.(le)}function $(w,G,te){L(w),tE(n.label,w,G,te);const ne=l.has(w)?`claimed-group:${w}`:void 0;return l.set(w,G),ne}function L(w){const G=n.bindGroupLayouts.get(w);if(!G)throw Yt(`${n.label}.layout`,`@group(${w}) does not exist in '${n.label}'.`);return G}function O(){return s.map(j)}function j(w){const G=l.get(w);if(G)return{group:w,bindGroup:G,offsets:[],claimValidation:X(G,w)};const te=new Set(sr(L(w))?.entries.map(oe=>oe.binding)),ne=n.reflection.bindings.filter(oe=>oe.group===w&&te.has(oe.binding)),le=Q(ne),Ge=H(ne),de=n.cache.getOrCreate(n.drawId,w,Ge,()=>n.device.gpu.createBindGroup({label:`${n.label}.group${w}`,layout:L(w),entries:le}));return{group:w,bindGroup:de,offsets:[]}}function X(w,G){return Q0(w)?void 0:{label:n.label,group:G}}function Q(w){return w.map(G=>{const te=U(G);return{binding:G.binding,resource:te.resource}})}function H(w){return w.map(G=>U(G).identity)}function U(w){const G=i.get(w.name);if(!G?.resource||!G.identity)throw eS(n.label,w);return G}function J(w){if(l.has(w))throw tS(n.label,w)}function W(w,G){w.buffer=n.device.createBuffer({size:G,usage:["uniform","copy_dst"],label:`${n.label}.${w.info.name}`}),w.resource={buffer:w.buffer.gpu,offset:0,size:G},w.identity=w.buffer.resourceIdentity,w.unsubscribe=w.buffer.onDestroy(()=>n.cache.evictIdentity(w.buffer.resourceIdentity))}function A(w){if(w.info.kind!=="buffer"||!w.info.layout?.size)throw Yt(`${n.label}.set`,`Binding '${w.info.name}' needs a compatible resource, not JS.`);return w.info.layout}return{get groups(){return s},set:u,claimGroup:$,layout:L,bindGroups:O,bindingState(w){const G=i.get(w);if(!(!G?.ownership||!G.resource||!G.identity))return{info:G.info,ownership:G.ownership,resource:G.resource,identity:G.identity}}}}function W2(n){return new Map(n.bindings.map(i=>[i.name,{info:i,memberOwnership:new Map}]))}function J2(n,i,s){let l;for(const u of i.values())if(u.info.layout?.members?.some(f=>f.name===n)){if(l)throw Yt(`${s}.set`,`Binding member '${n}' is ambiguous in '${s}'; set the complete binding.`);l=u}return l}function Cg(n,i){return n.bindingLayout?.kind==="buffer"&&O2(i)?"lib":"user"}function Og(n,i,s){if(n.ownership&&n.ownership!==s)throw P0(i,n.ownership);n.ownership??=s}function eE(n,i,s){const l=n.memberOwnership.get(i);if(l&&l!==s)throw P0(i,l);n.memberOwnership.set(i,s)}function tE(n,i,s,l){const u=Q0(s);if(!u)return;const f=sr(l);if(!f)return;const d=nE(f.entries,u.layout.entries);if(d)throw nS(n,i,d)}function nE(n,i){if(n.length!==i.length)return`expected ${n.length} bindings and received ${i.length}`;const s=zg(n),l=zg(i);for(const[u,f]of s){const d=l.get(u);if(!d)return`missing @binding(${u})`;if(_g(f)!==_g(d))return`@binding(${u}) does not match the reflected layout`}}function zg(n){return new Map(n.map(i=>[i.binding,i]))}function _g(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 kc(n,i){const s=ql(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 ql(n){return n===void 0?void 0:ef(n)}function iE(n,i){return tf(n)&&tf(i)?{...n,...i}:i}function aE(n){return tf(n)?n:{}}const sE="rgba8unorm",Af=Object.freeze([0,0,0,1]);function tu(n,i){const s=n,l=Array.isArray(n)?n:[s?.r,s?.g,s?.b,s?.a];if(l.length!==4||!l.every(u=>typeof u=="number"&&Number.isFinite(u)))throw SS(i);return Mf(n)}function Mf(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 Yl(n){return n.colors??[{format:n.format??sE}]}function Oy(n){return n.depth===!0?"depth24plus":n.depth||void 0}function zy(n){const i=n.msaa;if(i===!0||i===4)return 4;if(i===void 0||i===!1)return 1;const s=Z0();throw s.code="VGPU-TARGET-MSAA-INVALID",s.message=`msaa received ${i}; WebGPU 1|4; use true`,s}function rE(n,i){if(!n?.size)throw Z0();const s=Oy(n);if(s==="stencil8")throw mS(s);if(zy(n)===4)for(const l of Yl(n))lE(l.format,i)}function lE(n,i){if(i.isCompatibilityMode&&n==="rgba16float")throw Yt("target","Dawn compatibility mode does not support rgba16float+msaa.","Use rgba8unorm for MSAA here, or disable msaa.")}function uE(n,i,s,l){const u={view:(i??n).createView(),resolveTarget:i?n.createView():void 0,loadOp:l?"load":"clear",storeOp:i?"discard":"store"};return l||(u.clearValue=_y(s)),u}function oE(n,i,s,l,u){if(u){const d={view:n.createView(),depthReadOnly:!0};return cr(n.format)&&(d.stencilReadOnly=!0),d}const f={view:n.createView(),depthLoadOp:i?"load":"clear",depthStoreOp:n.sampleCount>1?"discard":"store"};return i||(f.depthClearValue=s??1),n.format&&cr(n.format)&&(f.stencilLoadOp=i?"load":"clear",f.stencilStoreOp=n.sampleCount>1?"discard":"store",i||(f.stencilClearValue=l??0)),f}function cr(n){return!!n&&n.includes("stencil")}function _y(n){return Array.isArray(n)?{r:n[0],g:n[1],b:n[2],a:n[3]}:n}function Uy(n,i){return n[0]===i[0]&&n[1]===i[1]}function ou(n){return typeof n=="object"&&n!==null&&typeof n.renderPassDescriptor=="function"}let cE=1,fE=1;const dE=new WeakMap,hE=new WeakMap;function pE(n){return ou(n)?{colors:n.colors.map(i=>i.format),depth:n.depth?.format,sampleCount:n.sampleCount}:typeof n!="object"||n===null?{colors:[]}:{colors:Array.isArray(n.colors)?[...n.colors]:n.colors??[],depth:n.depth,sampleCount:n.sampleCount??1}}function Ny(n){return`${n.colors.join(",")}:${n.depth??"none"}:${n.sampleCount??1}`}function mE(n,i){if(!Array.isArray(n.colors)||n.colors.length===0)throw Ul(i,"colors must be a non-empty array.");const s=n.colors.find(u=>typeof u!="string"||u.length===0);if(s!==void 0)throw Ul(i,`colors must contain only GPUTextureFormat strings; received ${String(s)}.`);if(n.depth!==void 0&&(typeof n.depth!="string"||n.depth.length===0))throw Ul(i,"depth must be a GPUTextureFormat string.");const l=n.sampleCount??1;if(l!==1&&l!==4)throw Ul(i,`sampleCount must be 1 or 4; received ${String(l)}.`)}function gE(n){const i=`${Lg(dE,n.module,()=>cE++)}|${Lg(hE,n.pipelineLayout,()=>fE++)}|${wE(n.vertexBufferLayouts??[])}|${Ny(n.signature)}`,s=n.topology||n.stripIndexFormat?`${i}|${n.topology??"triangle-list"}|${n.stripIndexFormat??"none"}`:i,l=n.cullMode||n.frontFace?`${s}|${n.cullMode??"none"}|${n.frontFace??"ccw"}`:s,u=n.unclippedDepth?`${l}|unclipped`:l,f=n.depthKey?`${u}|${n.depthKey}`:u,d=n.stencilKey?`${f}|${n.stencilKey}`:f,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 Ug(n,i,s,l,u){if(l===void 0)return i.find(d=>d.stage===s);if(typeof l!="string")throw Fl(n,`${s} received ${nf(l)}; expected an entry point name string.`,u);const f=i.find(d=>d.name===l);if(!f)throw Fl(n,`"${l}" matches no entry point in the shader; available entry points: ${Ng(i)}.`,u);if(f.stage!==s)throw Fl(n,`"${l}" is a @${f.stage} entry point, not @${s}; available entry points: ${Ng(i)}.`,u);return f}function Ng(n){return n.length?n.map(i=>`"${i.name}" (@${i.stage})`).join(", "):"none"}function yE(n,i,s,l){if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))throw _l(n,`received ${nf(i)}; expected { overrideNameOrId: number | boolean }.`,l);const u=new Map(s.map(d=>[kg(d),d])),f={};for(const[d,h]of Object.entries(i??{})){if(!u.has(d))throw _l(n,`"${d}" matches no override in the shader; available overrides: ${vE(s)}.`,l);if(typeof h=="boolean"){f[d]=h?1:0;continue}if(typeof h!="number"||!Number.isFinite(h))throw _l(n,`"${d}" received ${nf(h)}; use a finite number or a boolean (WebGPU converts the value to the override's WGSL type, and NaN/Infinity fail that conversion).`,l);f[d]=h}for(const d of s){const h=kg(d);if(d.defaultValue===void 0&&!(h in f))throw _l(n,`override '${d.name}' has no default value and must be provided; add constants: { "${h}": value }.`,l)}return Object.keys(f).length===0?{}:{constants:f,constantsKey:bE(f)}}function kg(n){return n.id!==void 0?String(n.id):n.name}function vE(n){return n.length?n.map(i=>i.id!==void 0?`"${i.id}" (@id of ${i.name})`:`"${i.name}"`).join(", "):"none"}function bE(n){return`cn~${Object.entries(n).sort(([i],[s])=>i<s?-1:i>s?1:0).map(([i,s])=>`${i}=${s}`).join("~")}`}function nf(n){if(typeof n=="string")return`"${n}"`;try{return JSON.stringify(n)??String(n)}catch{return String(n)}}function ky(n){const i=new Map;return{get(s,l){let u=i.get(s);return u||(u=n.gpu.createShaderModule({label:l,code:s}),i.set(s,u)),u},dispose(){i.clear()}}}function Ly(n){const i=new Map;return{get(s){const l=EE(s);let u=i.get(l);return u||(u=n.gpu.createPipelineLayout({bindGroupLayouts:TE(s)}),i.set(l,u)),u},dispose(){i.clear()}}}function jy(n,i={}){return new xE(n,i)}class xE{device;#e=new Map;#t=new Set;#n;#i;#a=!1;constructor(i,s){this.device=i,this.#n=s.errorSink??(()=>{}),this.#i=s.registerSettledSource?.(()=>[...this.#t])}getReady(i){return this.#e.get(i)?.pipeline}getSync(i,s,l){this.#u(l.where);const u=this.#e.get(i);if(u?.pipeline)return u.pipeline;const f=u??{};u||this.#e.set(i,f);const d=this.#s(i,f,s,l);if(!d){f.pending||this.#e.delete(i);return}return f.pipeline=d,f.pending?.resolve(d),f.pending=void 0,d}getAsync(i,s,l){this.#u(l.where);const u=this.#e.get(i);if(u?.pipeline)return Promise.resolve(u.pipeline);if(u?.pending)return u.pending.promise;const f={},d=SE();f.pending=d,this.#e.set(i,f);let h;try{h=s()}catch(m){const g=tr(l.where,m,l.signature);return d.reject(g),this.#e.delete(i),d.promise}return this.#o(h),h.then(m=>{this.#e.get(i)!==f||f.pipeline||f.pending!==d||(f.pipeline=m,f.pending=void 0,d.resolve(m))},m=>{this.#e.get(i)!==f||f.pipeline||f.pending!==d||(f.pending=void 0,this.#e.delete(i),d.reject(tr(l.where,m,l.signature)))}),d.promise}dispose(){if(this.#a)return;this.#a=!0;const i=gg("gpu.dispose");for(const s of this.#e.values())s.pending?.reject(i);this.#e.clear(),this.#t.clear(),this.#i?.()}#s(i,s,l,u){const f=this.device.gpu,d=typeof f.pushErrorScope=="function"&&typeof f.popErrorScope=="function";d&&f.pushErrorScope("validation");try{const h=l();return d&&this.#l(i,s,u),h}catch(h){d&&this.#c();const m=tr(u.where,h,u.signature);this.#n(m);return}}#l(i,s,l){const u=this.device.gpu.popErrorScope().then(f=>{if(!f)return;const d=tr(l.where,f,l.signature);return this.#e.get(i)===s&&this.#e.delete(i),this.#n(d)},f=>{const d=tr(l.where,f,l.signature);return this.#e.get(i)===s&&this.#e.delete(i),this.#n(d)});this.#o(u)}#c(){const i=this.device.gpu.popErrorScope?.();i&&i.catch(()=>{})}#u(i){if(this.#a)throw gg(i)}#o(i){this.#t.add(i),i.catch(()=>{}).then(()=>this.#t.delete(i),()=>this.#t.delete(i))}}function SE(){let n,i;const s=new Promise((l,u)=>{n=l,i=u});return s.catch(()=>{}),{promise:s,resolve:n,reject:i}}function Lg(n,i,s){let l=n.get(i);return l||(l=s(),n.set(i,l)),l}function wE(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 EE(n){return JSON.stringify([...n.entries()].map(([i,s])=>({group:i,entries:ME(s)})))}function TE(n){const i=Math.max(-1,...n.keys()),s=[];for(let l=0;l<=i;l++)s.push(AE(n,l));return s}function AE(n,i){const s=n.get(i);if(!s)throw pS(i);return s}function ME(n){return(sr(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 RE=lu("frame-state");function By(n){return n.service(RE,DE)}function DE(){const n=new Set;let i=jg(),s=!1,l=!1;const u={time:0,deltaTime:0,frameCount:0,advanceBy(f){u.deltaTime=f,u.time+=f,l=!0},tick(){if(s)throw J0();s=!0;try{const f=jg();l?l=!1:(u.deltaTime=Math.max(0,(f-i)/1e3),u.time+=u.deltaTime),i=f,u.frameCount+=1;for(const d of[...n])d()}finally{s=!1}},onAdvance(f){return n.add(f),()=>{n.delete(f)}}};return u}function jg(){return globalThis.performance?.now?.()??Date.now()}function CE(n,i,s={}){const l=Wn(n,"surface"),u=zE(l),f=u.get(i);if(f&&!f.disposed)throw yS(f.label);const d=new $y(l.device,i,s,g=>{u.get(g.canvas)===g&&u.delete(g.canvas),h(),m()}),h=By(l).onAdvance(()=>d.applyAutoResize()),m=l.own("resource",()=>d.dispose());return u.set(i,d),d}const OE=lu("surfaces");function zE(n){return n.service(OE,()=>new Map)}let ar=0,Rf=0;function _E(){return ar>0}function UE(){return Rf>0}function NE(){Rf+=1}function kE(){Rf-=1}function Gy(n){return n instanceof $y}class $y{device;canvas;options;unregister;resourceIdentity=su("render-target");label;context;autoResize;layoutBacked;format;#e=new ru;#t=new Set;#n=new Set;#i;#a;#s=!1;#l=!1;constructor(i,s,l,u){this.device=i,this.canvas=s,this.options=l,this.unregister=u,this.label=l.label,this.#a=l.clearColor===void 0?Af:tu(l.clearColor,"surface.clearColor");const f=s.getContext("webgpu");if(!f)throw gS();if(this.context=f,this.layoutBacked=LE(s),l.autoResize===!0&&!this.layoutBacked)throw bS();this.autoResize=l.autoResize??(l.size?!1:this.layoutBacked),this.#i=Gg(l.dpr),this.format=l.format??BE();const d=jE(s,l,this.layoutBacked,this.#i);(l.size||this.layoutBacked)&&Bg(s,d),f.configure({device:i.gpu,format:this.format,alphaMode:l.alphaMode??"premultiplied",colorSpace:l.colorSpace??"srgb",usage:GE()})}get gpu(){return this.context}get size(){return this.#r(),Xl(this.canvas)}get texelSize(){const i=this.size;return[1/i[0],1/i[1]]}get color(){return this.#r(),new as(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 Mf(this.#a)}set clearColor(i){this.#a=tu(i,"surface.clearColor")}get disposed(){return this.#s}resize(i){if(this.#r(),this.#l)throw xS(this.options.label);this.#c(nu(i),this.#i,!0)}applyAutoResize(){if(this.#s||!this.autoResize||!this.layoutBacked)return;const i=Gg(this.options.dpr),s=Iy(this.canvas,i);this.#c(s,i,!0)}onResize(i){this.#r(),this.#t.add(i),this.#l=!0,ar+=1;try{i(this.#f())}finally{ar-=1,this.#l=!1}return()=>{this.#t.delete(i)}}async read(){return this.#r(),this.color.read()}async readFloats(){return this.#r(),this.color.readFloats()}onDestroy(i){return this.#r(),this.#e.onDestroy(this,i)}onTexturesRecreated(i){return this.#r(),this.#n.add(i),()=>{this.#n.delete(i)}}renderPassDescriptor(i={}){const{clear:s=[0,0,0,1],preserve:l}=i;this.#r();const u={view:this.context.getCurrentTexture().createView(),loadOp:l?"load":"clear",storeOp:"store"};return l||(u.clearValue=_y(s)),{colorAttachments:[u]}}dispose(){if(!this.#s){this.#s=!0;try{this.context.unconfigure?.()}catch{}this.unregister(this),this.#t.clear(),this.#n.clear(),this.#e.emit(this)}}#c(i,s,l){const u=!Uy(Xl(this.canvas),i);this.#i=s,u&&(Bg(this.canvas,i),this.#u(),l&&this.#o())}#u(){for(const i of[...this.#n])i()}#o(){this.#l=!0,ar+=1;try{const i=this.#f();for(const s of[...this.#t])s(i)}finally{ar-=1,this.#l=!1}}#f(){const i=Xl(this.canvas);return{width:i[0],height:i[1],dpr:this.#i,surface:this}}#r(){if(this.#s)throw vS(this.options.label)}}function LE(n){return typeof n.clientWidth=="number"}function jE(n,i,s,l){return i.size?nu(i.size):s?Iy(n,l):nu(Xl(n))}function Iy(n,i){const s=n;return nu([Math.round(s.clientWidth*i),Math.round(s.clientHeight*i)])}function Xl(n){const i=n;return[i.width,i.height]}function Bg(n,i){const s=n;s.width=i[0],s.height=i[1]}function nu(n){return[Math.max(1,Math.floor(n[0])),Math.max(1,Math.floor(n[1]))]}function Gg(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 BE(){return globalThis.navigator?.gpu?.getPreferredCanvasFormat?.()??"bgra8unorm"}function GE(){const n=globalThis.GPUTextureUsage;return n?n.RENDER_ATTACHMENT|n.TEXTURE_BINDING|n.COPY_SRC:void 0}const $E={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 IE(n,i,s,l){const u=typeof s=="object"&&s!==null?s.buffer:void 0,f=$g(s)?s:$g(u)?u:void 0;if(!f)throw Ka(n,`received ${Ig(s)}; expected a StorageBuffer or { buffer, offset? }.`,i);const d=f===s?0:s.offset??0;if(typeof d!="number"||!Number.isInteger(d)||d<0)throw Ka(n,`offset must be an integer >= 0; received ${Ig(d)}.`,i);if(d%4!==0)throw Ka(n,`offset must be a multiple of 4 (WebGPU requires "indirectOffset is a multiple of 4"); received ${d}.`,i);if(!f.buffer.options.usage.includes("indirect"))throw Ka(n,`the buffer lacks the "indirect" usage (WebGPU requires "indirectBuffer.usage contains INDIRECT"); create it with storage(gpu, ${f.size}, { indirect: true }).`,i);const{bytes:h,args:m}=$E[l];if(d+h>f.size)throw Ka(n,`${l} reads ${h} bytes (${m}) at offset ${d}, but offset + ${h} = ${d+h} exceeds the buffer size ${f.size}.`,i);return{buffer:f.gpu,offset:d}}function $g(n){return typeof n=="object"&&n!==null&&"gpu"in n&&"size"in n&&n.buffer instanceof Ri}function Ig(n){if(typeof n=="string")return`"${n}"`;try{return JSON.stringify(n)??String(n)}catch{return String(n)}}const iu=Symbol("vgpu.frame.drawable");function VE(n){return n?.[iu]}const FE=Symbol("vgpu.frame.bundle");function HE(n){return n?.[FE]}const Df=Symbol("vgpu.frame.passAttachment");function qE(n){return typeof n?.[Df]=="function"?n:void 0}function YE(n,i){return Cf(Wn(n,"sampler")).sampler(i)}let Vg=1;function XE(n){const i=new Map,s=new WeakMap;return{sampler(l={}){const u=af(l);let f=i.get(u);return f||(f=n.gpu.createSampler(l),i.set(u,f),s.set(f,{kind:"sampler",id:Vg++})),f},identity(l){let u=s.get(l);return u||(u={kind:"sampler",id:Vg++},s.set(l,u)),u}}}function af(n){if(n===null||typeof n!="object")return JSON.stringify(n);if(Array.isArray(n))return`[${n.map(af).join(",")}]`;const i=n;return`{${Object.keys(i).sort().map(s=>`${JSON.stringify(s)}:${af(i[s])}`).join(",")}}`}const KE=lu("render-service");function Cf(n){return n.service(KE,QE)}function QE(n){const i=n.device,s=vy(),l=jy(i,{errorSink:h=>n.reportError(h),registerSettledSource:h=>n.registerSettledSource(h)}),u=ky(i),f=Ly(i),d=XE(i);return n.own("service",()=>{l.dispose(),u.dispose(),f.dispose(),s.dispose()}),{binds:s,pipelines:l,shaderModules:u,pipelineLayouts:f,sampler:h=>d.sampler(h)}}function Vy(n){if(typeof n=="string")return n;if(!PE(n)||!("version"in n)||n.version!==1)throw Nl(n);const s=n.wgsl;if(typeof s!="string")throw Nl(n);return s}function PE(n){return typeof n=="object"&&n!==null}function Ll(n,i){const s=Wn(n,"draw"),l=Cf(s),u=Vy(i.shader);return new Hy(s.device,u,{...i,shader:u},l.binds,void 0,l.pipelines,l.shaderModules,l.pipelineLayouts,f=>s.reportError(f),f=>{s.trackDelivery(f)})}let ZE=1;const Fy=new WeakMap;class Hy{source;label;#e=new Map;constructor(i,s,l,u=vy(),f,d=jy(i),h=ky(i),m=Ly(i),g,b){this.source=s,pt(i,"Draw.constructor"),this.label=l.label??"draw";const x=ZE++,R=yy(s,`${this.label}.wgsl`),$=rT(this.label,l.entry),L=Ug(this.label,R.entryPoints,"vertex",$.vertex,"draw"),O=Ug(this.label,R.entryPoints,"fragment",$.fragment,"draw"),j=lT(R,L,O),X=[L,O].filter(ae=>!!ae),Q=Y2(R.bindings,X);WE(i,this.label,R.bindings,X,Q);const H=l.geometry,U=L?Wl(L,"inputs",this.label):[],J=H&&Zc in H?H[Zc](U,`${this.label}.geometry`):H?.vertexBufferLayouts,W=new Map(X2(i,this.label,R,Q)),A=m.get(W),w=h.get(s,`${this.label}.shader`),G=TT(),te=tT(this.label,l),ne=iT(this.label,l,te),le=uT(i,this.label,l),Ge=dT(i,this.label,l),de=gT(this.label,l),oe=vT(this.label,l),z=yE(this.label,l.constants,R.overrides,"draw"),Y=Z2({device:i,label:this.label,drawId:x,reflection:R,bindGroupLayouts:W,cache:u,onIdentityChange:ae=>G.markStale({kind:"binding-identity",drawLabel:this.label,...ae})});Fy.set(this,{id:x,device:i,opts:l,vertexBufferLayouts:J,cache:u,defaultTarget:f,reflection:R,visibility:Q,vertexEntry:L?.name??"vs_main",fragmentEntry:O?.name??"fs_main",entryKey:j,setCore:Y,bindGroupLayouts:W,pipelineLayout:A,shaderModule:w,pipelineStore:d,pipelineLayouts:m,errorSink:g,trackSettled:b,resolvedPipelineKeys:new Set,recordedIn:G,...te,...ne,...le,...Ge,...de,...oe,...z}),l.set&&this.set(l.set);for(const ae of l.targets??[])this.compileSync(ae)}get gpu(){const i=we(this);for(const s of i.resolvedPipelineKeys){const l=i.pipelineStore.getReady(s);if(l)return l}}get targets(){return we(this).opts.targets}get[iu](){return this}writesDepth(){return ST(this)}stencilWritingOps(){return wT(this)}set(i){const s=we(this);pt(s.device,`${this.label}.set`);for(const l of s.setCore.set(i))s.recordedIn.markStale({kind:"binding-identity",drawLabel:this.label,...l});return this}group(i,s){const l=we(this);pt(l.device,`${this.label}.group`);const u=this.#e.get(i)??this.layout(i),f=l.setCore.claimGroup(i,s,u);return l.recordedIn.markStale({kind:"group-claim",drawLabel:this.label,group:i,previousIdentity:f,newIdentity:`claimed-group:${i}`}),this}layout(i,s={}){return pt(we(this).device,`${this.label}.layout`),s.dynamicOffsets?this.#t(i):we(this).setCore.layout(i)}#t(i){const s=we(this);s.setCore.layout(i);const l=this.#e.get(i);if(l)return l;const u=MT(this,i),f=Cy(s.device,`${this.label}.group${i}.dynamic.bgl`,u);return this.#e.set(i,f),s.bindGroupLayouts.set(i,f),s.pipelineLayout=s.pipelineLayouts.get(s.bindGroupLayouts),f}draw(i={}){pt(we(this).device,`${this.label}.draw`);const s=ou(i)?{target:i}:i,l=we(this),u=s.target??l.defaultTarget;if(!u)throw Pc(`${this.label}.draw`);n0(u,`${this.label}.draw`);const f=l.device.gpu.createCommandEncoder(),d=f.beginRenderPass(u.renderPassDescriptor()),h=[];try{this.encode(d,u,s,x=>h.push(x))}catch(x){qt(h),xy(l.device);try{d.end()}catch{}throw x}wy(l.device,d,h,h[0]?.context);let m;const g=h[0]?.context;g&&rr(l.device,g);try{m=f.finish()}catch(x){const R=g?cn(l.device):void 0;qt(h),R&&qt([R]);const $=R?.context??g;if($){t0(l,$.label,$.group,x);return}throw x}if(g){const x=cn(l.device);x&&(h[0]=h[0]?eu(x,h[0]):x)}const b=h[0]?.context;b&&rr(l.device,b);try{l.device.gpu.queue.submit([m])}catch(x){const R=b?cn(l.device):void 0;qt(h),R&&qt([R]);const $=R?.context??b;if($){t0(l,$.label,$.group,x);return}throw x}if(b){const x=cn(l.device);x&&(h[0]=h[0]?eu(x,h[0]):x)}if(h.length){const x=Sy(l.device,h,{errorSink:l.errorSink});l.trackSettled?.(x)}}encode(i,s,l={},u){pt(we(this).device,`${this.label}.encode`);const f=this.pipelineFor(s,!0);if(!f)return;i.setPipeline(f);const d=we(this);d.blendConstant&&i.setBlendConstant(d.blendConstant),d.stencilRef!==void 0&&i.setStencilReference(d.stencilRef);for(const h of d.setCore.bindGroups())this.#n(i,h,l,u);this.#l(i,l)}#n(i,s,l,u){const f=AT(l.offsets,s.group,s.offsets);if(!s.claimValidation||!u){i.setBindGroup(s.group,s.bindGroup,f);return}rr(we(this).device,s.claimValidation);try{i.setBindGroup(s.group,s.bindGroup,f)}catch(h){throw A2(we(this).device),is(s.claimValidation.label,s.claimValidation.group,h)}const d=cn(we(this).device);d&&u(d)}compile(i){pt(we(this).device,`${this.label}.compile`);const{key:s,signature:l,signatureKey:u}=this.#i(i,`${this.label}.compile`);return we(this).pipelineStore.getAsync(s,()=>this.#o(l),{where:`${this.label}.compile`,signature:u}).then(()=>(pt(we(this).device,`${this.label}.compile`),we(this).resolvedPipelineKeys.add(s),this))}compileSync(i){pt(we(this).device,`${this.label}.compileSync`);const{key:s,signature:l,signatureKey:u}=this.#i(i,`${this.label}.compileSync`);return we(this).pipelineStore.getSync(s,()=>this.#u(l),{where:`${this.label}.compileSync`,signature:u})&&we(this).resolvedPipelineKeys.add(s),this}pipelineFor(i,s=!1){pt(we(this).device,`${this.label}.pipelineFor`);const{key:l,signature:u,signatureKey:f}=this.#i(i,`${this.label}.pipelineFor`,s),d=we(this).pipelineStore.getSync(l,()=>this.#u(u),{where:`${this.label}.pipelineFor`,signature:f});return d&&we(this).resolvedPipelineKeys.add(l),d}pipelineForAsync(i){pt(we(this).device,`${this.label}.pipelineForAsync`);const{key:s,signature:l,signatureKey:u}=this.#i(i,`${this.label}.pipelineForAsync`);return we(this).pipelineStore.getAsync(s,()=>this.#o(l),{where:`${this.label}.pipelineForAsync`,signature:u}).then(d=>(pt(we(this).device,`${this.label}.pipelineForAsync`),we(this).resolvedPipelineKeys.add(s),d))}#i(i,s,l=!1){const u=this.#a(i,s,l),f=Ny(u);return{signature:u,signatureKey:f,key:this.#s(u)}}#a(i,s,l=!1){const u=we(this),f=i??u.defaultTarget;if(!f)throw Pc(s);l||n0(f,s);const d=pE(f);if(mE(d,s),u.colorStates&&u.colorStates.length!==d.colors.length)throw Qc(this.label,`expected one entry per color attachment; colors has ${u.colorStates.length}, but the target signature has ${d.colors.length}.`,s);if(u.multisampleState?.alphaToCoverageEnabled&&(d.sampleCount??1)<=1)throw Vl(this.label,`alphaToCoverage requires a multisampled target, but the target signature has sampleCount ${d.sampleCount??1}; create the target with msaa: true.`,s);if((u.stencilState||u.stencilRef!==void 0)&&!cr(d.depth))throw ts(this.label,`stencil requires a depth format with a stencil aspect, but the target signature has ${d.depth?`"${d.depth}"`:"no depth"}; create the target with depth: "depth24plus-stencil8".`,s);return d}#s(i){const s=we(this),l=s.opts.geometry;return gE({module:s.shaderModule,pipelineLayout:s.pipelineLayout,vertexBufferLayouts:s.vertexBufferLayouts,signature:i,fragmentKey:s.fragmentKey,topology:l?.topology,stripIndexFormat:qy(l),cullMode:s.cullMode,frontFace:s.frontFace,unclippedDepth:s.unclippedDepth,depthKey:s.depthKey,stencilKey:s.stencilKey,multisampleKey:s.multisampleKey,constantsKey:s.constantsKey,entryKey:s.entryKey})}#l(i,s={}){const l=we(this).opts.geometry;if(l?.vertexBuffers&&l.vertexBuffers.forEach((f,d)=>i.setVertexBuffer(d,f)),s.indirect!==void 0)return this.#c(i,l,s);const u=eT(this.label,l,we(this).opts,s);if(!l?.indexBuffer)return i.draw(u.vertexCount,u.instanceCount,u.firstVertex,u.firstInstance);i.setIndexBuffer(l.indexBuffer,l.indexFormat??"uint32"),i.drawIndexed(u.indexCount,u.instanceCount,u.firstIndex,u.baseVertex,u.firstInstance)}#c(i,s,l){const u=`${this.label}.draw`,f=JE.find(g=>l[g]!==void 0);if(f!==void 0)throw Ka(this.label,`indirect cannot be combined with ${f} in the same call; the GPU reads the draw arguments from the buffer, so the CPU-side value would be ignored.`,u);const d=!!s?.indexBuffer,{buffer:h,offset:m}=IE(this.label,u,l.indirect,d?"drawIndexedIndirect":"drawIndirect");if(!d)return i.drawIndirect(h,m);i.setIndexBuffer(s.indexBuffer,s.indexFormat??"uint32"),i.drawIndexedIndirect(h,m)}#u(i){const s=we(this);return s.device.gpu.createRenderPipeline({label:`${this.label}.pipeline`,layout:s.pipelineLayout,vertex:{module:s.shaderModule,entryPoint:s.vertexEntry,buffers:[...s.vertexBufferLayouts??[]],...s.constants?{constants:s.constants}:{}},fragment:{module:s.shaderModule,entryPoint:s.fragmentEntry,targets:Fg(i,s),...s.constants?{constants:s.constants}:{}},primitive:Hg(s.opts.geometry,s.cullMode,s.frontFace,s.unclippedDepth),depthStencil:Pg(i,s),multisample:Jg(i,s)})}#o(i){const s=we(this);return s.device.gpu.createRenderPipelineAsync({label:`${this.label}.pipeline`,layout:s.pipelineLayout,vertex:{module:s.shaderModule,entryPoint:s.vertexEntry,buffers:[...s.vertexBufferLayouts??[]],...s.constants?{constants:s.constants}:{}},fragment:{module:s.shaderModule,entryPoint:s.fragmentEntry,targets:Fg(i,s),...s.constants?{constants:s.constants}:{}},primitive:Hg(s.opts.geometry,s.cullMode,s.frontFace,s.unclippedDepth),depthStencil:Pg(i,s),multisample:Jg(i,s)})}}function WE(n,i,s,l,u){const f=n.limits;for(const[d,h,m]of[["vertex",1,"maxStorageBuffersInVertexStage"],["fragment",2,"maxStorageBuffersInFragmentStage"]]){const g=l.find(R=>R.stage===d);if(!g)continue;const b=s.filter(R=>R.bindingLayout?.kind==="buffer"&&R.bindingLayout.buffer.type!=="uniform"&&u(R)&h),x=f[m]??f.maxStorageBuffersPerShaderStage;if(x!==void 0&&b.length>x)throw W1(i,d,g.name,b.length,x,b)}}const JE=["vertices","indices","instances","firstVertex","firstIndex","baseVertex","firstInstance"];function Fg(n,i){return n.colors.map((s,l)=>{const u=i.colorStates?.[l],f=u?.blendState??i.blendState,d=u?.writeMask??i.writeMask,h={format:s};return f&&(h.blend=f),d!==void 0&&(h.writeMask=d),h})}function eT(n,i,s,l){Ti(n,"DrawOptions.instances",s.instances),Ti(n,"DrawOptions.vertices",s.vertices),Ti(n,"DrawOptions.firstInstance",s.firstInstance),Ti(n,"DrawCallOptions.instances",l.instances),Ei(n,"DrawCallOptions.vertices",l.vertices),Ei(n,"DrawCallOptions.indices",l.indices),Ei(n,"DrawCallOptions.firstVertex",l.firstVertex),Ei(n,"DrawCallOptions.firstIndex",l.firstIndex),Ei(n,"DrawCallOptions.baseVertex",l.baseVertex),Ti(n,"DrawCallOptions.firstInstance",l.firstInstance),Ti(n,"GeometryLike.vertexCount",i?.vertexCount),Ti(n,"GeometryLike.indexCount",i?.indexCount),Ti(n,"GeometryLike.instanceCount",i?.instanceCount),Ei(n,"GeometryLike.firstVertex",i?.firstVertex),Ei(n,"GeometryLike.firstIndex",i?.firstIndex),Ei(n,"GeometryLike.baseVertex",i?.baseVertex);const u=!!i?.indexBuffer,d=i?.geometry??(i&&Zc in i?i:void 0),h=l.firstVertex??i?.firstVertex??0,m=l.vertices??i?.vertexCount??s.vertices??3,g=l.firstIndex??i?.firstIndex??0,b=l.indices??i?.indexCount??0,x=l.baseVertex??i?.baseVertex??0;if(u)qg(n,"index",g,b,d?.indexCount);else if(l.indices!==void 0||l.firstIndex!==void 0||l.baseVertex!==void 0)throw hf(`${n}.draw`,"Index range needs an indexed geometry.");return u||qg(n,"vertex",h,m,d?.vertexCount),{instanceCount:l.instances??s.instances??i?.instanceCount??1,firstInstance:l.firstInstance??s.firstInstance??0,vertexCount:m,firstVertex:h,indexCount:b,firstIndex:g,baseVertex:x}}function qy(n){const i=n?.topology??"triangle-list";return n?.stripIndexFormat??(i.endsWith("strip")?n?.indexFormat:void 0)}function Hg(n,i,s,l){const u=n?.topology??"triangle-list",f=qy(n),d=f?{topology:u,stripIndexFormat:f}:{topology:u};return i!==void 0&&(d.cullMode=i),s!==void 0&&(d.frontFace=s),l&&(d.unclippedDepth=!0),d}function qg(n,i,s,l,u){if(!(u===void 0||s+l<=u))throw hf(`${n}.draw`,`${i} range [${s}, ${s+l}) exceeds parent geometry ${i} count ${u}.`)}function Ei(n,i,s){if(!(s===void 0||Number.isInteger(s)&&s>=0))throw hf(`${n}.draw`,`${i} must be an integer >= 0; received ${String(s)}.`)}function Ti(n,i,s){if(s!==void 0&&!(Number.isInteger(s)&&s>=0))throw new se({code:"VGPU-R1-DRAW-COUNT",message:`${i} of '${n}' must be an integer >= 0; received ${String(s)}. Use 0 only when you want to issue a valid draw with no vertices/instances.`,where:`${n}.draw`})}function tT(n,i){const s=i.blend===void 0?void 0:Yy(n,i.blend),l=i.writeMask===void 0?void 0:Qy(n,i.writeMask),u=i.colors===void 0?void 0:nT(n,i.colors),f=u?`${e0(s,l)}@${u.map(xT).join("@")}`:s||l!==void 0?e0(s,l):void 0;return{blendState:s,writeMask:l,colorStates:u,fragmentKey:f}}function nT(n,i){if(!Array.isArray(i))throw Qc(n,`colors must be an array; received ${Ze(i)}.`);return i.map((s,l)=>{if(s==null)return null;if(typeof s!="object"||Array.isArray(s))throw Qc(n,`colors[${l}] must be null or { blend?, writeMask? }; received ${Ze(s)}.`);const u=s.blend===void 0?void 0:Yy(`${n}.colors[${l}]`,s.blend),f=s.writeMask===void 0?void 0:Qy(`${n}.colors[${l}]`,s.writeMask);return!u&&f===void 0?null:{blendState:u,writeMask:f}})}function Yy(n,i){if(i==="alpha")return jl({src:"src-alpha",dst:"one-minus-src-alpha"},{src:"one",dst:"one-minus-src-alpha"});if(i==="premultiplied")return jl({src:"one",dst:"one-minus-src-alpha"},{src:"one",dst:"one-minus-src-alpha"});if(i==="additive")return jl({src:"one",dst:"one"},{src:"one",dst:"one"});if(typeof i!="object"||i===null||!Yg(i.color))throw cg(n,i);const s=i.color,l=i.alpha;if(l!==void 0&&!Yg(l))throw cg(n,i);return jl(s,l??s)}function Yg(n){return typeof n=="object"&&n!==null&&typeof n.src=="string"&&typeof n.dst=="string"}function jl(n,i){return{color:Xg(n),alpha:Xg(i)}}function Xg(n){return{srcFactor:n.src,dstFactor:n.dst,operation:n.op??"add"}}function iT(n,i,s){if(i.blendConstant===void 0)return{};const l=i.blendConstant;if(!Array.isArray(l)||l.length!==4||l.some(u=>typeof u!="number"||!Number.isFinite(u)))throw fg(n,`received ${Ze(l)}; expected [r, g, b, a] finite numbers.`);if(!aT(s).some(u=>u&&sT(u)))throw fg(n,`no color target's effective blend uses a "constant"/"one-minus-constant" factor (colors[i].blend replaces the top-level blend for that target), so blendConstant would have no effect.`);return{blendConstant:{r:l[0],g:l[1],b:l[2],a:l[3]}}}function aT(n){return n.colorStates?n.colorStates.map(i=>i?.blendState??n.blendState):[n.blendState]}function sT(n){return[n.color.srcFactor,n.color.dstFactor,n.alpha.srcFactor,n.alpha.dstFactor].some(i=>i==="constant"||i==="one-minus-constant")}function rT(n,i){if(i===void 0)return{};if(typeof i!="object"||i===null||Array.isArray(i))throw Fl(n,`received ${Ze(i)}; expected { vertex?, fragment? } entry point names.`);return i}function lT(n,i,s){const l=n.entryPoints.find(f=>f.stage==="vertex"),u=n.entryPoints.find(f=>f.stage==="fragment");if(!(i===l&&s===u))return`en~${i?.name??""}~${s?.name??""}`}function uT(n,i,s){const l=s.cull===void 0?void 0:cT(i,s.cull),u=s.frontFace===void 0?void 0:fT(i,s.frontFace),f=s.unclippedDepth===void 0?void 0:oT(n,i,s.unclippedDepth);return{cullMode:l,frontFace:u,unclippedDepth:f}}function oT(n,i,s){if(typeof s!="boolean")throw hg(i,`received ${Ze(s)}; expected a boolean.`);if(s){if(!n.features.has("depth-clip-control"))throw hg(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 cT(n,i){if(i==="none"||i==="front"||i==="back")return i;throw iS(n,i)}function fT(n,i){if(i==="ccw"||i==="cw")return i;throw aS(n,i)}const Xy={depthWriteEnabled:!0,depthCompare:"less-equal"},Ky=["never","less","equal","less-equal","greater","not-equal","greater-equal","always"],Kg=-2147483648,Qg=2147483647;function Pg(n,i){if(n.depth)return{format:n.depth,...i.depthState??Xy,...i.stencilState??{}}}function dT(n,i,s){if(s.depth===void 0)return{};const l=hT(n,i,s.depth,s.geometry?.topology??"triangle-list");return{depthState:l,depthKey:pT(l)}}function hT(n,i,s,l){if(s===!1)return{depthWriteEnabled:!1,depthCompare:"always"};if(typeof s!="object"||s===null)throw Xn(i,`received ${Ze(s)}.`);if(s.write!==void 0&&typeof s.write!="boolean")throw Xn(i,`write must be a boolean; received ${Ze(s.write)}.`);if(s.compare!==void 0&&!Ky.includes(s.compare))throw Xn(i,`compare must be a GPUCompareFunction; received ${Ze(s.compare)}.`);if(s.bias!==void 0&&!Number.isInteger(s.bias))throw Xn(i,`bias must be an integer (WebGPU depthBias is i32); received ${Ze(s.bias)}.`);if(s.bias!==void 0&&(s.bias<Kg||s.bias>Qg))throw Xn(i,`bias must fit in the i32 range [${Kg}, ${Qg}] (WebGPU depthBias is i32); received ${Ze(s.bias)}.`);if(s.biasSlopeScale!==void 0&&!Number.isFinite(s.biasSlopeScale))throw Xn(i,`biasSlopeScale must be a finite number; received ${Ze(s.biasSlopeScale)}.`);if(s.biasClamp!==void 0&&!Number.isFinite(s.biasClamp))throw Xn(i,`biasClamp must be a finite number; received ${Ze(s.biasClamp)}.`);const u=s.bias??0,f=s.biasSlopeScale??0,d=s.biasClamp??0;if((u!==0||f!==0||d!==0)&&!l.startsWith("triangle"))throw Xn(i,`bias, biasSlopeScale, and biasClamp must be 0 for "${l}" topology.`);if(d!==0&&n.isCompatibilityMode)throw Xn(i,`biasClamp must be 0 on a compatibility-mode device; received ${Ze(s.biasClamp)}.`);return{depthWriteEnabled:s.write??!0,depthCompare:s.compare??"less-equal",...u!==0?{depthBias:u}:{},...f!==0?{depthBiasSlopeScale:f}:{},...d!==0?{depthBiasClamp:d}:{}}}function pT(n){return`${n.depthWriteEnabled?1:0}~${n.depthCompare}~${n.depthBias??0}~${n.depthBiasSlopeScale??0}~${n.depthBiasClamp??0}`}const mT=["keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"];function gT(n,i){if(i.stencil===void 0)return{};const s=i.stencil;if(typeof s!="object"||s===null||Array.isArray(s))throw ts(n,`received ${Ze(s)}; expected { front?, back?, readMask?, writeMask?, ref? }.`);const l=s.front===void 0?void 0:Zg(n,"front",s.front),u=s.back===void 0?void 0:Zg(n,"back",s.back);Lc(n,"readMask",s.readMask),Lc(n,"writeMask",s.writeMask),Lc(n,"ref",s.ref);const f={...l?{stencilFront:l}:{},...u??l?{stencilBack:u??{...l}}:{},...s.readMask!==void 0?{stencilReadMask:s.readMask}:{},...s.writeMask!==void 0?{stencilWriteMask:s.writeMask}:{}},d=f.stencilFront!==void 0||f.stencilBack!==void 0||f.stencilReadMask!==void 0||f.stencilWriteMask!==void 0;return!d&&s.ref===void 0?{}:{...d?{stencilState:f,stencilKey:yT(f)}:{},...s.ref!==void 0?{stencilRef:s.ref}:{}}}function Zg(n,i,s){if(typeof s!="object"||s===null||Array.isArray(s))throw ts(n,`${i} must be a { compare?, fail?, depthFail?, pass? } object; received ${Ze(s)}.`);if(s.compare!==void 0&&!Ky.includes(s.compare))throw ts(n,`${i}.compare must be a GPUCompareFunction; received ${Ze(s.compare)}.`);for(const[l,u]of[["fail",s.fail],["depthFail",s.depthFail],["pass",s.pass]])if(u!==void 0&&!mT.includes(u))throw ts(n,`${i}.${l} must be a GPUStencilOperation; received ${Ze(u)}.`);return{compare:s.compare??"always",failOp:s.fail??"keep",depthFailOp:s.depthFail??"keep",passOp:s.pass??"keep"}}function Lc(n,i,s){if(s!==void 0&&(typeof s!="number"||!Number.isInteger(s)||s<0||s>4294967295))throw ts(n,`${i} must be an integer in [0, 0xFFFFFFFF] (WebGPU GPUStencilValue is u32); received ${Ze(s)}.`)}function yT(n){return`st~${Wg(n.stencilFront)}~${Wg(n.stencilBack)}~${n.stencilReadMask??4294967295}~${n.stencilWriteMask??4294967295}`}function Wg(n){return n?`${n.compare},${n.failOp},${n.depthFailOp},${n.passOp}`:"default"}function Jg(n,i){return{count:n.sampleCount??1,...i.multisampleState??{}}}function vT(n,i){if(i.multisample===void 0)return{};const s=i.multisample;if(typeof s!="object"||s===null||Array.isArray(s))throw Vl(n,`received ${Ze(s)}; expected { alphaToCoverage?, mask? }.`);if(s.alphaToCoverage!==void 0&&typeof s.alphaToCoverage!="boolean")throw Vl(n,`alphaToCoverage must be a boolean; received ${Ze(s.alphaToCoverage)}.`);if(s.mask!==void 0&&(typeof s.mask!="number"||!Number.isInteger(s.mask)||s.mask<0||s.mask>4294967295))throw Vl(n,`mask must be an integer in [0, 0xFFFFFFFF] (WebGPU GPUSampleMask is u32); received ${Ze(s.mask)}.`);const l={...s.alphaToCoverage!==void 0?{alphaToCoverageEnabled:s.alphaToCoverage}:{},...s.mask!==void 0?{mask:s.mask}:{}};return l.alphaToCoverageEnabled===void 0&&l.mask===void 0?{}:{multisampleState:l,multisampleKey:bT(l)}}function bT(n){return`ms~${n.alphaToCoverageEnabled?1:0}~${n.mask??4294967295}`}function Qy(n,i){if(!Array.isArray(i))throw dg(n,Ze(i));let s=0;for(const l of i)if(l==="r")s|=1;else if(l==="g")s|=2;else if(l==="b")s|=4;else if(l==="a")s|=8;else throw dg(n,Ze(l));return s}function e0(n,i){return`${Py(n)};${i??15}`}function Py(n){if(!n)return"none;none";const i=n.color,s=n.alpha;return`${i.srcFactor},${i.dstFactor},${i.operation};${s.srcFactor},${s.dstFactor},${s.operation}`}function xT(n){return n?`${n.blendState?Py(n.blendState):"inherit"};${n.writeMask??"inherit"}`:"inherit"}function Ze(n){if(typeof n=="string")return`"${n}"`;try{return JSON.stringify(n)??String(n)}catch{return String(n)}}function ST(n){return(we(n).depthState??Xy).depthWriteEnabled}function wT(n){const i=we(n),s=i.stencilState;if(!s||s.stencilWriteMask===0)return[];const l=i.cullMode??"none",u=[],f=(d,h)=>{if(h)for(const[m,g]of[["fail",h.failOp],["depthFail",h.depthFailOp],["pass",h.passOp]])g!==void 0&&g!=="keep"&&u.push(`${d}.${m}: "${g}"`)};return l!=="front"&&f("front",s.stencilFront),l!=="back"&&f("back",s.stencilBack),u}function ET(n,i,s,l={},u){n.encode(i,s,l,u)}function we(n){const i=Fy.get(n);if(!i)throw new TypeError("Invalid Draw instance");return i}function t0(n,i,s,l){const u=(async()=>{await vf(n.device),pt(n.device,`${i}.validation`);const f=is(i,s,l);n.errorSink?await n.errorSink(f):console.error(f)})();return n.trackSettled?.(u),u}function TT(){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 AT(n,i,s){return n?Array.isArray(n)?n:n[i]??s:s}function MT(n,i){const s=we(n);return Dy(s.reflection.bindings,i,s.visibility).map(RT)}function RT(n){return n.buffer?{...n,buffer:{...n.buffer,hasDynamicOffset:!0}}:n}function n0(n,i){if(Gy(n)&&!UE())throw W0(i)}function i0(n,i,s={}){if("geometry"in s)throw Yt("effect","effect() never accepts vertex buffers; use draw(gpu, { shader, geometry: geometry(gpu, descriptor) }).");const l=Wn(n,"effect"),u=Cf(l);return new DT(l.device,Vy(i),s,u.binds,void 0,u.pipelines,u.shaderModules,u.pipelineLayouts,f=>l.reportError(f),f=>{l.trackDelivery(f)})}const Zy=new WeakMap;class DT{get gpu(){return Wi(this).gpu}constructor(i,s,l={},u,f,d,h,m,g,b){const x=CT(s),R=new Hy(i,x,{shader:x,set:l.set,label:l.label??"effect",blend:l.blend,writeMask:l.writeMask},u,f,d,h,m,g,b);Zy.set(this,R)}set(i){return Wi(this).set(i),this}draw(i={}){Wi(this).draw(ou(i)?{target:i}:i)}compile(i){return Wi(this).compile(i).then(()=>this)}compileSync(i){return Wi(this).compileSync(i),this}encode(i,s,l={},u){ET(Wi(this),i,s,l,u)}get[iu](){return Wi(this)[iu]}}function Wi(n){const i=Zy.get(n);if(!i)throw new TypeError("Invalid Effect instance");return i}function CT(n){return OT(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 OT(n){return yy(n,"effect.wgsl").entryPoints.some(i=>i.stage==="vertex")}function zT(n,i){return UT(Wn(n,"frame")).frame(i)}const _T=lu("frame-runner");function UT(n){return n.service(_T,i=>{const s=By(i);return new HT(()=>{let l=()=>{};const u=new NT(i.device,void 0,f=>i.reportError(f),f=>{i.trackDelivery(f)},()=>l());return l=i.own("scheduler",()=>u.cancel()),u},()=>s.tick(),l=>i.own("scheduler",()=>l.stop()))})}class NT{device;defaultTarget;errorSink;trackSettled;releaseLifecycle;done=Promise.resolve();#e;#t=[];#n=new Set;#i=new Set;#a=!1;#s=!1;#l=!1;constructor(i,s,l,u,f){this.device=i,this.defaultTarget=s,this.errorSink=l,this.trackSettled=u,this.releaseLifecycle=f,pt(i,"Frame.constructor"),this.#e=i.gpu.createCommandEncoder({label:"vgpu.frame"})}pass(i,s){if(this.#s)throw yg("Frame.pass");pt(this.device,"Frame.pass");const l=ou(i),u=typeof s=="function"?s:O=>O.draw(s),f=l?i:i.target??this.defaultTarget;if(!f)throw Pc("Frame.pass");if(Gy(f)&&this.#a)throw W0("Frame.pass");const d=l?void 0:i.clear,h=d===!1;if(h&&f.sampleCount===4)throw sS();const m=l?void 0:i.clearDepth;if(m!==void 0){if(typeof m!="number"||!(m>=0&&m<=1))throw pg(m);if(h)throw rS();if(!f.depth)throw pg(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=l?void 0:i.clearStencil;if(g!==void 0){if(typeof g!="number"||!Number.isInteger(g)||g<0||g>4294967295)throw mg(`received ${String(g)}; expected an integer in [0, 0xFFFFFFFF] (WebGPU GPUStencilValue).`);if(h)throw lS();const O=f.depth?.format;if(!cr(O))throw mg(`received ${String(g)}, but the target's depth format ${O?`"${O}"`:"(none)"} has no stencil aspect, so clearStencil would have no effect.`)}const b=l?void 0:i.depthReadOnly;if(b!==void 0&&typeof b!="boolean")throw na(`received ${Di(b)}; expected a boolean.`,"Pass depthReadOnly: true to open the pass with a read-only depth attachment, or omit it.");if(b){if(!f.depth)throw na("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(f.sampleCount===4)throw uS();if(m!==void 0)throw na("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 na("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 x=l?void 0:IT(i.viewport,this.device.gpu.limits,f.size),R=l?void 0:VT(i.scissor,f.size),$=[];let L;try{const O=l||i.timer===void 0?void 0:this.#r(i.timer,f,$,GT),X=(l||i.visibility===void 0?void 0:this.#r(i.visibility,f,$,$T))?.occlusion;let Q=f.renderPassDescriptor({clear:d===void 0||d===!0||d===!1?f.clearColor??Af:d,preserve:h,clearDepth:m,clearStencil:g,depthReadOnly:b});O?.timestampWrites&&(Q={...Q,timestampWrites:O.timestampWrites}),X&&(Q={...Q,occlusionQuerySet:X.querySet}),L=this.#e.beginRenderPass(Q),x&&L.setViewport(x.x,x.y,x.width,x.height,x.minDepth,x.maxDepth),R&&L.setScissorRect(R[0],R[1],R[2],R[3]),this.#l=!0;try{u(new kT(L,f,this.#t,b===!0,X,this,H=>{if(pt(this.device,H),this.#s)throw yg(H)}))}finally{this.#l=!1}}catch(O){this.#o($),qt(this.#t),this.#t.length=0,xy(this.device);try{L?.end()}catch{}throw O}wy(this.device,L,this.#t)}submit(){if(this.#a||this.#s)return;pt(this.device,"Frame.submit"),this.#a=!0,this.releaseLifecycle?.();for(const u of this.#f())u.finalizeFrame(this,this.#e);let i;const s=this.#t[0]?.context;s&&rr(this.device,s);try{i=this.#e.finish()}catch(u){this.#c(this.#u());const f=s?cn(this.device):void 0;qt(this.#t),f&&qt([f]);const d=f?.context??s;if(!d)throw u;this.done=this.#h(this.#d(d.label,d.group,u));return}if(s){const u=cn(this.device);u&&(this.#t[0]=this.#t[0]?eu(u,this.#t[0]):u)}const l=this.#t[0]?.context;l&&rr(this.device,l);try{this.device.gpu.queue.submit([i])}catch(u){this.#c(this.#u());const f=l?cn(this.device):void 0;qt(this.#t),f&&qt([f]);const d=f?.context??l;if(!d)throw u;this.done=this.#h(this.#d(d.label,d.group,u));return}if(l){const u=cn(this.device);u&&(this.#t[0]=this.#t[0]?eu(u,this.#t[0]):u)}for(const u of this.#f())u.frameSubmitted(this);this.#c(this.#i),this.done=this.#h(Sy(this.device,this.#t,{errorSink:this.errorSink}))}cancel(){if(!this.#s){if(this.#a)throw TS("Frame.cancel");if(this.#l)throw ES("Frame.cancel");this.#s=!0,this.releaseLifecycle?.(),this.#c(this.#u()),this.#n.clear(),this.#i.clear(),qt(this.#t),this.#t.length=0}}#c(i){for(const s of[...i])s.frameAbandoned(this)}#u(){return[...this.#n,...this.#i]}#o(i){for(const s of[...i])this.#n.delete(s),this.#i.add(s)}#f(){return[...this.#n].filter(i=>!this.#i.has(i))}#r(i,s,l,u){const f=qE(i);if(!f)throw u(i);let d;try{d=f[Df]({frame:this,device:this.device,target:s})}catch(h){throw this.#o(this.#n),h}return this.#n.add(d.owner),l.push(d.owner),d}async#d(i,s,l){await vf(this.device),pt(this.device,"Frame.validation");const u=is(i,s,l);this.errorSink?await this.errorSink(u):console.error(u)}#h(i){return this.trackSettled?.(i),i}}class kT{encoder;target;validations;depthReadOnly;occlusionSource;frame;assertFrameOpen;#e=!1;constructor(i,s,l,u=!1,f,d,h){this.encoder=i,this.target=s,this.validations=l,this.depthReadOnly=u,this.occlusionSource=f,this.frame=d,this.assertFrameOpen=h}draw(i,s={}){this.assertFrameOpen?.("FramePass.draw");const l=jT(i);this.depthReadOnly&<(l,this.target),l.encode(this.encoder,this.target,s,u=>this.validations.push(u))}occlusion(i,s){if(this.assertFrameOpen?.("FramePass.occlusion"),!this.occlusionSource)throw fS();if(this.#e)throw dS();const l=this.occlusionSource.beginQuery(i,this.frame);this.encoder.beginOcclusionQuery(l),this.#e=!0;try{typeof s=="function"?s():this.draw(s)}finally{this.#e=!1,this.encoder.endOcclusionQuery()}}bundles(...i){if(this.assertFrameOpen?.("FramePass.bundles"),this.depthReadOnly)throw na("pass cannot replay bundles: bundle records bundles with writable depth/stencil, and WebGPU only executes read-only-recorded bundles in a read-only pass.","Encode the draws directly with pass.draw(...) inside the depthReadOnly pass.","FramePass.bundles");const s=i.map(l=>HE(l)??BT());for(const l of s)l.assertReplayable(this.target);this.encoder.executeBundles(s.map(l=>l.gpu))}}function LT(n,i){if(n.writesDepth())throw na(`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(cr(i.depth?.format)){const s=n.stencilWritingOps();if(s.length)throw na(`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 jT(n){const i=VE(n);if(!i)throw new TypeError("Invalid Effect instance: pass.draw() expects a Draw or an Effect created by this library.");return i}function BT(){throw new se({code:"VGPU-R3-BUNDLE-INVALID",message:"p.bundles() expected bundles created by bundle(gpu, { target }, cb).",where:"FramePass.bundles"})}function GT(n){return Qa(`FramePassOptions.timer received ${Di(n)}; expected a TimerSpan from timer.span(name).`,'Create const passTimer = timer(gpu) once, then pass passTimer.span("name") per pass.',"Frame.pass")}function $T(n){return cS(`FramePassOptions.visibility received ${Di(n)}; expected a Visibility from visibility(gpu).`,"Create const vis = visibility(gpu) once, then pass { target, visibility: vis } per pass.","Frame.pass")}function IT(n,i,s){if(n===void 0)return;if(typeof n!="object"||n===null||Array.isArray(n))throw Kn(`received ${Di(n)}; expected { x?, y?, width, height, minDepth?, maxDepth? }.`);const{x:l=0,y:u=0,width:f,height:d,minDepth:h=0,maxDepth:m=1}=n;for(const[R,$]of[["x",l],["y",u],["width",f],["height",d],["minDepth",h],["maxDepth",m]])if(typeof $!="number"||!Number.isFinite($))throw Kn(`${R} received ${Di($)}; expected a finite number.`);const g=i.maxTextureDimension2D,b=g*2,x=`target is ${s[0]}x${s[1]}px, device maxTextureDimension2D is ${g}`;if(!(f>=0&&f<=g))throw Kn(`width ${f} is outside [0, ${g}] (${x}).`);if(!(d>=0&&d<=g))throw Kn(`height ${d} is outside [0, ${g}] (${x}).`);if(!(l>=-b&&l+f<=b-1))throw Kn(`x ${l} with width ${f} is outside [${-b}, ${b-1}] (${x}).`);if(!(u>=-b&&u+d<=b-1))throw Kn(`y ${u} with height ${d} is outside [${-b}, ${b-1}] (${x}).`);if(!(h>=0&&h<=1))throw Kn(`minDepth ${h} is outside [0, 1].`);if(!(m>=0&&m<=1))throw Kn(`maxDepth ${m} is outside [0, 1].`);if(!(h<=m))throw Kn(`minDepth ${h} exceeds maxDepth ${m}.`);return{x:l,y:u,width:f,height:d,minDepth:h,maxDepth:m}}function VT(n,i){if(n===void 0)return;if(!Array.isArray(n)||n.length!==4)throw _c(`received ${Di(n)}; expected [x, y, width, height].`);const[s,l,u,f]=n;for(const[m,g]of[["x",s],["y",l],["width",u],["height",f]])if(typeof g!="number"||!Number.isInteger(g)||g<0)throw _c(`${m} received ${Di(g)}; expected a non-negative integer.`);const[d,h]=i;if(s+u>d||l+f>h)throw _c(`[${s}, ${l}, ${u}, ${f}] exceeds the target's current size ${d}x${h}px (x + width <= ${d}, y + height <= ${h}).`);return[s,l,u,f]}function Di(n){return typeof n=="string"?`'${n}'`:Array.isArray(n)?`[${n.map(i=>Di(i)).join(", ")}]`:typeof n=="object"&&n!==null?"an object":String(n)}function FT(n){const i=n?.code;return i==="VGPU-DEVICE-DISPOSED"||i==="VGPU-DEVICE-LOST"}class HT{createFrame;advance;trackLoop;#e=!1;constructor(i,s,l){this.createFrame=i,this.advance=s,this.trackLoop=l}frame(i){if(this.#e||_E())throw J0();this.#e=!0,NE();try{this.advance();const s=this.createFrame();if(i)try{i(s)}finally{try{s.submit()}catch(l){if(!FT(l))throw l}}return s}finally{kE(),this.#e=!1}}loop(i,s={}){let l=!1;const u=globalThis.requestAnimationFrame??(R=>setTimeout(()=>R(performance.now()),16)),f=globalThis.cancelAnimationFrame??(R=>clearTimeout(R)),d=s.fps&&s.fps>0?1e3/s.fps:0;let h,m=0;const g=R=>{l||(qT(R,h,d)&&(h=R,this.frame(i)),l||(m=u(g)))};m=u(g);let b;const x={stop(){l=!0,f(m),b?.(),b=void 0}};return b=this.trackLoop?.(x),x}}function qT(n,i,s){return i===void 0||s<=0?!0:n-i>=s}function a0(n,i){return new sf(Wn(n,"target").device,i)}class sf{device;options;resourceIdentity=su("render-target");#e=new ru;#t=new Set;#n;#i;#a;#s;#l;constructor(i,s){this.device=i,this.options=s,rE(s,i),this.#l=s.clearColor===void 0?Af:tu(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 Yl(this.options)[0]?.format??"rgba8unorm"}get clearColor(){return Mf(this.#l)}set clearColor(i){this.#l=tu(i,"target.clearColor")}get sampleCount(){return zy(this.options)}resize(i){Uy(this.#n,i)||this.#c(i)}async read(){return this.color.read()}async readFloats(){return this.color.readFloats()}onDestroy(i){return this.#e.onDestroy(this,i)}onTexturesRecreated(i){return this.#t.add(i),()=>{this.#t.delete(i)}}destroy(){this.#e.emit(this),this.#t.clear(),this.#o()}renderPassDescriptor(i={}){const{clear:s=[0,0,0,1],preserve:l,clearDepth:u,clearStencil:f,depthReadOnly:d}=i;return{colorAttachments:this.#i.map((h,m)=>uE(h,this.#a?.[m],s,l)),depthStencilAttachment:this.#s?oE(this.#s,l,u,f,d):void 0}}#c(i){this.#o(),this.#n=[i[0],i[1]],this.#i=this.#f(),this.#a=this.sampleCount===4?this.#r():void 0,this.#s=this.#d(),this.#u()}#u(){for(const i of[...this.#t])i()}#o(){for(const i of this.#i)i.destroy();for(const i of this.#a??[])i.destroy();this.#s?.destroy()}#f(){return Yl(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 Yl(this.options).map((i,s)=>this.device.createTexture({size:this.#n,format:i.format,usage:["render_attachment"],sampleCount:4,label:this.options.label?`${this.options.label}.color${s}`:void 0}))}#d(){const i=Oy(this.options);return i?this.device.createTexture({size:this.#n,format:i,usage:["render_attachment","texture_binding"],sampleCount:this.sampleCount,label:this.options.label?`${this.options.label}.depth`:void 0}):void 0}}function Ya(n,i,s="read-write"){const l=Wn(n,"storage"),u=typeof s=="string"?{access:s}:s,f=YT(l.device,i,u.access??"read-write",void 0,u.indirect??!1);return ny(l,f,d=>d.destroy(),d=>{f.onDestroy(d)})}class Of{size;access;buffer;constructor(i,s){this.buffer=i,this.access=s,this.size=i.options.size}static create(i,s,l,u,f=!1){const d=f?["storage","copy_dst","copy_src","indirect"]:["storage","copy_dst","copy_src"],h=i.createBuffer({size:s,usage:d,label:u});return new Of(h,l)}read(){return this.buffer.read(this.size)}write(i,s=0){this.buffer.write(XT(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 YT(n,i,s,l,u=!1){return Of.create(n,i,s,l,u)}function XT(n){if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n;throw new TypeError("StorageBuffer.write() requires ArrayBuffer or ArrayBufferView.")}function KT(n,i,s,l={}){const u=Wn(n,"pingPong");return PT(u.device,i,s,l,f=>QT(u,f))}function QT(n,i){return ny(n,i,s=>s.destroy(),s=>{i.onDestroy(s)})}function PT(n,i,s,l={},u=ZT){const f=[s0(i),s0(s)],d={...l,size:f},h=u(new sf(n,r0(d,l.label,"ping"))),m=u(new sf(n,r0(d,l.label,"pong")));return new WT([h,m])}function ZT(n){return n}class WT{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 s0(n){return Math.max(1,Math.floor(n))}function r0(n,i,s){return i?{...n,label:`${i}.${s}`}:n}const jc=8,JT=globalThis.GPUMapMode?.READ??1;function eA(n,i){return new tA(n,i)}class tA{querySet;capacity;#e;#t;#n;#i;#a;#s=0;#l=0;#c=-1;#u;#o=0;#f=0;#r=!1;#d=!1;constructor(i,s){this.capacity=s.capacity;const l=s.label??"vgpu.query-ring";this.#e=l;const u=s.capacity*jc;this.querySet=i.gpu.createQuerySet({type:s.type,count:s.capacity,label:l}),this.#t=i.createBuffer({size:u,usage:["query_resolve","copy_src"],label:`${l}.resolve`}),this.#n=Array.from({length:s.depth??3},(f,d)=>({buffer:i.createBuffer({size:u,usage:["map_read","copy_dst"],label:`${l}.staging${d}`}),mapPending:!1,retired:!1})),this.#i=s.trackSettled,this.#a=s.errorSink}encodeResolve(i,s){if(this.#u=void 0,this.#r||s<=0)return!1;const l=this.#h();if(!l)return!1;const u=Math.min(s,this.capacity);return i.resolveQuerySet(this.querySet,0,u,this.#t.gpu,0),i.copyBufferToBuffer(this.#t.gpu,0,l.buffer.gpu,0,u*jc),this.#u={staging:l,usedCount:u,seq:this.#l},this.#l+=1,this.#s+=1,!0}onSubmitted(i){const s=this.#u;if(this.#u=void 0,!s)return;s.staging.mapPending=!0,this.#o+=1;const l=s.staging.buffer.gpu.mapAsync(JT).then(()=>{const u=this.#m(s);s.seq<=this.#c||(this.#c=s.seq,i(u))}).catch(u=>{this.#y(u)}).finally(()=>{s.staging.mapPending=!1,this.#o-=1,this.#g()});this.#i?.(l)}#h(){for(let i=0;i<this.#n.length;i+=1){const s=this.#n[this.#s%this.#n.length];if(!s.retired)return s.mapPending?void 0:s;this.#s+=1}}#m(i){let s;try{s=new BigUint64Array(i.staging.buffer.gpu.getMappedRange().slice(0,i.usedCount*jc))}catch(l){throw this.#p(i.staging),l}try{i.staging.buffer.gpu.unmap()}catch(l){throw i.staging.retired=!0,l}return s}#p(i){try{i.buffer.gpu.unmap()}catch{i.retired=!0}}retain(){this.#f+=1}release(){this.#f>0&&(this.#f-=1),this.#g()}dispose(){this.#r||(this.#r=!0,this.#u=void 0,this.#g())}#g(){if(!(!this.#r||this.#d||this.#o>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=wS(this.#e,i),l=this.#a;if(!l){console.error(s);return}try{Promise.resolve(l(s)).catch(u=>{console.error(u)})}catch(u){console.error(u)}}}const l0=32,rf=4096,u0=rf/2,nA=1/1e6;class iA{name;owner;constructor(i,s){this.name=i,this.owner=s}[Df](i){return{owner:this.owner,timestampWrites:this.owner.attachSpan(this,i.frame,i.device)}}}function aA(n){const i=Wn(n,"timer");return jS(i,s=>new sA(i.device,s))}class sA{#e;#t;#n=new Map;#i=new Set;#a;#s=l0*2;#l=l0*2;#c;#u=[];#o=new Set;#f=0;#r;#d=0;#h=-1;#m=new Map;#p=!1;constructor(i,s={}){if(!i.features.has("timestamp-query"))throw Qa('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 Qa(`span name received ${lA(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 iA(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.#o.clear(),this.#u=[],this.#r=void 0,this.#a.dispose(),this.#t.onDispose?.())}attachSpan(i,s,l){if(this.#v("Frame.pass"),l!==this.#e)throw Qa(`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.#o.has(i.name))throw Qa(`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.#o.size>=u0)throw oS(u0,rf);this.#o.add(i.name);const u=this.#o.size*2-2;if(this.#l<u+2&&(this.#l=u+2),!(u+2>this.#a.capacity))return this.#f=u+2,this.#u.push({name:i.name,begin:u}),this.#S(s),{querySet:this.#a.querySet,beginningOfPassWriteIndex:u,endOfPassWriteIndex:u+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.#u])}frameSubmitted(i){if(this.#b(i),i!==this.#c||this.#p)return;const s=this.#r;if(this.#r=void 0,!s||s.length===0)return;const l=this.#d;this.#d+=1,this.#a.onSubmitted(u=>{l<=this.#h||(this.#h=l,this.#y(s,u))})}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(rf,rA(this.#l)),this.#a=this.#x()),this.#l=this.#s,this.#c=i,this.#u=[],this.#o.clear(),this.#f=0}#y(i,s){const l={};for(const{name:f,begin:d}of i){const h=s[d]??0n,m=s[d+1]??0n;l[f]=m>h?Number(m-h)*nA:0}const u=Object.freeze(l);for(const f of[...this.#i])try{f(u)}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 eA(this.#e,{type:"timestamp",capacity:this.#s,label:"vgpu.timer",trackSettled:this.#t.trackSettled,errorSink:this.#t.errorSink})}#v(i){if(this.#p)throw Qa("the timer is disposed.","Create a new timer with timer(gpu).",i)}}function rA(n){let i=1;for(;i<n;)i*=2;return i}function lA(n){return typeof n=="string"?`'${n}'`:String(n)}function o0(n){return _S("browser",n)}const Wy=`struct Params {
|
|
26
|
+
// visible world rect: x0, y0, x1, y1
|
|
27
|
+
rect : vec4f,
|
|
28
|
+
// viewportW, viewportH, scale (px per world unit), time (seconds)
|
|
29
|
+
view : vec4f,
|
|
30
|
+
// massCount, disturbanceCount, couplingCount, dt
|
|
31
|
+
counts : vec4f,
|
|
32
|
+
// rowsScreen, stepScreen, amp, alpha
|
|
33
|
+
layer : vec4f,
|
|
34
|
+
// lineWidth, dz, parallaxX, showResidue
|
|
35
|
+
layer2 : vec4f,
|
|
36
|
+
// columns, rows, laneCount, plinthCount
|
|
37
|
+
grid : vec4f,
|
|
38
|
+
fill : vec4f,
|
|
39
|
+
// padded field rect used by the field texture: x0, y0, x1, y1
|
|
40
|
+
fieldRect : vec4f,
|
|
41
|
+
// fill reach in rows (0 = every fill runs to the viewport bottom), unused, unused, unused
|
|
42
|
+
sheet : vec4f,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
// Storage rather than uniform: every array below is packed by hand into a Float32Array, and this
|
|
46
|
+
// keeps the whole parameter block on the same footing instead of splitting the packing across two
|
|
47
|
+
// binding conventions.
|
|
48
|
+
@group(0) @binding(0) var<storage, read> P : Params;
|
|
49
|
+
|
|
50
|
+
// masses: 3 vec4 each
|
|
51
|
+
// 0: pos.xy, extent.xy
|
|
52
|
+
// 1: depth, rim, pull, lobe
|
|
53
|
+
// 2: phase, tint.rgb
|
|
54
|
+
@group(0) @binding(1) var<storage, read> massData : array<vec4f>;
|
|
55
|
+
|
|
56
|
+
// disturbances: 3 vec4 each
|
|
57
|
+
// 0: x, y, radius, amplitude
|
|
58
|
+
// 1: frequency, phase, statusIndex, energy
|
|
59
|
+
// 2: articulation, shoulder, unused, unused
|
|
60
|
+
@group(0) @binding(2) var<storage, read> distData : array<vec4f>;
|
|
61
|
+
|
|
62
|
+
// couplings: 1 vec4 each — fromMassIndex, toMassIndex, energy, unused
|
|
63
|
+
@group(0) @binding(3) var<storage, read> coupData : array<vec4f>;
|
|
64
|
+
|
|
65
|
+
// WGSL's pow() is exp2(y * log2(x)) and returns NaN for a negative base. The approved material
|
|
66
|
+
// squares plenty of signed quantities — offsets from a rim, distances either side of a ridge — so
|
|
67
|
+
// every one of those must be a multiplication, not a pow. A single NaN propagates through the
|
|
68
|
+
// baked field texture and blanks the entire sheet.
|
|
69
|
+
fn sq(x: f32) -> f32 { return x * x; }
|
|
70
|
+
fn quad(x: f32) -> f32 { let s = x * x; return s * s; }
|
|
71
|
+
|
|
72
|
+
fn massPos(i: u32) -> vec2f { return massData[i * 3u].xy; }
|
|
73
|
+
fn massExtent(i: u32) -> vec2f { return massData[i * 3u].zw; }
|
|
74
|
+
fn massShape(i: u32) -> vec4f { return massData[i * 3u + 1u]; }
|
|
75
|
+
fn massPhase(i: u32) -> f32 { return massData[i * 3u + 2u].x; }
|
|
76
|
+
fn massTint(i: u32) -> vec3f { return massData[i * 3u + 2u].yzw; }
|
|
77
|
+
`,uA=`@group(0) @binding(4) var prevTex : texture_2d<f32>;
|
|
78
|
+
@group(0) @binding(5) var prevSamp : sampler;
|
|
79
|
+
|
|
80
|
+
const DEPOSIT_RATE : f32 = 0.02;
|
|
81
|
+
const DECAY_RATE : f32 = 0.05;
|
|
82
|
+
|
|
83
|
+
@fragment
|
|
84
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
85
|
+
let prev = textureSampleLevel(prevTex, prevSamp, uv, 0.0);
|
|
86
|
+
let dt = P.counts.w;
|
|
87
|
+
|
|
88
|
+
// Texel back to world space over the fixed residue rect.
|
|
89
|
+
let world = vec2f(
|
|
90
|
+
mix(P.fieldRect.x, P.fieldRect.z, uv.x),
|
|
91
|
+
mix(P.fieldRect.y, P.fieldRect.w, uv.y)
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
// --- process deposition -------------------------------------------------
|
|
95
|
+
var deposit = 0.0;
|
|
96
|
+
let dn = u32(P.counts.y);
|
|
97
|
+
for (var i = 0u; i < dn; i = i + 1u) {
|
|
98
|
+
let a = distData[i * 3u];
|
|
99
|
+
let b = distData[i * 3u + 1u];
|
|
100
|
+
let radius = a.z;
|
|
101
|
+
let energy = b.w;
|
|
102
|
+
if (energy <= 0.001) { continue; }
|
|
103
|
+
let d = length(vec2f(world.x - a.x, (world.y - a.y) * 1.5));
|
|
104
|
+
if (d > radius * 2.4) { continue; }
|
|
105
|
+
let falloff = exp(-sq(d / (radius * 1.7)));
|
|
106
|
+
deposit = deposit + energy * falloff;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// --- transfer deposition ------------------------------------------------
|
|
110
|
+
var coupleDeposit = 0.0;
|
|
111
|
+
let cn = u32(P.counts.z);
|
|
112
|
+
for (var i = 0u; i < cn; i = i + 1u) {
|
|
113
|
+
let c = coupData[i];
|
|
114
|
+
let a = massPos(u32(c.x));
|
|
115
|
+
let b = massPos(u32(c.y));
|
|
116
|
+
let v = b - a;
|
|
117
|
+
let l2 = dot(v, v);
|
|
118
|
+
if (l2 < 1.0) { continue; }
|
|
119
|
+
let u = dot(world - a, v) / l2;
|
|
120
|
+
if (u < -0.05 || u > 1.05) { continue; }
|
|
121
|
+
let proj = a + v * u;
|
|
122
|
+
let p = length(world - proj) / 44.0;
|
|
123
|
+
coupleDeposit = coupleDeposit + c.z * exp(-p * p * 1.4)
|
|
124
|
+
* exp(-quad((u - 0.5) / 0.5));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
let r = prev.r + (deposit * DEPOSIT_RATE - prev.r * DECAY_RATE) * dt;
|
|
128
|
+
let g = prev.g + (coupleDeposit * DEPOSIT_RATE * 1.5 - prev.g * DECAY_RATE) * dt;
|
|
129
|
+
|
|
130
|
+
// Clamped so a pathological source can never drive residue unbounded.
|
|
131
|
+
return vec4f(clamp(r, 0.0, 4.0), clamp(g, 0.0, 4.0), 0.0, 1.0);
|
|
132
|
+
}
|
|
133
|
+
`,oA=`@group(0) @binding(4) var residueTex : texture_2d<f32>;
|
|
134
|
+
@group(0) @binding(5) var residueSamp : sampler;
|
|
135
|
+
|
|
136
|
+
// plinths: 3 vec4 each — session presence (FIELD-SPEC §15)
|
|
137
|
+
// 0: x, y, extentX, extentY
|
|
138
|
+
// 1: presence, articulation, parentIndex + 1 (0 = none), empty flag
|
|
139
|
+
// 2: shoulder, nested flag, unused, unused
|
|
140
|
+
@group(0) @binding(6) var<storage, read> plinthData : array<vec4f>;
|
|
141
|
+
|
|
142
|
+
const MAX_PLINTHS : u32 = 16u;
|
|
143
|
+
|
|
144
|
+
const RES_X0 : f32 = 0.0;
|
|
145
|
+
const RES_Y0 : f32 = 0.0;
|
|
146
|
+
const RES_X1 : f32 = 1160.0;
|
|
147
|
+
const RES_Y1 : f32 = 812.0;
|
|
148
|
+
|
|
149
|
+
fn residueAt(world: vec2f) -> vec2f {
|
|
150
|
+
let uv = vec2f(
|
|
151
|
+
(world.x - RES_X0) / (RES_X1 - RES_X0),
|
|
152
|
+
(world.y - RES_Y0) / (RES_Y1 - RES_Y0)
|
|
153
|
+
);
|
|
154
|
+
if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) { return vec2f(0.0); }
|
|
155
|
+
return textureSampleLevel(residueTex, residueSamp, uv, 0.0).rg;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** FIELD-SPEC §7 — the sheet sags toward mass. */
|
|
159
|
+
fn shiftAt(world: vec2f, t: f32) -> f32 {
|
|
160
|
+
var dy = 0.0;
|
|
161
|
+
let mn = u32(P.counts.x);
|
|
162
|
+
for (var i = 0u; i < mn; i = i + 1u) {
|
|
163
|
+
let pos = massPos(i);
|
|
164
|
+
let ext = massExtent(i);
|
|
165
|
+
let n = (world - pos) / ext;
|
|
166
|
+
let g = exp(-dot(n, n) * 0.85);
|
|
167
|
+
dy = dy + massShape(i).z * n.y * g * 1.6;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Coupling flattens the sheet between two machines (FIELD-SPEC §8).
|
|
171
|
+
let cn = u32(P.counts.z);
|
|
172
|
+
let res = residueAt(world);
|
|
173
|
+
for (var i = 0u; i < cn; i = i + 1u) {
|
|
174
|
+
let c = coupData[i];
|
|
175
|
+
let a = massPos(u32(c.x));
|
|
176
|
+
let b = massPos(u32(c.y));
|
|
177
|
+
let v = b - a;
|
|
178
|
+
let l2 = dot(v, v);
|
|
179
|
+
if (l2 < 1.0) { continue; }
|
|
180
|
+
let u = dot(world - a, v) / l2;
|
|
181
|
+
if (u < -0.05 || u > 1.05) { continue; }
|
|
182
|
+
let proj = a + v * u;
|
|
183
|
+
let off = (world.y - proj.y) / 62.0;
|
|
184
|
+
let env = exp(-off * off) * exp(-quad((u - 0.5) / 0.55));
|
|
185
|
+
dy = dy - off * 62.0 * 0.42 * env * (0.7 + 0.3 * sin(t * 2.4 - u * 6.0)) * c.z;
|
|
186
|
+
dy = dy - off * 10.0 * env * res.g;
|
|
187
|
+
}
|
|
188
|
+
return dy;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
/** FIELD-SPEC §6 — the height field. */
|
|
192
|
+
fn heightAt(world: vec2f, t: f32) -> f32 {
|
|
193
|
+
let x = world.x;
|
|
194
|
+
let y = world.y;
|
|
195
|
+
|
|
196
|
+
// Base medium.
|
|
197
|
+
var v = 3.1 * sin(x * 0.021 + y * 0.013) * sin(y * 0.017 - x * 0.008)
|
|
198
|
+
+ 1.7 * sin(x * 0.045 - y * 0.031)
|
|
199
|
+
+ 1.1 * sin(y * 0.062 + x * 0.017);
|
|
200
|
+
|
|
201
|
+
// Mass: a lobed well with a raised rim. Permanent.
|
|
202
|
+
let mn = u32(P.counts.x);
|
|
203
|
+
for (var i = 0u; i < mn; i = i + 1u) {
|
|
204
|
+
let pos = massPos(i);
|
|
205
|
+
let ext = massExtent(i);
|
|
206
|
+
let shape = massShape(i);
|
|
207
|
+
let ph = massPhase(i);
|
|
208
|
+
let n = (world - pos) / ext;
|
|
209
|
+
let r = length(n);
|
|
210
|
+
let th = atan2(n.y, n.x);
|
|
211
|
+
let lobe = shape.w;
|
|
212
|
+
let wob = 1.0 + lobe * sin(3.0 * th + ph) * 0.5 + lobe * 0.3 * sin(5.0 * th - ph);
|
|
213
|
+
let rr = r / max(0.35, wob);
|
|
214
|
+
v = v - shape.x * exp(-rr * rr * 1.05);
|
|
215
|
+
v = v + shape.y * exp(-sq((rr - 1.02) / 0.42));
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Activity: temporary, local, independent. Anisotropic — wider than tall.
|
|
219
|
+
//
|
|
220
|
+
// Articulation (FIELD-SPEC §16) is spent on definition only: it damps the ripple terms, softens
|
|
221
|
+
// and widens the collar so the rim stops closing, and — when co-observing sources disagree on
|
|
222
|
+
// extent — raises a faint doubled shoulder inside the object's own trough. The bulge amplitude
|
|
223
|
+
// itself is NEVER scaled by articulation: unknown stays heavy.
|
|
224
|
+
let dn = u32(P.counts.y);
|
|
225
|
+
for (var i = 0u; i < dn; i = i + 1u) {
|
|
226
|
+
let a = distData[i * 3u];
|
|
227
|
+
let b = distData[i * 3u + 1u];
|
|
228
|
+
let c = distData[i * 3u + 2u];
|
|
229
|
+
let amp = a.w;
|
|
230
|
+
if (amp <= 0.01) { continue; }
|
|
231
|
+
let radius = a.z;
|
|
232
|
+
let freq = b.x;
|
|
233
|
+
let phase = b.y;
|
|
234
|
+
let artic = c.x;
|
|
235
|
+
let rip = 0.15 + 0.85 * artic;
|
|
236
|
+
let d = length(vec2f(x - a.x, (y - a.y) * 1.5));
|
|
237
|
+
if (d > radius * 4.0) { continue; }
|
|
238
|
+
let e = exp(-sq(d / radius));
|
|
239
|
+
v = v + amp * e * (0.78 + 0.22 * sin(t * freq + phase) * rip);
|
|
240
|
+
v = v - amp * 0.34 * (0.25 + 0.75 * artic)
|
|
241
|
+
* exp(-sq((d - radius * 1.5) / (radius * 0.62 * (1.0 + (1.0 - artic) * 1.4))));
|
|
242
|
+
v = v + amp * 0.16 * rip * exp(-d / (radius * 2.1)) * sin(d * 0.13 - t * freq * 2.6 + phase);
|
|
243
|
+
if (c.y > 0.02) {
|
|
244
|
+
v = v + amp * 0.11 * exp(-sq((d - radius * (0.72 + c.y)) / (radius * 0.3)));
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
// SESSION PRESENCE (FIELD-SPEC §15): a flat-topped plinth per live session raises grouped
|
|
249
|
+
// executions onto one platform, so an existing contour closes around the set. A spawned child
|
|
250
|
+
// is a plinth growing out of the parent plinth. An empty-but-known session keeps only its rim.
|
|
251
|
+
let pn = min(u32(P.grid.w), MAX_PLINTHS);
|
|
252
|
+
var lv : array<f32, MAX_PLINTHS>;
|
|
253
|
+
for (var i = 0u; i < pn; i = i + 1u) {
|
|
254
|
+
let pa = plinthData[i * 3u];
|
|
255
|
+
let pb = plinthData[i * 3u + 1u];
|
|
256
|
+
let pc = plinthData[i * 3u + 2u];
|
|
257
|
+
let n = (world - pa.xy) / pa.zw;
|
|
258
|
+
let r2 = dot(n, n);
|
|
259
|
+
let presence = pb.x;
|
|
260
|
+
let plateau = 1.0 / (1.0 + pow(max(r2, 1e-5), 2.6));
|
|
261
|
+
lv[i] = plateau * presence;
|
|
262
|
+
if (pb.w > 0.5) {
|
|
263
|
+
// Presence without content: the rim of a session nothing ever ran in.
|
|
264
|
+
v = v + 4.5 * presence * exp(-sq((sqrt(r2) - 1.0) / 0.3));
|
|
265
|
+
} else {
|
|
266
|
+
let plinth = select(17.0, 13.0, pc.y > 0.5) * presence;
|
|
267
|
+
v = v + plinth * plateau;
|
|
268
|
+
if (pc.x > 0.02) {
|
|
269
|
+
// Co-observation shoulder: sources agree on the computation, not exactly on its extent.
|
|
270
|
+
// A concentric bench inside the plateau edge — never a separate closed rim.
|
|
271
|
+
v = v + plinth * 0.3 * pc.x * exp(-sq((sqrt(r2) - 0.78) / 0.13));
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
// THE KEEL: where two unrelated plateaus overlap, the ground between them drops — the same
|
|
277
|
+
// trough vocabulary already used around bulges, so contours cannot bridge it and proximity alone
|
|
278
|
+
// can never close a line. Parent and spawned child are exempt and still share a wall. Shallow by
|
|
279
|
+
// design: it must never read as a machine-level rift.
|
|
280
|
+
for (var i = 0u; i < pn; i = i + 1u) {
|
|
281
|
+
for (var j = i + 1u; j < pn; j = j + 1u) {
|
|
282
|
+
if (lv[i] < 0.02 || lv[j] < 0.02) { continue; }
|
|
283
|
+
let pi = u32(plinthData[i * 3u + 1u].z);
|
|
284
|
+
let pj = u32(plinthData[j * 3u + 1u].z);
|
|
285
|
+
if (pi == j + 1u || pj == i + 1u) { continue; }
|
|
286
|
+
let lo = min(lv[i], lv[j]);
|
|
287
|
+
let o = lo / max(lv[i], lv[j]);
|
|
288
|
+
v = v - 30.0 * o * sqrt(o) * lo;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
// Residue: what the field remembers. One texture read, not a walk through history.
|
|
293
|
+
if (P.layer2.w > 0.5) {
|
|
294
|
+
let res = residueAt(world);
|
|
295
|
+
v = v + 62.0 * 0.15 * res.r;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// Coupling ridge.
|
|
299
|
+
let cn = u32(P.counts.z);
|
|
300
|
+
let resC = residueAt(world);
|
|
301
|
+
for (var i = 0u; i < cn; i = i + 1u) {
|
|
302
|
+
let c = coupData[i];
|
|
303
|
+
let a = massPos(u32(c.x));
|
|
304
|
+
let b = massPos(u32(c.y));
|
|
305
|
+
let vv = b - a;
|
|
306
|
+
let l2 = dot(vv, vv);
|
|
307
|
+
if (l2 < 1.0) { continue; }
|
|
308
|
+
let u = dot(world - a, vv) / l2;
|
|
309
|
+
if (u < -0.05 || u > 1.05) { continue; }
|
|
310
|
+
let proj = a + vv * u;
|
|
311
|
+
let p = length(world - proj) / 44.0;
|
|
312
|
+
let envc = exp(-p * p) * exp(-quad((u - 0.5) / 0.56));
|
|
313
|
+
v = v + 34.0 * envc * (0.5 + 0.5 * sin(u * 13.0 - t * 4.6)) * c.z;
|
|
314
|
+
v = v - 14.0 * exp(-sq(abs(p) - 1.5)) * envc * c.z;
|
|
315
|
+
v = v + 9.0 * resC.g * exp(-p * p * 1.4) * exp(-quad((u - 0.5) / 0.5));
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
return v;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Local articulation (FIELD-SPEC §16): the sheet resolves coarser near unresolved objects, so line
|
|
323
|
+
* cadence carries the meaning. Weighted blend over disturbances and plinths, with a prior toward 1
|
|
324
|
+
* so the empty medium — and everything far from an observed object — keeps its full cadence.
|
|
325
|
+
*/
|
|
326
|
+
fn articAt(world: vec2f) -> f32 {
|
|
327
|
+
var num = 0.0;
|
|
328
|
+
var den = 0.35;
|
|
329
|
+
let dn = u32(P.counts.y);
|
|
330
|
+
for (var i = 0u; i < dn; i = i + 1u) {
|
|
331
|
+
let a = distData[i * 3u];
|
|
332
|
+
let b = distData[i * 3u + 1u];
|
|
333
|
+
if (b.w <= 0.001) { continue; }
|
|
334
|
+
let dx = (world.x - a.x) / (a.z * 2.0);
|
|
335
|
+
let dy = (world.y - a.y) * 1.5 / (a.z * 2.0);
|
|
336
|
+
let w = exp(-(dx * dx + dy * dy)) * b.w;
|
|
337
|
+
num = num + w * distData[i * 3u + 2u].x;
|
|
338
|
+
den = den + w;
|
|
339
|
+
}
|
|
340
|
+
let pn = min(u32(P.grid.w), MAX_PLINTHS);
|
|
341
|
+
for (var i = 0u; i < pn; i = i + 1u) {
|
|
342
|
+
let pa = plinthData[i * 3u];
|
|
343
|
+
let pb = plinthData[i * 3u + 1u];
|
|
344
|
+
if (pb.x <= 0.01) { continue; }
|
|
345
|
+
let dx = (world.x - pa.x) / (pa.z * 1.3);
|
|
346
|
+
let dy = (world.y - pa.y) / (pa.w * 1.3);
|
|
347
|
+
let w = exp(-(dx * dx + dy * dy)) * pb.x * 0.8;
|
|
348
|
+
num = num + w * pb.y;
|
|
349
|
+
den = den + w;
|
|
350
|
+
}
|
|
351
|
+
return clamp((num + 0.35) / den, 0.1, 1.0);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
@fragment
|
|
355
|
+
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
356
|
+
let world = vec2f(
|
|
357
|
+
mix(P.fieldRect.x, P.fieldRect.z, uv.x),
|
|
358
|
+
mix(P.fieldRect.y, P.fieldRect.w, uv.y)
|
|
359
|
+
);
|
|
360
|
+
let t = P.view.w;
|
|
361
|
+
return vec4f(heightAt(world, t), shiftAt(world, t), articAt(world), 1.0);
|
|
362
|
+
}
|
|
363
|
+
`,cA=`@group(0) @binding(4) var fieldTex : texture_2d<f32>;
|
|
364
|
+
@group(0) @binding(5) var fieldSamp : sampler;
|
|
365
|
+
|
|
366
|
+
struct VOut {
|
|
367
|
+
@builtin(position) pos : vec4f,
|
|
368
|
+
@location(0) color : vec4f,
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
fn fieldSample(world: vec2f) -> vec3f {
|
|
372
|
+
let uv = vec2f(
|
|
373
|
+
(world.x - P.fieldRect.x) / (P.fieldRect.z - P.fieldRect.x),
|
|
374
|
+
(world.y - P.fieldRect.y) / (P.fieldRect.w - P.fieldRect.y)
|
|
375
|
+
);
|
|
376
|
+
// r: height, g: shift, b: local articulation.
|
|
377
|
+
return textureSampleLevel(fieldTex, fieldSamp, clamp(uv, vec2f(0.0), vec2f(1.0)), 0.0).rgb;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/** FIELD-SPEC §10 — line colour is the base ink pulled toward nearby mass tints. */
|
|
381
|
+
fn tintMix(world: vec2f) -> vec3f {
|
|
382
|
+
var acc = vec3f(226.0, 223.0, 215.0);
|
|
383
|
+
var w = 1.0;
|
|
384
|
+
let mn = u32(P.counts.x);
|
|
385
|
+
for (var i = 0u; i < mn; i = i + 1u) {
|
|
386
|
+
let pos = massPos(i);
|
|
387
|
+
let ext = massExtent(i) * 1.5;
|
|
388
|
+
let n = (world - pos) / ext;
|
|
389
|
+
let k = exp(-dot(n, n)) * 0.85;
|
|
390
|
+
acc = acc + massTint(i) * k;
|
|
391
|
+
w = w + k;
|
|
392
|
+
}
|
|
393
|
+
return acc / w / 255.0;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
/** Screen-space y of the sheet at world x on the given row baseline. */
|
|
397
|
+
fn rowPoint(x: f32, by: f32, dzW: f32, ampF: f32) -> f32 {
|
|
398
|
+
let wy = by + dzW;
|
|
399
|
+
let sh = fieldSample(vec2f(x, wy)).g;
|
|
400
|
+
let yy = wy + sh * ampF;
|
|
401
|
+
let hv = fieldSample(vec2f(x, yy)).r * ampF;
|
|
402
|
+
let worldY = by - hv + sh * 0.55 * ampF;
|
|
403
|
+
return (worldY - P.rect.y) * P.view.z;
|
|
404
|
+
}
|
|
405
|
+
`,fA=`@vertex
|
|
406
|
+
fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
|
|
407
|
+
let cols = u32(P.grid.x);
|
|
408
|
+
let isLine = ii & 1u;
|
|
409
|
+
let seg = ii >> 1u;
|
|
410
|
+
let row = seg / cols;
|
|
411
|
+
let col = seg % cols;
|
|
412
|
+
|
|
413
|
+
let k = P.view.z;
|
|
414
|
+
let stepW = P.layer.y / k;
|
|
415
|
+
let rowsW = P.layer.x / k;
|
|
416
|
+
let dzW = P.layer2.y / k;
|
|
417
|
+
// FIELD-SPEC §10 — amplitude compensation when zoomed in.
|
|
418
|
+
let ampF = P.layer.z * select(1.0, 1.6 / k, k > 1.0);
|
|
419
|
+
|
|
420
|
+
let x0 = P.rect.x - stepW * 2.0 + f32(col) * stepW;
|
|
421
|
+
let x1 = x0 + stepW;
|
|
422
|
+
let by = P.rect.y - rowsW * 0.6 + f32(row) * rowsW;
|
|
423
|
+
|
|
424
|
+
let sy0 = rowPoint(x0, by, dzW, ampF);
|
|
425
|
+
let sy1 = rowPoint(x1, by, dzW, ampF);
|
|
426
|
+
let sx0 = (x0 - P.rect.x) * k + P.layer2.z;
|
|
427
|
+
let sx1 = (x1 - P.rect.x) * k + P.layer2.z;
|
|
428
|
+
|
|
429
|
+
var p = vec2f(0.0);
|
|
430
|
+
var color = vec4f(0.0);
|
|
431
|
+
|
|
432
|
+
if (isLine == 0u) {
|
|
433
|
+
// Fill: from this segment down over the farther rows it occludes.
|
|
434
|
+
//
|
|
435
|
+
// ── Why the fill stops where it does ──────────────────────────────────────────────────────
|
|
436
|
+
// The approved material ran every fill to the bottom of the viewport. Composited far to near
|
|
437
|
+
// that is exactly the hidden-line algorithm, but it also means a pixel is written once per row
|
|
438
|
+
// above it: at the 9 px near-row spacing on a 914 px tall viewport, about 107 blended
|
|
439
|
+
// fragments per pixel across the three layers (measured; see the performance investigation),
|
|
440
|
+
// and that overdraw grows with width × height² × dpr². It was three quarters of the frame's
|
|
441
|
+
// GPU time on an M4 and dwarfs everything else the field draws.
|
|
442
|
+
//
|
|
443
|
+
// Below the next 'reach' rows' lines a fill can no longer be seen: the fills of those rows
|
|
444
|
+
// land on top of it, each at this layer's fill alpha, so whatever it contributed is scaled by
|
|
445
|
+
// (1 - alpha)^reach — below one 8-bit step for the reach chosen per layer in FILL_REACH. So
|
|
446
|
+
// the fill stops at the LOWEST of the next 'reach' rows' lines at each end of the segment, and
|
|
447
|
+
// the rows between it and there keep exactly the occlusion and haze they had. The bottom edge
|
|
448
|
+
// is straight between the two ends, which bounds the straight segments of those rows.
|
|
449
|
+
//
|
|
450
|
+
// Reach 0 restores the original geometry, and the last 'reach' rows keep it, so the sheet's
|
|
451
|
+
// edge against the strata band is untouched.
|
|
452
|
+
var bottom = P.view.y + 60.0;
|
|
453
|
+
let reach = u32(P.sheet.x);
|
|
454
|
+
let rows = u32(P.grid.y);
|
|
455
|
+
let isBottom = (vi == 2u) || (vi == 4u) || (vi == 5u);
|
|
456
|
+
if (isBottom && reach > 0u && row + reach < rows) {
|
|
457
|
+
let xb = select(x0, x1, vi != 5u);
|
|
458
|
+
var b = select(sy0, sy1, vi != 5u);
|
|
459
|
+
for (var j = 1u; j <= reach; j = j + 1u) {
|
|
460
|
+
b = max(b, rowPoint(xb, by + f32(j) * rowsW, dzW, ampF));
|
|
461
|
+
}
|
|
462
|
+
// Half a pixel of slack over the nearer rows' own vertex arithmetic.
|
|
463
|
+
bottom = b + 0.5;
|
|
464
|
+
}
|
|
465
|
+
switch (vi) {
|
|
466
|
+
case 0u: { p = vec2f(sx0, sy0); }
|
|
467
|
+
case 1u: { p = vec2f(sx1, sy1); }
|
|
468
|
+
case 2u: { p = vec2f(sx1, bottom); }
|
|
469
|
+
case 3u: { p = vec2f(sx0, sy0); }
|
|
470
|
+
case 4u: { p = vec2f(sx1, bottom); }
|
|
471
|
+
default: { p = vec2f(sx0, bottom); }
|
|
472
|
+
}
|
|
473
|
+
color = P.fill;
|
|
474
|
+
} else {
|
|
475
|
+
// Line: a quad along the segment, width and alpha from local slope (FIELD-SPEC §10).
|
|
476
|
+
let slope = min(1.0, abs(sy1 - sy0) / max(0.001, P.layer.y));
|
|
477
|
+
var bucketA = 0.17;
|
|
478
|
+
var bucketW = 0.75;
|
|
479
|
+
if (slope > 0.62) { bucketA = 0.98; bucketW = 1.80; }
|
|
480
|
+
else if (slope > 0.30) { bucketA = 0.60; bucketW = 1.35; }
|
|
481
|
+
else if (slope > 0.11) { bucketA = 0.32; bucketW = 1.00; }
|
|
482
|
+
|
|
483
|
+
// OBSERVATION RESOLUTION (FIELD-SPEC §16): near an unresolved object the sheet's own line
|
|
484
|
+
// cadence loosens — segments dash out, thin and dim. Never the height: mass stays, definition
|
|
485
|
+
// varies. The blend prior keeps the empty medium at full cadence, so a fully resolved field
|
|
486
|
+
// renders exactly as it did before articulation existed.
|
|
487
|
+
let art = fieldSample(vec2f((x0 + x1) * 0.5, by)).b;
|
|
488
|
+
if (art <= 0.85) {
|
|
489
|
+
let dash = (1.0 - art) * 9.0 + 1.5;
|
|
490
|
+
// World-anchored phase (scaled to screen), so the cadence sits still under panning.
|
|
491
|
+
let phase = fract(x0 * k * 0.7 / (dash * 2.2)) * dash * 2.2;
|
|
492
|
+
if (phase > dash * 1.15) {
|
|
493
|
+
var cut: VOut;
|
|
494
|
+
cut.pos = vec4f(-10.0, -10.0, 0.0, 1.0);
|
|
495
|
+
cut.color = vec4f(0.0);
|
|
496
|
+
return cut;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
let artA = 0.34 + 0.66 * art;
|
|
500
|
+
let artW = 0.7 + 0.3 * art;
|
|
501
|
+
|
|
502
|
+
let width = max(0.6, bucketW * artW * min(2.1, k) * P.layer2.x);
|
|
503
|
+
let dir = normalize(vec2f(sx1 - sx0, sy1 - sy0) + vec2f(0.0001, 0.0));
|
|
504
|
+
let nrm = vec2f(-dir.y, dir.x) * (width * 0.5);
|
|
505
|
+
|
|
506
|
+
switch (vi) {
|
|
507
|
+
case 0u: { p = vec2f(sx0, sy0) - nrm; }
|
|
508
|
+
case 1u: { p = vec2f(sx1, sy1) - nrm; }
|
|
509
|
+
case 2u: { p = vec2f(sx1, sy1) + nrm; }
|
|
510
|
+
case 3u: { p = vec2f(sx0, sy0) - nrm; }
|
|
511
|
+
case 4u: { p = vec2f(sx1, sy1) + nrm; }
|
|
512
|
+
default: { p = vec2f(sx0, sy0) + nrm; }
|
|
513
|
+
}
|
|
514
|
+
let rgb = tintMix(vec2f((x0 + x1) * 0.5, by));
|
|
515
|
+
color = vec4f(rgb, bucketA * artA * P.layer.w);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
var out: VOut;
|
|
519
|
+
out.pos = vec4f(p.x / P.view.x * 2.0 - 1.0, 1.0 - p.y / P.view.y * 2.0, 0.0, 1.0);
|
|
520
|
+
out.color = color;
|
|
521
|
+
return out;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
@fragment
|
|
525
|
+
fn fs_main(in: VOut) -> @location(0) vec4f {
|
|
526
|
+
return vec4f(in.color.rgb * in.color.a, in.color.a);
|
|
527
|
+
}
|
|
528
|
+
`,dA=`struct VOut {
|
|
529
|
+
@builtin(position) pos : vec4f,
|
|
530
|
+
@location(0) local : vec2f,
|
|
531
|
+
@location(1) color : vec3f,
|
|
532
|
+
@location(2) weight : f32,
|
|
533
|
+
};
|
|
534
|
+
|
|
535
|
+
fn statusColor(idx: f32) -> vec3f {
|
|
536
|
+
if (idx < 0.5) { return vec3f(240.0, 195.0, 116.0) / 255.0; } // running
|
|
537
|
+
if (idx < 1.5) { return vec3f(150.0, 175.0, 196.0) / 255.0; } // waiting
|
|
538
|
+
if (idx < 2.5) { return vec3f(206.0, 104.0, 90.0) / 255.0; } // failed
|
|
539
|
+
if (idx < 3.5) { return vec3f(180.0, 210.0, 175.0) / 255.0; } // completed
|
|
540
|
+
return vec3f(230.0, 227.0, 219.0) / 255.0; // idle
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
fn statusPulse(idx: f32, t: f32, freq: f32, phase: f32) -> f32 {
|
|
544
|
+
if (idx < 0.5) { return 0.55 + 0.35 * sin(t * freq * 2.0 + phase); }
|
|
545
|
+
if (idx < 1.5) { return 0.40 + 0.08 * sin(t * 0.6); }
|
|
546
|
+
if (idx < 2.5) { return 0.50 + 0.50 * sin(t * 30.0); }
|
|
547
|
+
if (idx < 3.5) { return 0.35; }
|
|
548
|
+
return 0.15;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
@vertex
|
|
552
|
+
fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
|
|
553
|
+
let a = distData[ii * 3u];
|
|
554
|
+
let b = distData[ii * 3u + 1u];
|
|
555
|
+
let k = P.view.z;
|
|
556
|
+
let t = P.view.w;
|
|
557
|
+
|
|
558
|
+
let statusIdx = b.z;
|
|
559
|
+
let failed = select(1.0, 1.3, statusIdx > 1.5 && statusIdx < 2.5);
|
|
560
|
+
let radius = max(2.4, 3.4 * k) * failed * 3.2;
|
|
561
|
+
|
|
562
|
+
let centre = vec2f((a.x - P.rect.x) * k, (a.y - P.rect.y) * k);
|
|
563
|
+
let corner = vec2f(
|
|
564
|
+
select(-1.0, 1.0, (vi == 1u) || (vi == 2u) || (vi == 4u)),
|
|
565
|
+
select(-1.0, 1.0, (vi == 2u) || (vi == 4u) || (vi == 5u))
|
|
566
|
+
);
|
|
567
|
+
let p = centre + corner * radius;
|
|
568
|
+
|
|
569
|
+
var out: VOut;
|
|
570
|
+
out.pos = vec4f(p.x / P.view.x * 2.0 - 1.0, 1.0 - p.y / P.view.y * 2.0, 0.0, 1.0);
|
|
571
|
+
out.local = corner;
|
|
572
|
+
out.color = statusColor(statusIdx);
|
|
573
|
+
// Articulation dims the core's confidence, never the field's mass (FIELD-SPEC §16).
|
|
574
|
+
let artic = distData[ii * 3u + 2u].x;
|
|
575
|
+
out.weight = statusPulse(statusIdx, t, b.x, b.y) * 0.9 * clamp(b.w, 0.0, 1.0)
|
|
576
|
+
* (0.22 + 0.78 * artic);
|
|
577
|
+
return out;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
@fragment
|
|
581
|
+
fn fs_main(in: VOut) -> @location(0) vec4f {
|
|
582
|
+
let d = length(in.local);
|
|
583
|
+
if (d > 1.0) { discard; }
|
|
584
|
+
// Radial falloff matching the design's gradient stops.
|
|
585
|
+
let a = (1.0 - d) * (1.0 - d) * in.weight;
|
|
586
|
+
return vec4f(in.color * a, a);
|
|
587
|
+
}
|
|
588
|
+
`,hA=`// per stratum: startFraction, endFraction, lane, statusIndex
|
|
589
|
+
@group(0) @binding(4) var<storage, read> strataData : array<vec4f>;
|
|
590
|
+
|
|
591
|
+
struct VOut {
|
|
592
|
+
@builtin(position) pos : vec4f,
|
|
593
|
+
@location(0) t : f32,
|
|
594
|
+
@location(1) color : vec3f,
|
|
595
|
+
@location(2) alpha : f32,
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
const STRATA_TOP : f32 = 812.0;
|
|
599
|
+
const STRATA_H : f32 = 360.0;
|
|
600
|
+
const SPAN_X : f32 = 1160.0;
|
|
601
|
+
const MIN_W : f32 = 3.0;
|
|
602
|
+
|
|
603
|
+
@vertex
|
|
604
|
+
fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
|
|
605
|
+
let s = strataData[ii];
|
|
606
|
+
let laneCount = max(1.0, P.grid.z);
|
|
607
|
+
let laneH = STRATA_H / laneCount;
|
|
608
|
+
let top = STRATA_TOP + s.z * laneH;
|
|
609
|
+
|
|
610
|
+
let wx0 = s.x * SPAN_X;
|
|
611
|
+
let wx1 = max(wx0 + MIN_W, s.y * SPAN_X);
|
|
612
|
+
let k = P.view.z;
|
|
613
|
+
|
|
614
|
+
let sx0 = (wx0 - P.rect.x) * k;
|
|
615
|
+
let sx1 = (wx1 - P.rect.x) * k;
|
|
616
|
+
let sy0 = (top - P.rect.y) * k;
|
|
617
|
+
let sy1 = (top + laneH - P.rect.y) * k;
|
|
618
|
+
|
|
619
|
+
let right = (vi == 1u) || (vi == 2u) || (vi == 4u);
|
|
620
|
+
let lower = (vi == 2u) || (vi == 4u) || (vi == 5u);
|
|
621
|
+
let p = vec2f(select(sx0, sx1, right), select(sy0, sy1, lower));
|
|
622
|
+
|
|
623
|
+
// Failed runs read red; otherwise the lane's machine tint.
|
|
624
|
+
var col = massTint(u32(s.z)) / 255.0;
|
|
625
|
+
if (s.w > 1.5 && s.w < 2.5) { col = vec3f(206.0, 104.0, 90.0) / 255.0; }
|
|
626
|
+
|
|
627
|
+
var out: VOut;
|
|
628
|
+
out.pos = vec4f(p.x / P.view.x * 2.0 - 1.0, 1.0 - p.y / P.view.y * 2.0, 0.0, 1.0);
|
|
629
|
+
out.t = select(0.0, 1.0, right);
|
|
630
|
+
out.color = col;
|
|
631
|
+
out.alpha = 0.30;
|
|
632
|
+
return out;
|
|
633
|
+
}
|
|
634
|
+
|
|
635
|
+
@fragment
|
|
636
|
+
fn fs_main(in: VOut) -> @location(0) vec4f {
|
|
637
|
+
// Left-to-right gradient to transparent, as in the approved design.
|
|
638
|
+
let a = in.alpha * (1.0 - in.t);
|
|
639
|
+
return vec4f(in.color * a, a);
|
|
640
|
+
}
|
|
641
|
+
`,c0=8,f0=64,d0=8,h0=16,pA={x0:0,y0:0,x1:1160,y1:812},p0=256;function cu(n){return`
|
|
642
|
+
|
|
643
|
+
`+Wy+`
|
|
644
|
+
|
|
645
|
+
`+n}function mA(n){return`
|
|
646
|
+
|
|
647
|
+
`+Wy+`
|
|
648
|
+
|
|
649
|
+
`+cA+n}const gA=cu(uA),yA=cu(oA),m0=mA(fA),vA=cu(dA),bA=cu(hA),Jy=.34,ev=3.4,g0={zoom:1,cx:580,cy:406},xA=-260,SA=1420,wA=-260,EA=1300,TA=.58,AA=.72,lf=1.7,MA=1.45;function RA(n,i){return n==="strata"?i>AA?"environment":"strata":n==="proximity"?i<MA?"environment":"proximity":i<TA?"strata":i>lf?"proximity":"environment"}function DA(n){return n.width/wn.spanX}function An(n,i){return DA(i)*n.zoom}function hr(n){return n.zoom=Math.max(Jy,Math.min(ev,n.zoom)),n.cx=Math.max(xA,Math.min(SA,n.cx)),n.cy=Math.max(wA,Math.min(EA,n.cy)),n}function CA(n,i,s){const l=An(n,i),u=i.width/l,f=i.height/l;return s.x0=n.cx-u/2,s.y0=n.cy-f/2,s.x1=n.cx+u/2,s.y1=n.cy+f/2,s}function uf(n,i,s,l){const u=An(s,l),f=l.width/u,d=l.height/u;return[s.cx-f/2+n/u,s.cy-d/2+i/u]}function Bc(n,i,s,l){const u=An(s,l),f=l.width/u,d=l.height/u;return[(n-(s.cx-f/2))*u,(i-(s.cy-d/2))*u]}function Gc(n,i,s,l,u){const[f,d]=uf(s,l,n,u);n.zoom=Math.max(Jy,Math.min(ev,n.zoom*i));const h=An(n,u);n.cx=f-s/h+u.width/h/2,n.cy=d-l/h+u.height/h/2,hr(n)}function y0(n,i,s,l){const u=An(n,l);n.cx+=i/u,n.cy+=s/u,hr(n)}function OA(n,i,s,l=7){const u=1-Math.exp(-l*s),f=i.zoom-n.zoom,d=i.cx-n.cx,h=i.cy-n.cy;n.zoom+=f*u,n.cx+=d*u,n.cy+=h*u;const m=Math.abs(f)<.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 zA(n,i,s){return hr({zoom:s,cx:n,cy:i})}const Bl=120,_A="field",UA=5,NA=2,v0=30;class kA{intervalMs=new Float32Array(Bl);cpuMs=new Float32Array(Bl);cursor=0;filled=0;lastFrameAt=0;frames=0;lastIntervalMs=0;lastCpuMs=0;gpuMs={};disturbances=0;fps=0;resolutionScale=1;get canAdapt(){return this.bakeSamples>0}lastEvalAt=0;pendingResize=!1;bakeSum=0;bakeSamples=0;sample(i,s,l){const u=this.gpuMs[_A];if(u!==void 0&&u>0&&(this.bakeSum+=u,this.bakeSamples++),this.lastFrameAt>0){const f=i-this.lastFrameAt;this.intervalMs[this.cursor]=f,this.cpuMs[this.cursor]=s,this.cursor=(this.cursor+1)%Bl,this.filled<Bl&&this.filled++,this.lastIntervalMs=f}this.lastFrameAt=i,this.lastCpuMs=s,this.frames++,this.disturbances=l,this.fps=this.averageInterval>0?1e3/this.averageInterval:0,this.maybeAdapt(i)}resetPacing(){this.lastFrameAt=0}get averageInterval(){if(this.filled===0)return 0;let i=0;for(let s=0;s<this.filled;s++)i+=this.intervalMs[s];return i/this.filled}get averageCpuMs(){if(this.filled===0)return 0;let i=0;for(let s=0;s<this.filled;s++)i+=this.cpuMs[s];return i/this.filled}get totalGpuMs(){let i=0;for(const s in this.gpuMs)i+=this.gpuMs[s];return i}bakeCost(){return this.bakeSamples<v0?0:this.bakeSum/this.bakeSamples}maybeAdapt(i){if(i-this.lastEvalAt<2e3||this.filled<45)return;const s=this.bakeCost();this.bakeSamples<v0||(this.lastEvalAt=i,this.bakeSum=0,this.bakeSamples=0,!(s<=0)&&(s>UA&&this.resolutionScale>.5?(this.resolutionScale=Math.max(.5,this.resolutionScale-.15),this.pendingResize=!0):s<NA&&this.resolutionScale<1&&(this.resolutionScale=Math.min(1,this.resolutionScale+.1),this.pendingResize=!0)))}wantsResize(){return this.pendingResize?(this.pendingResize=!1,!0):!1}snapshot(){return{fps:this.fps,intervalMs:this.averageInterval,cpuMs:this.averageCpuMs,gpuMs:this.totalGpuMs,frames:this.frames,scale:this.resolutionScale,disturbances:this.disturbances}}}const Pn=[{rows:22,step:11,amp:.5,alpha:.4,lw:.75,dz:-190,px:44,fill:[5,6,8,.9]},{rows:14,step:9,amp:.74,alpha:.72,lw:.9,dz:-92,px:18,fill:[5,6,8,.94]},{rows:9,step:7.5,amp:1,alpha:1,lw:1,dz:0,px:0,fill:[4,5,7,.965]}],b0={running:0,waiting:1,failed:2,completed:3,idle:4},x0={laptop:[214,176,116],desktop:[168,186,150],server:[150,190,175]},S0=512,LA=[3,2,2],w0=0,E0=1,Ji=2,T0=1,A0=2,jA=4,BA=1600,M0=.004;function GA(n){return n.msSinceInteraction<BA?T0:n.couplings>0||n.maxEnergy>M0?A0:n.maxSettling>M0?jA:n.dirty?T0:1/0}class $A{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(c0*3*4);distArr=new Float32Array(f0*3*4);coupArr=new Float32Array(d0*4);strataArr=new Float32Array(S0*4);plinthArr=new Float32Array(h0*3*4);rect={x0:0,y0:0,x1:0,y1:0};landscape={time:0,masses:[],disturbances:[],plinths:[],couplings:[],strata:[]};massIndex=new Map;runtime=new Map;plinthRuntime=new Map;plinthStatics=new Map;frameSubscribers=new Set;generation=0;lastInstances=0;strataCount=0;disturbanceCount=0;couplingCount=0;massCount=0;plinthCount=0;raf=0;refreshCount=0;lastStride=1;lastDrawnAt=0;nextDrawAt=0;dirty=!0;running=!1;lastFrameAt=0;simTime=0;lastInteractionAt=0;disposed=!1;landscapeDirty=!0;perf=new kA;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 o0({requiredFeatures:["timestamp-query"]})}catch{return await o0()}}),!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 f=aA(this.gpu);this.gpuTimer=f,this.spans={residue:f.span("residue"),field:f.span("field"),sheet:f.span("sheet"),overlay:f.span("overlay")},this.layerSpans=[0,1,2].map(d=>f.span(`sheet${d}`)),f.onResults(d=>{this.perf.gpuMs=d,this.probe?.noteGpu(d)}),this.probe?.note("timestamp-query available")}catch(f){this.gpuTimer=null,this.spans=null,this.layerSpans=[],this.probe?.note(`timestamp-query unavailable: ${f instanceof Error?f.message:String(f)}`)}if(this.headless)this.output=a0(this.gpu,{size:[this.headless.width,this.headless.height],format:"rgba8unorm"});else{const f=this.canvas;await IA(f);const d=Math.min(this.maxDpr,globalThis.devicePixelRatio||1),[h,m]=this.cssSize();f.width=Math.round(h*d),f.height=Math.round(m*d),this.surf=CE(this.gpu,f,{dpr:d,autoResize:!0}),this.output=this.surf,this.view.width=h,this.view.height=m}this.residue=KT(this.gpu,p0,p0,{format:"rgba16float"});const[i,s]=this.fieldSize();this.fieldTarget=a0(this.gpu,{size:[i,s],format:"rgba16float"}),this.paramsBufs=Array.from({length:5},()=>Ya(this.gpu,this.params.byteLength,"read")),this.massBuf=Ya(this.gpu,this.massArr.byteLength,"read"),this.distBuf=Ya(this.gpu,this.distArr.byteLength,"read"),this.coupBuf=Ya(this.gpu,this.coupArr.byteLength,"read"),this.strataBuf=Ya(this.gpu,this.strataArr.byteLength,"read"),this.plinthBuf=Ya(this.gpu,this.plinthArr.byteLength,"read");const l=YE(this.gpu,{minFilter:"linear",magFilter:"linear"});this.linearSampler=l,this.residueFx=i0(this.gpu,gA,{set:{P:this.paramsBufs[w0],massData:this.massBuf,distData:this.distBuf,coupData:this.coupBuf,prevTex:this.residue.read,prevSamp:l}}),this.fieldFx=i0(this.gpu,yA,{set:{P:this.paramsBufs[E0],massData:this.massBuf,distData:this.distBuf,coupData:this.coupBuf,residueTex:this.residue.read,residueSamp:l,plinthData:this.plinthBuf}}),this.sheetDraw=Ll(this.gpu,{shader:m0,vertices:6,blend:"premultiplied",set:{P:this.paramsBufs[Ji],massData:this.massBuf,fieldTex:this.fieldTarget,fieldSamp:l}}),this.coresDraw=Ll(this.gpu,{shader:vA,vertices:6,blend:"additive",set:{P:this.paramsBufs[Ji],distData:this.distBuf}}),this.strataDraw=Ll(this.gpu,{shader:bA,vertices:6,blend:"premultiplied",set:{P:this.paramsBufs[Ji],massData:this.massBuf,strataData:this.strataBuf}});const u={colors:[this.output.format]};await Promise.all([this.residueFx.compile(this.residue.write),this.fieldFx.compile(this.fieldTarget),this.sheetDraw.compile(u),this.coresDraw.compile(u),this.strataDraw.compile(u)])}cssSize(){const i=this.canvas;if(!i)return[this.headless.width,this.headless.height];const s=i.parentElement,l=i.clientWidth||s?.clientWidth||1280,u=i.clientHeight||s?.clientHeight||720;return[Math.max(1,l),Math.max(1,u)]}fieldSize(){const i=this.perf.resolutionScale,s=this.headless?.width??this.canvas?.clientWidth??640,l=this.headless?.height??this.canvas?.clientHeight??480,u=Math.max(160,Math.round(Math.min(768,s)*i)),f=Math.max(120,Math.round(Math.min(576,l)*i));return[u,f]}attachProbe(i){this.probe=i}setLandscape(i){const s=this.probe?performance.now():0;this.landscape=i,this.landscapeDirty=!0,this.generation++,this.probe&&(this.probe.landscapes++,queueMicrotask(()=>this.probe?.landscapeMs.push(performance.now()-s)));const l=this.generation;for(const u of i.disturbances){let f=this.runtime.get(u.id);f||(f={energy:0,target:u.energy,status:u.status,statusSince:u.statusSince,seen:l,extent:u.extent,toExtent:u.extent},this.runtime.set(u.id,f)),f.target=u.energy,f.status=u.status,f.statusSince=u.statusSince,f.seen=l,f.toExtent=u.extent}for(const[u,f]of this.runtime)f.seen!==l&&(f.target=0,f.energy<.002&&this.runtime.delete(u));for(const u of i.plinths){let f=this.plinthRuntime.get(u.id);f||(f={presence:0,target:u.presence,x:u.x,y:u.y,extentX:u.extentX,extentY:u.extentY,toX:u.x,toY:u.y,toExtentX:u.extentX,toExtentY:u.extentY,seen:l},this.plinthRuntime.set(u.id,f)),f.target=u.presence,f.toX=u.x,f.toY=u.y,f.toExtentX=u.extentX,f.toExtentY=u.extentY,f.seen=l,this.plinthStatics.set(u.id,u)}for(const[u,f]of this.plinthRuntime)f.seen!==l&&(f.target=0,f.presence<.002&&(this.plinthRuntime.delete(u),this.plinthStatics.delete(u)))}noteInteraction(){this.lastInteractionAt=performance.now(),this.dirty=!0}onFrame(i){return this.frameSubscribers.add(i),()=>this.frameSubscribers.delete(i)}start(){if(this.running||this.disposed)return;this.running=!0,this.lastFrameAt=performance.now(),this.refreshCount=0,this.nextDrawAt=0;const i=s=>{if(!this.running)return;this.raf=requestAnimationFrame(i),this.refreshCount++;const l=this.currentStride(s);if(this.probe?.noteRefresh(s,l),l===1/0){this.perf.resetPacing(),this.lastDrawnAt=0,this.lastFrameAt=s,this.nextDrawAt=this.refreshCount+1;return}if(this.refreshCount<this.nextDrawAt)return;this.nextDrawAt=this.refreshCount+l;const u=s-this.lastFrameAt;this.lastFrameAt=s,this.lastStride=l;const f=this.probe?.debug.fixedDt??null,d=f!==null?f:Math.min(.1,u/1e3);this.renderFrame(d)};this.raf=requestAnimationFrame(i)}stop(){this.running=!1,this.raf&&cancelAnimationFrame(this.raf),this.raf=0}invalidate(){this.dirty=!0}currentStride(i){let s=0,l=0;for(const u of this.runtime.values()){u.energy>s&&(s=u.energy);const f=Math.abs(u.target-u.energy);f>l&&(l=f);const d=Math.abs(u.toExtent-u.extent);d>l&&(l=d)}for(const u of this.plinthRuntime.values()){const f=Math.abs(u.target-u.presence);f>l&&(l=f)}return GA({dirty:this.dirty||this.landscapeDirty,msSinceInteraction:i-this.lastInteractionAt,couplings:this.couplingCount,maxEnergy:s,maxSettling:l})}stepPhysics(i){const s=this.simTime;for(const l of this.runtime.values()){let u=l.target;if(l.status==="failed"){const d=Math.max(0,s-l.statusSince/1e3);d<1.4?u=l.target*(1+.45*Math.sin(d*44)):u=l.target*Math.max(0,1-(d-1.4)/2.2)*.22}const f=u>l.energy?2.6:1.1;l.energy+=(u-l.energy)*(1-Math.exp(-f*i)),l.energy<5e-4&&u===0&&(l.energy=0),l.extent+=(l.toExtent-l.extent)*(1-Math.exp(-3*i))}for(const l of this.plinthRuntime.values()){const u=l.target>l.presence?1.8:.9;l.presence+=(l.target-l.presence)*(1-Math.exp(-u*i)),l.presence<5e-4&&l.target===0&&(l.presence=0);const f=1-Math.exp(-3*i);l.x+=(l.toX-l.x)*f,l.y+=(l.toY-l.y)*f,l.extentX+=(l.toExtentX-l.extentX)*f,l.extentY+=(l.toExtentY-l.extentY)*f}}packStatics(){const{masses:i,couplings:s,strata:l}=this.landscape;this.massIndex.clear(),this.massArr.fill(0),this.massCount=Math.min(i.length,c0);for(let u=0;u<this.massCount;u++){const f=i[u];this.massIndex.set(f.id,u);const d=u*12;this.massArr[d+0]=f.x,this.massArr[d+1]=f.y,this.massArr[d+2]=f.extentX,this.massArr[d+3]=f.extentY;const h=f.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+f.seed*.12,this.massArr[d+8]=f.seed*Math.PI*2;const m=x0[f.kind]??x0.laptop;this.massArr[d+9]=m[0],this.massArr[d+10]=m[1],this.massArr[d+11]=m[2]}this.massBuf.write(this.massArr),this.coupArr.fill(0),this.couplingCount=0;for(const u of s){if(this.couplingCount>=d0)break;const f=this.massIndex.get(u.fromMassId),d=this.massIndex.get(u.toMassId);if(f===void 0||d===void 0)continue;const h=this.couplingCount*4;this.coupArr[h+0]=f,this.coupArr[h+1]=d,this.coupArr[h+2]=u.energy,this.couplingCount++}this.coupBuf.write(this.coupArr),this.strataArr.fill(0),this.strataCount=Math.min(l.length,S0);for(let u=0;u<this.strataCount;u++){const f=l[u],d=u*4;this.strataArr[d+0]=f.startFraction,this.strataArr[d+1]=f.endFraction,this.strataArr[d+2]=Math.min(f.lane,this.massCount-1),this.strataArr[d+3]=b0[f.status]}this.strataBuf.write(this.strataArr)}packDisturbances(){this.distArr.fill(0);let i=0;for(const s of this.landscape.disturbances){if(i>=f0)break;const l=this.runtime.get(s.id),u=l?l.energy:s.energy;if(u<=5e-4)continue;const f=l?l.extent:s.extent,d=30+f*44,h=d*(.62+.22*f),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*u,this.distArr[m+4]=.9+s.rate*1.15,this.distArr[m+5]=s.phase,this.distArr[m+6]=b0[s.status],this.distArr[m+7]=u,this.distArr[m+8]=s.articulation,this.distArr[m+9]=s.shoulder,i++}this.disturbanceCount=i,this.distBuf.write(this.distArr)}packPlinths(){this.plinthArr.fill(0);const i=[];let s=0;for(const[l,u]of this.plinthRuntime){if(s>=h0)break;if(u.presence<=5e-4)continue;const f=this.plinthStatics.get(l);if(!f)continue;const d=s*12;this.plinthArr[d+0]=u.x,this.plinthArr[d+1]=u.y,this.plinthArr[d+2]=u.extentX,this.plinthArr[d+3]=u.extentY,this.plinthArr[d+4]=u.presence,this.plinthArr[d+5]=f.articulation,this.plinthArr[d+7]=f.empty?1:0,this.plinthArr[d+8]=f.shoulder,i.push({id:l,parentId:f.parentId}),s++}for(let l=0;l<i.length;l++){const u=i[l].parentId,f=u?i.findIndex(d=>d.id===u):-1;this.plinthArr[l*12+6]=f+1,this.plinthArr[l*12+9]=f>=0?1:0}this.plinthCount=s,this.plinthBuf.write(this.plinthArr)}packParams(i,s,l,u){const f=this.params,d=An(this.camera,this.view);f[0]=this.rect.x0,f[1]=this.rect.y0,f[2]=this.rect.x1,f[3]=this.rect.y1,f[4]=this.view.width,f[5]=this.view.height,f[6]=d,f[7]=this.simTime,f[8]=this.massCount,f[9]=this.disturbanceCount,f[10]=this.couplingCount,f[11]=s;const h=Pn[u]??Pn[0];f[12]=h.rows,f[13]=h.step,f[14]=h.amp,f[15]=h.alpha,f[16]=h.lw,f[17]=h.dz,f[18]=h.px,f[19]=1,f[20]=this.colsFor(h.step,d),f[21]=this.rowsFor(h.rows,d),f[22]=Math.max(1,this.massCount),f[23]=this.plinthCount,f[24]=h.fill[0]/255*h.fill[3],f[25]=h.fill[1]/255*h.fill[3],f[26]=h.fill[2]/255*h.fill[3],f[27]=h.fill[3],f[28]=l.x0,f[29]=l.y0,f[30]=l.x1,f[31]=l.y1;const m=i>=Ji?LA[u]??0:0;f[32]=this.probe?.debug.fillReach??m,f[33]=0,f[34]=0,f[35]=0,this.paramsBufs[i].write(f)}colsFor(i,s){const l=i/s,u=this.rect.x1-this.rect.x0+l*4;return Math.max(2,Math.min(1024,Math.ceil(u/l)))}rowsFor(i,s){const l=i/s,f=Math.min(this.rect.y1,832)+90/s-(this.rect.y0-l*.6);return Math.max(2,Math.min(512,Math.ceil(f/l)))}renderOnce(i){this.renderFrame(Math.min(.25,i))}async debugField(){const i=await this.fieldTarget.readFloats();let s=1/0,l=-1/0,u=0;for(let f=0;f<i.length;f+=4){const d=i[f];Number.isNaN(d)?u++:(d<s&&(s=d),d>l&&(l=d))}return{min:s,max:l,nan:u,sample:Array.from(i.slice(0,16))}}stats(){return{runtimeEntries:this.runtime.size,disturbances:this.disturbanceCount,plinths:this.plinthCount,strata:this.strataCount,couplings:this.couplingCount,instances:this.lastInstances}}renderFrame(i){if(this.disposed)return;const s=performance.now();if(this.simTime+=i,hr(this.camera),this.headless){const[O,j]=this.output.size;this.view.width=O,this.view.height=j}else{const O=this.canvas;if(O&&(O.clientWidth===0||O.clientHeight===0)){this.perf.resetPacing(),this.lastDrawnAt=0;return}const[j,X]=this.cssSize();if(j!==this.view.width||X!==this.view.height){this.view.width=j,this.view.height=X;const Q=Math.min(this.maxDpr,globalThis.devicePixelRatio||1);this.canvas.width=Math.round(j*Q),this.canvas.height=Math.round(X*Q),this.surf?.resize([j,X]);const[H,U]=this.fieldSize();this.fieldTarget.resize([H,U]),this.probe&&(this.probe.canvasResizes++,this.probe.note(`canvas ${j}×${X} css → ${O?.width}×${O?.height}, field ${H}×${U}`))}}CA(this.camera,this.view,this.rect),this.stepPhysics(i),this.landscapeDirty&&(this.packStatics(),this.landscapeDirty=!1),this.packDisturbances(),this.packPlinths();const l=(this.rect.x1-this.rect.x0)*.12,u=(this.rect.y1-this.rect.y0)*.16,f={x0:this.rect.x0-l,y0:this.rect.y0-u,x1:this.rect.x1+l,y1:this.rect.y1+u},d=An(this.camera,this.view);this.packParams(w0,i,pA,0),this.packParams(E0,i,f,0);for(let O=0;O<Pn.length;O++)this.packParams(Ji+O,i,f,O);const h=this.probe?this.probe.debug:null,m=h&&(h.skipFill||h.skipLine)?this.sheetVariantDraw(h):this.sheetDraw,g=this.probe?performance.now():0;let b=0;const x=[];zT(this.gpu,O=>{h?.skipResidue||(this.residueFx.set({prevTex:this.residue.read}),O.pass(this.spans?{target:this.residue.write,clear:!1,timer:this.spans.residue}:{target:this.residue.write,clear:!1},this.residueFx),b++),h?.skipField||(this.fieldFx.set({residueTex:this.residue.write}),O.pass(this.spans?{target:this.fieldTarget,clear:!0,timer:this.spans.field}:{target:this.fieldTarget,clear:!0},this.fieldFx),b++);let j=0;const X=(H,U)=>{const J=Pn[U],W=this.colsFor(J.step,d),A=this.rowsFor(J.rows,d),w=W*A*2;this.probe&&x.push({cols:W,rows:A,instances:w}),!(h&&!h.layers[U])&&(j+=w,m.set({P:this.paramsBufs[Ji+U]}),H.draw(m,{instances:w}))},Q=[.024,.027,.035,1];if(h?.splitLayers&&this.layerSpans.length===Pn.length){for(let H=0;H<Pn.length;H++)O.pass(H===0?{target:this.output,clear:Q,timer:this.layerSpans[H]}:{target:this.output,clear:!1,timer:this.layerSpans[H]},U=>X(U,H)),b++;O.pass(this.spans?{target:this.output,clear:!1,timer:this.spans.overlay}:{target:this.output,clear:!1},H=>{this.strataCount>0&&!h?.skipStrata&&H.draw(this.strataDraw,{instances:this.strataCount}),this.disturbanceCount>0&&!h?.skipCores&&H.draw(this.coresDraw,{instances:this.disturbanceCount})}),b++}else O.pass(this.spans?{target:this.output,clear:Q,timer:this.spans.sheet}:{target:this.output,clear:Q},H=>{for(let U=0;U<Pn.length;U++)X(H,U);this.strataCount>0&&!h?.skipStrata&&H.draw(this.strataDraw,{instances:this.strataCount}),this.disturbanceCount>0&&!h?.skipCores&&H.draw(this.coresDraw,{instances:this.disturbanceCount})}),b++;this.lastInstances=j+this.strataCount+this.disturbanceCount}),this.residue.swap(),this.dirty=!1;const R=this.probe?performance.now():0;if(!h?.skipSubscribers)for(const O of this.frameSubscribers)O(this.view);const $=performance.now(),L=this.lastDrawnAt>0?s-this.lastDrawnAt:0;if(this.lastDrawnAt=s,this.perf.sample(s,$-s,this.disturbanceCount),this.probe&&(this.probe.noteFrame({interval:L,stride:this.lastStride,prep:g-s,encode:R-g,post:$-R,total:$-s}),this.captureScene(b,x)),this.perf.wantsResize()){const[O,j]=this.fieldSize(),[X,Q]=this.fieldTarget.size;(O!==X||j!==Q)&&(this.fieldTarget.resize([O,j]),this.probe&&(this.probe.fieldResizes++,this.probe.note(`field texture ${X}×${Q} → ${O}×${j} (scale ${this.perf.resolutionScale.toFixed(2)})`)))}}sheetVariantDraw(i){const s=`${i.skipFill?"F":""}${i.skipLine?"L":""}`;let l=this.sheetVariants.get(s);return!l&&this.probe&&(l=Ll(this.gpu,{shader:this.probe.sheetVariant(m0,{skipFill:i.skipFill,skipLine:i.skipLine}),vertices:6,blend:"premultiplied",set:{P:this.paramsBufs[Ji],massData:this.massBuf,fieldTex:this.fieldTarget,fieldSamp:this.linearSampler}}),this.sheetVariants.set(s,l),this.probe.note(`sheet variant '${s}' compiled`)),l??this.sheetDraw}captureScene(i,s){if(!this.probe)return;const l=this.view.width,u=this.view.height,f=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 b=0;b<Pn.length;b++){const R=Pn[b].rows/h,$=this.rect.y0-R*.6,L=s[b]?.rows??0;for(let O=0;O<L;O++){const j=($+O*R-this.rect.y0)*h;j<u&&(m+=(u-Math.max(0,j))/u)}}let g=0;for(const b of s)g+=b.instances;this.probe.scene={cssW:l,cssH:u,canvasW:f,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*f*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 IA(n,i=2e3){return n.clientWidth>0&&n.clientHeight>0?Promise.resolve():new Promise(s=>{let l=!1;const u=()=>{l||(l=!0,f.disconnect(),clearTimeout(d),s())},f=new ResizeObserver(()=>{n.clientWidth>0&&n.clientHeight>0&&u()});f.observe(n);const d=setTimeout(u,i)})}const q={bg:"#050608",ink:"#e6e3db",accent:"#d9a441",accentBright:"#f0c374",hoverInk:"#f5cf8b",panel:"rgba(7,8,11,0.94)",panelBorder:"rgba(230,227,219,0.4)",hairline:"rgba(230,227,219,0.14)",chrome:"rgba(230,227,219,0.62)",chromeDim:"rgba(230,227,219,0.4)",chromeMid:"rgba(230,227,219,0.7)",chromeStrong:"rgba(230,227,219,0.82)",body:"rgba(230,227,219,0.88)"},at={running:"rgba(240,195,116,0.85)",waiting:"rgba(150,175,196,0.85)",failed:"rgba(206,104,90,0.9)",completed:"rgba(180,210,175,0.75)",idle:"rgba(230,227,219,0.62)"},Et="'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace",Za="0 0 6px rgba(5,6,8,0.95)",VA={backgroundImage:"radial-gradient(rgba(230,227,219,0.05) 0.5px, rgba(0,0,0,0) 0.6px)",backgroundSize:"3px 3px"},FA={background:"radial-gradient(96% 82% at 44% 56%, rgba(0,0,0,0) 42%, rgba(3,3,5,0.9) 100%)"},HA={background:"linear-gradient(to bottom, rgba(6,8,11,0.7), rgba(6,8,11,0))"};let $c=Promise.resolve();function qA({landscape:n,onHover:i,onSelect:s,anchor:l,children:u,onBand:f,onReady:d,depth:h,overlay:m,inset:g,keepVisible:b,compact:x=!1}){const R=K.useRef(null),$=K.useRef(null),L=K.useRef(null),O=K.useRef({...g0}),j=K.useRef(n),X=K.useRef(new Map),Q=K.useRef(null),H=K.useRef(null),U=K.useRef(null),J=K.useRef(null),W=K.useRef(null),A=K.useRef(new Map),w=K.useRef(null),G=K.useRef({key:"",w:0,h:0,label:!1}),[te,ne]=K.useState("init"),[le,Ge]=K.useState(null),[de,oe]=K.useState("environment"),[z,Y]=K.useState([]),[ae,be]=K.useState("grab");j.current=n,K.useEffect(()=>{const ee=$.current;if(!ee)return;let P=!1,ye=null;const Ce=$c.then(async()=>{if(!P){if(ye=new $A({canvas:ee,camera:O.current}),await ye.init(),P){ye.dispose(),ye=null;return}L.current=ye,ye.setLandscape(j.current),ye.start(),ne("ready"),d?.(ye)}}).catch(Qe=>{P||(Ge(Qe instanceof Error?Qe.message:String(Qe)),ne("failed"))});return $c=Ce,()=>{P=!0,L.current=null,$c=Ce.then(()=>{ye?.dispose(),ye=null})}},[]),K.useEffect(()=>{L.current?.setLandscape(n)},[n]),K.useEffect(()=>{const ee=[];for(const P of n.masses)ee.push({id:`mass:${P.id}`,wx:P.x,wy:P.y+P.extentY+26,text:P.name,color:"rgba(230,227,219,0.78)",size:10});if(de==="proximity"){for(const P of n.disturbances)P.energy<.02&&P.status!=="completed"||ee.push({id:`dist:${P.id}`,wx:P.x,wy:P.y-30-P.extent*40,text:`${P.label} · ${P.status}`,color:at[P.status],size:9});for(const P of n.plinths)ee.push({id:`plinth:${P.id}`,wx:P.x,wy:P.y-P.extentY-16,text:`${P.parentId?"└ ":""}${P.label}${P.observers>1?` · ${P.observers} obs`:""}`,color:`rgba(240,195,116,${(.16+.5*P.articulation).toFixed(2)})`,size:9})}Y(ee)},[n,de]),K.useLayoutEffect(()=>{const ee=L.current;if(!ee)return;let P=0;const ye=Ce=>{const Qe=O.current,Pe=performance.now(),Qt=P===0?1/60:Math.min(.1,(Pe-P)/1e3);P=Pe,J.current&&(OA(Qe,J.current,Qt)&&(J.current=null),ee.noteInteraction());const Ve=RA(De.current,Qe.zoom);Ve!==De.current&&(De.current=Ve,oe(Ve),f?.(Ve));for(const[Tt,ft]of X.current){const qe=k.current.get(Tt);if(!qe)continue;const[St,tt]=Bc(qe.wx,qe.wy,Qe,Ce),_i=St>-200&&St<Ce.width+200&&tt>-80&&tt<Ce.height+80;ft.style.visibility=_i?"visible":"hidden",ft.style.transform=`translate3d(${St}px, ${tt}px, 0) translate(-50%, -100%)`}const pn=Q.current,xt=T.current;if(pn&&xt){const[Tt,ft]=Bc(xt.x,xt.y,Qe,Ce),qe=pn.firstElementChild;qe&&G.current.key!==xt.id&&(G.current={key:xt.id,w:qe.offsetWidth,h:qe.offsetHeight,label:qe.dataset.anchorPlacement==="label"});const{w:St,h:tt,label:_i}=G.current;let Ui=_i?-St/2:18,ls=_i?-tt-14:-tt/2;!_i&&Tt+Ui+St>Ce.width-12&&(Ui=-St-18),Ui=Math.max(12-Tt,Ui),ls=Math.min(Math.max(12-ft,ls),Ce.height-12-tt-ft),pn.style.transform=`translate3d(${Tt+Ui}px, ${ft+ls}px, 0)`,pn.style.visibility=Tt>-300&&Tt<Ce.width+300&&ft>-300&&ft<Ce.height+300?"visible":"hidden"}const Lt=Qe.cy+Ce.height/An(Qe,Ce)/2,Rn=Lt>wn.strataTop+40,la=Lt>wn.strataTop+wn.strataHeight*.7,Dn=H.current,zi=Dn?.querySelector("[data-depth-label]");if(zi){const Tt=Rn?la?"FIELD — TODAY":"FIELD — SURFACE + TODAY":"FIELD — LIVE";zi.textContent!==Tt&&(zi.textContent=Tt)}if(Dn){const Tt=Dn.querySelector("[data-depth-summary]"),ft=Dn.querySelector("[data-depth-deep]");if(Tt&&(Tt.style.display=Rn?"inline-flex":"none"),ft){const qe=ft.dataset.depthSuppressed==="true";ft.style.display=la&&!qe?"block":"none"}}};return ee.onFrame(ye)},[te,f]);const De=K.useRef("environment"),T=K.useRef(null),k=K.useRef(new Map);T.current=l,K.useEffect(()=>{k.current=new Map(z.map(ee=>[ee.id,ee]))},[z]);const F=K.useCallback(()=>{const ee=R.current;return{width:ee?.clientWidth??1,height:ee?.clientHeight??1}},[]),Z=g?.right??0,ue=g?.bottom??0,he=b?.id??null,me=b?.x??0,$e=b?.y??0;K.useEffect(()=>{const ee=L.current;if(!ee||!he||Z===0&&ue===0)return;const P=F(),ye={...J.current??O.current},Ce=An(ye,P);if(Ce<=0)return;const[Qe,Pe]=Bc(me,$e,ye,P);let Qt=!1;if(Z>0){const Ve=P.width-Z-40;Qe>Ve&&(ye.cx+=(Qe-(P.width-Z)/2)/Ce,Qt=!0)}if(ue>0){const Ve=P.height-ue-40;Pe>Ve&&(ye.cy+=(Pe-(Ve-60))/Ce,Qt=!0)}Pe<70&&(ye.cy-=(110-Pe)/Ce,Qt=!0),Qt&&(J.current=hr(ye),ee.noteInteraction())},[he,me,$e,Z,ue,F]);const Re=K.useCallback(ee=>{const P=R.current.getBoundingClientRect();return[ee.clientX-P.left,ee.clientY-P.top]},[]),hn=K.useCallback(ee=>{const P=L.current;if(!P)return;const[ye,Ce]=Re(ee);J.current=null,ee.ctrlKey||ee.metaKey?Gc(O.current,Math.exp(-ee.deltaY*.012),ye,Ce,F()):y0(O.current,ee.deltaX,ee.deltaY,F()),P.noteInteraction()},[Re,F]);K.useEffect(()=>{const ee=R.current;if(!ee)return;const P=ye=>ye.preventDefault();return ee.addEventListener("wheel",P,{passive:!1}),()=>ee.removeEventListener("wheel",P)},[]);const Mn=K.useCallback(ee=>{const P=Re(ee);ee.isPrimary&&A.current.clear(),A.current.set(ee.pointerId,P),J.current=null;try{R.current?.setPointerCapture(ee.pointerId)}catch{}if(A.current.size===1)U.current={x:P[0],y:P[1],moved:!1},be("grabbing");else if(A.current.size===2){const[ye,Ce]=[...A.current.values()];w.current={distance:Math.hypot(ye[0]-Ce[0],ye[1]-Ce[1]),zoom:O.current.zoom},U.current=null}L.current?.noteInteraction()},[Re]),Oi=K.useCallback(ee=>{const P=L.current;if(!P)return;const ye=Re(ee),Ce=A.current.has(ee.pointerId);Ce&&A.current.set(ee.pointerId,ye);const Qe=w.current;if(Qe&&A.current.size>=2){const[xt,Lt]=[...A.current.values()],Rn=Math.hypot(xt[0]-Lt[0],xt[1]-Lt[1]),la=(xt[0]+Lt[0])/2,Dn=(xt[1]+Lt[1])/2,zi=Qe.zoom*(Rn/Math.max(12,Qe.distance));Gc(O.current,zi/O.current.zoom,la,Dn,F()),P.noteInteraction();return}const Pe=U.current;if(Ce&&Pe){const xt=ye[0]-Pe.x,Lt=ye[1]-Pe.y;(Math.abs(xt)>4||Math.abs(Lt)>4)&&(Pe.moved=!0),y0(O.current,-xt,-Lt,F()),Pe.x=ye[0],Pe.y=ye[1],P.noteInteraction();return}if(ee.pointerType==="touch")return;const[Qt,Ve]=uf(ye[0],ye[1],O.current,F()),pn=qm(j.current,Qt,Ve);be(pn?"pointer":"grab"),(pn||W.current)&&P.noteInteraction(),W.current=pn,i(pn)},[Re,i,F]),Mt=K.useCallback(ee=>{const P=A.current.get(ee.pointerId)??Re(ee);A.current.delete(ee.pointerId),A.current.size<2&&(w.current=null);const ye=U.current;if(U.current=null,be("grab"),!ye||ye.moved)return;const[Ce,Qe]=uf(P[0],P[1],O.current,F()),Pe=qm(j.current,Ce,Qe);if(s(Pe),Pe&&Pe.kind!=="stratum"){const Qt=Pe.kind==="mass"?lf:lf+.5;J.current=zA(Pe.x,Pe.y,Math.max(O.current.zoom,Qt))}L.current?.noteInteraction()},[Re,s,F]),kt=K.useCallback(()=>{U.current=null,w.current=null,A.current.clear(),be("grab")},[]),Ee=K.useCallback(()=>{J.current={...g0},L.current?.noteInteraction(),s(null)},[s]),Kt=K.useCallback(ee=>{const P=F();Gc(O.current,ee,P.width/2,P.height/2,P),L.current?.noteInteraction()},[F]);return v.jsxs("div",{style:{position:"relative",flex:1,minHeight:0},children:[v.jsxs("div",{ref:R,onWheel:hn,onPointerDown:Mn,onPointerMove:Oi,onPointerUp:Mt,onPointerCancel:Mt,onLostPointerCapture:ee=>{A.current.delete(ee.pointerId),A.current.size<2&&(w.current=null)},onPointerLeave:ee=>{ee.pointerType!=="touch"&&(kt(),i(null))},style:{position:"absolute",inset:0,overflow:"hidden",background:q.bg,cursor:ae},children:[v.jsx("canvas",{ref:$,style:{display:"block",width:"100%",height:"100%"}}),v.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",...VA}}),v.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",...FA}}),v.jsx("div",{style:{position:"absolute",left:0,right:0,top:0,height:"16%",pointerEvents:"none",...HA}}),v.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[z.map(ee=>v.jsx("div",{ref:P=>{P?X.current.set(ee.id,P):X.current.delete(ee.id)},style:{position:"absolute",left:0,top:0,willChange:"transform",visibility:"hidden",fontFamily:Et,fontSize:ee.size,letterSpacing:"0.22em",color:ee.color,whiteSpace:"nowrap",textTransform:"uppercase"},children:ee.text},ee.id)),l&&v.jsx("div",{ref:Q,style:{position:"absolute",left:0,top:0,willChange:"transform",visibility:"hidden",pointerEvents:"auto"},children:u})]}),m&&v.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:m}),h&&v.jsx("div",{ref:H,style:{position:"absolute",inset:0,pointerEvents:"none"},children:h}),te==="failed"&&v.jsx("div",{style:{position:"absolute",inset:0,display:"grid",placeItems:"center",fontFamily:Et,fontSize:11,letterSpacing:"0.18em",color:at.failed,textAlign:"center",padding:40},children:v.jsxs("div",{children:[v.jsx("div",{children:"FIELD UNAVAILABLE — WEBGPU DID NOT START"}),v.jsx("div",{style:{marginTop:10,color:q.chrome,letterSpacing:"0.08em"},children:le})]})})]}),v.jsx(YA,{onSurface:Ee,onZoom:Kt,compact:x})]})}function YA({onSurface:n,onZoom:i,compact:s}){if(s)return v.jsx("div",{style:{position:"absolute",right:14,bottom:18},children:v.jsx("button",{onClick:n,style:{width:52,height:52,borderRadius:"50%",background:"rgba(7,8,11,0.9)",border:"1px solid rgba(230,227,219,0.5)",color:q.ink,fontFamily:Et,fontSize:8.5,letterSpacing:"0.1em",cursor:"pointer"},children:"SURF"})});const l={background:"transparent",border:`1px solid ${q.chromeDim}`,color:q.chromeStrong,fontFamily:Et,fontSize:10,letterSpacing:"0.14em",padding:"7px 12px",cursor:"pointer"};return v.jsxs("div",{style:{position:"absolute",right:16,bottom:16,display:"flex",gap:8},children:[v.jsx("button",{style:l,onClick:()=>i(1.35),"aria-label":"Zoom in",children:"+"}),v.jsx("button",{style:l,onClick:()=>i(1/1.35),"aria-label":"Zoom out",children:"−"}),v.jsx("button",{style:l,onClick:n,children:"SURFACE"})]})}function XA(n,i,s){if(s&&s.runs>0&&s.reported===0)return R0("WAITING ON YOU","—",void 0,{note:"not reported by today's sources"});const l=i.count>0?`${i.count} ${i.count===1?"block":"blocks"} · longest ${Ke(i.longestMs)}`:void 0,u=s&&s.reported<s.runs?`from the ${s.reported} of ${s.runs} runs whose sources report waits`:void 0;return R0("WAITING ON YOU",Ke(n.value),n,{tone:n.value>0?"waiting":void 0,note:[l,u].filter(Boolean).join(" · ")||void 0})}function R0(n,i,s,l={}){const u=s?.basis==="inferred";return{key:n,value:i,inferred:u,assumption:u?s?.assumption:void 0,...l}}const D0="(no model)";function ln({name:n,value:i,measure:s,accent:l,note:u}){const f=s?.basis==="inferred";return v.jsxs("div",{title:f?s?.assumption:void 0,style:{display:"flex",flexDirection:"column",gap:5,padding:"12px 0",borderTop:`1px solid ${q.hairline}`,cursor:f?"help":"default"},children:[v.jsxs("div",{style:{fontSize:9.5,letterSpacing:"0.22em",color:q.chrome,display:"flex",alignItems:"baseline",gap:6},children:[n,f&&v.jsx("span",{style:{color:q.chromeDim,letterSpacing:"0.1em"},children:"inferred"})]}),v.jsx("div",{style:{fontSize:21,letterSpacing:"0.02em",color:l??q.ink,fontVariantNumeric:"tabular-nums"},children:i}),u&&v.jsx("div",{style:{fontSize:9.5,color:q.chromeDim},children:u})]})}function ea({title:n,children:i}){return v.jsxs("div",{style:{marginTop:40},children:[v.jsx("div",{style:{fontSize:9.5,letterSpacing:"0.24em",color:q.chrome},children:n}),v.jsx("div",{style:{marginTop:12},children:i})]})}function tv({fraction:n,color:i}){return v.jsx("div",{style:{height:3,background:"rgba(230,227,219,0.08)",width:"100%"},children:v.jsx("div",{style:{height:"100%",width:`${Math.max(.5,Math.min(1,n)*100)}%`,background:i}})})}function KA(n){if(n.medianTokens===void 0)return{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 ${ot(n.medianTokens)}`,title:"One eligible run, so this is that run's figure, not a median. Same window as the rest of TODAY.",absent:!1};const i=n.medianRuns===n.runs?`${n.runs}`:`${n.medianRuns} of ${n.runs}`;return{text:`median ${ot(n.medianTokens)} over ${i} runs`,title:`Median billed tokens per run, over the runs in this group 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. Runs whose source persists no accounting are excluded: absence is not zero. Same window as the rest of TODAY.`,absent:!1}}function Ic({rows:n,max:i,label:s,color:l,median:u=!1}){return v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:n.map(f=>v.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16,fontSize:11,fontVariantNumeric:"tabular-nums"},children:[v.jsx("span",{style:{color:q.body},children:s(f.key)}),v.jsxs("span",{style:{color:q.chromeMid},children:[f.runs," ",f.runs===1?"run":"runs",f.tokenRuns>0?` · ${ot(f.tokens)} tok`:""," · ",Ke(f.computeMs),f.failed>0&&v.jsxs("span",{style:{color:at.failed},children:[" · ",f.failed," failed"]})]})]}),v.jsx(tv,{fraction:i>0?f.computeMs/i:0,color:l}),u&&(()=>{const d=KA(f);return v.jsx("div",{title:d.title,style:{fontSize:9.5,letterSpacing:"0.06em",color:d.absent?q.chromeDim:q.chrome,cursor:"help",fontVariantNumeric:"tabular-nums"},children:d.text})})()]},f.key))})}function QA({world:n,waitEvidence:i}){const s=K.useMemo(()=>I0(n),[n]),l=K.useMemo(()=>F0(n,s),[n,s]),u=K.useMemo(()=>Fx(n),[n]),f=K.useMemo(()=>Hx(n),[n]),d=XA(s.waitingOnYou,f,i),h=K.useMemo(()=>qx(n),[n]),m=K.useMemo(()=>Yx(n),[n]),g=K.useMemo(()=>Oc(n,(U,J)=>J?.context),[n]),b=K.useMemo(()=>Oc(n,U=>U.model??D0),[n]),x=K.useMemo(()=>Oc(n,U=>U.machineId),[n]),R=K.useMemo(()=>[...n.executions.values()].filter(U=>U.status==="failed").sort((U,J)=>J.startedAt-U.startedAt),[n]),$=s.longestFocus.value,L=K.useMemo(()=>[...n.executions.values()].filter(U=>fn(U.measures)===void 0).length,[n]),O=g[0]?.computeMs??0,j=b[0]?.computeMs??0,X=x[0]?.computeMs??0,Q=m.reduce((U,J)=>J.computeMs>U.computeMs?J:U,m[0]),H=[...n.executions.values()].filter(U=>U.depth>0).length;return v.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"28px 48px 80px",fontFamily:Et,color:q.ink},children:[v.jsxs("div",{style:{marginBottom:34,maxWidth:900},children:[v.jsx("div",{style:{fontSize:9.5,letterSpacing:"0.24em",color:q.chrome},children:"WORK SHAPE"}),v.jsx("div",{style:{fontSize:34,letterSpacing:"0.08em",marginTop:10,color:q.accentBright},children:l.headline}),v.jsx("div",{style:{marginTop:14,display:"flex",flexDirection:"column",gap:7},children:l.clauses.map(U=>v.jsx("div",{style:{fontSize:12,lineHeight:1.65,color:q.body,letterSpacing:"0.02em"},children:U},U))})]}),v.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(190px, 1fr))",gap:"0 40px"},children:[v.jsx(ln,{name:"REQUESTS",value:ot(s.requests.value),measure:s.requests}),v.jsx(ln,{name:"RUNS",value:String(s.executions.value),measure:s.executions,note:H>0?`${H} of them sub-agents`:void 0}),v.jsx(ln,{name:"SESSIONS",value:String(s.sessions.value),measure:s.sessions}),v.jsx(ln,{name:"TOKENS",value:ot(s.tokens.value),measure:s.tokens,note:`${Math.round(u.cacheRead/Math.max(1,u.total)*100)}% cache reads`+(L>0?` · ${L} ${L===1?"run reports":"runs report"} no accounting`:"")}),v.jsx(ln,{name:"TOOL CALLS",value:ot(h.toolCalls),measure:s.toolCalls,note:h.toolErrors>0?`${h.toolErrors} failed`:void 0}),v.jsx(ln,{name:"TIME IN FLIGHT",value:Ke(s.timeInFlight.value),measure:s.timeInFlight}),v.jsx(ln,{name:"HUMAN + AGENT OVERLAP",value:Ke(s.humanAgentOverlap.value),measure:s.humanAgentOverlap,note:`${Math.round(s.humanAgentOverlap.value/Math.max(1,s.timeInFlight.value)*100)}% of time in flight`}),v.jsx(ln,{name:"PEAK CONCURRENCY",value:s.peakConcurrency.value>0?`${s.peakConcurrency.value} · ${Ja(s.peakConcurrencyAt.value)}`:"0",measure:s.peakConcurrency}),v.jsx(ln,{name:"CONTEXT SWITCHES",value:String(s.contextSwitches.value),measure:s.contextSwitches,note:`across ${g.length} ${g.length===1?"context":"contexts"}`}),v.jsx(ln,{name:"LONGEST FOCUS",value:$?Ke($.end-$.start):"—",measure:s.longestFocus,note:$?`${lr($.context)} · ${Ja($.start)}–${Ja($.end)}`:void 0}),v.jsx(ln,{name:d.key,value:d.value,measure:d.value==="—"?void 0:s.waitingOnYou,accent:d.tone==="waiting"?at.waiting:void 0,note:d.note}),v.jsx(ln,{name:"FAILED",value:String(h.failed),accent:h.failed>0?at.failed:void 0,note:h.interrupted>0||h.retries>0?`${h.interrupted} stopped · ${h.retries} retries`:void 0})]}),m.length>0&&v.jsxs(ea,{title:"HOUR BY HOUR",children:[v.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:3,height:84},children:m.map((U,J)=>{const W=U.computeMs/36e5;return v.jsx("div",{title:`${String(U.hour).padStart(2,"0")}:00 — ${Ke(U.computeMs)} in flight, ${U.runs} runs, peak ${U.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:U.peak>1?"rgba(240,195,116,0.75)":"rgba(214,176,116,0.38)"}})},J)})}),v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:6,fontSize:9,letterSpacing:"0.16em",color:q.chromeDim},children:[v.jsxs("span",{children:[String(m[0].hour).padStart(2,"0"),":00"]}),v.jsxs("span",{children:["busiest ",String(Q.hour).padStart(2,"0"),":00 · ",Ke(Q.computeMs)," ","of that hour"]}),v.jsxs("span",{children:[String(m[m.length-1].hour).padStart(2,"0"),":00"]})]})]}),v.jsx(ea,{title:"WHERE THE TIME WENT",children:v.jsx(Ic,{rows:g,max:O,label:lr,color:"rgba(240,195,116,0.6)"})}),x.length>0&&v.jsx(ea,{title:"BY MACHINE",children:v.jsx(Ic,{rows:x,max:X,label:U=>n.machines.get(U)?.name??U,color:"rgba(168,186,150,0.6)"})}),b.length>0&&v.jsx(ea,{title:"BY MODEL",children:v.jsx(Ic,{rows:b,max:j,label:U=>U===D0?"model not observed":U,color:"rgba(150,175,196,0.6)",median:!0})}),v.jsxs(ea,{title:"TOKEN COMPOSITION",children:[v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[["CACHE READS",u.cacheRead,"rgba(150,175,196,0.6)"],["INPUT",u.input,"rgba(240,195,116,0.6)"],["OUTPUT",u.output,"rgba(180,210,175,0.7)"],["REASONING",u.reasoning,"rgba(214,176,116,0.5)"]].map(([U,J,W])=>v.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:11,fontVariantNumeric:"tabular-nums"},children:[v.jsx("span",{style:{color:q.body},children:U}),v.jsxs("span",{style:{color:q.chromeMid},children:[ot(J)," · ",Math.round(J/Math.max(1,u.total)*100),"%"]})]}),v.jsx(tv,{fraction:J/Math.max(1,u.total),color:W})]},U))}),v.jsx("div",{style:{marginTop:12,fontSize:10,lineHeight:1.7,color:q.chromeDim},children:"Cache reads are context replayed into each request, not work generated. They dominate the total, which is why the headline token figure is much larger than it feels."})]}),R.length>0&&v.jsx(ea,{title:"FAILURES",children:v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:9},children:R.slice(0,12).map(U=>v.jsxs("div",{style:{display:"flex",gap:16,fontSize:11,borderTop:`1px solid ${q.hairline}`,paddingTop:8},children:[v.jsx("span",{style:{color:q.chromeMid,minWidth:46},children:Ja(U.startedAt)}),v.jsx("span",{style:{color:q.body,minWidth:160},children:U.label}),v.jsxs("span",{style:{color:at.failed},children:[U.failure?.code,": ",U.failure?.message]})]},U.id))})}),v.jsx(PA,{})]})}function PA(){return v.jsx(ea,{title:"NOT AVAILABLE FROM THESE SOURCES",children:v.jsxs("div",{style:{maxWidth:760,fontSize:10.5,lineHeight:1.8,color:q.chromeDim},children:[v.jsx("div",{children:"COST — every source here reports tokens or CPU time; none reports money. Converting one to the other needs a price table 057 does not have, so no cost figure is shown anywhere."}),v.jsx("div",{style:{marginTop:8},children:"TOKENS, FROM SOME SOURCES — Cursor persists no usage and 0x2F records none; their runs read NOT OBSERVED rather than 0, and the token totals sum only the runs that report."}),v.jsx("div",{style:{marginTop:8},children:"CLAUDE IN A BROWSER — Claude on claude.ai (chat, Claude Design, cloud Claude Code sessions) runs on Anthropic's servers and writes nothing to this Mac. Only Claude Code sessions that run here (a terminal, an editor, the desktop app's Code tab) leave the files 057 reads; the browser is seen as a process, never as work."}),v.jsx("div",{style:{marginTop:8},children:"MACHINE-TO-MACHINE TRANSFER — every observed source is single-host. Transfers are modelled and the field renders them, but no real adapter emits one; only the synthetic source does."}),v.jsx("div",{style:{marginTop:8},children:"PROCESS EXITS — the OS collector samples; an exit is inferred from disappearance between samples, never witnessed."}),v.jsx("div",{style:{marginTop:8},children:"OUTCOME QUALITY — the log records that a run completed, not whether the work was any good."})]})})}function ZA(n,i,s){return n===void 0?i===void 0?0:1:i===void 0?-1:s==="asc"?n-i:i-n}const Vc=100,C0="58px minmax(180px,1.4fr) 104px 132px 84px 68px 76px 70px 56px",O0=4,WA=8,nv="rgba(230,227,219,0.09)",z0="rgba(230,227,219,0.55)",_0="rgba(230,227,219,0.22)",JA="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 eM(n){const i=(Math.log10(Math.max(n,1))-O0)/(WA-O0),s=Math.max(0,Math.min(1,i))*100;return{width:n>0?`max(2px, ${s.toFixed(1)}%)`:"0",over:i>1}}function tM({tokens:n}){const{width:i,over:s}=eM(n);return v.jsxs("div",{style:{marginTop:3,height:1,background:nv,position:"relative"},children:[v.jsx("div",{style:{height:1,width:i,background:z0}}),s&&v.jsx("div",{style:{position:"absolute",right:0,top:-2,width:1,height:5,background:z0}})]})}function nM(){return v.jsxs("div",{style:{marginTop:3,height:3,position:"relative"},children:[v.jsx("div",{style:{position:"absolute",left:0,right:0,top:1,height:1,background:nv}}),[0,25,50,75].map(n=>v.jsx("div",{style:{position:"absolute",left:`${n}%`,top:0,width:1,height:3,background:_0}},n)),v.jsx("div",{style:{position:"absolute",right:0,top:0,width:1,height:3,background:_0}})]})}function iM(n){return n.outcome==="interrupted"?"STOPPED":n.status}function aM(n){return n.outcome==="interrupted"?q.chromeMid:at[n.status]}function Ai({children:n,align:i="left",color:s}){return v.jsx("div",{style:{textAlign:i,color:s??q.chromeMid,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})}function sM({p:n,session:i,onShowInField:s}){const l=fn(n.measures),u=n.startBasis==="inferred"||n.endBasis==="inferred",f=[["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"],...l===void 0?[["TOKENS","not observed"]]:[["INPUT",ot(Wa(n.measures).input)],["OUTPUT",ot(Wa(n.measures).output)],["CACHE READ",ot(Wa(n.measures).cacheRead)],["REASONING",ot(Wa(n.measures).reasoning)]],["REQUESTS",String(cf(n))],["TOOL CALLS",es(on(n),"not observed")]];return ia(n)>0&&f.push(["TOOL ERRORS",String(ia(n)),at.failed]),Yc(n)>0&&f.push(["PROVIDER RETRIES",String(Yc(n)),at.waiting]),(n.waits.length>0||n.waitingMs>0)&&f.push(["BLOCKED ON YOU",`${Ke(n.waitingMs)} across ${n.waits.length||1}`,at.waiting]),n.depth>0&&f.push(["SUB-AGENT",`depth ${n.depth}`]),v.jsxs("div",{style:{gridColumn:"1 / -1",display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(180px, 1fr))",gap:"6px 28px",padding:"12px 0 14px 16px",borderLeft:`1px solid ${q.panelBorder}`,margin:"2px 0 6px",background:"rgba(230,227,219,0.02)"},children:[f.map(([d,h,m])=>v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:12},children:[v.jsx("span",{style:{fontSize:9.5,letterSpacing:"0.16em",color:q.chrome},children:d}),v.jsx("span",{style:{fontSize:10.5,color:m??q.body,fontVariantNumeric:"tabular-nums",overflow:"hidden",textOverflow:"ellipsis"},children:h})]},d)),n.failure&&v.jsxs("div",{style:{gridColumn:"1 / -1",fontSize:10.5,color:at.failed},children:[n.failure.code,": ",n.failure.message]}),u&&n.boundsAssumption&&v.jsxs("div",{style:{gridColumn:"1 / -1",fontSize:9.5,color:q.chromeMid},children:["timing inferred — ",n.boundsAssumption]}),v.jsx("div",{style:{gridColumn:"1 / -1",marginTop:4},children:v.jsx("button",{onClick:d=>{d.stopPropagation(),s()},style:{background:"transparent",border:`1px solid ${q.hairline}`,color:q.chromeMid,fontFamily:Et,fontSize:9,letterSpacing:"0.16em",padding:"5px 10px",cursor:"pointer"},children:"SHOW IN FIELD →"})})]})}function rM({world:n,selectedId:i,onSelect:s}){const[l,u]=K.useState("all"),[f,d]=K.useState("time"),[h,m]=K.useState(Vc),[g,b]=K.useState(null),x=K.useMemo(()=>{let j=[...n.executions.values()];l==="stopped"?j=j.filter(H=>H.outcome==="interrupted"):l!=="all"&&(j=j.filter(H=>H.status===l&&H.outcome!=="interrupted"));const X=H=>(H.endedAt??n.now)-H.startedAt,Q={time:(H,U)=>U.startedAt-H.startedAt,duration:(H,U)=>X(U)-X(H),tokens:(H,U)=>ZA(fn(H.measures),fn(U.measures),"desc"),tools:(H,U)=>(on(U)??0)-(on(H)??0),waited:(H,U)=>U.waitingMs-H.waitingMs};return j.sort(Q[f])},[n,l,f]),R=K.useMemo(()=>{const j={all:n.executions.size,stopped:0};for(const X of n.executions.values())X.outcome==="interrupted"?j.stopped++:j[X.status]=(j[X.status]??0)+1;return j},[n]),$=K.useMemo(()=>{let j=0,X=0,Q=0,H=0;for(const U of x)j+=fn(U.measures)??0,X+=(U.endedAt??n.now)-U.startedAt,Q+=on(U)??0,H+=U.waitingMs;return{tokens:j,compute:X,tools:Q,waited:H}},[x,n]),L=x.slice(0,h),O=(j,X,Q="left")=>v.jsxs("div",{onClick:()=>d(j),style:{textAlign:Q,cursor:"pointer",color:f===j?q.ink:q.chrome},children:[X,f===j?" ↓":""]});return v.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"24px 48px 80px",fontFamily:Et,color:q.ink},children:[v.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap",marginBottom:14},children:["all","running","waiting","idle","completed","failed","stopped"].map(j=>{const X=l===j,Q=R[j]??0;return v.jsxs("button",{onClick:()=>{u(j),m(Vc)},style:{background:"transparent",border:`1px solid ${X?"rgba(230,227,219,0.6)":q.hairline}`,color:X?q.ink:q.chromeMid,fontFamily:Et,fontSize:9.5,letterSpacing:"0.16em",padding:"6px 11px",cursor:"pointer",textTransform:"uppercase"},children:[j," ",Q>0&&v.jsx("span",{style:{color:q.chromeDim},children:Q})]},j)})}),v.jsxs("div",{style:{fontSize:10,letterSpacing:"0.12em",color:q.chromeDim,marginBottom:14,fontVariantNumeric:"tabular-nums"},children:[x.length," ",x.length===1?"run":"runs"," shown · ",ot($.tokens)," tok ·"," ",Ke($.compute)," of run time · ",ot($.tools)," tool calls",$.waited>0&&` · ${Ke($.waited)} blocked on you`]}),v.jsxs("div",{style:{display:"grid",gridTemplateColumns:C0,gap:"0 14px",fontSize:9,letterSpacing:"0.18em",color:q.chrome,paddingBottom:8,borderBottom:`1px solid ${q.hairline}`,alignItems:"end"},children:[O("time","START"),v.jsx("div",{children:"RUN"}),v.jsx("div",{children:"CONTEXT"}),v.jsx("div",{children:"MODEL"}),v.jsx("div",{children:"STATUS"}),O("duration","DUR","right"),v.jsxs("div",{onClick:()=>d("tokens"),title:JA,style:{cursor:"help"},children:[v.jsxs("div",{style:{textAlign:"right",color:f==="tokens"?q.ink:q.chrome},children:["TOKENS",f==="tokens"?" ↓":""]}),v.jsx(nM,{})]}),O("waited","WAITED","right"),O("tools","TOOLS","right")]}),L.map(j=>{const X=n.sessions.get(j.sessionId),Q=fn(j.measures),H=j.id===i,U=g===j.id;return v.jsxs("div",{children:[v.jsxs("div",{onClick:()=>b(U?null:j.id),style:{display:"grid",gridTemplateColumns:C0,gap:"0 14px",fontSize:11,padding:"9px 0",borderBottom:"1px solid rgba(230,227,219,0.05)",cursor:"pointer",background:H||U?"rgba(240,195,116,0.07)":"transparent",fontVariantNumeric:"tabular-nums"},children:[v.jsx(Ai,{children:Ja(j.startedAt)}),v.jsxs(Ai,{color:H||U?q.accentBright:q.body,children:[j.depth>0&&v.jsx("span",{style:{color:q.chromeDim},children:"└ "}),j.label]}),v.jsx(Ai,{children:X?lr(X.context):"—"}),v.jsx(Ai,{color:j.model?void 0:q.chromeDim,children:j.model??"—"}),v.jsx("div",{style:{fontSize:9,letterSpacing:"0.14em",color:aM(j),textTransform:"uppercase"},children:iM(j)}),v.jsxs(Ai,{align:"right",children:[j.startBasis==="inferred"||j.endBasis==="inferred"?"~":"",Ke((j.endedAt??n.now)-j.startedAt)]}),v.jsxs("div",{children:[v.jsx(Ai,{align:"right",color:Q===void 0?q.chromeDim:void 0,children:es(Q,"—")}),Q!==void 0&&v.jsx(tM,{tokens:Q})]}),v.jsx(Ai,{align:"right",color:j.waitingMs>0?at.waiting:q.chromeDim,children:j.waitingMs>0?Ke(j.waitingMs):"—"}),v.jsxs(Ai,{align:"right",color:on(j)===void 0?q.chromeDim:void 0,children:[es(on(j),"—"),ia(j)>0&&v.jsxs("span",{style:{color:at.failed},children:[" /",ia(j)]})]})]}),U&&v.jsx(sM,{p:j,session:X,onShowInField:()=>s(j.id)})]},j.id)}),x.length===0&&v.jsx("div",{style:{padding:"28px 0",fontSize:11,color:q.chromeMid},children:"Nothing matching in this window."}),x.length>h&&v.jsxs("button",{onClick:()=>m(j=>j+Vc),style:{marginTop:18,background:"transparent",border:`1px solid ${q.hairline}`,color:q.chromeMid,fontFamily:Et,fontSize:9.5,letterSpacing:"0.16em",padding:"8px 14px",cursor:"pointer"},children:["SHOW MORE — ",x.length-h," REMAINING"]})]})}const Fc={display:"flex",flexDirection:"column",gap:5,background:q.panel,borderLeft:`1px solid ${q.panelBorder}`,padding:"9px 13px",minWidth:170,maxWidth:320,fontFamily:Et,backdropFilter:"blur(2px)"};function Ue({name:n,detail:i,color:s,title:l,tag:u}){return v.jsxs("div",{title:l,style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:16,fontSize:10.5,cursor:l?"help":void 0},children:[v.jsxs("span",{style:{color:q.chromeMid,letterSpacing:"0.1em",whiteSpace:"nowrap"},children:[n,u&&v.jsxs("span",{style:{color:q.chromeDim,letterSpacing:"0.06em"},children:[" ",u]})]}),v.jsx("span",{style:{fontSize:10,fontWeight:500,letterSpacing:"0.14em",color:s??q.chromeStrong,whiteSpace:"nowrap",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",maxWidth:190},children:i})]})}function Hc({text:n,onClose:i}){return v.jsxs("div",{style:{display:"flex",alignItems:"baseline",justifyContent:"space-between",gap:14},children:[v.jsx("div",{style:{fontSize:10,letterSpacing:"0.18em",color:q.ink,textTransform:"uppercase"},children:n}),v.jsx("div",{onClick:i,role:"button",style:{fontSize:11,color:q.chromeMid,cursor:"pointer"},children:"×"})]})}function zf({label:n}){return v.jsx("div",{style:{marginTop:5,paddingTop:5,borderTop:"1px solid rgba(230,227,219,0.08)",fontSize:8.5,letterSpacing:"0.2em",color:q.chromeDim},children:n})}function lM(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 uM(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 U0={"ran-as":"RAN AS","same-as":"SAME AS",spawned:"SPAWNED",contains:"CONTAINS",produced:"PRODUCED"};function N0({world:n,subject:i}){const s=n.relationships.filter(l=>l.from.type===i.type&&l.from.id===i.id||l.to.type===i.type&&l.to.id===i.id);return s.length===0?null:v.jsxs(v.Fragment,{children:[v.jsx(zf,{label:"RELATED"}),s.slice(0,6).map((l,u)=>{const f=l.from.type===i.type&&l.from.id===i.id,d=f?l.to:l.from,h=f?U0[l.kind]:l.kind==="spawned"?"SPAWNED BY":U0[l.kind],m=lM(l);return v.jsx(Ue,{name:h,tag:m.grade==="contextual"?`${m.label} · inferred`:m.label,detail:uM(n,d),color:m.grade==="contextual"?q.chromeMid:void 0,title:l.assumption??(l.via?`via ${l.via}`:void 0)},`${l.kind}:${d.type}:${d.id}:${u}`)})]})}function oM({type:n,id:i}){const[s,l]=K.useState(null);return K.useEffect(()=>{let u=!1;l(null);const f=setTimeout(()=>{m1(n,i).then(({events:d})=>{u||l(cM(d))}).catch(()=>{u||l(null)})},180);return()=>{u=!0,clearTimeout(f)}},[n,i]),!s||s.facts.length===0&&!s.provenance?null:v.jsxs(v.Fragment,{children:[v.jsx(zf,{label:"NATIVE RECORD"}),s.facts.map(([u,f])=>v.jsx(Ue,{name:u,detail:f,color:q.chromeMid},u)),s.provenance&&v.jsxs("div",{title:s.provenance,style:{fontSize:8.5,letterSpacing:"0.04em",color:q.chromeDim,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"help"},children:["read from ",s.provenance]})]})}function cM(n){const i=new Map;let s;for(const u of n){for(const[f,d]of Object.entries(u.attrs??{}))!f.includes(".")||d===void 0||d===null||d===""||i.set(f,d);!s&&u.provenance?.path&&(s=u.provenance.path)}return{facts:[...i.entries()].slice(0,10).map(([u,f])=>[u,typeof f=="object"?JSON.stringify(f):String(f)]),provenance:s}}function fM({p:n,now:i}){const s=(n.endedAt??i)-n.startedAt,l=n.startBasis==="inferred",u=n.endBasis==="inferred",f=l||u;return v.jsxs(v.Fragment,{children:[v.jsx(Ue,{name:"STARTED",tag:l?"inferred":void 0,detail:Ja(n.startedAt),title:l?n.boundsAssumption:void 0}),v.jsx(Ue,{name:"ELAPSED",tag:f?"inferred":void 0,detail:Ke(s),title:f?n.boundsAssumption:void 0})]})}function _f({hit:n,world:i,landscape:s,band:l,density:u,onClose:f}){if(n.kind==="mass"){const L=i.machines.get(n.id);if(!L)return null;const O=[];let j=0,X;for(const U of i.executions.values()){if(U.machineId!==L.id)continue;const J=fn(U.measures);J!==void 0&&(X=(X??0)+J),U.status==="running"||U.status==="waiting"?O.push({id:U.id,label:U.label,status:U.status}):j++}const Q=i.processTotals,H=new Set;for(const U of i.relationships)U.kind==="ran-as"&&(U.from.type==="process"&&H.add(U.from.id),U.to.type==="process"&&H.add(U.to.id));return v.jsxs("div",{style:Fc,children:[v.jsx(Hc,{text:L.name,onClose:f}),O.length===0?v.jsx("div",{style:{fontSize:10,color:q.chrome},children:"idle — nothing active"}):O.slice(0,8).map(U=>v.jsx(Ue,{name:U.label,detail:U.status.toUpperCase(),color:at[U.status]},U.id)),v.jsx("div",{style:{height:4}}),v.jsx(Ue,{name:"RAN TODAY",detail:String(j)}),v.jsx(Ue,{name:"TOKENS",detail:es(X),title:X===void 0?"No execution in this window reported token accounting.":void 0}),Q&&v.jsxs(v.Fragment,{children:[v.jsx(zf,{label:"MACHINE STRATUM"}),v.jsx(Ue,{name:"PROCESSES OBSERVED",detail:String(Q.observed)}),v.jsx(Ue,{name:"SEEN IN LAST 5 MIN",detail:String(Q.recentlySeen),title:"Processes with a liveness observation in the last five minutes. The sampler only records a process when it is doing something, and never witnesses an exit — so recency is the honest liveness signal, not an unexpired status."}),v.jsx(Ue,{name:"ATTRIBUTED",detail:`${H.size} of ${Q.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."}),Q.exitsInferred>0&&v.jsx(Ue,{name:"EXITS",tag:"inferred",detail:String(Q.exitsInferred),title:"An exit is never witnessed by the sampler; it is inferred from disappearance between samples."})]})]})}if(n.kind==="coupling"){const L=i.transfers.get(n.id);if(!L)return null;const O=i.machines.get(L.fromMachineId)?.name??L.fromMachineId,j=i.machines.get(L.toMachineId)?.name??L.toMachineId;return v.jsxs("div",{style:Fc,children:[v.jsx(Hc,{text:`${O} → ${j}`,onClose:f}),v.jsx(Ue,{name:"STATUS",detail:"TRANSFERRING",color:at.running}),v.jsx(Ue,{name:"WHAT",detail:L.label}),v.jsx(Ue,{name:"SIZE",detail:Xx(L.bytes)}),v.jsx(Ue,{name:"ELAPSED",detail:Ke(i.now-L.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(L=>L.id===n.id),b=u==="full"||u!=="compact"&&(l==="proximity"||n.kind==="stratum"),x=b,R=fn(d.measures),$=Wa(d.measures);return v.jsxs("div",{style:Fc,children:[v.jsx(Hc,{text:d.label,onClose:f}),v.jsx(Ue,{name:"STATUS",detail:d.status.toUpperCase(),color:at[d.status]}),v.jsx(Ue,{name:"MACHINE",detail:m?.name??d.machineId}),v.jsx(fM,{p:d,now:i.now}),x&&v.jsxs(v.Fragment,{children:[v.jsx(Ue,{name:"TOKENS",detail:es(R),title:R===void 0?"This source does not persist token accounting.":void 0}),v.jsx(Ue,{name:"REQUESTS",detail:String(cf(d))}),v.jsx(Ue,{name:"TOOL CALLS",detail:es(on(d)),title:on(d)===void 0?"This source does not count discrete operations.":void 0})]}),b&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:{height:4}}),h&&v.jsx(Ue,{name:"CONTEXT",detail:lr(h.context)}),v.jsx(Ue,{name:"PROVIDER",detail:d.executor}),v.jsx(Ue,{name:"MODEL",detail:d.model??"NOT OBSERVED",color:d.model?void 0:q.chromeMid,title:d.model?void 0:"This source does not record the model."}),R!==void 0&&v.jsxs(v.Fragment,{children:[v.jsx(Ue,{name:"CACHE READ",detail:ot($.cacheRead)}),v.jsx(Ue,{name:"REASONING",detail:ot($.reasoning)})]}),ia(d)>0&&v.jsx(Ue,{name:"TOOL ERRORS",detail:String(ia(d)),color:at.failed}),d.waitingMs>0&&v.jsx(Ue,{name:"WAITED ON YOU",detail:Ke(d.waitingMs),color:at.waiting}),d.depth>0&&v.jsx(Ue,{name:"SUB-AGENT",detail:`depth ${d.depth}`}),h?.parentId&&v.jsx(Ue,{name:"SESSION SPAWNED BY",tag:"recorded",detail:i.sessions.get(h.parentId)?.label??h.parentId,title:"The session's own runtime recorded which session started it."}),g&&v.jsx(Ue,{name:"FIELD ENERGY",detail:g.energy.toFixed(2)}),v.jsx(N0,{world:i,subject:{type:"execution",id:d.id}}),h&&v.jsx(N0,{world:i,subject:{type:"session",id:h.id}}),v.jsx(oM,{type:"execution",id:d.id})]}),d.failure&&v.jsxs("div",{style:{marginTop:4,fontSize:9.5,letterSpacing:"0.06em",color:at.failed,maxWidth:280},children:[d.failure.code,": ",d.failure.message]}),d.outcome==="interrupted"&&!d.failure&&v.jsx("div",{style:{marginTop:4,fontSize:9.5,color:q.chromeMid},children:"stopped before finishing"})]})}function dM({hit:n,world:i}){let s="",l="",u=q.chromeMid;if(n.kind==="mass")s=i.machines.get(n.id)?.name??n.id;else if(n.kind==="coupling"){const f=i.transfers.get(n.id),d=f?i.machines.get(f.fromMachineId)?.name??"":"",h=f?i.machines.get(f.toMachineId)?.name??"":"";s=`${d} → ${h}`,l="TRANSFERRING",u=at.running}else{const f=i.executions.get(n.id);if(!f)return null;s=f.label,l=f.status.toUpperCase(),u=at[f.status]}return v.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:2,pointerEvents:"none",whiteSpace:"nowrap",fontFamily:Et},children:[v.jsx("div",{style:{fontSize:10.5,fontWeight:500,letterSpacing:"0.18em",color:q.hoverInk,background:"rgba(5,6,8,0.88)",padding:"4px 9px"},children:s}),l&&v.jsx("div",{style:{fontSize:9.5,letterSpacing:"0.22em",color:u,textShadow:Za},children:l})]})}function hM(n){return[`${ot(n.requests.value)} REQ`,`${n.sessions.value} SESS`,`${Ke(n.timeInFlight.value)}`,`${ot(n.tokens.value)} TOK`].join(" · ")}function pM(n){return[`${ot(n.requests.value)} REQUESTS`,`${n.sessions.value} SESSIONS`,`${Ke(n.timeInFlight.value)} IN FLIGHT`,`${Ke(n.humanAgentOverlap.value)} OVERLAP`,`PEAK ${n.peakConcurrency.value}`,`${n.contextSwitches.value} SWITCHES`,`${ot(n.tokens.value)} TOK`].join(" · ")}function mM({metrics:n,shape:i,compact:s=!1}){return v.jsxs("div",{style:{position:"absolute",left:20,bottom:16,right:s?82:236,display:"flex",flexDirection:"column",gap:8,pointerEvents:"none",fontFamily:Et},children:[v.jsxs("div",{"data-depth-deep":!0,"data-depth-suppressed":s?"true":void 0,style:{display:"none",maxWidth:720,background:"linear-gradient(to right, rgba(5,6,8,0.92) 0%, rgba(5,6,8,0.86) 70%, rgba(5,6,8,0) 100%)",padding:"10px 42px 10px 0",margin:"0 0 -2px -6px",paddingLeft:6},children:[v.jsxs("div",{style:{fontSize:9.5,letterSpacing:"0.24em",color:q.chrome,textShadow:Za},children:["WORK SHAPE — ",i.headline]}),v.jsx("div",{style:{marginTop:6,display:"flex",flexDirection:"column",gap:3},children:i.clauses.slice(0,3).map(l=>v.jsx("div",{style:{fontSize:10.5,lineHeight:1.6,color:q.chromeMid,textShadow:Za},children:l},l))}),v.jsx("div",{style:{marginTop:7,fontSize:9.5,lineHeight:1.6,color:q.chromeDim,textShadow:Za,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:Za},children:"FIELD — LIVE"}),v.jsxs("span",{"data-depth-summary":!0,style:{display:"none",alignItems:"baseline",gap:10},children:[v.jsx("span",{style:{color:q.chromeDim},children:"·"}),v.jsx("span",{style:{fontSize:10.5,letterSpacing:"0.18em",color:"rgba(230,227,219,0.6)",textShadow:Za},children:s?hM(n):pM(n)})]})]})]})}const gM=560;function k0(n,i,s){return Math.min(n,i)<gM||s?i>=n?"portrait":"landscape":"desktop"}function yM(){const[n,i]=K.useState(()=>typeof window>"u"?"desktop":k0(window.innerWidth,window.innerHeight,window.matchMedia("(pointer: coarse)").matches));return K.useEffect(()=>{const s=window.matchMedia("(pointer: coarse)"),l=()=>i(k0(window.innerWidth,window.innerHeight,s.matches));return l(),window.addEventListener("resize",l),window.addEventListener("orientationchange",l),s.addEventListener("change",l),()=>{window.removeEventListener("resize",l),window.removeEventListener("orientationchange",l),s.removeEventListener("change",l)}},[]),n}const iv=250,av=150;function vM(n,i,s,l){return i?n==="landscape"?{right:iv,bottom:0}:n==="portrait"?{right:0,bottom:s?Math.round(l*.6):av}:{right:0,bottom:0}:{right:0,bottom:0}}const sv={fontSize:9,letterSpacing:"0.16em",color:q.chromeMid};function bM(n){return v.jsxs("div",{style:{position:"absolute",right:0,top:0,bottom:0,width:iv,boxSizing:"border-box",background:q.panel,borderLeft:`1px solid ${q.panelBorder}`,padding:"16px 16px 14px",display:"flex",flexDirection:"column",gap:10,fontFamily:Et,pointerEvents:"auto"},children:[v.jsx(_f,{...n,density:"full"}),v.jsx("div",{style:{marginTop:"auto",...sv},children:"TAP FIELD TO DISMISS"})]})}function xM({detent:n,onToggleDetent:i,viewportHeight:s,...l}){const u=n==="expanded",f=u?Math.round(s*.6):av;return v.jsxs("div",{style:{position:"absolute",left:0,right:0,bottom:0,height:f,boxSizing:"border-box",background:"rgba(7,8,11,0.96)",borderTop:`1px solid ${q.panelBorder}`,padding:"10px 18px 18px",display:"flex",flexDirection:"column",gap:10,fontFamily:Et,pointerEvents:"auto",transition:"height 180ms ease-out"},children:[v.jsx("button",{onClick:i,"aria-label":u?"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(_f,{...l,density:u?"full":"compact"})}),v.jsx("div",{style:{marginTop:"auto",...sv},children:u?"TAP HANDLE TO COLLAPSE":"TAP HANDLE FOR FULL TELEMETRY"})]})}function SM(){return"capture"}function wM(n){return`${n.message}. ${n.remedy} Nothing observed since this appeared has been saved.`}const qc={label:"TODAY",tone:"normal",detail:"Midnight to now."},EM={normal:q.chromeMid,warn:"rgba(240,195,116,0.9)",error:"rgba(206,104,90,0.9)"};function TM(){const n=Date.now(),i=new Date(n);return i.setHours(0,0,0,0),{start:i.getTime(),now:n}}const AM=250,MM={time:0,masses:[],disturbances:[],plinths:[],couplings:[],strata:[]};function RM(){const[n,i]=K.useState(SM),[s,l]=K.useState("field"),[u,f]=K.useState(null),[d,h]=K.useState(qc),[m,g]=K.useState(MM),[b,x]=K.useState(0),[R,$]=K.useState(null),[L,O]=K.useState(null),[j,X]=K.useState("environment"),[Q,H]=K.useState(null),[U,J]=K.useState("peek"),W=yM(),A=K.useRef(Gl(Date.now(),Date.now())),w=K.useRef(void 0),G=K.useRef(null),te=K.useRef(null),ne=K.useRef(!1);K.useEffect(()=>{let k=!1,F=null;h(qc);async function Z(){if(n==="synthetic"||n==="fixture"){let Ee;if(Ee=new h1({seed:57}),h({label:"REPLAY",tone:"normal",detail:"A deterministic synthetic day, replayed at speed. Not your telemetry."}),k)return;const Kt=Ee.bounds();A.current=Gl(Kt.dayStart,Kt.dayEnd),w.current=void 0,G.current=Ee,f(Ee.info()),O(null),$(null),F=Ee.subscribe(ee=>{kx(A.current,ee),ne.current=!0}),ne.current=!0;return}const{start:ue,now:he}=TM();await Xc(ue,he);const me=await p1();let $e=await Kc(ue,he);if($e.world.executions.length===0&&$e.world.sessions.length===0){const Ee=he-2592e5;await Xc(Ee,he),$e=await Kc(Ee,he),($e.world.executions.length>0||$e.world.sessions.length>0)&&h({label:"LAST 72H",tone:"warn",detail:"Nothing ran today, so the window was widened to the last 72 hours."})}const Re=Object.entries(me.observation??{}).flatMap(([Ee,Kt])=>Object.entries(Kt.strata).filter(([ee,P])=>P==="partial"||P==="failed"&&ee!=="live-semantics").map(([ee,P])=>`${Ee} ${ee} ${P}`)),hn=Object.entries(me.sources).filter(([,Ee])=>(Ee.presence??(Ee.available?"observing":"not-installed"))==="failed").map(([Ee])=>Ee),Mn=Object.entries(me.sources).filter(([,Ee])=>Ee.presence==="not-installed").map(([Ee])=>Ee),Oi=me.store.bySource.filter(Ee=>Ee.source!=="host"),Mt=me.health;me.fault?h({label:"STORE LOST",tone:"error",detail:wM(me.fault)}):Mt&&!Mt.store.ok?h({label:"STORE DEGRADED",tone:"error",detail:Mt.store.remedy??"Some stored rows could not be read."}):Mt&&Mt.failingSources.length>0?h({label:"SOURCE FAILING",tone:"error",detail:`Installed and failing every collection round: ${Mt.failingSources.join(", ")}. `+(Mt.collection[Mt.failingSources[0]]?.lastError??"")+" Other sources and captured history are unaffected."}):me.mode==="os-only"?h({label:"OS ONLY",tone:"normal",detail:"Observing this machine’s processes. No AI runtime state was found here"+(Mn.length?` (looked for ${Mn.join(", ")})`:"")+" — that is a valid mode, not a fault. Install or use one and its sessions appear here."}):Oi.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."}):(hn.length||Re.length)&&h({label:"PARTIAL",tone:"warn",detail:[hn.length?`Installed but unreadable: ${hn.join(", ")}.`:"",Re.length?`Reduced observation depth: ${Re.join("; ")}. The computation is still observed; some semantics are not.`:"","Captured history is intact."].filter(Boolean).join(" ")});const kt=new v1($e,me,{onTrouble:Ee=>{if(!k){if(!Ee)return h(qc);h(Ee.kind==="store-fault"?{label:"STORE LOST",tone:"error",detail:`${Ee.message} ${Ee.detail}`}:{label:"CAPTURE FAILING",tone:"error",detail:`${Ee.message}. ${Ee.detail}. The field is showing the last world it received.`})}}});k||(A.current=Gl($e.from,$e.to),G.current=kt,f(kt.info()),O(null),$(null),F=kt.subscribe((Ee,Kt)=>{A.current=Ee,w.current=Kt,ne.current=!0}),ne.current=!0)}return Z().catch(ue=>{k||h({label:"SOURCE FAILED",tone:"error",detail:ue instanceof Error?ue.message:String(ue)})}),()=>{k=!0,G.current=null,F?.()}},[n]),K.useEffect(()=>{const k=setInterval(()=>{const F=A.current,Z=G.current?.now()??Date.now();if(Lx(F,Math.max(F.now,Z)),!ne.current)return;ne.current=!1;const ue=u1(F);g(ue),x(he=>he+1)},AM);return()=>clearInterval(k)},[]),K.useEffect(()=>{const k=setInterval(()=>{const F=te.current?.perf.snapshot();F&&H({fps:F.fps,gpuMs:F.gpuMs,scale:F.scale})},1e3);return()=>clearInterval(k)},[]);const le=A.current,Ge=K.useMemo(()=>I0(le),[b]),de=K.useMemo(()=>F0(le,Ge),[Ge]),oe=K.useCallback(k=>$(k),[]),z=K.useCallback(k=>{const F=m.disturbances.find(ue=>ue.id===k),Z=m.strata.find(ue=>ue.id===k);!F&&!Z||(O({kind:F?"disturbance":"stratum",id:k,x:F?.x??0,y:F?.y??0}),l("field"))},[m]),Y=L??R,ae=W!=="desktop",be=typeof window>"u"?800:window.innerHeight,De=K.useMemo(()=>vM(W,!!L,U==="expanded",be),[W,L,U,be]),T=Y&&(!L&&Y.kind==="disturbance"?v.jsx("div",{"data-anchor-placement":"label",children:v.jsx(dM,{hit:Y,world:le})}):v.jsx("div",{"data-anchor-placement":"panel",children:v.jsx(_f,{hit:Y,world:le,landscape:m,band:j,onClose:()=>O(null)})}));return v.jsxs("div",{style:{position:"fixed",inset:0,display:"flex",flexDirection:"column",background:q.bg,color:q.ink,fontFamily:Et},children:[v.jsx(DM,{view:s,setView:l,feed:n,setFeed:i,sourceInfo:u,window:d}),s==="today"&&v.jsx(QA,{world:le,waitEvidence:w.current}),s==="log"&&v.jsx(rM,{world:le,selectedId:L?.id??null,onSelect:z}),v.jsx("div",{style:{display:s==="field"?"contents":"none"},children:v.jsx(qA,{landscape:m,onHover:oe,onSelect:O,anchor:ae?null:Y,onBand:X,compact:ae,inset:De,keepVisible:L,overlay:ae&&L?W==="landscape"?v.jsx(bM,{hit:L,world:le,landscape:m,band:j,onClose:()=>O(null)}):v.jsx(xM,{hit:L,world:le,landscape:m,band:j,detent:U,onToggleDetent:()=>J(k=>k==="peek"?"expanded":"peek"),viewportHeight:be,onClose:()=>O(null)}):null,onReady:k=>{te.current=k},depth:v.jsx(mM,{metrics:Ge,shape:de,compact:ae}),children:T})}),v.jsx(CM,{view:s,perf:Q,touch:ae})]})}function DM({view:n,setView:i,feed:s,setFeed:l,sourceInfo:u,window:f}){const d=(g,b)=>{const x=n===g;return v.jsx("button",{onClick:()=>i(g),style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontFamily:Et,letterSpacing:"0.22em",fontSize:x?12.5:9.5,color:x?q.ink:q.chromeDim},children:b},g)},h=s==="synthetic",m=[f.detail,u?.detail].filter(Boolean).join(" ");return v.jsxs("div",{style:{display:"flex",alignItems:"center",gap:14,padding:"16px 24px 15px",borderBottom:`1px solid ${q.hairline}`,flexWrap:"nowrap",overflow:"hidden"},children:[v.jsx("div",{style:{fontSize:11,letterSpacing:"0.3em",color:"rgba(230,227,219,0.5)",flexShrink:0},children:"057"}),v.jsx("div",{className:"hdr-tagline",style:{fontSize:8.5,letterSpacing:"0.24em",color:q.chromeDim,flexShrink:0,whiteSpace:"nowrap"},children:"PERSONAL COMPUTATIONAL TELEMETRY"}),v.jsx("div",{className:"hdr-tagline",style:{width:1,height:12,background:"rgba(230,227,219,0.12)",flexShrink:0,margin:"0 10px"}}),v.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:20,flexShrink:0},children:[d("field","FIELD"),d("today","TODAY"),d("log","PROCESS LOG")]}),v.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:22,minWidth:0},children:[v.jsxs("div",{title:m,style:{display:"flex",alignItems:"center",gap:9,flexShrink:0,cursor:"help"},children:[v.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:EM[f.tone],flexShrink:0}}),v.jsx("span",{style:{fontSize:10,letterSpacing:"0.2em",color:q.chromeStrong,whiteSpace:"nowrap"},children:f.label})]}),v.jsxs("button",{onClick:()=>l(h?"capture":"synthetic"),title:h?"Switch to CAPTURE":"Switch to SYNTHETIC",style:{background:"transparent",border:"none",padding:"3px 0",cursor:"pointer",display:"flex",alignItems:"center",gap:8,flexShrink:0},children:[v.jsx("span",{style:{fontSize:10,color:h?q.chromeDim:q.accent},children:h?"○":"●"}),v.jsx("span",{style:{fontSize:9.5,letterSpacing:"0.16em",color:q.chrome},children:h?"SYNTHETIC":"CAPTURE"})]})]})]})}function CM({view:n,perf:i,touch:s}){return v.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:14,padding:"10px 24px 14px",borderTop:`1px solid ${q.hairline}`,fontSize:10.5,letterSpacing:"0.16em",color:q.chrome,flexWrap:"wrap"},children:[v.jsx("span",{children:n==="field"?s?"DRAG TO PAN · PINCH TO ZOOM · TAP TO INSPECT":"SCROLL TO PAN · ⌃SCROLL / PINCH TO ZOOM · CLICK TO INSPECT · ZOOM OUT FOR TODAY":n==="log"?v.jsxs(v.Fragment,{children:["CLICK A ROW FOR THE FULL RECORD · CLICK A COLUMN TO SORT",v.jsx("span",{style:{color:q.accentBright},children:" · TOKEN RULE: LOG 10k–100M"})]}):"HOVER AN INFERRED MEASURE FOR THE ASSUMPTION BEHIND IT"}),v.jsx("span",{style:{marginLeft:"auto",color:q.chromeDim,fontSize:9.5},children:n==="field"&&i&&i.fps>0?`${Math.round(i.fps)}FPS${i.gpuMs>0?` · ${i.gpuMs.toFixed(1)}MS GPU`:""}${i.scale<1?` · ${Math.round(i.scale*100)}%`:""}`:""})]})}Dx.createRoot(document.getElementById("root")).render(v.jsx(K.StrictMode,{children:v.jsx(RM,{})}));
|