@probnaya/057-cli 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/assets/index-BQEdszeO.js +658 -0
- package/dist/index.html +1 -1
- package/dist-server/057.mjs +1 -1
- package/package.json +1 -1
- package/dist/assets/index-BInsdRgV.js +0 -658
|
@@ -1,658 +0,0 @@
|
|
|
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 Ac={exports:{}},Js={};var Om;function px(){if(Om)return Js;Om=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 zm;function mx(){return zm||(zm=1,Ac.exports=px()),Ac.exports}var v=mx(),Tc={exports:{}},pe={};var _m;function gx(){if(_m)return pe;_m=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"),x=Symbol.for("react.lazy"),b=Symbol.for("react.activity"),D=Symbol.iterator;function V(w){return w===null||typeof w!="object"?null:(w=D&&w[D]||w["@@iterator"],typeof w=="function"?w:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},O=Object.assign,L={};function K(w,N,Y){this.props=w,this.context=N,this.refs=L,this.updater=Y||k}K.prototype.isReactComponent={},K.prototype.setState=function(w,N){if(typeof w!="object"&&typeof w!="function"&&w!=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,w,N,"setState")},K.prototype.forceUpdate=function(w){this.updater.enqueueForceUpdate(this,w,"forceUpdate")};function G(){}G.prototype=K.prototype;function I(w,N,Y){this.props=w,this.context=N,this.refs=L,this.updater=Y||k}var H=I.prototype=new G;H.constructor=I,O(H,K.prototype),H.isPureReactComponent=!0;var Z=Array.isArray;function de(){}var M={H:null,A:null,T:null,S:null},E=Object.prototype.hasOwnProperty;function B(w,N,Y){var P=Y.ref;return{$$typeof:n,type:w,key:N,ref:P!==void 0?P:null,props:Y}}function W(w,N){return B(w.type,N,w.props)}function te(w){return typeof w=="object"&&w!==null&&w.$$typeof===n}function le(w){var N={"=":"=0",":":"=2"};return"$"+w.replace(/[=:]/g,function(Y){return N[Y]})}var $e=/\/+/g;function he(w,N){return typeof w=="object"&&w!==null&&w.key!=null?le(""+w.key):N.toString(36)}function re(w){switch(w.status){case"fulfilled":return w.value;case"rejected":throw w.reason;default:switch(typeof w.status=="string"?w.then(de,de):(w.status="pending",w.then(function(N){w.status==="pending"&&(w.status="fulfilled",w.value=N)},function(N){w.status==="pending"&&(w.status="rejected",w.reason=N)})),w.status){case"fulfilled":return w.value;case"rejected":throw w.reason}}throw w}function R(w,N,Y,P,ue){var fe=typeof w;(fe==="undefined"||fe==="boolean")&&(w=null);var me=!1;if(w===null)me=!0;else switch(fe){case"bigint":case"string":case"number":me=!0;break;case"object":switch(w.$$typeof){case n:case i:me=!0;break;case x:return me=w._init,R(me(w._payload),N,Y,P,ue)}}if(me)return ue=ue(w),me=P===""?"."+he(w,0):P,Z(ue)?(Y="",me!=null&&(Y=me.replace($e,"$&/")+"/"),R(ue,N,Y,"",function(gn){return gn})):ue!=null&&(te(ue)&&(ue=W(ue,Y+(ue.key==null||w&&w.key===ue.key?"":(""+ue.key).replace($e,"$&/")+"/")+me)),N.push(ue)),1;me=0;var Ze=P===""?".":P+":";if(Z(w))for(var De=0;De<w.length;De++)P=w[De],fe=Ze+he(P,De),me+=R(P,N,Y,fe,ue);else if(De=V(w),typeof De=="function")for(w=De.call(w),De=0;!(P=w.next()).done;)P=P.value,fe=Ze+he(P,De++),me+=R(P,N,Y,fe,ue);else if(fe==="object"){if(typeof w.then=="function")return R(re(w),N,Y,P,ue);throw N=String(w),Error("Objects are not valid as a React child (found: "+(N==="[object Object]"?"object with keys {"+Object.keys(w).join(", ")+"}":N)+"). If you meant to render a collection of children, use an array instead.")}return me}function q(w,N,Y){if(w==null)return w;var P=[],ue=0;return R(w,P,"","",function(fe){return N.call(Y,fe,ue++)}),P}function ae(w){if(w._status===-1){var N=w._result;N=N(),N.then(function(Y){(w._status===0||w._status===-1)&&(w._status=1,w._result=Y)},function(Y){(w._status===0||w._status===-1)&&(w._status=2,w._result=Y)}),w._status===-1&&(w._status=0,w._result=N)}if(w._status===1)return w._result.default;throw w._result}var Te=typeof reportError=="function"?reportError:function(w){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var N=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof w=="object"&&w!==null&&typeof w.message=="string"?String(w.message):String(w),error:w});if(!window.dispatchEvent(N))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",w);return}console.error(w)},Re={map:q,forEach:function(w,N,Y){q(w,function(){N.apply(this,arguments)},Y)},count:function(w){var N=0;return q(w,function(){N++}),N},toArray:function(w){return q(w,function(N){return N})||[]},only:function(w){if(!te(w))throw Error("React.Children.only expected to receive a single React element child.");return w}};return pe.Activity=b,pe.Children=Re,pe.Component=K,pe.Fragment=s,pe.Profiler=u,pe.PureComponent=I,pe.StrictMode=l,pe.Suspense=m,pe.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=M,pe.__COMPILER_RUNTIME={__proto__:null,c:function(w){return M.H.useMemoCache(w)}},pe.cache=function(w){return function(){return w.apply(null,arguments)}},pe.cacheSignal=function(){return null},pe.cloneElement=function(w,N,Y){if(w==null)throw Error("The argument must be a React element, but you passed "+w+".");var P=O({},w.props),ue=w.key;if(N!=null)for(fe in N.key!==void 0&&(ue=""+N.key),N)!E.call(N,fe)||fe==="key"||fe==="__self"||fe==="__source"||fe==="ref"&&N.ref===void 0||(P[fe]=N[fe]);var fe=arguments.length-2;if(fe===1)P.children=Y;else if(1<fe){for(var me=Array(fe),Ze=0;Ze<fe;Ze++)me[Ze]=arguments[Ze+2];P.children=me}return B(w.type,ue,P)},pe.createContext=function(w){return w={$$typeof:d,_currentValue:w,_currentValue2:w,_threadCount:0,Provider:null,Consumer:null},w.Provider=w,w.Consumer={$$typeof:f,_context:w},w},pe.createElement=function(w,N,Y){var P,ue={},fe=null;if(N!=null)for(P in N.key!==void 0&&(fe=""+N.key),N)E.call(N,P)&&P!=="key"&&P!=="__self"&&P!=="__source"&&(ue[P]=N[P]);var me=arguments.length-2;if(me===1)ue.children=Y;else if(1<me){for(var Ze=Array(me),De=0;De<me;De++)Ze[De]=arguments[De+2];ue.children=Ze}if(w&&w.defaultProps)for(P in me=w.defaultProps,me)ue[P]===void 0&&(ue[P]=me[P]);return B(w,fe,ue)},pe.createRef=function(){return{current:null}},pe.forwardRef=function(w){return{$$typeof:h,render:w}},pe.isValidElement=te,pe.lazy=function(w){return{$$typeof:x,_payload:{_status:-1,_result:w},_init:ae}},pe.memo=function(w,N){return{$$typeof:g,type:w,compare:N===void 0?null:N}},pe.startTransition=function(w){var N=M.T,Y={};M.T=Y;try{var P=w(),ue=M.S;ue!==null&&ue(Y,P),typeof P=="object"&&P!==null&&typeof P.then=="function"&&P.then(de,Te)}catch(fe){Te(fe)}finally{N!==null&&Y.types!==null&&(N.types=Y.types),M.T=N}},pe.unstable_useCacheRefresh=function(){return M.H.useCacheRefresh()},pe.use=function(w){return M.H.use(w)},pe.useActionState=function(w,N,Y){return M.H.useActionState(w,N,Y)},pe.useCallback=function(w,N){return M.H.useCallback(w,N)},pe.useContext=function(w){return M.H.useContext(w)},pe.useDebugValue=function(){},pe.useDeferredValue=function(w,N){return M.H.useDeferredValue(w,N)},pe.useEffect=function(w,N){return M.H.useEffect(w,N)},pe.useEffectEvent=function(w){return M.H.useEffectEvent(w)},pe.useId=function(){return M.H.useId()},pe.useImperativeHandle=function(w,N,Y){return M.H.useImperativeHandle(w,N,Y)},pe.useInsertionEffect=function(w,N){return M.H.useInsertionEffect(w,N)},pe.useLayoutEffect=function(w,N){return M.H.useLayoutEffect(w,N)},pe.useMemo=function(w,N){return M.H.useMemo(w,N)},pe.useOptimistic=function(w,N){return M.H.useOptimistic(w,N)},pe.useReducer=function(w,N,Y){return M.H.useReducer(w,N,Y)},pe.useRef=function(w){return M.H.useRef(w)},pe.useState=function(w){return M.H.useState(w)},pe.useSyncExternalStore=function(w,N,Y){return M.H.useSyncExternalStore(w,N,Y)},pe.useTransition=function(){return M.H.useTransition()},pe.version="19.2.8",pe}var Um;function cf(){return Um||(Um=1,Tc.exports=gx()),Tc.exports}var Q=cf(),Mc={exports:{}},er={},Dc={exports:{}},Rc={};var Nm;function yx(){return Nm||(Nm=1,(function(n){function i(R,q){var ae=R.length;R.push(q);e:for(;0<ae;){var Te=ae-1>>>1,Re=R[Te];if(0<u(Re,q))R[Te]=q,R[ae]=Re,ae=Te;else break e}}function s(R){return R.length===0?null:R[0]}function l(R){if(R.length===0)return null;var q=R[0],ae=R.pop();if(ae!==q){R[0]=ae;e:for(var Te=0,Re=R.length,w=Re>>>1;Te<w;){var N=2*(Te+1)-1,Y=R[N],P=N+1,ue=R[P];if(0>u(Y,ae))P<Re&&0>u(ue,Y)?(R[Te]=ue,R[P]=ae,Te=P):(R[Te]=Y,R[N]=ae,Te=N);else if(P<Re&&0>u(ue,ae))R[Te]=ue,R[P]=ae,Te=P;else break e}}return q}function u(R,q){var ae=R.sortIndex-q.sortIndex;return ae!==0?ae:R.id-q.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=[],x=1,b=null,D=3,V=!1,k=!1,O=!1,L=!1,K=typeof setTimeout=="function"?setTimeout:null,G=typeof clearTimeout=="function"?clearTimeout:null,I=typeof setImmediate<"u"?setImmediate:null;function H(R){for(var q=s(g);q!==null;){if(q.callback===null)l(g);else if(q.startTime<=R)l(g),q.sortIndex=q.expirationTime,i(m,q);else break;q=s(g)}}function Z(R){if(O=!1,H(R),!k)if(s(m)!==null)k=!0,de||(de=!0,le());else{var q=s(g);q!==null&&re(Z,q.startTime-R)}}var de=!1,M=-1,E=5,B=-1;function W(){return L?!0:!(n.unstable_now()-B<E)}function te(){if(L=!1,de){var R=n.unstable_now();B=R;var q=!0;try{e:{k=!1,O&&(O=!1,G(M),M=-1),V=!0;var ae=D;try{t:{for(H(R),b=s(m);b!==null&&!(b.expirationTime>R&&W());){var Te=b.callback;if(typeof Te=="function"){b.callback=null,D=b.priorityLevel;var Re=Te(b.expirationTime<=R);if(R=n.unstable_now(),typeof Re=="function"){b.callback=Re,H(R),q=!0;break t}b===s(m)&&l(m),H(R)}else l(m);b=s(m)}if(b!==null)q=!0;else{var w=s(g);w!==null&&re(Z,w.startTime-R),q=!1}}break e}finally{b=null,D=ae,V=!1}q=void 0}}finally{q?le():de=!1}}}var le;if(typeof I=="function")le=function(){I(te)};else if(typeof MessageChannel<"u"){var $e=new MessageChannel,he=$e.port2;$e.port1.onmessage=te,le=function(){he.postMessage(null)}}else le=function(){K(te,0)};function re(R,q){M=K(function(){R(n.unstable_now())},q)}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(R){R.callback=null},n.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):E=0<R?Math.floor(1e3/R):5},n.unstable_getCurrentPriorityLevel=function(){return D},n.unstable_next=function(R){switch(D){case 1:case 2:case 3:var q=3;break;default:q=D}var ae=D;D=q;try{return R()}finally{D=ae}},n.unstable_requestPaint=function(){L=!0},n.unstable_runWithPriority=function(R,q){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var ae=D;D=R;try{return q()}finally{D=ae}},n.unstable_scheduleCallback=function(R,q,ae){var Te=n.unstable_now();switch(typeof ae=="object"&&ae!==null?(ae=ae.delay,ae=typeof ae=="number"&&0<ae?Te+ae:Te):ae=Te,R){case 1:var Re=-1;break;case 2:Re=250;break;case 5:Re=1073741823;break;case 4:Re=1e4;break;default:Re=5e3}return Re=ae+Re,R={id:x++,callback:q,priorityLevel:R,startTime:ae,expirationTime:Re,sortIndex:-1},ae>Te?(R.sortIndex=ae,i(g,R),s(m)===null&&R===s(g)&&(O?(G(M),M=-1):O=!0,re(Z,ae-Te))):(R.sortIndex=Re,i(m,R),k||V||(k=!0,de||(de=!0,le()))),R},n.unstable_shouldYield=W,n.unstable_wrapCallback=function(R){var q=D;return function(){var ae=D;D=q;try{return R.apply(this,arguments)}finally{D=ae}}}})(Rc)),Rc}var Lm;function vx(){return Lm||(Lm=1,Dc.exports=yx()),Dc.exports}var Cc={exports:{}},wt={};var km;function bx(){if(km)return wt;km=1;var n=cf();function i(m){var g="https://react.dev/errors/"+m;if(1<arguments.length){g+="?args[]="+encodeURIComponent(arguments[1]);for(var x=2;x<arguments.length;x++)g+="&args[]="+encodeURIComponent(arguments[x])}return"Minified React error #"+m+"; visit "+g+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(){}var 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,x){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:b==null?null:""+b,children:m,containerInfo:g,implementation:x}}var d=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function h(m,g){if(m==="font")return"";if(typeof g=="string")return g==="use-credentials"?g:""}return wt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=l,wt.createPortal=function(m,g){var x=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!g||g.nodeType!==1&&g.nodeType!==9&&g.nodeType!==11)throw Error(i(299));return f(m,g,null,x)},wt.flushSync=function(m){var g=d.T,x=l.p;try{if(d.T=null,l.p=2,m)return m()}finally{d.T=g,l.p=x,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 x=g.as,b=h(x,g.crossOrigin),D=typeof g.integrity=="string"?g.integrity:void 0,V=typeof g.fetchPriority=="string"?g.fetchPriority:void 0;x==="style"?l.d.S(m,typeof g.precedence=="string"?g.precedence:void 0,{crossOrigin:b,integrity:D,fetchPriority:V}):x==="script"&&l.d.X(m,{crossOrigin:b,integrity:D,fetchPriority:V,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 x=h(g.as,g.crossOrigin);l.d.M(m,{crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0})}}else g==null&&l.d.M(m)},wt.preload=function(m,g){if(typeof m=="string"&&typeof g=="object"&&g!==null&&typeof g.as=="string"){var x=g.as,b=h(x,g.crossOrigin);l.d.L(m,x,{crossOrigin:b,integrity:typeof g.integrity=="string"?g.integrity:void 0,nonce:typeof g.nonce=="string"?g.nonce:void 0,type:typeof g.type=="string"?g.type:void 0,fetchPriority:typeof g.fetchPriority=="string"?g.fetchPriority:void 0,referrerPolicy:typeof g.referrerPolicy=="string"?g.referrerPolicy:void 0,imageSrcSet:typeof g.imageSrcSet=="string"?g.imageSrcSet:void 0,imageSizes:typeof g.imageSizes=="string"?g.imageSizes:void 0,media:typeof g.media=="string"?g.media:void 0})}},wt.preloadModule=function(m,g){if(typeof m=="string")if(g){var x=h(g.as,g.crossOrigin);l.d.m(m,{as:typeof g.as=="string"&&g.as!=="script"?g.as:void 0,crossOrigin:x,integrity:typeof g.integrity=="string"?g.integrity:void 0})}else 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,x){return d.H.useFormState(m,g,x)},wt.useFormStatus=function(){return d.H.useHostTransitionStatus()},wt.version="19.2.8",wt}var jm;function xx(){if(jm)return Cc.exports;jm=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=bx(),Cc.exports}var Bm;function Sx(){if(Bm)return er;Bm=1;var n=vx(),i=cf(),s=xx();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 x(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=x(e),t!==null)return t;e=e.sibling}return null}var b=Object.assign,D=Symbol.for("react.element"),V=Symbol.for("react.transitional.element"),k=Symbol.for("react.portal"),O=Symbol.for("react.fragment"),L=Symbol.for("react.strict_mode"),K=Symbol.for("react.profiler"),G=Symbol.for("react.consumer"),I=Symbol.for("react.context"),H=Symbol.for("react.forward_ref"),Z=Symbol.for("react.suspense"),de=Symbol.for("react.suspense_list"),M=Symbol.for("react.memo"),E=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),W=Symbol.for("react.memo_cache_sentinel"),te=Symbol.iterator;function le(e){return e===null||typeof e!="object"?null:(e=te&&e[te]||e["@@iterator"],typeof e=="function"?e:null)}var $e=Symbol.for("react.client.reference");function he(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===$e?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case O:return"Fragment";case K:return"Profiler";case L:return"StrictMode";case Z:return"Suspense";case de:return"SuspenseList";case B:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case k:return"Portal";case I:return e.displayName||"Context";case G:return(e._context.displayName||"Context")+".Consumer";case H:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case M:return t=e.displayName||null,t!==null?t:he(e.type)||"Memo";case E:t=e._payload,e=e._init;try{return he(e(t))}catch{}}return null}var re=Array.isArray,R=i.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,q=s.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ae={pending:!1,data:null,method:null,action:null},Te=[],Re=-1;function w(e){return{current:e}}function N(e){0>Re||(e.current=Te[Re],Te[Re]=null,Re--)}function Y(e,t){Re++,Te[Re]=e.current,e.current=t}var P=w(null),ue=w(null),fe=w(null),me=w(null);function Ze(e,t){switch(Y(fe,t),Y(ue,e),Y(P,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Jp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Jp(t),e=em(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}N(P),Y(P,e)}function De(){N(P),N(ue),N(fe)}function gn(e){e.memoizedState!==null&&Y(me,e);var t=P.current,a=em(t,e.type);t!==a&&(Y(ue,e),Y(P,a))}function Jn(e){ue.current===e&&(N(P),N(ue)),me.current===e&&(N(me),Qs._currentValue=ae)}var Mt,Mn;function be(e){if(Mt===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);Mt=t&&t[1]||"",Mn=-1<a.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
-
`+Mt+e+Mn}var yn=!1;function fn(e,t){if(!e||yn)return"";yn=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var r={DetermineComponentFrameRoot:function(){try{if(t){var F=function(){throw Error()};if(Object.defineProperty(F.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(F,[])}catch(U){var _=U}Reflect.construct(e,[],F)}else{try{F.call()}catch(U){_=U}e.call(F.prototype)}}else{try{throw Error()}catch(U){_=U}(F=e())&&typeof F.catch=="function"&&F.catch(function(){})}}catch(U){if(U&&_&&typeof U.stack=="string")return[U.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
|
-
`),z=y.split(`
|
|
5
|
-
`);for(o=r=0;r<S.length&&!S[r].includes("DetermineComponentFrameRoot");)r++;for(;o<z.length&&!z[o].includes("DetermineComponentFrameRoot");)o++;if(r===S.length||o===z.length)for(r=S.length-1,o=z.length-1;1<=r&&0<=o&&S[r]!==z[o];)o--;for(;1<=r&&0<=o;r--,o--)if(S[r]!==z[o]){if(r!==1||o!==1)do if(r--,o--,0>o||S[r]!==z[o]){var j=`
|
|
6
|
-
`+S[r].replace(" at new "," at ");return e.displayName&&j.includes("<anonymous>")&&(j=j.replace("<anonymous>",e.displayName)),j}while(1<=r&&0<=o);break}}}finally{yn=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?be(a):""}function ee(e,t){switch(e.tag){case 26:case 27:case 5:return be(e.type);case 16:return be("Lazy");case 13:return e.child!==t&&t!==null?be("Suspense Fallback"):be("Suspense");case 19:return be("SuspenseList");case 0:case 15:return fn(e.type,!1);case 11:return fn(e.type.render,!1);case 1:return fn(e.type,!0);case 31:return be("Activity");default:return""}}function J(e){try{var t="",a=null;do t+=ee(e,a),a=e,e=e.return;while(e);return t}catch(r){return`
|
|
7
|
-
Error generating stack: `+r.message+`
|
|
8
|
-
`+r.stack}}var ye=Object.prototype.hasOwnProperty,Ce=n.unstable_scheduleCallback,Ke=n.unstable_cancelCallback,Qe=n.unstable_shouldYield,Kt=n.unstable_requestPaint,Ve=n.unstable_now,dn=n.unstable_getCurrentPriorityLevel,xt=n.unstable_ImmediatePriority,Lt=n.unstable_UserBlockingPriority,Dn=n.unstable_NormalPriority,la=n.unstable_LowPriority,Rn=n.unstable_IdlePriority,zi=n.log,At=n.unstable_setDisableYieldValue,ct=null,He=null;function St(e){if(typeof zi=="function"&&At(e),He&&typeof He.setStrictMode=="function")try{He.setStrictMode(ct,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 gr=256,yr=262144,vr=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 br(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 tv(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 Nf(){var e=vr;return vr<<=1,(vr&62914560)===0&&(vr=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 nv(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,z=e.hiddenUpdates;for(a=p&~a;0<a;){var j=31-tt(a),F=1<<j;y[j]=0,S[j]=-1;var _=z[j];if(_!==null)for(z[j]=null,j=0;j<_.length;j++){var U=_[j];U!==null&&(U.lane&=-536870913)}a&=~F}r!==0&&Lf(e,r,0),c!==0&&o===0&&e.tag!==0&&(e.suspendedLanes|=c&~(p&~t))}function Lf(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 jf(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 Bf(){var e=q.p;return e!==0?e:(e=window.event,e===void 0?32:Em(e.type))}function Gf(e,t){var a=q.p;try{return q.p=e,t()}finally{q.p=a}}var ei=Math.random().toString(36).slice(2),mt="__reactFiber$"+ei,Dt="__reactProps$"+ei,ua="__reactContainer$"+ei,pu="__reactEvents$"+ei,iv="__reactListeners$"+ei,av="__reactHandles$"+ei,$f="__reactResources$"+ei,cs="__reactMarker$"+ei;function mu(e){delete e[mt],delete e[Dt],delete e[pu],delete e[iv],delete e[av]}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=lm(e);e!==null;){if(a=e[mt])return a;e=lm(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[$f];return t||(t=e[$f]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function ft(e){e[cs]=!0}var Vf=new Set,If={};function Li(e,t){da(e,t),da(e+"Capture",t)}function da(e,t){for(If[e]=t,e=0;e<t.length;e++)Vf.add(t[e])}var sv=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]*$"),Ff={},Hf={};function rv(e){return ye.call(Hf,e)?!0:ye.call(Ff,e)?!1:sv.test(e)?Hf[e]=!0:(Ff[e]=!0,!1)}function xr(e,t,a){if(rv(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 Sr(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 Qt(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function lv(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=qf(e)?"checked":"value";e._valueTracker=lv(e,t,""+e[t])}}function Yf(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),r="";return e&&(r=qf(e)?e.checked?"true":"false":e.value),e=r,e!==a?(t.setValue(e),!0):!1}function wr(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 uv=/[\n"\\]/g;function Pt(e){return e.replace(uv,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=""+Qt(t)):e.value!==""+Qt(t)&&(e.value=""+Qt(t)):p!=="submit"&&p!=="reset"||e.removeAttribute("value"),t!=null?vu(e,p,Qt(t)):a!=null?vu(e,p,Qt(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=""+Qt(y):e.removeAttribute("name")}function Xf(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?""+Qt(a):"",t=t!=null?""+Qt(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"&&wr(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=""+Qt(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 Kf(e,t,a){if(t!=null&&(t=""+Qt(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+Qt(a):""}function Qf(e,t,a,r){if(t==null){if(r!=null){if(a!=null)throw Error(l(92));if(re(r)){if(1<r.length)throw Error(l(93));r=r[0]}a=r}a==null&&(a=""),t=a}a=Qt(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 ov=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 Pf(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||ov.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Zf(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&&Pf(e,o,r)}else for(var c in t)t.hasOwnProperty(c)&&Pf(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 cv=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"]]),fv=/^[\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 Er(e){return fv.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 Wf(e){var t=ca(e);if(t&&(e=t.stateNode)){var a=e[Dt]||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="'+Pt(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var r=a[t];if(r!==e&&r.form===e.form){var o=r[Dt]||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&&Yf(r)}break e;case"textarea":Kf(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&ha(e,!!a.multiple,t,!1)}}}var wu=!1;function Jf(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)&&(cl(),ma&&(t=ma,e=ga,ga=ma=null,Wf(t),e)))for(t=0;t<e.length;t++)Wf(e[t])}}function ds(e,t){var a=e.stateNode;if(a===null)return null;var r=a[Dt]||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 ti=null,Au=null,Ar=null;function ed(){if(Ar)return Ar;var e,t=Au,a=t.length,r,o="value"in ti?ti.value:ti.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 Ar=o.slice(e,1<r?1-r:void 0)}function Tr(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 Mr(){return!0}function td(){return!1}function Rt(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)?Mr:td,this.isPropagationStopped=td,this}return b(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Mr)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Mr)},persist:function(){},isPersistent:Mr}),t}var ki={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Dr=Rt(ki),ps=b({},ki,{view:0,detail:0}),dv=Rt(ps),Tu,Mu,ms,Rr=b({},ps,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ru,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"?(Tu=e.screenX-ms.screenX,Mu=e.screenY-ms.screenY):Mu=Tu=0,ms=e),Tu)},movementY:function(e){return"movementY"in e?e.movementY:Mu}}),nd=Rt(Rr),hv=b({},Rr,{dataTransfer:0}),pv=Rt(hv),mv=b({},ps,{relatedTarget:0}),Du=Rt(mv),gv=b({},ki,{animationName:0,elapsedTime:0,pseudoElement:0}),yv=Rt(gv),vv=b({},ki,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),bv=Rt(vv),xv=b({},ki,{data:0}),id=Rt(xv),Sv={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},wv={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"},Ev={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Av(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ev[e])?!!t[e]:!1}function Ru(){return Av}var Tv=b({},ps,{key:function(e){if(e.key){var t=Sv[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=Tr(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?wv[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ru,charCode:function(e){return e.type==="keypress"?Tr(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?Tr(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Mv=Rt(Tv),Dv=b({},Rr,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ad=Rt(Dv),Rv=b({},ps,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ru}),Cv=Rt(Rv),Ov=b({},ki,{propertyName:0,elapsedTime:0,pseudoElement:0}),zv=Rt(Ov),_v=b({},Rr,{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}),Uv=Rt(_v),Nv=b({},ki,{newState:0,oldState:0}),Lv=Rt(Nv),kv=[9,13,27,32],Cu=zn&&"CompositionEvent"in window,gs=null;zn&&"documentMode"in document&&(gs=document.documentMode);var jv=zn&&"TextEvent"in window&&!gs,sd=zn&&(!Cu||gs&&8<gs&&11>=gs),rd=" ",ld=!1;function ud(e,t){switch(e){case"keyup":return kv.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function od(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ya=!1;function Bv(e,t){switch(e){case"compositionend":return od(t);case"keypress":return t.which!==32?null:(ld=!0,rd);case"textInput":return e=t.data,e===rd&&ld?null:e;default:return null}}function Gv(e,t){if(ya)return e==="compositionend"||!Cu&&ud(e,t)?(e=ed(),Ar=Au=ti=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 sd&&t.locale!=="ko"?null:t.data;default:return null}}var $v={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 cd(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!$v[e.type]:t==="textarea"}function fd(e,t,a,r){ma?ga?ga.push(r):ga=[r]:ma=r,t=yl(t,"onChange"),0<t.length&&(a=new Dr("onChange","change",null,a,r),e.push({event:a,listeners:t}))}var ys=null,vs=null;function Vv(e){Xp(e,0)}function Cr(e){var t=fs(e);if(Yf(t))return e}function dd(e,t){if(e==="change")return t}var hd=!1;if(zn){var Ou;if(zn){var zu="oninput"in document;if(!zu){var pd=document.createElement("div");pd.setAttribute("oninput","return;"),zu=typeof pd.oninput=="function"}Ou=zu}else Ou=!1;hd=Ou&&(!document.documentMode||9<document.documentMode)}function md(){ys&&(ys.detachEvent("onpropertychange",gd),vs=ys=null)}function gd(e){if(e.propertyName==="value"&&Cr(vs)){var t=[];fd(t,vs,e,Su(e)),Jf(Vv,t)}}function Iv(e,t,a){e==="focusin"?(md(),ys=t,vs=a,ys.attachEvent("onpropertychange",gd)):e==="focusout"&&md()}function Fv(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return Cr(vs)}function Hv(e,t){if(e==="click")return Cr(t)}function qv(e,t){if(e==="input"||e==="change")return Cr(t)}function Yv(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var kt=typeof Object.is=="function"?Object.is:Yv;function bs(e,t){if(kt(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)||!kt(e[o],t[o]))return!1}return!0}function yd(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function vd(e,t){var a=yd(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=yd(a)}}function bd(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?bd(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function xd(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=wr(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=wr(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 Xv=zn&&"documentMode"in document&&11>=document.documentMode,va=null,Uu=null,xs=null,Nu=!1;function Sd(e,t,a){var r=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Nu||va==null||va!==wr(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=yl(Uu,"onSelect"),0<r.length&&(t=new Dr("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")},Lu={},wd={};zn&&(wd=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(Lu[e])return Lu[e];if(!ba[e])return e;var t=ba[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in wd)return Lu[e]=t[a];return e}var Ed=Bi("animationend"),Ad=Bi("animationiteration"),Td=Bi("animationstart"),Kv=Bi("transitionrun"),Qv=Bi("transitionstart"),Pv=Bi("transitioncancel"),Md=Bi("transitionend"),Dd=new Map,ku="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(" ");ku.push("scrollEnd");function hn(e,t){Dd.set(e,t),Li(t,[e])}var Or=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)},Zt=[],xa=0,ju=0;function zr(){for(var e=xa,t=ju=xa=0;t<e;){var a=Zt[t];Zt[t++]=null;var r=Zt[t];Zt[t++]=null;var o=Zt[t];Zt[t++]=null;var c=Zt[t];if(Zt[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 _r(e,t,a,r){Zt[xa++]=e,Zt[xa++]=t,Zt[xa++]=a,Zt[xa++]=r,ju|=r,e.lanes|=r,e=e.alternate,e!==null&&(e.lanes|=r)}function Bu(e,t,a,r){return _r(e,t,a,r),Ur(e)}function Gi(e,t){return _r(e,null,null,t),Ur(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 Ur(e){if(50<Is)throw Is=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 Zv(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 jt(e,t,a,r){return new Zv(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=jt(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 Cd(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 Nr(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=nx(e,a,P.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case B:return e=jt(31,a,t,o),e.elementType=B,e.lanes=c,e;case O:return $i(a.children,o,c,t);case L:p=8,o|=24;break;case K:return e=jt(12,a,t,o|2),e.elementType=K,e.lanes=c,e;case Z:return e=jt(13,a,t,o),e.elementType=Z,e.lanes=c,e;case de:return e=jt(19,a,t,o),e.elementType=de,e.lanes=c,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case I:p=10;break e;case G:p=9;break e;case H:p=11;break e;case M:p=14;break e;case E:p=16,r=null;break e}p=29,a=Error(l(130,e===null?"null":typeof e,"")),r=null}return t=jt(p,a,t,o),t.elementType=e,t.type=r,t.lanes=c,t}function $i(e,t,a,r){return e=jt(7,e,r,t),e.lanes=a,e}function $u(e,t,a){return e=jt(6,e,null,t),e.lanes=a,e}function Od(e){var t=jt(18,null,null,0);return t.stateNode=e,t}function Vu(e,t,a){return t=jt(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var zd=new WeakMap;function Wt(e,t){if(typeof e=="object"&&e!==null){var a=zd.get(e);return a!==void 0?a:(t={value:e,source:t,stack:J(t)},zd.set(e,t),t)}return{value:e,source:t,stack:J(t)}}var wa=[],Ea=0,Lr=null,Ss=0,Jt=[],en=0,ni=null,vn=1,bn="";function Un(e,t){wa[Ea++]=Ss,wa[Ea++]=Lr,Lr=e,Ss=t}function _d(e,t,a){Jt[en++]=vn,Jt[en++]=bn,Jt[en++]=ni,ni=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 Iu(e){e.return!==null&&(Un(e,1),_d(e,1,0))}function Fu(e){for(;e===Lr;)Lr=wa[--Ea],wa[Ea]=null,Ss=wa[--Ea],wa[Ea]=null;for(;e===ni;)ni=Jt[--en],Jt[en]=null,bn=Jt[--en],Jt[en]=null,vn=Jt[--en],Jt[en]=null}function Ud(e,t){Jt[en++]=vn,Jt[en++]=bn,Jt[en++]=ni,vn=t.id,bn=t.overflow,ni=e}var gt=null,Ie=null,Me=!1,ii=null,tn=!1,Hu=Error(l(519));function ai(e){var t=Error(l(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw ws(Wt(t,e)),Hu}function Nd(e){var t=e.stateNode,a=e.type,r=e.memoizedProps;switch(t[mt]=e,t[Dt]=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),Xf(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),Qf(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||Zp(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||ai(e,!0)}function Ld(e){for(gt=e.return;gt;)switch(gt.tag){case 5:case 31:case 13:tn=!1;return;case 27:case 3:tn=!0;return;default:gt=gt.return}}function Aa(e){if(e!==gt)return!1;if(!Me)return Ld(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&&Ie&&ai(e),Ld(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ie=rm(e)}else if(t===31){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(317));Ie=rm(e)}else t===27?(t=Ie,vi(e.type)?(e=pc,pc=null,Ie=e):Ie=t):Ie=gt?an(e.stateNode.nextSibling):null;return!0}function Vi(){Ie=gt=null,Me=!1}function qu(){var e=ii;return e!==null&&(_t===null?_t=e:_t.push.apply(_t,e),ii=null),e}function ws(e){ii===null?ii=[e]:ii.push(e)}var Yu=w(null),Ii=null,Nn=null;function si(e,t,a){Y(Yu,t._currentValue),t._currentValue=a}function Ln(e){e._currentValue=Yu.current,N(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 Ta(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;kt(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 kr(e){for(e=e.firstContext;e!==null;){if(!kt(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function Fi(e){Ii=e,Nn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function yt(e){return kd(Ii,e)}function jr(e,t){return Ii===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 Wv=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()})}},Jv=n.unstable_scheduleCallback,eb=n.unstable_NormalPriority,st={$$typeof:I,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Qu(){return{controller:new Wv,data:new Map,refCount:0}}function Es(e){e.refCount--,e.refCount===0&&Jv(eb,function(){e.controller.abort()})}var As=null,Pu=0,Ma=0,Da=null;function tb(e,t){if(As===null){var a=As=[];Pu=0,Ma=ec(),Da={status:"pending",value:void 0,then:function(r){a.push(r)}}}return Pu++,t.then(jd,jd),t}function jd(){if(--Pu===0&&As!==null){Da!==null&&(Da.status="fulfilled");var e=As;As=null,Ma=0,Da=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function nb(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 Bd=R.S;R.S=function(e,t){Sp=Ve(),typeof t=="object"&&t!==null&&typeof t.then=="function"&&tb(e,t),Bd!==null&&Bd(e,t)};var Hi=w(null);function Zu(){var e=Hi.current;return e!==null?e:Ge.pooledCache}function Br(e,t){t===null?Y(Hi,Hi.current):Y(Hi,t.pool)}function Gd(){var e=Zu();return e===null?null:{parent:st._currentValue,pool:e}}var Ra=Error(l(460)),Wu=Error(l(474)),Gr=Error(l(542)),$r={then:function(){}};function $d(e){return e=e.status,e==="fulfilled"||e==="rejected"}function Vd(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,Fd(e),e;default:if(typeof t.status=="string")t.then(On,On);else{if(e=Ge,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,Fd(e),e}throw Yi=t,Ra}}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,Ra):a}}var Yi=null;function Id(){if(Yi===null)throw Error(l(459));var e=Yi;return Yi=null,e}function Fd(e){if(e===Ra||e===Gr)throw Error(l(483))}var Ca=null,Ts=0;function Vr(e){var t=Ts;return Ts+=1,Ca===null&&(Ca=[]),Vd(Ca,e,t)}function Ms(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Ir(e,t){throw t.$$typeof===D?Error(l(525)):(e=Object.prototype.toString.call(t),Error(l(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function Hd(e){function t(T,A){if(e){var C=T.deletions;C===null?(T.deletions=[A],T.flags|=16):C.push(A)}}function a(T,A){if(!e)return null;for(;A!==null;)t(T,A),A=A.sibling;return null}function r(T){for(var A=new Map;T!==null;)T.key!==null?A.set(T.key,T):A.set(T.index,T),T=T.sibling;return A}function o(T,A){return T=_n(T,A),T.index=0,T.sibling=null,T}function c(T,A,C){return T.index=C,e?(C=T.alternate,C!==null?(C=C.index,C<A?(T.flags|=67108866,A):C):(T.flags|=67108866,A)):(T.flags|=1048576,A)}function p(T){return e&&T.alternate===null&&(T.flags|=67108866),T}function y(T,A,C,$){return A===null||A.tag!==6?(A=$u(C,T.mode,$),A.return=T,A):(A=o(A,C),A.return=T,A)}function S(T,A,C,$){var oe=C.type;return oe===O?j(T,A,C.props.children,$,C.key):A!==null&&(A.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===E&&qi(oe)===A.type)?(A=o(A,C.props),Ms(A,C),A.return=T,A):(A=Nr(C.type,C.key,C.props,null,T.mode,$),Ms(A,C),A.return=T,A)}function z(T,A,C,$){return A===null||A.tag!==4||A.stateNode.containerInfo!==C.containerInfo||A.stateNode.implementation!==C.implementation?(A=Vu(C,T.mode,$),A.return=T,A):(A=o(A,C.children||[]),A.return=T,A)}function j(T,A,C,$,oe){return A===null||A.tag!==7?(A=$i(C,T.mode,$,oe),A.return=T,A):(A=o(A,C),A.return=T,A)}function F(T,A,C){if(typeof A=="string"&&A!==""||typeof A=="number"||typeof A=="bigint")return A=$u(""+A,T.mode,C),A.return=T,A;if(typeof A=="object"&&A!==null){switch(A.$$typeof){case V:return C=Nr(A.type,A.key,A.props,null,T.mode,C),Ms(C,A),C.return=T,C;case k:return A=Vu(A,T.mode,C),A.return=T,A;case E:return A=qi(A),F(T,A,C)}if(re(A)||le(A))return A=$i(A,T.mode,C,null),A.return=T,A;if(typeof A.then=="function")return F(T,Vr(A),C);if(A.$$typeof===I)return F(T,jr(T,A),C);Ir(T,A)}return null}function _(T,A,C,$){var oe=A!==null?A.key:null;if(typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint")return oe!==null?null:y(T,A,""+C,$);if(typeof C=="object"&&C!==null){switch(C.$$typeof){case V:return C.key===oe?S(T,A,C,$):null;case k:return C.key===oe?z(T,A,C,$):null;case E:return C=qi(C),_(T,A,C,$)}if(re(C)||le(C))return oe!==null?null:j(T,A,C,$,null);if(typeof C.then=="function")return _(T,A,Vr(C),$);if(C.$$typeof===I)return _(T,A,jr(T,C),$);Ir(T,C)}return null}function U(T,A,C,$,oe){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return T=T.get(C)||null,y(A,T,""+$,oe);if(typeof $=="object"&&$!==null){switch($.$$typeof){case V:return T=T.get($.key===null?C:$.key)||null,S(A,T,$,oe);case k:return T=T.get($.key===null?C:$.key)||null,z(A,T,$,oe);case E:return $=qi($),U(T,A,C,$,oe)}if(re($)||le($))return T=T.get(C)||null,j(A,T,$,oe,null);if(typeof $.then=="function")return U(T,A,C,Vr($),oe);if($.$$typeof===I)return U(T,A,C,jr(A,$),oe);Ir(A,$)}return null}function ne(T,A,C,$){for(var oe=null,Oe=null,se=A,ve=A=0,Ae=null;se!==null&&ve<C.length;ve++){se.index>ve?(Ae=se,se=null):Ae=se.sibling;var ze=_(T,se,C[ve],$);if(ze===null){se===null&&(se=Ae);break}e&&se&&ze.alternate===null&&t(T,se),A=c(ze,A,ve),Oe===null?oe=ze:Oe.sibling=ze,Oe=ze,se=Ae}if(ve===C.length)return a(T,se),Me&&Un(T,ve),oe;if(se===null){for(;ve<C.length;ve++)se=F(T,C[ve],$),se!==null&&(A=c(se,A,ve),Oe===null?oe=se:Oe.sibling=se,Oe=se);return Me&&Un(T,ve),oe}for(se=r(se);ve<C.length;ve++)Ae=U(se,T,ve,C[ve],$),Ae!==null&&(e&&Ae.alternate!==null&&se.delete(Ae.key===null?ve:Ae.key),A=c(Ae,A,ve),Oe===null?oe=Ae:Oe.sibling=Ae,Oe=Ae);return e&&se.forEach(function(Ei){return t(T,Ei)}),Me&&Un(T,ve),oe}function ce(T,A,C,$){if(C==null)throw Error(l(151));for(var oe=null,Oe=null,se=A,ve=A=0,Ae=null,ze=C.next();se!==null&&!ze.done;ve++,ze=C.next()){se.index>ve?(Ae=se,se=null):Ae=se.sibling;var Ei=_(T,se,ze.value,$);if(Ei===null){se===null&&(se=Ae);break}e&&se&&Ei.alternate===null&&t(T,se),A=c(Ei,A,ve),Oe===null?oe=Ei:Oe.sibling=Ei,Oe=Ei,se=Ae}if(ze.done)return a(T,se),Me&&Un(T,ve),oe;if(se===null){for(;!ze.done;ve++,ze=C.next())ze=F(T,ze.value,$),ze!==null&&(A=c(ze,A,ve),Oe===null?oe=ze:Oe.sibling=ze,Oe=ze);return Me&&Un(T,ve),oe}for(se=r(se);!ze.done;ve++,ze=C.next())ze=U(se,T,ve,ze.value,$),ze!==null&&(e&&ze.alternate!==null&&se.delete(ze.key===null?ve:ze.key),A=c(ze,A,ve),Oe===null?oe=ze:Oe.sibling=ze,Oe=ze);return e&&se.forEach(function(hx){return t(T,hx)}),Me&&Un(T,ve),oe}function Be(T,A,C,$){if(typeof C=="object"&&C!==null&&C.type===O&&C.key===null&&(C=C.props.children),typeof C=="object"&&C!==null){switch(C.$$typeof){case V:e:{for(var oe=C.key;A!==null;){if(A.key===oe){if(oe=C.type,oe===O){if(A.tag===7){a(T,A.sibling),$=o(A,C.props.children),$.return=T,T=$;break e}}else if(A.elementType===oe||typeof oe=="object"&&oe!==null&&oe.$$typeof===E&&qi(oe)===A.type){a(T,A.sibling),$=o(A,C.props),Ms($,C),$.return=T,T=$;break e}a(T,A);break}else t(T,A);A=A.sibling}C.type===O?($=$i(C.props.children,T.mode,$,C.key),$.return=T,T=$):($=Nr(C.type,C.key,C.props,null,T.mode,$),Ms($,C),$.return=T,T=$)}return p(T);case k:e:{for(oe=C.key;A!==null;){if(A.key===oe)if(A.tag===4&&A.stateNode.containerInfo===C.containerInfo&&A.stateNode.implementation===C.implementation){a(T,A.sibling),$=o(A,C.children||[]),$.return=T,T=$;break e}else{a(T,A);break}else t(T,A);A=A.sibling}$=Vu(C,T.mode,$),$.return=T,T=$}return p(T);case E:return C=qi(C),Be(T,A,C,$)}if(re(C))return ne(T,A,C,$);if(le(C)){if(oe=le(C),typeof oe!="function")throw Error(l(150));return C=oe.call(C),ce(T,A,C,$)}if(typeof C.then=="function")return Be(T,A,Vr(C),$);if(C.$$typeof===I)return Be(T,A,jr(T,C),$);Ir(T,C)}return typeof C=="string"&&C!==""||typeof C=="number"||typeof C=="bigint"?(C=""+C,A!==null&&A.tag===6?(a(T,A.sibling),$=o(A,C),$.return=T,T=$):(a(T,A),$=$u(C,T.mode,$),$.return=T,T=$),p(T)):a(T,A)}return function(T,A,C,$){try{Ts=0;var oe=Be(T,A,C,$);return Ca=null,oe}catch(se){if(se===Ra||se===Gr)throw se;var Oe=jt(29,se,null,T.mode);return Oe.lanes=$,Oe.return=T,Oe}}}var Xi=Hd(!0),qd=Hd(!1),ri=!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 li(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ui(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=Ur(e),Rd(e,null,a),t}return _r(e,r,t,a),Ur(e)}function Ds(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 Rs(){if(no){var e=Da;if(e!==null)throw e}}function Cs(e,t,a,r){no=!1;var o=e.updateQueue;ri=!1;var c=o.firstBaseUpdate,p=o.lastBaseUpdate,y=o.shared.pending;if(y!==null){o.shared.pending=null;var S=y,z=S.next;S.next=null,p===null?c=z:p.next=z,p=S;var j=e.alternate;j!==null&&(j=j.updateQueue,y=j.lastBaseUpdate,y!==p&&(y===null?j.firstBaseUpdate=z:y.next=z,j.lastBaseUpdate=S))}if(c!==null){var F=o.baseState;p=0,j=z=S=null,y=c;do{var _=y.lane&-536870913,U=_!==y.lane;if(U?(Ee&_)===_:(r&_)===_){_!==0&&_===Ma&&(no=!0),j!==null&&(j=j.next={lane:0,tag:y.tag,payload:y.payload,callback:null,next:null});e:{var ne=e,ce=y;_=t;var Be=a;switch(ce.tag){case 1:if(ne=ce.payload,typeof ne=="function"){F=ne.call(Be,F,_);break e}F=ne;break e;case 3:ne.flags=ne.flags&-65537|128;case 0:if(ne=ce.payload,_=typeof ne=="function"?ne.call(Be,F,_):ne,_==null)break e;F=b({},F,_);break e;case 2:ri=!0}}_=y.callback,_!==null&&(e.flags|=64,U&&(e.flags|=8192),U=o.callbacks,U===null?o.callbacks=[_]:U.push(_))}else U={lane:_,tag:y.tag,payload:y.payload,callback:y.callback,next:null},j===null?(z=j=U,S=F):j=j.next=U,p|=_;if(y=y.next,y===null){if(y=o.shared.pending,y===null)break;U=y,y=U.next,U.next=null,o.lastBaseUpdate=U,o.shared.pending=null}}while(!0);j===null&&(S=F),o.baseState=S,o.firstBaseUpdate=z,o.lastBaseUpdate=j,c===null&&(o.shared.lanes=0),hi|=p,e.lanes=p,e.memoizedState=F}}function Yd(e,t){if(typeof e!="function")throw Error(l(191,e));e.call(t)}function Xd(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)Yd(a[e],t)}var Oa=w(null),Fr=w(0);function Kd(e,t){e=Hn,Y(Fr,e),Y(Oa,t),Hn=e|t.baseLanes}function io(){Y(Fr,Hn),Y(Oa,Oa.current)}function ao(){Hn=Fr.current,N(Oa),N(Fr)}var Bt=w(null),nn=null;function oi(e){var t=e.alternate;Y(nt,nt.current&1),Y(Bt,e),nn===null&&(t===null||Oa.current!==null||t.memoizedState!==null)&&(nn=e)}function so(e){Y(nt,nt.current),Y(Bt,e),nn===null&&(nn=e)}function Qd(e){e.tag===22?(Y(nt,nt.current),Y(Bt,e),nn===null&&(nn=e)):ci()}function ci(){Y(nt,nt.current),Y(Bt,Bt.current)}function Gt(e){N(Bt),nn===e&&(nn=null),N(nt)}var nt=w(0);function Hr(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 kn=0,ge=null,ke=null,rt=null,qr=!1,za=!1,Ki=!1,Yr=0,Os=0,_a=null,ib=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(!kt(e[a],t[a]))return!1;return!0}function lo(e,t,a,r,o,c){return kn=c,ge=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,R.H=e===null||e.memoizedState===null?_h:Eo,Ki=!1,c=a(r,o),Ki=!1,za&&(c=Zd(t,a,r,o)),Pd(e),c}function Pd(e){R.H=Us;var t=ke!==null&&ke.next!==null;if(kn=0,rt=ke=ge=null,qr=!1,Os=0,_a=null,t)throw Error(l(300));e===null||lt||(e=e.dependencies,e!==null&&kr(e)&&(lt=!0))}function Zd(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=ke=null,e.updateQueue!=null){var c=e.updateQueue;c.lastEffect=null,c.events=null,c.stores=null,c.memoCache!=null&&(c.memoCache.index=0)}R.H=Uh,c=t(a,r)}while(za);return c}function ab(){var e=R.H,t=e.useState()[0];return t=typeof t.then=="function"?zs(t):t,e=e.useState()[0],(ke!==null?ke.memoizedState:null)!==e&&(ge.flags|=1024),t}function uo(){var e=Yr!==0;return Yr=0,e}function oo(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function co(e){if(qr){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}qr=!1}kn=0,rt=ke=ge=null,za=!1,Os=Yr=0,_a=null}function Tt(){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(ke===null){var e=ge.alternate;e=e!==null?e.memoizedState:null}else e=ke.next;var t=rt===null?ge.memoizedState:rt.next;if(t!==null)rt=t,ke=e;else{if(e===null)throw ge.alternate===null?Error(l(467)):Error(l(310));ke=e,e={memoizedState:ke.memoizedState,baseState:ke.baseState,baseQueue:ke.baseQueue,queue:ke.queue,next:null},rt===null?ge.memoizedState=rt=e:rt=rt.next=e}return rt}function Xr(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function zs(e){var t=Os;return Os+=1,_a===null&&(_a=[]),e=Vd(_a,e,t),t=ge,(rt===null?t.memoizedState:rt.next)===null&&(t=t.alternate,R.H=t===null||t.memoizedState===null?_h:Eo),e}function Kr(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return zs(e);if(e.$$typeof===I)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=Xr(),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]=W;return t.index++,a}function jn(e,t){return typeof t=="function"?t(e):t}function Qr(e){var t=it();return ho(t,ke,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,z=t,j=!1;do{var F=z.lane&-536870913;if(F!==z.lane?(Ee&F)===F:(kn&F)===F){var _=z.revertLane;if(_===0)S!==null&&(S=S.next={lane:0,revertLane:0,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null}),F===Ma&&(j=!0);else if((kn&_)===_){z=z.next,_===Ma&&(j=!0);continue}else F={lane:0,revertLane:z.revertLane,gesture:null,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},S===null?(y=S=F,p=c):S=S.next=F,ge.lanes|=_,hi|=_;F=z.action,Ki&&a(c,F),c=z.hasEagerState?z.eagerState:a(c,F)}else _={lane:F,revertLane:z.revertLane,gesture:z.gesture,action:z.action,hasEagerState:z.hasEagerState,eagerState:z.eagerState,next:null},S===null?(y=S=_,p=c):S=S.next=_,ge.lanes|=F,hi|=F;z=z.next}while(z!==null&&z!==t);if(S===null?p=c:S.next=y,!kt(c,e.memoizedState)&&(lt=!0,j&&(a=Da,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);kt(c,t.memoizedState)||(lt=!0),t.memoizedState=c,t.baseQueue===null&&(t.baseState=c),a.lastRenderedState=c}return[c,r]}function Wd(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=!kt((ke||o).memoizedState,a);if(p&&(o.memoizedState=a,lt=!0),o=o.queue,yo(th.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},eh.bind(null,r,o,a,t),null),Ge===null)throw Error(l(349));c||(kn&127)!==0||Jd(r,t,a)}return a}function Jd(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=ge.updateQueue,t===null?(t=Xr(),ge.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function eh(e,t,a,r){t.value=a,t.getSnapshot=r,nh(t)&&ih(e)}function th(e,t,a){return a(function(){nh(t)&&ih(e)})}function nh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!kt(e,a)}catch{return!0}}function ih(e){var t=Gi(e,2);t!==null&&Ut(t,e,2)}function mo(e){var t=Tt();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 ah(e,t,a,r){return e.baseState=a,ho(e,ke,typeof r=="function"?r:jn)}function sb(e,t,a,r,o){if(Wr(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)}};R.T!==null?a(!0):c.isTransition=!1,r(c),a=t.pending,a===null?(c.next=t.pending=c,sh(t,c)):(c.next=a.next,t.pending=a.next=c)}}function sh(e,t){var a=t.action,r=t.payload,o=e.state;if(t.isTransition){var c=R.T,p={};R.T=p;try{var y=a(o,r),S=R.S;S!==null&&S(p,y),rh(e,t,y)}catch(z){go(e,t,z)}finally{c!==null&&p.types!==null&&(c.types=p.types),R.T=c}}else try{c=a(o,r),rh(e,t,c)}catch(z){go(e,t,z)}}function rh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(r){lh(e,t,r)},function(r){return go(e,t,r)}):lh(e,t,a)}function lh(e,t,a){t.status="fulfilled",t.value=a,uh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,sh(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,uh(t),t=t.next;while(t!==r)}e.action=null}function uh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function oh(e,t){return t}function ch(e,t){if(Me){var a=Ge.formState;if(a!==null){e:{var r=ge;if(Me){if(Ie){t:{for(var o=Ie,c=tn;o.nodeType!==8;){if(!c){o=null;break t}if(o=an(o.nextSibling),o===null){o=null;break t}}c=o.data,o=c==="F!"||c==="F"?o:null}if(o){Ie=an(o.nextSibling),r=o.data==="F!";break e}}ai(r)}r=!1}r&&(t=a[0])}}return a=Tt(),a.memoizedState=a.baseState=t,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:oh,lastRenderedState:t},a.queue=r,a=Ch.bind(null,ge,r),r.dispatch=a,r=mo(!1),c=wo.bind(null,ge,!1,r.queue),r=Tt(),o={state:t,dispatch:null,action:e,pending:null},r.queue=o,a=sb.bind(null,ge,o,c,a),o.dispatch=a,r.memoizedState=e,[t,a,!1]}function fh(e){var t=it();return dh(t,ke,e)}function dh(e,t,a){if(t=ho(e,t,oh)[0],e=Qr(jn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var r=zs(t)}catch(p){throw p===Ra?Gr: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},rb.bind(null,o,a),null)),[r,c,e]}function rb(e,t){e.action=t}function hh(e){var t=it(),a=ke;if(a!==null)return dh(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=Xr(),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 ph(){return it().memoizedState}function Pr(e,t,a,r){var o=Tt();ge.flags|=e,o.memoizedState=Ua(1|t,{destroy:void 0},a,r===void 0?null:r)}function Zr(e,t,a,r){var o=it();r=r===void 0?null:r;var c=o.memoizedState.inst;ke!==null&&r!==null&&ro(r,ke.memoizedState.deps)?o.memoizedState=Ua(t,c,a,r):(ge.flags|=e,o.memoizedState=Ua(1|t,c,a,r))}function mh(e,t){Pr(8390656,8,e,t)}function yo(e,t){Zr(2048,8,e,t)}function lb(e){ge.flags|=4;var t=ge.updateQueue;if(t===null)t=Xr(),ge.updateQueue=t,t.events=[e];else{var a=t.events;a===null?t.events=[e]:a.push(e)}}function gh(e){var t=it().memoizedState;return lb({ref:t,nextImpl:e}),function(){if((_e&2)!==0)throw Error(l(440));return t.impl.apply(void 0,arguments)}}function yh(e,t){return Zr(4,2,e,t)}function vh(e,t){return Zr(4,4,e,t)}function bh(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 xh(e,t,a){a=a!=null?a.concat([e]):null,Zr(4,4,bh.bind(null,t,e),a)}function vo(){}function Sh(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 wh(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||(kn&1073741824)!==0&&(Ee&261930)===0?e.memoizedState=t:(e.memoizedState=a,e=Ep(),ge.lanes|=e,hi|=e,a)}function Eh(e,t,a,r){return kt(a,t)?a:Oa.current!==null?(e=bo(e,a,r),kt(e,t)||(lt=!0),e):(kn&42)===0||(kn&1073741824)!==0&&(Ee&261930)===0?(lt=!0,e.memoizedState=a):(e=Ep(),ge.lanes|=e,hi|=e,t)}function Ah(e,t,a,r,o){var c=q.p;q.p=c!==0&&8>c?c:8;var p=R.T,y={};R.T=y,wo(e,!1,t,a);try{var S=o(),z=R.S;if(z!==null&&z(y,S),S!==null&&typeof S=="object"&&typeof S.then=="function"){var j=nb(S,r);_s(e,t,j,It(e))}else _s(e,t,r,It(e))}catch(F){_s(e,t,{then:function(){},status:"rejected",reason:F},It())}finally{q.p=c,p!==null&&y.types!==null&&(p.types=y.types),R.T=p}}function ub(){}function xo(e,t,a,r){if(e.tag!==5)throw Error(l(476));var o=Th(e).queue;Ah(e,o,t,ae,a===null?ub:function(){return Mh(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 Mh(e){var t=Th(e);t.next===null&&(t=e.alternate.memoizedState),_s(e,t.next.queue,{},It())}function So(){return yt(Qs)}function Dh(){return it().memoizedState}function Rh(){return it().memoizedState}function ob(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=It();e=li(a);var r=ui(t,e,a);r!==null&&(Ut(r,t,a),Ds(r,t,a)),t={cache:Qu()},e.payload=t;return}t=t.return}}function cb(e,t,a){var r=It();a={lane:r,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},Wr(e)?Oh(t,a):(a=Bu(e,t,a,r),a!==null&&(Ut(a,e,r),zh(a,t,r)))}function Ch(e,t,a){var r=It();_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(Wr(e))Oh(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,kt(y,p))return _r(e,t,o,0),Ge===null&&zr(),!1}catch{}if(a=Bu(e,t,o,r),a!==null)return Ut(a,e,r),zh(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},Wr(e)){if(t)throw Error(l(479))}else t=Bu(e,a,r,2),t!==null&&Ut(t,e,2)}function Wr(e){var t=e.alternate;return e===ge||t!==null&&t===ge}function Oh(e,t){za=qr=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function zh(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:Kr,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 _h={readContext:yt,use:Kr,useCallback:function(e,t){return Tt().memoizedState=[e,t===void 0?null:t],e},useContext:yt,useEffect:mh,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Pr(4194308,4,bh.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Pr(4194308,4,e,t)},useInsertionEffect:function(e,t){Pr(4,2,e,t)},useMemo:function(e,t){var a=Tt();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=Tt();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=cb.bind(null,ge,e),[r.memoizedState,e]},useRef:function(e){var t=Tt();return e={current:e},t.memoizedState=e},useState:function(e){e=mo(e);var t=e.queue,a=Ch.bind(null,ge,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:vo,useDeferredValue:function(e,t){var a=Tt();return bo(a,e,t)},useTransition:function(){var e=mo(!1);return e=Ah.bind(null,ge,e.queue,!0,!1),Tt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var r=ge,o=Tt();if(Me){if(a===void 0)throw Error(l(407));a=a()}else{if(a=t(),Ge===null)throw Error(l(349));(Ee&127)!==0||Jd(r,t,a)}o.memoizedState=a;var c={value:a,getSnapshot:t};return o.queue=c,mh(th.bind(null,r,c,e),[e]),r.flags|=2048,Ua(9,{destroy:void 0},eh.bind(null,r,c,a,t),null),a},useId:function(){var e=Tt(),t=Ge.identifierPrefix;if(Me){var a=bn,r=vn;a=(r&~(1<<32-tt(r)-1)).toString(32)+a,t="_"+t+"R_"+a,a=Yr++,0<a&&(t+="H"+a.toString(32)),t+="_"}else a=ib++,t="_"+t+"r_"+a.toString(32)+"_";return e.memoizedState=t},useHostTransitionStatus:So,useFormState:ch,useActionState:ch,useOptimistic:function(e){var t=Tt();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 Tt().memoizedState=ob.bind(null,ge)},useEffectEvent:function(e){var t=Tt(),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:Kr,useCallback:Sh,useContext:yt,useEffect:yo,useImperativeHandle:xh,useInsertionEffect:yh,useLayoutEffect:vh,useMemo:wh,useReducer:Qr,useRef:ph,useState:function(){return Qr(jn)},useDebugValue:vo,useDeferredValue:function(e,t){var a=it();return Eh(a,ke.memoizedState,e,t)},useTransition:function(){var e=Qr(jn)[0],t=it().memoizedState;return[typeof e=="boolean"?e:zs(e),t]},useSyncExternalStore:Wd,useId:Dh,useHostTransitionStatus:So,useFormState:fh,useActionState:fh,useOptimistic:function(e,t){var a=it();return ah(a,ke,e,t)},useMemoCache:fo,useCacheRefresh:Rh};Eo.useEffectEvent=gh;var Uh={readContext:yt,use:Kr,useCallback:Sh,useContext:yt,useEffect:yo,useImperativeHandle:xh,useInsertionEffect:yh,useLayoutEffect:vh,useMemo:wh,useReducer:po,useRef:ph,useState:function(){return po(jn)},useDebugValue:vo,useDeferredValue:function(e,t){var a=it();return ke===null?bo(a,e,t):Eh(a,ke.memoizedState,e,t)},useTransition:function(){var e=po(jn)[0],t=it().memoizedState;return[typeof e=="boolean"?e:zs(e),t]},useSyncExternalStore:Wd,useId:Dh,useHostTransitionStatus:So,useFormState:hh,useActionState:hh,useOptimistic:function(e,t){var a=it();return ke!==null?ah(a,ke,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:fo,useCacheRefresh:Rh};Uh.useEffectEvent=gh;function Ao(e,t,a,r){t=e.memoizedState,a=a(r,t),a=a==null?t:b({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var To={enqueueSetState:function(e,t,a){e=e._reactInternals;var r=It(),o=li(r);o.payload=t,a!=null&&(o.callback=a),t=ui(e,o,r),t!==null&&(Ut(t,e,r),Ds(t,e,r))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var r=It(),o=li(r);o.tag=1,o.payload=t,a!=null&&(o.callback=a),t=ui(e,o,r),t!==null&&(Ut(t,e,r),Ds(t,e,r))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=It(),r=li(a);r.tag=2,t!=null&&(r.callback=t),t=ui(e,r,a),t!==null&&(Ut(t,e,a),Ds(t,e,a))}};function Nh(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 Lh(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&&To.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=b({},a));for(var o in e)a[o]===void 0&&(a[o]=e[o])}return a}function kh(e){Or(e)}function jh(e){console.error(e)}function Bh(e){Or(e)}function Jr(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(r){setTimeout(function(){throw r})}}function Gh(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=li(a),a.tag=3,a.payload={element:null},a.callback=function(){Jr(e,t)},a}function $h(e){return e=li(e),e.tag=3,e}function Vh(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(){Gh(t,a,r)}}var p=a.stateNode;p!==null&&typeof p.componentDidCatch=="function"&&(e.callback=function(){Gh(t,a,r),typeof o!="function"&&(pi===null?pi=new Set([this]):pi.add(this));var y=r.stack;this.componentDidCatch(r.value,{componentStack:y!==null?y:""})})}function fb(e,t,a,r,o){if(a.flags|=32768,r!==null&&typeof r=="object"&&typeof r.then=="function"){if(t=a.alternate,t!==null&&Ta(t,a,o,!0),a=Bt.current,a!==null){switch(a.tag){case 31:case 13:return nn===null?fl():a.alternate===null&&Je===0&&(Je=3),a.flags&=-257,a.flags|=65536,a.lanes=o,r===$r?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===$r?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),fl(),!1}if(Me)return t=Bt.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(Wt(e,a)))):(r!==Hu&&(t=Error(l(423),{cause:r}),ws(Wt(t,a))),e=e.current.alternate,e.flags|=65536,o&=-o,e.lanes|=o,r=Wt(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=Wt(c,a),Vs===null?Vs=[c]:Vs.push(c),Je!==4&&(Je=2),t===null)return!0;r=Wt(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"&&(pi===null||!pi.has(c))))return a.flags|=65536,o&=-o,a.lanes|=o,o=$h(o),Vh(o,e,a,r),to(a,o),!1}a=a.return}while(a!==null);return!1}var Do=Error(l(461)),lt=!1;function vt(e,t,a,r){t.child=e===null?qd(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&&Iu(t),t.flags|=1,vt(e,t,r,o),t.child)}function Fh(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,Hh(e,t,c,r,o)):(e=Nr(a.type,null,r,t,t.mode,o),e.ref=t.ref,e.return=t,t.child=e)}if(c=e.child,!Lo(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 Hh(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,Lo(e,o))(e.flags&131072)!==0&&(lt=!0);else return t.lanes=e.lanes,Bn(e,t,o)}return Ro(e,t,a,r,o)}function qh(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 Yh(e,t,c,a,r)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&Br(t,c!==null?c.cachePool:null),c!==null?Kd(t,c):io(),Qd(t);else return r=t.lanes=536870912,Yh(e,t,c!==null?c.baseLanes|a:a,a,r)}else c!==null?(Br(t,c.cachePool),Kd(t,c),ci(),t.memoizedState=null):(e!==null&&Br(t,null),io(),ci());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 Yh(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&&Br(t,null),io(),Qd(t),e!==null&&Ta(e,t,r,!0),t.childLanes=o,null}function el(e,t){return t=nl({mode:t.mode,children:t.children},e.mode),t.ref=e.ref,e.child=t,t.return=e,t}function Xh(e,t,a){return Xi(t,e.child,null,a),e=el(t,t.pendingProps),e.flags|=2,Gt(t),t.memoizedState=null,e}function db(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=el(t,r),t.lanes=536870912,Ns(null,e);if(so(t),(e=Ie)?(e=sm(e,tn),e=e!==null&&e.data==="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ni!==null?{id:vn,overflow:bn}:null,retryLane:536870912,hydrationErrors:null},a=Od(e),a.return=t,t.child=a,gt=t,Ie=null)):e=null,e===null)throw ai(t);return t.lanes=536870912,null}return el(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=Xh(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||Ta(e,t,a,!1),o=(a&e.childLanes)!==0,lt||o){if(r=Ge,r!==null&&(p=jf(r,a),p!==0&&p!==c.retryLane))throw c.retryLane=p,Gi(e,p),Ut(r,e,p),Do;fl(),t=Xh(e,t,a)}else e=c.treeContext,Ie=an(p.nextSibling),gt=t,Me=!0,ii=null,tn=!1,e!==null&&Ud(t,e),t=el(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 tl(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 Ro(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&&Iu(t),t.flags|=1,vt(e,t,a,o),t.child)}function Kh(e,t,a,r,o,c){return Fi(t),t.updateQueue=null,a=Zd(t,r,a,o),Pd(e),r=uo(),e!==null&&!lt?(oo(e,t,c),Bn(e,t,c)):(Me&&r&&Iu(t),t.flags|=1,vt(e,t,a,c),t.child)}function Qh(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=To,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"&&(Ao(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&&To.enqueueReplaceState(c,c.state,null),Cs(t,r,c,o),Rs(),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 z=c.context,j=a.contextType;p=Sa,typeof j=="object"&&j!==null&&(p=yt(j));var F=a.getDerivedStateFromProps;j=typeof F=="function"||typeof c.getSnapshotBeforeUpdate=="function",y=t.pendingProps!==y,j||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(y||z!==p)&&Lh(t,c,r,p),ri=!1;var _=t.memoizedState;c.state=_,Cs(t,r,c,o),Rs(),z=t.memoizedState,y||_!==z||ri?(typeof F=="function"&&(Ao(t,a,F,r),z=t.memoizedState),(S=ri||Nh(t,a,S,r,_,z,p))?(j||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=z),c.props=r,c.state=z,c.context=p,r=S):(typeof c.componentDidMount=="function"&&(t.flags|=4194308),r=!1)}else{c=t.stateNode,eo(e,t),p=t.memoizedProps,j=Qi(a,p),c.props=j,F=t.pendingProps,_=c.context,z=a.contextType,S=Sa,typeof z=="object"&&z!==null&&(S=yt(z)),y=a.getDerivedStateFromProps,(z=typeof y=="function"||typeof c.getSnapshotBeforeUpdate=="function")||typeof c.UNSAFE_componentWillReceiveProps!="function"&&typeof c.componentWillReceiveProps!="function"||(p!==F||_!==S)&&Lh(t,c,r,S),ri=!1,_=t.memoizedState,c.state=_,Cs(t,r,c,o),Rs();var U=t.memoizedState;p!==F||_!==U||ri||e!==null&&e.dependencies!==null&&kr(e.dependencies)?(typeof y=="function"&&(Ao(t,a,y,r),U=t.memoizedState),(j=ri||Nh(t,a,j,r,_,U,S)||e!==null&&e.dependencies!==null&&kr(e.dependencies))?(z||typeof c.UNSAFE_componentWillUpdate!="function"&&typeof c.componentWillUpdate!="function"||(typeof c.componentWillUpdate=="function"&&c.componentWillUpdate(r,U,S),typeof c.UNSAFE_componentWillUpdate=="function"&&c.UNSAFE_componentWillUpdate(r,U,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=U),c.props=r,c.state=U,c.context=S,r=j):(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,tl(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 Ph(e,t,a,r){return Vi(),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:Gd()}}function zo(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=Vt),e}function Zh(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?oi(t):ci(),(e=Ie)?(e=sm(e,tn),e=e!==null&&e.data!=="&"?e:null,e!==null&&(t.memoizedState={dehydrated:e,treeContext:ni!==null?{id:vn,overflow:bn}:null,retryLane:536870912,hydrationErrors:null},a=Od(e),a.return=t,t.child=a,gt=t,Ie=null)):e=null,e===null)throw ai(t);return hc(e)?t.lanes=32:t.lanes=536870912,null}var y=r.children;return r=r.fallback,o?(ci(),o=t.mode,y=nl({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)):(oi(t),_o(t,y))}var S=e.memoizedState;if(S!==null&&(y=S.dehydrated,y!==null)){if(c)t.flags&256?(oi(t),t.flags&=-257,t=Uo(e,t,a)):t.memoizedState!==null?(ci(),t.child=e.child,t.flags|=128,t=null):(ci(),y=r.fallback,o=t.mode,r=nl({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(oi(t),hc(y)){if(p=y.nextSibling&&y.nextSibling.dataset,p)var z=p.dgst;p=z,r=Error(l(419)),r.stack="",r.digest=p,ws({value:r,source:null,stack:null}),t=Uo(e,t,a)}else if(lt||Ta(e,t,a,!1),p=(a&e.childLanes)!==0,lt||p){if(p=Ge,p!==null&&(r=jf(p,a),r!==0&&r!==S.retryLane))throw S.retryLane=r,Gi(e,r),Ut(p,e,r),Do;dc(y)||fl(),t=Uo(e,t,a)}else dc(y)?(t.flags|=192,t.child=e.child,t=null):(e=S.treeContext,Ie=an(y.nextSibling),gt=t,Me=!0,ii=null,tn=!1,e!==null&&Ud(t,e),t=_o(t,r.children),t.flags|=4096);return t}return o?(ci(),y=r.fallback,o=t.mode,S=e.child,z=S.sibling,r=_n(S,{mode:"hidden",children:r.children}),r.subtreeFlags=S.subtreeFlags&65011712,z!==null?y=_n(z,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=Gd(),y={baseLanes:y.baseLanes|a,cachePool:o}),r.memoizedState=y,r.childLanes=zo(e,p,a),t.memoizedState=Co,Ns(e.child,r)):(oi(t),a=e.child,e=a.sibling,a=_n(a,{mode:"visible",children:r.children}),a.return=t,a.sibling=null,e!==null&&(p=t.deletions,p===null?(t.deletions=[e],t.flags|=16):p.push(e)),t.child=a,t.memoizedState=null,a)}function _o(e,t){return t=nl({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function nl(e,t){return e=jt(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 Wh(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 Jh(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,Y(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&&Wh(e,a,t);else if(e.tag===19)Wh(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&&Hr(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&&Hr(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),hi|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(Ta(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 Lo(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&kr(e)))}function hb(e,t,a){switch(t.tag){case 3:Ze(t,t.stateNode.containerInfo),si(t,st,e.memoizedState.cache),Vi();break;case 27:case 5:gn(t);break;case 4:Ze(t,t.stateNode.containerInfo);break;case 10:si(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?(oi(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Zh(e,t,a):(oi(t),e=Bn(e,t,a),e!==null?e.sibling:null);oi(t);break;case 19:var o=(e.flags&128)!==0;if(r=(a&t.childLanes)!==0,r||(Ta(e,t,a,!1),r=(a&t.childLanes)!==0),o){if(r)return Jh(e,t,a);t.flags|=128}if(o=t.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Y(nt,nt.current),r)break;return null;case 22:return t.lanes=0,qh(e,t,a,t.pendingProps);case 24:si(t,st,e.memoizedState.cache)}return Bn(e,t,a)}function ep(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)lt=!0;else{if(!Lo(e,a)&&(t.flags&128)===0)return lt=!1,hb(e,t,a);lt=(e.flags&131072)!==0}else lt=!1,Me&&(t.flags&1048576)!==0&&_d(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=Qh(null,t,e,r,a)):(t.tag=0,t=Ro(null,t,e,r,a));else{if(e!=null){var o=e.$$typeof;if(o===H){t.tag=11,t=Ih(null,t,e,r,a);break e}else if(o===M){t.tag=14,t=Fh(null,t,e,r,a);break e}}throw t=he(e)||e,Error(l(306,t,""))}}return t;case 0:return Ro(e,t,t.type,t.pendingProps,a);case 1:return r=t.type,o=Qi(r,t.pendingProps),Qh(e,t,r,o,a);case 3:e:{if(Ze(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,si(t,st,r),r!==c.cache&&Ku(t,[st],a,!0),Rs(),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=Ph(e,t,r,a);break e}else if(r!==o){o=Wt(Error(l(424)),t),ws(o),t=Ph(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,Ie=an(e.firstChild),gt=t,Me=!0,ii=null,tn=!0,a=qd(t,null,r,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(Vi(),r===o){t=Bn(e,t,a);break e}vt(e,t,r,a)}t=t.child}return t;case 26:return tl(e,t),e===null?(a=fm(t.type,null,t.pendingProps,null))?t.memoizedState=a:Me||(a=t.type,e=t.pendingProps,r=vl(fe.current).createElement(a),r[mt]=t,r[Dt]=e,bt(r,a,e),ft(r),t.stateNode=r):t.memoizedState=fm(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return gn(t),e===null&&Me&&(r=t.stateNode=um(t.type,t.pendingProps,fe.current),gt=t,tn=!0,o=Ie,vi(t.type)?(pc=o,Ie=an(r.firstChild)):Ie=o),vt(e,t,t.pendingProps.children,a),tl(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Me&&((o=r=Ie)&&(r=Fb(r,t.type,t.pendingProps,tn),r!==null?(t.stateNode=r,gt=t,Ie=an(r.firstChild),tn=!1,o=!0):o=!1),o||ai(t)),gn(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,ab,null,null,a),Qs._currentValue=o),tl(e,t),vt(e,t,r,a),t.child;case 6:return e===null&&Me&&((e=a=Ie)&&(a=Hb(a,t.pendingProps,tn),a!==null?(t.stateNode=a,gt=t,Ie=null,e=!0):e=!1),e||ai(t)),null;case 13:return Zh(e,t,a);case 4:return Ze(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,si(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 Fh(e,t,t.type,t.pendingProps,a);case 15:return Hh(e,t,t.type,t.pendingProps,a);case 19:return Jh(e,t,a);case 31:return db(e,t,a);case 22:return qh(e,t,a,t.pendingProps);case 24:return Fi(t),r=yt(st),e===null?(o=Zu(),o===null&&(o=Ge,c=Qu(),o.pooledCache=c,c.refCount++,c!==null&&(o.pooledCacheLanes|=a),o=c),t.memoizedState={parent:r,cache:o},Ju(t),si(t,st,o)):((e.lanes&a)!==0&&(eo(e,t),Cs(t,null,null,a),Rs()),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),si(t,st,r)):(r=c.cache,si(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 ko(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(Dp())e.flags|=8192;else throw Yi=$r,Wu}else e.flags&=-16777217}function tp(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!gm(t))if(Dp())e.flags|=8192;else throw Yi=$r,Wu}function il(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?Nf():536870912,e.lanes|=t,ja|=t)}function Ls(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 Fe(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 pb(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 Fe(t),null;case 1:return Fe(t),null;case 3:return a=t.stateNode,r=null,e!==null&&(r=e.memoizedState.cache),t.memoizedState.cache!==r&&(t.flags|=2048),Ln(st),De(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&(Aa(t)?Gn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,qu())),Fe(t),null;case 26:var o=t.type,c=t.memoizedState;return e===null?(Gn(t),c!==null?(Fe(t),tp(t,c)):(Fe(t),ko(t,o,null,r,a))):c?c!==e.memoizedState?(Gn(t),Fe(t),tp(t,c)):(Fe(t),t.flags&=-16777217):(e=e.memoizedProps,e!==r&&Gn(t),Fe(t),ko(t,o,e,r,a)),null;case 27:if(Jn(t),a=fe.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 Fe(t),null}e=P.current,Aa(t)?Nd(t):(e=um(o,r,a),t.stateNode=e,Gn(t))}return Fe(t),null;case 5:if(Jn(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 Fe(t),null}if(c=P.current,Aa(t))Nd(t);else{var p=vl(fe.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[Dt]=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 Fe(t),ko(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=fe.current,Aa(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||Zp(e.nodeValue,a)),e||ai(t,!0)}else e=vl(e).createTextNode(r),e[mt]=t,t.stateNode=e}return Fe(t),null;case 31:if(a=t.memoizedState,e===null||e.memoizedState!==null){if(r=Aa(t),a!==null){if(e===null){if(!r)throw Error(l(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(l(557));e[mt]=t}else Vi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Fe(t),e=!1}else a=qu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=a),e=!0;if(!e)return t.flags&256?(Gt(t),t):(Gt(t),null);if((t.flags&128)!==0)throw Error(l(558))}return Fe(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(o=Aa(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 Vi(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;Fe(t),o=!1}else o=qu(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=o),o=!0;if(!o)return t.flags&256?(Gt(t),t):(Gt(t),null)}return Gt(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),il(t,t.updateQueue),Fe(t),null);case 4:return De(),e===null&&ac(t.stateNode.containerInfo),Fe(t),null;case 10:return Ln(t.type),Fe(t),null;case 19:if(N(nt),r=t.memoizedState,r===null)return Fe(t),null;if(o=(t.flags&128)!==0,c=r.rendering,c===null)if(o)Ls(r,!1);else{if(Je!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(c=Hr(e),c!==null){for(t.flags|=128,Ls(r,!1),e=c.updateQueue,t.updateQueue=e,il(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)Cd(a,e),a=a.sibling;return Y(nt,nt.current&1|2),Me&&Un(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&Ve()>ul&&(t.flags|=128,o=!0,Ls(r,!1),t.lanes=4194304)}else{if(!o)if(e=Hr(c),e!==null){if(t.flags|=128,o=!0,e=e.updateQueue,t.updateQueue=e,il(t,e),Ls(r,!0),r.tail===null&&r.tailMode==="hidden"&&!c.alternate&&!Me)return Fe(t),null}else 2*Ve()-r.renderingStartTime>ul&&a!==536870912&&(t.flags|=128,o=!0,Ls(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,Y(nt,o?a&1|2:a&1),Me&&Un(t,r.treeForkCount),e):(Fe(t),null);case 22:case 23:return Gt(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&&(Fe(t),t.subtreeFlags&6&&(t.flags|=8192)):Fe(t),a=t.updateQueue,a!==null&&il(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&&N(Hi),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Ln(st),Fe(t),null;case 25:return null;case 30:return null}throw Error(l(156,t.tag))}function mb(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 Ln(st),De(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return Jn(t),null;case 31:if(t.memoizedState!==null){if(Gt(t),t.alternate===null)throw Error(l(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Gt(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(l(340));Vi()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return N(nt),null;case 4:return De(),null;case 10:return Ln(t.type),null;case 22:case 23:return Gt(t),ao(),e!==null&&N(Hi),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ln(st),null;case 25:return null;default:return null}}function np(e,t){switch(Fu(t),t.tag){case 3:Ln(st),De();break;case 26:case 27:case 5:Jn(t);break;case 4:De();break;case 31:t.memoizedState!==null&&Gt(t);break;case 13:Gt(t);break;case 19:N(nt);break;case 10:Ln(t.type);break;case 22:case 23:Gt(t),ao(),e!==null&&N(Hi);break;case 24:Ln(st)}}function ks(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){Le(t,t.return,y)}}function fi(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,z=y;try{z()}catch(j){Le(o,S,j)}}}r=r.next}while(r!==c)}}catch(j){Le(t,t.return,j)}}function ip(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Xd(t,a)}catch(r){Le(e,e.return,r)}}}function ap(e,t,a){a.props=Qi(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(r){Le(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){Le(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){Le(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){Le(e,t,o)}else a.current=null}function sp(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){Le(e,e.return,o)}}function jo(e,t,a){try{var r=e.stateNode;jb(r,e.type,a,t),r[Dt]=t}catch(o){Le(e,e.return,o)}}function rp(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&vi(e.type)||e.tag===4}function Bo(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||rp(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&&vi(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&&vi(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 al(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&&vi(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(al(e,t,a),e=e.sibling;e!==null;)al(e,t,a),e=e.sibling}function lp(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[Dt]=a}catch(c){Le(e,e.return,c)}}var $n=!1,ut=!1,$o=!1,up=typeof WeakSet=="function"?WeakSet:Set,dt=null;function gb(e,t){if(e=e.containerInfo,lc=Tl,e=xd(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,z=0,j=0,F=e,_=null;t:for(;;){for(var U;F!==a||o!==0&&F.nodeType!==3||(y=p+o),F!==c||r!==0&&F.nodeType!==3||(S=p+r),F.nodeType===3&&(p+=F.nodeValue.length),(U=F.firstChild)!==null;)_=F,F=U;for(;;){if(F===e)break t;if(_===a&&++z===o&&(y=p),_===c&&++j===r&&(S=p),(U=F.nextSibling)!==null)break;F=_,_=F.parentNode}F=U}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},Tl=!1,dt=t;dt!==null;)if(t=dt,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,dt=e;else for(;dt!==null;){switch(t=dt,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 ne=Qi(a.type,o);e=r.getSnapshotBeforeUpdate(ne,c),r.__reactInternalSnapshotBeforeUpdate=e}catch(ce){Le(a,a.return,ce)}}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,dt=e;break}dt=t.return}}function op(e,t,a){var r=a.flags;switch(a.tag){case 0:case 11:case 15:In(e,a),r&4&&ks(5,a);break;case 1:if(In(e,a),r&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(p){Le(a,a.return,p)}else{var o=Qi(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(o,t,e.__reactInternalSnapshotBeforeUpdate)}catch(p){Le(a,a.return,p)}}r&64&&ip(a),r&512&&js(a,a.return);break;case 3:if(In(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{Xd(e,t)}catch(p){Le(a,a.return,p)}}break;case 27:t===null&&r&4&&lp(a);case 26:case 5:In(e,a),t===null&&r&4&&sp(a),r&512&&js(a,a.return);break;case 12:In(e,a);break;case 31:In(e,a),r&4&&dp(e,a);break;case 13:In(e,a),r&4&&hp(e,a),r&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Tb.bind(null,a),qb(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):In(e,a),$n=o,ut=c}break;case 30:break;default:In(e,a)}}function cp(e){var t=e.alternate;t!==null&&(e.alternate=null,cp(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 qe=null,Ct=!1;function Vn(e,t,a){for(a=a.child;a!==null;)fp(e,t,a),a=a.sibling}function fp(e,t,a){if(He&&typeof He.onCommitFiberUnmount=="function")try{He.onCommitFiberUnmount(ct,a)}catch{}switch(a.tag){case 26:ut||xn(a,t),Vn(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=qe,o=Ct;vi(a.type)&&(qe=a.stateNode,Ct=!1),Vn(e,t,a),Ys(a.stateNode),qe=r,Ct=o;break;case 5:ut||xn(a,t);case 6:if(r=qe,o=Ct,qe=null,Vn(e,t,a),qe=r,Ct=o,qe!==null)if(Ct)try{(qe.nodeType===9?qe.body:qe.nodeName==="HTML"?qe.ownerDocument.body:qe).removeChild(a.stateNode)}catch(c){Le(a,t,c)}else try{qe.removeChild(a.stateNode)}catch(c){Le(a,t,c)}break;case 18:qe!==null&&(Ct?(e=qe,im(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),qa(e)):im(qe,a.stateNode));break;case 4:r=qe,o=Ct,qe=a.stateNode.containerInfo,Ct=!0,Vn(e,t,a),qe=r,Ct=o;break;case 0:case 11:case 14:case 15:fi(2,a,t),ut||fi(4,a,t),Vn(e,t,a);break;case 1:ut||(xn(a,t),r=a.stateNode,typeof r.componentWillUnmount=="function"&&ap(a,t,r)),Vn(e,t,a);break;case 21:Vn(e,t,a);break;case 22:ut=(r=ut)||a.memoizedState!==null,Vn(e,t,a),ut=r;break;default:Vn(e,t,a)}}function dp(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null))){e=e.dehydrated;try{qa(e)}catch(a){Le(t,t.return,a)}}}function hp(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){Le(t,t.return,a)}}function yb(e){switch(e.tag){case 31:case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new up),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new up),t;default:throw Error(l(435,e.tag))}}function sl(e,t){var a=yb(e);t.forEach(function(r){if(!a.has(r)){a.add(r);var o=Mb.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(vi(y.type)){qe=y.stateNode,Ct=!1;break e}break;case 5:qe=y.stateNode,Ct=!1;break e;case 3:case 4:qe=y.stateNode.containerInfo,Ct=!0;break e}y=y.return}if(qe===null)throw Error(l(160));fp(c,p,o),qe=null,Ct=!1,c=o.alternate,c!==null&&(c.return=null),o.return=null}if(t.subtreeFlags&13886)for(t=t.child;t!==null;)pp(t,e),t=t.sibling}var pn=null;function pp(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&&(fi(3,e,e.return),ks(3,e),fi(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=pn;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,ft(c),r=c;break e;case"link":var p=pm("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=pm("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,ft(c),r=c}e.stateNode=r}else mm(o,e.type,e.stateNode);else e.stateNode=hm(o,r,e.memoizedProps);else c!==r?(c===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):c.count--,r===null?mm(o,e.type,e.stateNode):hm(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(ne){Le(e,e.return,ne)}}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(ne){Le(e,e.return,ne)}}break;case 3:if(Sl=null,o=pn,pn=bl(t.containerInfo),Ot(t,e),pn=o,zt(e),r&4&&a!==null&&a.memoizedState.isDehydrated)try{qa(t.containerInfo)}catch(ne){Le(e,e.return,ne)}$o&&($o=!1,mp(e));break;case 4:r=pn,pn=bl(e.stateNode.containerInfo),Ot(t,e),zt(e),pn=r;break;case 12:Ot(t,e),zt(e);break;case 31:Ot(t,e),zt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(e,r)));break;case 13:Ot(t,e),zt(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(ll=Ve()),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(e,r)));break;case 22:o=e.memoizedState!==null;var S=a!==null&&a.memoizedState!==null,z=$n,j=ut;if($n=z||o,ut=j||S,Ot(t,e),ut=j,$n=z,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 F=S.memoizedProps.style,_=F!=null&&F.hasOwnProperty("display")?F.display:null;y.style.display=_==null||typeof _=="boolean"?"":(""+_).trim()}}catch(ne){Le(S,S.return,ne)}}}else if(t.tag===6){if(a===null){S=t;try{S.stateNode.nodeValue=o?"":S.memoizedProps}catch(ne){Le(S,S.return,ne)}}}else if(t.tag===18){if(a===null){S=t;try{var U=S.stateNode;o?am(U,!0):am(S.stateNode,!1)}catch(ne){Le(S,S.return,ne)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}r&4&&(r=e.updateQueue,r!==null&&(a=r.retryQueue,a!==null&&(r.retryQueue=null,sl(e,a))));break;case 19:Ot(t,e),zt(e),r&4&&(r=e.updateQueue,r!==null&&(e.updateQueue=null,sl(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(rp(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);al(e,c,o);break;case 5:var p=a.stateNode;a.flags&32&&(pa(p,""),a.flags&=-33);var y=Bo(e);al(e,y,p);break;case 3:case 4:var S=a.stateNode.containerInfo,z=Bo(e);Go(e,z,S);break;default:throw Error(l(161))}}catch(j){Le(e,e.return,j)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function mp(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;mp(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function In(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)op(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:fi(4,t,t.return),Pi(t);break;case 1:xn(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&ap(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),ks(4,c);break;case 1:if(Fn(o,c,a),r=c,o=r.stateNode,typeof o.componentDidMount=="function")try{o.componentDidMount()}catch(z){Le(r,r.return,z)}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++)Yd(S[o],y)}catch(z){Le(r,r.return,z)}}a&&p&64&&ip(c),js(c,c.return);break;case 27:lp(c);case 26:case 5:Fn(o,c,a),a&&r===null&&p&4&&sp(c),js(c,c.return);break;case 12:Fn(o,c,a);break;case 31:Fn(o,c,a),a&&p&4&&dp(o,c);break;case 13:Fn(o,c,a),a&&p&4&&hp(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 Vo(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 Io(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 mn(e,t,a,r){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)gp(e,t,a,r),t=t.sibling}function gp(e,t,a,r){var o=t.flags;switch(t.tag){case 0:case 11:case 15:mn(e,t,a,r),o&2048&&ks(9,t);break;case 1:mn(e,t,a,r);break;case 3:mn(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){mn(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){Le(t,t.return,S)}}else mn(e,t,a,r);break;case 31:mn(e,t,a,r);break;case 13:mn(e,t,a,r);break;case 23:break;case 22:c=t.stateNode,p=t.alternate,t.memoizedState!==null?c._visibility&2?mn(e,t,a,r):Bs(e,t):c._visibility&2?mn(e,t,a,r):(c._visibility|=2,Na(e,t,a,r,(t.subtreeFlags&10256)!==0||!1)),o&2048&&Vo(p,t);break;case 24:mn(e,t,a,r),o&2048&&Io(t.alternate,t);break;default:mn(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,z=p.flags;switch(p.tag){case 0:case 11:case 15:Na(c,p,y,S,o),ks(8,p);break;case 23:break;case 22:var j=p.stateNode;p.memoizedState!==null?j._visibility&2?Na(c,p,y,S,o):Bs(c,p):(j._visibility|=2,Na(c,p,y,S,o)),o&&z&2048&&Vo(p.alternate,p);break;case 24:Na(c,p,y,S,o),o&&z&2048&&Io(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&&Vo(r.alternate,r);break;case 24:Bs(a,r),o&2048&&Io(r.alternate,r);break;default:Bs(a,r)}t=t.sibling}}var Gs=8192;function La(e,t,a){if(e.subtreeFlags&Gs)for(e=e.child;e!==null;)yp(e,t,a),e=e.sibling}function yp(e,t,a){switch(e.tag){case 26:La(e,t,a),e.flags&Gs&&e.memoizedState!==null&&ix(a,pn,e.memoizedState,e.memoizedProps);break;case 5:La(e,t,a);break;case 3:case 4:var r=pn;pn=bl(e.stateNode.containerInfo),La(e,t,a),pn=r;break;case 22:e.memoizedState===null&&(r=e.alternate,r!==null&&r.memoizedState!==null?(r=Gs,Gs=16777216,La(e,t,a),Gs=r):La(e,t,a));break;default:La(e,t,a)}}function vp(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];dt=r,xp(r,e)}vp(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)bp(e),e=e.sibling}function bp(e){switch(e.tag){case 0:case 11:case 15:$s(e),e.flags&2048&&fi(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,rl(e)):$s(e);break;default:$s(e)}}function rl(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];dt=r,xp(r,e)}vp(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:fi(8,t,t.return),rl(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,rl(t));break;default:rl(t)}e=e.sibling}}function xp(e,t){for(;dt!==null;){var a=dt;switch(a.tag){case 0:case 11:case 15:fi(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,dt=r;else e:for(a=e;dt!==null;){r=dt;var o=r.sibling,c=r.return;if(cp(r),r===a){dt=null;break e}if(o!==null){o.return=c,dt=o;break e}dt=c}}}var vb={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}},bb=typeof WeakMap=="function"?WeakMap:Map,_e=0,Ge=null,xe=null,Ee=0,Ne=0,$t=null,di=!1,ka=!1,Fo=!1,Hn=0,Je=0,hi=0,Zi=0,Ho=0,Vt=0,ja=0,Vs=null,_t=null,qo=!1,ll=0,Sp=0,ul=1/0,ol=null,pi=null,ot=0,mi=null,Ba=null,qn=0,Yo=0,Xo=null,wp=null,Is=0,Ko=null;function It(){return(_e&2)!==0&&Ee!==0?Ee&-Ee:R.T!==null?ec():Bf()}function Ep(){if(Vt===0)if((Ee&536870912)===0||Me){var e=yr;yr<<=1,(yr&3932160)===0&&(yr=262144),Vt=e}else Vt=536870912;return e=Bt.current,e!==null&&(e.flags|=32),Vt}function Ut(e,t,a){(e===Ge&&(Ne===2||Ne===9)||e.cancelPendingCommit!==null)&&(Ga(e,0),gi(e,Ee,Vt,!1)),os(e,a),((_e&2)===0||e!==Ge)&&(e===Ge&&((_e&2)===0&&(Zi|=a),Je===4&&gi(e,Ee,Vt,!1)),Sn(e))}function Ap(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?wb(e,t):Po(e,t,!0),c=r;do{if(o===0){ka&&!r&&gi(e,t,0,!1);break}else{if(a=e.current.alternate,c&&!xb(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=Vs;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),gi(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:gi(r,t,Vt,!di);break e;case 2:_t=null;break;case 3:case 5:break;default:throw Error(l(329))}if((t&62914560)===t&&(o=ll+300-Ve(),10<o)){if(gi(r,t,Vt,!di),br(r,0,!0)!==0)break e;qn=t,r.timeoutHandle=tm(Tp.bind(null,r,a,_t,ol,qo,t,Vt,Zi,ja,di,c,"Throttled",-0,0),o);break e}Tp(r,a,_t,ol,qo,t,Vt,Zi,ja,di,c,null,-0,0)}}break}while(!0);Sn(e)}function Tp(e,t,a,r,o,c,p,y,S,z,j,F,_,U){if(e.timeoutHandle=-1,F=t.subtreeFlags,F&8192||(F&16785408)===16785408){F={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:On},yp(t,c,F);var ne=(c&62914560)===c?ll-Ve():(c&4194048)===c?Sp-Ve():0;if(ne=ax(F,ne),ne!==null){qn=c,e.cancelPendingCommit=ne(Up.bind(null,e,t,c,a,r,o,p,y,S,j,F,null,_,U)),gi(e,c,p,!z);return}}Up(e,t,c,a,r,o,p,y,S)}function xb(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(!kt(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 gi(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&&Lf(e,a,t)}function cl(){return(_e&6)===0?(Fs(0),!1):!0}function Qo(){if(xe!==null){if(Ne===0)var e=xe.return;else e=xe,Nn=Ii=null,co(e),Ca=null,Ts=0,e=xe;for(;e!==null;)np(e.alternate,e),e=e.return;xe=null}}function Ga(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,$b(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),qn=0,Qo(),Ge=e,xe=a=_n(e.current,null),Ee=t,Ne=0,$t=null,di=!1,ka=us(e,t),Fo=!1,ja=Vt=Ho=Zi=hi=Je=0,_t=Vs=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,zr(),a}function Mp(e,t){ge=null,R.H=Us,t===Ra||t===Gr?(t=Id(),Ne=3):t===Wu?(t=Id(),Ne=4):Ne=t===Do?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,$t=t,xe===null&&(Je=1,Jr(e,Wt(t,e.current)))}function Dp(){var e=Bt.current;return e===null?!0:(Ee&4194048)===Ee?nn===null:(Ee&62914560)===Ee||(Ee&536870912)!==0?e===nn:!1}function Rp(){var e=R.H;return R.H=Us,e===null?Us:e}function Cp(){var e=R.A;return R.A=vb,e}function fl(){Je=4,di||(Ee&4194048)!==Ee&&Bt.current!==null||(ka=!0),(hi&134217727)===0&&(Zi&134217727)===0||Ge===null||gi(Ge,Ee,Vt,!1)}function Po(e,t,a){var r=_e;_e|=2;var o=Rp(),c=Cp();(Ge!==e||Ee!==t)&&(ol=null,Ga(e,t)),t=!1;var p=Je;e:do try{if(Ne!==0&&xe!==null){var y=xe,S=$t;switch(Ne){case 8:Qo(),p=6;break e;case 3:case 2:case 9:case 6:Bt.current===null&&(t=!0);var z=Ne;if(Ne=0,$t=null,$a(e,y,S,z),a&&ka){p=0;break e}break;default:z=Ne,Ne=0,$t=null,$a(e,y,S,z)}}Sb(),p=Je;break}catch(j){Mp(e,j)}while(!0);return t&&e.shellSuspendCounter++,Nn=Ii=null,_e=r,R.H=o,R.A=c,xe===null&&(Ge=null,Ee=0,zr()),p}function Sb(){for(;xe!==null;)Op(xe)}function wb(e,t){var a=_e;_e|=2;var r=Rp(),o=Cp();Ge!==e||Ee!==t?(ol=null,ul=Ve()+500,Ga(e,t)):ka=us(e,t);e:do try{if(Ne!==0&&xe!==null){t=xe;var c=$t;t:switch(Ne){case 1:Ne=0,$t=null,$a(e,t,c,1);break;case 2:case 9:if($d(c)){Ne=0,$t=null,zp(t);break}t=function(){Ne!==2&&Ne!==9||Ge!==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:$d(c)?(Ne=0,$t=null,zp(t)):(Ne=0,$t=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?gm(p):y.stateNode.complete){Ne=0,$t=null;var S=y.sibling;if(S!==null)xe=S;else{var z=y.return;z!==null?(xe=z,dl(z)):xe=null}break t}}Ne=0,$t=null,$a(e,t,c,5);break;case 6:Ne=0,$t=null,$a(e,t,c,6);break;case 8:Qo(),Je=6;break e;default:throw Error(l(462))}}Eb();break}catch(j){Mp(e,j)}while(!0);return Nn=Ii=null,R.H=r,R.A=o,_e=a,xe!==null?0:(Ge=null,Ee=0,zr(),Je)}function Eb(){for(;xe!==null&&!Qe();)Op(xe)}function Op(e){var t=ep(e.alternate,e,Hn);e.memoizedProps=e.pendingProps,t===null?dl(e):xe=t}function zp(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Kh(a,t,t.pendingProps,t.type,void 0,Ee);break;case 11:t=Kh(a,t,t.pendingProps,t.type.render,t.ref,Ee);break;case 5:co(t);default:np(a,t),t=xe=Cd(t,Hn),t=ep(a,t,Hn)}e.memoizedProps=e.pendingProps,t===null?dl(e):xe=t}function $a(e,t,a,r){Nn=Ii=null,co(t),Ca=null,Ts=0;var o=t.return;try{if(fb(e,o,t,a,Ee)){Je=1,Jr(e,Wt(a,e.current)),xe=null;return}}catch(c){if(o!==null)throw xe=o,c;Je=1,Jr(e,Wt(a,e.current)),xe=null;return}t.flags&32768?(Me||r===1?e=!0:ka||(Ee&536870912)!==0?e=!1:(di=e=!0,(r===2||r===9||r===3||r===6)&&(r=Bt.current,r!==null&&r.tag===13&&(r.flags|=16384))),_p(t,e)):dl(t)}function dl(e){var t=e;do{if((t.flags&32768)!==0){_p(t,di);return}e=t.return;var a=pb(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 _p(e,t){do{var a=mb(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 Up(e,t,a,r,o,c,p,y,S){e.cancelPendingCommit=null;do hl();while(ot!==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,nv(e,a,c,p,y,S),e===Ge&&(xe=Ge=null,Ee=0),Ba=t,mi=e,qn=a,Yo=c,Xo=o,wp=r,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,Db(Dn,function(){return Bp(),null})):(e.callbackNode=null,e.callbackPriority=0),r=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||r){r=R.T,R.T=null,o=q.p,q.p=2,p=_e,_e|=4;try{gb(e,t,a)}finally{_e=p,q.p=o,R.T=r}}ot=1,Np(),Lp(),kp()}}function Np(){if(ot===1){ot=0;var e=mi,t=Ba,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=R.T,R.T=null;var r=q.p;q.p=2;var o=_e;_e|=4;try{pp(t,e);var c=uc,p=xd(e.containerInfo),y=c.focusedElem,S=c.selectionRange;if(p!==y&&y&&y.ownerDocument&&bd(y.ownerDocument.documentElement,y)){if(S!==null&&_u(y)){var z=S.start,j=S.end;if(j===void 0&&(j=z),"selectionStart"in y)y.selectionStart=z,y.selectionEnd=Math.min(j,y.value.length);else{var F=y.ownerDocument||document,_=F&&F.defaultView||window;if(_.getSelection){var U=_.getSelection(),ne=y.textContent.length,ce=Math.min(S.start,ne),Be=S.end===void 0?ce:Math.min(S.end,ne);!U.extend&&ce>Be&&(p=Be,Be=ce,ce=p);var T=vd(y,ce),A=vd(y,Be);if(T&&A&&(U.rangeCount!==1||U.anchorNode!==T.node||U.anchorOffset!==T.offset||U.focusNode!==A.node||U.focusOffset!==A.offset)){var C=F.createRange();C.setStart(T.node,T.offset),U.removeAllRanges(),ce>Be?(U.addRange(C),U.extend(A.node,A.offset)):(C.setEnd(A.node,A.offset),U.addRange(C))}}}}for(F=[],U=y;U=U.parentNode;)U.nodeType===1&&F.push({element:U,left:U.scrollLeft,top:U.scrollTop});for(typeof y.focus=="function"&&y.focus(),y=0;y<F.length;y++){var $=F[y];$.element.scrollLeft=$.left,$.element.scrollTop=$.top}}Tl=!!lc,uc=lc=null}finally{_e=o,q.p=r,R.T=a}}e.current=t,ot=2}}function Lp(){if(ot===2){ot=0;var e=mi,t=Ba,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=R.T,R.T=null;var r=q.p;q.p=2;var o=_e;_e|=4;try{op(e,t.alternate,t)}finally{_e=o,q.p=r,R.T=a}}ot=3}}function kp(){if(ot===4||ot===3){ot=0,Kt();var e=mi,t=Ba,a=qn,r=wp;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?ot=5:(ot=0,Ba=mi=null,jp(e,e.pendingLanes));var o=e.pendingLanes;if(o===0&&(pi=null),hu(a),t=t.stateNode,He&&typeof He.onCommitFiberRoot=="function")try{He.onCommitFiberRoot(ct,t,void 0,(t.current.flags&128)===128)}catch{}if(r!==null){t=R.T,o=q.p,q.p=2,R.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{R.T=t,q.p=o}}(qn&3)!==0&&hl(),Sn(e),o=e.pendingLanes,(a&261930)!==0&&(o&42)!==0?e===Ko?Is++:(Is=0,Ko=e):Is=0,Fs(0)}}function jp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Es(t)))}function hl(){return Np(),Lp(),kp(),Bp()}function Bp(){if(ot!==5)return!1;var e=mi,t=Yo;Yo=0;var a=hu(qn),r=R.T,o=q.p;try{q.p=32>a?32:a,R.T=null,a=Xo,Xo=null;var c=mi,p=qn;if(ot=0,Ba=mi=null,qn=0,(_e&6)!==0)throw Error(l(331));var y=_e;if(_e|=4,bp(c.current),gp(c,c.current,p,a),_e=y,Fs(0,!1),He&&typeof He.onPostCommitFiberRoot=="function")try{He.onPostCommitFiberRoot(ct,c)}catch{}return!0}finally{q.p=o,R.T=r,jp(e,t)}}function Gp(e,t,a){t=Wt(a,t),t=Mo(e.stateNode,t,2),e=ui(e,t,2),e!==null&&(os(e,2),Sn(e))}function Le(e,t,a){if(e.tag===3)Gp(e,e,a);else for(;t!==null;){if(t.tag===3){Gp(t,e,a);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(pi===null||!pi.has(r))){e=Wt(a,e),a=$h(2),r=ui(t,a,2),r!==null&&(Vh(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 bb;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=Ab.bind(null,e,t,a),t.then(e,e))}function Ab(e,t,a){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,Ge===e&&(Ee&a)===a&&(Je===4||Je===3&&(Ee&62914560)===Ee&&300>Ve()-ll?(_e&2)===0&&Ga(e,0):Ho|=a,ja===Ee&&(ja=0)),Sn(e)}function $p(e,t){t===0&&(t=Nf()),e=Gi(e,t),e!==null&&(os(e,t),Sn(e))}function Tb(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),$p(e,a)}function Mb(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),$p(e,a)}function Db(e,t){return Ce(e,t)}var pl=null,Va=null,Wo=!1,ml=!1,Jo=!1,yi=0;function Sn(e){e!==Va&&e.next===null&&(Va===null?pl=Va=e:Va=Va.next=e),ml=!0,Wo||(Wo=!0,Cb())}function Fs(e,t){if(!Jo&&ml){Jo=!0;do for(var a=!1,r=pl;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,Hp(r,c))}else c=Ee,c=br(r,r===Ge?c:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(c&3)===0||us(r,c)||(a=!0,Hp(r,c));r=r.next}while(a);Jo=!1}}function Rb(){Vp()}function Vp(){ml=Wo=!1;var e=0;yi!==0&&Gb()&&(e=yi);for(var t=Ve(),a=null,r=pl;r!==null;){var o=r.next,c=Ip(r,t);c===0?(r.next=null,a===null?pl=o:a.next=o,o===null&&(Va=a)):(a=r,(e!==0||(c&3)!==0)&&(ml=!0)),r=o}ot!==0&&ot!==5||Fs(e),yi!==0&&(yi=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]=tv(y,t)):S<=t&&(e.expiredLanes|=y),c&=~y}if(t=Ge,a=Ee,a=br(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r=e.callbackNode,a===0||e===t&&(Ne===2||Ne===9)||e.cancelPendingCommit!==null)return r!==null&&r!==null&&Ke(r),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||us(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(r!==null&&Ke(r),hu(a)){case 2:case 8:a=Lt;break;case 32:a=Dn;break;case 268435456:a=Rn;break;default:a=Dn}return r=Fp.bind(null,e),a=Ce(a,r),e.callbackPriority=t,e.callbackNode=a,t}return r!==null&&r!==null&&Ke(r),e.callbackPriority=2,e.callbackNode=null,2}function Fp(e,t){if(ot!==0&&ot!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(hl()&&e.callbackNode!==a)return null;var r=Ee;return r=br(e,e===Ge?r:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),r===0?null:(Ap(e,r,t),Ip(e,Ve()),e.callbackNode!=null&&e.callbackNode===a?Fp.bind(null,e):null)}function Hp(e,t){if(hl())return null;Ap(e,t,!0)}function Cb(){Vb(function(){(_e&6)!==0?Ce(xt,Rb):Vp()})}function ec(){if(yi===0){var e=Ma;e===0&&(e=gr,gr<<=1,(gr&261888)===0&&(gr=256)),yi=e}return yi}function qp(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:Er(""+e)}function Yp(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 Ob(e,t,a,r,o){if(t==="submit"&&a&&a.stateNode===o){var c=qp((o[Dt]||null).action),p=r.submitter;p&&(t=(t=p[Dt]||null)?qp(t.formAction):p.getAttribute("formAction"),t!==null&&(c=t,p=null));var y=new Dr("action","action",null,r,o);e.push({event:y,listeners:[{instance:null,listener:function(){if(r.defaultPrevented){if(yi!==0){var S=p?Yp(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?Yp(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<ku.length;tc++){var nc=ku[tc],zb=nc.toLowerCase(),_b=nc[0].toUpperCase()+nc.slice(1);hn(zb,"on"+_b)}hn(Ed,"onAnimationEnd"),hn(Ad,"onAnimationIteration"),hn(Td,"onAnimationStart"),hn("dblclick","onDoubleClick"),hn("focusin","onFocus"),hn("focusout","onBlur"),hn(Kv,"onTransitionRun"),hn(Qv,"onTransitionStart"),hn(Pv,"onTransitionCancel"),hn(Md,"onTransitionEnd"),da("onMouseEnter",["mouseout","mouseover"]),da("onMouseLeave",["mouseout","mouseover"]),da("onPointerEnter",["pointerout","pointerover"]),da("onPointerLeave",["pointerout","pointerover"]),Li("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Li("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Li("onBeforeInput",["compositionend","keypress","textInput","paste"]),Li("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Li("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Li("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var 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(" "),Ub=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Hs));function Xp(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,z=y.currentTarget;if(y=y.listener,S!==c&&o.isPropagationStopped())break e;c=y,o.currentTarget=z;try{c(o)}catch(j){Or(j)}o.currentTarget=null,c=S}else for(p=0;p<r.length;p++){if(y=r[p],S=y.instance,z=y.currentTarget,y=y.listener,S!==c&&o.isPropagationStopped())break e;c=y,o.currentTarget=z;try{c(o)}catch(j){Or(j)}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)||(Kp(t,e,2,!1),a.add(r))}function ic(e,t,a){var r=0;t&&(r|=4),Kp(a,e,r,t)}var gl="_reactListening"+Math.random().toString(36).slice(2);function ac(e){if(!e[gl]){e[gl]=!0,Vf.forEach(function(a){a!=="selectionchange"&&(Ub.has(a)||ic(a,!1,e),ic(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[gl]||(t[gl]=!0,ic("selectionchange",!1,t))}}function Kp(e,t,a,r){switch(Em(t)){case 2:var o=lx;break;case 8:o=ux;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}Jf(function(){var z=c,j=Su(a),F=[];e:{var _=Dd.get(e);if(_!==void 0){var U=Dr,ne=e;switch(e){case"keypress":if(Tr(a)===0)break e;case"keydown":case"keyup":U=Mv;break;case"focusin":ne="focus",U=Du;break;case"focusout":ne="blur",U=Du;break;case"beforeblur":case"afterblur":U=Du;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":U=nd;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":U=pv;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":U=Cv;break;case Ed:case Ad:case Td:U=yv;break;case Md:U=zv;break;case"scroll":case"scrollend":U=dv;break;case"wheel":U=Uv;break;case"copy":case"cut":case"paste":U=bv;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":U=ad;break;case"toggle":case"beforetoggle":U=Lv}var ce=(t&4)!==0,Be=!ce&&(e==="scroll"||e==="scrollend"),T=ce?_!==null?_+"Capture":null:_;ce=[];for(var A=z,C;A!==null;){var $=A;if(C=$.stateNode,$=$.tag,$!==5&&$!==26&&$!==27||C===null||T===null||($=ds(A,T),$!=null&&ce.push(qs(A,$,C))),Be)break;A=A.return}0<ce.length&&(_=new U(_,ne,null,a,j),F.push({event:_,listeners:ce}))}}if((t&7)===0){e:{if(_=e==="mouseover"||e==="pointerover",U=e==="mouseout"||e==="pointerout",_&&a!==xu&&(ne=a.relatedTarget||a.fromElement)&&(oa(ne)||ne[ua]))break e;if((U||_)&&(_=j.window===j?j:(_=j.ownerDocument)?_.defaultView||_.parentWindow:window,U?(ne=a.relatedTarget||a.toElement,U=z,ne=ne?oa(ne):null,ne!==null&&(Be=f(ne),ce=ne.tag,ne!==Be||ce!==5&&ce!==27&&ce!==6)&&(ne=null)):(U=null,ne=z),U!==ne)){if(ce=nd,$="onMouseLeave",T="onMouseEnter",A="mouse",(e==="pointerout"||e==="pointerover")&&(ce=ad,$="onPointerLeave",T="onPointerEnter",A="pointer"),Be=U==null?_:fs(U),C=ne==null?_:fs(ne),_=new ce($,A+"leave",U,a,j),_.target=Be,_.relatedTarget=C,$=null,oa(j)===z&&(ce=new ce(T,A+"enter",ne,a,j),ce.target=C,ce.relatedTarget=Be,$=ce),Be=$,U&&ne)t:{for(ce=Nb,T=U,A=ne,C=0,$=T;$;$=ce($))C++;$=0;for(var oe=A;oe;oe=ce(oe))$++;for(;0<C-$;)T=ce(T),C--;for(;0<$-C;)A=ce(A),$--;for(;C--;){if(T===A||A!==null&&T===A.alternate){ce=T;break t}T=ce(T),A=ce(A)}ce=null}else ce=null;U!==null&&Qp(F,_,U,ce,!1),ne!==null&&Be!==null&&Qp(F,Be,ne,ce,!0)}}e:{if(_=z?fs(z):window,U=_.nodeName&&_.nodeName.toLowerCase(),U==="select"||U==="input"&&_.type==="file")var Oe=dd;else if(cd(_))if(hd)Oe=qv;else{Oe=Fv;var se=Iv}else U=_.nodeName,!U||U.toLowerCase()!=="input"||_.type!=="checkbox"&&_.type!=="radio"?z&&bu(z.elementType)&&(Oe=dd):Oe=Hv;if(Oe&&(Oe=Oe(e,z))){fd(F,Oe,a,j);break e}se&&se(e,_,z),e==="focusout"&&z&&_.type==="number"&&z.memoizedProps.value!=null&&vu(_,"number",_.value)}switch(se=z?fs(z):window,e){case"focusin":(cd(se)||se.contentEditable==="true")&&(va=se,Uu=z,xs=null);break;case"focusout":xs=Uu=va=null;break;case"mousedown":Nu=!0;break;case"contextmenu":case"mouseup":case"dragend":Nu=!1,Sd(F,a,j);break;case"selectionchange":if(Xv)break;case"keydown":case"keyup":Sd(F,a,j)}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?ud(e,a)&&(Ae="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ae="onCompositionStart");Ae&&(sd&&a.locale!=="ko"&&(ya||Ae!=="onCompositionStart"?Ae==="onCompositionEnd"&&ya&&(ve=ed()):(ti=j,Au="value"in ti?ti.value:ti.textContent,ya=!0)),se=yl(z,Ae),0<se.length&&(Ae=new id(Ae,e,null,a,j),F.push({event:Ae,listeners:se}),ve?Ae.data=ve:(ve=od(a),ve!==null&&(Ae.data=ve)))),(ve=jv?Bv(e,a):Gv(e,a))&&(Ae=yl(z,"onBeforeInput"),0<Ae.length&&(se=new id("onBeforeInput","beforeinput",null,a,j),F.push({event:se,listeners:Ae}),se.data=ve)),Ob(F,e,z,a,j)}Xp(F,t)})}function qs(e,t,a){return{instance:e,listener:t,currentTarget:a}}function yl(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 Nb(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function Qp(e,t,a,r,o){for(var c=t._reactName,p=[];a!==null&&a!==r;){var y=a,S=y.alternate,z=y.stateNode;if(y=y.tag,S!==null&&S===r)break;y!==5&&y!==26&&y!==27||z===null||(S=z,o?(z=ds(a,c),z!=null&&p.unshift(qs(a,z,S))):o||(z=ds(a,c),z!=null&&p.push(qs(a,z,S)))),a=a.return}p.length!==0&&e.push({event:t,listeners:p})}var Lb=/\r\n?/g,kb=/\u0000|\uFFFD/g;function Pp(e){return(typeof e=="string"?e:""+e).replace(Lb,`
|
|
9
|
-
`).replace(kb,"")}function Zp(e,t){return t=Pp(t),Pp(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":Sr(e,"class",r);break;case"tabIndex":Sr(e,"tabindex",r);break;case"dir":case"role":case"viewBox":case"width":case"height":Sr(e,a,r);break;case"style":Zf(e,r,c);break;case"data":if(t!=="object"){Sr(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=Er(""+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=Er(""+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=Er(""+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),xr(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":xr(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=cv.get(a)||a,xr(e,a,r))}}function rc(e,t,a,r,o,c){switch(a){case"style":Zf(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[Dt]||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,""):xr(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,z=null;for(r in a)if(a.hasOwnProperty(r)){var j=a[r];if(j!=null)switch(r){case"name":o=j;break;case"type":p=j;break;case"checked":S=j;break;case"defaultChecked":z=j;break;case"value":c=j;break;case"defaultValue":y=j;break;case"children":case"dangerouslySetInnerHTML":if(j!=null)throw Error(l(137,t));break;default:je(e,t,r,j,a,null)}}Xf(e,c,y,S,z,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)}Qf(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(z in a)if(a.hasOwnProperty(z)&&(r=a[z],r!=null))switch(z){case"children":case"dangerouslySetInnerHTML":throw Error(l(137,t));default:je(e,t,z,r,a,null)}return;default:if(bu(t)){for(j in a)a.hasOwnProperty(j)&&(r=a[j],r!==void 0&&rc(e,t,j,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 jb(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,z=null,j=null;for(U in a){var F=a[U];if(a.hasOwnProperty(U)&&F!=null)switch(U){case"checked":break;case"value":break;case"defaultValue":S=F;default:r.hasOwnProperty(U)||je(e,t,U,null,r,F)}}for(var _ in r){var U=r[_];if(F=a[_],r.hasOwnProperty(_)&&(U!=null||F!=null))switch(_){case"type":c=U;break;case"name":o=U;break;case"checked":z=U;break;case"defaultChecked":j=U;break;case"value":p=U;break;case"defaultValue":y=U;break;case"children":case"dangerouslySetInnerHTML":if(U!=null)throw Error(l(137,t));break;default:U!==F&&je(e,t,_,U,r,F)}}yu(e,p,y,S,z,j,c,o);return;case"select":U=p=y=_=null;for(c in a)if(S=a[c],a.hasOwnProperty(c)&&S!=null)switch(c){case"value":break;case"multiple":U=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=U,_!=null?ha(e,!!a,_,!1):!!r!=!!a&&(t!=null?ha(e,!!a,t,!0):ha(e,!!a,a?[]:"",!1));return;case"textarea":U=_=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":U=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)}Kf(e,_,U);return;case"option":for(var ne in a)_=a[ne],a.hasOwnProperty(ne)&&_!=null&&!r.hasOwnProperty(ne)&&(ne==="selected"?e.selected=!1:je(e,t,ne,null,r,_));for(S in r)_=r[S],U=a[S],r.hasOwnProperty(S)&&_!==U&&(_!=null||U!=null)&&(S==="selected"?e.selected=_&&typeof _!="function"&&typeof _!="symbol":je(e,t,S,_,r,U));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var ce in a)_=a[ce],a.hasOwnProperty(ce)&&_!=null&&!r.hasOwnProperty(ce)&&je(e,t,ce,null,r,_);for(z in r)if(_=r[z],U=a[z],r.hasOwnProperty(z)&&_!==U&&(_!=null||U!=null))switch(z){case"children":case"dangerouslySetInnerHTML":if(_!=null)throw Error(l(137,t));break;default:je(e,t,z,_,r,U)}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(j in r)_=r[j],U=a[j],!r.hasOwnProperty(j)||_===U||_===void 0&&U===void 0||rc(e,t,j,_,r,U);return}}for(var T in a)_=a[T],a.hasOwnProperty(T)&&_!=null&&!r.hasOwnProperty(T)&&je(e,t,T,null,r,_);for(F in r)_=r[F],U=a[F],!r.hasOwnProperty(F)||_===U||_==null&&U==null||je(e,t,F,_,r,U)}function Wp(e){switch(e){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function Bb(){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&&Wp(p)){for(p=0,y=o.responseEnd,r+=1;r<a.length;r++){var S=a[r],z=S.startTime;if(z>y)break;var j=S.transferSize,F=S.initiatorType;j&&Wp(F)&&(S=S.responseEnd,p+=j*(S<y?1:(y-z)/(S-z)))}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 vl(e){return e.nodeType===9?e:e.ownerDocument}function Jp(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 em(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 Gb(){var e=window.event;return e&&e.type==="popstate"?e===cc?!1:(cc=e,!0):(cc=null,!1)}var tm=typeof setTimeout=="function"?setTimeout:void 0,$b=typeof clearTimeout=="function"?clearTimeout:void 0,nm=typeof Promise=="function"?Promise:void 0,Vb=typeof queueMicrotask=="function"?queueMicrotask:typeof nm<"u"?function(e){return nm.resolve(null).then(e).catch(Ib)}:tm;function Ib(e){setTimeout(function(){throw e})}function vi(e){return e==="head"}function im(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 am(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 Fb(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=an(e.nextSibling),e===null)break}return null}function Hb(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=an(e.nextSibling),e===null))return null;return e}function sm(e,t){for(;e.nodeType!==8;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!t||(e=an(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 qb(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 an(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 rm(e){e=e.nextSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="/$"||a==="/&"){if(t===0)return an(e.nextSibling);t--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||t++}e=e.nextSibling}return null}function lm(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 um(e,t,a){switch(t=vl(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 sn=new Map,om=new Set;function bl(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var Yn=q.d;q.d={f:Yb,r:Xb,D:Kb,C:Qb,L:Pb,m:Zb,X:Jb,S:Wb,M:ex};function Yb(){var e=Yn.f(),t=cl();return e||t}function Xb(e){var t=ca(e);t!==null&&t.tag===5&&t.type==="form"?Mh(t):Yn.r(e)}var Ia=typeof document>"u"?null:document;function cm(e,t,a){var r=Ia;if(r&&typeof t=="string"&&t){var o=Pt(t);o='link[rel="'+e+'"][href="'+o+'"]',typeof a=="string"&&(o+='[crossorigin="'+a+'"]'),om.has(o)||(om.add(o),e={rel:e,crossOrigin:a,href:t},r.querySelector(o)===null&&(t=r.createElement("link"),bt(t,"link",e),ft(t),r.head.appendChild(t)))}}function Kb(e){Yn.D(e),cm("dns-prefetch",e,null)}function Qb(e,t){Yn.C(e,t),cm("preconnect",e,t)}function Pb(e,t,a){Yn.L(e,t,a);var r=Ia;if(r&&e&&t){var o='link[rel="preload"][as="'+Pt(t)+'"]';t==="image"&&a&&a.imageSrcSet?(o+='[imagesrcset="'+Pt(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(o+='[imagesizes="'+Pt(a.imageSizes)+'"]')):o+='[href="'+Pt(e)+'"]';var c=o;switch(t){case"style":c=Fa(e);break;case"script":c=Ha(e)}sn.has(c)||(e=b({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),sn.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),ft(t),r.head.appendChild(t)))}}function Zb(e,t){Yn.m(e,t);var a=Ia;if(a&&e){var r=t&&typeof t.as=="string"?t.as:"script",o='link[rel="modulepreload"][as="'+Pt(r)+'"][href="'+Pt(e)+'"]',c=o;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":c=Ha(e)}if(!sn.has(c)&&(e=b({rel:"modulepreload",href:e},t),sn.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),ft(r),a.head.appendChild(r)}}}function Wb(e,t,a){Yn.S(e,t,a);var r=Ia;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=b({rel:"stylesheet",href:e,"data-precedence":t},a),(a=sn.get(c))&&mc(e,a);var S=p=r.createElement("link");ft(S),bt(S,"link",e),S._p=new Promise(function(z,j){S.onload=z,S.onerror=j}),S.addEventListener("load",function(){y.loading|=1}),S.addEventListener("error",function(){y.loading|=2}),y.loading|=4,xl(p,t,r)}p={type:"stylesheet",instance:p,count:1,state:y},o.set(c,p)}}}function Jb(e,t){Yn.X(e,t);var a=Ia;if(a&&e){var r=fa(a).hoistableScripts,o=Ha(e),c=r.get(o);c||(c=a.querySelector(Ks(o)),c||(e=b({src:e,async:!0},t),(t=sn.get(o))&&gc(e,t),c=a.createElement("script"),ft(c),bt(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},r.set(o,c))}}function ex(e,t){Yn.M(e,t);var a=Ia;if(a&&e){var r=fa(a).hoistableScripts,o=Ha(e),c=r.get(o);c||(c=a.querySelector(Ks(o)),c||(e=b({src:e,async:!0,type:"module"},t),(t=sn.get(o))&&gc(e,t),c=a.createElement("script"),ft(c),bt(c,"link",e),a.head.appendChild(c)),c={type:"script",instance:c,count:1,state:null},r.set(o,c))}}function fm(e,t,a,r){var o=(o=fe.current)?bl(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),sn.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},sn.set(e,a),c||tx(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="'+Pt(e)+'"'}function Xs(e){return'link[rel="stylesheet"]['+e+"]"}function dm(e){return b({},e,{"data-precedence":e.precedence,precedence:null})}function tx(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),ft(t),e.head.appendChild(t))}function Ha(e){return'[src="'+Pt(e)+'"]'}function Ks(e){return"script[async]"+e}function hm(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+Pt(a.href)+'"]');if(r)return t.instance=r,ft(r),r;var o=b({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),ft(r),bt(r,"style",o),xl(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,ft(c),c;r=dm(a),(o=sn.get(o))&&mc(r,o),c=(e.ownerDocument||e).createElement("link"),ft(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,xl(c,a.precedence,e),t.instance=c;case"script":return c=Ha(a.src),(o=e.querySelector(Ks(c)))?(t.instance=o,ft(o),o):(r=a,(o=sn.get(c))&&(r=b({},a),gc(r,o)),e=e.ownerDocument||e,o=e.createElement("script"),ft(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,xl(r,a.precedence,e));return t.instance}function xl(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 Sl=null;function pm(e,t,a){if(Sl===null){var r=new Map,o=Sl=new Map;o.set(a,r)}else o=Sl,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 mm(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function nx(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 gm(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function ix(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=wl.bind(e),t.then(e,e)),a.state.loading|=4,a.instance=c,ft(c);return}c=t.ownerDocument||t,r=dm(r),(o=sn.get(o))&&mc(r,o),c=c.createElement("link"),ft(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=wl.bind(e),t.addEventListener("load",a),t.addEventListener("error",a))}}var yc=0;function ax(e,t){return e.stylesheets&&e.count===0&&Al(e,e.stylesheets),0<e.count||0<e.imgCount?function(a){var r=setTimeout(function(){if(e.stylesheets&&Al(e,e.stylesheets),e.unsuspend){var c=e.unsuspend;e.unsuspend=null,c()}},6e4+t);0<e.imgBytes&&yc===0&&(yc=62500*Bb());var o=setTimeout(function(){if(e.waitingForImages=!1,e.count===0&&(e.stylesheets&&Al(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 wl(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Al(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var El=null;function Al(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,El=new Map,t.forEach(sx,e),El=null,wl.call(e))}function sx(e,t){if(!(t.state.loading&4)){var a=El.get(e);if(a)var r=a.get(null);else{a=new Map,El.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=wl.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:I,Provider:null,Consumer:null,_currentValue:ae,_currentValue2:ae,_threadCount:0};function rx(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 ym(e,t,a,r,o,c,p,y,S,z,j,F){return e=new rx(e,t,a,p,S,z,j,F,y),t=1,c===!0&&(t|=24),c=jt(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 vm(e){return e?(e=Sa,e):Sa}function bm(e,t,a,r,o,c){o=vm(o),r.context===null?r.context=o:r.pendingContext=o,r=li(t),r.payload={element:a},c=c===void 0?null:c,c!==null&&(r.callback=c),a=ui(e,r,t),a!==null&&(Ut(a,e,t),Ds(a,e,t))}function xm(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){xm(e,t),(e=e.alternate)&&xm(e,t)}function Sm(e){if(e.tag===13||e.tag===31){var t=Gi(e,67108864);t!==null&&Ut(t,e,67108864),vc(e,67108864)}}function wm(e){if(e.tag===13||e.tag===31){var t=It();t=du(t);var a=Gi(e,t);a!==null&&Ut(a,e,t),vc(e,t)}}var Tl=!0;function lx(e,t,a,r){var o=R.T;R.T=null;var c=q.p;try{q.p=2,bc(e,t,a,r)}finally{q.p=c,R.T=o}}function ux(e,t,a,r){var o=R.T;R.T=null;var c=q.p;try{q.p=8,bc(e,t,a,r)}finally{q.p=c,R.T=o}}function bc(e,t,a,r){if(Tl){var o=xc(r);if(o===null)sc(e,t,r,Ml,a),Am(e,r);else if(cx(o,e,t,a,r))r.stopPropagation();else if(Am(e,r),t&4&&-1<ox.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&&(ul=Ve()+500,Fs(0))}}break;case 31:case 13:y=Gi(c,2),y!==null&&Ut(y,c,2),cl(),vc(c,2)}if(c=xc(r),c===null&&sc(e,t,r,Ml,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 Ml=null;function Sc(e){if(Ml=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 Ml=e,null}function Em(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(dn()){case xt:return 2;case Lt:return 8;case Dn:case la:return 32;case Rn:return 268435456;default:return 32}default:return 32}}var wc=!1,bi=null,xi=null,Si=null,Ps=new Map,Zs=new Map,wi=[],ox="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 Am(e,t){switch(e){case"focusin":case"focusout":bi=null;break;case"dragenter":case"dragleave":xi=null;break;case"mouseover":case"mouseout":Si=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&&Sm(t)),e):(e.eventSystemFlags|=r,t=e.targetContainers,o!==null&&t.indexOf(o)===-1&&t.push(o),e)}function cx(e,t,a,r,o){switch(t){case"focusin":return bi=Ws(bi,e,t,a,r,o),!0;case"dragenter":return xi=Ws(xi,e,t,a,r,o),!0;case"mouseover":return Si=Ws(Si,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,Gf(e.priority,function(){wm(a)});return}}else if(t===31){if(t=h(a),t!==null){e.blockedOn=t,Gf(e.priority,function(){wm(a)});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function Dl(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=xc(e.nativeEvent);if(a===null){a=e.nativeEvent;var r=new a.constructor(a.type,a);xu=r,a.target.dispatchEvent(r),xu=null}else return t=ca(a),t!==null&&Sm(t),e.blockedOn=a,!1;t.shift()}return!0}function Mm(e,t,a){Dl(e)&&a.delete(t)}function fx(){wc=!1,bi!==null&&Dl(bi)&&(bi=null),xi!==null&&Dl(xi)&&(xi=null),Si!==null&&Dl(Si)&&(Si=null),Ps.forEach(Mm),Zs.forEach(Mm)}function Rl(e,t){e.blockedOn===t&&(e.blockedOn=null,wc||(wc=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,fx)))}var Cl=null;function Dm(e){Cl!==e&&(Cl=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){Cl===e&&(Cl=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 Rl(S,e)}bi!==null&&Rl(bi,e),xi!==null&&Rl(xi,e),Si!==null&&Rl(Si,e),Ps.forEach(t),Zs.forEach(t);for(var a=0;a<wi.length;a++){var r=wi[a];r.blockedOn===e&&(r.blockedOn=null)}for(;0<wi.length&&(a=wi[0],a.blockedOn===null);)Tm(a),a.blockedOn===null&&wi.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[Dt]||null;if(typeof c=="function")p||Dm(a);else if(p){var y=null;if(c&&c.hasAttribute("formAction")){if(o=c,p=c[Dt]||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),Dm(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}Ol.prototype.render=Ec.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(l(409));var a=t.current,r=It();bm(a,r,e,t,null,null)},Ol.prototype.unmount=Ec.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;bm(e.current,2,null,e,null,null),cl(),t[ua]=null}};function Ol(e){this._internalRoot=e}Ol.prototype.unstable_scheduleHydration=function(e){if(e){var t=Bf();e={blockedOn:null,target:e,priority:t};for(var a=0;a<wi.length&&t!==0&&t<wi[a].priority;a++);wi.splice(a,0,e),a===0&&Tm(e)}};var Cm=i.version;if(Cm!=="19.2.8")throw Error(l(527,Cm,"19.2.8"));q.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?x(e):null,e=e===null?null:e.stateNode,e};var dx={bundleType:0,version:"19.2.8",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.8"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var zl=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zl.isDisabled&&zl.supportsFiber)try{ct=zl.inject(dx),He=zl}catch{}}return er.createRoot=function(e,t){if(!u(e))throw Error(l(299));var a=!1,r="",o=kh,c=jh,p=Bh;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=ym(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=jh,y=Bh,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=ym(e,1,!0,t,a??null,r,o,S,c,p,y,Rm),t.context=vm(null),a=t.current,r=It(),r=du(r),o=li(r),o.callback=null,ui(a,o,r),a=r,t.current.lanes=a,os(t,a),Sn(t),e[ua]=t.current,ac(e),new Ol(t)},er.version="19.2.8",er}var Gm;function wx(){if(Gm)return Mc.exports;Gm=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(i){console.error(i)}}return n(),Mc.exports=Sx(),Mc.exports}var Ex=wx();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 An(n,i){const s=n[i];return typeof s=="number"&&Number.isFinite(s)?s:void 0}function Pl(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 Ax=[Xe.tokensInput,Xe.tokensOutput,Xe.tokensCacheRead];function qt(n){let i=0,s=!1;for(const l of Ax){const u=An(n,l);u!==void 0&&(s=!0,i+=u)}return s?i:void 0}function Wa(n){return{input:An(n,Xe.tokensInput)??0,output:An(n,Xe.tokensOutput)??0,cacheRead:An(n,Xe.tokensCacheRead)??0,reasoning:An(n,Xe.tokensReasoning)??0}}function _0(n){const i=qt(n.measures);if(i!==void 0)return $m(i/1e3,200);const s=An(n.measures,Xe.cpuMs);if(s!==void 0)return $m(s/1e3,200)}function un(n){return An(n.measures,Xe.interactions)}function ff(n){return An(n.measures,Xe.steps)??0}function ia(n){return An(n.measures,Xe.errors)??0}function Yc(n){return An(n.measures,Xe.retries)??0}function $m(n,i){return Math.min(1,Math.log1p(Math.max(0,n))/Math.log1p(i))}const Tx=new Set(["running","waiting"]);function U0(n){return Tx.has(n)}function Vl(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 N0=9e4;function Vm(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 Mx(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 Dx(n,i){if(n.seen.has(i.id))return;n.seen.add(i.id),i.occurredAt>n.now&&(n.now=i.occurredAt),Mx(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);break}const f={id:i.subject.id,machineId:s.machineId??"",label:s.label,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":Rx(n,i,l);break;case"process":Cx(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 Rx(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&&Pl(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&&Pl(f.measures,l.measures),f.lastActivityAt=s,f.status==="idle"&&(f.status="running",n.active.add(u));break}case"blocked":{if(!U0(f.status))break;f.status="waiting",f.waitingSince=s,f.waitReason=l.blockedOn??"input",f.lastActivityAt=s;break}case"resumed":{Vm(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"}),Vm(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 Cx(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&&Pl(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;Pl(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 Ox(n,i){for(let s=0;s<i.length;s++)Dx(n,i[s])}function zx(n,i){if(!(i<=n.now)){n.now=i;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>N0&&(l.status="idle")}}}const Ft=n=>({value:n,basis:"measured"}),_l=(n,i)=>({value:n,basis:"inferred",assumption:i});function df(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 _x(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 L0(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}}const k0=6e4;function Ux(n,i){return{start:n.startedAt,end:n.endedAt??i}}function Nx(n){const i=[];for(const s of n.executions.values()){s.depth===0&&i.push({start:s.startedAt-k0,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 df(i)}function j0(n){const i=n.now,s=[...n.executions.values()];let l=0,u=0,f=0,d=0,h=0,m=0,g=0,x=0;const b=[],D=new Map;for(const Z of s){l+=ff(Z),u+=qt(Z.measures)??0,f+=un(Z)??0,Z.status==="completed"?d++:Z.status==="failed"?h++:Z.status==="waiting"?m++:Z.status==="idle"&&g++;const de=Ux(Z,i);b.push(de),x+=Z.waitingMs,Z.waitingSince!==void 0&&(x+=Math.max(0,i-Z.waitingSince));let M=D.get(Z.machineId);M||(M={machineId:Z.machineId,executions:0,tokens:0,computeTime:0},D.set(Z.machineId,M)),M.executions++,M.tokens+=qt(Z.measures)??0,M.computeTime+=de.end-de.start}const V=df(b.map(Z=>({...Z}))),k=Nx(n),O=Im(_x(V,k)),{peak:L,at:K}=L0(b),G=Lx(n),I=Math.max(0,G.length-1);let H=null;for(const Z of G)(!H||Z.end-Z.start>H.end-H.start)&&(H=Z);return{requests:Ft(l),sessions:Ft(n.sessions.size),executions:Ft(s.length),tokens:Ft(u),toolCalls:Ft(f),autonomousCompute:_l(Im(V),"Wall-clock time during which at least one run was in flight, merged so parallel runs are not double-counted."),humanAgentOverlap:_l(O,`Compute time intersecting a window when you were plausibly present: the ${k0/1e3}s before you sent a message, and any approval from ask to answer.`),peakConcurrency:Ft(L),peakConcurrencyAt:Ft(K),contextSwitches:_l(I,"Transitions between working directories, ordered by time. A directory is the closest thing the source has to a project."),longestFocus:_l(H,"Longest unbroken stretch spent in one working directory."),waitingOnYou:Ft(x),completed:Ft(d),failed:Ft(h),waiting:Ft(m),idle:Ft(g),byMachine:D,contextSpans:G,transfers:Ft(n.transfers.size)}}function Lx(n){const i=[];for(const l of n.executions.values()){const u=n.sessions.get(l.sessionId);u&&i.push({context:u.context,start:l.startedAt,end:l.endedAt??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<=kx?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 kx=15*6e4;function jx(n){return{key:n,runs:0,tokens:0,tokenRuns:0,computeMs:0,failed:0,waitingMs:0,toolCalls:0}}function Oc(n,i){const s=new Map;for(const l of n.executions.values()){const u=i(l,n.sessions.get(l.sessionId));if(u===void 0)continue;let f=s.get(u);f||(f=jx(u),s.set(u,f)),f.runs++;const d=qt(l.measures);d!==void 0&&(f.tokens+=d,f.tokenRuns++),f.computeMs+=(l.endedAt??n.now)-l.startedAt,f.waitingMs+=l.waitingMs,f.toolCalls+=un(l)??0,l.status==="failed"&&f.failed++}return[...s.values()].sort((l,u)=>u.computeMs-l.computeMs)}function Bx(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 Gx(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 $x(n){const i={toolCalls:0,toolErrors:0,retries:0,failed:0,interrupted:0,completed:0};for(const s of n.executions.values())i.toolCalls+=un(s)??0,i.toolErrors+=ia(s),i.retries+=Yc(s),s.status==="failed"?i.failed++:s.outcome==="interrupted"?i.interrupted++:s.outcome==="completed"&&i.completed++;return i}function Vx(n){const i=[];for(const f of n.executions.values())i.push({start:f.startedAt,end:f.endedAt??n.now});if(i.length===0)return[];const s=df(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 x of s){const b=Math.max(x.start,f),D=Math.min(x.end,d);D>b&&(h+=D-b)}let m=0;const g=[];for(const x of i)x.start<d&&x.end>f&&(m++,g.push({start:Math.max(x.start,f),end:Math.min(x.end,d)}));u.push({hour:new Date(f).getHours(),runs:m,computeMs:h,peak:L0(g).peak})}return u}const B0=1e3,Fm=60*B0;function Ye(n){if(!Number.isFinite(n)||n<=0)return"0m";if(n<Fm)return`${Math.max(1,Math.round(n/B0))}s`;const i=Math.round(n/Fm),s=Math.floor(i/60),l=i%60;return s===0?`${l}m`:l===0?`${s}h`:`${s}h ${l}m`}function pt(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:pt(n)}function Ix(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 ur(n){const i=n.split("/").filter(Boolean);return i[i.length-1]??n}const Il=6e4,Fx=60*Il;function G0(n,i){const s=[],l=i.contextSpans,u=i.longestFocus.value,f=Math.max(1,n.now-n.dayStart),d=i.autonomousCompute.value/f;let h;if(i.executions.value===0)return{headline:"QUIET",clauses:["No computation observed in this window."]};if(i.peakConcurrency.value>=3?h="PARALLEL":l.length>=6?h="FRAGMENTED":u&&u.end-u.start>2*Fx?h="SUSTAINED":d<.15?h="SPARSE":h="SERIAL",i.peakConcurrency.value>=2?s.push(`Up to ${i.peakConcurrency.value} runs in flight at once; ${Ye(i.autonomousCompute.value)} of wall-clock time had computation running.`):s.push(`Runs happened one at a time, across ${Ye(i.autonomousCompute.value)} of wall-clock time.`),u&&s.push(`The longest unbroken stretch was ${Ye(u.end-u.start)} in ${ur(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>Il&&s.push(`${Ye(i.waitingOnYou.value)} was spent with a run waiting on your answer.`),i.humanAgentOverlap.value>Il){const m=Math.round(i.humanAgentOverlap.value/Math.max(1,i.autonomousCompute.value)*100);s.push(`About ${m}% of that computation overlapped a window when you were present; the rest ran without you.`)}else i.autonomousCompute.value>5*Il&&s.push("Computation ran almost entirely outside the moments you were 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,x)=>x.computeTime-g.computeTime).map(g=>`${n.machines.get(g.machineId)?.name??g.machineId} ${Ye(g.computeTime)}`);s.push(`Compute was split across ${m.join(", ")}.`)}return{headline:h,clauses:s}}function Hx(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 Zl(n,i=0){return Hx(n+"#"+i)%1e5/1e5}const zc=[{x:430,y:508,extentX:300,extentY:186},{x:838,y:322,extentX:186,extentY:116}];function qx(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 Yx(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 Hm(n,i){const s=Zl(i,1),l=Zl(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},$0=3,Xx=4,qm=30,Kx=74;function V0(n){return qm+n*(Kx-qm)}function Ym(n,i,s){let l=null,u=1/0;for(const d of n.disturbances){const h=V0(d.extent),m=i-d.x,g=(s-d.y)*1.5,x=Math.hypot(m,g);x<h*1.3&&x<u&&(u=x,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,x=m.y-h.y,b=g*g+x*x;if(b===0)continue;const D=((i-h.x)*g+(s-h.y)*x)/b;if(D<.05||D>.95)continue;const V=h.x+g*D,k=h.y+x*D;if(Math.hypot(i-V,(s-k)*1.5)<50)return{kind:"coupling",id:d.id,x:V,y:k}}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 x=null,b=1/0;const D=$0/wn.spanX,V=Xx/wn.spanX;for(const k of n.strata){if(k.lane!==m)continue;const O=Math.max(D,k.endFraction-k.startFraction);g<k.startFraction-V||g>k.startFraction+O+V||O<b&&(b=O,x={kind:"stratum",id:k.id,x:i,y:s})}if(x)return x}return null}const Xm=64,Qx=8,Px=8,Km=16,Qm=.45;function Zx(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 Pm=.32;function Wx(n){const i=_0(n),s=n.depth>0?.62:1;return i===void 0?Pm*s:Math.min(1,(Pm+.68*i)*s)}function Jx(n,i){const s=Math.max(1,(n.endedAt??i)-n.startedAt),l=(un(n)??0)/(s/6e4);return Math.min(1,.25+l/24)}function Zm(n){return(n.status==="failed"?3:n.status==="waiting"?2:n.status==="running"?1:0)*1e15+n.lastActivityAt}function e1(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 t1(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=_0(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 Wm(n){let i=1;for(const s of n)i*=1-Math.min(1,Math.max(0,s));return 1-i}function Jm(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 n1(n){const i=n.now,s=Yx(n.machines.values()).slice(0,Qx),l=new Map,u=[];let f=1;const d=new Map;for(const M of n.executions.values()){const E=(d.get(M.machineId)??0)+1;d.set(M.machineId,E),E>f&&(f=E)}s.forEach((M,E)=>{const B=qx(E);l.set(M.id,B),u.push({id:M.id,name:M.name,kind:M.kind,x:B.x,y:B.y,extentX:B.extentX,extentY:B.extentY,prominence:(d.get(M.id)??0)/f,seed:Zl(M.id,7)})});const h=45e3,m=[];for(const M of n.executions.values())(M.status==="completed"||M.status==="failed")&&i-(M.endedAt??i)>h||M.status==="idle"&&i-M.lastActivityAt>h*4||l.has(M.machineId)&&m.push(M);m.length>Xm&&(m.sort((M,E)=>Zm(E)-Zm(M)),m.length=Xm);const g=e1(n),x=M=>{const E=l.get(M.machineId),{x:B,y:W}=Hm(E,M.id);return{id:M.id,massId:M.machineId,sessionId:M.sessionId,x:B,y:W,extent:Wx(M),energy:Zx(M,i),rate:Jx(M,i),phase:Zl(M.id,3)*Math.PI*2,status:M.status,label:M.label,statusSince:M.waitingSince??M.endedAt??M.startedAt,articulation:t1(M,g),shoulder:0,observers:1}},b=new Set(m.map(M=>M.id)),D=new Set,V=[],k=M=>[M.startedAt,M.endedAt??i];for(const M of[...m].sort((E,B)=>E.id<B.id?-1:1)){if(D.has(M.id))continue;const E=[M];D.add(M.id);for(let he=0;he<E.length;he++)for(const re of g.sameExecution.get(E[he].id)??[])!b.has(re)||D.has(re)||(D.add(re),E.push(n.executions.get(re)));if(E.length===1){V.push(x(M));continue}const B=E.map(x),W=B.reduce((he,re)=>re.articulation>he.articulation||re.articulation===he.articulation&&re.id<he.id?re:he);let te=1;const[le,$e]=k(n.executions.get(W.id));for(const he of E){const[re,R]=k(he);te=Math.min(te,Jm(le,$e,re,R))}V.push({...W,extent:Math.max(...B.map(he=>he.extent)),energy:Math.max(...B.map(he=>he.energy)),articulation:Wm(B.map(he=>he.articulation)),shoulder:Math.min(Qm,1-te),observers:E.length})}const O=new Map;for(const M of V){if(g.runObservesSession.has(M.id))continue;const E=O.get(M.sessionId);E?E.push(M):O.set(M.sessionId,[M])}const L=new Map,K=[];for(const M of V){const E=g.runObservesSession.get(M.id),B=E?O.get(E):void 0;if(!E||!B||B.length===0){if(K.push(M),E){const R=O.get(M.sessionId);R?R.push(M):O.set(M.sessionId,[M])}continue}const W=n.executions.get(M.id);let te=1/0,le=-1/0;for(const R of B){const[q,ae]=k(n.executions.get(R.id));te=Math.min(te,q),le=Math.max(le,ae)}const[$e,he]=k(W),re=L.get(E)??{articulations:[],coincidence:1};re.articulations.push(M.articulation),re.coincidence=Math.min(re.coincidence,Jm($e,he,te,le)),L.set(E,re)}const G=[];for(const M of[...O.keys()].sort()){const E=O.get(M),B=n.sessions.get(M);if(!B||E.length===0)continue;let W=0,te=0;for(const R of E)W+=R.x,te+=R.y;W/=E.length,te/=E.length;let le=0,$e=0;for(const R of E){const q=V0(R.extent);le=Math.max(le,Math.abs(R.x-W)+q*1.5),$e=Math.max($e,Math.abs(R.y-te)+q)}const he=L.get(M),re=Math.max(...E.map(R=>R.articulation));G.push({id:M,massId:E[0].massId,x:W,y:te,extentX:Math.max(le,52),extentY:Math.max($e,36),presence:1,articulation:he?Wm([re,...he.articulations]):re,parentId:B.parentId,empty:!1,shoulder:he?Math.min(Qm,1-he.coincidence):0,observers:1+(he?.articulations.length??0),label:B.label??B.executor??M})}for(const M of[...n.sessions.values()].sort((E,B)=>E.id<B.id?-1:1)){if(M.executionIds.length>0||M.endedAt!==void 0&&i-M.endedAt>h)continue;const E=l.get(M.machineId);if(!E)continue;const{x:B,y:W}=Hm(E,`session-presence:${M.id}`);G.push({id:M.id,massId:M.machineId,x:B,y:W,extentX:64,extentY:42,presence:1,articulation:g.sessionsWithProcess.has(M.id)?.5:.25,parentId:M.parentId,empty:!0,shoulder:0,observers:1,label:M.label??M.executor??M.id})}if(G.length>Km){const M=E=>E.empty?0:O.get(E.id)?.length??0;G.sort((E,B)=>M(B)-M(E)||(E.id<B.id?-1:1)),G.length=Km}const I=[];for(const M of n.transfers.values())if(M.endedAt===void 0&&!(!l.has(M.fromMachineId)||!l.has(M.toMachineId))){if(I.length>=Px)break;I.push({id:M.id,fromMassId:M.fromMachineId,toMassId:M.toMachineId,energy:1,label:M.label})}const H=new Map;s.forEach((M,E)=>H.set(M.id,E));const Z=Math.max(1,n.dayEnd-n.dayStart),de=[];for(const M of n.executions.values()){const E=H.get(M.machineId);if(E===void 0)continue;const B=(M.startedAt-n.dayStart)/Z,W=((M.endedAt??i)-n.dayStart)/Z;de.push({id:M.id,massId:M.machineId,lane:E,startFraction:Math.max(0,Math.min(1,B)),endFraction:Math.max(0,Math.min(1,W)),status:M.status,label:M.label})}return{time:i,masses:u,disturbances:K,plinths:G,couplings:I,strata:de}}const Fl="synthetic";let i1=0;const Nt=(n,i,s,l)=>({id:`syn:${(i1++).toString(36)}`,source:{id:Fl,instance:"replay"},occurredAt:n,observedAt:n,clock:"wall",kind:i,subject:s,core:l,basis:"measured",stratum:"stored-semantics"});function a1(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,s1=60*Xa,eg=["~/atlas","~/harbour-cli","~/ledger","~/studio-site"],tg=[{id:"macbook",name:"MACBOOK",kind:"laptop",firstSeenAt:0},{id:"mini",name:"MINI-PC",kind:"desktop",firstSeenAt:0}];function ng(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 r1(n={}){const i=n.seed??57,s=n.dayStart??Date.parse("2026-08-29T07:00:00Z"),l=n.duration??15*s1,u=n.runCount??24,f=n.failureRate??.09,d=n.waitRate??.2,h=s+l,m=a1(i),g=[];for(const V of tg)g.push(Nt(s,"began",{type:"machine",id:V.id},{machineName:V.name,machineKind:V.kind}));const x=Math.max(1,Math.round(u/4));let b=0,D=0;for(let V=0;V<x;V++){const k=s+V/x*l+m()*20*Xa,O=2+Math.floor(m()*4);for(let L=0;L<O;L++){const K=tg[m()<.66?0:1],G=eg[Math.floor(m()*eg.length)],I=`syn-session-${b++}`,H=k+L*(2+m()*9)*Xa;if(H>h)continue;const Z=m()<.7?"deepseek-v4-flash":"deepseek-v4";g.push({...Nt(H,"began",{type:"session",id:I},{machineId:K.id,executor:Fl,model:Z}),attrs:{context:G}});const de=`syn-proc-${D++}`,M=G.split("/").pop().toUpperCase();g.push(Nt(H,"began",{type:"execution",id:de},{machineId:K.id,sessionId:I,label:M,executor:Fl,model:Z,depth:0}));const E=m()<.35,B=(E?25+m()*95:2+m()*14)*Xa,W=Math.max(1,Math.ceil(B/(N0*.6))),te=E?4:1;let le=H;const $e=B/W;for(let re=0;re<W&&(le+=$e,!(le>h));re++)g.push(Nt(le,"progressed",{type:"execution",id:de},{measures:{...ng(te,m),[Xe.interactions]:Math.floor(m()*4),[Xe.errors]:m()<.06?1:0,[Xe.steps]:1}}));if(m()<d){const re=H+B*(.35+m()*.3),R=re+(1+m()*18)*Xa;re<h&&(g.push(Nt(re,"blocked",{type:"execution",id:de},{blockedOn:"approval"})),R<h&&g.push(Nt(R,"resumed",{type:"execution",id:de})))}if(E&&m()<.5){const re=`syn-proc-${D++}`,R=H+B*.25,q=R+B*.4;R<h&&g.push(Nt(R,"began",{type:"execution",id:re},{machineId:K.id,sessionId:I,label:`${M} · SUB`,executor:Fl,model:Z,parentId:de,depth:1}),Nt((R+q)/2,"progressed",{type:"execution",id:re},{measures:{...ng(1,m),[Xe.interactions]:3,[Xe.steps]:4}}),Nt(Math.min(h,q),"ended",{type:"execution",id:re},{outcome:"completed"}))}const he=Math.min(h,H+B);if(m()<f?g.push(Nt(he,"ended",{type:"execution",id:de},{outcome:"error",failureCode:"TRANSPORT",failureMessage:"Provider request failed"})):g.push(Nt(he,"ended",{type:"execution",id:de},{outcome:"completed"})),g.push(Nt(he,"ended",{type:"session",id:I})),K.id==="mini"&&m()<.3){const re=he+3e4,R=re+(1+m()*4)*Xa;if(R<h){const q=`syn-xfer-${D}`;g.push({...Nt(re,"began",{type:"artifact",id:q},{label:"ARTIFACT SYNC",machineId:"mini"}),attrs:{"syn.transfer":!0,"syn.from":"mini","syn.to":"macbook","syn.bytes":Math.round(2e8+m()*3e9)}},{...Nt(R,"ended",{type:"artifact",id:q}),attrs:{"syn.transfer":!0}})}}}}return g.sort((V,k)=>V.occurredAt-k.occurredAt),{events:g,dayStart:s,dayEnd:h}}class l1{constructor(i={},s=180){this.timeScale=s;const l=r1(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 ig(n){const i=Vl(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),U0(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 u1(){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 o1(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 c1=4e3,f1=3;class d1{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??c1}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(ig(this.initial.world))});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(ig(d.world))}catch(u){this.failures++,this.failures>=f1&&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 hf=class extends Error{code;severity;fix;where;cause;detail;constructor(i){super(i.message,{cause:i.cause}),this.name="VGPUError",this.code=i.code,this.severity=i.severity??"error",this.fix=i.fix,this.where=i.where,this.cause=i.cause,this.detail=i.detail}};class cn extends hf{constructor(i){super({...i,severity:"error"}),this.name="ValidationError"}}function h1(n){return new hf({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 p1(n,i){if(!n)return;const s=(i??[]).filter(l=>!n.has(l));if(s.length)throw h1(s)}const m1={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 dr(n){const i=globalThis.GPUBufferUsage;return n.reduce((s,l)=>s|g1(l,i),0)}function g1(n,i){const s=n.toUpperCase();return i?.[s]??m1[n]}function ag(){return globalThis.GPUMapMode?.READ??1}const y1={copy_src:1,copy_dst:2,texture_binding:4,storage_binding:8,render_attachment:16};function v1(n){const i=globalThis.GPUTextureUsage;return n.reduce((s,l)=>s|b1(l,i),0)}function b1(n,i){const s=n.toUpperCase();return i?.[s]??y1[n]}function I0(n){return"__vgpuMockBytes"in n}function sg(n){return"__vgpuMockBytes"in n}let x1=1;function ru(n){return Object.freeze({kind:n,id:x1++})}class lu{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 lu;identity=ru("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 cn({code:"VGPU-BUFFER-DISPOSED",message:"Buffer is destroyed.",where:i,fix:"Wrap or create a live GPUBuffer before using it."});this.device.assertUsable(i)}write(i,s=0){this.#e("Buffer.write"),this.ownership==="external"&&this.validateExternalOperation("write",s,i.byteLength,"copy_dst");try{this.device.queue.writeBuffer(this.gpu,s,i)}catch(l){throw this.ownership!=="external"?l:Ul("Buffer.write","The external GPUBuffer rejected the write operation.",l)}}async read(i,s=0){this.#e("Buffer.read"),this.ownership==="external"&&this.validateExternalOperation("read",s,i,"copy_src");try{const l=await this.device.readback.read(this.gpu,i,s);return this.#e("Buffer.read"),l}catch(l){throw l instanceof cn||this.ownership!=="external"?l:Ul("Buffer.read","The external GPUBuffer rejected the read operation.",l)}}destroy(){this.destroyed||(this.destroyed=!0,this.destroySignal.emit(this),this.ownership==="owned"&&!I0(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 Ul(`Buffer.${i}`,"External buffer offsets and lengths must be non-negative, 4-byte aligned, and within the buffer size.");if((this.gpu.usage&dr([u]))===0)throw Ul(`Buffer.${i}`,`External buffer is missing ${u.toUpperCase()} usage.`)}}function Ul(n,i,s){return new cn({code:"VGPU-EXTERNAL-BUFFER-VALIDATION",message:i,where:n,cause:s,fix:"Use a buffer with the required usage flags and an aligned in-range operation."})}function S1(n){if(A1(n))throw T1();const i={version:1,mappings:[]},s={version:1,modules:[{path:"<runtime>",text:n}],diagnostics:[],sourceMap:i,cacheKey:w1(n)};return{kind:"wgsl",wgsl:n,source:{text:n,path:"<runtime>",imports:[]},ast:s,sourceMap:i,diagnostics:[],cacheKey:s.cacheKey,entryPoints:E1(n),stats:{lines:n.split(/\r?\n/).length,bytes:new TextEncoder().encode(n).byteLength,bindGroups:0}}}function w1(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 E1(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 A1(n){const i=n.replace(/\/\*[\s\S]*?\*\//g,"").replace(/\/\/.*$/gm,"").trimStart();return i.startsWith("import ")||i.startsWith("import{")}function T1(){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 rg=dr(["copy_dst","map_read"]);class M1{device;constructor(i){this.device=i}async read(i,s,l){if(I0(i))return i.__vgpuMockBytes.slice(l,l+s).buffer;const u=this.device.createBuffer({size:s,usage:rg});try{const f=this.device.createCommandEncoder();f.copyBufferToBuffer(i,l,u,0,s),this.device.queue.submit([f.finish()]),await u.mapAsync(ag());const d=u.getMappedRange().slice(0);return lg(u),d}finally{ug(u)}}async readTexture(i,s,l){const[u,f]=s,d=Wl(l,"Readback.readTexture"),h=d.bytesPerPixel,m=D1(u*h,256),g=m*f,x=this.device.createBuffer({size:g,usage:rg});let b;try{const D=this.device.createCommandEncoder();D.copyTextureToBuffer({texture:i},{buffer:x,bytesPerRow:m,rowsPerImage:f},{width:u,height:f}),this.device.queue.submit([D.finish()]),await x.mapAsync(ag());const V=new Uint8Array(x.getMappedRange());b=new Uint8Array(u*f*h);for(let k=0;k<f;k++){const O=k*m,L=k*u*h;b.set(V.subarray(O,O+u*h),L)}lg(x)}finally{ug(x)}return d.swizzle==="bgra-to-rgba"&&F0(b),b}destroy(){}}function lg(n){try{n.unmap()}catch{}}function ug(n){try{n.destroy()}catch{}}function D1(n,i){return Math.ceil(n/i)*i}const og={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 Wl(n,i){const s=og[n];if(s)return s;throw new cn({code:"VGPU-CORE-UNSUPPORTED-FORMAT",message:`Texture.read does not support format ${n}. Supported formats: ${Object.keys(og).join(", ")}.`,where:i})}function R1(n,i,s="Texture.readFloats"){const l=Wl(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]=C1(h.getUint16(m*2,!0)):d[m]=h.getFloat32(m*4,!0);return d}function C1(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 O1(n,i,s){const l=n.slice(0,i[0]*i[1]*s.bytesPerPixel);return s.swizzle==="bgra-to-rgba"&&F0(l),l}function F0(n){for(let i=0;i<n.length;i+=4){const s=n[i];n[i]=n[i+2],n[i+2]=s}}function z1(n){return{size:n,usage:dr(["copy_src","copy_dst"])}}class _1{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 U1{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 N1=Symbol.for("vgpu/Texture"),L1=Symbol.for("vgpu/Texture/resizeLock");class as{device;ownership;[N1]=!0;destroySignal=new lu;identity=ru("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,L1,{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 cn({code:"VGPU-CORE-EXTERNAL-TEXTURE",message:"Texture wraps an externally owned GPUTexture and cannot be resized.",where:"Texture.resize"});if(this.resizeLock)throw new cn({code:"VGPU-CORE-TEXTURE-RESIZE-LOCKED",message:this.resizeLock,where:"Texture.resize"});const s=this.options.size[2]??1,l=i[2]??s;if(this.options.size[0]===i[0]&&this.options.size[1]===i[1]&&s===l)return!1;const 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(H0(f)),this.currentOptions=f,this.defaultView=null,d.destroy(),!0}async read(){this.assertAlive("Texture.read");const i=Wl(this.options.format,"Texture.read");if(sg(this.gpu))return O1(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 Wl(this.options.format,"Texture.readFloats"),R1(await this.read(),this.options.format)}destroy(){this.destroyed||(this.destroyed=!0,this.defaultView=null,this.destroySignal.emit(this),this.ownership!=="external"&&(sg(this.gpu)||this.gpu.destroy()))}dispose(){this.destroy()}assertAlive(i="Texture"){if(this.destroyed)throw new cn({code:"VGPU-CORE-TEXTURE-DESTROYED",message:"Texture is destroyed",where:i});this.device.assertUsable?.(i)}}function H0(n){const i={label:n.label,size:{width:n.size[0],height:n.size[1],depthOrArrayLayers:n.size[2]??1},format:n.format,usage:v1(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 k1{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 _1(i.queue,h=>this.#e(h)),this.readback=new M1(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"?S1(i):i;return new U1(this.gpu.createShaderModule({code:s.wgsl}),s)}createTexture(i){return this.#e("Device.createTexture"),new as(this,this.gpu.createTexture(H0(i)),i)}createBuffer(i){this.#e("Device.createBuffer");const s=j1(i);s&&this.captureError(s);const l=s?z1(Math.max(4,i.size||4)):B1(i);return new Ri(this,this.gpu.createBuffer(l),i)}wrapBuffer(i){if(this.#e("Device.wrapBuffer"),!$1(i))throw new cn({code:"VGPU-EXTERNAL-BUFFER-INVALID",message:"Device.wrapBuffer requires a GPUBuffer with finite size and usage properties.",where:"Device.wrapBuffer",fix:"Pass a live GPUBuffer created for this GPUDevice."});const s={size:i.size,usage:I1(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]??G1(s)??null}#e(i){if(this.state==="alive")return;if(this.state==="disposed")throw new cn({code:"VGPU-DEVICE-DISPOSED",message:"The GPU device wrapper has been disposed.",where:i,fix:"Create a new Gpu instance before performing more work."});const s=this.lossInfo?.reason,l=this.lossInfo?.message;throw new cn({code:"VGPU-DEVICE-LOST",message:`The GPU device was lost${s?` (${s})`:""}${l?`: ${l}`:"."}`,where:i,cause:this.lossInfo})}destroy(){if(this.state==="disposed")return;const i=this.state==="lost";this.state="disposed",this.observeLoss=!1,this.scopes.length=0,this.readback.destroy(),this.ownership==="owned"&&!i&&this.gpu.destroy()}dispose(){this.destroy()}captureError(i){const s=this.scopes.at(-1);if(s)s.push(i);else throw i}}function j1(n){return!Number.isFinite(n.size)||n.size<=0?cg("Buffer size must be greater than zero."):n.usage.length===0?cg("Buffer usage must not be empty."):null}function cg(n){return new cn({code:"VGPU-CORE-INVALID-USAGE",message:n,where:"Device.createBuffer"})}function B1(n){return{label:n.label,size:n.size,usage:dr(n.usage)}}function G1(n){return n?new cn({code:"VGPU-CORE-VALIDATION",message:n.message,where:"GPUDevice.popErrorScope",cause:n}):null}function $1(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 V1=["map_read","map_write","copy_src","copy_dst","index","vertex","uniform","storage","indirect","query_resolve"];function I1(n){return V1.filter(i=>(n&dr([i]))!==0)}const q0=new WeakMap,F1=new WeakMap;function H1(n,i){return q0.set(n,q1(i)),n}function rr(n){return q0.get(n)}function Y0(n){return F1.get(n)}function q1(n){return{entries:n.entries.map(i=>({...i}))}}let ie=class extends hf{};function Y1(n,i,s,l,u,f){const d=i==="vertex"?"Vertex":"Fragment",h=i==="vertex"?"VERTEX":"FRAGMENT",m=`maxStorageBuffersIn${d}Stage`;return new ie({code:`VGPU-LIMIT-STORAGE-${h}`,message:`${d} entry '${s}' in '${n}' uses ${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:x,binding:b})=>({name:g,group:x,binding:b}))}})}function X1(n,i,s,l,u){return new ie({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 K1(n,i){const s=wS(n,i);return new ie({code:"VGPU-R1-BINDING-NEVER-SET",message:`Unset \`${i.name}\` @group(${i.group}) @binding(${i.binding}) in '${n}'. Fix: ${s}; or ${n}.group(${i.group}, bindGroup).`,where:`${n}.draw`})}function X0(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 ie({code:"VGPU-R1-OWNERSHIP-FLIP",message:`\`${n}\` is ${s}; ownership cannot change. ${l}`,where:"set"})}function Q1(n,i){return new ie({code:"VGPU-R4-GROUP-CLAIMED",message:`group ${i} of '${n}' is claimed; set() cannot update it.`,fix:`Call set() first, or build from ${n}.layout(${i}); pass dynamic offsets to p.draw().`,where:`${n}.set`})}function P1(n,i,s,l){return new ie({code:"VGPU-R4-GROUP-INCOMPATIBLE",message:`claimed group ${i} in '${n}' is incompatible: ${s}.`,fix:`Build from ${n}.layout(${i}, { dynamicOffsets? }) then call ${n}.group(${i}, bindGroup).`,where:`${n}.group`,cause:l})}function is(n,i,s){return new ie({code:"VGPU-R4-GROUP-VALIDATION",message:`WebGPU rejected claimed group ${i} in '${n}'.`,fix:`Build from ${n}.layout(${i}); pass offsets via p.draw(draw, { offsets: { ${i}: [...] } }).`,where:`${n}.draw`,cause:s,detail:{drawLabel:n,group:i}})}function fg(n,i){return new ie({code:"VGPU-BLEND-INVALID",message:`Invalid blend '${String(i)}' in '${n}'.`,fix:'Use "alpha", "additive", "premultiplied", or { color, alpha? } components.',where:"draw"})}function dg(n,i){return new ie({code:"VGPU-BLEND-CONSTANT-INVALID",message:`Invalid blendConstant in '${n}': ${i}`,fix:'Use [r, g, b, a] finite numbers with a blend whose color or alpha uses "constant"/"one-minus-constant"; omit it to keep the pass default (0, 0, 0, 0).',where:"draw"})}function hg(n,i){return new ie({code:"VGPU-WRITEMASK-INVALID",message:`Invalid writeMask ${i} in '${n}'.`,fix:"Use an array of r/g/b/a; omit it for all channels.",where:"draw"})}function Qc(n,i,s="draw"){return new ie({code:"VGPU-COLORS-INVALID",message:`Invalid colors in '${n}': ${i}`,fix:"Use one { blend?, writeMask? } or null entry per color attachment of the target, aligned by index; omit colors to apply the top-level blend/writeMask to every attachment.",where:s})}function Z1(n,i){return new ie({code:"VGPU-CULL-INVALID",message:`Invalid cull '${String(i)}' in '${n}'.`,fix:'Use "none", "front", or "back"; omit it for no culling.',where:"draw"})}function W1(n,i){return new ie({code:"VGPU-FRONTFACE-INVALID",message:`Invalid frontFace '${String(i)}' in '${n}'.`,fix:'Use "ccw" or "cw"; omit it for counter-clockwise.',where:"draw"})}function pg(n,i){return new ie({code:"VGPU-UNCLIPPED-DEPTH-INVALID",message:`Invalid unclippedDepth in '${n}': ${i}`,fix:'Use a boolean. unclippedDepth: true needs the "depth-clip-control" device feature — request it with init({ requiredFeatures: ["depth-clip-control"] }) on an adapter that supports it. Omit the option to keep depth clipping.',where:"draw"})}function Xn(n,i){return new ie({code:"VGPU-DEPTH-INVALID",message:`Invalid depth in '${n}': ${i}`,fix:'Use false or { write?, compare?, bias?, biasSlopeScale?, biasClamp? }; omit it for { write: true, compare: "less-equal" }.',where:"draw"})}function ts(n,i,s="draw"){return new ie({code:"VGPU-STENCIL-INVALID",message:`Invalid stencil in '${n}': ${i}`,fix:`Use { front?, back?, readMask?, writeMask?, ref? } with GPUCompareFunction/GPUStencilOperation faces and u32 masks, against a target whose depth format has a stencil aspect (depth: "depth24plus-stencil8"); omit it for WebGPU's pass-through defaults.`,where:s})}function Hl(n,i,s="draw"){return new ie({code:"VGPU-MULTISAMPLE-INVALID",message:`Invalid multisample in '${n}': ${i}`,fix:"Use { alphaToCoverage?, mask? }: alphaToCoverage needs a target created with msaa: true, and mask must be an integer in [0, 0xFFFFFFFF] (bits above the target's sampleCount are ignored). Omit multisample for full-coverage defaults.",where:s})}function Nl(n,i,s="draw"){return new ie({code:"VGPU-CONSTANTS-INVALID",message:`Invalid constants in '${n}': ${i}`,fix:"Key WGSL `override` constants by name, or by the decimal string of N when the declaration has @id(N); values are finite numbers or booleans, converted to the override's WGSL type (bool/i32/u32/f32/f16). Every override without a default value must be provided. Omit constants to keep the WGSL defaults.",where:s})}function ql(n,i,s="draw"){return new ie({code:"VGPU-ENTRY-INVALID",message:`Invalid entry in '${n}': ${i}`,fix:"Name an entry point declared in the shader with the matching stage — { vertex?, fragment? } strings for draw, one @compute name string for compute. Omit entry (or a field) to use the first entry point of that stage.",where:s})}function Ka(n,i,s){return new ie({code:"VGPU-INDIRECT-INVALID",message:`Invalid indirect in '${n}': ${i}`,fix:"Pass a storage buffer created with storage(gpu, bytes, { indirect: true }) — bare, or as { buffer, offset? } with a 4-aligned byte offset — sized so the GPU-read arguments fit: 16 bytes for drawIndirect, 20 for drawIndexedIndirect, 12 for dispatchWorkgroupsIndirect. Omit indirect to use CPU-side counts.",where:s})}function J1(){return new ie({code:"VGPU-PASS-PRESERVE-MSAA",message:"clear:false cannot preserve MSAA; use a non-MSAA target.",fix:"Use non-MSAA for accumulation.",where:"Frame.pass"})}function mg(n,i="expected a number in [0, 1].",s='Use 1 (default), or 0 with depth: { compare: "greater" } for reversed-Z.'){return new ie({code:"VGPU-PASS-CLEARDEPTH-INVALID",message:`clearDepth received ${String(n)}; ${i}`,fix:s,where:"Frame.pass"})}function Kn(n){return new ie({code:"VGPU-PASS-VIEWPORT-INVALID",message:`Invalid viewport: ${n}`,fix:"Use { x?, y?, width, height, minDepth?, maxDepth? } finite numbers within device limits; omit it for the full target.",where:"Frame.pass"})}function _c(n){return new ie({code:"VGPU-PASS-SCISSOR-INVALID",message:`Invalid scissor: ${n}`,fix:"Use [x, y, width, height] non-negative integers with x + width and y + height within the target's current pixel size; omit it for the full target.",where:"Frame.pass"})}function eS(){return new ie({code:"VGPU-PASS-PRESERVE-CLEARDEPTH",message:"clear:false preserves depth; clearDepth cannot apply.",fix:"Remove clearDepth, or let the pass clear.",where:"Frame.pass"})}function gg(n){return new ie({code:"VGPU-PASS-CLEARSTENCIL-INVALID",message:`clearStencil ${n}`,fix:`Use an integer in [0, 0xFFFFFFFF] on a target whose depth format has a stencil aspect, e.g. depth: "depth24plus-stencil8"; the value is masked to the stencil aspect's bit width.`,where:"Frame.pass"})}function tS(){return new ie({code:"VGPU-PASS-PRESERVE-CLEARSTENCIL",message:"clear:false preserves stencil; clearStencil cannot apply.",fix:"Remove clearStencil, or let the pass clear.",where:"Frame.pass"})}function na(n,i,s="Frame.pass"){return new ie({code:"VGPU-PASS-DEPTH-READONLY",message:`depthReadOnly ${n}`,fix:i,where:s})}function nS(){return new ie({code:"VGPU-PASS-DEPTH-READONLY-MSAA",message:`depthReadOnly cannot read an MSAA target's depth: multisampled depth is stored with storeOp "discard", so a read-only pass tests against discarded contents.`,fix:"Use a non-MSAA target for read-only depth, or drop depthReadOnly and let the pass own its depth.",where:"Frame.pass"})}function Qa(n,i,s="timer"){return new ie({code:"VGPU-TIMER-INVALID",message:`Invalid timer use: ${n}`,fix:i,where:s})}function iS(n,i){return new ie({code:"VGPU-TIMER-CAPACITY",message:`frame exceeds ${n} timed spans; a timer holds one timestamp query set and WebGPU createQuerySet requires count <= ${i} (2 queries per span).`,fix:"Time fewer passes per frame, or spread timing across frames.",where:"Frame.pass"})}function aS(n,i,s="visibility"){return new ie({code:"VGPU-VIS-INVALID",message:`Invalid visibility use: ${n}`,fix:i,where:s})}function sS(){return new ie({code:"VGPU-QUERY-NO-VISIBILITY",message:"occlusion() needs the pass to be opened with a visibility instance; the render pass has no occlusionQuerySet to write into.",fix:"Open the pass with f.pass({ target, visibility: vis }, ...) using the visibility(gpu) instance that created the query handle.",where:"FramePass.occlusion"})}function rS(){return new ie({code:"VGPU-QUERY-NESTED",message:"occlusion() cannot nest inside an active occlusion() body; WebGPU allows one active occlusion query per pass at a time.",fix:"Encode each occlusion scope sequentially: p.occlusion(a, ...); p.occlusion(b, ...).",where:"FramePass.occlusion"})}function Pc(n="Frame.pass"){return new ie({code:"VGPU-TARGET-REQUIRED",message:"Target required. Fix: pass surface(gpu, canvas) or target(gpu, { size }) as { target }.",where:n})}function lS(n,i,s,l){return new ie({code:n,message:`${n}: ${s}`,fix:l,where:i})}function pf(n,i){return lS("VGPU-MESH-RANGE-INVALID",n,i,"Use index ranges for indexed geometries, vertex ranges otherwise, within geometry counts.")}function uS(n){return new ie({code:"VGPU-PIPELINE-LAYOUT-GAP",message:`Pipeline bind group ${n} is missing.`,fix:"Use consecutive @group() indices starting at 0.",where:"pipeline layout"})}function tr(n,i,s){return new ie({code:"VGPU-COMPILE-FAILED",message:"WebGPU pipeline compilation failed.",fix:"Check WGSL, vertex layouts, and target signature.",where:n,cause:i,detail:s?{signature:s}:void 0})}function yg(n){return new ie({code:"VGPU-COMPILE-DISPOSED",message:"GPU disposed during pipeline compilation.",where:n})}function Ll(n,i){return new ie({code:"VGPU-COMPILE-SIGNATURE-INVALID",message:`Invalid TargetSignature: ${i}`,fix:"Pass { colors, depth?, sampleCount?:1|4 } or a Target.",where:n})}function oS(n){return new ie({code:"VGPU-TARGET-DEPTH-STENCIL-ONLY",message:`depth received '${n}'; stencil-only depth targets are not supported yet.`,fix:'Use a format with a depth aspect such as "depth24plus" or "depth24plus-stencil8".',where:"target"})}function K0(){return new ie({code:"VGPU-TARGET-SIZE-REQUIRED",message:"Target size required. Fix: target(gpu, { size: [w,h] }); update surface-derived targets in onResize.",where:"target"})}function Q0(n){return new ie({code:"VGPU-SURFACE-NOT-IN-FRAME",message:"Surface targets are only available inside frame(gpu).",fix:"surface passes must run inside frame(gpu, ...); precompile against an offscreen target(gpu, ...) instead",where:n})}function cS(){return new ie({code:"VGPU-SURFACE-CONTEXT",message:"Canvas WebGPU context failed. Fix: check navigator.gpu and remove any existing 2d/webgl context.",where:"surface"})}function fS(n){return new ie({code:"VGPU-SURFACE-DUPLICATE",message:`Canvas already has surface${n?` '${n}'`:""}. Fix: reuse or dispose it.`,where:"surface"})}function dS(n){return new ie({code:"VGPU-SURFACE-DISPOSED",message:`Surface '${n??"surface"}' is disposed. Fix: call surface(gpu, canvas).`,where:"surface"})}function hS(){return new ie({code:"VGPU-SURFACE-AUTORESIZE-UNSUPPORTED",message:"autoResize needs clientWidth. Fix: call surface.resize([w,h]) for OffscreenCanvas; onResize still fires.",where:"surface"})}function pS(n){return new ie({code:"VGPU-SURFACE-RESIZE-REENTRANT",message:`Cannot resize this surface${n?` '${n}'`:""} in onResize. Fix: resize derived targets only.`,where:"surface.resize"})}function mS(n){return new ie({code:"VGPU-CLEAR-COLOR-INVALID",message:`Invalid ${n}: expected four finite numbers.`,fix:"Assign [r, g, b, a] or a GPUColor object ({ r, g, b, a }).",where:n})}function P0(){return new ie({code:"VGPU-FRAME-REENTRANT",message:"Nested frame(gpu) is invalid. Fix: queue work for the next frame.",where:"frame"})}function gS(n,i){return new ie({code:"VGPU-QUERY-READBACK",message:`${n} dropped a query readback: ${bS(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 vg(n){return new ie({code:"VGPU-FRAME-CANCELED",message:"the frame was canceled; its command encoder was dropped and nothing more can be encoded or submitted on it.",fix:"Open a new frame(gpu) for further work; cancel() is the last operation on a frame.",where:n})}function yS(n){return new ie({code:"VGPU-FRAME-PASS-ACTIVE",message:"the frame cannot be canceled while a pass callback is active.",fix:"Return from the frame.pass(...) callback first, then call frame.cancel(); this keeps pass descriptor resources alive until the pass is closed.",where:n})}function vS(n){return new ie({code:"VGPU-FRAME-SUBMITTED",message:"the frame was already submitted; submitted GPU work cannot be canceled.",fix:"Call cancel() only on a frame you decided not to submit; the frame you did submit needs no cleanup.",where:n})}function Zn(n,i,s){return new ie({code:"VGPU-R1-BINDING-INCOMPATIBLE-RESOURCE",message:`binding \`${n.name}\` @group(${n.group}) @binding(${n.binding}) needs ${i}.`,fix:s,where:"set"})}function Yt(n,i,s){return new ie({code:"VGPU-RING1-UNSUPPORTED",message:i,fix:s,where:n})}function kl(n){return xS(n)&&n.version!==1?new ie({code:"VGPU-SHADER-SOURCE-INVALID",message:`VGPU-SHADER-SOURCE-INVALID: unsupported ShaderSource v${String(n.version)}; expected v1. Fix: update vgpu or regenerate it.`,where:"shader source"}):new ie({code:"VGPU-SHADER-SOURCE-INVALID",message:`VGPU-SHADER-SOURCE-INVALID: expected WGSL or { version, wgsl }, got ${SS(n)}. Fix: configure @vgpu/wgsl loader-vite or loader-webpack.`,where:"shader source"})}function bS(n){return n instanceof Error?`${n.name}: ${n.message}`:String(n)}function xS(n){return typeof n=="object"&&n!==null&&"version"in n}function SS(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 wS(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 bg=["scheduler","resource","service"];function uu(n){return{name:n}}const Z0=new WeakMap;function ES(n){const i=Z0.get(n);if(!i)throw new ie({code:"VGPU-GPU-FOREIGN",message:"This object was not created by init(); it has no vgpu kernel.",fix:"Pass the gpu returned by init() from vgpu, vgpu/node or vgpu/mock.",where:"gpu"});return i}class AS{device;#e=new Map;#t=new Map(bg.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 bg){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 TS(n){const i=new AS(n),s={device:n,gpu:n.gpu,get disposed(){return i.disposed},onError:l=>i.addErrorListener(l),settled:()=>i.settled(),dispose:()=>{i.dispose()}};return Z0.set(s,i),s}async function MS(n,i={},s){return TS(await DS(n,i,s))}async function DS(n,i,s){return i.adapter||s?(i.adapter??s()).requestDevice(i):RS(i)}async function RS(n){const s=await globalThis.navigator.gpu?.requestAdapter({powerPreference:n.powerPreference});if(!s)throw Yt("init","navigator.gpu.requestAdapter() returned null.");p1(s.features,n.requiredFeatures);const l=await s.requestDevice({requiredFeatures:n.requiredFeatures,requiredLimits:n.requiredLimits});return new k1(l,s.info??null)}function ht(n,i){n.assertUsable(i)}function xg(n,i){n.assertUsable(i)}const W0=Symbol("vgpu.bindingResource");function CS(n){return typeof(typeof n=="object"&&n!==null?n[W0]:void 0)=="function"?n:void 0}const Zc=Symbol("vgpu.geometry.layoutResolver");function Wn(n,i){const s=ES(n);if(s.disposed)throw OS(i);return s}function OS(n){return new ie({code:"VGPU-GPU-DISPOSED",message:`${n}() ran after gpu.dispose(); the device and everything it owned are gone.`,fix:"Create resources before disposing the gpu, or init() a new one.",where:n})}function zS(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 J0(n,i,s,l){const u=n.own("resource",()=>s(i));return l?.(u),i}class ey 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 _S(n,i,s={}){const l=new ey(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 ey(n,i,s,l)}const US=new Set(["fn","struct","const","alias","var","override"]);function NS(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(ty(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[b,D]=LS(n,u);i.push(b),u=D;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?kS(n,h.text==="export"?u+1:u+3):u,x=n[g];if(x&&US.has(x.text)){const b=jS(n,g);s.push({name:b,localName:b,kind:x.text}),m&&l.push({name:b,localName:b,kind:x.text}),f=!0}u++}return{imports:i,exports:l,locals:s}}function LS(n,i){let s=i+1;const l=[];if(n[s]?.text==="{"){for(s++;n[s]&&n[s].text!=="}";){if(ty(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 kS(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 jS(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 ty(n){return n.kind==="lineComment"||n.kind==="blockComment"}function BS(n,i){return i==="uniform"||i==="storage"?"buffer":n.kind==="sampler"?"sampler":n.kind==="texture"?n.textureKind==="texture_external"?"externalTexture":"texture":"unknown"}function GS(n,i,s,l,u){if(n==="buffer")return $S(i,s,u);if(l.kind==="sampler")return VS(l);if(l.kind==="texture")return l.textureKind==="texture_external"?{kind:"externalTexture",externalTexture:{}}:l.textureKind.startsWith("texture_storage_")?IS(l):FS(l)}function $S(n,i,s){return{kind:"buffer",buffer:{type:n==="uniform"?"uniform":i==="read"?"read-only-storage":"storage",hasDynamicOffset:!1,minBindingSize:s?.size}}}function VS(n){return{kind:"sampler",sampler:{type:n.comparison?"comparison":"filtering"}}}function IS(n){return{kind:"storageTexture",storageTexture:{access:qS(n.access),format:n.texelFormat??"rgba8unorm",viewDimension:ny(n.dimension)}}}function FS(n){return{kind:"texture",texture:{sampleType:HS(n),viewDimension:ny(n.dimension),multisampled:n.dimension==="multisampled_2d"||n.dimension==="depth_multisampled_2d"}}}function HS(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 ny(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 qS(n){return n==="read"?"read-only":n==="read_write"?"read-write":"write-only"}const ln=(1n<<64n)-1n,ta=11400714785074694791n,ir=14029467366897019727n,Sg=1609587929392839161n,iy=9650029242287828579n,wg=2870177450012600261n;function YS(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=Di(f,1n)+Di(d,7n)+Di(h,12n)+Di(m,18n),u=jl(u,f),u=jl(u,d),u=jl(u,h),u=jl(u,m)}else u=i+wg;for(u=u+BigInt(s.length)&ln;l+8<=s.length;)u^=Pa(0n,nr(s,l)),u=Di(u,27n)*ta+iy&ln,l+=8;for(l+4<=s.length&&(u^=XS(s,l)*ta&ln,u=Di(u,23n)*ir+Sg&ln,l+=4);l<s.length;)u^=BigInt(s[l])*wg&ln,u=Di(u,11n)*ta&ln,l++;return u^=u>>33n,u=u*ir&ln,u^=u>>29n,u=u*Sg&ln,u^=u>>32n,u.toString(16).padStart(16,"0")}function Pa(n,i){return Di(n+i*ir&ln,31n)*ta&ln}function jl(n,i){return n^=Pa(0n,i),n*ta+iy&ln}function Di(n,i){return(n<<i|n>>64n-i)&ln}function nr(n,i){let s=0n;for(let l=7;l>=0;l--)s=(s<<8n)+BigInt(n[i+l]);return s}function XS(n,i){return BigInt(n[i])|BigInt(n[i+1])<<8n|BigInt(n[i+2])<<16n|BigInt(n[i+3])<<24n}function KS(n){return YS(n)}function QS(n){return KS(n).slice(0,8)}function PS(n,i){return`_vgsl_${QS(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 mf(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(ay).filter(u=>u.length>0)}function ay(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 ZS(n){if(n!==void 0&&sy(n))return Number(n.replace(/[ui]$/,""))}function sy(n){return/^(0|[1-9][0-9]*)([ui])?$/.test(n)}function ry(n){if(n==="read"||n==="write"||n==="read_write")return n}function WS(n){return["f32","f16","i32","u32","bool"].find(i=>i===n)}function JS(n){return{kind:"scalar",name:n==="f"?"f32":n==="h"?"f16":n==="i"?"i32":"u32"}}function ly(n){return n==="f16"?2:4}function sa(n,i){return Math.ceil(i/n)*n}function En(n){const i=ay(n);if(i.length===0)throw et("VGPU-WGSL-REFLECT-TYPE","Expected WGSL type");const s=i.map(f=>f.text).join(""),l=ew(s);if(l)return l;if(i[1]?.text==="<"){const f=i[0].text,d=mf(i.slice(2,-1)),h=tw(f,d);if(h)return h}const u=nw(s);return u||iw(s)}function ew(n){const i=WS(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:JS(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 tw(n,i){if(n==="array"){const s=i[1]?.map(u=>u.text).join(""),l=s===void 0?void 0:ZS(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:ry(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 nw(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 iw(n){return{kind:"identifier",name:n}}function Oi(n){if(n?.kind!=="ident"&&n?.kind!=="keyword")throw et("VGPU-WGSL-REFLECT-PARSE","Expected identifier",n?.line,n?.column);return n.text}function 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 aw(n,i,s,l){for(let u=i;u<s;u++)if(n[u].text===l)return u}function ou(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 gf(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 yf(n,i){const s=[];let l=i;for(;n[l]?.text==="@";){const u=n[l],f=Oi(n[l+1]);l+=2;let d=[];if(n[l]?.text==="("){const h=gf(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 sw(n){const i=n.find(l=>l.name==="workgroup_size");if(!i)return;const s=mf(i.args).map(l=>Number(l.map(u=>u.text).join("")));return[s[0]??1,s[1]??1,s[2]??1]}function rw(n,i){if(n[i]?.text!=="<")return{after:i};const s=ra(n,i,">"),l=mf(n.slice(i+1,s)).map(u=>u.map(f=>f.text).join(""));return{addressSpace:l[0],access:ry(l[1]),after:s+1}}function lw(n){const i=[],s=[],l=[],u=[],f=[],d=[],h=n.tokens.filter(x=>x.kind!=="lineComment"&&x.kind!=="blockComment");let m=0,g=0;for(;m<h.length;){const x=h[m];if(x.text==="{"){g++,m++;continue}if(x.text==="}"){g=Math.max(0,g-1),m++;continue}if(g>0){m++;continue}const b=m,[D,V]=yf(h,m);m=V,h[m]?.text==="export"&&m++;const k=h[m]?.text;if(k==="enable"){h[m+1]?.kind==="ident"&&d.push(h[m+1].text),m=ou(h,m,";")+1;continue}if(k==="struct"){const O=uw(n,h,m);O.item&&i.push(O.item),m=O.next;continue}if(k==="alias"){const O=ow(n,h,m);O.item&&s.push(O.item),m=O.next;continue}if(k==="var"){const O=cw(n,h,m,D);O.item&&l.push(O.item),m=O.next;continue}if(k==="fn"){const O=fw(n,h,m,D);O.item&&u.push(O.item),m=O.next;continue}if(k==="override"){const O=hw(h,m,D);O.item&&f.push(O.item),m=O.next;continue}m=Math.max(b+1,m+1)}return{structs:i,aliases:s,vars:l,entries:u,overrides:f,features:d}}function uw(n,i,s,l){const u=Oi(i[s+1]),f=ra(i,s+2,"{"),d=gf(i,f);return{item:{name:u,originalName:u,mangledName:vf(n,u,"struct"),members:pw(i.slice(f+1,d)),path:n.path},next:d+1}}function ow(n,i,s,l){const u=Oi(i[s+1]),f=ra(i,s+2,"="),d=ou(i,f+1,";");return{item:{name:u,originalName:u,mangledName:vf(n,u,"alias"),target:En(i.slice(f+1,d)),path:n.path},next:d+1}}function cw(n,i,s,l){const{addressSpace:u,access:f,after:d}=rw(i,s+1),h=Oi(i[d]),m=ra(i,d+1,":"),g=ou(i,m+1,";");return{item:{path:n.path,name:h,mangledName:mw(l)?h:vf(n,h,"var"),attrs:l,addressSpace:u,access:f,type:En(i.slice(m+1,g))},next:g+1}}function fw(n,i,s,l){const u=Oi(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=gf(i,d);return{item:{name:u,mangledName:u,stage:f,workgroupSize:sw(l),path:n.path,params:dw(i.slice(d+1,h))},next:h+1}}function dw(n){const i=[];let s=0;for(;s<n.length;){const[l,u]=yf(n,s);if(s=u,!n[s]||n[s].text===","){s++;continue}const f=Oi(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 hw(n,i,s){const l=Oi(n[i+1]),u=ou(n,i+1,";"),f=aw(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 pw(n){const i=[];let s=0;for(;s<n.length;){const[l,u]=yf(n,s);if(s=u,!n[s]||n[s].text===","||n[s].text===";"){s++;continue}const f=Oi(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 vf(n,i,s){return s==="override"?i:PS(n.path,i)}function mw(n){return Xt(n,"group")!==void 0||Xt(n,"binding")!==void 0}const gw="literal length required for auto layout; use draw.group(n, bg) manual binding",yw="VGPUError: `bool` is not host-shareable in uniform/storage. Fix: use `u32` (0 | 1) → struct Params { enabled: u32 }",uy="use a manual group claim (`draw.group(n, bg)`)";function vw(n=1,i=1){return et("VGPU-WGSL-REFLECT-ARRAY-LENGTH",gw,n,i)}function oy(n=1,i=1){return et("VGPU-WGSL-REFLECT-BOOL-HOST-SHAREABLE",yw,n,i)}function Jl(n,i,s=1,l=1){return et("VGPU-WGSL-REFLECT-UNKNOWN-TYPE",`type '${n}' is unknown in ${i}; ${uy}`,s,l)}function Eg(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 cy(n,i=1,s=1){return et("VGPU-WGSL-REFLECT-NON-HOST-SHAREABLE",`Type ${n} is not host-shareable; ${uy}`,i,s)}const ss="naga-standard";function bw(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)xw(d,m,h,n,u);f.set(d.path,h)}return f}function xw(n,i,s,l,u,f){const d=ww(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 Sw(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 Eg(n.name)}const f=s.get(i)?.get(n.name);if(f?.kind==="namespace")throw Eg(n.name);if(!f)throw Jl(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 ww(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:Ew(`${d}${f}`);return[f,h].find(g=>s.some(x=>x.path===g))??u??h}function Ew(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 hr(n,i,s=ns(n),l=s,u){const f=u?Wc(n,u):n;return Aw(f,i,s,l,u)}function Aw(n,i,s,l,u){switch(n.kind){case"scalar":return Tw(n,i,s,l);case"atomic":return Mw(n,i,s,l);case"vector":return Dw(n,i,s,l,u);case"matrix":return Rw(n,i,s,l,u);case"array":return Cw(n,i,s,l,u);case"identifier":return zw(n,i,s,l,u);default:throw cy(ns(n))}}function Tw(n,i,s,l){const u=ly(n.name);if(n.name==="bool")throw oy();return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:u,size:u}}function Mw(n,i,s,l){return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:4,size:4}}function Dw(n,i,s,l,u){const d=hr(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 Rw(n,i,s,l,u){const f={kind:"vector",width:n.rows,element:n.element},d=hr(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 Cw(n,i,s,l,u){Ow(n.countExpression);const f=hr(n.element,i,`${s}[]`,`${l}[]`,u),d=sa(or(n.element,i,u),f.size??0);return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:or(n,i,u),size:n.count===void 0?void 0:d*n.count,stride:d,element:f,runtimeSized:n.count===void 0}}function Ow(n){if(n!==void 0&&!sy(n))throw vw()}function zw(n,i,s,l,u){if(!u)throw Jl(n.name,"<unknown>");const f=u.structs.get(n.mangledName??n.name);if(!f)throw Jl(n.name,"<unknown>");const d=[];let h=0,m=1;for(const x of f.members){const b=_w(x,i,h,u);d.push(b.member),h=Uw(i,x.type,b.offset,b.member.size??0,u),m=Math.max(m,b.member.align)}const g=Lw(i,m);return{name:s,mangledName:l,addressSpace:i,layoutMode:ss,type:n,align:g,size:sa(g,h),members:d}}function _w(n,i,s,l){const u=hr(n.type,i,n.name,n.name,l),f=Math.max(or(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 Uw(n,i,s,l,u){return s+(n==="uniform"&&Nw(i,u)?sa(16,l):l)}function Nw(n,i){const s=rs(n,i);return s.kind==="identifier"&&i.structs.has(s.mangledName??s.name)}function Lw(n,i){return n==="uniform"?sa(16,i):i}function or(n,i,s){const l=s?rs(n,s):n,u=Yl(l,i,s);return i==="uniform"&&kw(l,s)?sa(16,u):u}function kw(n,i){return n.kind==="array"||n.kind==="identifier"&&!!i?.structs.get(n.mangledName??n.name)}function Yl(n,i,s){const l=s?rs(n,s):n;switch(l.kind){case"scalar":return jw(l.name);case"atomic":return 4;case"vector":return l.width===2?Yl(l.element,i,s)*2:Yl(l.element,i,s)*4;case"matrix":return Yl({kind:"vector",width:l.rows,element:l.element},i,s);case"array":return or(l.element,i,s);case"identifier":return Bw(l,i,s);default:throw cy(ns(l))}}function jw(n){if(n==="bool")throw oy();return ly(n)}function Bw(n,i,s){const l=s?.structs.get(n.mangledName??n.name);if(!l)throw Jl(n.name,"<unknown>");return Math.max(1,...l.members.map(u=>Math.max(or(u.type,i,s),u.align??1)))}const Gw=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"]),$w=new Set(["import","export","from","as"]),fy=new Set([...Gw,...$w]),Vw=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"]),Iw=new Set(["binding_array"]),Fw=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"]),Hw=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"]),qw=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"]),Yw=new Set(["align","binding","blend_src","builtin","compute","diagnostic","fragment","group","id","interpolate","invariant","location","must_use","size","vertex","workgroup_size"]),Xw=new Set(["function","private","storage","uniform","workgroup"]),Kw=new Set(["read","read_write","write"]),Qw=new Set(["bgra8unorm","r32float","r32sint","r32uint","rg32float","rg32sint","rg32uint","rgba16float","rgba16sint","rgba16uint","rgba32float","rgba32sint","rgba32uint","rgba8sint","rgba8snorm","rgba8uint","rgba8unorm"]);[...fy,...Vw,...Iw,...Fw,...Hw,...qw,...Yw,...Xw,...Kw,...Qw];const Pw="VGPU-WGSL-IDENT-NONASCII",Zw="https://github.com/vercel-labs/vgpu/issues/294";function Ww(n,i){const s=[];let l=0,u=1,f=1;const d=(m,g,x,b,D)=>s.push({kind:m,text:n.slice(g,x),start:g,end:x,line:b,column:D}),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,x=u,b=f;if(m==="/"&&n[l+1]==="/"){for(;l<n.length&&n[l]!==`
|
|
11
|
-
`;)h();d("lineComment",g,l,x,b);continue}if(m==="/"&&n[l+1]==="*"){let D=0;for(;l<n.length;){if(n[l]==="/"&&n[l+1]==="*"){D++,h(),h();continue}if(n[l]==="*"&&n[l+1]==="/"){if(D--,h(),h(),D===0){d("blockComment",g,l,x,b);break}continue}h()}if(D!==0)throw et("VGPU-WGSL-LEX-UNTERM-COMMENT","Unterminated block comment",x,b);continue}if(m==='"'||m==="'"){const D=m;for(h();l<n.length&&n[l]!==D;){if(n[l]===`
|
|
12
|
-
`)throw et("VGPU-WGSL-LEX-UNTERM-STRING","Unterminated string",x,b);n[l]==="\\"&&h(),h()}if(l>=n.length)throw et("VGPU-WGSL-LEX-UNTERM-STRING","Unterminated string",x,b);h(),d("string",g,l,x,b);continue}if(/[A-Za-z_]/.test(m)){for(;l<n.length&&/[A-Za-z0-9_]/.test(n[l]);)h();const D=n.slice(g,l);d(fy.has(D)?"keyword":"ident",g,l,x,b);continue}if(/[0-9]/.test(m)||m==="."&&/[0-9]/.test(n[l+1]??"")){for(m==="."&&h();l<n.length;){const D=n[l];if(/[A-Za-z0-9_.]/.test(D)){h();continue}if((D==="+"||D==="-")&&e2(n[l-1])&&/[0-9]/.test(n[l+1]??"")){h();continue}break}d("number",g,l,x,b);continue}if(m.charCodeAt(0)>127)throw Jw(n,l,u,f,i);h(),d("punct",g,l,x,b)}return s}function Jw(n,i,s,l,u){let f=i;for(;f>0&&Ag(n[f-1]);)f--;let d=i+1;for(;d<n.length&&Ag(n[d]);)d++;const h=n.slice(f,d),m=l-(i-f),g=u===void 0?"":` in ${u}`,x=_S(Pw,`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 ${Zw}`,line:s,column:m});return x.range={file:u,start:{line:s,column:m}},x}function Ag(n){return n.charCodeAt(0)>127||/[A-Za-z0-9_]/.test(n)}function e2(n){return n==="e"||n==="E"||n==="p"||n==="P"}const t2=/^_vgsl_[0-9a-f]{8,16}__[A-Za-z_][A-Za-z0-9_]*$/,n2=new Set(["fn","struct","const","alias","var","override"]);function dy(n){return new i2(n).analyze()}class i2{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"&&!n2.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=t2.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 x=this.nextSig(h);x!==void 0&&this.tokens[x]?.kind==="ident"&&this.preserveToken(x,"member");continue}if(m.text==="enable"||m.text==="requires"||m.text==="diagnostic"){h=this.preserveStatement(h,"directive");continue}if(m.text==="for"){const x=u("for-init",h),b=this.nextSig(h);(b===void 0||this.tokens[b]?.text!=="(")&&this.functionFallback(i,"for without parenthesized header",h),l.push({scopeId:x,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 x=a2(l,b=>b.awaitingBody&&b.bodyDepth===void 0);x&&(x.bodyDepth=d),u("block",h);continue}if(m.text==="}"){const x=d;for(f(h),d--;l.length>0&&l[l.length-1].bodyDepth===x;)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 x=this.resolve(m.text,s);x!==void 0?this.references.push({name:m.text,tokenIndex:h,declarationId:x,scopeId:s[s.length-1],functionId:i.id}):this.preserveToken(h,"unknown")}}for(;s.length>2;)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 a2(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 s2=new Set(["textureSample","textureSampleBias","textureSampleLevel","textureSampleGrad","textureGather","textureSampleBaseClampToEdge"]),r2=new Set(["textureSampleCompare","textureSampleCompareLevel","textureGatherCompare"]);function l2(n,i,s){const l=new Map;for(let u=0;u<n.length;u++){const f=n[u],d=i[u],h=dy(f.tokens),m=new Map;for(const x of d.vars){const b=Xt(x.attrs,"group"),D=Xt(x.attrs,"binding"),V=h.declarations.find(k=>k.kind==="global"&&k.name===x.name);b!==void 0&&D!==void 0&&V&&m.set(V.id,{group:b,binding:D})}const g=new Map;for(const x of h.declarations){if(x.kind!=="function")continue;const b=h.functions.find(D=>D.nameTokenIndex===x.tokenIndex);b&&g.set(x.id,b.id)}for(const x of d.entries){const b=h.functions.find(O=>O.name===x.name),D=[];let V=h.fallback.wholeModule||!b;!V&&b&&(V=!hy(b.id,new Map,new Set,h,m,g,D));const k=b?d2(b.id,h,m,g):s.map(Jc);l.set(x,V?h2(s,k):p2(D))}}return l}function hy(n,i,s,l,u,f,d){const h=l.functions[n];if(!h||h.skipped)return!1;const m=`${n}|${[...i].map(([b,D])=>`${b}:${D.group}:${D.binding}`).join(",")}`;if(s.has(m))return!0;s.add(m);const g=l.references.filter(b=>b.functionId===n),x=new Map(g.map(b=>[b.tokenIndex,b]));for(let b=h.bodyStartToken+1;b<h.bodyEndToken;b++){const D=l.tokens[b]?.text,V=s2.has(D??"")?"filtering":r2.has(D??"")?"comparison":void 0,k=x.get(b),O=k&&f.get(k.declarationId);if(!V&&O===void 0)continue;const L=f2(l,b);if(L===void 0||l.tokens[L]?.text!=="(")continue;const K=c2(l,L);if(!K)return!1;const G=K.map(([I,H])=>u2(I,H,l,u,i));if(V){const I=D==="textureGather"&&!o2(K[0],l,u,i)?1:0,H=G[I],Z=G[I+1];if(!H||!Z)return!1;d.push({texture:H,sampler:Z,mode:V})}else{const I=l.declarations.filter(Z=>Z.kind==="param"&&Z.functionId===O).sort((Z,de)=>Z.tokenIndex-de.tokenIndex),H=new Map;for(let Z=0;Z<I.length;Z++)G[Z]&&H.set(I[Z].id,G[Z]);if(!hy(O,H,s,l,u,f,d))return!1}}return!0}function u2(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 o2(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 c2(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 f2(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 d2(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 x=l.get(m.declarationId);x!==void 0&&u.push(x)}}}return[...d.values()]}function h2(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 p2(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 m2(n,i){const s=n.map(lw),l=bw(n,s),u=Sw(s,l),f=[],d=[];for(const g of s)for(const x of g.vars){const b=Xt(x.attrs,"group"),D=Xt(x.attrs,"binding");if(b===void 0||D===void 0)continue;const V=aa(x.type,x.path,l),k=BS(V,x.addressSpace),O=x.addressSpace==="uniform"||x.addressSpace==="storage"?hr(V,x.addressSpace,x.name,x.mangledName,u):void 0;O&&d.push(O),f.push({group:b,binding:D,name:x.name,mangledName:x.mangledName,type:V,kind:k,addressSpace:x.addressSpace,access:x.access,struct:V.kind==="identifier"?u.structs.get(V.mangledName??V.name):void 0,layout:O,bindingLayout:GS(k,x.addressSpace,x.access,V,O)})}f.sort((g,x)=>g.group-x.group||g.binding-x.binding);const h=g2(n,s,f),m=l2(n,s,f);return{bindings:f,entryPoints:s.flatMap(g=>g.entries.map(x=>y2(x,s.flatMap(b=>b.structs),l,u,h.get(x)??f,m.get(x)??[]))),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 g2(n,i,s){const l=new Map;for(let u=0;u<n.length;u++){const f=n[u],d=i[u],h=dy(f.tokens),m=h.fallback.wholeModule,g=new Map;for(const b of h.declarations){if(b.kind!=="function")continue;const D=h.functions.find(V=>V.nameTokenIndex===b.tokenIndex);D&&g.set(b.id,D.id)}const x=new Map;for(const b of d.vars){const D=Xt(b.attrs,"group"),V=Xt(b.attrs,"binding");if(D===void 0||V===void 0)continue;const k=h.declarations.find(O=>O.kind==="global"&&O.name===b.name);k&&x.set(k.id,{group:D,binding:V})}for(const b of d.entries){const D=h.functions.find(L=>L.name===b.name);if(m||!D){l.set(b,s);continue}const V=[D.id],k=new Set,O=new Map;for(;V.length;){const L=V.pop();if(!k.has(L)&&(k.add(L),!!h.functions[L]))for(const K of h.references){if(K.functionId!==L)continue;const G=x.get(K.declarationId);G&&O.set(`${G.group}:${G.binding}`,G);const I=g.get(K.declarationId);I!==void 0&&V.push(I)}}l.set(b,[...O.values()].sort((L,K)=>L.group-K.group||L.binding-K.binding))}}return l}function y2(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:v2(n,i,s,l)}:{}}}function v2(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(b=>b.mangledName===(m.mangledName??m.name)),x=l.structs.get(m.mangledName??m.name);if(g)for(let b=0;b<g.members.length;b++){const D=g.members[b];if(Tg(D.attrs,"builtin"))continue;const V=Xt(D.attrs,"location");V!==void 0&&u.push({name:D.name,location:V,type:x?.members[b]?.type??aa(D.type,g.path,s)})}}return u}function Tg(n,i){return n.some(s=>s.name===i)}function py(n,i="<runtime>"){const s=Ww(n,i),l=NS(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 m2([{path:i,source:n,tokens:s,parsed:l}])}function my(){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 eu(n,i,s){const l=n[i];if(!l)throw new ie({code:"VGPU-REFLECT-ENTRY-METADATA-MISSING",message:`Entry point '${n.name}' has no reflected ${i}.`,fix:"Pass the reflection from reflectSource()/resolveShader().",where:s});return l}const tu=new WeakMap;function lr(n,i){if(!n.gpu.pushErrorScope||!n.gpu.popErrorScope)return;n.gpu.pushErrorScope("validation");const s=tu.get(n.gpu);s?s.push(i):tu.set(n.gpu,[i])}function on(n){const i=tu.get(n.gpu);if(!i?.length||!n.gpu.popErrorScope)return;const s=i.pop();return i.length||tu.delete(n.gpu),{context:s,error:n.gpu.popErrorScope()}}function gy(n){const i=[];let s=on(n);for(;s;)i.push(s),s=on(n);return i}function b2(n){const i=on(n);i&&xf(i)}function yy(n){for(const i of gy(n))xf(i)}function Ht(n){for(const i of n)xf(i)}function bf(n){return n.gpu.queue.onSubmittedWorkDone?.()??Promise.resolve()}function vy(n,i=[],s={}){return S2(n,i,s.errorSink??w2)}function nu(n,i){return{context:n.context,error:x2(n.error,i.error)}}async function x2(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 S2(n,i,s){await bf(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 xf(n){n.error.catch(()=>{})}function w2(n){console.error(n)}function by(n,i,s,l){try{i.end()}catch(u){const f=gy(n);Ht(s),Ht(f),s.length=0;const d=f[0]?.context??l;throw d?is(d.label,d.group,u):u}}let E2=1;const Mg=new WeakMap;function A2(n){return n===null||typeof n!="object"||ArrayBuffer.isView(n)||n instanceof ArrayBuffer||Array.isArray(n)?!0:n instanceof Ri||n instanceof as?!1:!Sy(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:!Sy(n)}function Dg(n,i,s){switch(n.bindingLayout?.kind){case"buffer":return T2(n,i,s);case"texture":return M2(n,i,s);case"sampler":return D2(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 T2(n,i,s){const l=CS(i);if(l)return l[W0](n,s.sourceHint);if(i instanceof Ri)return xg(i,`${s.sourceHint}.set`),C2(n,i.options.usage),{resource:{buffer:i.gpu},identity:i.resourceIdentity,unsubscribe:u=>i.onDestroy(u)};if(z2(i))return xg(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(Ey(i))return{resource:i,identity:cr(i.buffer)};if(Sf(i))return{resource:{buffer:i},identity:cr(i)};throw Zn(n,"buffer",`Pass a compatible Buffer/Uniform: ${n.name}.set({ ${n.name}: gpu.device.createBuffer(...) }).`)}function M2(n,i,s){const l=xy(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 O2(n,i.usage),Rg(n,i,s),{resource:i.createView(),identity:i.resourceIdentity,unsubscribe:u=>i.onDestroy(u)};if(wy(i))return{resource:i.createView(),identity:i.resourceIdentity??cr(i)};if(typeof i=="object"&&i!==null)return{resource:i,identity:cr(i)};throw Zn(n,"texture/target",`Pass a Texture or Target: ${n.name}.set({ ${n.name}: scene.color }) or set({ ${n.name}: scene }).`)}function D2(n,i){if(R2(i))return{resource:i,identity:cr(i)};throw Zn(n,"sampler",`Use the cached sampler: set({ ${n.name}: sampler(gpu) }).`)}function R2(n){return typeof n!="object"||n===null||n instanceof Ri||n instanceof as?!1:!Sf(n)&&!Ey(n)&&!wy(n)&&!xy(n)}function C2(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 O2(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 X1(s.sourceHint,n,i.format,i.label??"texture",s.pairedSampler)}function xy(n){if(typeof n!="object"||n===null)return;const i=n;if(!(!i.resourceIdentity||!i.color||typeof i.onDestroy!="function"))return i}function Sy(n){const i=n;return"gpu"in i||"bindGroup"in i||"createView"in i||"resourceIdentity"in i}function cr(n){if(typeof n!="object"||n===null)return`value:${String(n)}`;let i=Mg.get(n);return i||(i={kind:"external",id:E2++},Mg.set(n,i)),i}function z2(n){return typeof n=="object"&&n!==null&&"gpu"in n&&"size"in n&&"buffer"in n&&n.buffer instanceof Ri}function wy(n){return typeof n=="object"&&n!==null&&typeof n.createView=="function"}function Ey(n){return typeof n=="object"&&n!==null&&"buffer"in n&&Sf(n.buffer)}function Sf(n){return typeof n=="object"&&n!==null&&"size"in n&&"usage"in n&&typeof n.destroy=="function"}function _2(n,i){U2(n);const s=new ArrayBuffer(n.size);return wf(new DataView(s),n,0,i),s}function U2(n){if(n.size===void 0)throw Yt("set",`No se puede inferir byteLength para layout runtime-sized '${n.name}'.`)}function wf(n,i,s,l){if(i.members)return N2(n,i.members,s,l);L2(n,i,s,l)}function N2(n,i,s,l){const u=l;for(const f of i)wf(n,f.layout,s+f.offset,u?.[f.name])}function L2(n,i,s,l){switch(i.type.kind){case"scalar":return Ef(n,s,i.type.name,l);case"vector":return k2(n,s,i.type,l);case"matrix":return j2(n,i,s,l);case"array":return B2(n,i,s,l);default:throw Yt("set",`No hay writer para layout ${i.type.kind}.`)}}function Ef(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,G2(Number(l??0)),!0)}function k2(n,i,s,l){const u=l,f=Ay(s.element);for(let d=0;d<s.width;d++)Ef(n,i+d*f,Af(s.element),u?.[d]??0)}function j2(n,i,s,l){const u=i.type,f=l,d=Ay(u.element),h=i.stride??16;for(let m=0;m<u.columns;m++)for(let g=0;g<u.rows;g++)Ef(n,s+m*h+g*d,Af(u.element),f?.[m*u.rows+g]??0)}function B2(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++)wf(n,i.element,s+d*f,u[d])}function Ay(n){return Af(n)==="f16"?2:4}function Af(n){if(n.kind!=="scalar")throw Yt("set",`Expected scalar, got ${n.kind}`);return n.name}function G2(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 Cg=new WeakMap;function $2(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 eu(f,"bindings","visibility")){const m=`${h.group}:${h.binding}`;s.set(m,(s.get(m)??0)|d)}for(const h of eu(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 Ty(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,...F2(l,s.filterable?.has(`${l.group}:${l.binding}`)??!1)}]})}function V2(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,I2(n,i,s,h,l));return u}function I2(n,i,s,l,u=Tf){return My(n,`${i}.group${l}.bgl`,Ty(s.bindings,l,u))}function My(n,i,s){let l=Cg.get(n.gpu);l||(l=new Map,Cg.set(n.gpu,l));const u=JSON.stringify(s),f=l.get(u);if(f)return f;const d=H1(n.gpu.createBindGroupLayout({label:i,entries:s}),{entries:s});return l.set(u,d),d}function F2(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"}}:H2(s)}function H2(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 q2(n){const i=Y2(n.reflection),s=[...n.bindGroupLayouts.keys()].sort((E,B)=>E-B),l=new Map;function u(E){const B=[];for(const[W,te]of Object.entries(E))B.push(...d(W,te));return B}function f(E){const B=n.bindGroupLayouts.get(E.info.group);return!!B&&!!rr(B)?.entries.some(W=>W.binding===E.info.binding)}function d(E,B){const W=i.get(E);if(W)return h(W,E,B);const te=X2(E,i,n.label);if(!te)throw Yt(`${n.label}.set`,`Binding '${E}' does not exist in '${n.label}'.`);return m(te,E,B)}function h(E,B,W){Z(E.info.group);const te=Og(E.info,W);zg(E,B,te);const le=Xl(E.identity);return te==="lib"?g(E,Z2(E.libValue,W)):b(E,W),f(E)?Lc(E,le):[]}function m(E,B,W){Z(E.info.group);const te=Og(E.info,W);if(zg(E,B,te),K2(E,B,te),te!=="lib")throw Yt(`${n.label}.set`,`Member '${B}' needs a JS value; set resource '${E.info.name}' instead.`);const le=Xl(E.identity);return g(E,{...W2(E.libValue),[B]:W}),f(E)?Lc(E,le):[]}function g(E,B){const W=M(E);E.libValue=B;const te=_2(W,B);E.buffer||de(E,W.size),E.bytes=te,E.buffer.write(te,0)}function x(E){const B=rr(n.bindGroupLayouts.get(E.group))?.entries.find(le=>le.binding===E.binding),W=n.reflection.entryPoints.flatMap(le=>eu(le,"samplingPairs",n.label)).find(le=>le.mode==="filtering"&&le.texture.group===E.group&&le.texture.binding===E.binding),te=W&&n.reflection.bindings.find(le=>le.group===W.sampler.group&&le.binding===W.sampler.binding);return{sourceHint:n.label,filterableTexture:B?.texture?.sampleType==="float",float32Filterable:n.device.features.has("float32-filterable"),pairedSampler:te}}function b(E,B){const W=Dg(E.info,B,x(E.info));E.unsubscribe?.(),E.unsubscribeRecreate?.(),E.resource=W.resource,E.identity=W.identity,E.unsubscribe=W.unsubscribe?.(()=>{E.identity&&n.cache.evictIdentity(E.identity)}),E.unsubscribeRecreate=W.onRecreate?.(()=>D(E,B))}function D(E,B){const W=Xl(E.identity);E.identity&&n.cache.evictIdentity(E.identity);const te=Dg(E.info,B,x(E.info));if(E.unsubscribe?.(),E.unsubscribeRecreate?.(),E.resource=te.resource,E.identity=te.identity,E.unsubscribe=te.unsubscribe?.(()=>{E.identity&&n.cache.evictIdentity(E.identity)}),E.unsubscribeRecreate=te.onRecreate?.(()=>D(E,B)),f(E))for(const le of Lc(E,W))n.onIdentityChange?.(le)}function V(E,B,W){k(E),Q2(n.label,E,B,W);const te=l.has(E)?`claimed-group:${E}`:void 0;return l.set(E,B),te}function k(E){const B=n.bindGroupLayouts.get(E);if(!B)throw Yt(`${n.label}.layout`,`@group(${E}) does not exist in '${n.label}'.`);return B}function O(){return s.map(L)}function L(E){const B=l.get(E);if(B)return{group:E,bindGroup:B,offsets:[],claimValidation:K(B,E)};const W=new Set(rr(k(E))?.entries.map(re=>re.binding)),te=n.reflection.bindings.filter(re=>re.group===E&&W.has(re.binding)),le=G(te),$e=I(te),he=n.cache.getOrCreate(n.drawId,E,$e,()=>n.device.gpu.createBindGroup({label:`${n.label}.group${E}`,layout:k(E),entries:le}));return{group:E,bindGroup:he,offsets:[]}}function K(E,B){return Y0(E)?void 0:{label:n.label,group:B}}function G(E){return E.map(B=>{const W=H(B);return{binding:B.binding,resource:W.resource}})}function I(E){return E.map(B=>H(B).identity)}function H(E){const B=i.get(E.name);if(!B?.resource||!B.identity)throw K1(n.label,E);return B}function Z(E){if(l.has(E))throw Q1(n.label,E)}function de(E,B){E.buffer=n.device.createBuffer({size:B,usage:["uniform","copy_dst"],label:`${n.label}.${E.info.name}`}),E.resource={buffer:E.buffer.gpu,offset:0,size:B},E.identity=E.buffer.resourceIdentity,E.unsubscribe=E.buffer.onDestroy(()=>n.cache.evictIdentity(E.buffer.resourceIdentity))}function M(E){if(E.info.kind!=="buffer"||!E.info.layout?.size)throw Yt(`${n.label}.set`,`Binding '${E.info.name}' needs a compatible resource, not JS.`);return E.info.layout}return{get groups(){return s},set:u,claimGroup:V,layout:k,bindGroups:O,bindingState(E){const B=i.get(E);if(!(!B?.ownership||!B.resource||!B.identity))return{info:B.info,ownership:B.ownership,resource:B.resource,identity:B.identity}}}}function Y2(n){return new Map(n.bindings.map(i=>[i.name,{info:i,memberOwnership:new Map}]))}function X2(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 Og(n,i){return n.bindingLayout?.kind==="buffer"&&A2(i)?"lib":"user"}function zg(n,i,s){if(n.ownership&&n.ownership!==s)throw X0(i,n.ownership);n.ownership??=s}function K2(n,i,s){const l=n.memberOwnership.get(i);if(l&&l!==s)throw X0(i,l);n.memberOwnership.set(i,s)}function Q2(n,i,s,l){const u=Y0(s);if(!u)return;const f=rr(l);if(!f)return;const d=P2(f.entries,u.layout.entries);if(d)throw P1(n,i,d)}function P2(n,i){if(n.length!==i.length)return`expected ${n.length} bindings and received ${i.length}`;const s=_g(n),l=_g(i);for(const[u,f]of s){const d=l.get(u);if(!d)return`missing @binding(${u})`;if(Ug(f)!==Ug(d))return`@binding(${u}) does not match the reflected layout`}}function _g(n){return new Map(n.map(i=>[i.binding,i]))}function Ug(n){return JSON.stringify({binding:n.binding,visibility:n.visibility,buffer:n.buffer,sampler:n.sampler,texture:n.texture,storageTexture:n.storageTexture,externalTexture:n.externalTexture?{}:void 0})}function Lc(n,i){const s=Xl(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 Xl(n){return n===void 0?void 0:ef(n)}function Z2(n,i){return tf(n)&&tf(i)?{...n,...i}:i}function W2(n){return tf(n)?n:{}}const J2="rgba8unorm",Mf=Object.freeze([0,0,0,1]);function iu(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 mS(i);return Df(n)}function Df(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 Kl(n){return n.colors??[{format:n.format??J2}]}function Dy(n){return n.depth===!0?"depth24plus":n.depth||void 0}function Ry(n){const i=n.msaa;if(i===!0||i===4)return 4;if(i===void 0||i===!1)return 1;const s=K0();throw s.code="VGPU-TARGET-MSAA-INVALID",s.message=`msaa received ${i}; WebGPU 1|4; use true`,s}function eE(n,i){if(!n?.size)throw K0();const s=Dy(n);if(s==="stencil8")throw oS(s);if(Ry(n)===4)for(const l of Kl(n))tE(l.format,i)}function tE(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 nE(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=Cy(s)),u}function iE(n,i,s,l,u){if(u){const d={view:n.createView(),depthReadOnly:!0};return fr(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&&fr(n.format)&&(f.stencilLoadOp=i?"load":"clear",f.stencilStoreOp=n.sampleCount>1?"discard":"store",i||(f.stencilClearValue=l??0)),f}function fr(n){return!!n&&n.includes("stencil")}function Cy(n){return Array.isArray(n)?{r:n[0],g:n[1],b:n[2],a:n[3]}:n}function Oy(n,i){return n[0]===i[0]&&n[1]===i[1]}function cu(n){return typeof n=="object"&&n!==null&&typeof n.renderPassDescriptor=="function"}let aE=1,sE=1;const rE=new WeakMap,lE=new WeakMap;function uE(n){return cu(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 zy(n){return`${n.colors.join(",")}:${n.depth??"none"}:${n.sampleCount??1}`}function oE(n,i){if(!Array.isArray(n.colors)||n.colors.length===0)throw Ll(i,"colors must be a non-empty array.");const s=n.colors.find(u=>typeof u!="string"||u.length===0);if(s!==void 0)throw Ll(i,`colors must contain only GPUTextureFormat strings; received ${String(s)}.`);if(n.depth!==void 0&&(typeof n.depth!="string"||n.depth.length===0))throw Ll(i,"depth must be a GPUTextureFormat string.");const l=n.sampleCount??1;if(l!==1&&l!==4)throw Ll(i,`sampleCount must be 1 or 4; received ${String(l)}.`)}function cE(n){const i=`${jg(rE,n.module,()=>aE++)}|${jg(lE,n.pipelineLayout,()=>sE++)}|${gE(n.vertexBufferLayouts??[])}|${zy(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 Ng(n,i,s,l,u){if(l===void 0)return i.find(d=>d.stage===s);if(typeof l!="string")throw ql(n,`${s} received ${nf(l)}; expected an entry point name string.`,u);const f=i.find(d=>d.name===l);if(!f)throw ql(n,`"${l}" matches no entry point in the shader; available entry points: ${Lg(i)}.`,u);if(f.stage!==s)throw ql(n,`"${l}" is a @${f.stage} entry point, not @${s}; available entry points: ${Lg(i)}.`,u);return f}function Lg(n){return n.length?n.map(i=>`"${i.name}" (@${i.stage})`).join(", "):"none"}function fE(n,i,s,l){if(i!==void 0&&(typeof i!="object"||i===null||Array.isArray(i)))throw Nl(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 Nl(n,`"${d}" matches no override in the shader; available overrides: ${dE(s)}.`,l);if(typeof h=="boolean"){f[d]=h?1:0;continue}if(typeof h!="number"||!Number.isFinite(h))throw Nl(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 Nl(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:hE(f)}}function kg(n){return n.id!==void 0?String(n.id):n.name}function dE(n){return n.length?n.map(i=>i.id!==void 0?`"${i.id}" (@id of ${i.name})`:`"${i.name}"`).join(", "):"none"}function hE(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 _y(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 Uy(n){const i=new Map;return{get(s){const l=yE(s);let u=i.get(l);return u||(u=n.gpu.createPipelineLayout({bindGroupLayouts:vE(s)}),i.set(l,u)),u},dispose(){i.clear()}}}function Ny(n,i={}){return new pE(n,i)}class pE{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=mE();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=yg("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 yg(i)}#o(i){this.#t.add(i),i.catch(()=>{}).then(()=>this.#t.delete(i),()=>this.#t.delete(i))}}function mE(){let n,i;const s=new Promise((l,u)=>{n=l,i=u});return s.catch(()=>{}),{promise:s,resolve:n,reject:i}}function jg(n,i,s){let l=n.get(i);return l||(l=s(),n.set(i,l)),l}function gE(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 yE(n){return JSON.stringify([...n.entries()].map(([i,s])=>({group:i,entries:xE(s)})))}function vE(n){const i=Math.max(-1,...n.keys()),s=[];for(let l=0;l<=i;l++)s.push(bE(n,l));return s}function bE(n,i){const s=n.get(i);if(!s)throw uS(i);return s}function xE(n){return(rr(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 SE=uu("frame-state");function Ly(n){return n.service(SE,wE)}function wE(){const n=new Set;let i=Bg(),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 P0();s=!0;try{const f=Bg();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 Bg(){return globalThis.performance?.now?.()??Date.now()}function EE(n,i,s={}){const l=Wn(n,"surface"),u=TE(l),f=u.get(i);if(f&&!f.disposed)throw fS(f.label);const d=new jy(l.device,i,s,g=>{u.get(g.canvas)===g&&u.delete(g.canvas),h(),m()}),h=Ly(l).onAdvance(()=>d.applyAutoResize()),m=l.own("resource",()=>d.dispose());return u.set(i,d),d}const AE=uu("surfaces");function TE(n){return n.service(AE,()=>new Map)}let ar=0,Rf=0;function ME(){return ar>0}function DE(){return Rf>0}function RE(){Rf+=1}function CE(){Rf-=1}function ky(n){return n instanceof jy}class jy{device;canvas;options;unregister;resourceIdentity=ru("render-target");label;context;autoResize;layoutBacked;format;#e=new lu;#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?Mf:iu(l.clearColor,"surface.clearColor");const f=s.getContext("webgpu");if(!f)throw cS();if(this.context=f,this.layoutBacked=OE(s),l.autoResize===!0&&!this.layoutBacked)throw hS();this.autoResize=l.autoResize??(l.size?!1:this.layoutBacked),this.#i=$g(l.dpr),this.format=l.format??_E();const d=zE(s,l,this.layoutBacked,this.#i);(l.size||this.layoutBacked)&&Gg(s,d),f.configure({device:i.gpu,format:this.format,alphaMode:l.alphaMode??"premultiplied",colorSpace:l.colorSpace??"srgb",usage:UE()})}get gpu(){return this.context}get size(){return this.#r(),Ql(this.canvas)}get texelSize(){const i=this.size;return[1/i[0],1/i[1]]}get color(){return this.#r(),new 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 Df(this.#a)}set clearColor(i){this.#a=iu(i,"surface.clearColor")}get disposed(){return this.#s}resize(i){if(this.#r(),this.#l)throw pS(this.options.label);this.#c(au(i),this.#i,!0)}applyAutoResize(){if(this.#s||!this.autoResize||!this.layoutBacked)return;const i=$g(this.options.dpr),s=By(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=Cy(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=!Oy(Ql(this.canvas),i);this.#i=s,u&&(Gg(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=Ql(this.canvas);return{width:i[0],height:i[1],dpr:this.#i,surface:this}}#r(){if(this.#s)throw dS(this.options.label)}}function OE(n){return typeof n.clientWidth=="number"}function zE(n,i,s,l){return i.size?au(i.size):s?By(n,l):au(Ql(n))}function By(n,i){const s=n;return au([Math.round(s.clientWidth*i),Math.round(s.clientHeight*i)])}function Ql(n){const i=n;return[i.width,i.height]}function Gg(n,i){const s=n;s.width=i[0],s.height=i[1]}function au(n){return[Math.max(1,Math.floor(n[0])),Math.max(1,Math.floor(n[1]))]}function $g(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 _E(){return globalThis.navigator?.gpu?.getPreferredCanvasFormat?.()??"bgra8unorm"}function UE(){const n=globalThis.GPUTextureUsage;return n?n.RENDER_ATTACHMENT|n.TEXTURE_BINDING|n.COPY_SRC:void 0}const NE={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 LE(n,i,s,l){const u=typeof s=="object"&&s!==null?s.buffer:void 0,f=Vg(s)?s:Vg(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}=NE[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 Vg(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 su=Symbol("vgpu.frame.drawable");function kE(n){return n?.[su]}const jE=Symbol("vgpu.frame.bundle");function BE(n){return n?.[jE]}const Cf=Symbol("vgpu.frame.passAttachment");function GE(n){return typeof n?.[Cf]=="function"?n:void 0}function $E(n,i){return Of(Wn(n,"sampler")).sampler(i)}let Fg=1;function VE(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:Fg++})),f},identity(l){let u=s.get(l);return u||(u={kind:"sampler",id:Fg++},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 IE=uu("render-service");function Of(n){return n.service(IE,FE)}function FE(n){const i=n.device,s=my(),l=Ny(i,{errorSink:h=>n.reportError(h),registerSettledSource:h=>n.registerSettledSource(h)}),u=_y(i),f=Uy(i),d=VE(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 Gy(n){if(typeof n=="string")return n;if(!HE(n)||!("version"in n)||n.version!==1)throw kl(n);const s=n.wgsl;if(typeof s!="string")throw kl(n);return s}function HE(n){return typeof n=="object"&&n!==null}function Bl(n,i){const s=Wn(n,"draw"),l=Of(s),u=Gy(i.shader);return new Vy(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 qE=1;const $y=new WeakMap;class Vy{source;label;#e=new Map;constructor(i,s,l,u=my(),f,d=Ny(i),h=_y(i),m=Uy(i),g,x){this.source=s,ht(i,"Draw.constructor"),this.label=l.label??"draw";const b=qE++,D=py(s,`${this.label}.wgsl`),V=eA(this.label,l.entry),k=Ng(this.label,D.entryPoints,"vertex",V.vertex,"draw"),O=Ng(this.label,D.entryPoints,"fragment",V.fragment,"draw"),L=tA(D,k,O),K=[k,O].filter(ae=>!!ae),G=$2(D.bindings,K);YE(i,this.label,D.bindings,K,G);const I=l.geometry,H=k?eu(k,"inputs",this.label):[],Z=I&&Zc in I?I[Zc](H,`${this.label}.geometry`):I?.vertexBufferLayouts,de=new Map(V2(i,this.label,D,G)),M=m.get(de),E=h.get(s,`${this.label}.shader`),B=vA(),W=QE(this.label,l),te=ZE(this.label,l,W),le=nA(i,this.label,l),$e=rA(i,this.label,l),he=cA(this.label,l),re=dA(this.label,l),R=fE(this.label,l.constants,D.overrides,"draw"),q=q2({device:i,label:this.label,drawId:b,reflection:D,bindGroupLayouts:de,cache:u,onIdentityChange:ae=>B.markStale({kind:"binding-identity",drawLabel:this.label,...ae})});$y.set(this,{id:b,device:i,opts:l,vertexBufferLayouts:Z,cache:u,defaultTarget:f,reflection:D,visibility:G,vertexEntry:k?.name??"vs_main",fragmentEntry:O?.name??"fs_main",entryKey:L,setCore:q,bindGroupLayouts:de,pipelineLayout:M,shaderModule:E,pipelineStore:d,pipelineLayouts:m,errorSink:g,trackSettled:x,resolvedPipelineKeys:new Set,recordedIn:B,...W,...te,...le,...$e,...he,...re,...R}),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[su](){return this}writesDepth(){return mA(this)}stencilWritingOps(){return gA(this)}set(i){const s=we(this);ht(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);ht(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 ht(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=xA(this,i),f=My(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={}){ht(we(this).device,`${this.label}.draw`);const s=cu(i)?{target:i}:i,l=we(this),u=s.target??l.defaultTarget;if(!u)throw Pc(`${this.label}.draw`);i0(u,`${this.label}.draw`);const f=l.device.gpu.createCommandEncoder(),d=f.beginRenderPass(u.renderPassDescriptor()),h=[];try{this.encode(d,u,s,b=>h.push(b))}catch(b){Ht(h),yy(l.device);try{d.end()}catch{}throw b}by(l.device,d,h,h[0]?.context);let m;const g=h[0]?.context;g&&lr(l.device,g);try{m=f.finish()}catch(b){const D=g?on(l.device):void 0;Ht(h),D&&Ht([D]);const V=D?.context??g;if(V){n0(l,V.label,V.group,b);return}throw b}if(g){const b=on(l.device);b&&(h[0]=h[0]?nu(b,h[0]):b)}const x=h[0]?.context;x&&lr(l.device,x);try{l.device.gpu.queue.submit([m])}catch(b){const D=x?on(l.device):void 0;Ht(h),D&&Ht([D]);const V=D?.context??x;if(V){n0(l,V.label,V.group,b);return}throw b}if(x){const b=on(l.device);b&&(h[0]=h[0]?nu(b,h[0]):b)}if(h.length){const b=vy(l.device,h,{errorSink:l.errorSink});l.trackSettled?.(b)}}encode(i,s,l={},u){ht(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=bA(l.offsets,s.group,s.offsets);if(!s.claimValidation||!u){i.setBindGroup(s.group,s.bindGroup,f);return}lr(we(this).device,s.claimValidation);try{i.setBindGroup(s.group,s.bindGroup,f)}catch(h){throw b2(we(this).device),is(s.claimValidation.label,s.claimValidation.group,h)}const d=on(we(this).device);d&&u(d)}compile(i){ht(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(()=>(ht(we(this).device,`${this.label}.compile`),we(this).resolvedPipelineKeys.add(s),this))}compileSync(i){ht(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){ht(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){ht(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=>(ht(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=zy(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||i0(f,s);const d=uE(f);if(oE(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 Hl(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)&&!fr(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 cE({module:s.shaderModule,pipelineLayout:s.pipelineLayout,vertexBufferLayouts:s.vertexBufferLayouts,signature:i,fragmentKey:s.fragmentKey,topology:l?.topology,stripIndexFormat:Iy(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=KE(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=XE.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}=LE(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:Hg(i,s),...s.constants?{constants:s.constants}:{}},primitive:qg(s.opts.geometry,s.cullMode,s.frontFace,s.unclippedDepth),depthStencil:Zg(i,s),multisample:e0(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:Hg(i,s),...s.constants?{constants:s.constants}:{}},primitive:qg(s.opts.geometry,s.cullMode,s.frontFace,s.unclippedDepth),depthStencil:Zg(i,s),multisample:e0(i,s)})}}function YE(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(D=>D.stage===d);if(!g)continue;const x=s.filter(D=>D.bindingLayout?.kind==="buffer"&&D.bindingLayout.buffer.type!=="uniform"&&u(D)&h),b=f[m]??f.maxStorageBuffersPerShaderStage;if(b!==void 0&&x.length>b)throw Y1(i,d,g.name,x.length,b,x)}}const XE=["vertices","indices","instances","firstVertex","firstIndex","baseVertex","firstInstance"];function Hg(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 KE(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),Ai(n,"DrawCallOptions.vertices",l.vertices),Ai(n,"DrawCallOptions.indices",l.indices),Ai(n,"DrawCallOptions.firstVertex",l.firstVertex),Ai(n,"DrawCallOptions.firstIndex",l.firstIndex),Ai(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),Ai(n,"GeometryLike.firstVertex",i?.firstVertex),Ai(n,"GeometryLike.firstIndex",i?.firstIndex),Ai(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,x=l.indices??i?.indexCount??0,b=l.baseVertex??i?.baseVertex??0;if(u)Yg(n,"index",g,x,d?.indexCount);else if(l.indices!==void 0||l.firstIndex!==void 0||l.baseVertex!==void 0)throw pf(`${n}.draw`,"Index range needs an indexed geometry.");return u||Yg(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:x,firstIndex:g,baseVertex:b}}function Iy(n){const i=n?.topology??"triangle-list";return n?.stripIndexFormat??(i.endsWith("strip")?n?.indexFormat:void 0)}function qg(n,i,s,l){const u=n?.topology??"triangle-list",f=Iy(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 Yg(n,i,s,l,u){if(!(u===void 0||s+l<=u))throw pf(`${n}.draw`,`${i} range [${s}, ${s+l}) exceeds parent geometry ${i} count ${u}.`)}function Ai(n,i,s){if(!(s===void 0||Number.isInteger(s)&&s>=0))throw pf(`${n}.draw`,`${i} must be an integer >= 0; received ${String(s)}.`)}function Ti(n,i,s){if(s!==void 0&&!(Number.isInteger(s)&&s>=0))throw new ie({code:"VGPU-R1-DRAW-COUNT",message:`${i} of '${n}' must be an integer >= 0; received ${String(s)}. Use 0 only when you want to issue a valid draw with no vertices/instances.`,where:`${n}.draw`})}function QE(n,i){const s=i.blend===void 0?void 0:Fy(n,i.blend),l=i.writeMask===void 0?void 0:Yy(n,i.writeMask),u=i.colors===void 0?void 0:PE(n,i.colors),f=u?`${t0(s,l)}@${u.map(pA).join("@")}`:s||l!==void 0?t0(s,l):void 0;return{blendState:s,writeMask:l,colorStates:u,fragmentKey:f}}function PE(n,i){if(!Array.isArray(i))throw Qc(n,`colors must be an array; received ${Pe(i)}.`);return i.map((s,l)=>{if(s==null)return null;if(typeof s!="object"||Array.isArray(s))throw Qc(n,`colors[${l}] must be null or { blend?, writeMask? }; received ${Pe(s)}.`);const u=s.blend===void 0?void 0:Fy(`${n}.colors[${l}]`,s.blend),f=s.writeMask===void 0?void 0:Yy(`${n}.colors[${l}]`,s.writeMask);return!u&&f===void 0?null:{blendState:u,writeMask:f}})}function Fy(n,i){if(i==="alpha")return Gl({src:"src-alpha",dst:"one-minus-src-alpha"},{src:"one",dst:"one-minus-src-alpha"});if(i==="premultiplied")return Gl({src:"one",dst:"one-minus-src-alpha"},{src:"one",dst:"one-minus-src-alpha"});if(i==="additive")return Gl({src:"one",dst:"one"},{src:"one",dst:"one"});if(typeof i!="object"||i===null||!Xg(i.color))throw fg(n,i);const s=i.color,l=i.alpha;if(l!==void 0&&!Xg(l))throw fg(n,i);return Gl(s,l??s)}function Xg(n){return typeof n=="object"&&n!==null&&typeof n.src=="string"&&typeof n.dst=="string"}function Gl(n,i){return{color:Kg(n),alpha:Kg(i)}}function Kg(n){return{srcFactor:n.src,dstFactor:n.dst,operation:n.op??"add"}}function ZE(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 dg(n,`received ${Pe(l)}; expected [r, g, b, a] finite numbers.`);if(!WE(s).some(u=>u&&JE(u)))throw dg(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 WE(n){return n.colorStates?n.colorStates.map(i=>i?.blendState??n.blendState):[n.blendState]}function JE(n){return[n.color.srcFactor,n.color.dstFactor,n.alpha.srcFactor,n.alpha.dstFactor].some(i=>i==="constant"||i==="one-minus-constant")}function eA(n,i){if(i===void 0)return{};if(typeof i!="object"||i===null||Array.isArray(i))throw ql(n,`received ${Pe(i)}; expected { vertex?, fragment? } entry point names.`);return i}function tA(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 nA(n,i,s){const l=s.cull===void 0?void 0:aA(i,s.cull),u=s.frontFace===void 0?void 0:sA(i,s.frontFace),f=s.unclippedDepth===void 0?void 0:iA(n,i,s.unclippedDepth);return{cullMode:l,frontFace:u,unclippedDepth:f}}function iA(n,i,s){if(typeof s!="boolean")throw pg(i,`received ${Pe(s)}; expected a boolean.`);if(s){if(!n.features.has("depth-clip-control"))throw pg(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 aA(n,i){if(i==="none"||i==="front"||i==="back")return i;throw Z1(n,i)}function sA(n,i){if(i==="ccw"||i==="cw")return i;throw W1(n,i)}const Hy={depthWriteEnabled:!0,depthCompare:"less-equal"},qy=["never","less","equal","less-equal","greater","not-equal","greater-equal","always"],Qg=-2147483648,Pg=2147483647;function Zg(n,i){if(n.depth)return{format:n.depth,...i.depthState??Hy,...i.stencilState??{}}}function rA(n,i,s){if(s.depth===void 0)return{};const l=lA(n,i,s.depth,s.geometry?.topology??"triangle-list");return{depthState:l,depthKey:uA(l)}}function lA(n,i,s,l){if(s===!1)return{depthWriteEnabled:!1,depthCompare:"always"};if(typeof s!="object"||s===null)throw Xn(i,`received ${Pe(s)}.`);if(s.write!==void 0&&typeof s.write!="boolean")throw Xn(i,`write must be a boolean; received ${Pe(s.write)}.`);if(s.compare!==void 0&&!qy.includes(s.compare))throw Xn(i,`compare must be a GPUCompareFunction; received ${Pe(s.compare)}.`);if(s.bias!==void 0&&!Number.isInteger(s.bias))throw Xn(i,`bias must be an integer (WebGPU depthBias is i32); received ${Pe(s.bias)}.`);if(s.bias!==void 0&&(s.bias<Qg||s.bias>Pg))throw Xn(i,`bias must fit in the i32 range [${Qg}, ${Pg}] (WebGPU depthBias is i32); received ${Pe(s.bias)}.`);if(s.biasSlopeScale!==void 0&&!Number.isFinite(s.biasSlopeScale))throw Xn(i,`biasSlopeScale must be a finite number; received ${Pe(s.biasSlopeScale)}.`);if(s.biasClamp!==void 0&&!Number.isFinite(s.biasClamp))throw Xn(i,`biasClamp must be a finite number; received ${Pe(s.biasClamp)}.`);const 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 ${Pe(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 uA(n){return`${n.depthWriteEnabled?1:0}~${n.depthCompare}~${n.depthBias??0}~${n.depthBiasSlopeScale??0}~${n.depthBiasClamp??0}`}const oA=["keep","zero","replace","invert","increment-clamp","decrement-clamp","increment-wrap","decrement-wrap"];function cA(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 ${Pe(s)}; expected { front?, back?, readMask?, writeMask?, ref? }.`);const l=s.front===void 0?void 0:Wg(n,"front",s.front),u=s.back===void 0?void 0:Wg(n,"back",s.back);kc(n,"readMask",s.readMask),kc(n,"writeMask",s.writeMask),kc(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:fA(f)}:{},...s.ref!==void 0?{stencilRef:s.ref}:{}}}function Wg(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 ${Pe(s)}.`);if(s.compare!==void 0&&!qy.includes(s.compare))throw ts(n,`${i}.compare must be a GPUCompareFunction; received ${Pe(s.compare)}.`);for(const[l,u]of[["fail",s.fail],["depthFail",s.depthFail],["pass",s.pass]])if(u!==void 0&&!oA.includes(u))throw ts(n,`${i}.${l} must be a GPUStencilOperation; received ${Pe(u)}.`);return{compare:s.compare??"always",failOp:s.fail??"keep",depthFailOp:s.depthFail??"keep",passOp:s.pass??"keep"}}function kc(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 ${Pe(s)}.`)}function fA(n){return`st~${Jg(n.stencilFront)}~${Jg(n.stencilBack)}~${n.stencilReadMask??4294967295}~${n.stencilWriteMask??4294967295}`}function Jg(n){return n?`${n.compare},${n.failOp},${n.depthFailOp},${n.passOp}`:"default"}function e0(n,i){return{count:n.sampleCount??1,...i.multisampleState??{}}}function dA(n,i){if(i.multisample===void 0)return{};const s=i.multisample;if(typeof s!="object"||s===null||Array.isArray(s))throw Hl(n,`received ${Pe(s)}; expected { alphaToCoverage?, mask? }.`);if(s.alphaToCoverage!==void 0&&typeof s.alphaToCoverage!="boolean")throw Hl(n,`alphaToCoverage must be a boolean; received ${Pe(s.alphaToCoverage)}.`);if(s.mask!==void 0&&(typeof s.mask!="number"||!Number.isInteger(s.mask)||s.mask<0||s.mask>4294967295))throw Hl(n,`mask must be an integer in [0, 0xFFFFFFFF] (WebGPU GPUSampleMask is u32); received ${Pe(s.mask)}.`);const l={...s.alphaToCoverage!==void 0?{alphaToCoverageEnabled:s.alphaToCoverage}:{},...s.mask!==void 0?{mask:s.mask}:{}};return l.alphaToCoverageEnabled===void 0&&l.mask===void 0?{}:{multisampleState:l,multisampleKey:hA(l)}}function hA(n){return`ms~${n.alphaToCoverageEnabled?1:0}~${n.mask??4294967295}`}function Yy(n,i){if(!Array.isArray(i))throw hg(n,Pe(i));let s=0;for(const l of i)if(l==="r")s|=1;else if(l==="g")s|=2;else if(l==="b")s|=4;else if(l==="a")s|=8;else throw hg(n,Pe(l));return s}function t0(n,i){return`${Xy(n)};${i??15}`}function Xy(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 pA(n){return n?`${n.blendState?Xy(n.blendState):"inherit"};${n.writeMask??"inherit"}`:"inherit"}function Pe(n){if(typeof n=="string")return`"${n}"`;try{return JSON.stringify(n)??String(n)}catch{return String(n)}}function mA(n){return(we(n).depthState??Hy).depthWriteEnabled}function gA(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 yA(n,i,s,l={},u){n.encode(i,s,l,u)}function we(n){const i=$y.get(n);if(!i)throw new TypeError("Invalid Draw instance");return i}function n0(n,i,s,l){const u=(async()=>{await bf(n.device),ht(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 vA(){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 bA(n,i,s){return n?Array.isArray(n)?n:n[i]??s:s}function xA(n,i){const s=we(n);return Ty(s.reflection.bindings,i,s.visibility).map(SA)}function SA(n){return n.buffer?{...n,buffer:{...n.buffer,hasDynamicOffset:!0}}:n}function i0(n,i){if(ky(n)&&!DE())throw Q0(i)}function a0(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=Of(l);return new wA(l.device,Gy(i),s,u.binds,void 0,u.pipelines,u.shaderModules,u.pipelineLayouts,f=>l.reportError(f),f=>{l.trackDelivery(f)})}const Ky=new WeakMap;class wA{get gpu(){return Wi(this).gpu}constructor(i,s,l={},u,f,d,h,m,g,x){const b=EA(s),D=new Vy(i,b,{shader:b,set:l.set,label:l.label??"effect",blend:l.blend,writeMask:l.writeMask},u,f,d,h,m,g,x);Ky.set(this,D)}set(i){return Wi(this).set(i),this}draw(i={}){Wi(this).draw(cu(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){yA(Wi(this),i,s,l,u)}get[su](){return Wi(this)[su]}}function Wi(n){const i=Ky.get(n);if(!i)throw new TypeError("Invalid Effect instance");return i}function EA(n){return AA(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 AA(n){return py(n,"effect.wgsl").entryPoints.some(i=>i.stage==="vertex")}function TA(n,i){return DA(Wn(n,"frame")).frame(i)}const MA=uu("frame-runner");function DA(n){return n.service(MA,i=>{const s=Ly(i);return new BA(()=>{let l=()=>{};const u=new RA(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 RA{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,ht(i,"Frame.constructor"),this.#e=i.gpu.createCommandEncoder({label:"vgpu.frame"})}pass(i,s){if(this.#s)throw vg("Frame.pass");ht(this.device,"Frame.pass");const l=cu(i),u=typeof s=="function"?s:O=>O.draw(s),f=l?i:i.target??this.defaultTarget;if(!f)throw Pc("Frame.pass");if(ky(f)&&this.#a)throw Q0("Frame.pass");const d=l?void 0:i.clear,h=d===!1;if(h&&f.sampleCount===4)throw J1();const m=l?void 0:i.clearDepth;if(m!==void 0){if(typeof m!="number"||!(m>=0&&m<=1))throw mg(m);if(h)throw eS();if(!f.depth)throw mg(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 gg(`received ${String(g)}; expected an integer in [0, 0xFFFFFFFF] (WebGPU GPUStencilValue).`);if(h)throw tS();const O=f.depth?.format;if(!fr(O))throw gg(`received ${String(g)}, but the target's depth format ${O?`"${O}"`:"(none)"} has no stencil aspect, so clearStencil would have no effect.`)}const x=l?void 0:i.depthReadOnly;if(x!==void 0&&typeof x!="boolean")throw na(`received ${Ci(x)}; expected a boolean.`,"Pass depthReadOnly: true to open the pass with a read-only depth attachment, or omit it.");if(x){if(!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 nS();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 b=l?void 0:LA(i.viewport,this.device.gpu.limits,f.size),D=l?void 0:kA(i.scissor,f.size),V=[];let k;try{const O=l||i.timer===void 0?void 0:this.#r(i.timer,f,V,UA),K=(l||i.visibility===void 0?void 0:this.#r(i.visibility,f,V,NA))?.occlusion;let G=f.renderPassDescriptor({clear:d===void 0||d===!0||d===!1?f.clearColor??Mf:d,preserve:h,clearDepth:m,clearStencil:g,depthReadOnly:x});O?.timestampWrites&&(G={...G,timestampWrites:O.timestampWrites}),K&&(G={...G,occlusionQuerySet:K.querySet}),k=this.#e.beginRenderPass(G),b&&k.setViewport(b.x,b.y,b.width,b.height,b.minDepth,b.maxDepth),D&&k.setScissorRect(D[0],D[1],D[2],D[3]),this.#l=!0;try{u(new CA(k,f,this.#t,x===!0,K,this,I=>{if(ht(this.device,I),this.#s)throw vg(I)}))}finally{this.#l=!1}}catch(O){this.#o(V),Ht(this.#t),this.#t.length=0,yy(this.device);try{k?.end()}catch{}throw O}by(this.device,k,this.#t)}submit(){if(this.#a||this.#s)return;ht(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&&lr(this.device,s);try{i=this.#e.finish()}catch(u){this.#c(this.#u());const f=s?on(this.device):void 0;Ht(this.#t),f&&Ht([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=on(this.device);u&&(this.#t[0]=this.#t[0]?nu(u,this.#t[0]):u)}const l=this.#t[0]?.context;l&&lr(this.device,l);try{this.device.gpu.queue.submit([i])}catch(u){this.#c(this.#u());const f=l?on(this.device):void 0;Ht(this.#t),f&&Ht([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=on(this.device);u&&(this.#t[0]=this.#t[0]?nu(u,this.#t[0]):u)}for(const u of this.#f())u.frameSubmitted(this);this.#c(this.#i),this.done=this.#h(vy(this.device,this.#t,{errorSink:this.errorSink}))}cancel(){if(!this.#s){if(this.#a)throw vS("Frame.cancel");if(this.#l)throw yS("Frame.cancel");this.#s=!0,this.releaseLifecycle?.(),this.#c(this.#u()),this.#n.clear(),this.#i.clear(),Ht(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=GE(i);if(!f)throw u(i);let d;try{d=f[Cf]({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 bf(this.device),ht(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 CA{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=zA(i);this.depthReadOnly&&OA(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 sS();if(this.#e)throw rS();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=>BE(l)??_A());for(const l of s)l.assertReplayable(this.target);this.encoder.executeBundles(s.map(l=>l.gpu))}}function OA(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(fr(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 zA(n){const i=kE(n);if(!i)throw new TypeError("Invalid Effect instance: pass.draw() expects a Draw or an Effect created by this library.");return i}function _A(){throw new ie({code:"VGPU-R3-BUNDLE-INVALID",message:"p.bundles() expected bundles created by bundle(gpu, { target }, cb).",where:"FramePass.bundles"})}function UA(n){return Qa(`FramePassOptions.timer received ${Ci(n)}; expected a TimerSpan from timer.span(name).`,'Create const passTimer = timer(gpu) once, then pass passTimer.span("name") per pass.',"Frame.pass")}function NA(n){return aS(`FramePassOptions.visibility received ${Ci(n)}; expected a Visibility from visibility(gpu).`,"Create const vis = visibility(gpu) once, then pass { target, visibility: vis } per pass.","Frame.pass")}function LA(n,i,s){if(n===void 0)return;if(typeof n!="object"||n===null||Array.isArray(n))throw Kn(`received ${Ci(n)}; expected { x?, y?, width, height, minDepth?, maxDepth? }.`);const{x:l=0,y:u=0,width:f,height:d,minDepth:h=0,maxDepth:m=1}=n;for(const[D,V]of[["x",l],["y",u],["width",f],["height",d],["minDepth",h],["maxDepth",m]])if(typeof V!="number"||!Number.isFinite(V))throw Kn(`${D} received ${Ci(V)}; expected a finite number.`);const g=i.maxTextureDimension2D,x=g*2,b=`target is ${s[0]}x${s[1]}px, device maxTextureDimension2D is ${g}`;if(!(f>=0&&f<=g))throw Kn(`width ${f} is outside [0, ${g}] (${b}).`);if(!(d>=0&&d<=g))throw Kn(`height ${d} is outside [0, ${g}] (${b}).`);if(!(l>=-x&&l+f<=x-1))throw Kn(`x ${l} with width ${f} is outside [${-x}, ${x-1}] (${b}).`);if(!(u>=-x&&u+d<=x-1))throw Kn(`y ${u} with height ${d} is outside [${-x}, ${x-1}] (${b}).`);if(!(h>=0&&h<=1))throw Kn(`minDepth ${h} is outside [0, 1].`);if(!(m>=0&&m<=1))throw Kn(`maxDepth ${m} is outside [0, 1].`);if(!(h<=m))throw Kn(`minDepth ${h} exceeds maxDepth ${m}.`);return{x:l,y:u,width:f,height:d,minDepth:h,maxDepth:m}}function kA(n,i){if(n===void 0)return;if(!Array.isArray(n)||n.length!==4)throw _c(`received ${Ci(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 ${Ci(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 Ci(n){return typeof n=="string"?`'${n}'`:Array.isArray(n)?`[${n.map(i=>Ci(i)).join(", ")}]`:typeof n=="object"&&n!==null?"an object":String(n)}function jA(n){const i=n?.code;return i==="VGPU-DEVICE-DISPOSED"||i==="VGPU-DEVICE-LOST"}class BA{createFrame;advance;trackLoop;#e=!1;constructor(i,s,l){this.createFrame=i,this.advance=s,this.trackLoop=l}frame(i){if(this.#e||ME())throw P0();this.#e=!0,RE();try{this.advance();const s=this.createFrame();if(i)try{i(s)}finally{try{s.submit()}catch(l){if(!jA(l))throw l}}return s}finally{CE(),this.#e=!1}}loop(i,s={}){let l=!1;const u=globalThis.requestAnimationFrame??(D=>setTimeout(()=>D(performance.now()),16)),f=globalThis.cancelAnimationFrame??(D=>clearTimeout(D)),d=s.fps&&s.fps>0?1e3/s.fps:0;let h,m=0;const g=D=>{l||(GA(D,h,d)&&(h=D,this.frame(i)),l||(m=u(g)))};m=u(g);let x;const b={stop(){l=!0,f(m),x?.(),x=void 0}};return x=this.trackLoop?.(b),b}}function GA(n,i,s){return i===void 0||s<=0?!0:n-i>=s}function s0(n,i){return new sf(Wn(n,"target").device,i)}class sf{device;options;resourceIdentity=ru("render-target");#e=new lu;#t=new Set;#n;#i;#a;#s;#l;constructor(i,s){this.device=i,this.options=s,eE(s,i),this.#l=s.clearColor===void 0?Mf:iu(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 Kl(this.options)[0]?.format??"rgba8unorm"}get clearColor(){return Df(this.#l)}set clearColor(i){this.#l=iu(i,"target.clearColor")}get sampleCount(){return Ry(this.options)}resize(i){Oy(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)=>nE(h,this.#a?.[m],s,l)),depthStencilAttachment:this.#s?iE(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 Kl(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 Kl(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=Dy(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=$A(l.device,i,u.access??"read-write",void 0,u.indirect??!1);return J0(l,f,d=>d.destroy(),d=>{f.onDestroy(d)})}class zf{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 zf(h,l)}read(){return this.buffer.read(this.size)}write(i,s=0){this.buffer.write(VA(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 $A(n,i,s,l,u=!1){return zf.create(n,i,s,l,u)}function VA(n){if(n instanceof ArrayBuffer||ArrayBuffer.isView(n))return n;throw new TypeError("StorageBuffer.write() requires ArrayBuffer or ArrayBufferView.")}function IA(n,i,s,l={}){const u=Wn(n,"pingPong");return HA(u.device,i,s,l,f=>FA(u,f))}function FA(n,i){return J0(n,i,s=>s.destroy(),s=>{i.onDestroy(s)})}function HA(n,i,s,l={},u=qA){const f=[r0(i),r0(s)],d={...l,size:f},h=u(new sf(n,l0(d,l.label,"ping"))),m=u(new sf(n,l0(d,l.label,"pong")));return new YA([h,m])}function qA(n){return n}class YA{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 r0(n){return Math.max(1,Math.floor(n))}function l0(n,i,s){return i?{...n,label:`${i}.${s}`}:n}const jc=8,XA=globalThis.GPUMapMode?.READ??1;function KA(n,i){return new QA(n,i)}class QA{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(XA).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=gS(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 u0=32,rf=4096,o0=rf/2,PA=1/1e6;class ZA{name;owner;constructor(i,s){this.name=i,this.owner=s}[Cf](i){return{owner:this.owner,timestampWrites:this.owner.attachSpan(this,i.frame,i.device)}}}function WA(n){const i=Wn(n,"timer");return zS(i,s=>new JA(i.device,s))}class JA{#e;#t;#n=new Map;#i=new Set;#a;#s=u0*2;#l=u0*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 ${tT(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 ZA(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>=o0)throw iS(o0,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,eT(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)*PA: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 KA(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 eT(n){let i=1;for(;i<n;)i*=2;return i}function tT(n){return typeof n=="string"?`'${n}'`:String(n)}function c0(n){return MS("browser",n)}const f0=8,d0=64,h0=8,lf=16,sr={x0:0,y0:0,x1:1160,y1:812},p0=256,pr=`
|
|
26
|
-
struct Params {
|
|
27
|
-
// visible world rect: x0, y0, x1, y1
|
|
28
|
-
rect : vec4f,
|
|
29
|
-
// viewportW, viewportH, scale (px per world unit), time (seconds)
|
|
30
|
-
view : vec4f,
|
|
31
|
-
// massCount, disturbanceCount, couplingCount, dt
|
|
32
|
-
counts : vec4f,
|
|
33
|
-
// rowsScreen, stepScreen, amp, alpha
|
|
34
|
-
layer : vec4f,
|
|
35
|
-
// lineWidth, dz, parallaxX, showResidue
|
|
36
|
-
layer2 : vec4f,
|
|
37
|
-
// columns, rows, laneCount, plinthCount
|
|
38
|
-
grid : vec4f,
|
|
39
|
-
fill : vec4f,
|
|
40
|
-
// padded field rect used by the field texture: x0, y0, x1, y1
|
|
41
|
-
fieldRect : vec4f,
|
|
42
|
-
// fill reach in rows (0 = every fill runs to the viewport bottom), unused, unused, unused
|
|
43
|
-
sheet : vec4f,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
// Storage rather than uniform: every array below is packed by hand into a Float32Array, and this
|
|
47
|
-
// keeps the whole parameter block on the same footing instead of splitting the packing across two
|
|
48
|
-
// binding conventions.
|
|
49
|
-
@group(0) @binding(0) var<storage, read> P : Params;
|
|
50
|
-
|
|
51
|
-
// masses: 3 vec4 each
|
|
52
|
-
// 0: pos.xy, extent.xy
|
|
53
|
-
// 1: depth, rim, pull, lobe
|
|
54
|
-
// 2: phase, tint.rgb
|
|
55
|
-
@group(0) @binding(1) var<storage, read> massData : array<vec4f>;
|
|
56
|
-
|
|
57
|
-
// disturbances: 3 vec4 each
|
|
58
|
-
// 0: x, y, radius, amplitude
|
|
59
|
-
// 1: frequency, phase, statusIndex, energy
|
|
60
|
-
// 2: articulation, shoulder, unused, unused
|
|
61
|
-
@group(0) @binding(2) var<storage, read> distData : array<vec4f>;
|
|
62
|
-
|
|
63
|
-
// couplings: 1 vec4 each — fromMassIndex, toMassIndex, energy, unused
|
|
64
|
-
@group(0) @binding(3) var<storage, read> coupData : array<vec4f>;
|
|
65
|
-
|
|
66
|
-
// WGSL's pow() is exp2(y * log2(x)) and returns NaN for a negative base. The approved material
|
|
67
|
-
// squares plenty of signed quantities — offsets from a rim, distances either side of a ridge — so
|
|
68
|
-
// every one of those must be a multiplication, not a pow. A single NaN propagates through the
|
|
69
|
-
// baked field texture and blanks the entire sheet.
|
|
70
|
-
fn sq(x: f32) -> f32 { return x * x; }
|
|
71
|
-
fn quad(x: f32) -> f32 { let s = x * x; return s * s; }
|
|
72
|
-
|
|
73
|
-
fn massPos(i: u32) -> vec2f { return massData[i * 3u].xy; }
|
|
74
|
-
fn massExtent(i: u32) -> vec2f { return massData[i * 3u].zw; }
|
|
75
|
-
fn massShape(i: u32) -> vec4f { return massData[i * 3u + 1u]; }
|
|
76
|
-
fn massPhase(i: u32) -> f32 { return massData[i * 3u + 2u].x; }
|
|
77
|
-
fn massTint(i: u32) -> vec3f { return massData[i * 3u + 2u].yzw; }
|
|
78
|
-
`,nT=`
|
|
79
|
-
${pr}
|
|
80
|
-
|
|
81
|
-
@group(0) @binding(4) var prevTex : texture_2d<f32>;
|
|
82
|
-
@group(0) @binding(5) var prevSamp : sampler;
|
|
83
|
-
|
|
84
|
-
const DEPOSIT_RATE : f32 = 0.02;
|
|
85
|
-
const DECAY_RATE : f32 = 0.05;
|
|
86
|
-
|
|
87
|
-
@fragment
|
|
88
|
-
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
89
|
-
let prev = textureSampleLevel(prevTex, prevSamp, uv, 0.0);
|
|
90
|
-
let dt = P.counts.w;
|
|
91
|
-
|
|
92
|
-
// Texel back to world space over the fixed residue rect.
|
|
93
|
-
let world = vec2f(
|
|
94
|
-
mix(P.fieldRect.x, P.fieldRect.z, uv.x),
|
|
95
|
-
mix(P.fieldRect.y, P.fieldRect.w, uv.y)
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
// --- process deposition -------------------------------------------------
|
|
99
|
-
var deposit = 0.0;
|
|
100
|
-
let dn = u32(P.counts.y);
|
|
101
|
-
for (var i = 0u; i < dn; i = i + 1u) {
|
|
102
|
-
let a = distData[i * 3u];
|
|
103
|
-
let b = distData[i * 3u + 1u];
|
|
104
|
-
let radius = a.z;
|
|
105
|
-
let energy = b.w;
|
|
106
|
-
if (energy <= 0.001) { continue; }
|
|
107
|
-
let d = length(vec2f(world.x - a.x, (world.y - a.y) * 1.5));
|
|
108
|
-
if (d > radius * 2.4) { continue; }
|
|
109
|
-
let falloff = exp(-sq(d / (radius * 1.7)));
|
|
110
|
-
deposit = deposit + energy * falloff;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
// --- transfer deposition ------------------------------------------------
|
|
114
|
-
var coupleDeposit = 0.0;
|
|
115
|
-
let cn = u32(P.counts.z);
|
|
116
|
-
for (var i = 0u; i < cn; i = i + 1u) {
|
|
117
|
-
let c = coupData[i];
|
|
118
|
-
let a = massPos(u32(c.x));
|
|
119
|
-
let b = massPos(u32(c.y));
|
|
120
|
-
let v = b - a;
|
|
121
|
-
let l2 = dot(v, v);
|
|
122
|
-
if (l2 < 1.0) { continue; }
|
|
123
|
-
let u = dot(world - a, v) / l2;
|
|
124
|
-
if (u < -0.05 || u > 1.05) { continue; }
|
|
125
|
-
let proj = a + v * u;
|
|
126
|
-
let p = length(world - proj) / 44.0;
|
|
127
|
-
coupleDeposit = coupleDeposit + c.z * exp(-p * p * 1.4)
|
|
128
|
-
* exp(-quad((u - 0.5) / 0.5));
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
let r = prev.r + (deposit * DEPOSIT_RATE - prev.r * DECAY_RATE) * dt;
|
|
132
|
-
let g = prev.g + (coupleDeposit * DEPOSIT_RATE * 1.5 - prev.g * DECAY_RATE) * dt;
|
|
133
|
-
|
|
134
|
-
// Clamped so a pathological source can never drive residue unbounded.
|
|
135
|
-
return vec4f(clamp(r, 0.0, 4.0), clamp(g, 0.0, 4.0), 0.0, 1.0);
|
|
136
|
-
}
|
|
137
|
-
`,iT=`
|
|
138
|
-
${pr}
|
|
139
|
-
|
|
140
|
-
@group(0) @binding(4) var residueTex : texture_2d<f32>;
|
|
141
|
-
@group(0) @binding(5) var residueSamp : sampler;
|
|
142
|
-
|
|
143
|
-
// plinths: 3 vec4 each — session presence (FIELD-SPEC §15)
|
|
144
|
-
// 0: x, y, extentX, extentY
|
|
145
|
-
// 1: presence, articulation, parentIndex + 1 (0 = none), empty flag
|
|
146
|
-
// 2: shoulder, nested flag, unused, unused
|
|
147
|
-
@group(0) @binding(6) var<storage, read> plinthData : array<vec4f>;
|
|
148
|
-
|
|
149
|
-
const MAX_PLINTHS : u32 = ${lf}u;
|
|
150
|
-
|
|
151
|
-
const RES_X0 : f32 = ${sr.x0}.0;
|
|
152
|
-
const RES_Y0 : f32 = ${sr.y0}.0;
|
|
153
|
-
const RES_X1 : f32 = ${sr.x1}.0;
|
|
154
|
-
const RES_Y1 : f32 = ${sr.y1}.0;
|
|
155
|
-
|
|
156
|
-
fn residueAt(world: vec2f) -> vec2f {
|
|
157
|
-
let uv = vec2f(
|
|
158
|
-
(world.x - RES_X0) / (RES_X1 - RES_X0),
|
|
159
|
-
(world.y - RES_Y0) / (RES_Y1 - RES_Y0)
|
|
160
|
-
);
|
|
161
|
-
if (uv.x < 0.0 || uv.x > 1.0 || uv.y < 0.0 || uv.y > 1.0) { return vec2f(0.0); }
|
|
162
|
-
return textureSampleLevel(residueTex, residueSamp, uv, 0.0).rg;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
/** FIELD-SPEC §7 — the sheet sags toward mass. */
|
|
166
|
-
fn shiftAt(world: vec2f, t: f32) -> f32 {
|
|
167
|
-
var dy = 0.0;
|
|
168
|
-
let mn = u32(P.counts.x);
|
|
169
|
-
for (var i = 0u; i < mn; i = i + 1u) {
|
|
170
|
-
let pos = massPos(i);
|
|
171
|
-
let ext = massExtent(i);
|
|
172
|
-
let n = (world - pos) / ext;
|
|
173
|
-
let g = exp(-dot(n, n) * 0.85);
|
|
174
|
-
dy = dy + massShape(i).z * n.y * g * 1.6;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
// Coupling flattens the sheet between two machines (FIELD-SPEC §8).
|
|
178
|
-
let cn = u32(P.counts.z);
|
|
179
|
-
let res = residueAt(world);
|
|
180
|
-
for (var i = 0u; i < cn; i = i + 1u) {
|
|
181
|
-
let c = coupData[i];
|
|
182
|
-
let a = massPos(u32(c.x));
|
|
183
|
-
let b = massPos(u32(c.y));
|
|
184
|
-
let v = b - a;
|
|
185
|
-
let l2 = dot(v, v);
|
|
186
|
-
if (l2 < 1.0) { continue; }
|
|
187
|
-
let u = dot(world - a, v) / l2;
|
|
188
|
-
if (u < -0.05 || u > 1.05) { continue; }
|
|
189
|
-
let proj = a + v * u;
|
|
190
|
-
let off = (world.y - proj.y) / 62.0;
|
|
191
|
-
let env = exp(-off * off) * exp(-quad((u - 0.5) / 0.55));
|
|
192
|
-
dy = dy - off * 62.0 * 0.42 * env * (0.7 + 0.3 * sin(t * 2.4 - u * 6.0)) * c.z;
|
|
193
|
-
dy = dy - off * 10.0 * env * res.g;
|
|
194
|
-
}
|
|
195
|
-
return dy;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/** FIELD-SPEC §6 — the height field. */
|
|
199
|
-
fn heightAt(world: vec2f, t: f32) -> f32 {
|
|
200
|
-
let x = world.x;
|
|
201
|
-
let y = world.y;
|
|
202
|
-
|
|
203
|
-
// Base medium.
|
|
204
|
-
var v = 3.1 * sin(x * 0.021 + y * 0.013) * sin(y * 0.017 - x * 0.008)
|
|
205
|
-
+ 1.7 * sin(x * 0.045 - y * 0.031)
|
|
206
|
-
+ 1.1 * sin(y * 0.062 + x * 0.017);
|
|
207
|
-
|
|
208
|
-
// Mass: a lobed well with a raised rim. Permanent.
|
|
209
|
-
let mn = u32(P.counts.x);
|
|
210
|
-
for (var i = 0u; i < mn; i = i + 1u) {
|
|
211
|
-
let pos = massPos(i);
|
|
212
|
-
let ext = massExtent(i);
|
|
213
|
-
let shape = massShape(i);
|
|
214
|
-
let ph = massPhase(i);
|
|
215
|
-
let n = (world - pos) / ext;
|
|
216
|
-
let r = length(n);
|
|
217
|
-
let th = atan2(n.y, n.x);
|
|
218
|
-
let lobe = shape.w;
|
|
219
|
-
let wob = 1.0 + lobe * sin(3.0 * th + ph) * 0.5 + lobe * 0.3 * sin(5.0 * th - ph);
|
|
220
|
-
let rr = r / max(0.35, wob);
|
|
221
|
-
v = v - shape.x * exp(-rr * rr * 1.05);
|
|
222
|
-
v = v + shape.y * exp(-sq((rr - 1.02) / 0.42));
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// Activity: temporary, local, independent. Anisotropic — wider than tall.
|
|
226
|
-
//
|
|
227
|
-
// Articulation (FIELD-SPEC §16) is spent on definition only: it damps the ripple terms, softens
|
|
228
|
-
// and widens the collar so the rim stops closing, and — when co-observing sources disagree on
|
|
229
|
-
// extent — raises a faint doubled shoulder inside the object's own trough. The bulge amplitude
|
|
230
|
-
// itself is NEVER scaled by articulation: unknown stays heavy.
|
|
231
|
-
let dn = u32(P.counts.y);
|
|
232
|
-
for (var i = 0u; i < dn; i = i + 1u) {
|
|
233
|
-
let a = distData[i * 3u];
|
|
234
|
-
let b = distData[i * 3u + 1u];
|
|
235
|
-
let c = distData[i * 3u + 2u];
|
|
236
|
-
let amp = a.w;
|
|
237
|
-
if (amp <= 0.01) { continue; }
|
|
238
|
-
let radius = a.z;
|
|
239
|
-
let freq = b.x;
|
|
240
|
-
let phase = b.y;
|
|
241
|
-
let artic = c.x;
|
|
242
|
-
let rip = 0.15 + 0.85 * artic;
|
|
243
|
-
let d = length(vec2f(x - a.x, (y - a.y) * 1.5));
|
|
244
|
-
if (d > radius * 4.0) { continue; }
|
|
245
|
-
let e = exp(-sq(d / radius));
|
|
246
|
-
v = v + amp * e * (0.78 + 0.22 * sin(t * freq + phase) * rip);
|
|
247
|
-
v = v - amp * 0.34 * (0.25 + 0.75 * artic)
|
|
248
|
-
* exp(-sq((d - radius * 1.5) / (radius * 0.62 * (1.0 + (1.0 - artic) * 1.4))));
|
|
249
|
-
v = v + amp * 0.16 * rip * exp(-d / (radius * 2.1)) * sin(d * 0.13 - t * freq * 2.6 + phase);
|
|
250
|
-
if (c.y > 0.02) {
|
|
251
|
-
v = v + amp * 0.11 * exp(-sq((d - radius * (0.72 + c.y)) / (radius * 0.3)));
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// SESSION PRESENCE (FIELD-SPEC §15): a flat-topped plinth per live session raises grouped
|
|
256
|
-
// executions onto one platform, so an existing contour closes around the set. A spawned child
|
|
257
|
-
// is a plinth growing out of the parent plinth. An empty-but-known session keeps only its rim.
|
|
258
|
-
let pn = min(u32(P.grid.w), MAX_PLINTHS);
|
|
259
|
-
var lv : array<f32, MAX_PLINTHS>;
|
|
260
|
-
for (var i = 0u; i < pn; i = i + 1u) {
|
|
261
|
-
let pa = plinthData[i * 3u];
|
|
262
|
-
let pb = plinthData[i * 3u + 1u];
|
|
263
|
-
let pc = plinthData[i * 3u + 2u];
|
|
264
|
-
let n = (world - pa.xy) / pa.zw;
|
|
265
|
-
let r2 = dot(n, n);
|
|
266
|
-
let presence = pb.x;
|
|
267
|
-
let plateau = 1.0 / (1.0 + pow(max(r2, 1e-5), 2.6));
|
|
268
|
-
lv[i] = plateau * presence;
|
|
269
|
-
if (pb.w > 0.5) {
|
|
270
|
-
// Presence without content: the rim of a session nothing ever ran in.
|
|
271
|
-
v = v + 4.5 * presence * exp(-sq((sqrt(r2) - 1.0) / 0.3));
|
|
272
|
-
} else {
|
|
273
|
-
let plinth = select(17.0, 13.0, pc.y > 0.5) * presence;
|
|
274
|
-
v = v + plinth * plateau;
|
|
275
|
-
if (pc.x > 0.02) {
|
|
276
|
-
// Co-observation shoulder: sources agree on the computation, not exactly on its extent.
|
|
277
|
-
// A concentric bench inside the plateau edge — never a separate closed rim.
|
|
278
|
-
v = v + plinth * 0.3 * pc.x * exp(-sq((sqrt(r2) - 0.78) / 0.13));
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
// THE KEEL: where two unrelated plateaus overlap, the ground between them drops — the same
|
|
284
|
-
// trough vocabulary already used around bulges, so contours cannot bridge it and proximity alone
|
|
285
|
-
// can never close a line. Parent and spawned child are exempt and still share a wall. Shallow by
|
|
286
|
-
// design: it must never read as a machine-level rift.
|
|
287
|
-
for (var i = 0u; i < pn; i = i + 1u) {
|
|
288
|
-
for (var j = i + 1u; j < pn; j = j + 1u) {
|
|
289
|
-
if (lv[i] < 0.02 || lv[j] < 0.02) { continue; }
|
|
290
|
-
let pi = u32(plinthData[i * 3u + 1u].z);
|
|
291
|
-
let pj = u32(plinthData[j * 3u + 1u].z);
|
|
292
|
-
if (pi == j + 1u || pj == i + 1u) { continue; }
|
|
293
|
-
let lo = min(lv[i], lv[j]);
|
|
294
|
-
let o = lo / max(lv[i], lv[j]);
|
|
295
|
-
v = v - 30.0 * o * sqrt(o) * lo;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
// Residue: what the field remembers. One texture read, not a walk through history.
|
|
300
|
-
if (P.layer2.w > 0.5) {
|
|
301
|
-
let res = residueAt(world);
|
|
302
|
-
v = v + 62.0 * 0.15 * res.r;
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
// Coupling ridge.
|
|
306
|
-
let cn = u32(P.counts.z);
|
|
307
|
-
let resC = residueAt(world);
|
|
308
|
-
for (var i = 0u; i < cn; i = i + 1u) {
|
|
309
|
-
let c = coupData[i];
|
|
310
|
-
let a = massPos(u32(c.x));
|
|
311
|
-
let b = massPos(u32(c.y));
|
|
312
|
-
let vv = b - a;
|
|
313
|
-
let l2 = dot(vv, vv);
|
|
314
|
-
if (l2 < 1.0) { continue; }
|
|
315
|
-
let u = dot(world - a, vv) / l2;
|
|
316
|
-
if (u < -0.05 || u > 1.05) { continue; }
|
|
317
|
-
let proj = a + vv * u;
|
|
318
|
-
let p = length(world - proj) / 44.0;
|
|
319
|
-
let envc = exp(-p * p) * exp(-quad((u - 0.5) / 0.56));
|
|
320
|
-
v = v + 34.0 * envc * (0.5 + 0.5 * sin(u * 13.0 - t * 4.6)) * c.z;
|
|
321
|
-
v = v - 14.0 * exp(-sq(abs(p) - 1.5)) * envc * c.z;
|
|
322
|
-
v = v + 9.0 * resC.g * exp(-p * p * 1.4) * exp(-quad((u - 0.5) / 0.5));
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
return v;
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
/**
|
|
329
|
-
* Local articulation (FIELD-SPEC §16): the sheet resolves coarser near unresolved objects, so line
|
|
330
|
-
* cadence carries the meaning. Weighted blend over disturbances and plinths, with a prior toward 1
|
|
331
|
-
* so the empty medium — and everything far from an observed object — keeps its full cadence.
|
|
332
|
-
*/
|
|
333
|
-
fn articAt(world: vec2f) -> f32 {
|
|
334
|
-
var num = 0.0;
|
|
335
|
-
var den = 0.35;
|
|
336
|
-
let dn = u32(P.counts.y);
|
|
337
|
-
for (var i = 0u; i < dn; i = i + 1u) {
|
|
338
|
-
let a = distData[i * 3u];
|
|
339
|
-
let b = distData[i * 3u + 1u];
|
|
340
|
-
if (b.w <= 0.001) { continue; }
|
|
341
|
-
let dx = (world.x - a.x) / (a.z * 2.0);
|
|
342
|
-
let dy = (world.y - a.y) * 1.5 / (a.z * 2.0);
|
|
343
|
-
let w = exp(-(dx * dx + dy * dy)) * b.w;
|
|
344
|
-
num = num + w * distData[i * 3u + 2u].x;
|
|
345
|
-
den = den + w;
|
|
346
|
-
}
|
|
347
|
-
let pn = min(u32(P.grid.w), MAX_PLINTHS);
|
|
348
|
-
for (var i = 0u; i < pn; i = i + 1u) {
|
|
349
|
-
let pa = plinthData[i * 3u];
|
|
350
|
-
let pb = plinthData[i * 3u + 1u];
|
|
351
|
-
if (pb.x <= 0.01) { continue; }
|
|
352
|
-
let dx = (world.x - pa.x) / (pa.z * 1.3);
|
|
353
|
-
let dy = (world.y - pa.y) / (pa.w * 1.3);
|
|
354
|
-
let w = exp(-(dx * dx + dy * dy)) * pb.x * 0.8;
|
|
355
|
-
num = num + w * pb.y;
|
|
356
|
-
den = den + w;
|
|
357
|
-
}
|
|
358
|
-
return clamp((num + 0.35) / den, 0.1, 1.0);
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
@fragment
|
|
362
|
-
fn fs_main(@location(0) uv: vec2f) -> @location(0) vec4f {
|
|
363
|
-
let world = vec2f(
|
|
364
|
-
mix(P.fieldRect.x, P.fieldRect.z, uv.x),
|
|
365
|
-
mix(P.fieldRect.y, P.fieldRect.w, uv.y)
|
|
366
|
-
);
|
|
367
|
-
let t = P.view.w;
|
|
368
|
-
return vec4f(heightAt(world, t), shiftAt(world, t), articAt(world), 1.0);
|
|
369
|
-
}
|
|
370
|
-
`,m0=`
|
|
371
|
-
${pr}
|
|
372
|
-
|
|
373
|
-
@group(0) @binding(4) var fieldTex : texture_2d<f32>;
|
|
374
|
-
@group(0) @binding(5) var fieldSamp : sampler;
|
|
375
|
-
|
|
376
|
-
struct VOut {
|
|
377
|
-
@builtin(position) pos : vec4f,
|
|
378
|
-
@location(0) color : vec4f,
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
fn fieldSample(world: vec2f) -> vec3f {
|
|
382
|
-
let uv = vec2f(
|
|
383
|
-
(world.x - P.fieldRect.x) / (P.fieldRect.z - P.fieldRect.x),
|
|
384
|
-
(world.y - P.fieldRect.y) / (P.fieldRect.w - P.fieldRect.y)
|
|
385
|
-
);
|
|
386
|
-
// r: height, g: shift, b: local articulation.
|
|
387
|
-
return textureSampleLevel(fieldTex, fieldSamp, clamp(uv, vec2f(0.0), vec2f(1.0)), 0.0).rgb;
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
/** FIELD-SPEC §10 — line colour is the base ink pulled toward nearby mass tints. */
|
|
391
|
-
fn tintMix(world: vec2f) -> vec3f {
|
|
392
|
-
var acc = vec3f(226.0, 223.0, 215.0);
|
|
393
|
-
var w = 1.0;
|
|
394
|
-
let mn = u32(P.counts.x);
|
|
395
|
-
for (var i = 0u; i < mn; i = i + 1u) {
|
|
396
|
-
let pos = massPos(i);
|
|
397
|
-
let ext = massExtent(i) * 1.5;
|
|
398
|
-
let n = (world - pos) / ext;
|
|
399
|
-
let k = exp(-dot(n, n)) * 0.85;
|
|
400
|
-
acc = acc + massTint(i) * k;
|
|
401
|
-
w = w + k;
|
|
402
|
-
}
|
|
403
|
-
return acc / w / 255.0;
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
/** Screen-space y of the sheet at world x on the given row baseline. */
|
|
407
|
-
fn rowPoint(x: f32, by: f32, dzW: f32, ampF: f32) -> f32 {
|
|
408
|
-
let wy = by + dzW;
|
|
409
|
-
let sh = fieldSample(vec2f(x, wy)).g;
|
|
410
|
-
let yy = wy + sh * ampF;
|
|
411
|
-
let hv = fieldSample(vec2f(x, yy)).r * ampF;
|
|
412
|
-
let worldY = by - hv + sh * 0.55 * ampF;
|
|
413
|
-
return (worldY - P.rect.y) * P.view.z;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
@vertex
|
|
417
|
-
fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
|
|
418
|
-
let cols = u32(P.grid.x);
|
|
419
|
-
let isLine = ii & 1u;
|
|
420
|
-
let seg = ii >> 1u;
|
|
421
|
-
let row = seg / cols;
|
|
422
|
-
let col = seg % cols;
|
|
423
|
-
|
|
424
|
-
let k = P.view.z;
|
|
425
|
-
let stepW = P.layer.y / k;
|
|
426
|
-
let rowsW = P.layer.x / k;
|
|
427
|
-
let dzW = P.layer2.y / k;
|
|
428
|
-
// FIELD-SPEC §10 — amplitude compensation when zoomed in.
|
|
429
|
-
let ampF = P.layer.z * select(1.0, 1.6 / k, k > 1.0);
|
|
430
|
-
|
|
431
|
-
let x0 = P.rect.x - stepW * 2.0 + f32(col) * stepW;
|
|
432
|
-
let x1 = x0 + stepW;
|
|
433
|
-
let by = P.rect.y - rowsW * 0.6 + f32(row) * rowsW;
|
|
434
|
-
|
|
435
|
-
let sy0 = rowPoint(x0, by, dzW, ampF);
|
|
436
|
-
let sy1 = rowPoint(x1, by, dzW, ampF);
|
|
437
|
-
let sx0 = (x0 - P.rect.x) * k + P.layer2.z;
|
|
438
|
-
let sx1 = (x1 - P.rect.x) * k + P.layer2.z;
|
|
439
|
-
|
|
440
|
-
var p = vec2f(0.0);
|
|
441
|
-
var color = vec4f(0.0);
|
|
442
|
-
|
|
443
|
-
if (isLine == 0u) {
|
|
444
|
-
// Fill: from this segment down over the farther rows it occludes.
|
|
445
|
-
//
|
|
446
|
-
// ── Why the fill stops where it does ──────────────────────────────────────────────────────
|
|
447
|
-
// The approved material ran every fill to the bottom of the viewport. Composited far to near
|
|
448
|
-
// that is exactly the hidden-line algorithm, but it also means a pixel is written once per row
|
|
449
|
-
// above it: at the 9 px near-row spacing on a 914 px tall viewport, about 107 blended
|
|
450
|
-
// fragments per pixel across the three layers (measured; see the performance investigation),
|
|
451
|
-
// and that overdraw grows with width × height² × dpr². It was three quarters of the frame's
|
|
452
|
-
// GPU time on an M4 and dwarfs everything else the field draws.
|
|
453
|
-
//
|
|
454
|
-
// Below the next 'reach' rows' lines a fill can no longer be seen: the fills of those rows
|
|
455
|
-
// land on top of it, each at this layer's fill alpha, so whatever it contributed is scaled by
|
|
456
|
-
// (1 - alpha)^reach — below one 8-bit step for the reach chosen per layer in FILL_REACH. So
|
|
457
|
-
// the fill stops at the LOWEST of the next 'reach' rows' lines at each end of the segment, and
|
|
458
|
-
// the rows between it and there keep exactly the occlusion and haze they had. The bottom edge
|
|
459
|
-
// is straight between the two ends, which bounds the straight segments of those rows.
|
|
460
|
-
//
|
|
461
|
-
// Reach 0 restores the original geometry, and the last 'reach' rows keep it, so the sheet's
|
|
462
|
-
// edge against the strata band is untouched.
|
|
463
|
-
var bottom = P.view.y + 60.0;
|
|
464
|
-
let reach = u32(P.sheet.x);
|
|
465
|
-
let rows = u32(P.grid.y);
|
|
466
|
-
let isBottom = (vi == 2u) || (vi == 4u) || (vi == 5u);
|
|
467
|
-
if (isBottom && reach > 0u && row + reach < rows) {
|
|
468
|
-
let xb = select(x0, x1, vi != 5u);
|
|
469
|
-
var b = select(sy0, sy1, vi != 5u);
|
|
470
|
-
for (var j = 1u; j <= reach; j = j + 1u) {
|
|
471
|
-
b = max(b, rowPoint(xb, by + f32(j) * rowsW, dzW, ampF));
|
|
472
|
-
}
|
|
473
|
-
// Half a pixel of slack over the nearer rows' own vertex arithmetic.
|
|
474
|
-
bottom = b + 0.5;
|
|
475
|
-
}
|
|
476
|
-
switch (vi) {
|
|
477
|
-
case 0u: { p = vec2f(sx0, sy0); }
|
|
478
|
-
case 1u: { p = vec2f(sx1, sy1); }
|
|
479
|
-
case 2u: { p = vec2f(sx1, bottom); }
|
|
480
|
-
case 3u: { p = vec2f(sx0, sy0); }
|
|
481
|
-
case 4u: { p = vec2f(sx1, bottom); }
|
|
482
|
-
default: { p = vec2f(sx0, bottom); }
|
|
483
|
-
}
|
|
484
|
-
color = P.fill;
|
|
485
|
-
} else {
|
|
486
|
-
// Line: a quad along the segment, width and alpha from local slope (FIELD-SPEC §10).
|
|
487
|
-
let slope = min(1.0, abs(sy1 - sy0) / max(0.001, P.layer.y));
|
|
488
|
-
var bucketA = 0.17;
|
|
489
|
-
var bucketW = 0.75;
|
|
490
|
-
if (slope > 0.62) { bucketA = 0.98; bucketW = 1.80; }
|
|
491
|
-
else if (slope > 0.30) { bucketA = 0.60; bucketW = 1.35; }
|
|
492
|
-
else if (slope > 0.11) { bucketA = 0.32; bucketW = 1.00; }
|
|
493
|
-
|
|
494
|
-
// OBSERVATION RESOLUTION (FIELD-SPEC §16): near an unresolved object the sheet's own line
|
|
495
|
-
// cadence loosens — segments dash out, thin and dim. Never the height: mass stays, definition
|
|
496
|
-
// varies. The blend prior keeps the empty medium at full cadence, so a fully resolved field
|
|
497
|
-
// renders exactly as it did before articulation existed.
|
|
498
|
-
let art = fieldSample(vec2f((x0 + x1) * 0.5, by)).b;
|
|
499
|
-
if (art <= 0.85) {
|
|
500
|
-
let dash = (1.0 - art) * 9.0 + 1.5;
|
|
501
|
-
// World-anchored phase (scaled to screen), so the cadence sits still under panning.
|
|
502
|
-
let phase = fract(x0 * k * 0.7 / (dash * 2.2)) * dash * 2.2;
|
|
503
|
-
if (phase > dash * 1.15) {
|
|
504
|
-
var cut: VOut;
|
|
505
|
-
cut.pos = vec4f(-10.0, -10.0, 0.0, 1.0);
|
|
506
|
-
cut.color = vec4f(0.0);
|
|
507
|
-
return cut;
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
let artA = 0.34 + 0.66 * art;
|
|
511
|
-
let artW = 0.7 + 0.3 * art;
|
|
512
|
-
|
|
513
|
-
let width = max(0.6, bucketW * artW * min(2.1, k) * P.layer2.x);
|
|
514
|
-
let dir = normalize(vec2f(sx1 - sx0, sy1 - sy0) + vec2f(0.0001, 0.0));
|
|
515
|
-
let nrm = vec2f(-dir.y, dir.x) * (width * 0.5);
|
|
516
|
-
|
|
517
|
-
switch (vi) {
|
|
518
|
-
case 0u: { p = vec2f(sx0, sy0) - nrm; }
|
|
519
|
-
case 1u: { p = vec2f(sx1, sy1) - nrm; }
|
|
520
|
-
case 2u: { p = vec2f(sx1, sy1) + nrm; }
|
|
521
|
-
case 3u: { p = vec2f(sx0, sy0) - nrm; }
|
|
522
|
-
case 4u: { p = vec2f(sx1, sy1) + nrm; }
|
|
523
|
-
default: { p = vec2f(sx0, sy0) + nrm; }
|
|
524
|
-
}
|
|
525
|
-
let rgb = tintMix(vec2f((x0 + x1) * 0.5, by));
|
|
526
|
-
color = vec4f(rgb, bucketA * artA * P.layer.w);
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
var out: VOut;
|
|
530
|
-
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);
|
|
531
|
-
out.color = color;
|
|
532
|
-
return out;
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
@fragment
|
|
536
|
-
fn fs_main(in: VOut) -> @location(0) vec4f {
|
|
537
|
-
return vec4f(in.color.rgb * in.color.a, in.color.a);
|
|
538
|
-
}
|
|
539
|
-
`,aT=`
|
|
540
|
-
${pr}
|
|
541
|
-
|
|
542
|
-
struct VOut {
|
|
543
|
-
@builtin(position) pos : vec4f,
|
|
544
|
-
@location(0) local : vec2f,
|
|
545
|
-
@location(1) color : vec3f,
|
|
546
|
-
@location(2) weight : f32,
|
|
547
|
-
};
|
|
548
|
-
|
|
549
|
-
fn statusColor(idx: f32) -> vec3f {
|
|
550
|
-
if (idx < 0.5) { return vec3f(240.0, 195.0, 116.0) / 255.0; } // running
|
|
551
|
-
if (idx < 1.5) { return vec3f(150.0, 175.0, 196.0) / 255.0; } // waiting
|
|
552
|
-
if (idx < 2.5) { return vec3f(206.0, 104.0, 90.0) / 255.0; } // failed
|
|
553
|
-
if (idx < 3.5) { return vec3f(180.0, 210.0, 175.0) / 255.0; } // completed
|
|
554
|
-
return vec3f(230.0, 227.0, 219.0) / 255.0; // idle
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
fn statusPulse(idx: f32, t: f32, freq: f32, phase: f32) -> f32 {
|
|
558
|
-
if (idx < 0.5) { return 0.55 + 0.35 * sin(t * freq * 2.0 + phase); }
|
|
559
|
-
if (idx < 1.5) { return 0.40 + 0.08 * sin(t * 0.6); }
|
|
560
|
-
if (idx < 2.5) { return 0.50 + 0.50 * sin(t * 30.0); }
|
|
561
|
-
if (idx < 3.5) { return 0.35; }
|
|
562
|
-
return 0.15;
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
@vertex
|
|
566
|
-
fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
|
|
567
|
-
let a = distData[ii * 3u];
|
|
568
|
-
let b = distData[ii * 3u + 1u];
|
|
569
|
-
let k = P.view.z;
|
|
570
|
-
let t = P.view.w;
|
|
571
|
-
|
|
572
|
-
let statusIdx = b.z;
|
|
573
|
-
let failed = select(1.0, 1.3, statusIdx > 1.5 && statusIdx < 2.5);
|
|
574
|
-
let radius = max(2.4, 3.4 * k) * failed * 3.2;
|
|
575
|
-
|
|
576
|
-
let centre = vec2f((a.x - P.rect.x) * k, (a.y - P.rect.y) * k);
|
|
577
|
-
let corner = vec2f(
|
|
578
|
-
select(-1.0, 1.0, (vi == 1u) || (vi == 2u) || (vi == 4u)),
|
|
579
|
-
select(-1.0, 1.0, (vi == 2u) || (vi == 4u) || (vi == 5u))
|
|
580
|
-
);
|
|
581
|
-
let p = centre + corner * radius;
|
|
582
|
-
|
|
583
|
-
var out: VOut;
|
|
584
|
-
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);
|
|
585
|
-
out.local = corner;
|
|
586
|
-
out.color = statusColor(statusIdx);
|
|
587
|
-
// Articulation dims the core's confidence, never the field's mass (FIELD-SPEC §16).
|
|
588
|
-
let artic = distData[ii * 3u + 2u].x;
|
|
589
|
-
out.weight = statusPulse(statusIdx, t, b.x, b.y) * 0.9 * clamp(b.w, 0.0, 1.0)
|
|
590
|
-
* (0.22 + 0.78 * artic);
|
|
591
|
-
return out;
|
|
592
|
-
}
|
|
593
|
-
|
|
594
|
-
@fragment
|
|
595
|
-
fn fs_main(in: VOut) -> @location(0) vec4f {
|
|
596
|
-
let d = length(in.local);
|
|
597
|
-
if (d > 1.0) { discard; }
|
|
598
|
-
// Radial falloff matching the design's gradient stops.
|
|
599
|
-
let a = (1.0 - d) * (1.0 - d) * in.weight;
|
|
600
|
-
return vec4f(in.color * a, a);
|
|
601
|
-
}
|
|
602
|
-
`,sT=`
|
|
603
|
-
${pr}
|
|
604
|
-
|
|
605
|
-
// per stratum: startFraction, endFraction, lane, statusIndex
|
|
606
|
-
@group(0) @binding(4) var<storage, read> strataData : array<vec4f>;
|
|
607
|
-
|
|
608
|
-
struct VOut {
|
|
609
|
-
@builtin(position) pos : vec4f,
|
|
610
|
-
@location(0) t : f32,
|
|
611
|
-
@location(1) color : vec3f,
|
|
612
|
-
@location(2) alpha : f32,
|
|
613
|
-
};
|
|
614
|
-
|
|
615
|
-
const STRATA_TOP : f32 = 812.0;
|
|
616
|
-
const STRATA_H : f32 = 360.0;
|
|
617
|
-
const SPAN_X : f32 = 1160.0;
|
|
618
|
-
const MIN_W : f32 = ${$0}.0;
|
|
619
|
-
|
|
620
|
-
@vertex
|
|
621
|
-
fn vs_main(@builtin(vertex_index) vi: u32, @builtin(instance_index) ii: u32) -> VOut {
|
|
622
|
-
let s = strataData[ii];
|
|
623
|
-
let laneCount = max(1.0, P.grid.z);
|
|
624
|
-
let laneH = STRATA_H / laneCount;
|
|
625
|
-
let top = STRATA_TOP + s.z * laneH;
|
|
626
|
-
|
|
627
|
-
let wx0 = s.x * SPAN_X;
|
|
628
|
-
let wx1 = max(wx0 + MIN_W, s.y * SPAN_X);
|
|
629
|
-
let k = P.view.z;
|
|
630
|
-
|
|
631
|
-
let sx0 = (wx0 - P.rect.x) * k;
|
|
632
|
-
let sx1 = (wx1 - P.rect.x) * k;
|
|
633
|
-
let sy0 = (top - P.rect.y) * k;
|
|
634
|
-
let sy1 = (top + laneH - P.rect.y) * k;
|
|
635
|
-
|
|
636
|
-
let right = (vi == 1u) || (vi == 2u) || (vi == 4u);
|
|
637
|
-
let lower = (vi == 2u) || (vi == 4u) || (vi == 5u);
|
|
638
|
-
let p = vec2f(select(sx0, sx1, right), select(sy0, sy1, lower));
|
|
639
|
-
|
|
640
|
-
// Failed runs read red; otherwise the lane's machine tint.
|
|
641
|
-
var col = massTint(u32(s.z)) / 255.0;
|
|
642
|
-
if (s.w > 1.5 && s.w < 2.5) { col = vec3f(206.0, 104.0, 90.0) / 255.0; }
|
|
643
|
-
|
|
644
|
-
var out: VOut;
|
|
645
|
-
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);
|
|
646
|
-
out.t = select(0.0, 1.0, right);
|
|
647
|
-
out.color = col;
|
|
648
|
-
out.alpha = 0.30;
|
|
649
|
-
return out;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
|
-
@fragment
|
|
653
|
-
fn fs_main(in: VOut) -> @location(0) vec4f {
|
|
654
|
-
// Left-to-right gradient to transparent, as in the approved design.
|
|
655
|
-
let a = in.alpha * (1.0 - in.t);
|
|
656
|
-
return vec4f(in.color * a, a);
|
|
657
|
-
}
|
|
658
|
-
`,Qy=.34,Py=3.4,g0={zoom:1,cx:580,cy:406},rT=-260,lT=1420,uT=-260,oT=1300,cT=.58,fT=.72,uf=1.7,dT=1.45;function hT(n,i){return n==="strata"?i>fT?"environment":"strata":n==="proximity"?i<dT?"environment":"proximity":i<cT?"strata":i>uf?"proximity":"environment"}function pT(n){return n.width/wn.spanX}function Tn(n,i){return pT(i)*n.zoom}function mr(n){return n.zoom=Math.max(Qy,Math.min(Py,n.zoom)),n.cx=Math.max(rT,Math.min(lT,n.cx)),n.cy=Math.max(uT,Math.min(oT,n.cy)),n}function mT(n,i,s){const l=Tn(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 of(n,i,s,l){const u=Tn(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=Tn(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]=of(s,l,n,u);n.zoom=Math.max(Qy,Math.min(Py,n.zoom*i));const h=Tn(n,u);n.cx=f-s/h+u.width/h/2,n.cy=d-l/h+u.height/h/2,mr(n)}function y0(n,i,s,l){const u=Tn(n,l);n.cx+=i/u,n.cy+=s/u,mr(n)}function gT(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 yT(n,i,s){return mr({zoom:s,cx:n,cy:i})}const $l=120,vT="field",bT=5,xT=2,v0=30;class ST{intervalMs=new Float32Array($l);cpuMs=new Float32Array($l);cursor=0;filled=0;lastFrameAt=0;frames=0;lastIntervalMs=0;lastCpuMs=0;gpuMs={};disturbances=0;fps=0;resolutionScale=1;get canAdapt(){return this.bakeSamples>0}lastEvalAt=0;pendingResize=!1;bakeSum=0;bakeSamples=0;sample(i,s,l){const u=this.gpuMs[vT];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)%$l,this.filled<$l&&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>bT&&this.resolutionScale>.5?(this.resolutionScale=Math.max(.5,this.resolutionScale-.15),this.pendingResize=!0):s<xT&&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,wT=[3,2,2],w0=0,E0=1,Ji=2,A0=1,T0=2,ET=4,AT=1600,M0=.004;function TT(n){return n.msSinceInteraction<AT?A0:n.couplings>0||n.maxEnergy>M0?T0:n.maxSettling>M0?ET:n.dirty?A0:1/0}class MT{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(f0*3*4);distArr=new Float32Array(d0*3*4);coupArr=new Float32Array(h0*4);strataArr=new Float32Array(S0*4);plinthArr=new Float32Array(lf*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 ST;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 c0({requiredFeatures:["timestamp-query"]})}catch{return await c0()}}),!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=WA(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=s0(this.gpu,{size:[this.headless.width,this.headless.height],format:"rgba8unorm"});else{const f=this.canvas;await DT(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=EE(this.gpu,f,{dpr:d,autoResize:!0}),this.output=this.surf,this.view.width=h,this.view.height=m}this.residue=IA(this.gpu,p0,p0,{format:"rgba16float"});const[i,s]=this.fieldSize();this.fieldTarget=s0(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=$E(this.gpu,{minFilter:"linear",magFilter:"linear"});this.linearSampler=l,this.residueFx=a0(this.gpu,nT,{set:{P:this.paramsBufs[w0],massData:this.massBuf,distData:this.distBuf,coupData:this.coupBuf,prevTex:this.residue.read,prevSamp:l}}),this.fieldFx=a0(this.gpu,iT,{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=Bl(this.gpu,{shader:m0,vertices:6,blend:"premultiplied",set:{P:this.paramsBufs[Ji],massData:this.massBuf,fieldTex:this.fieldTarget,fieldSamp:l}}),this.coresDraw=Bl(this.gpu,{shader:aT,vertices:6,blend:"additive",set:{P:this.paramsBufs[Ji],distData:this.distBuf}}),this.strataDraw=Bl(this.gpu,{shader:sT,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},this.runtime.set(u.id,f)),f.target=u.energy,f.status=u.status,f.statusSince=u.statusSince,f.seen=l}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)}for(const u of this.plinthRuntime.values()){const f=Math.abs(u.target-u.presence);f>l&&(l=f)}return TT({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)}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,f0);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>=h0)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>=d0)break;const l=this.runtime.get(s.id),u=l?l.energy:s.energy;if(u<=5e-4)continue;const f=30+s.extent*44,d=f*(.62+.22*s.extent),h=i*12;this.distArr[h+0]=s.x,this.distArr[h+1]=s.y,this.distArr[h+2]=f,this.distArr[h+3]=d*u,this.distArr[h+4]=.9+s.rate*1.15,this.distArr[h+5]=s.phase,this.distArr[h+6]=b0[s.status],this.distArr[h+7]=u,this.distArr[h+8]=s.articulation,this.distArr[h+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>=lf)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=Tn(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?wT[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,mr(this.camera),this.headless){const[O,L]=this.output.size;this.view.width=O,this.view.height=L}else{const O=this.canvas;if(O&&(O.clientWidth===0||O.clientHeight===0)){this.perf.resetPacing(),this.lastDrawnAt=0;return}const[L,K]=this.cssSize();if(L!==this.view.width||K!==this.view.height){this.view.width=L,this.view.height=K;const G=Math.min(this.maxDpr,globalThis.devicePixelRatio||1);this.canvas.width=Math.round(L*G),this.canvas.height=Math.round(K*G),this.surf?.resize([L,K]);const[I,H]=this.fieldSize();this.fieldTarget.resize([I,H]),this.probe&&(this.probe.canvasResizes++,this.probe.note(`canvas ${L}×${K} css → ${O?.width}×${O?.height}, field ${I}×${H}`))}}mT(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=Tn(this.camera,this.view);this.packParams(w0,i,sr,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 x=0;const b=[];TA(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),x++),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),x++);let L=0;const K=(I,H)=>{const Z=Pn[H],de=this.colsFor(Z.step,d),M=this.rowsFor(Z.rows,d),E=de*M*2;this.probe&&b.push({cols:de,rows:M,instances:E}),!(h&&!h.layers[H])&&(L+=E,m.set({P:this.paramsBufs[Ji+H]}),I.draw(m,{instances:E}))},G=[.024,.027,.035,1];if(h?.splitLayers&&this.layerSpans.length===Pn.length){for(let I=0;I<Pn.length;I++)O.pass(I===0?{target:this.output,clear:G,timer:this.layerSpans[I]}:{target:this.output,clear:!1,timer:this.layerSpans[I]},H=>K(H,I)),x++;O.pass(this.spans?{target:this.output,clear:!1,timer:this.spans.overlay}:{target:this.output,clear:!1},I=>{this.strataCount>0&&!h?.skipStrata&&I.draw(this.strataDraw,{instances:this.strataCount}),this.disturbanceCount>0&&!h?.skipCores&&I.draw(this.coresDraw,{instances:this.disturbanceCount})}),x++}else O.pass(this.spans?{target:this.output,clear:G,timer:this.spans.sheet}:{target:this.output,clear:G},I=>{for(let H=0;H<Pn.length;H++)K(I,H);this.strataCount>0&&!h?.skipStrata&&I.draw(this.strataDraw,{instances:this.strataCount}),this.disturbanceCount>0&&!h?.skipCores&&I.draw(this.coresDraw,{instances:this.disturbanceCount})}),x++;this.lastInstances=L+this.strataCount+this.disturbanceCount}),this.residue.swap(),this.dirty=!1;const D=this.probe?performance.now():0;if(!h?.skipSubscribers)for(const O of this.frameSubscribers)O(this.view);const V=performance.now(),k=this.lastDrawnAt>0?s-this.lastDrawnAt:0;if(this.lastDrawnAt=s,this.perf.sample(s,V-s,this.disturbanceCount),this.probe&&(this.probe.noteFrame({interval:k,stride:this.lastStride,prep:g-s,encode:D-g,post:V-D,total:V-s}),this.captureScene(x,b)),this.perf.wantsResize()){const[O,L]=this.fieldSize(),[K,G]=this.fieldTarget.size;(O!==K||L!==G)&&(this.fieldTarget.resize([O,L]),this.probe&&(this.probe.fieldResizes++,this.probe.note(`field texture ${K}×${G} → ${O}×${L} (scale ${this.perf.resolutionScale.toFixed(2)})`)))}}sheetVariantDraw(i){const s=`${i.skipFill?"F":""}${i.skipLine?"L":""}`;let l=this.sheetVariants.get(s);return!l&&this.probe&&(l=Bl(this.gpu,{shader:this.probe.sheetVariant(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=Tn(this.camera,this.view);let m=0;for(let x=0;x<Pn.length;x++){const D=Pn[x].rows/h,V=this.rect.y0-D*.6,k=s[x]?.rows??0;for(let O=0;O<k;O++){const L=(V+O*D-this.rect.y0)*h;L<u&&(m+=(u-Math.max(0,L))/u)}}let g=0;for(const x of s)g+=x.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 DT(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 X={bg:"#050608",ink:"#e6e3db",accent:"#d9a441",accentBright:"#f0c374",hoverInk:"#f5cf8b",panel:"rgba(7,8,11,0.94)",panelBorder:"rgba(230,227,219,0.4)",hairline:"rgba(230,227,219,0.14)",chrome:"rgba(230,227,219,0.62)",chromeDim:"rgba(230,227,219,0.4)",chromeMid:"rgba(230,227,219,0.7)",chromeStrong:"rgba(230,227,219,0.82)",body:"rgba(230,227,219,0.88)"},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)",RT={backgroundImage:"radial-gradient(rgba(230,227,219,0.05) 0.5px, rgba(0,0,0,0) 0.6px)",backgroundSize:"3px 3px"},CT={background:"radial-gradient(96% 82% at 44% 56%, rgba(0,0,0,0) 42%, rgba(3,3,5,0.9) 100%)"},OT={background:"linear-gradient(to bottom, rgba(6,8,11,0.7), rgba(6,8,11,0))"};let $c=Promise.resolve();function zT({landscape:n,onHover:i,onSelect:s,anchor:l,children:u,onBand:f,onReady:d,depth:h,overlay:m,inset:g,keepVisible:x,compact:b=!1}){const D=Q.useRef(null),V=Q.useRef(null),k=Q.useRef(null),O=Q.useRef({...g0}),L=Q.useRef(n),K=Q.useRef(new Map),G=Q.useRef(null),I=Q.useRef(null),H=Q.useRef(null),Z=Q.useRef(null),de=Q.useRef(null),M=Q.useRef(new Map),E=Q.useRef(null),B=Q.useRef({key:"",w:0,h:0,label:!1}),[W,te]=Q.useState("init"),[le,$e]=Q.useState(null),[he,re]=Q.useState("environment"),[R,q]=Q.useState([]),[ae,Te]=Q.useState("grab");L.current=n,Q.useEffect(()=>{const ee=V.current;if(!ee)return;let J=!1,ye=null;const Ce=$c.then(async()=>{if(!J){if(ye=new MT({canvas:ee,camera:O.current}),await ye.init(),J){ye.dispose(),ye=null;return}k.current=ye,ye.setLandscape(L.current),ye.start(),te("ready"),d?.(ye)}}).catch(Ke=>{J||($e(Ke instanceof Error?Ke.message:String(Ke)),te("failed"))});return $c=Ce,()=>{J=!0,k.current=null,$c=Ce.then(()=>{ye?.dispose(),ye=null})}},[]),Q.useEffect(()=>{k.current?.setLandscape(n)},[n]),Q.useEffect(()=>{const ee=[];for(const J of n.masses)ee.push({id:`mass:${J.id}`,wx:J.x,wy:J.y+J.extentY+26,text:J.name,color:"rgba(230,227,219,0.78)",size:10});if(he==="proximity"){for(const J of n.disturbances)J.energy<.02&&J.status!=="completed"||ee.push({id:`dist:${J.id}`,wx:J.x,wy:J.y-30-J.extent*40,text:`${J.label} · ${J.status}`,color:at[J.status],size:9});for(const J of n.plinths)ee.push({id:`plinth:${J.id}`,wx:J.x,wy:J.y-J.extentY-16,text:`${J.parentId?"└ ":""}${J.label}${J.observers>1?` · ${J.observers} obs`:""}`,color:`rgba(240,195,116,${(.16+.5*J.articulation).toFixed(2)})`,size:9})}q(ee)},[n,he]),Q.useLayoutEffect(()=>{const ee=k.current;if(!ee)return;let J=0;const ye=Ce=>{const Ke=O.current,Qe=performance.now(),Kt=J===0?1/60:Math.min(.1,(Qe-J)/1e3);J=Qe,Z.current&&(gT(Ke,Z.current,Kt)&&(Z.current=null),ee.noteInteraction());const Ve=hT(Re.current,Ke.zoom);Ve!==Re.current&&(Re.current=Ve,re(Ve),f?.(Ve));for(const[At,ct]of K.current){const He=N.current.get(At);if(!He)continue;const[St,tt]=Bc(He.wx,He.wy,Ke,Ce),_i=St>-200&&St<Ce.width+200&&tt>-80&&tt<Ce.height+80;ct.style.visibility=_i?"visible":"hidden",ct.style.transform=`translate3d(${St}px, ${tt}px, 0) translate(-50%, -100%)`}const dn=G.current,xt=w.current;if(dn&&xt){const[At,ct]=Bc(xt.x,xt.y,Ke,Ce),He=dn.firstElementChild;He&&B.current.key!==xt.id&&(B.current={key:xt.id,w:He.offsetWidth,h:He.offsetHeight,label:He.dataset.anchorPlacement==="label"});const{w:St,h:tt,label:_i}=B.current;let Ui=_i?-St/2:18,ls=_i?-tt-14:-tt/2;!_i&&At+Ui+St>Ce.width-12&&(Ui=-St-18),Ui=Math.max(12-At,Ui),ls=Math.min(Math.max(12-ct,ls),Ce.height-12-tt-ct),dn.style.transform=`translate3d(${At+Ui}px, ${ct+ls}px, 0)`,dn.style.visibility=At>-300&&At<Ce.width+300&&ct>-300&&ct<Ce.height+300?"visible":"hidden"}const Lt=Ke.cy+Ce.height/Tn(Ke,Ce)/2,Dn=Lt>wn.strataTop+40,la=Lt>wn.strataTop+wn.strataHeight*.7,Rn=I.current,zi=Rn?.querySelector("[data-depth-label]");if(zi){const At=Dn?la?"FIELD — TODAY":"FIELD — SURFACE + TODAY":"FIELD — LIVE";zi.textContent!==At&&(zi.textContent=At)}if(Rn){const At=Rn.querySelector("[data-depth-summary]"),ct=Rn.querySelector("[data-depth-deep]");if(At&&(At.style.display=Dn?"inline-flex":"none"),ct){const He=ct.dataset.depthSuppressed==="true";ct.style.display=la&&!He?"block":"none"}}};return ee.onFrame(ye)},[W,f]);const Re=Q.useRef("environment"),w=Q.useRef(null),N=Q.useRef(new Map);w.current=l,Q.useEffect(()=>{N.current=new Map(R.map(ee=>[ee.id,ee]))},[R]);const Y=Q.useCallback(()=>{const ee=D.current;return{width:ee?.clientWidth??1,height:ee?.clientHeight??1}},[]),P=g?.right??0,ue=g?.bottom??0,fe=x?.id??null,me=x?.x??0,Ze=x?.y??0;Q.useEffect(()=>{const ee=k.current;if(!ee||!fe||P===0&&ue===0)return;const J=Y(),ye={...Z.current??O.current},Ce=Tn(ye,J);if(Ce<=0)return;const[Ke,Qe]=Bc(me,Ze,ye,J);let Kt=!1;if(P>0){const Ve=J.width-P-40;Ke>Ve&&(ye.cx+=(Ke-(J.width-P)/2)/Ce,Kt=!0)}if(ue>0){const Ve=J.height-ue-40;Qe>Ve&&(ye.cy+=(Qe-(Ve-60))/Ce,Kt=!0)}Qe<70&&(ye.cy-=(110-Qe)/Ce,Kt=!0),Kt&&(Z.current=mr(ye),ee.noteInteraction())},[fe,me,Ze,P,ue,Y]);const De=Q.useCallback(ee=>{const J=D.current.getBoundingClientRect();return[ee.clientX-J.left,ee.clientY-J.top]},[]),gn=Q.useCallback(ee=>{const J=k.current;if(!J)return;const[ye,Ce]=De(ee);Z.current=null,ee.ctrlKey||ee.metaKey?Gc(O.current,Math.exp(-ee.deltaY*.012),ye,Ce,Y()):y0(O.current,ee.deltaX,ee.deltaY,Y()),J.noteInteraction()},[De,Y]);Q.useEffect(()=>{const ee=D.current;if(!ee)return;const J=ye=>ye.preventDefault();return ee.addEventListener("wheel",J,{passive:!1}),()=>ee.removeEventListener("wheel",J)},[]);const Jn=Q.useCallback(ee=>{const J=De(ee);ee.isPrimary&&M.current.clear(),M.current.set(ee.pointerId,J),Z.current=null;try{D.current?.setPointerCapture(ee.pointerId)}catch{}if(M.current.size===1)H.current={x:J[0],y:J[1],moved:!1},Te("grabbing");else if(M.current.size===2){const[ye,Ce]=[...M.current.values()];E.current={distance:Math.hypot(ye[0]-Ce[0],ye[1]-Ce[1]),zoom:O.current.zoom},H.current=null}k.current?.noteInteraction()},[De]),Mt=Q.useCallback(ee=>{const J=k.current;if(!J)return;const ye=De(ee),Ce=M.current.has(ee.pointerId);Ce&&M.current.set(ee.pointerId,ye);const Ke=E.current;if(Ke&&M.current.size>=2){const[xt,Lt]=[...M.current.values()],Dn=Math.hypot(xt[0]-Lt[0],xt[1]-Lt[1]),la=(xt[0]+Lt[0])/2,Rn=(xt[1]+Lt[1])/2,zi=Ke.zoom*(Dn/Math.max(12,Ke.distance));Gc(O.current,zi/O.current.zoom,la,Rn,Y()),J.noteInteraction();return}const Qe=H.current;if(Ce&&Qe){const xt=ye[0]-Qe.x,Lt=ye[1]-Qe.y;(Math.abs(xt)>4||Math.abs(Lt)>4)&&(Qe.moved=!0),y0(O.current,-xt,-Lt,Y()),Qe.x=ye[0],Qe.y=ye[1],J.noteInteraction();return}if(ee.pointerType==="touch")return;const[Kt,Ve]=of(ye[0],ye[1],O.current,Y()),dn=Ym(L.current,Kt,Ve);Te(dn?"pointer":"grab"),(dn||de.current)&&J.noteInteraction(),de.current=dn,i(dn)},[De,i,Y]),Mn=Q.useCallback(ee=>{const J=M.current.get(ee.pointerId)??De(ee);M.current.delete(ee.pointerId),M.current.size<2&&(E.current=null);const ye=H.current;if(H.current=null,Te("grab"),!ye||ye.moved)return;const[Ce,Ke]=of(J[0],J[1],O.current,Y()),Qe=Ym(L.current,Ce,Ke);if(s(Qe),Qe&&Qe.kind!=="stratum"){const Kt=Qe.kind==="mass"?uf:uf+.5;Z.current=yT(Qe.x,Qe.y,Math.max(O.current.zoom,Kt))}k.current?.noteInteraction()},[De,s,Y]),be=Q.useCallback(()=>{H.current=null,E.current=null,M.current.clear(),Te("grab")},[]),yn=Q.useCallback(()=>{Z.current={...g0},k.current?.noteInteraction(),s(null)},[s]),fn=Q.useCallback(ee=>{const J=Y();Gc(O.current,ee,J.width/2,J.height/2,J),k.current?.noteInteraction()},[Y]);return v.jsxs("div",{style:{position:"relative",flex:1,minHeight:0},children:[v.jsxs("div",{ref:D,onWheel:gn,onPointerDown:Jn,onPointerMove:Mt,onPointerUp:Mn,onPointerCancel:Mn,onLostPointerCapture:ee=>{M.current.delete(ee.pointerId),M.current.size<2&&(E.current=null)},onPointerLeave:ee=>{ee.pointerType!=="touch"&&(be(),i(null))},style:{position:"absolute",inset:0,overflow:"hidden",background:X.bg,cursor:ae},children:[v.jsx("canvas",{ref:V,style:{display:"block",width:"100%",height:"100%"}}),v.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",...RT}}),v.jsx("div",{style:{position:"absolute",inset:0,pointerEvents:"none",...CT}}),v.jsx("div",{style:{position:"absolute",left:0,right:0,top:0,height:"16%",pointerEvents:"none",...OT}}),v.jsxs("div",{style:{position:"absolute",inset:0,pointerEvents:"none"},children:[R.map(ee=>v.jsx("div",{ref:J=>{J?K.current.set(ee.id,J):K.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:G,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:I,style:{position:"absolute",inset:0,pointerEvents:"none"},children:h}),W==="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:X.chrome,letterSpacing:"0.08em"},children:le})]})})]}),v.jsx(_T,{onSurface:yn,onZoom:fn,compact:b})]})}function _T({onSurface:n,onZoom:i,compact:s}){if(s)return v.jsx("div",{style:{position:"absolute",right:14,bottom:18},children:v.jsx("button",{onClick:n,style:{width:52,height:52,borderRadius:"50%",background:"rgba(7,8,11,0.9)",border:"1px solid rgba(230,227,219,0.5)",color:X.ink,fontFamily:Et,fontSize:8.5,letterSpacing:"0.1em",cursor:"pointer"},children:"SURF"})});const l={background:"transparent",border:`1px solid ${X.chromeDim}`,color:X.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"})]})}const D0="(no model)";function rn({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 ${X.hairline}`,cursor:f?"help":"default"},children:[v.jsxs("div",{style:{fontSize:9.5,letterSpacing:"0.22em",color:X.chrome,display:"flex",alignItems:"baseline",gap:6},children:[n,f&&v.jsx("span",{style:{color:X.chromeDim,letterSpacing:"0.1em"},children:"inferred"})]}),v.jsx("div",{style:{fontSize:21,letterSpacing:"0.02em",color:l??X.ink,fontVariantNumeric:"tabular-nums"},children:i}),u&&v.jsx("div",{style:{fontSize:9.5,color:X.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:X.chrome},children:n}),v.jsx("div",{style:{marginTop:12},children:i})]})}function Zy({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 Vc({rows:n,max:i,label:s,color:l}){return v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:n.map(u=>v.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",gap:16,fontSize:11,fontVariantNumeric:"tabular-nums"},children:[v.jsx("span",{style:{color:X.body},children:s(u.key)}),v.jsxs("span",{style:{color:X.chromeMid},children:[u.runs," ",u.runs===1?"run":"runs",u.tokenRuns>0?` · ${pt(u.tokens)} tok`:""," · ",Ye(u.computeMs),u.failed>0&&v.jsxs("span",{style:{color:at.failed},children:[" · ",u.failed," failed"]})]})]}),v.jsx(Zy,{fraction:i>0?u.computeMs/i:0,color:l})]},u.key))})}function UT({world:n}){const i=Q.useMemo(()=>j0(n),[n]),s=Q.useMemo(()=>G0(n,i),[n,i]),l=Q.useMemo(()=>Bx(n),[n]),u=Q.useMemo(()=>Gx(n),[n]),f=Q.useMemo(()=>$x(n),[n]),d=Q.useMemo(()=>Vx(n),[n]),h=Q.useMemo(()=>Oc(n,(G,I)=>I?.context),[n]),m=Q.useMemo(()=>Oc(n,G=>G.model??D0),[n]),g=Q.useMemo(()=>Oc(n,G=>G.machineId),[n]),x=Q.useMemo(()=>[...n.executions.values()].filter(G=>G.status==="failed").sort((G,I)=>I.startedAt-G.startedAt),[n]),b=i.longestFocus.value,D=Q.useMemo(()=>[...n.executions.values()].filter(G=>qt(G.measures)===void 0).length,[n]),V=h[0]?.computeMs??0,k=m[0]?.computeMs??0,O=g[0]?.computeMs??0,L=d.reduce((G,I)=>I.computeMs>G.computeMs?I:G,d[0]),K=[...n.executions.values()].filter(G=>G.depth>0).length;return v.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"28px 48px 80px",fontFamily:Et,color:X.ink},children:[v.jsxs("div",{style:{marginBottom:34,maxWidth:900},children:[v.jsx("div",{style:{fontSize:9.5,letterSpacing:"0.24em",color:X.chrome},children:"WORK SHAPE"}),v.jsx("div",{style:{fontSize:34,letterSpacing:"0.08em",marginTop:10,color:X.accentBright},children:s.headline}),v.jsx("div",{style:{marginTop:14,display:"flex",flexDirection:"column",gap:7},children:s.clauses.map(G=>v.jsx("div",{style:{fontSize:12,lineHeight:1.65,color:X.body,letterSpacing:"0.02em"},children:G},G))})]}),v.jsxs("div",{style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(190px, 1fr))",gap:"0 40px"},children:[v.jsx(rn,{name:"REQUESTS",value:pt(i.requests.value),measure:i.requests}),v.jsx(rn,{name:"RUNS",value:String(i.executions.value),measure:i.executions,note:K>0?`${K} of them sub-agents`:void 0}),v.jsx(rn,{name:"SESSIONS",value:String(i.sessions.value),measure:i.sessions}),v.jsx(rn,{name:"TOKENS",value:pt(i.tokens.value),measure:i.tokens,note:`${Math.round(l.cacheRead/Math.max(1,l.total)*100)}% cache reads`+(D>0?` · ${D} ${D===1?"run reports":"runs report"} no accounting`:"")}),v.jsx(rn,{name:"TOOL CALLS",value:pt(f.toolCalls),measure:i.toolCalls,note:f.toolErrors>0?`${f.toolErrors} failed`:void 0}),v.jsx(rn,{name:"AUTONOMOUS COMPUTE",value:Ye(i.autonomousCompute.value),measure:i.autonomousCompute}),v.jsx(rn,{name:"HUMAN + AGENT OVERLAP",value:Ye(i.humanAgentOverlap.value),measure:i.humanAgentOverlap,note:`${Math.round(i.humanAgentOverlap.value/Math.max(1,i.autonomousCompute.value)*100)}% of compute`}),v.jsx(rn,{name:"PEAK CONCURRENCY",value:i.peakConcurrency.value>0?`${i.peakConcurrency.value} · ${Ja(i.peakConcurrencyAt.value)}`:"0",measure:i.peakConcurrency}),v.jsx(rn,{name:"CONTEXT SWITCHES",value:String(i.contextSwitches.value),measure:i.contextSwitches,note:`across ${h.length} ${h.length===1?"context":"contexts"}`}),v.jsx(rn,{name:"LONGEST FOCUS",value:b?Ye(b.end-b.start):"—",measure:i.longestFocus,note:b?`${ur(b.context)} · ${Ja(b.start)}–${Ja(b.end)}`:void 0}),v.jsx(rn,{name:"WAITING ON YOU",value:Ye(i.waitingOnYou.value),measure:i.waitingOnYou,accent:i.waitingOnYou.value>0?at.waiting:void 0,note:u.count>0?`${u.count} ${u.count===1?"block":"blocks"} · longest ${Ye(u.longestMs)}`:void 0}),v.jsx(rn,{name:"FAILED",value:String(f.failed),accent:f.failed>0?at.failed:void 0,note:f.interrupted>0||f.retries>0?`${f.interrupted} stopped · ${f.retries} retries`:void 0})]}),d.length>0&&v.jsxs(ea,{title:"HOUR BY HOUR",children:[v.jsx("div",{style:{display:"flex",alignItems:"flex-end",gap:3,height:84},children:d.map((G,I)=>{const H=G.computeMs/36e5;return v.jsx("div",{title:`${String(G.hour).padStart(2,"0")}:00 — ${Ye(G.computeMs)} of compute, ${G.runs} runs, peak ${G.peak}`,style:{flex:1,minWidth:4,height:"100%",display:"flex",flexDirection:"column",justifyContent:"flex-end"},children:v.jsx("div",{style:{height:`${Math.max(1,H*100)}%`,background:G.peak>1?"rgba(240,195,116,0.75)":"rgba(214,176,116,0.38)"}})},I)})}),v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",marginTop:6,fontSize:9,letterSpacing:"0.16em",color:X.chromeDim},children:[v.jsxs("span",{children:[String(d[0].hour).padStart(2,"0"),":00"]}),v.jsxs("span",{children:["busiest ",String(L.hour).padStart(2,"0"),":00 · ",Ye(L.computeMs)," ","of that hour"]}),v.jsxs("span",{children:[String(d[d.length-1].hour).padStart(2,"0"),":00"]})]})]}),v.jsx(ea,{title:"WHERE THE TIME WENT",children:v.jsx(Vc,{rows:h,max:V,label:ur,color:"rgba(240,195,116,0.6)"})}),g.length>0&&v.jsx(ea,{title:"BY MACHINE",children:v.jsx(Vc,{rows:g,max:O,label:G=>n.machines.get(G)?.name??G,color:"rgba(168,186,150,0.6)"})}),m.length>0&&v.jsx(ea,{title:"BY MODEL",children:v.jsx(Vc,{rows:m,max:k,label:G=>G===D0?"model not observed":G,color:"rgba(150,175,196,0.6)"})}),v.jsxs(ea,{title:"TOKEN COMPOSITION",children:[v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:10},children:[["CACHE READS",l.cacheRead,"rgba(150,175,196,0.6)"],["INPUT",l.input,"rgba(240,195,116,0.6)"],["OUTPUT",l.output,"rgba(180,210,175,0.7)"],["REASONING",l.reasoning,"rgba(214,176,116,0.5)"]].map(([G,I,H])=>v.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:5},children:[v.jsxs("div",{style:{display:"flex",justifyContent:"space-between",fontSize:11,fontVariantNumeric:"tabular-nums"},children:[v.jsx("span",{style:{color:X.body},children:G}),v.jsxs("span",{style:{color:X.chromeMid},children:[pt(I)," · ",Math.round(I/Math.max(1,l.total)*100),"%"]})]}),v.jsx(Zy,{fraction:I/Math.max(1,l.total),color:H})]},G))}),v.jsx("div",{style:{marginTop:12,fontSize:10,lineHeight:1.7,color:X.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."})]}),x.length>0&&v.jsx(ea,{title:"FAILURES",children:v.jsx("div",{style:{display:"flex",flexDirection:"column",gap:9},children:x.slice(0,12).map(G=>v.jsxs("div",{style:{display:"flex",gap:16,fontSize:11,borderTop:`1px solid ${X.hairline}`,paddingTop:8},children:[v.jsx("span",{style:{color:X.chromeMid,minWidth:46},children:Ja(G.startedAt)}),v.jsx("span",{style:{color:X.body,minWidth:160},children:G.label}),v.jsxs("span",{style:{color:at.failed},children:[G.failure?.code,": ",G.failure?.message]})]},G.id))})}),v.jsx(NT,{})]})}function NT(){return v.jsx(ea,{title:"NOT AVAILABLE FROM THESE SOURCES",children:v.jsxs("div",{style:{maxWidth:760,fontSize:10.5,lineHeight:1.8,color:X.chromeDim},children:[v.jsx("div",{children:"COST — every source here reports tokens or CPU time; none reports money. Converting one to the other needs a price table 057 does not have, so no cost figure is shown anywhere."}),v.jsx("div",{style:{marginTop:8},children:"TOKENS, FROM SOME SOURCES — Cursor persists no usage and 0x2F records none; their runs read NOT OBSERVED rather than 0, and the token totals sum only the runs that report."}),v.jsx("div",{style:{marginTop:8},children:"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."})]})})}const Ic=100,R0="58px minmax(180px,1.4fr) 104px 132px 84px 68px 62px 70px 56px";function LT(n){return n.outcome==="interrupted"?"STOPPED":n.status}function kT(n){return n.outcome==="interrupted"?X.chromeMid:at[n.status]}function Mi({children:n,align:i="left",color:s}){return v.jsx("div",{style:{textAlign:i,color:s??X.chromeMid,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n})}function jT({p:n,session:i,onShowInField:s}){const l=qt(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",pt(Wa(n.measures).input)],["OUTPUT",pt(Wa(n.measures).output)],["CACHE READ",pt(Wa(n.measures).cacheRead)],["REASONING",pt(Wa(n.measures).reasoning)]],["REQUESTS",String(ff(n))],["TOOL CALLS",es(un(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",`${Ye(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 ${X.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:X.chrome},children:d}),v.jsx("span",{style:{fontSize:10.5,color:m??X.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:X.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 ${X.hairline}`,color:X.chromeMid,fontFamily:Et,fontSize:9,letterSpacing:"0.16em",padding:"5px 10px",cursor:"pointer"},children:"SHOW IN FIELD →"})})]})}function BT({world:n,selectedId:i,onSelect:s}){const[l,u]=Q.useState("all"),[f,d]=Q.useState("time"),[h,m]=Q.useState(Ic),[g,x]=Q.useState(null),b=Q.useMemo(()=>{let L=[...n.executions.values()];l==="stopped"?L=L.filter(I=>I.outcome==="interrupted"):l!=="all"&&(L=L.filter(I=>I.status===l&&I.outcome!=="interrupted"));const K=I=>(I.endedAt??n.now)-I.startedAt,G={time:(I,H)=>H.startedAt-I.startedAt,duration:(I,H)=>K(H)-K(I),tokens:(I,H)=>(qt(H.measures)??0)-(qt(I.measures)??0),tools:(I,H)=>(un(H)??0)-(un(I)??0),waited:(I,H)=>H.waitingMs-I.waitingMs};return L.sort(G[f])},[n,l,f]),D=Q.useMemo(()=>{const L={all:n.executions.size,stopped:0};for(const K of n.executions.values())K.outcome==="interrupted"?L.stopped++:L[K.status]=(L[K.status]??0)+1;return L},[n]),V=Q.useMemo(()=>{let L=0,K=0,G=0,I=0;for(const H of b)L+=qt(H.measures)??0,K+=(H.endedAt??n.now)-H.startedAt,G+=un(H)??0,I+=H.waitingMs;return{tokens:L,compute:K,tools:G,waited:I}},[b,n]),k=b.slice(0,h),O=(L,K,G="left")=>v.jsxs("div",{onClick:()=>d(L),style:{textAlign:G,cursor:"pointer",color:f===L?X.ink:X.chrome},children:[K,f===L?" ↓":""]});return v.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"24px 48px 80px",fontFamily:Et,color:X.ink},children:[v.jsx("div",{style:{display:"flex",gap:10,flexWrap:"wrap",marginBottom:14},children:["all","running","waiting","idle","completed","failed","stopped"].map(L=>{const K=l===L,G=D[L]??0;return v.jsxs("button",{onClick:()=>{u(L),m(Ic)},style:{background:"transparent",border:`1px solid ${K?"rgba(230,227,219,0.6)":X.hairline}`,color:K?X.ink:X.chromeMid,fontFamily:Et,fontSize:9.5,letterSpacing:"0.16em",padding:"6px 11px",cursor:"pointer",textTransform:"uppercase"},children:[L," ",G>0&&v.jsx("span",{style:{color:X.chromeDim},children:G})]},L)})}),v.jsxs("div",{style:{fontSize:10,letterSpacing:"0.12em",color:X.chromeDim,marginBottom:14,fontVariantNumeric:"tabular-nums"},children:[b.length," ",b.length===1?"run":"runs"," shown · ",pt(V.tokens)," tok ·"," ",Ye(V.compute)," of run time · ",pt(V.tools)," tool calls",V.waited>0&&` · ${Ye(V.waited)} blocked on you`]}),v.jsxs("div",{style:{display:"grid",gridTemplateColumns:R0,gap:"0 14px",fontSize:9,letterSpacing:"0.18em",color:X.chrome,paddingBottom:8,borderBottom:`1px solid ${X.hairline}`},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"),O("tokens","TOKENS","right"),O("waited","WAITED","right"),O("tools","TOOLS","right")]}),k.map(L=>{const K=n.sessions.get(L.sessionId),G=L.id===i,I=g===L.id;return v.jsxs("div",{children:[v.jsxs("div",{onClick:()=>x(I?null:L.id),style:{display:"grid",gridTemplateColumns:R0,gap:"0 14px",fontSize:11,padding:"9px 0",borderBottom:"1px solid rgba(230,227,219,0.05)",cursor:"pointer",background:G||I?"rgba(240,195,116,0.07)":"transparent",fontVariantNumeric:"tabular-nums"},children:[v.jsx(Mi,{children:Ja(L.startedAt)}),v.jsxs(Mi,{color:G||I?X.accentBright:X.body,children:[L.depth>0&&v.jsx("span",{style:{color:X.chromeDim},children:"└ "}),L.label]}),v.jsx(Mi,{children:K?ur(K.context):"—"}),v.jsx(Mi,{color:L.model?void 0:X.chromeDim,children:L.model??"—"}),v.jsx("div",{style:{fontSize:9,letterSpacing:"0.14em",color:kT(L),textTransform:"uppercase"},children:LT(L)}),v.jsxs(Mi,{align:"right",children:[L.startBasis==="inferred"||L.endBasis==="inferred"?"~":"",Ye((L.endedAt??n.now)-L.startedAt)]}),v.jsx(Mi,{align:"right",color:qt(L.measures)===void 0?X.chromeDim:void 0,children:es(qt(L.measures),"—")}),v.jsx(Mi,{align:"right",color:L.waitingMs>0?at.waiting:X.chromeDim,children:L.waitingMs>0?Ye(L.waitingMs):"—"}),v.jsxs(Mi,{align:"right",color:un(L)===void 0?X.chromeDim:void 0,children:[es(un(L),"—"),ia(L)>0&&v.jsxs("span",{style:{color:at.failed},children:[" /",ia(L)]})]})]}),I&&v.jsx(jT,{p:L,session:K,onShowInField:()=>s(L.id)})]},L.id)}),b.length===0&&v.jsx("div",{style:{padding:"28px 0",fontSize:11,color:X.chromeMid},children:"Nothing matching in this window."}),b.length>h&&v.jsxs("button",{onClick:()=>m(L=>L+Ic),style:{marginTop:18,background:"transparent",border:`1px solid ${X.hairline}`,color:X.chromeMid,fontFamily:Et,fontSize:9.5,letterSpacing:"0.16em",padding:"8px 14px",cursor:"pointer"},children:["SHOW MORE — ",b.length-h," REMAINING"]})]})}const Fc={display:"flex",flexDirection:"column",gap:5,background:X.panel,borderLeft:`1px solid ${X.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:X.chromeMid,letterSpacing:"0.1em",whiteSpace:"nowrap"},children:[n,u&&v.jsxs("span",{style:{color:X.chromeDim,letterSpacing:"0.06em"},children:[" ",u]})]}),v.jsx("span",{style:{fontSize:10,fontWeight:500,letterSpacing:"0.14em",color:s??X.chromeStrong,whiteSpace:"nowrap",textAlign:"right",overflow:"hidden",textOverflow:"ellipsis",maxWidth:190},children:i})]})}function 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:X.ink,textTransform:"uppercase"},children:n}),v.jsx("div",{onClick:i,role:"button",style:{fontSize:11,color:X.chromeMid,cursor:"pointer"},children:"×"})]})}function _f({label:n}){return v.jsx("div",{style:{marginTop:5,paddingTop:5,borderTop:"1px solid rgba(230,227,219,0.08)",fontSize:8.5,letterSpacing:"0.2em",color:X.chromeDim},children:n})}function GT(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 $T(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 C0={"ran-as":"RAN AS","same-as":"SAME AS",spawned:"SPAWNED",contains:"CONTAINS",produced:"PRODUCED"};function O0({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(_f,{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?C0[l.kind]:l.kind==="spawned"?"SPAWNED BY":C0[l.kind],m=GT(l);return v.jsx(Ue,{name:h,tag:m.grade==="contextual"?`${m.label} · inferred`:m.label,detail:$T(n,d),color:m.grade==="contextual"?X.chromeMid:void 0,title:l.assumption??(l.via?`via ${l.via}`:void 0)},`${l.kind}:${d.type}:${d.id}:${u}`)})]})}function VT({type:n,id:i}){const[s,l]=Q.useState(null);return Q.useEffect(()=>{let u=!1;l(null);const f=setTimeout(()=>{o1(n,i).then(({events:d})=>{u||l(IT(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(_f,{label:"NATIVE RECORD"}),s.facts.map(([u,f])=>v.jsx(Ue,{name:u,detail:f,color:X.chromeMid},u)),s.provenance&&v.jsxs("div",{title:s.provenance,style:{fontSize:8.5,letterSpacing:"0.04em",color:X.chromeDim,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",cursor:"help"},children:["read from ",s.provenance]})]})}function IT(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 FT({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:Ye(s),title:f?n.boundsAssumption:void 0})]})}function Uf({hit:n,world:i,landscape:s,band:l,density:u,onClose:f}){if(n.kind==="mass"){const k=i.machines.get(n.id);if(!k)return null;const O=[];let L=0,K;for(const H of i.executions.values()){if(H.machineId!==k.id)continue;const Z=qt(H.measures);Z!==void 0&&(K=(K??0)+Z),H.status==="running"||H.status==="waiting"?O.push({id:H.id,label:H.label,status:H.status}):L++}const G=i.processTotals,I=new Set;for(const H of i.relationships)H.kind==="ran-as"&&(H.from.type==="process"&&I.add(H.from.id),H.to.type==="process"&&I.add(H.to.id));return v.jsxs("div",{style:Fc,children:[v.jsx(Hc,{text:k.name,onClose:f}),O.length===0?v.jsx("div",{style:{fontSize:10,color:X.chrome},children:"idle — nothing active"}):O.slice(0,8).map(H=>v.jsx(Ue,{name:H.label,detail:H.status.toUpperCase(),color:at[H.status]},H.id)),v.jsx("div",{style:{height:4}}),v.jsx(Ue,{name:"RAN TODAY",detail:String(L)}),v.jsx(Ue,{name:"TOKENS",detail:es(K),title:K===void 0?"No execution in this window reported token accounting.":void 0}),G&&v.jsxs(v.Fragment,{children:[v.jsx(_f,{label:"MACHINE STRATUM"}),v.jsx(Ue,{name:"PROCESSES OBSERVED",detail:String(G.observed)}),v.jsx(Ue,{name:"SEEN IN LAST 5 MIN",detail:String(G.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:`${I.size} of ${G.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."}),G.exitsInferred>0&&v.jsx(Ue,{name:"EXITS",tag:"inferred",detail:String(G.exitsInferred),title:"An exit is never witnessed by the sampler; it is inferred from disappearance between samples."})]})]})}if(n.kind==="coupling"){const k=i.transfers.get(n.id);if(!k)return null;const O=i.machines.get(k.fromMachineId)?.name??k.fromMachineId,L=i.machines.get(k.toMachineId)?.name??k.toMachineId;return v.jsxs("div",{style:Fc,children:[v.jsx(Hc,{text:`${O} → ${L}`,onClose:f}),v.jsx(Ue,{name:"STATUS",detail:"TRANSFERRING",color:at.running}),v.jsx(Ue,{name:"WHAT",detail:k.label}),v.jsx(Ue,{name:"SIZE",detail:Ix(k.bytes)}),v.jsx(Ue,{name:"ELAPSED",detail:Ye(i.now-k.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(k=>k.id===n.id),x=u==="full"||u!=="compact"&&(l==="proximity"||n.kind==="stratum"),b=x,D=qt(d.measures),V=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(FT,{p:d,now:i.now}),b&&v.jsxs(v.Fragment,{children:[v.jsx(Ue,{name:"TOKENS",detail:es(D),title:D===void 0?"This source does not persist token accounting.":void 0}),v.jsx(Ue,{name:"REQUESTS",detail:String(ff(d))}),v.jsx(Ue,{name:"TOOL CALLS",detail:es(un(d)),title:un(d)===void 0?"This source does not count discrete operations.":void 0})]}),x&&v.jsxs(v.Fragment,{children:[v.jsx("div",{style:{height:4}}),h&&v.jsx(Ue,{name:"CONTEXT",detail:ur(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:X.chromeMid,title:d.model?void 0:"This source does not record the model."}),D!==void 0&&v.jsxs(v.Fragment,{children:[v.jsx(Ue,{name:"CACHE READ",detail:pt(V.cacheRead)}),v.jsx(Ue,{name:"REASONING",detail:pt(V.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:Ye(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(O0,{world:i,subject:{type:"execution",id:d.id}}),h&&v.jsx(O0,{world:i,subject:{type:"session",id:h.id}}),v.jsx(VT,{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:X.chromeMid},children:"stopped before finishing"})]})}function HT({hit:n,world:i}){let s="",l="",u=X.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:X.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 qT(n){return[`${pt(n.requests.value)} REQ`,`${n.sessions.value} SESS`,`${Ye(n.autonomousCompute.value)}`,`${pt(n.tokens.value)} TOK`].join(" · ")}function YT(n){return[`${pt(n.requests.value)} REQUESTS`,`${n.sessions.value} SESSIONS`,`${Ye(n.autonomousCompute.value)} AUTONOMOUS`,`${Ye(n.humanAgentOverlap.value)} OVERLAP`,`PEAK ${n.peakConcurrency.value}`,`${n.contextSwitches.value} SWITCHES`,`${pt(n.tokens.value)} TOK`].join(" · ")}function XT({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:X.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:X.chromeMid,textShadow:Za},children:l},l))}),v.jsx("div",{style:{marginTop:7,fontSize:9.5,lineHeight:1.6,color:X.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:X.chromeDim},children:"·"}),v.jsx("span",{style:{fontSize:10.5,letterSpacing:"0.18em",color:"rgba(230,227,219,0.6)",textShadow:Za},children:s?qT(n):YT(n)})]})]})]})}const KT=560;function z0(n,i,s){return Math.min(n,i)<KT||s?i>=n?"portrait":"landscape":"desktop"}function QT(){const[n,i]=Q.useState(()=>typeof window>"u"?"desktop":z0(window.innerWidth,window.innerHeight,window.matchMedia("(pointer: coarse)").matches));return Q.useEffect(()=>{const s=window.matchMedia("(pointer: coarse)"),l=()=>i(z0(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 Wy=250,Jy=150;function PT(n,i,s,l){return i?n==="landscape"?{right:Wy,bottom:0}:n==="portrait"?{right:0,bottom:s?Math.round(l*.6):Jy}:{right:0,bottom:0}:{right:0,bottom:0}}const ev={fontSize:9,letterSpacing:"0.16em",color:X.chromeMid};function ZT(n){return v.jsxs("div",{style:{position:"absolute",right:0,top:0,bottom:0,width:Wy,boxSizing:"border-box",background:X.panel,borderLeft:`1px solid ${X.panelBorder}`,padding:"16px 16px 14px",display:"flex",flexDirection:"column",gap:10,fontFamily:Et,pointerEvents:"auto"},children:[v.jsx(Uf,{...n,density:"full"}),v.jsx("div",{style:{marginTop:"auto",...ev},children:"TAP FIELD TO DISMISS"})]})}function WT({detent:n,onToggleDetent:i,viewportHeight:s,...l}){const u=n==="expanded",f=u?Math.round(s*.6):Jy;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 ${X.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(Uf,{...l,density:u?"full":"compact"})}),v.jsx("div",{style:{marginTop:"auto",...ev},children:u?"TAP HANDLE TO COLLAPSE":"TAP HANDLE FOR FULL TELEMETRY"})]})}function JT(){return"capture"}function eM(n){return`${n.message}. ${n.remedy} Nothing observed since this appeared has been saved.`}const qc={label:"TODAY",tone:"normal",detail:"Midnight to now."},tM={normal:X.chromeMid,warn:"rgba(240,195,116,0.9)",error:"rgba(206,104,90,0.9)"};function nM(){const n=Date.now(),i=new Date(n);return i.setHours(0,0,0,0),{start:i.getTime(),now:n}}const iM=250,aM={time:0,masses:[],disturbances:[],plinths:[],couplings:[],strata:[]};function sM(){const[n,i]=Q.useState(JT),[s,l]=Q.useState("field"),[u,f]=Q.useState(null),[d,h]=Q.useState(qc),[m,g]=Q.useState(aM),[x,b]=Q.useState(0),[D,V]=Q.useState(null),[k,O]=Q.useState(null),[L,K]=Q.useState("environment"),[G,I]=Q.useState(null),[H,Z]=Q.useState("peek"),de=QT(),M=Q.useRef(Vl(Date.now(),Date.now())),E=Q.useRef(null),B=Q.useRef(null),W=Q.useRef(!1);Q.useEffect(()=>{let w=!1,N=null;h(qc);async function Y(){if(n==="synthetic"||n==="fixture"){let be;if(be=new l1({seed:57}),h({label:"REPLAY",tone:"normal",detail:"A deterministic synthetic day, replayed at speed. Not your telemetry."}),w)return;const yn=be.bounds();M.current=Vl(yn.dayStart,yn.dayEnd),E.current=be,f(be.info()),O(null),V(null),N=be.subscribe(fn=>{Ox(M.current,fn),W.current=!0}),W.current=!0;return}const{start:P,now:ue}=nM();await Xc(P,ue);const fe=await u1();let me=await Kc(P,ue);if(me.world.executions.length===0&&me.world.sessions.length===0){const be=ue-2592e5;await Xc(be,ue),me=await Kc(be,ue),(me.world.executions.length>0||me.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 Ze=Object.entries(fe.observation??{}).flatMap(([be,yn])=>Object.entries(yn.strata).filter(([fn,ee])=>ee==="partial"||ee==="failed"&&fn!=="live-semantics").map(([fn,ee])=>`${be} ${fn} ${ee}`)),De=Object.entries(fe.sources).filter(([,be])=>(be.presence??(be.available?"observing":"not-installed"))==="failed").map(([be])=>be),gn=Object.entries(fe.sources).filter(([,be])=>be.presence==="not-installed").map(([be])=>be),Jn=fe.store.bySource.filter(be=>be.source!=="host"),Mt=fe.health;fe.fault?h({label:"STORE LOST",tone:"error",detail:eM(fe.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."}):fe.mode==="os-only"?h({label:"OS ONLY",tone:"normal",detail:"Observing this machine’s processes. No AI runtime state was found here"+(gn.length?` (looked for ${gn.join(", ")})`:"")+" — that is a valid mode, not a fault. Install or use one and its sessions appear here."}):Jn.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."}):(De.length||Ze.length)&&h({label:"PARTIAL",tone:"warn",detail:[De.length?`Installed but unreadable: ${De.join(", ")}.`:"",Ze.length?`Reduced observation depth: ${Ze.join("; ")}. The computation is still observed; some semantics are not.`:"","Captured history is intact."].filter(Boolean).join(" ")});const Mn=new d1(me,fe,{onTrouble:be=>{if(!w){if(!be)return h(qc);h(be.kind==="store-fault"?{label:"STORE LOST",tone:"error",detail:`${be.message} ${be.detail}`}:{label:"CAPTURE FAILING",tone:"error",detail:`${be.message}. ${be.detail}. The field is showing the last world it received.`})}}});w||(M.current=Vl(me.from,me.to),E.current=Mn,f(Mn.info()),O(null),V(null),N=Mn.subscribe(be=>{M.current=be,W.current=!0}),W.current=!0)}return Y().catch(P=>{w||h({label:"SOURCE FAILED",tone:"error",detail:P instanceof Error?P.message:String(P)})}),()=>{w=!0,E.current=null,N?.()}},[n]),Q.useEffect(()=>{const w=setInterval(()=>{const N=M.current,Y=E.current?.now()??Date.now();if(zx(N,Math.max(N.now,Y)),!W.current)return;W.current=!1;const P=n1(N);g(P),b(ue=>ue+1)},iM);return()=>clearInterval(w)},[]),Q.useEffect(()=>{const w=setInterval(()=>{const N=B.current?.perf.snapshot();N&&I({fps:N.fps,gpuMs:N.gpuMs,scale:N.scale})},1e3);return()=>clearInterval(w)},[]);const te=M.current,le=Q.useMemo(()=>j0(te),[x]),$e=Q.useMemo(()=>G0(te,le),[le]),he=Q.useCallback(w=>V(w),[]),re=Q.useCallback(w=>{const N=m.disturbances.find(P=>P.id===w),Y=m.strata.find(P=>P.id===w);!N&&!Y||(O({kind:N?"disturbance":"stratum",id:w,x:N?.x??0,y:N?.y??0}),l("field"))},[m]),R=k??D,q=de!=="desktop",ae=typeof window>"u"?800:window.innerHeight,Te=Q.useMemo(()=>PT(de,!!k,H==="expanded",ae),[de,k,H,ae]),Re=R&&(!k&&R.kind==="disturbance"?v.jsx("div",{"data-anchor-placement":"label",children:v.jsx(HT,{hit:R,world:te})}):v.jsx("div",{"data-anchor-placement":"panel",children:v.jsx(Uf,{hit:R,world:te,landscape:m,band:L,onClose:()=>O(null)})}));return v.jsxs("div",{style:{position:"fixed",inset:0,display:"flex",flexDirection:"column",background:X.bg,color:X.ink,fontFamily:Et},children:[v.jsx(rM,{view:s,setView:l,feed:n,setFeed:i,sourceInfo:u,window:d}),s==="today"&&v.jsx(UT,{world:te}),s==="log"&&v.jsx(BT,{world:te,selectedId:k?.id??null,onSelect:re}),v.jsx("div",{style:{display:s==="field"?"contents":"none"},children:v.jsx(zT,{landscape:m,onHover:he,onSelect:O,anchor:q?null:R,onBand:K,compact:q,inset:Te,keepVisible:k,overlay:q&&k?de==="landscape"?v.jsx(ZT,{hit:k,world:te,landscape:m,band:L,onClose:()=>O(null)}):v.jsx(WT,{hit:k,world:te,landscape:m,band:L,detent:H,onToggleDetent:()=>Z(w=>w==="peek"?"expanded":"peek"),viewportHeight:ae,onClose:()=>O(null)}):null,onReady:w=>{B.current=w},depth:v.jsx(XT,{metrics:le,shape:$e,compact:q}),children:Re})}),v.jsx(lM,{view:s,perf:G,touch:q})]})}function rM({view:n,setView:i,feed:s,setFeed:l,sourceInfo:u,window:f}){const d=(g,x)=>{const b=n===g;return v.jsx("button",{onClick:()=>i(g),style:{background:"transparent",border:"none",padding:0,cursor:"pointer",fontFamily:Et,letterSpacing:"0.22em",fontSize:b?12.5:9.5,color:b?X.ink:X.chromeDim},children:x},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 ${X.hairline}`,flexWrap:"nowrap",overflow:"hidden"},children:[v.jsx("div",{style:{fontSize:11,letterSpacing:"0.3em",color:"rgba(230,227,219,0.5)",flexShrink:0},children:"057"}),v.jsx("div",{className:"hdr-tagline",style:{fontSize:8.5,letterSpacing:"0.24em",color:X.chromeDim,flexShrink:0,whiteSpace:"nowrap"},children:"PERSONAL COMPUTATIONAL TELEMETRY"}),v.jsx("div",{className:"hdr-tagline",style:{width:1,height:12,background:"rgba(230,227,219,0.12)",flexShrink:0,margin:"0 10px"}}),v.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:20,flexShrink:0},children:[d("field","FIELD"),d("today","TODAY"),d("log","PROCESS LOG")]}),v.jsxs("div",{style:{marginLeft:"auto",display:"flex",alignItems:"center",gap:22,minWidth:0},children:[v.jsxs("div",{title:m,style:{display:"flex",alignItems:"center",gap:9,flexShrink:0,cursor:"help"},children:[v.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:tM[f.tone],flexShrink:0}}),v.jsx("span",{style:{fontSize:10,letterSpacing:"0.2em",color:X.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?X.chromeDim:X.accent},children:h?"○":"●"}),v.jsx("span",{style:{fontSize:9.5,letterSpacing:"0.16em",color:X.chrome},children:h?"SYNTHETIC":"CAPTURE"})]})]})]})}function lM({view:n,perf:i,touch:s}){return v.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:14,padding:"10px 24px 14px",borderTop:`1px solid ${X.hairline}`,fontSize:10.5,letterSpacing:"0.16em",color:X.chrome,flexWrap:"wrap"},children:[v.jsx("span",{children:n==="field"?s?"DRAG TO PAN · PINCH TO ZOOM · TAP TO INSPECT":"SCROLL TO PAN · ⌃SCROLL / PINCH TO ZOOM · CLICK TO INSPECT · ZOOM OUT FOR TODAY":n==="log"?"CLICK A ROW FOR THE FULL RECORD · CLICK A COLUMN TO SORT":"HOVER AN INFERRED MEASURE FOR THE ASSUMPTION BEHIND IT"}),v.jsx("span",{style:{marginLeft:"auto",color:X.chromeDim,fontSize:9.5},children:n==="field"&&i&&i.fps>0?`${Math.round(i.fps)}FPS${i.gpuMs>0?` · ${i.gpuMs.toFixed(1)}MS GPU`:""}${i.scale<1?` · ${Math.round(i.scale*100)}%`:""}`:""})]})}Ex.createRoot(document.getElementById("root")).render(v.jsx(Q.StrictMode,{children:v.jsx(sM,{})}));
|