@sequenza/workbench 1.0.4 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1867 @@
1
+ function wA(e,t){for(var r=0;r<t.length;r++){const i=t[r];if(typeof i!="string"&&!Array.isArray(i)){for(const a in i)if(a!=="default"&&!(a in e)){const l=Object.getOwnPropertyDescriptor(i,a);l&&Object.defineProperty(e,a,l.get?l:{enumerable:!0,get:()=>i[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const a of document.querySelectorAll('link[rel="modulepreload"]'))i(a);new MutationObserver(a=>{for(const l of a)if(l.type==="childList")for(const u of l.addedNodes)u.tagName==="LINK"&&u.rel==="modulepreload"&&i(u)}).observe(document,{childList:!0,subtree:!0});function r(a){const l={};return a.integrity&&(l.integrity=a.integrity),a.referrerPolicy&&(l.referrerPolicy=a.referrerPolicy),a.crossOrigin==="use-credentials"?l.credentials="include":a.crossOrigin==="anonymous"?l.credentials="omit":l.credentials="same-origin",l}function i(a){if(a.ep)return;a.ep=!0;const l=r(a);fetch(a.href,l)}})();function LE(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Em={exports:{}},Ka={};var ab;function CA(){if(ab)return Ka;ab=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.fragment");function r(i,a,l){var u=null;if(l!==void 0&&(u=""+l),a.key!==void 0&&(u=""+a.key),"key"in a){l={};for(var f in a)f!=="key"&&(l[f]=a[f])}else l=a;return a=l.ref,{$$typeof:e,type:i,key:u,ref:a!==void 0?a:null,props:l}}return Ka.Fragment=t,Ka.jsx=r,Ka.jsxs=r,Ka}var lb;function TA(){return lb||(lb=1,Em.exports=CA()),Em.exports}var D=TA(),Sm={exports:{}},Ue={};var cb;function RA(){if(cb)return Ue;cb=1;var e=Symbol.for("react.transitional.element"),t=Symbol.for("react.portal"),r=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),a=Symbol.for("react.profiler"),l=Symbol.for("react.consumer"),u=Symbol.for("react.context"),f=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),v=Symbol.iterator;function x(U){return U===null||typeof U!="object"?null:(U=v&&U[v]||U["@@iterator"],typeof U=="function"?U:null)}var b={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},_=Object.assign,C={};function E(U,V,ee){this.props=U,this.context=V,this.refs=C,this.updater=ee||b}E.prototype.isReactComponent={},E.prototype.setState=function(U,V){if(typeof U!="object"&&typeof U!="function"&&U!=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,U,V,"setState")},E.prototype.forceUpdate=function(U){this.updater.enqueueForceUpdate(this,U,"forceUpdate")};function N(){}N.prototype=E.prototype;function w(U,V,ee){this.props=U,this.context=V,this.refs=C,this.updater=ee||b}var A=w.prototype=new N;A.constructor=w,_(A,E.prototype),A.isPureReactComponent=!0;var M=Array.isArray;function T(){}var O={H:null,A:null,T:null,S:null},I=Object.prototype.hasOwnProperty;function j(U,V,ee){var J=ee.ref;return{$$typeof:e,type:U,key:V,ref:J!==void 0?J:null,props:ee}}function Z(U,V){return j(U.type,V,U.props)}function P(U){return typeof U=="object"&&U!==null&&U.$$typeof===e}function q(U){var V={"=":"=0",":":"=2"};return"$"+U.replace(/[=:]/g,function(ee){return V[ee]})}var G=/\/+/g;function k(U,V){return typeof U=="object"&&U!==null&&U.key!=null?q(""+U.key):V.toString(36)}function F(U){switch(U.status){case"fulfilled":return U.value;case"rejected":throw U.reason;default:switch(typeof U.status=="string"?U.then(T,T):(U.status="pending",U.then(function(V){U.status==="pending"&&(U.status="fulfilled",U.value=V)},function(V){U.status==="pending"&&(U.status="rejected",U.reason=V)})),U.status){case"fulfilled":return U.value;case"rejected":throw U.reason}}throw U}function z(U,V,ee,J,fe){var ye=typeof U;(ye==="undefined"||ye==="boolean")&&(U=null);var he=!1;if(U===null)he=!0;else switch(ye){case"bigint":case"string":case"number":he=!0;break;case"object":switch(U.$$typeof){case e:case t:he=!0;break;case p:return he=U._init,z(he(U._payload),V,ee,J,fe)}}if(he)return fe=fe(U),he=J===""?"."+k(U,0):J,M(fe)?(ee="",he!=null&&(ee=he.replace(G,"$&/")+"/"),z(fe,V,ee,"",function(ve){return ve})):fe!=null&&(P(fe)&&(fe=Z(fe,ee+(fe.key==null||U&&U.key===fe.key?"":(""+fe.key).replace(G,"$&/")+"/")+he)),V.push(fe)),1;he=0;var ae=J===""?".":J+":";if(M(U))for(var be=0;be<U.length;be++)J=U[be],ye=ae+k(J,be),he+=z(J,V,ee,ye,fe);else if(be=x(U),typeof be=="function")for(U=be.call(U),be=0;!(J=U.next()).done;)J=J.value,ye=ae+k(J,be++),he+=z(J,V,ee,ye,fe);else if(ye==="object"){if(typeof U.then=="function")return z(F(U),V,ee,J,fe);throw V=String(U),Error("Objects are not valid as a React child (found: "+(V==="[object Object]"?"object with keys {"+Object.keys(U).join(", ")+"}":V)+"). If you meant to render a collection of children, use an array instead.")}return he}function L(U,V,ee){if(U==null)return U;var J=[],fe=0;return z(U,J,"","",function(ye){return V.call(ee,ye,fe++)}),J}function H(U){if(U._status===-1){var V=U._result;V=V(),V.then(function(ee){(U._status===0||U._status===-1)&&(U._status=1,U._result=ee)},function(ee){(U._status===0||U._status===-1)&&(U._status=2,U._result=ee)}),U._status===-1&&(U._status=0,U._result=V)}if(U._status===1)return U._result.default;throw U._result}var X=typeof reportError=="function"?reportError:function(U){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var V=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof U=="object"&&U!==null&&typeof U.message=="string"?String(U.message):String(U),error:U});if(!window.dispatchEvent(V))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",U);return}console.error(U)},Q={map:L,forEach:function(U,V,ee){L(U,function(){V.apply(this,arguments)},ee)},count:function(U){var V=0;return L(U,function(){V++}),V},toArray:function(U){return L(U,function(V){return V})||[]},only:function(U){if(!P(U))throw Error("React.Children.only expected to receive a single React element child.");return U}};return Ue.Activity=g,Ue.Children=Q,Ue.Component=E,Ue.Fragment=r,Ue.Profiler=a,Ue.PureComponent=w,Ue.StrictMode=i,Ue.Suspense=h,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(U){return O.H.useMemoCache(U)}},Ue.cache=function(U){return function(){return U.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(U,V,ee){if(U==null)throw Error("The argument must be a React element, but you passed "+U+".");var J=_({},U.props),fe=U.key;if(V!=null)for(ye in V.key!==void 0&&(fe=""+V.key),V)!I.call(V,ye)||ye==="key"||ye==="__self"||ye==="__source"||ye==="ref"&&V.ref===void 0||(J[ye]=V[ye]);var ye=arguments.length-2;if(ye===1)J.children=ee;else if(1<ye){for(var he=Array(ye),ae=0;ae<ye;ae++)he[ae]=arguments[ae+2];J.children=he}return j(U.type,fe,J)},Ue.createContext=function(U){return U={$$typeof:u,_currentValue:U,_currentValue2:U,_threadCount:0,Provider:null,Consumer:null},U.Provider=U,U.Consumer={$$typeof:l,_context:U},U},Ue.createElement=function(U,V,ee){var J,fe={},ye=null;if(V!=null)for(J in V.key!==void 0&&(ye=""+V.key),V)I.call(V,J)&&J!=="key"&&J!=="__self"&&J!=="__source"&&(fe[J]=V[J]);var he=arguments.length-2;if(he===1)fe.children=ee;else if(1<he){for(var ae=Array(he),be=0;be<he;be++)ae[be]=arguments[be+2];fe.children=ae}if(U&&U.defaultProps)for(J in he=U.defaultProps,he)fe[J]===void 0&&(fe[J]=he[J]);return j(U,ye,fe)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(U){return{$$typeof:f,render:U}},Ue.isValidElement=P,Ue.lazy=function(U){return{$$typeof:p,_payload:{_status:-1,_result:U},_init:H}},Ue.memo=function(U,V){return{$$typeof:d,type:U,compare:V===void 0?null:V}},Ue.startTransition=function(U){var V=O.T,ee={};O.T=ee;try{var J=U(),fe=O.S;fe!==null&&fe(ee,J),typeof J=="object"&&J!==null&&typeof J.then=="function"&&J.then(T,X)}catch(ye){X(ye)}finally{V!==null&&ee.types!==null&&(V.types=ee.types),O.T=V}},Ue.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Ue.use=function(U){return O.H.use(U)},Ue.useActionState=function(U,V,ee){return O.H.useActionState(U,V,ee)},Ue.useCallback=function(U,V){return O.H.useCallback(U,V)},Ue.useContext=function(U){return O.H.useContext(U)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(U,V){return O.H.useDeferredValue(U,V)},Ue.useEffect=function(U,V){return O.H.useEffect(U,V)},Ue.useEffectEvent=function(U){return O.H.useEffectEvent(U)},Ue.useId=function(){return O.H.useId()},Ue.useImperativeHandle=function(U,V,ee){return O.H.useImperativeHandle(U,V,ee)},Ue.useInsertionEffect=function(U,V){return O.H.useInsertionEffect(U,V)},Ue.useLayoutEffect=function(U,V){return O.H.useLayoutEffect(U,V)},Ue.useMemo=function(U,V){return O.H.useMemo(U,V)},Ue.useOptimistic=function(U,V){return O.H.useOptimistic(U,V)},Ue.useReducer=function(U,V,ee){return O.H.useReducer(U,V,ee)},Ue.useRef=function(U){return O.H.useRef(U)},Ue.useState=function(U){return O.H.useState(U)},Ue.useSyncExternalStore=function(U,V,ee){return O.H.useSyncExternalStore(U,V,ee)},Ue.useTransition=function(){return O.H.useTransition()},Ue.version="19.2.4",Ue}var ub;function Bl(){return ub||(ub=1,Sm.exports=RA()),Sm.exports}var R=Bl();const kE=LE(R),IE=wA({__proto__:null,default:kE},[R]);var wm={exports:{}},Za={},Cm={exports:{}},Tm={};var fb;function AA(){return fb||(fb=1,(function(e){function t(z,L){var H=z.length;z.push(L);e:for(;0<H;){var X=H-1>>>1,Q=z[X];if(0<a(Q,L))z[X]=L,z[H]=Q,H=X;else break e}}function r(z){return z.length===0?null:z[0]}function i(z){if(z.length===0)return null;var L=z[0],H=z.pop();if(H!==L){z[0]=H;e:for(var X=0,Q=z.length,U=Q>>>1;X<U;){var V=2*(X+1)-1,ee=z[V],J=V+1,fe=z[J];if(0>a(ee,H))J<Q&&0>a(fe,ee)?(z[X]=fe,z[J]=H,X=J):(z[X]=ee,z[V]=H,X=V);else if(J<Q&&0>a(fe,H))z[X]=fe,z[J]=H,X=J;else break e}}return L}function a(z,L){var H=z.sortIndex-L.sortIndex;return H!==0?H:z.id-L.id}if(e.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var l=performance;e.unstable_now=function(){return l.now()}}else{var u=Date,f=u.now();e.unstable_now=function(){return u.now()-f}}var h=[],d=[],p=1,g=null,v=3,x=!1,b=!1,_=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,N=typeof clearTimeout=="function"?clearTimeout:null,w=typeof setImmediate<"u"?setImmediate:null;function A(z){for(var L=r(d);L!==null;){if(L.callback===null)i(d);else if(L.startTime<=z)i(d),L.sortIndex=L.expirationTime,t(h,L);else break;L=r(d)}}function M(z){if(_=!1,A(z),!b)if(r(h)!==null)b=!0,T||(T=!0,q());else{var L=r(d);L!==null&&F(M,L.startTime-z)}}var T=!1,O=-1,I=5,j=-1;function Z(){return C?!0:!(e.unstable_now()-j<I)}function P(){if(C=!1,T){var z=e.unstable_now();j=z;var L=!0;try{e:{b=!1,_&&(_=!1,N(O),O=-1),x=!0;var H=v;try{t:{for(A(z),g=r(h);g!==null&&!(g.expirationTime>z&&Z());){var X=g.callback;if(typeof X=="function"){g.callback=null,v=g.priorityLevel;var Q=X(g.expirationTime<=z);if(z=e.unstable_now(),typeof Q=="function"){g.callback=Q,A(z),L=!0;break t}g===r(h)&&i(h),A(z)}else i(h);g=r(h)}if(g!==null)L=!0;else{var U=r(d);U!==null&&F(M,U.startTime-z),L=!1}}break e}finally{g=null,v=H,x=!1}L=void 0}}finally{L?q():T=!1}}}var q;if(typeof w=="function")q=function(){w(P)};else if(typeof MessageChannel<"u"){var G=new MessageChannel,k=G.port2;G.port1.onmessage=P,q=function(){k.postMessage(null)}}else q=function(){E(P,0)};function F(z,L){O=E(function(){z(e.unstable_now())},L)}e.unstable_IdlePriority=5,e.unstable_ImmediatePriority=1,e.unstable_LowPriority=4,e.unstable_NormalPriority=3,e.unstable_Profiling=null,e.unstable_UserBlockingPriority=2,e.unstable_cancelCallback=function(z){z.callback=null},e.unstable_forceFrameRate=function(z){0>z||125<z?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<z?Math.floor(1e3/z):5},e.unstable_getCurrentPriorityLevel=function(){return v},e.unstable_next=function(z){switch(v){case 1:case 2:case 3:var L=3;break;default:L=v}var H=v;v=L;try{return z()}finally{v=H}},e.unstable_requestPaint=function(){C=!0},e.unstable_runWithPriority=function(z,L){switch(z){case 1:case 2:case 3:case 4:case 5:break;default:z=3}var H=v;v=z;try{return L()}finally{v=H}},e.unstable_scheduleCallback=function(z,L,H){var X=e.unstable_now();switch(typeof H=="object"&&H!==null?(H=H.delay,H=typeof H=="number"&&0<H?X+H:X):H=X,z){case 1:var Q=-1;break;case 2:Q=250;break;case 5:Q=1073741823;break;case 4:Q=1e4;break;default:Q=5e3}return Q=H+Q,z={id:p++,callback:L,priorityLevel:z,startTime:H,expirationTime:Q,sortIndex:-1},H>X?(z.sortIndex=H,t(d,z),r(h)===null&&z===r(d)&&(_?(N(O),O=-1):_=!0,F(M,H-X))):(z.sortIndex=Q,t(h,z),b||x||(b=!0,T||(T=!0,q()))),z},e.unstable_shouldYield=Z,e.unstable_wrapCallback=function(z){var L=v;return function(){var H=v;v=L;try{return z.apply(this,arguments)}finally{v=H}}}})(Tm)),Tm}var db;function NA(){return db||(db=1,Cm.exports=AA()),Cm.exports}var Rm={exports:{}},en={};var hb;function MA(){if(hb)return en;hb=1;var e=Bl();function t(h){var d="https://react.dev/errors/"+h;if(1<arguments.length){d+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)d+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+h+"; visit "+d+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function r(){}var i={d:{f:r,r:function(){throw Error(t(522))},D:r,C:r,L:r,m:r,X:r,S:r,M:r},p:0,findDOMNode:null},a=Symbol.for("react.portal");function l(h,d,p){var g=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:a,key:g==null?null:""+g,children:h,containerInfo:d,implementation:p}}var u=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function f(h,d){if(h==="font")return"";if(typeof d=="string")return d==="use-credentials"?d:""}return en.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,en.createPortal=function(h,d){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!d||d.nodeType!==1&&d.nodeType!==9&&d.nodeType!==11)throw Error(t(299));return l(h,d,null,p)},en.flushSync=function(h){var d=u.T,p=i.p;try{if(u.T=null,i.p=2,h)return h()}finally{u.T=d,i.p=p,i.d.f()}},en.preconnect=function(h,d){typeof h=="string"&&(d?(d=d.crossOrigin,d=typeof d=="string"?d==="use-credentials"?d:"":void 0):d=null,i.d.C(h,d))},en.prefetchDNS=function(h){typeof h=="string"&&i.d.D(h)},en.preinit=function(h,d){if(typeof h=="string"&&d&&typeof d.as=="string"){var p=d.as,g=f(p,d.crossOrigin),v=typeof d.integrity=="string"?d.integrity:void 0,x=typeof d.fetchPriority=="string"?d.fetchPriority:void 0;p==="style"?i.d.S(h,typeof d.precedence=="string"?d.precedence:void 0,{crossOrigin:g,integrity:v,fetchPriority:x}):p==="script"&&i.d.X(h,{crossOrigin:g,integrity:v,fetchPriority:x,nonce:typeof d.nonce=="string"?d.nonce:void 0})}},en.preinitModule=function(h,d){if(typeof h=="string")if(typeof d=="object"&&d!==null){if(d.as==null||d.as==="script"){var p=f(d.as,d.crossOrigin);i.d.M(h,{crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0})}}else d==null&&i.d.M(h)},en.preload=function(h,d){if(typeof h=="string"&&typeof d=="object"&&d!==null&&typeof d.as=="string"){var p=d.as,g=f(p,d.crossOrigin);i.d.L(h,p,{crossOrigin:g,integrity:typeof d.integrity=="string"?d.integrity:void 0,nonce:typeof d.nonce=="string"?d.nonce:void 0,type:typeof d.type=="string"?d.type:void 0,fetchPriority:typeof d.fetchPriority=="string"?d.fetchPriority:void 0,referrerPolicy:typeof d.referrerPolicy=="string"?d.referrerPolicy:void 0,imageSrcSet:typeof d.imageSrcSet=="string"?d.imageSrcSet:void 0,imageSizes:typeof d.imageSizes=="string"?d.imageSizes:void 0,media:typeof d.media=="string"?d.media:void 0})}},en.preloadModule=function(h,d){if(typeof h=="string")if(d){var p=f(d.as,d.crossOrigin);i.d.m(h,{as:typeof d.as=="string"&&d.as!=="script"?d.as:void 0,crossOrigin:p,integrity:typeof d.integrity=="string"?d.integrity:void 0})}else i.d.m(h)},en.requestFormReset=function(h){i.d.r(h)},en.unstable_batchedUpdates=function(h,d){return h(d)},en.useFormState=function(h,d,p){return u.H.useFormState(h,d,p)},en.useFormStatus=function(){return u.H.useHostTransitionStatus()},en.version="19.2.4",en}var mb;function HE(){if(mb)return Rm.exports;mb=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),Rm.exports=MA(),Rm.exports}var pb;function OA(){if(pb)return Za;pb=1;var e=NA(),t=Bl(),r=HE();function i(n){var o="https://react.dev/errors/"+n;if(1<arguments.length){o+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)o+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+n+"; visit "+o+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function a(n){return!(!n||n.nodeType!==1&&n.nodeType!==9&&n.nodeType!==11)}function l(n){var o=n,s=n;if(n.alternate)for(;o.return;)o=o.return;else{n=o;do o=n,(o.flags&4098)!==0&&(s=o.return),n=o.return;while(n)}return o.tag===3?s:null}function u(n){if(n.tag===13){var o=n.memoizedState;if(o===null&&(n=n.alternate,n!==null&&(o=n.memoizedState)),o!==null)return o.dehydrated}return null}function f(n){if(n.tag===31){var o=n.memoizedState;if(o===null&&(n=n.alternate,n!==null&&(o=n.memoizedState)),o!==null)return o.dehydrated}return null}function h(n){if(l(n)!==n)throw Error(i(188))}function d(n){var o=n.alternate;if(!o){if(o=l(n),o===null)throw Error(i(188));return o!==n?null:n}for(var s=n,c=o;;){var m=s.return;if(m===null)break;var y=m.alternate;if(y===null){if(c=m.return,c!==null){s=c;continue}break}if(m.child===y.child){for(y=m.child;y;){if(y===s)return h(m),n;if(y===c)return h(m),o;y=y.sibling}throw Error(i(188))}if(s.return!==c.return)s=m,c=y;else{for(var S=!1,B=m.child;B;){if(B===s){S=!0,s=m,c=y;break}if(B===c){S=!0,c=m,s=y;break}B=B.sibling}if(!S){for(B=y.child;B;){if(B===s){S=!0,s=y,c=m;break}if(B===c){S=!0,c=y,s=m;break}B=B.sibling}if(!S)throw Error(i(189))}}if(s.alternate!==c)throw Error(i(190))}if(s.tag!==3)throw Error(i(188));return s.stateNode.current===s?n:o}function p(n){var o=n.tag;if(o===5||o===26||o===27||o===6)return n;for(n=n.child;n!==null;){if(o=p(n),o!==null)return o;n=n.sibling}return null}var g=Object.assign,v=Symbol.for("react.element"),x=Symbol.for("react.transitional.element"),b=Symbol.for("react.portal"),_=Symbol.for("react.fragment"),C=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),N=Symbol.for("react.consumer"),w=Symbol.for("react.context"),A=Symbol.for("react.forward_ref"),M=Symbol.for("react.suspense"),T=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),I=Symbol.for("react.lazy"),j=Symbol.for("react.activity"),Z=Symbol.for("react.memo_cache_sentinel"),P=Symbol.iterator;function q(n){return n===null||typeof n!="object"?null:(n=P&&n[P]||n["@@iterator"],typeof n=="function"?n:null)}var G=Symbol.for("react.client.reference");function k(n){if(n==null)return null;if(typeof n=="function")return n.$$typeof===G?null:n.displayName||n.name||null;if(typeof n=="string")return n;switch(n){case _:return"Fragment";case E:return"Profiler";case C:return"StrictMode";case M:return"Suspense";case T:return"SuspenseList";case j:return"Activity"}if(typeof n=="object")switch(n.$$typeof){case b:return"Portal";case w:return n.displayName||"Context";case N:return(n._context.displayName||"Context")+".Consumer";case A:var o=n.render;return n=n.displayName,n||(n=o.displayName||o.name||"",n=n!==""?"ForwardRef("+n+")":"ForwardRef"),n;case O:return o=n.displayName||null,o!==null?o:k(n.type)||"Memo";case I:o=n._payload,n=n._init;try{return k(n(o))}catch{}}return null}var F=Array.isArray,z=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,L=r.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,H={pending:!1,data:null,method:null,action:null},X=[],Q=-1;function U(n){return{current:n}}function V(n){0>Q||(n.current=X[Q],X[Q]=null,Q--)}function ee(n,o){Q++,X[Q]=n.current,n.current=o}var J=U(null),fe=U(null),ye=U(null),he=U(null);function ae(n,o){switch(ee(ye,o),ee(fe,n),ee(J,null),o.nodeType){case 9:case 11:n=(n=o.documentElement)&&(n=n.namespaceURI)?Mx(n):0;break;default:if(n=o.tagName,o=o.namespaceURI)o=Mx(o),n=Ox(o,n);else switch(n){case"svg":n=1;break;case"math":n=2;break;default:n=0}}V(J),ee(J,n)}function be(){V(J),V(fe),V(ye)}function ve(n){n.memoizedState!==null&&ee(he,n);var o=J.current,s=Ox(o,n.type);o!==s&&(ee(fe,n),ee(J,s))}function Te(n){fe.current===n&&(V(J),V(fe)),he.current===n&&(V(he),qa._currentValue=H)}var we,xe;function Ee(n){if(we===void 0)try{throw Error()}catch(s){var o=s.stack.trim().match(/\n( *(at )?)/);we=o&&o[1]||"",xe=-1<s.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<s.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+we+n+xe}var Ce=!1;function ie(n,o){if(!n||Ce)return"";Ce=!0;var s=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var c={DetermineComponentFrameRoot:function(){try{if(o){var pe=function(){throw Error()};if(Object.defineProperty(pe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(pe,[])}catch(ce){var oe=ce}Reflect.construct(n,[],pe)}else{try{pe.call()}catch(ce){oe=ce}n.call(pe.prototype)}}else{try{throw Error()}catch(ce){oe=ce}(pe=n())&&typeof pe.catch=="function"&&pe.catch(function(){})}}catch(ce){if(ce&&oe&&typeof ce.stack=="string")return[ce.stack,oe.stack]}return[null,null]}};c.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var m=Object.getOwnPropertyDescriptor(c.DetermineComponentFrameRoot,"name");m&&m.configurable&&Object.defineProperty(c.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var y=c.DetermineComponentFrameRoot(),S=y[0],B=y[1];if(S&&B){var Y=S.split(`
4
+ `),ne=B.split(`
5
+ `);for(m=c=0;c<Y.length&&!Y[c].includes("DetermineComponentFrameRoot");)c++;for(;m<ne.length&&!ne[m].includes("DetermineComponentFrameRoot");)m++;if(c===Y.length||m===ne.length)for(c=Y.length-1,m=ne.length-1;1<=c&&0<=m&&Y[c]!==ne[m];)m--;for(;1<=c&&0<=m;c--,m--)if(Y[c]!==ne[m]){if(c!==1||m!==1)do if(c--,m--,0>m||Y[c]!==ne[m]){var de=`
6
+ `+Y[c].replace(" at new "," at ");return n.displayName&&de.includes("<anonymous>")&&(de=de.replace("<anonymous>",n.displayName)),de}while(1<=c&&0<=m);break}}}finally{Ce=!1,Error.prepareStackTrace=s}return(s=n?n.displayName||n.name:"")?Ee(s):""}function re(n,o){switch(n.tag){case 26:case 27:case 5:return Ee(n.type);case 16:return Ee("Lazy");case 13:return n.child!==o&&o!==null?Ee("Suspense Fallback"):Ee("Suspense");case 19:return Ee("SuspenseList");case 0:case 15:return ie(n.type,!1);case 11:return ie(n.type.render,!1);case 1:return ie(n.type,!0);case 31:return Ee("Activity");default:return""}}function ue(n){try{var o="",s=null;do o+=re(n,s),s=n,n=n.return;while(n);return o}catch(c){return`
7
+ Error generating stack: `+c.message+`
8
+ `+c.stack}}var le=Object.prototype.hasOwnProperty,se=e.unstable_scheduleCallback,K=e.unstable_cancelCallback,ge=e.unstable_shouldYield,Se=e.unstable_requestPaint,_e=e.unstable_now,Je=e.unstable_getCurrentPriorityLevel,st=e.unstable_ImmediatePriority,ft=e.unstable_UserBlockingPriority,at=e.unstable_NormalPriority,Qe=e.unstable_LowPriority,He=e.unstable_IdlePriority,_t=e.log,an=e.unstable_setDisableYieldValue,ze=null,Oe=null;function rt(n){if(typeof _t=="function"&&an(n),Oe&&typeof Oe.setStrictMode=="function")try{Oe.setStrictMode(ze,n)}catch{}}var wt=Math.clz32?Math.clz32:qt,Ze=Math.log,Ct=Math.LN2;function qt(n){return n>>>=0,n===0?32:31-(Ze(n)/Ct|0)|0}var Et=256,Pt=262144,Ot=4194304;function $t(n){var o=n&42;if(o!==0)return o;switch(n&-n){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 n&261888;case 262144:case 524288:case 1048576:case 2097152:return n&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return n&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return n}}function _n(n,o,s){var c=n.pendingLanes;if(c===0)return 0;var m=0,y=n.suspendedLanes,S=n.pingedLanes;n=n.warmLanes;var B=c&134217727;return B!==0?(c=B&~y,c!==0?m=$t(c):(S&=B,S!==0?m=$t(S):s||(s=B&~n,s!==0&&(m=$t(s))))):(B=c&~y,B!==0?m=$t(B):S!==0?m=$t(S):s||(s=c&~n,s!==0&&(m=$t(s)))),m===0?0:o!==0&&o!==m&&(o&y)===0&&(y=m&-m,s=o&-o,y>=s||y===32&&(s&4194048)!==0)?o:m}function Un(n,o){return(n.pendingLanes&~(n.suspendedLanes&~n.pingedLanes)&o)===0}function ni(n,o){switch(n){case 1:case 2:case 4:case 8:case 64:return o+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 o+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 so(){var n=Ot;return Ot<<=1,(Ot&62914560)===0&&(Ot=4194304),n}function Nr(n){for(var o=[],s=0;31>s;s++)o.push(n);return o}function Mr(n,o){n.pendingLanes|=o,o!==268435456&&(n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0)}function ri(n,o,s,c,m,y){var S=n.pendingLanes;n.pendingLanes=s,n.suspendedLanes=0,n.pingedLanes=0,n.warmLanes=0,n.expiredLanes&=s,n.entangledLanes&=s,n.errorRecoveryDisabledLanes&=s,n.shellSuspendCounter=0;var B=n.entanglements,Y=n.expirationTimes,ne=n.hiddenUpdates;for(s=S&~s;0<s;){var de=31-wt(s),pe=1<<de;B[de]=0,Y[de]=-1;var oe=ne[de];if(oe!==null)for(ne[de]=null,de=0;de<oe.length;de++){var ce=oe[de];ce!==null&&(ce.lane&=-536870913)}s&=~pe}c!==0&&oi(n,c,0),y!==0&&m===0&&n.tag!==0&&(n.suspendedLanes|=y&~(S&~o))}function oi(n,o,s){n.pendingLanes|=o,n.suspendedLanes&=~o;var c=31-wt(o);n.entangledLanes|=o,n.entanglements[c]=n.entanglements[c]|1073741824|s&261930}function Gi(n,o){var s=n.entangledLanes|=o;for(n=n.entanglements;s;){var c=31-wt(s),m=1<<c;m&o|n[c]&o&&(n[c]|=o),s&=~m}}function qi(n,o){var s=o&-o;return s=(s&42)!==0?1:Yn(s),(s&(n.suspendedLanes|o))!==0?0:s}function Yn(n){switch(n){case 2:n=1;break;case 8:n=4;break;case 32:n=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:n=128;break;case 268435456:n=134217728;break;default:n=0}return n}function ii(n){return n&=-n,2<n?8<n?(n&134217727)!==0?32:268435456:8:2}function Yi(){var n=L.p;return n!==0?n:(n=window.event,n===void 0?32:eb(n.type))}function Xi(n,o){var s=L.p;try{return L.p=n,o()}finally{L.p=s}}var lr=Math.random().toString(36).slice(2),jt="__reactFiber$"+lr,Jt="__reactProps$"+lr,Or="__reactContainer$"+lr,$i="__reactEvents$"+lr,Zl="__reactListeners$"+lr,hd="__reactHandles$"+lr,Ql="__reactResources$"+lr,si="__reactMarker$"+lr;function ia(n){delete n[jt],delete n[Jt],delete n[$i],delete n[Zl],delete n[hd]}function ao(n){var o=n[jt];if(o)return o;for(var s=n.parentNode;s;){if(o=s[Or]||s[jt]){if(s=o.alternate,o.child!==null||s!==null&&s.child!==null)for(n=Ix(n);n!==null;){if(s=n[jt])return s;n=Ix(n)}return o}n=s,s=n.parentNode}return null}function lo(n){if(n=n[jt]||n[Or]){var o=n.tag;if(o===5||o===6||o===13||o===31||o===26||o===27||o===3)return n}return null}function co(n){var o=n.tag;if(o===5||o===26||o===27||o===6)return n.stateNode;throw Error(i(33))}function uo(n){var o=n[Ql];return o||(o=n[Ql]={hoistableStyles:new Map,hoistableScripts:new Map}),o}function Dt(n){n[si]=!0}var Wl=new Set,Jl={};function Dr(n,o){fo(n,o),fo(n+"Capture",o)}function fo(n,o){for(Jl[n]=o,n=0;n<o.length;n++)Wl.add(o[n])}var md=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]*$"),sa={},ec={};function pd(n){return le.call(ec,n)?!0:le.call(sa,n)?!1:md.test(n)?ec[n]=!0:(sa[n]=!0,!1)}function Ki(n,o,s){if(pd(o))if(s===null)n.removeAttribute(o);else{switch(typeof s){case"undefined":case"function":case"symbol":n.removeAttribute(o);return;case"boolean":var c=o.toLowerCase().slice(0,5);if(c!=="data-"&&c!=="aria-"){n.removeAttribute(o);return}}n.setAttribute(o,""+s)}}function Zi(n,o,s){if(s===null)n.removeAttribute(o);else{switch(typeof s){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(o);return}n.setAttribute(o,""+s)}}function Xn(n,o,s,c){if(c===null)n.removeAttribute(s);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":n.removeAttribute(s);return}n.setAttributeNS(o,s,""+c)}}function ln(n){switch(typeof n){case"bigint":case"boolean":case"number":case"string":case"undefined":return n;case"object":return n;default:return""}}function tc(n){var o=n.type;return(n=n.nodeName)&&n.toLowerCase()==="input"&&(o==="checkbox"||o==="radio")}function gd(n,o,s){var c=Object.getOwnPropertyDescriptor(n.constructor.prototype,o);if(!n.hasOwnProperty(o)&&typeof c<"u"&&typeof c.get=="function"&&typeof c.set=="function"){var m=c.get,y=c.set;return Object.defineProperty(n,o,{configurable:!0,get:function(){return m.call(this)},set:function(S){s=""+S,y.call(this,S)}}),Object.defineProperty(n,o,{enumerable:c.enumerable}),{getValue:function(){return s},setValue:function(S){s=""+S},stopTracking:function(){n._valueTracker=null,delete n[o]}}}}function Qi(n){if(!n._valueTracker){var o=tc(n)?"checked":"value";n._valueTracker=gd(n,o,""+n[o])}}function nc(n){if(!n)return!1;var o=n._valueTracker;if(!o)return!0;var s=o.getValue(),c="";return n&&(c=tc(n)?n.checked?"true":"false":n.value),n=c,n!==s?(o.setValue(n),!0):!1}function ai(n){if(n=n||(typeof document<"u"?document:void 0),typeof n>"u")return null;try{return n.activeElement||n.body}catch{return n.body}}var yd=/[\n"\\]/g;function cn(n){return n.replace(yd,function(o){return"\\"+o.charCodeAt(0).toString(16)+" "})}function li(n,o,s,c,m,y,S,B){n.name="",S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"?n.type=S:n.removeAttribute("type"),o!=null?S==="number"?(o===0&&n.value===""||n.value!=o)&&(n.value=""+ln(o)):n.value!==""+ln(o)&&(n.value=""+ln(o)):S!=="submit"&&S!=="reset"||n.removeAttribute("value"),o!=null?aa(n,S,ln(o)):s!=null?aa(n,S,ln(s)):c!=null&&n.removeAttribute("value"),m==null&&y!=null&&(n.defaultChecked=!!y),m!=null&&(n.checked=m&&typeof m!="function"&&typeof m!="symbol"),B!=null&&typeof B!="function"&&typeof B!="symbol"&&typeof B!="boolean"?n.name=""+ln(B):n.removeAttribute("name")}function rc(n,o,s,c,m,y,S,B){if(y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(n.type=y),o!=null||s!=null){if(!(y!=="submit"&&y!=="reset"||o!=null)){Qi(n);return}s=s!=null?""+ln(s):"",o=o!=null?""+ln(o):s,B||o===n.value||(n.value=o),n.defaultValue=o}c=c??m,c=typeof c!="function"&&typeof c!="symbol"&&!!c,n.checked=B?n.checked:!!c,n.defaultChecked=!!c,S!=null&&typeof S!="function"&&typeof S!="symbol"&&typeof S!="boolean"&&(n.name=S),Qi(n)}function aa(n,o,s){o==="number"&&ai(n.ownerDocument)===n||n.defaultValue===""+s||(n.defaultValue=""+s)}function zr(n,o,s,c){if(n=n.options,o){o={};for(var m=0;m<s.length;m++)o["$"+s[m]]=!0;for(s=0;s<n.length;s++)m=o.hasOwnProperty("$"+n[s].value),n[s].selected!==m&&(n[s].selected=m),m&&c&&(n[s].defaultSelected=!0)}else{for(s=""+ln(s),o=null,m=0;m<n.length;m++){if(n[m].value===s){n[m].selected=!0,c&&(n[m].defaultSelected=!0);return}o!==null||n[m].disabled||(o=n[m])}o!==null&&(o.selected=!0)}}function Cg(n,o,s){if(o!=null&&(o=""+ln(o),o!==n.value&&(n.value=o),s==null)){n.defaultValue!==o&&(n.defaultValue=o);return}n.defaultValue=s!=null?""+ln(s):""}function Tg(n,o,s,c){if(o==null){if(c!=null){if(s!=null)throw Error(i(92));if(F(c)){if(1<c.length)throw Error(i(93));c=c[0]}s=c}s==null&&(s=""),o=s}s=ln(o),n.defaultValue=s,c=n.textContent,c===s&&c!==""&&c!==null&&(n.value=c),Qi(n)}function Wi(n,o){if(o){var s=n.firstChild;if(s&&s===n.lastChild&&s.nodeType===3){s.nodeValue=o;return}}n.textContent=o}var xT=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 Rg(n,o,s){var c=o.indexOf("--")===0;s==null||typeof s=="boolean"||s===""?c?n.setProperty(o,""):o==="float"?n.cssFloat="":n[o]="":c?n.setProperty(o,s):typeof s!="number"||s===0||xT.has(o)?o==="float"?n.cssFloat=s:n[o]=(""+s).trim():n[o]=s+"px"}function Ag(n,o,s){if(o!=null&&typeof o!="object")throw Error(i(62));if(n=n.style,s!=null){for(var c in s)!s.hasOwnProperty(c)||o!=null&&o.hasOwnProperty(c)||(c.indexOf("--")===0?n.setProperty(c,""):c==="float"?n.cssFloat="":n[c]="");for(var m in o)c=o[m],o.hasOwnProperty(m)&&s[m]!==c&&Rg(n,m,c)}else for(var y in o)o.hasOwnProperty(y)&&Rg(n,y,o[y])}function vd(n){if(n.indexOf("-")===-1)return!1;switch(n){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 bT=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"]]),_T=/^[\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 oc(n){return _T.test(""+n)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":n}function Br(){}var xd=null;function bd(n){return n=n.target||n.srcElement||window,n.correspondingUseElement&&(n=n.correspondingUseElement),n.nodeType===3?n.parentNode:n}var Ji=null,es=null;function Ng(n){var o=lo(n);if(o&&(n=o.stateNode)){var s=n[Jt]||null;e:switch(n=o.stateNode,o.type){case"input":if(li(n,s.value,s.defaultValue,s.defaultValue,s.checked,s.defaultChecked,s.type,s.name),o=s.name,s.type==="radio"&&o!=null){for(s=n;s.parentNode;)s=s.parentNode;for(s=s.querySelectorAll('input[name="'+cn(""+o)+'"][type="radio"]'),o=0;o<s.length;o++){var c=s[o];if(c!==n&&c.form===n.form){var m=c[Jt]||null;if(!m)throw Error(i(90));li(c,m.value,m.defaultValue,m.defaultValue,m.checked,m.defaultChecked,m.type,m.name)}}for(o=0;o<s.length;o++)c=s[o],c.form===n.form&&nc(c)}break e;case"textarea":Cg(n,s.value,s.defaultValue);break e;case"select":o=s.value,o!=null&&zr(n,!!s.multiple,o,!1)}}}var _d=!1;function Mg(n,o,s){if(_d)return n(o,s);_d=!0;try{var c=n(o);return c}finally{if(_d=!1,(Ji!==null||es!==null)&&(qc(),Ji&&(o=Ji,n=es,es=Ji=null,Ng(o),n)))for(o=0;o<n.length;o++)Ng(n[o])}}function la(n,o){var s=n.stateNode;if(s===null)return null;var c=s[Jt]||null;if(c===null)return null;s=c[o];e:switch(o){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(c=!c.disabled)||(n=n.type,c=!(n==="button"||n==="input"||n==="select"||n==="textarea")),n=!c;break e;default:n=!1}if(n)return null;if(s&&typeof s!="function")throw Error(i(231,o,typeof s));return s}var Ur=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Ed=!1;if(Ur)try{var ca={};Object.defineProperty(ca,"passive",{get:function(){Ed=!0}}),window.addEventListener("test",ca,ca),window.removeEventListener("test",ca,ca)}catch{Ed=!1}var ho=null,Sd=null,ic=null;function Og(){if(ic)return ic;var n,o=Sd,s=o.length,c,m="value"in ho?ho.value:ho.textContent,y=m.length;for(n=0;n<s&&o[n]===m[n];n++);var S=s-n;for(c=1;c<=S&&o[s-c]===m[y-c];c++);return ic=m.slice(n,1<c?1-c:void 0)}function sc(n){var o=n.keyCode;return"charCode"in n?(n=n.charCode,n===0&&o===13&&(n=13)):n=o,n===10&&(n=13),32<=n||n===13?n:0}function ac(){return!0}function Dg(){return!1}function un(n){function o(s,c,m,y,S){this._reactName=s,this._targetInst=m,this.type=c,this.nativeEvent=y,this.target=S,this.currentTarget=null;for(var B in n)n.hasOwnProperty(B)&&(s=n[B],this[B]=s?s(y):y[B]);return this.isDefaultPrevented=(y.defaultPrevented!=null?y.defaultPrevented:y.returnValue===!1)?ac:Dg,this.isPropagationStopped=Dg,this}return g(o.prototype,{preventDefault:function(){this.defaultPrevented=!0;var s=this.nativeEvent;s&&(s.preventDefault?s.preventDefault():typeof s.returnValue!="unknown"&&(s.returnValue=!1),this.isDefaultPrevented=ac)},stopPropagation:function(){var s=this.nativeEvent;s&&(s.stopPropagation?s.stopPropagation():typeof s.cancelBubble!="unknown"&&(s.cancelBubble=!0),this.isPropagationStopped=ac)},persist:function(){},isPersistent:ac}),o}var ci={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(n){return n.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},lc=un(ci),ua=g({},ci,{view:0,detail:0}),ET=un(ua),wd,Cd,fa,cc=g({},ua,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Rd,button:0,buttons:0,relatedTarget:function(n){return n.relatedTarget===void 0?n.fromElement===n.srcElement?n.toElement:n.fromElement:n.relatedTarget},movementX:function(n){return"movementX"in n?n.movementX:(n!==fa&&(fa&&n.type==="mousemove"?(wd=n.screenX-fa.screenX,Cd=n.screenY-fa.screenY):Cd=wd=0,fa=n),wd)},movementY:function(n){return"movementY"in n?n.movementY:Cd}}),zg=un(cc),ST=g({},cc,{dataTransfer:0}),wT=un(ST),CT=g({},ua,{relatedTarget:0}),Td=un(CT),TT=g({},ci,{animationName:0,elapsedTime:0,pseudoElement:0}),RT=un(TT),AT=g({},ci,{clipboardData:function(n){return"clipboardData"in n?n.clipboardData:window.clipboardData}}),NT=un(AT),MT=g({},ci,{data:0}),Bg=un(MT),OT={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},DT={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"},zT={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function BT(n){var o=this.nativeEvent;return o.getModifierState?o.getModifierState(n):(n=zT[n])?!!o[n]:!1}function Rd(){return BT}var UT=g({},ua,{key:function(n){if(n.key){var o=OT[n.key]||n.key;if(o!=="Unidentified")return o}return n.type==="keypress"?(n=sc(n),n===13?"Enter":String.fromCharCode(n)):n.type==="keydown"||n.type==="keyup"?DT[n.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Rd,charCode:function(n){return n.type==="keypress"?sc(n):0},keyCode:function(n){return n.type==="keydown"||n.type==="keyup"?n.keyCode:0},which:function(n){return n.type==="keypress"?sc(n):n.type==="keydown"||n.type==="keyup"?n.keyCode:0}}),LT=un(UT),kT=g({},cc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Ug=un(kT),IT=g({},ua,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Rd}),HT=un(IT),FT=g({},ci,{propertyName:0,elapsedTime:0,pseudoElement:0}),PT=un(FT),jT=g({},cc,{deltaX:function(n){return"deltaX"in n?n.deltaX:"wheelDeltaX"in n?-n.wheelDeltaX:0},deltaY:function(n){return"deltaY"in n?n.deltaY:"wheelDeltaY"in n?-n.wheelDeltaY:"wheelDelta"in n?-n.wheelDelta:0},deltaZ:0,deltaMode:0}),VT=un(jT),GT=g({},ci,{newState:0,oldState:0}),qT=un(GT),YT=[9,13,27,32],Ad=Ur&&"CompositionEvent"in window,da=null;Ur&&"documentMode"in document&&(da=document.documentMode);var XT=Ur&&"TextEvent"in window&&!da,Lg=Ur&&(!Ad||da&&8<da&&11>=da),kg=" ",Ig=!1;function Hg(n,o){switch(n){case"keyup":return YT.indexOf(o.keyCode)!==-1;case"keydown":return o.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Fg(n){return n=n.detail,typeof n=="object"&&"data"in n?n.data:null}var ts=!1;function $T(n,o){switch(n){case"compositionend":return Fg(o);case"keypress":return o.which!==32?null:(Ig=!0,kg);case"textInput":return n=o.data,n===kg&&Ig?null:n;default:return null}}function KT(n,o){if(ts)return n==="compositionend"||!Ad&&Hg(n,o)?(n=Og(),ic=Sd=ho=null,ts=!1,n):null;switch(n){case"paste":return null;case"keypress":if(!(o.ctrlKey||o.altKey||o.metaKey)||o.ctrlKey&&o.altKey){if(o.char&&1<o.char.length)return o.char;if(o.which)return String.fromCharCode(o.which)}return null;case"compositionend":return Lg&&o.locale!=="ko"?null:o.data;default:return null}}var ZT={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 Pg(n){var o=n&&n.nodeName&&n.nodeName.toLowerCase();return o==="input"?!!ZT[n.type]:o==="textarea"}function jg(n,o,s,c){Ji?es?es.push(c):es=[c]:Ji=c,o=Wc(o,"onChange"),0<o.length&&(s=new lc("onChange","change",null,s,c),n.push({event:s,listeners:o}))}var ha=null,ma=null;function QT(n){wx(n,0)}function uc(n){var o=co(n);if(nc(o))return n}function Vg(n,o){if(n==="change")return o}var Gg=!1;if(Ur){var Nd;if(Ur){var Md="oninput"in document;if(!Md){var qg=document.createElement("div");qg.setAttribute("oninput","return;"),Md=typeof qg.oninput=="function"}Nd=Md}else Nd=!1;Gg=Nd&&(!document.documentMode||9<document.documentMode)}function Yg(){ha&&(ha.detachEvent("onpropertychange",Xg),ma=ha=null)}function Xg(n){if(n.propertyName==="value"&&uc(ma)){var o=[];jg(o,ma,n,bd(n)),Mg(QT,o)}}function WT(n,o,s){n==="focusin"?(Yg(),ha=o,ma=s,ha.attachEvent("onpropertychange",Xg)):n==="focusout"&&Yg()}function JT(n){if(n==="selectionchange"||n==="keyup"||n==="keydown")return uc(ma)}function eR(n,o){if(n==="click")return uc(o)}function tR(n,o){if(n==="input"||n==="change")return uc(o)}function nR(n,o){return n===o&&(n!==0||1/n===1/o)||n!==n&&o!==o}var En=typeof Object.is=="function"?Object.is:nR;function pa(n,o){if(En(n,o))return!0;if(typeof n!="object"||n===null||typeof o!="object"||o===null)return!1;var s=Object.keys(n),c=Object.keys(o);if(s.length!==c.length)return!1;for(c=0;c<s.length;c++){var m=s[c];if(!le.call(o,m)||!En(n[m],o[m]))return!1}return!0}function $g(n){for(;n&&n.firstChild;)n=n.firstChild;return n}function Kg(n,o){var s=$g(n);n=0;for(var c;s;){if(s.nodeType===3){if(c=n+s.textContent.length,n<=o&&c>=o)return{node:s,offset:o-n};n=c}e:{for(;s;){if(s.nextSibling){s=s.nextSibling;break e}s=s.parentNode}s=void 0}s=$g(s)}}function Zg(n,o){return n&&o?n===o?!0:n&&n.nodeType===3?!1:o&&o.nodeType===3?Zg(n,o.parentNode):"contains"in n?n.contains(o):n.compareDocumentPosition?!!(n.compareDocumentPosition(o)&16):!1:!1}function Qg(n){n=n!=null&&n.ownerDocument!=null&&n.ownerDocument.defaultView!=null?n.ownerDocument.defaultView:window;for(var o=ai(n.document);o instanceof n.HTMLIFrameElement;){try{var s=typeof o.contentWindow.location.href=="string"}catch{s=!1}if(s)n=o.contentWindow;else break;o=ai(n.document)}return o}function Od(n){var o=n&&n.nodeName&&n.nodeName.toLowerCase();return o&&(o==="input"&&(n.type==="text"||n.type==="search"||n.type==="tel"||n.type==="url"||n.type==="password")||o==="textarea"||n.contentEditable==="true")}var rR=Ur&&"documentMode"in document&&11>=document.documentMode,ns=null,Dd=null,ga=null,zd=!1;function Wg(n,o,s){var c=s.window===s?s.document:s.nodeType===9?s:s.ownerDocument;zd||ns==null||ns!==ai(c)||(c=ns,"selectionStart"in c&&Od(c)?c={start:c.selectionStart,end:c.selectionEnd}:(c=(c.ownerDocument&&c.ownerDocument.defaultView||window).getSelection(),c={anchorNode:c.anchorNode,anchorOffset:c.anchorOffset,focusNode:c.focusNode,focusOffset:c.focusOffset}),ga&&pa(ga,c)||(ga=c,c=Wc(Dd,"onSelect"),0<c.length&&(o=new lc("onSelect","select",null,o,s),n.push({event:o,listeners:c}),o.target=ns)))}function ui(n,o){var s={};return s[n.toLowerCase()]=o.toLowerCase(),s["Webkit"+n]="webkit"+o,s["Moz"+n]="moz"+o,s}var rs={animationend:ui("Animation","AnimationEnd"),animationiteration:ui("Animation","AnimationIteration"),animationstart:ui("Animation","AnimationStart"),transitionrun:ui("Transition","TransitionRun"),transitionstart:ui("Transition","TransitionStart"),transitioncancel:ui("Transition","TransitionCancel"),transitionend:ui("Transition","TransitionEnd")},Bd={},Jg={};Ur&&(Jg=document.createElement("div").style,"AnimationEvent"in window||(delete rs.animationend.animation,delete rs.animationiteration.animation,delete rs.animationstart.animation),"TransitionEvent"in window||delete rs.transitionend.transition);function fi(n){if(Bd[n])return Bd[n];if(!rs[n])return n;var o=rs[n],s;for(s in o)if(o.hasOwnProperty(s)&&s in Jg)return Bd[n]=o[s];return n}var ey=fi("animationend"),ty=fi("animationiteration"),ny=fi("animationstart"),oR=fi("transitionrun"),iR=fi("transitionstart"),sR=fi("transitioncancel"),ry=fi("transitionend"),oy=new Map,Ud="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(" ");Ud.push("scrollEnd");function $n(n,o){oy.set(n,o),Dr(o,[n])}var fc=typeof reportError=="function"?reportError:function(n){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var o=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof n=="object"&&n!==null&&typeof n.message=="string"?String(n.message):String(n),error:n});if(!window.dispatchEvent(o))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",n);return}console.error(n)},Ln=[],os=0,Ld=0;function dc(){for(var n=os,o=Ld=os=0;o<n;){var s=Ln[o];Ln[o++]=null;var c=Ln[o];Ln[o++]=null;var m=Ln[o];Ln[o++]=null;var y=Ln[o];if(Ln[o++]=null,c!==null&&m!==null){var S=c.pending;S===null?m.next=m:(m.next=S.next,S.next=m),c.pending=m}y!==0&&iy(s,m,y)}}function hc(n,o,s,c){Ln[os++]=n,Ln[os++]=o,Ln[os++]=s,Ln[os++]=c,Ld|=c,n.lanes|=c,n=n.alternate,n!==null&&(n.lanes|=c)}function kd(n,o,s,c){return hc(n,o,s,c),mc(n)}function di(n,o){return hc(n,null,null,o),mc(n)}function iy(n,o,s){n.lanes|=s;var c=n.alternate;c!==null&&(c.lanes|=s);for(var m=!1,y=n.return;y!==null;)y.childLanes|=s,c=y.alternate,c!==null&&(c.childLanes|=s),y.tag===22&&(n=y.stateNode,n===null||n._visibility&1||(m=!0)),n=y,y=y.return;return n.tag===3?(y=n.stateNode,m&&o!==null&&(m=31-wt(s),n=y.hiddenUpdates,c=n[m],c===null?n[m]=[o]:c.push(o),o.lane=s|536870912),y):null}function mc(n){if(50<Ia)throw Ia=0,Yh=null,Error(i(185));for(var o=n.return;o!==null;)n=o,o=n.return;return n.tag===3?n.stateNode:null}var is={};function aR(n,o,s,c){this.tag=n,this.key=s,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=o,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=c,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sn(n,o,s,c){return new aR(n,o,s,c)}function Id(n){return n=n.prototype,!(!n||!n.isReactComponent)}function Lr(n,o){var s=n.alternate;return s===null?(s=Sn(n.tag,o,n.key,n.mode),s.elementType=n.elementType,s.type=n.type,s.stateNode=n.stateNode,s.alternate=n,n.alternate=s):(s.pendingProps=o,s.type=n.type,s.flags=0,s.subtreeFlags=0,s.deletions=null),s.flags=n.flags&65011712,s.childLanes=n.childLanes,s.lanes=n.lanes,s.child=n.child,s.memoizedProps=n.memoizedProps,s.memoizedState=n.memoizedState,s.updateQueue=n.updateQueue,o=n.dependencies,s.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext},s.sibling=n.sibling,s.index=n.index,s.ref=n.ref,s.refCleanup=n.refCleanup,s}function sy(n,o){n.flags&=65011714;var s=n.alternate;return s===null?(n.childLanes=0,n.lanes=o,n.child=null,n.subtreeFlags=0,n.memoizedProps=null,n.memoizedState=null,n.updateQueue=null,n.dependencies=null,n.stateNode=null):(n.childLanes=s.childLanes,n.lanes=s.lanes,n.child=s.child,n.subtreeFlags=0,n.deletions=null,n.memoizedProps=s.memoizedProps,n.memoizedState=s.memoizedState,n.updateQueue=s.updateQueue,n.type=s.type,o=s.dependencies,n.dependencies=o===null?null:{lanes:o.lanes,firstContext:o.firstContext}),n}function pc(n,o,s,c,m,y){var S=0;if(c=n,typeof n=="function")Id(n)&&(S=1);else if(typeof n=="string")S=dA(n,s,J.current)?26:n==="html"||n==="head"||n==="body"?27:5;else e:switch(n){case j:return n=Sn(31,s,o,m),n.elementType=j,n.lanes=y,n;case _:return hi(s.children,m,y,o);case C:S=8,m|=24;break;case E:return n=Sn(12,s,o,m|2),n.elementType=E,n.lanes=y,n;case M:return n=Sn(13,s,o,m),n.elementType=M,n.lanes=y,n;case T:return n=Sn(19,s,o,m),n.elementType=T,n.lanes=y,n;default:if(typeof n=="object"&&n!==null)switch(n.$$typeof){case w:S=10;break e;case N:S=9;break e;case A:S=11;break e;case O:S=14;break e;case I:S=16,c=null;break e}S=29,s=Error(i(130,n===null?"null":typeof n,"")),c=null}return o=Sn(S,s,o,m),o.elementType=n,o.type=c,o.lanes=y,o}function hi(n,o,s,c){return n=Sn(7,n,c,o),n.lanes=s,n}function Hd(n,o,s){return n=Sn(6,n,null,o),n.lanes=s,n}function ay(n){var o=Sn(18,null,null,0);return o.stateNode=n,o}function Fd(n,o,s){return o=Sn(4,n.children!==null?n.children:[],n.key,o),o.lanes=s,o.stateNode={containerInfo:n.containerInfo,pendingChildren:null,implementation:n.implementation},o}var ly=new WeakMap;function kn(n,o){if(typeof n=="object"&&n!==null){var s=ly.get(n);return s!==void 0?s:(o={value:n,source:o,stack:ue(o)},ly.set(n,o),o)}return{value:n,source:o,stack:ue(o)}}var ss=[],as=0,gc=null,ya=0,In=[],Hn=0,mo=null,cr=1,ur="";function kr(n,o){ss[as++]=ya,ss[as++]=gc,gc=n,ya=o}function cy(n,o,s){In[Hn++]=cr,In[Hn++]=ur,In[Hn++]=mo,mo=n;var c=cr;n=ur;var m=32-wt(c)-1;c&=~(1<<m),s+=1;var y=32-wt(o)+m;if(30<y){var S=m-m%5;y=(c&(1<<S)-1).toString(32),c>>=S,m-=S,cr=1<<32-wt(o)+m|s<<m|c,ur=y+n}else cr=1<<y|s<<m|c,ur=n}function Pd(n){n.return!==null&&(kr(n,1),cy(n,1,0))}function jd(n){for(;n===gc;)gc=ss[--as],ss[as]=null,ya=ss[--as],ss[as]=null;for(;n===mo;)mo=In[--Hn],In[Hn]=null,ur=In[--Hn],In[Hn]=null,cr=In[--Hn],In[Hn]=null}function uy(n,o){In[Hn++]=cr,In[Hn++]=ur,In[Hn++]=mo,cr=o.id,ur=o.overflow,mo=n}var Kt=null,mt=null,Xe=!1,po=null,Fn=!1,Vd=Error(i(519));function go(n){var o=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw va(kn(o,n)),Vd}function fy(n){var o=n.stateNode,s=n.type,c=n.memoizedProps;switch(o[jt]=n,o[Jt]=c,s){case"dialog":je("cancel",o),je("close",o);break;case"iframe":case"object":case"embed":je("load",o);break;case"video":case"audio":for(s=0;s<Fa.length;s++)je(Fa[s],o);break;case"source":je("error",o);break;case"img":case"image":case"link":je("error",o),je("load",o);break;case"details":je("toggle",o);break;case"input":je("invalid",o),rc(o,c.value,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name,!0);break;case"select":je("invalid",o);break;case"textarea":je("invalid",o),Tg(o,c.value,c.defaultValue,c.children)}s=c.children,typeof s!="string"&&typeof s!="number"&&typeof s!="bigint"||o.textContent===""+s||c.suppressHydrationWarning===!0||Ax(o.textContent,s)?(c.popover!=null&&(je("beforetoggle",o),je("toggle",o)),c.onScroll!=null&&je("scroll",o),c.onScrollEnd!=null&&je("scrollend",o),c.onClick!=null&&(o.onclick=Br),o=!0):o=!1,o||go(n,!0)}function dy(n){for(Kt=n.return;Kt;)switch(Kt.tag){case 5:case 31:case 13:Fn=!1;return;case 27:case 3:Fn=!0;return;default:Kt=Kt.return}}function ls(n){if(n!==Kt)return!1;if(!Xe)return dy(n),Xe=!0,!1;var o=n.tag,s;if((s=o!==3&&o!==27)&&((s=o===5)&&(s=n.type,s=!(s!=="form"&&s!=="button")||am(n.type,n.memoizedProps)),s=!s),s&&mt&&go(n),dy(n),o===13){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));mt=kx(n)}else if(o===31){if(n=n.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(317));mt=kx(n)}else o===27?(o=mt,Mo(n.type)?(n=dm,dm=null,mt=n):mt=o):mt=Kt?jn(n.stateNode.nextSibling):null;return!0}function mi(){mt=Kt=null,Xe=!1}function Gd(){var n=po;return n!==null&&(mn===null?mn=n:mn.push.apply(mn,n),po=null),n}function va(n){po===null?po=[n]:po.push(n)}var qd=U(null),pi=null,Ir=null;function yo(n,o,s){ee(qd,o._currentValue),o._currentValue=s}function Hr(n){n._currentValue=qd.current,V(qd)}function Yd(n,o,s){for(;n!==null;){var c=n.alternate;if((n.childLanes&o)!==o?(n.childLanes|=o,c!==null&&(c.childLanes|=o)):c!==null&&(c.childLanes&o)!==o&&(c.childLanes|=o),n===s)break;n=n.return}}function Xd(n,o,s,c){var m=n.child;for(m!==null&&(m.return=n);m!==null;){var y=m.dependencies;if(y!==null){var S=m.child;y=y.firstContext;e:for(;y!==null;){var B=y;y=m;for(var Y=0;Y<o.length;Y++)if(B.context===o[Y]){y.lanes|=s,B=y.alternate,B!==null&&(B.lanes|=s),Yd(y.return,s,n),c||(S=null);break e}y=B.next}}else if(m.tag===18){if(S=m.return,S===null)throw Error(i(341));S.lanes|=s,y=S.alternate,y!==null&&(y.lanes|=s),Yd(S,s,n),S=null}else S=m.child;if(S!==null)S.return=m;else for(S=m;S!==null;){if(S===n){S=null;break}if(m=S.sibling,m!==null){m.return=S.return,S=m;break}S=S.return}m=S}}function cs(n,o,s,c){n=null;for(var m=o,y=!1;m!==null;){if(!y){if((m.flags&524288)!==0)y=!0;else if((m.flags&262144)!==0)break}if(m.tag===10){var S=m.alternate;if(S===null)throw Error(i(387));if(S=S.memoizedProps,S!==null){var B=m.type;En(m.pendingProps.value,S.value)||(n!==null?n.push(B):n=[B])}}else if(m===he.current){if(S=m.alternate,S===null)throw Error(i(387));S.memoizedState.memoizedState!==m.memoizedState.memoizedState&&(n!==null?n.push(qa):n=[qa])}m=m.return}n!==null&&Xd(o,n,s,c),o.flags|=262144}function yc(n){for(n=n.firstContext;n!==null;){if(!En(n.context._currentValue,n.memoizedValue))return!0;n=n.next}return!1}function gi(n){pi=n,Ir=null,n=n.dependencies,n!==null&&(n.firstContext=null)}function Zt(n){return hy(pi,n)}function vc(n,o){return pi===null&&gi(n),hy(n,o)}function hy(n,o){var s=o._currentValue;if(o={context:o,memoizedValue:s,next:null},Ir===null){if(n===null)throw Error(i(308));Ir=o,n.dependencies={lanes:0,firstContext:o},n.flags|=524288}else Ir=Ir.next=o;return s}var lR=typeof AbortController<"u"?AbortController:function(){var n=[],o=this.signal={aborted:!1,addEventListener:function(s,c){n.push(c)}};this.abort=function(){o.aborted=!0,n.forEach(function(s){return s()})}},cR=e.unstable_scheduleCallback,uR=e.unstable_NormalPriority,zt={$$typeof:w,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function $d(){return{controller:new lR,data:new Map,refCount:0}}function xa(n){n.refCount--,n.refCount===0&&cR(uR,function(){n.controller.abort()})}var ba=null,Kd=0,us=0,fs=null;function fR(n,o){if(ba===null){var s=ba=[];Kd=0,us=Wh(),fs={status:"pending",value:void 0,then:function(c){s.push(c)}}}return Kd++,o.then(my,my),o}function my(){if(--Kd===0&&ba!==null){fs!==null&&(fs.status="fulfilled");var n=ba;ba=null,us=0,fs=null;for(var o=0;o<n.length;o++)(0,n[o])()}}function dR(n,o){var s=[],c={status:"pending",value:null,reason:null,then:function(m){s.push(m)}};return n.then(function(){c.status="fulfilled",c.value=o;for(var m=0;m<s.length;m++)(0,s[m])(o)},function(m){for(c.status="rejected",c.reason=m,m=0;m<s.length;m++)(0,s[m])(void 0)}),c}var py=z.S;z.S=function(n,o){Wv=_e(),typeof o=="object"&&o!==null&&typeof o.then=="function"&&fR(n,o),py!==null&&py(n,o)};var yi=U(null);function Zd(){var n=yi.current;return n!==null?n:dt.pooledCache}function xc(n,o){o===null?ee(yi,yi.current):ee(yi,o.pool)}function gy(){var n=Zd();return n===null?null:{parent:zt._currentValue,pool:n}}var ds=Error(i(460)),Qd=Error(i(474)),bc=Error(i(542)),_c={then:function(){}};function yy(n){return n=n.status,n==="fulfilled"||n==="rejected"}function vy(n,o,s){switch(s=n[s],s===void 0?n.push(o):s!==o&&(o.then(Br,Br),o=s),o.status){case"fulfilled":return o.value;case"rejected":throw n=o.reason,by(n),n;default:if(typeof o.status=="string")o.then(Br,Br);else{if(n=dt,n!==null&&100<n.shellSuspendCounter)throw Error(i(482));n=o,n.status="pending",n.then(function(c){if(o.status==="pending"){var m=o;m.status="fulfilled",m.value=c}},function(c){if(o.status==="pending"){var m=o;m.status="rejected",m.reason=c}})}switch(o.status){case"fulfilled":return o.value;case"rejected":throw n=o.reason,by(n),n}throw xi=o,ds}}function vi(n){try{var o=n._init;return o(n._payload)}catch(s){throw s!==null&&typeof s=="object"&&typeof s.then=="function"?(xi=s,ds):s}}var xi=null;function xy(){if(xi===null)throw Error(i(459));var n=xi;return xi=null,n}function by(n){if(n===ds||n===bc)throw Error(i(483))}var hs=null,_a=0;function Ec(n){var o=_a;return _a+=1,hs===null&&(hs=[]),vy(hs,n,o)}function Ea(n,o){o=o.props.ref,n.ref=o!==void 0?o:null}function Sc(n,o){throw o.$$typeof===v?Error(i(525)):(n=Object.prototype.toString.call(o),Error(i(31,n==="[object Object]"?"object with keys {"+Object.keys(o).join(", ")+"}":n)))}function _y(n){function o(W,$){if(n){var te=W.deletions;te===null?(W.deletions=[$],W.flags|=16):te.push($)}}function s(W,$){if(!n)return null;for(;$!==null;)o(W,$),$=$.sibling;return null}function c(W){for(var $=new Map;W!==null;)W.key!==null?$.set(W.key,W):$.set(W.index,W),W=W.sibling;return $}function m(W,$){return W=Lr(W,$),W.index=0,W.sibling=null,W}function y(W,$,te){return W.index=te,n?(te=W.alternate,te!==null?(te=te.index,te<$?(W.flags|=67108866,$):te):(W.flags|=67108866,$)):(W.flags|=1048576,$)}function S(W){return n&&W.alternate===null&&(W.flags|=67108866),W}function B(W,$,te,me){return $===null||$.tag!==6?($=Hd(te,W.mode,me),$.return=W,$):($=m($,te),$.return=W,$)}function Y(W,$,te,me){var Me=te.type;return Me===_?de(W,$,te.props.children,me,te.key):$!==null&&($.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===I&&vi(Me)===$.type)?($=m($,te.props),Ea($,te),$.return=W,$):($=pc(te.type,te.key,te.props,null,W.mode,me),Ea($,te),$.return=W,$)}function ne(W,$,te,me){return $===null||$.tag!==4||$.stateNode.containerInfo!==te.containerInfo||$.stateNode.implementation!==te.implementation?($=Fd(te,W.mode,me),$.return=W,$):($=m($,te.children||[]),$.return=W,$)}function de(W,$,te,me,Me){return $===null||$.tag!==7?($=hi(te,W.mode,me,Me),$.return=W,$):($=m($,te),$.return=W,$)}function pe(W,$,te){if(typeof $=="string"&&$!==""||typeof $=="number"||typeof $=="bigint")return $=Hd(""+$,W.mode,te),$.return=W,$;if(typeof $=="object"&&$!==null){switch($.$$typeof){case x:return te=pc($.type,$.key,$.props,null,W.mode,te),Ea(te,$),te.return=W,te;case b:return $=Fd($,W.mode,te),$.return=W,$;case I:return $=vi($),pe(W,$,te)}if(F($)||q($))return $=hi($,W.mode,te,null),$.return=W,$;if(typeof $.then=="function")return pe(W,Ec($),te);if($.$$typeof===w)return pe(W,vc(W,$),te);Sc(W,$)}return null}function oe(W,$,te,me){var Me=$!==null?$.key:null;if(typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint")return Me!==null?null:B(W,$,""+te,me);if(typeof te=="object"&&te!==null){switch(te.$$typeof){case x:return te.key===Me?Y(W,$,te,me):null;case b:return te.key===Me?ne(W,$,te,me):null;case I:return te=vi(te),oe(W,$,te,me)}if(F(te)||q(te))return Me!==null?null:de(W,$,te,me,null);if(typeof te.then=="function")return oe(W,$,Ec(te),me);if(te.$$typeof===w)return oe(W,$,vc(W,te),me);Sc(W,te)}return null}function ce(W,$,te,me,Me){if(typeof me=="string"&&me!==""||typeof me=="number"||typeof me=="bigint")return W=W.get(te)||null,B($,W,""+me,Me);if(typeof me=="object"&&me!==null){switch(me.$$typeof){case x:return W=W.get(me.key===null?te:me.key)||null,Y($,W,me,Me);case b:return W=W.get(me.key===null?te:me.key)||null,ne($,W,me,Me);case I:return me=vi(me),ce(W,$,te,me,Me)}if(F(me)||q(me))return W=W.get(te)||null,de($,W,me,Me,null);if(typeof me.then=="function")return ce(W,$,te,Ec(me),Me);if(me.$$typeof===w)return ce(W,$,te,vc($,me),Me);Sc($,me)}return null}function Re(W,$,te,me){for(var Me=null,et=null,Ae=$,Ie=$=0,qe=null;Ae!==null&&Ie<te.length;Ie++){Ae.index>Ie?(qe=Ae,Ae=null):qe=Ae.sibling;var tt=oe(W,Ae,te[Ie],me);if(tt===null){Ae===null&&(Ae=qe);break}n&&Ae&&tt.alternate===null&&o(W,Ae),$=y(tt,$,Ie),et===null?Me=tt:et.sibling=tt,et=tt,Ae=qe}if(Ie===te.length)return s(W,Ae),Xe&&kr(W,Ie),Me;if(Ae===null){for(;Ie<te.length;Ie++)Ae=pe(W,te[Ie],me),Ae!==null&&($=y(Ae,$,Ie),et===null?Me=Ae:et.sibling=Ae,et=Ae);return Xe&&kr(W,Ie),Me}for(Ae=c(Ae);Ie<te.length;Ie++)qe=ce(Ae,W,Ie,te[Ie],me),qe!==null&&(n&&qe.alternate!==null&&Ae.delete(qe.key===null?Ie:qe.key),$=y(qe,$,Ie),et===null?Me=qe:et.sibling=qe,et=qe);return n&&Ae.forEach(function(Uo){return o(W,Uo)}),Xe&&kr(W,Ie),Me}function De(W,$,te,me){if(te==null)throw Error(i(151));for(var Me=null,et=null,Ae=$,Ie=$=0,qe=null,tt=te.next();Ae!==null&&!tt.done;Ie++,tt=te.next()){Ae.index>Ie?(qe=Ae,Ae=null):qe=Ae.sibling;var Uo=oe(W,Ae,tt.value,me);if(Uo===null){Ae===null&&(Ae=qe);break}n&&Ae&&Uo.alternate===null&&o(W,Ae),$=y(Uo,$,Ie),et===null?Me=Uo:et.sibling=Uo,et=Uo,Ae=qe}if(tt.done)return s(W,Ae),Xe&&kr(W,Ie),Me;if(Ae===null){for(;!tt.done;Ie++,tt=te.next())tt=pe(W,tt.value,me),tt!==null&&($=y(tt,$,Ie),et===null?Me=tt:et.sibling=tt,et=tt);return Xe&&kr(W,Ie),Me}for(Ae=c(Ae);!tt.done;Ie++,tt=te.next())tt=ce(Ae,W,Ie,tt.value,me),tt!==null&&(n&&tt.alternate!==null&&Ae.delete(tt.key===null?Ie:tt.key),$=y(tt,$,Ie),et===null?Me=tt:et.sibling=tt,et=tt);return n&&Ae.forEach(function(SA){return o(W,SA)}),Xe&&kr(W,Ie),Me}function ut(W,$,te,me){if(typeof te=="object"&&te!==null&&te.type===_&&te.key===null&&(te=te.props.children),typeof te=="object"&&te!==null){switch(te.$$typeof){case x:e:{for(var Me=te.key;$!==null;){if($.key===Me){if(Me=te.type,Me===_){if($.tag===7){s(W,$.sibling),me=m($,te.props.children),me.return=W,W=me;break e}}else if($.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===I&&vi(Me)===$.type){s(W,$.sibling),me=m($,te.props),Ea(me,te),me.return=W,W=me;break e}s(W,$);break}else o(W,$);$=$.sibling}te.type===_?(me=hi(te.props.children,W.mode,me,te.key),me.return=W,W=me):(me=pc(te.type,te.key,te.props,null,W.mode,me),Ea(me,te),me.return=W,W=me)}return S(W);case b:e:{for(Me=te.key;$!==null;){if($.key===Me)if($.tag===4&&$.stateNode.containerInfo===te.containerInfo&&$.stateNode.implementation===te.implementation){s(W,$.sibling),me=m($,te.children||[]),me.return=W,W=me;break e}else{s(W,$);break}else o(W,$);$=$.sibling}me=Fd(te,W.mode,me),me.return=W,W=me}return S(W);case I:return te=vi(te),ut(W,$,te,me)}if(F(te))return Re(W,$,te,me);if(q(te)){if(Me=q(te),typeof Me!="function")throw Error(i(150));return te=Me.call(te),De(W,$,te,me)}if(typeof te.then=="function")return ut(W,$,Ec(te),me);if(te.$$typeof===w)return ut(W,$,vc(W,te),me);Sc(W,te)}return typeof te=="string"&&te!==""||typeof te=="number"||typeof te=="bigint"?(te=""+te,$!==null&&$.tag===6?(s(W,$.sibling),me=m($,te),me.return=W,W=me):(s(W,$),me=Hd(te,W.mode,me),me.return=W,W=me),S(W)):s(W,$)}return function(W,$,te,me){try{_a=0;var Me=ut(W,$,te,me);return hs=null,Me}catch(Ae){if(Ae===ds||Ae===bc)throw Ae;var et=Sn(29,Ae,null,W.mode);return et.lanes=me,et.return=W,et}}}var bi=_y(!0),Ey=_y(!1),vo=!1;function Wd(n){n.updateQueue={baseState:n.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Jd(n,o){n=n.updateQueue,o.updateQueue===n&&(o.updateQueue={baseState:n.baseState,firstBaseUpdate:n.firstBaseUpdate,lastBaseUpdate:n.lastBaseUpdate,shared:n.shared,callbacks:null})}function xo(n){return{lane:n,tag:0,payload:null,callback:null,next:null}}function bo(n,o,s){var c=n.updateQueue;if(c===null)return null;if(c=c.shared,(nt&2)!==0){var m=c.pending;return m===null?o.next=o:(o.next=m.next,m.next=o),c.pending=o,o=mc(n),iy(n,null,s),o}return hc(n,c,o,s),mc(n)}function Sa(n,o,s){if(o=o.updateQueue,o!==null&&(o=o.shared,(s&4194048)!==0)){var c=o.lanes;c&=n.pendingLanes,s|=c,o.lanes=s,Gi(n,s)}}function eh(n,o){var s=n.updateQueue,c=n.alternate;if(c!==null&&(c=c.updateQueue,s===c)){var m=null,y=null;if(s=s.firstBaseUpdate,s!==null){do{var S={lane:s.lane,tag:s.tag,payload:s.payload,callback:null,next:null};y===null?m=y=S:y=y.next=S,s=s.next}while(s!==null);y===null?m=y=o:y=y.next=o}else m=y=o;s={baseState:c.baseState,firstBaseUpdate:m,lastBaseUpdate:y,shared:c.shared,callbacks:c.callbacks},n.updateQueue=s;return}n=s.lastBaseUpdate,n===null?s.firstBaseUpdate=o:n.next=o,s.lastBaseUpdate=o}var th=!1;function wa(){if(th){var n=fs;if(n!==null)throw n}}function Ca(n,o,s,c){th=!1;var m=n.updateQueue;vo=!1;var y=m.firstBaseUpdate,S=m.lastBaseUpdate,B=m.shared.pending;if(B!==null){m.shared.pending=null;var Y=B,ne=Y.next;Y.next=null,S===null?y=ne:S.next=ne,S=Y;var de=n.alternate;de!==null&&(de=de.updateQueue,B=de.lastBaseUpdate,B!==S&&(B===null?de.firstBaseUpdate=ne:B.next=ne,de.lastBaseUpdate=Y))}if(y!==null){var pe=m.baseState;S=0,de=ne=Y=null,B=y;do{var oe=B.lane&-536870913,ce=oe!==B.lane;if(ce?(Ge&oe)===oe:(c&oe)===oe){oe!==0&&oe===us&&(th=!0),de!==null&&(de=de.next={lane:0,tag:B.tag,payload:B.payload,callback:null,next:null});e:{var Re=n,De=B;oe=o;var ut=s;switch(De.tag){case 1:if(Re=De.payload,typeof Re=="function"){pe=Re.call(ut,pe,oe);break e}pe=Re;break e;case 3:Re.flags=Re.flags&-65537|128;case 0:if(Re=De.payload,oe=typeof Re=="function"?Re.call(ut,pe,oe):Re,oe==null)break e;pe=g({},pe,oe);break e;case 2:vo=!0}}oe=B.callback,oe!==null&&(n.flags|=64,ce&&(n.flags|=8192),ce=m.callbacks,ce===null?m.callbacks=[oe]:ce.push(oe))}else ce={lane:oe,tag:B.tag,payload:B.payload,callback:B.callback,next:null},de===null?(ne=de=ce,Y=pe):de=de.next=ce,S|=oe;if(B=B.next,B===null){if(B=m.shared.pending,B===null)break;ce=B,B=ce.next,ce.next=null,m.lastBaseUpdate=ce,m.shared.pending=null}}while(!0);de===null&&(Y=pe),m.baseState=Y,m.firstBaseUpdate=ne,m.lastBaseUpdate=de,y===null&&(m.shared.lanes=0),Co|=S,n.lanes=S,n.memoizedState=pe}}function Sy(n,o){if(typeof n!="function")throw Error(i(191,n));n.call(o)}function wy(n,o){var s=n.callbacks;if(s!==null)for(n.callbacks=null,n=0;n<s.length;n++)Sy(s[n],o)}var ms=U(null),wc=U(0);function Cy(n,o){n=$r,ee(wc,n),ee(ms,o),$r=n|o.baseLanes}function nh(){ee(wc,$r),ee(ms,ms.current)}function rh(){$r=wc.current,V(ms),V(wc)}var wn=U(null),Pn=null;function _o(n){var o=n.alternate;ee(At,At.current&1),ee(wn,n),Pn===null&&(o===null||ms.current!==null||o.memoizedState!==null)&&(Pn=n)}function oh(n){ee(At,At.current),ee(wn,n),Pn===null&&(Pn=n)}function Ty(n){n.tag===22?(ee(At,At.current),ee(wn,n),Pn===null&&(Pn=n)):Eo()}function Eo(){ee(At,At.current),ee(wn,wn.current)}function Cn(n){V(wn),Pn===n&&(Pn=null),V(At)}var At=U(0);function Cc(n){for(var o=n;o!==null;){if(o.tag===13){var s=o.memoizedState;if(s!==null&&(s=s.dehydrated,s===null||um(s)||fm(s)))return o}else if(o.tag===19&&(o.memoizedProps.revealOrder==="forwards"||o.memoizedProps.revealOrder==="backwards"||o.memoizedProps.revealOrder==="unstable_legacy-backwards"||o.memoizedProps.revealOrder==="together")){if((o.flags&128)!==0)return o}else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===n)break;for(;o.sibling===null;){if(o.return===null||o.return===n)return null;o=o.return}o.sibling.return=o.return,o=o.sibling}return null}var Fr=0,ke=null,lt=null,Bt=null,Tc=!1,ps=!1,_i=!1,Rc=0,Ta=0,gs=null,hR=0;function Tt(){throw Error(i(321))}function ih(n,o){if(o===null)return!1;for(var s=0;s<o.length&&s<n.length;s++)if(!En(n[s],o[s]))return!1;return!0}function sh(n,o,s,c,m,y){return Fr=y,ke=o,o.memoizedState=null,o.updateQueue=null,o.lanes=0,z.H=n===null||n.memoizedState===null?cv:_h,_i=!1,y=s(c,m),_i=!1,ps&&(y=Ay(o,s,c,m)),Ry(n),y}function Ry(n){z.H=Na;var o=lt!==null&&lt.next!==null;if(Fr=0,Bt=lt=ke=null,Tc=!1,Ta=0,gs=null,o)throw Error(i(300));n===null||Ut||(n=n.dependencies,n!==null&&yc(n)&&(Ut=!0))}function Ay(n,o,s,c){ke=n;var m=0;do{if(ps&&(gs=null),Ta=0,ps=!1,25<=m)throw Error(i(301));if(m+=1,Bt=lt=null,n.updateQueue!=null){var y=n.updateQueue;y.lastEffect=null,y.events=null,y.stores=null,y.memoCache!=null&&(y.memoCache.index=0)}z.H=uv,y=o(s,c)}while(ps);return y}function mR(){var n=z.H,o=n.useState()[0];return o=typeof o.then=="function"?Ra(o):o,n=n.useState()[0],(lt!==null?lt.memoizedState:null)!==n&&(ke.flags|=1024),o}function ah(){var n=Rc!==0;return Rc=0,n}function lh(n,o,s){o.updateQueue=n.updateQueue,o.flags&=-2053,n.lanes&=~s}function ch(n){if(Tc){for(n=n.memoizedState;n!==null;){var o=n.queue;o!==null&&(o.pending=null),n=n.next}Tc=!1}Fr=0,Bt=lt=ke=null,ps=!1,Ta=Rc=0,gs=null}function nn(){var n={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Bt===null?ke.memoizedState=Bt=n:Bt=Bt.next=n,Bt}function Nt(){if(lt===null){var n=ke.alternate;n=n!==null?n.memoizedState:null}else n=lt.next;var o=Bt===null?ke.memoizedState:Bt.next;if(o!==null)Bt=o,lt=n;else{if(n===null)throw ke.alternate===null?Error(i(467)):Error(i(310));lt=n,n={memoizedState:lt.memoizedState,baseState:lt.baseState,baseQueue:lt.baseQueue,queue:lt.queue,next:null},Bt===null?ke.memoizedState=Bt=n:Bt=Bt.next=n}return Bt}function Ac(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Ra(n){var o=Ta;return Ta+=1,gs===null&&(gs=[]),n=vy(gs,n,o),o=ke,(Bt===null?o.memoizedState:Bt.next)===null&&(o=o.alternate,z.H=o===null||o.memoizedState===null?cv:_h),n}function Nc(n){if(n!==null&&typeof n=="object"){if(typeof n.then=="function")return Ra(n);if(n.$$typeof===w)return Zt(n)}throw Error(i(438,String(n)))}function uh(n){var o=null,s=ke.updateQueue;if(s!==null&&(o=s.memoCache),o==null){var c=ke.alternate;c!==null&&(c=c.updateQueue,c!==null&&(c=c.memoCache,c!=null&&(o={data:c.data.map(function(m){return m.slice()}),index:0})))}if(o==null&&(o={data:[],index:0}),s===null&&(s=Ac(),ke.updateQueue=s),s.memoCache=o,s=o.data[o.index],s===void 0)for(s=o.data[o.index]=Array(n),c=0;c<n;c++)s[c]=Z;return o.index++,s}function Pr(n,o){return typeof o=="function"?o(n):o}function Mc(n){var o=Nt();return fh(o,lt,n)}function fh(n,o,s){var c=n.queue;if(c===null)throw Error(i(311));c.lastRenderedReducer=s;var m=n.baseQueue,y=c.pending;if(y!==null){if(m!==null){var S=m.next;m.next=y.next,y.next=S}o.baseQueue=m=y,c.pending=null}if(y=n.baseState,m===null)n.memoizedState=y;else{o=m.next;var B=S=null,Y=null,ne=o,de=!1;do{var pe=ne.lane&-536870913;if(pe!==ne.lane?(Ge&pe)===pe:(Fr&pe)===pe){var oe=ne.revertLane;if(oe===0)Y!==null&&(Y=Y.next={lane:0,revertLane:0,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null}),pe===us&&(de=!0);else if((Fr&oe)===oe){ne=ne.next,oe===us&&(de=!0);continue}else pe={lane:0,revertLane:ne.revertLane,gesture:null,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},Y===null?(B=Y=pe,S=y):Y=Y.next=pe,ke.lanes|=oe,Co|=oe;pe=ne.action,_i&&s(y,pe),y=ne.hasEagerState?ne.eagerState:s(y,pe)}else oe={lane:pe,revertLane:ne.revertLane,gesture:ne.gesture,action:ne.action,hasEagerState:ne.hasEagerState,eagerState:ne.eagerState,next:null},Y===null?(B=Y=oe,S=y):Y=Y.next=oe,ke.lanes|=pe,Co|=pe;ne=ne.next}while(ne!==null&&ne!==o);if(Y===null?S=y:Y.next=B,!En(y,n.memoizedState)&&(Ut=!0,de&&(s=fs,s!==null)))throw s;n.memoizedState=y,n.baseState=S,n.baseQueue=Y,c.lastRenderedState=y}return m===null&&(c.lanes=0),[n.memoizedState,c.dispatch]}function dh(n){var o=Nt(),s=o.queue;if(s===null)throw Error(i(311));s.lastRenderedReducer=n;var c=s.dispatch,m=s.pending,y=o.memoizedState;if(m!==null){s.pending=null;var S=m=m.next;do y=n(y,S.action),S=S.next;while(S!==m);En(y,o.memoizedState)||(Ut=!0),o.memoizedState=y,o.baseQueue===null&&(o.baseState=y),s.lastRenderedState=y}return[y,c]}function Ny(n,o,s){var c=ke,m=Nt(),y=Xe;if(y){if(s===void 0)throw Error(i(407));s=s()}else s=o();var S=!En((lt||m).memoizedState,s);if(S&&(m.memoizedState=s,Ut=!0),m=m.queue,ph(Dy.bind(null,c,m,n),[n]),m.getSnapshot!==o||S||Bt!==null&&Bt.memoizedState.tag&1){if(c.flags|=2048,ys(9,{destroy:void 0},Oy.bind(null,c,m,s,o),null),dt===null)throw Error(i(349));y||(Fr&127)!==0||My(c,o,s)}return s}function My(n,o,s){n.flags|=16384,n={getSnapshot:o,value:s},o=ke.updateQueue,o===null?(o=Ac(),ke.updateQueue=o,o.stores=[n]):(s=o.stores,s===null?o.stores=[n]:s.push(n))}function Oy(n,o,s,c){o.value=s,o.getSnapshot=c,zy(o)&&By(n)}function Dy(n,o,s){return s(function(){zy(o)&&By(n)})}function zy(n){var o=n.getSnapshot;n=n.value;try{var s=o();return!En(n,s)}catch{return!0}}function By(n){var o=di(n,2);o!==null&&pn(o,n,2)}function hh(n){var o=nn();if(typeof n=="function"){var s=n;if(n=s(),_i){rt(!0);try{s()}finally{rt(!1)}}}return o.memoizedState=o.baseState=n,o.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pr,lastRenderedState:n},o}function Uy(n,o,s,c){return n.baseState=s,fh(n,lt,typeof c=="function"?c:Pr)}function pR(n,o,s,c,m){if(zc(n))throw Error(i(485));if(n=o.action,n!==null){var y={payload:m,action:n,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(S){y.listeners.push(S)}};z.T!==null?s(!0):y.isTransition=!1,c(y),s=o.pending,s===null?(y.next=o.pending=y,Ly(o,y)):(y.next=s.next,o.pending=s.next=y)}}function Ly(n,o){var s=o.action,c=o.payload,m=n.state;if(o.isTransition){var y=z.T,S={};z.T=S;try{var B=s(m,c),Y=z.S;Y!==null&&Y(S,B),ky(n,o,B)}catch(ne){mh(n,o,ne)}finally{y!==null&&S.types!==null&&(y.types=S.types),z.T=y}}else try{y=s(m,c),ky(n,o,y)}catch(ne){mh(n,o,ne)}}function ky(n,o,s){s!==null&&typeof s=="object"&&typeof s.then=="function"?s.then(function(c){Iy(n,o,c)},function(c){return mh(n,o,c)}):Iy(n,o,s)}function Iy(n,o,s){o.status="fulfilled",o.value=s,Hy(o),n.state=s,o=n.pending,o!==null&&(s=o.next,s===o?n.pending=null:(s=s.next,o.next=s,Ly(n,s)))}function mh(n,o,s){var c=n.pending;if(n.pending=null,c!==null){c=c.next;do o.status="rejected",o.reason=s,Hy(o),o=o.next;while(o!==c)}n.action=null}function Hy(n){n=n.listeners;for(var o=0;o<n.length;o++)(0,n[o])()}function Fy(n,o){return o}function Py(n,o){if(Xe){var s=dt.formState;if(s!==null){e:{var c=ke;if(Xe){if(mt){t:{for(var m=mt,y=Fn;m.nodeType!==8;){if(!y){m=null;break t}if(m=jn(m.nextSibling),m===null){m=null;break t}}y=m.data,m=y==="F!"||y==="F"?m:null}if(m){mt=jn(m.nextSibling),c=m.data==="F!";break e}}go(c)}c=!1}c&&(o=s[0])}}return s=nn(),s.memoizedState=s.baseState=o,c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Fy,lastRenderedState:o},s.queue=c,s=sv.bind(null,ke,c),c.dispatch=s,c=hh(!1),y=bh.bind(null,ke,!1,c.queue),c=nn(),m={state:o,dispatch:null,action:n,pending:null},c.queue=m,s=pR.bind(null,ke,m,y,s),m.dispatch=s,c.memoizedState=n,[o,s,!1]}function jy(n){var o=Nt();return Vy(o,lt,n)}function Vy(n,o,s){if(o=fh(n,o,Fy)[0],n=Mc(Pr)[0],typeof o=="object"&&o!==null&&typeof o.then=="function")try{var c=Ra(o)}catch(S){throw S===ds?bc:S}else c=o;o=Nt();var m=o.queue,y=m.dispatch;return s!==o.memoizedState&&(ke.flags|=2048,ys(9,{destroy:void 0},gR.bind(null,m,s),null)),[c,y,n]}function gR(n,o){n.action=o}function Gy(n){var o=Nt(),s=lt;if(s!==null)return Vy(o,s,n);Nt(),o=o.memoizedState,s=Nt();var c=s.queue.dispatch;return s.memoizedState=n,[o,c,!1]}function ys(n,o,s,c){return n={tag:n,create:s,deps:c,inst:o,next:null},o=ke.updateQueue,o===null&&(o=Ac(),ke.updateQueue=o),s=o.lastEffect,s===null?o.lastEffect=n.next=n:(c=s.next,s.next=n,n.next=c,o.lastEffect=n),n}function qy(){return Nt().memoizedState}function Oc(n,o,s,c){var m=nn();ke.flags|=n,m.memoizedState=ys(1|o,{destroy:void 0},s,c===void 0?null:c)}function Dc(n,o,s,c){var m=Nt();c=c===void 0?null:c;var y=m.memoizedState.inst;lt!==null&&c!==null&&ih(c,lt.memoizedState.deps)?m.memoizedState=ys(o,y,s,c):(ke.flags|=n,m.memoizedState=ys(1|o,y,s,c))}function Yy(n,o){Oc(8390656,8,n,o)}function ph(n,o){Dc(2048,8,n,o)}function yR(n){ke.flags|=4;var o=ke.updateQueue;if(o===null)o=Ac(),ke.updateQueue=o,o.events=[n];else{var s=o.events;s===null?o.events=[n]:s.push(n)}}function Xy(n){var o=Nt().memoizedState;return yR({ref:o,nextImpl:n}),function(){if((nt&2)!==0)throw Error(i(440));return o.impl.apply(void 0,arguments)}}function $y(n,o){return Dc(4,2,n,o)}function Ky(n,o){return Dc(4,4,n,o)}function Zy(n,o){if(typeof o=="function"){n=n();var s=o(n);return function(){typeof s=="function"?s():o(null)}}if(o!=null)return n=n(),o.current=n,function(){o.current=null}}function Qy(n,o,s){s=s!=null?s.concat([n]):null,Dc(4,4,Zy.bind(null,o,n),s)}function gh(){}function Wy(n,o){var s=Nt();o=o===void 0?null:o;var c=s.memoizedState;return o!==null&&ih(o,c[1])?c[0]:(s.memoizedState=[n,o],n)}function Jy(n,o){var s=Nt();o=o===void 0?null:o;var c=s.memoizedState;if(o!==null&&ih(o,c[1]))return c[0];if(c=n(),_i){rt(!0);try{n()}finally{rt(!1)}}return s.memoizedState=[c,o],c}function yh(n,o,s){return s===void 0||(Fr&1073741824)!==0&&(Ge&261930)===0?n.memoizedState=o:(n.memoizedState=s,n=ex(),ke.lanes|=n,Co|=n,s)}function ev(n,o,s,c){return En(s,o)?s:ms.current!==null?(n=yh(n,s,c),En(n,o)||(Ut=!0),n):(Fr&42)===0||(Fr&1073741824)!==0&&(Ge&261930)===0?(Ut=!0,n.memoizedState=s):(n=ex(),ke.lanes|=n,Co|=n,o)}function tv(n,o,s,c,m){var y=L.p;L.p=y!==0&&8>y?y:8;var S=z.T,B={};z.T=B,bh(n,!1,o,s);try{var Y=m(),ne=z.S;if(ne!==null&&ne(B,Y),Y!==null&&typeof Y=="object"&&typeof Y.then=="function"){var de=dR(Y,c);Aa(n,o,de,An(n))}else Aa(n,o,c,An(n))}catch(pe){Aa(n,o,{then:function(){},status:"rejected",reason:pe},An())}finally{L.p=y,S!==null&&B.types!==null&&(S.types=B.types),z.T=S}}function vR(){}function vh(n,o,s,c){if(n.tag!==5)throw Error(i(476));var m=nv(n).queue;tv(n,m,o,H,s===null?vR:function(){return rv(n),s(c)})}function nv(n){var o=n.memoizedState;if(o!==null)return o;o={memoizedState:H,baseState:H,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pr,lastRenderedState:H},next:null};var s={};return o.next={memoizedState:s,baseState:s,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Pr,lastRenderedState:s},next:null},n.memoizedState=o,n=n.alternate,n!==null&&(n.memoizedState=o),o}function rv(n){var o=nv(n);o.next===null&&(o=n.alternate.memoizedState),Aa(n,o.next.queue,{},An())}function xh(){return Zt(qa)}function ov(){return Nt().memoizedState}function iv(){return Nt().memoizedState}function xR(n){for(var o=n.return;o!==null;){switch(o.tag){case 24:case 3:var s=An();n=xo(s);var c=bo(o,n,s);c!==null&&(pn(c,o,s),Sa(c,o,s)),o={cache:$d()},n.payload=o;return}o=o.return}}function bR(n,o,s){var c=An();s={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null},zc(n)?av(o,s):(s=kd(n,o,s,c),s!==null&&(pn(s,n,c),lv(s,o,c)))}function sv(n,o,s){var c=An();Aa(n,o,s,c)}function Aa(n,o,s,c){var m={lane:c,revertLane:0,gesture:null,action:s,hasEagerState:!1,eagerState:null,next:null};if(zc(n))av(o,m);else{var y=n.alternate;if(n.lanes===0&&(y===null||y.lanes===0)&&(y=o.lastRenderedReducer,y!==null))try{var S=o.lastRenderedState,B=y(S,s);if(m.hasEagerState=!0,m.eagerState=B,En(B,S))return hc(n,o,m,0),dt===null&&dc(),!1}catch{}if(s=kd(n,o,m,c),s!==null)return pn(s,n,c),lv(s,o,c),!0}return!1}function bh(n,o,s,c){if(c={lane:2,revertLane:Wh(),gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},zc(n)){if(o)throw Error(i(479))}else o=kd(n,s,c,2),o!==null&&pn(o,n,2)}function zc(n){var o=n.alternate;return n===ke||o!==null&&o===ke}function av(n,o){ps=Tc=!0;var s=n.pending;s===null?o.next=o:(o.next=s.next,s.next=o),n.pending=o}function lv(n,o,s){if((s&4194048)!==0){var c=o.lanes;c&=n.pendingLanes,s|=c,o.lanes=s,Gi(n,s)}}var Na={readContext:Zt,use:Nc,useCallback:Tt,useContext:Tt,useEffect:Tt,useImperativeHandle:Tt,useLayoutEffect:Tt,useInsertionEffect:Tt,useMemo:Tt,useReducer:Tt,useRef:Tt,useState:Tt,useDebugValue:Tt,useDeferredValue:Tt,useTransition:Tt,useSyncExternalStore:Tt,useId:Tt,useHostTransitionStatus:Tt,useFormState:Tt,useActionState:Tt,useOptimistic:Tt,useMemoCache:Tt,useCacheRefresh:Tt};Na.useEffectEvent=Tt;var cv={readContext:Zt,use:Nc,useCallback:function(n,o){return nn().memoizedState=[n,o===void 0?null:o],n},useContext:Zt,useEffect:Yy,useImperativeHandle:function(n,o,s){s=s!=null?s.concat([n]):null,Oc(4194308,4,Zy.bind(null,o,n),s)},useLayoutEffect:function(n,o){return Oc(4194308,4,n,o)},useInsertionEffect:function(n,o){Oc(4,2,n,o)},useMemo:function(n,o){var s=nn();o=o===void 0?null:o;var c=n();if(_i){rt(!0);try{n()}finally{rt(!1)}}return s.memoizedState=[c,o],c},useReducer:function(n,o,s){var c=nn();if(s!==void 0){var m=s(o);if(_i){rt(!0);try{s(o)}finally{rt(!1)}}}else m=o;return c.memoizedState=c.baseState=m,n={pending:null,lanes:0,dispatch:null,lastRenderedReducer:n,lastRenderedState:m},c.queue=n,n=n.dispatch=bR.bind(null,ke,n),[c.memoizedState,n]},useRef:function(n){var o=nn();return n={current:n},o.memoizedState=n},useState:function(n){n=hh(n);var o=n.queue,s=sv.bind(null,ke,o);return o.dispatch=s,[n.memoizedState,s]},useDebugValue:gh,useDeferredValue:function(n,o){var s=nn();return yh(s,n,o)},useTransition:function(){var n=hh(!1);return n=tv.bind(null,ke,n.queue,!0,!1),nn().memoizedState=n,[!1,n]},useSyncExternalStore:function(n,o,s){var c=ke,m=nn();if(Xe){if(s===void 0)throw Error(i(407));s=s()}else{if(s=o(),dt===null)throw Error(i(349));(Ge&127)!==0||My(c,o,s)}m.memoizedState=s;var y={value:s,getSnapshot:o};return m.queue=y,Yy(Dy.bind(null,c,y,n),[n]),c.flags|=2048,ys(9,{destroy:void 0},Oy.bind(null,c,y,s,o),null),s},useId:function(){var n=nn(),o=dt.identifierPrefix;if(Xe){var s=ur,c=cr;s=(c&~(1<<32-wt(c)-1)).toString(32)+s,o="_"+o+"R_"+s,s=Rc++,0<s&&(o+="H"+s.toString(32)),o+="_"}else s=hR++,o="_"+o+"r_"+s.toString(32)+"_";return n.memoizedState=o},useHostTransitionStatus:xh,useFormState:Py,useActionState:Py,useOptimistic:function(n){var o=nn();o.memoizedState=o.baseState=n;var s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return o.queue=s,o=bh.bind(null,ke,!0,s),s.dispatch=o,[n,o]},useMemoCache:uh,useCacheRefresh:function(){return nn().memoizedState=xR.bind(null,ke)},useEffectEvent:function(n){var o=nn(),s={impl:n};return o.memoizedState=s,function(){if((nt&2)!==0)throw Error(i(440));return s.impl.apply(void 0,arguments)}}},_h={readContext:Zt,use:Nc,useCallback:Wy,useContext:Zt,useEffect:ph,useImperativeHandle:Qy,useInsertionEffect:$y,useLayoutEffect:Ky,useMemo:Jy,useReducer:Mc,useRef:qy,useState:function(){return Mc(Pr)},useDebugValue:gh,useDeferredValue:function(n,o){var s=Nt();return ev(s,lt.memoizedState,n,o)},useTransition:function(){var n=Mc(Pr)[0],o=Nt().memoizedState;return[typeof n=="boolean"?n:Ra(n),o]},useSyncExternalStore:Ny,useId:ov,useHostTransitionStatus:xh,useFormState:jy,useActionState:jy,useOptimistic:function(n,o){var s=Nt();return Uy(s,lt,n,o)},useMemoCache:uh,useCacheRefresh:iv};_h.useEffectEvent=Xy;var uv={readContext:Zt,use:Nc,useCallback:Wy,useContext:Zt,useEffect:ph,useImperativeHandle:Qy,useInsertionEffect:$y,useLayoutEffect:Ky,useMemo:Jy,useReducer:dh,useRef:qy,useState:function(){return dh(Pr)},useDebugValue:gh,useDeferredValue:function(n,o){var s=Nt();return lt===null?yh(s,n,o):ev(s,lt.memoizedState,n,o)},useTransition:function(){var n=dh(Pr)[0],o=Nt().memoizedState;return[typeof n=="boolean"?n:Ra(n),o]},useSyncExternalStore:Ny,useId:ov,useHostTransitionStatus:xh,useFormState:Gy,useActionState:Gy,useOptimistic:function(n,o){var s=Nt();return lt!==null?Uy(s,lt,n,o):(s.baseState=n,[n,s.queue.dispatch])},useMemoCache:uh,useCacheRefresh:iv};uv.useEffectEvent=Xy;function Eh(n,o,s,c){o=n.memoizedState,s=s(c,o),s=s==null?o:g({},o,s),n.memoizedState=s,n.lanes===0&&(n.updateQueue.baseState=s)}var Sh={enqueueSetState:function(n,o,s){n=n._reactInternals;var c=An(),m=xo(c);m.payload=o,s!=null&&(m.callback=s),o=bo(n,m,c),o!==null&&(pn(o,n,c),Sa(o,n,c))},enqueueReplaceState:function(n,o,s){n=n._reactInternals;var c=An(),m=xo(c);m.tag=1,m.payload=o,s!=null&&(m.callback=s),o=bo(n,m,c),o!==null&&(pn(o,n,c),Sa(o,n,c))},enqueueForceUpdate:function(n,o){n=n._reactInternals;var s=An(),c=xo(s);c.tag=2,o!=null&&(c.callback=o),o=bo(n,c,s),o!==null&&(pn(o,n,s),Sa(o,n,s))}};function fv(n,o,s,c,m,y,S){return n=n.stateNode,typeof n.shouldComponentUpdate=="function"?n.shouldComponentUpdate(c,y,S):o.prototype&&o.prototype.isPureReactComponent?!pa(s,c)||!pa(m,y):!0}function dv(n,o,s,c){n=o.state,typeof o.componentWillReceiveProps=="function"&&o.componentWillReceiveProps(s,c),typeof o.UNSAFE_componentWillReceiveProps=="function"&&o.UNSAFE_componentWillReceiveProps(s,c),o.state!==n&&Sh.enqueueReplaceState(o,o.state,null)}function Ei(n,o){var s=o;if("ref"in o){s={};for(var c in o)c!=="ref"&&(s[c]=o[c])}if(n=n.defaultProps){s===o&&(s=g({},s));for(var m in n)s[m]===void 0&&(s[m]=n[m])}return s}function hv(n){fc(n)}function mv(n){console.error(n)}function pv(n){fc(n)}function Bc(n,o){try{var s=n.onUncaughtError;s(o.value,{componentStack:o.stack})}catch(c){setTimeout(function(){throw c})}}function gv(n,o,s){try{var c=n.onCaughtError;c(s.value,{componentStack:s.stack,errorBoundary:o.tag===1?o.stateNode:null})}catch(m){setTimeout(function(){throw m})}}function wh(n,o,s){return s=xo(s),s.tag=3,s.payload={element:null},s.callback=function(){Bc(n,o)},s}function yv(n){return n=xo(n),n.tag=3,n}function vv(n,o,s,c){var m=s.type.getDerivedStateFromError;if(typeof m=="function"){var y=c.value;n.payload=function(){return m(y)},n.callback=function(){gv(o,s,c)}}var S=s.stateNode;S!==null&&typeof S.componentDidCatch=="function"&&(n.callback=function(){gv(o,s,c),typeof m!="function"&&(To===null?To=new Set([this]):To.add(this));var B=c.stack;this.componentDidCatch(c.value,{componentStack:B!==null?B:""})})}function _R(n,o,s,c,m){if(s.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){if(o=s.alternate,o!==null&&cs(o,s,m,!0),s=wn.current,s!==null){switch(s.tag){case 31:case 13:return Pn===null?Yc():s.alternate===null&&Rt===0&&(Rt=3),s.flags&=-257,s.flags|=65536,s.lanes=m,c===_c?s.flags|=16384:(o=s.updateQueue,o===null?s.updateQueue=new Set([c]):o.add(c),Kh(n,c,m)),!1;case 22:return s.flags|=65536,c===_c?s.flags|=16384:(o=s.updateQueue,o===null?(o={transitions:null,markerInstances:null,retryQueue:new Set([c])},s.updateQueue=o):(s=o.retryQueue,s===null?o.retryQueue=new Set([c]):s.add(c)),Kh(n,c,m)),!1}throw Error(i(435,s.tag))}return Kh(n,c,m),Yc(),!1}if(Xe)return o=wn.current,o!==null?((o.flags&65536)===0&&(o.flags|=256),o.flags|=65536,o.lanes=m,c!==Vd&&(n=Error(i(422),{cause:c}),va(kn(n,s)))):(c!==Vd&&(o=Error(i(423),{cause:c}),va(kn(o,s))),n=n.current.alternate,n.flags|=65536,m&=-m,n.lanes|=m,c=kn(c,s),m=wh(n.stateNode,c,m),eh(n,m),Rt!==4&&(Rt=2)),!1;var y=Error(i(520),{cause:c});if(y=kn(y,s),ka===null?ka=[y]:ka.push(y),Rt!==4&&(Rt=2),o===null)return!0;c=kn(c,s),s=o;do{switch(s.tag){case 3:return s.flags|=65536,n=m&-m,s.lanes|=n,n=wh(s.stateNode,c,n),eh(s,n),!1;case 1:if(o=s.type,y=s.stateNode,(s.flags&128)===0&&(typeof o.getDerivedStateFromError=="function"||y!==null&&typeof y.componentDidCatch=="function"&&(To===null||!To.has(y))))return s.flags|=65536,m&=-m,s.lanes|=m,m=yv(m),vv(m,n,s,c),eh(s,m),!1}s=s.return}while(s!==null);return!1}var Ch=Error(i(461)),Ut=!1;function Qt(n,o,s,c){o.child=n===null?Ey(o,null,s,c):bi(o,n.child,s,c)}function xv(n,o,s,c,m){s=s.render;var y=o.ref;if("ref"in c){var S={};for(var B in c)B!=="ref"&&(S[B]=c[B])}else S=c;return gi(o),c=sh(n,o,s,S,y,m),B=ah(),n!==null&&!Ut?(lh(n,o,m),jr(n,o,m)):(Xe&&B&&Pd(o),o.flags|=1,Qt(n,o,c,m),o.child)}function bv(n,o,s,c,m){if(n===null){var y=s.type;return typeof y=="function"&&!Id(y)&&y.defaultProps===void 0&&s.compare===null?(o.tag=15,o.type=y,_v(n,o,y,c,m)):(n=pc(s.type,null,c,o,o.mode,m),n.ref=o.ref,n.return=o,o.child=n)}if(y=n.child,!zh(n,m)){var S=y.memoizedProps;if(s=s.compare,s=s!==null?s:pa,s(S,c)&&n.ref===o.ref)return jr(n,o,m)}return o.flags|=1,n=Lr(y,c),n.ref=o.ref,n.return=o,o.child=n}function _v(n,o,s,c,m){if(n!==null){var y=n.memoizedProps;if(pa(y,c)&&n.ref===o.ref)if(Ut=!1,o.pendingProps=c=y,zh(n,m))(n.flags&131072)!==0&&(Ut=!0);else return o.lanes=n.lanes,jr(n,o,m)}return Th(n,o,s,c,m)}function Ev(n,o,s,c){var m=c.children,y=n!==null?n.memoizedState:null;if(n===null&&o.stateNode===null&&(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),c.mode==="hidden"){if((o.flags&128)!==0){if(y=y!==null?y.baseLanes|s:s,n!==null){for(c=o.child=n.child,m=0;c!==null;)m=m|c.lanes|c.childLanes,c=c.sibling;c=m&~y}else c=0,o.child=null;return Sv(n,o,y,s,c)}if((s&536870912)!==0)o.memoizedState={baseLanes:0,cachePool:null},n!==null&&xc(o,y!==null?y.cachePool:null),y!==null?Cy(o,y):nh(),Ty(o);else return c=o.lanes=536870912,Sv(n,o,y!==null?y.baseLanes|s:s,s,c)}else y!==null?(xc(o,y.cachePool),Cy(o,y),Eo(),o.memoizedState=null):(n!==null&&xc(o,null),nh(),Eo());return Qt(n,o,m,s),o.child}function Ma(n,o){return n!==null&&n.tag===22||o.stateNode!==null||(o.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),o.sibling}function Sv(n,o,s,c,m){var y=Zd();return y=y===null?null:{parent:zt._currentValue,pool:y},o.memoizedState={baseLanes:s,cachePool:y},n!==null&&xc(o,null),nh(),Ty(o),n!==null&&cs(n,o,c,!0),o.childLanes=m,null}function Uc(n,o){return o=kc({mode:o.mode,children:o.children},n.mode),o.ref=n.ref,n.child=o,o.return=n,o}function wv(n,o,s){return bi(o,n.child,null,s),n=Uc(o,o.pendingProps),n.flags|=2,Cn(o),o.memoizedState=null,n}function ER(n,o,s){var c=o.pendingProps,m=(o.flags&128)!==0;if(o.flags&=-129,n===null){if(Xe){if(c.mode==="hidden")return n=Uc(o,c),o.lanes=536870912,Ma(null,n);if(oh(o),(n=mt)?(n=Lx(n,Fn),n=n!==null&&n.data==="&"?n:null,n!==null&&(o.memoizedState={dehydrated:n,treeContext:mo!==null?{id:cr,overflow:ur}:null,retryLane:536870912,hydrationErrors:null},s=ay(n),s.return=o,o.child=s,Kt=o,mt=null)):n=null,n===null)throw go(o);return o.lanes=536870912,null}return Uc(o,c)}var y=n.memoizedState;if(y!==null){var S=y.dehydrated;if(oh(o),m)if(o.flags&256)o.flags&=-257,o=wv(n,o,s);else if(o.memoizedState!==null)o.child=n.child,o.flags|=128,o=null;else throw Error(i(558));else if(Ut||cs(n,o,s,!1),m=(s&n.childLanes)!==0,Ut||m){if(c=dt,c!==null&&(S=qi(c,s),S!==0&&S!==y.retryLane))throw y.retryLane=S,di(n,S),pn(c,n,S),Ch;Yc(),o=wv(n,o,s)}else n=y.treeContext,mt=jn(S.nextSibling),Kt=o,Xe=!0,po=null,Fn=!1,n!==null&&uy(o,n),o=Uc(o,c),o.flags|=4096;return o}return n=Lr(n.child,{mode:c.mode,children:c.children}),n.ref=o.ref,o.child=n,n.return=o,n}function Lc(n,o){var s=o.ref;if(s===null)n!==null&&n.ref!==null&&(o.flags|=4194816);else{if(typeof s!="function"&&typeof s!="object")throw Error(i(284));(n===null||n.ref!==s)&&(o.flags|=4194816)}}function Th(n,o,s,c,m){return gi(o),s=sh(n,o,s,c,void 0,m),c=ah(),n!==null&&!Ut?(lh(n,o,m),jr(n,o,m)):(Xe&&c&&Pd(o),o.flags|=1,Qt(n,o,s,m),o.child)}function Cv(n,o,s,c,m,y){return gi(o),o.updateQueue=null,s=Ay(o,c,s,m),Ry(n),c=ah(),n!==null&&!Ut?(lh(n,o,y),jr(n,o,y)):(Xe&&c&&Pd(o),o.flags|=1,Qt(n,o,s,y),o.child)}function Tv(n,o,s,c,m){if(gi(o),o.stateNode===null){var y=is,S=s.contextType;typeof S=="object"&&S!==null&&(y=Zt(S)),y=new s(c,y),o.memoizedState=y.state!==null&&y.state!==void 0?y.state:null,y.updater=Sh,o.stateNode=y,y._reactInternals=o,y=o.stateNode,y.props=c,y.state=o.memoizedState,y.refs={},Wd(o),S=s.contextType,y.context=typeof S=="object"&&S!==null?Zt(S):is,y.state=o.memoizedState,S=s.getDerivedStateFromProps,typeof S=="function"&&(Eh(o,s,S,c),y.state=o.memoizedState),typeof s.getDerivedStateFromProps=="function"||typeof y.getSnapshotBeforeUpdate=="function"||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(S=y.state,typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount(),S!==y.state&&Sh.enqueueReplaceState(y,y.state,null),Ca(o,c,y,m),wa(),y.state=o.memoizedState),typeof y.componentDidMount=="function"&&(o.flags|=4194308),c=!0}else if(n===null){y=o.stateNode;var B=o.memoizedProps,Y=Ei(s,B);y.props=Y;var ne=y.context,de=s.contextType;S=is,typeof de=="object"&&de!==null&&(S=Zt(de));var pe=s.getDerivedStateFromProps;de=typeof pe=="function"||typeof y.getSnapshotBeforeUpdate=="function",B=o.pendingProps!==B,de||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(B||ne!==S)&&dv(o,y,c,S),vo=!1;var oe=o.memoizedState;y.state=oe,Ca(o,c,y,m),wa(),ne=o.memoizedState,B||oe!==ne||vo?(typeof pe=="function"&&(Eh(o,s,pe,c),ne=o.memoizedState),(Y=vo||fv(o,s,Y,c,oe,ne,S))?(de||typeof y.UNSAFE_componentWillMount!="function"&&typeof y.componentWillMount!="function"||(typeof y.componentWillMount=="function"&&y.componentWillMount(),typeof y.UNSAFE_componentWillMount=="function"&&y.UNSAFE_componentWillMount()),typeof y.componentDidMount=="function"&&(o.flags|=4194308)):(typeof y.componentDidMount=="function"&&(o.flags|=4194308),o.memoizedProps=c,o.memoizedState=ne),y.props=c,y.state=ne,y.context=S,c=Y):(typeof y.componentDidMount=="function"&&(o.flags|=4194308),c=!1)}else{y=o.stateNode,Jd(n,o),S=o.memoizedProps,de=Ei(s,S),y.props=de,pe=o.pendingProps,oe=y.context,ne=s.contextType,Y=is,typeof ne=="object"&&ne!==null&&(Y=Zt(ne)),B=s.getDerivedStateFromProps,(ne=typeof B=="function"||typeof y.getSnapshotBeforeUpdate=="function")||typeof y.UNSAFE_componentWillReceiveProps!="function"&&typeof y.componentWillReceiveProps!="function"||(S!==pe||oe!==Y)&&dv(o,y,c,Y),vo=!1,oe=o.memoizedState,y.state=oe,Ca(o,c,y,m),wa();var ce=o.memoizedState;S!==pe||oe!==ce||vo||n!==null&&n.dependencies!==null&&yc(n.dependencies)?(typeof B=="function"&&(Eh(o,s,B,c),ce=o.memoizedState),(de=vo||fv(o,s,de,c,oe,ce,Y)||n!==null&&n.dependencies!==null&&yc(n.dependencies))?(ne||typeof y.UNSAFE_componentWillUpdate!="function"&&typeof y.componentWillUpdate!="function"||(typeof y.componentWillUpdate=="function"&&y.componentWillUpdate(c,ce,Y),typeof y.UNSAFE_componentWillUpdate=="function"&&y.UNSAFE_componentWillUpdate(c,ce,Y)),typeof y.componentDidUpdate=="function"&&(o.flags|=4),typeof y.getSnapshotBeforeUpdate=="function"&&(o.flags|=1024)):(typeof y.componentDidUpdate!="function"||S===n.memoizedProps&&oe===n.memoizedState||(o.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===n.memoizedProps&&oe===n.memoizedState||(o.flags|=1024),o.memoizedProps=c,o.memoizedState=ce),y.props=c,y.state=ce,y.context=Y,c=de):(typeof y.componentDidUpdate!="function"||S===n.memoizedProps&&oe===n.memoizedState||(o.flags|=4),typeof y.getSnapshotBeforeUpdate!="function"||S===n.memoizedProps&&oe===n.memoizedState||(o.flags|=1024),c=!1)}return y=c,Lc(n,o),c=(o.flags&128)!==0,y||c?(y=o.stateNode,s=c&&typeof s.getDerivedStateFromError!="function"?null:y.render(),o.flags|=1,n!==null&&c?(o.child=bi(o,n.child,null,m),o.child=bi(o,null,s,m)):Qt(n,o,s,m),o.memoizedState=y.state,n=o.child):n=jr(n,o,m),n}function Rv(n,o,s,c){return mi(),o.flags|=256,Qt(n,o,s,c),o.child}var Rh={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Ah(n){return{baseLanes:n,cachePool:gy()}}function Nh(n,o,s){return n=n!==null?n.childLanes&~s:0,o&&(n|=Rn),n}function Av(n,o,s){var c=o.pendingProps,m=!1,y=(o.flags&128)!==0,S;if((S=y)||(S=n!==null&&n.memoizedState===null?!1:(At.current&2)!==0),S&&(m=!0,o.flags&=-129),S=(o.flags&32)!==0,o.flags&=-33,n===null){if(Xe){if(m?_o(o):Eo(),(n=mt)?(n=Lx(n,Fn),n=n!==null&&n.data!=="&"?n:null,n!==null&&(o.memoizedState={dehydrated:n,treeContext:mo!==null?{id:cr,overflow:ur}:null,retryLane:536870912,hydrationErrors:null},s=ay(n),s.return=o,o.child=s,Kt=o,mt=null)):n=null,n===null)throw go(o);return fm(n)?o.lanes=32:o.lanes=536870912,null}var B=c.children;return c=c.fallback,m?(Eo(),m=o.mode,B=kc({mode:"hidden",children:B},m),c=hi(c,m,s,null),B.return=o,c.return=o,B.sibling=c,o.child=B,c=o.child,c.memoizedState=Ah(s),c.childLanes=Nh(n,S,s),o.memoizedState=Rh,Ma(null,c)):(_o(o),Mh(o,B))}var Y=n.memoizedState;if(Y!==null&&(B=Y.dehydrated,B!==null)){if(y)o.flags&256?(_o(o),o.flags&=-257,o=Oh(n,o,s)):o.memoizedState!==null?(Eo(),o.child=n.child,o.flags|=128,o=null):(Eo(),B=c.fallback,m=o.mode,c=kc({mode:"visible",children:c.children},m),B=hi(B,m,s,null),B.flags|=2,c.return=o,B.return=o,c.sibling=B,o.child=c,bi(o,n.child,null,s),c=o.child,c.memoizedState=Ah(s),c.childLanes=Nh(n,S,s),o.memoizedState=Rh,o=Ma(null,c));else if(_o(o),fm(B)){if(S=B.nextSibling&&B.nextSibling.dataset,S)var ne=S.dgst;S=ne,c=Error(i(419)),c.stack="",c.digest=S,va({value:c,source:null,stack:null}),o=Oh(n,o,s)}else if(Ut||cs(n,o,s,!1),S=(s&n.childLanes)!==0,Ut||S){if(S=dt,S!==null&&(c=qi(S,s),c!==0&&c!==Y.retryLane))throw Y.retryLane=c,di(n,c),pn(S,n,c),Ch;um(B)||Yc(),o=Oh(n,o,s)}else um(B)?(o.flags|=192,o.child=n.child,o=null):(n=Y.treeContext,mt=jn(B.nextSibling),Kt=o,Xe=!0,po=null,Fn=!1,n!==null&&uy(o,n),o=Mh(o,c.children),o.flags|=4096);return o}return m?(Eo(),B=c.fallback,m=o.mode,Y=n.child,ne=Y.sibling,c=Lr(Y,{mode:"hidden",children:c.children}),c.subtreeFlags=Y.subtreeFlags&65011712,ne!==null?B=Lr(ne,B):(B=hi(B,m,s,null),B.flags|=2),B.return=o,c.return=o,c.sibling=B,o.child=c,Ma(null,c),c=o.child,B=n.child.memoizedState,B===null?B=Ah(s):(m=B.cachePool,m!==null?(Y=zt._currentValue,m=m.parent!==Y?{parent:Y,pool:Y}:m):m=gy(),B={baseLanes:B.baseLanes|s,cachePool:m}),c.memoizedState=B,c.childLanes=Nh(n,S,s),o.memoizedState=Rh,Ma(n.child,c)):(_o(o),s=n.child,n=s.sibling,s=Lr(s,{mode:"visible",children:c.children}),s.return=o,s.sibling=null,n!==null&&(S=o.deletions,S===null?(o.deletions=[n],o.flags|=16):S.push(n)),o.child=s,o.memoizedState=null,s)}function Mh(n,o){return o=kc({mode:"visible",children:o},n.mode),o.return=n,n.child=o}function kc(n,o){return n=Sn(22,n,null,o),n.lanes=0,n}function Oh(n,o,s){return bi(o,n.child,null,s),n=Mh(o,o.pendingProps.children),n.flags|=2,o.memoizedState=null,n}function Nv(n,o,s){n.lanes|=o;var c=n.alternate;c!==null&&(c.lanes|=o),Yd(n.return,o,s)}function Dh(n,o,s,c,m,y){var S=n.memoizedState;S===null?n.memoizedState={isBackwards:o,rendering:null,renderingStartTime:0,last:c,tail:s,tailMode:m,treeForkCount:y}:(S.isBackwards=o,S.rendering=null,S.renderingStartTime=0,S.last=c,S.tail=s,S.tailMode=m,S.treeForkCount=y)}function Mv(n,o,s){var c=o.pendingProps,m=c.revealOrder,y=c.tail;c=c.children;var S=At.current,B=(S&2)!==0;if(B?(S=S&1|2,o.flags|=128):S&=1,ee(At,S),Qt(n,o,c,s),c=Xe?ya:0,!B&&n!==null&&(n.flags&128)!==0)e:for(n=o.child;n!==null;){if(n.tag===13)n.memoizedState!==null&&Nv(n,s,o);else if(n.tag===19)Nv(n,s,o);else if(n.child!==null){n.child.return=n,n=n.child;continue}if(n===o)break e;for(;n.sibling===null;){if(n.return===null||n.return===o)break e;n=n.return}n.sibling.return=n.return,n=n.sibling}switch(m){case"forwards":for(s=o.child,m=null;s!==null;)n=s.alternate,n!==null&&Cc(n)===null&&(m=s),s=s.sibling;s=m,s===null?(m=o.child,o.child=null):(m=s.sibling,s.sibling=null),Dh(o,!1,m,s,y,c);break;case"backwards":case"unstable_legacy-backwards":for(s=null,m=o.child,o.child=null;m!==null;){if(n=m.alternate,n!==null&&Cc(n)===null){o.child=m;break}n=m.sibling,m.sibling=s,s=m,m=n}Dh(o,!0,s,null,y,c);break;case"together":Dh(o,!1,null,null,void 0,c);break;default:o.memoizedState=null}return o.child}function jr(n,o,s){if(n!==null&&(o.dependencies=n.dependencies),Co|=o.lanes,(s&o.childLanes)===0)if(n!==null){if(cs(n,o,s,!1),(s&o.childLanes)===0)return null}else return null;if(n!==null&&o.child!==n.child)throw Error(i(153));if(o.child!==null){for(n=o.child,s=Lr(n,n.pendingProps),o.child=s,s.return=o;n.sibling!==null;)n=n.sibling,s=s.sibling=Lr(n,n.pendingProps),s.return=o;s.sibling=null}return o.child}function zh(n,o){return(n.lanes&o)!==0?!0:(n=n.dependencies,!!(n!==null&&yc(n)))}function SR(n,o,s){switch(o.tag){case 3:ae(o,o.stateNode.containerInfo),yo(o,zt,n.memoizedState.cache),mi();break;case 27:case 5:ve(o);break;case 4:ae(o,o.stateNode.containerInfo);break;case 10:yo(o,o.type,o.memoizedProps.value);break;case 31:if(o.memoizedState!==null)return o.flags|=128,oh(o),null;break;case 13:var c=o.memoizedState;if(c!==null)return c.dehydrated!==null?(_o(o),o.flags|=128,null):(s&o.child.childLanes)!==0?Av(n,o,s):(_o(o),n=jr(n,o,s),n!==null?n.sibling:null);_o(o);break;case 19:var m=(n.flags&128)!==0;if(c=(s&o.childLanes)!==0,c||(cs(n,o,s,!1),c=(s&o.childLanes)!==0),m){if(c)return Mv(n,o,s);o.flags|=128}if(m=o.memoizedState,m!==null&&(m.rendering=null,m.tail=null,m.lastEffect=null),ee(At,At.current),c)break;return null;case 22:return o.lanes=0,Ev(n,o,s,o.pendingProps);case 24:yo(o,zt,n.memoizedState.cache)}return jr(n,o,s)}function Ov(n,o,s){if(n!==null)if(n.memoizedProps!==o.pendingProps)Ut=!0;else{if(!zh(n,s)&&(o.flags&128)===0)return Ut=!1,SR(n,o,s);Ut=(n.flags&131072)!==0}else Ut=!1,Xe&&(o.flags&1048576)!==0&&cy(o,ya,o.index);switch(o.lanes=0,o.tag){case 16:e:{var c=o.pendingProps;if(n=vi(o.elementType),o.type=n,typeof n=="function")Id(n)?(c=Ei(n,c),o.tag=1,o=Tv(null,o,n,c,s)):(o.tag=0,o=Th(null,o,n,c,s));else{if(n!=null){var m=n.$$typeof;if(m===A){o.tag=11,o=xv(null,o,n,c,s);break e}else if(m===O){o.tag=14,o=bv(null,o,n,c,s);break e}}throw o=k(n)||n,Error(i(306,o,""))}}return o;case 0:return Th(n,o,o.type,o.pendingProps,s);case 1:return c=o.type,m=Ei(c,o.pendingProps),Tv(n,o,c,m,s);case 3:e:{if(ae(o,o.stateNode.containerInfo),n===null)throw Error(i(387));c=o.pendingProps;var y=o.memoizedState;m=y.element,Jd(n,o),Ca(o,c,null,s);var S=o.memoizedState;if(c=S.cache,yo(o,zt,c),c!==y.cache&&Xd(o,[zt],s,!0),wa(),c=S.element,y.isDehydrated)if(y={element:c,isDehydrated:!1,cache:S.cache},o.updateQueue.baseState=y,o.memoizedState=y,o.flags&256){o=Rv(n,o,c,s);break e}else if(c!==m){m=kn(Error(i(424)),o),va(m),o=Rv(n,o,c,s);break e}else for(n=o.stateNode.containerInfo,n.nodeType===9?n=n.body:n=n.nodeName==="HTML"?n.ownerDocument.body:n,mt=jn(n.firstChild),Kt=o,Xe=!0,po=null,Fn=!0,s=Ey(o,null,c,s),o.child=s;s;)s.flags=s.flags&-3|4096,s=s.sibling;else{if(mi(),c===m){o=jr(n,o,s);break e}Qt(n,o,c,s)}o=o.child}return o;case 26:return Lc(n,o),n===null?(s=jx(o.type,null,o.pendingProps,null))?o.memoizedState=s:Xe||(s=o.type,n=o.pendingProps,c=Jc(ye.current).createElement(s),c[jt]=o,c[Jt]=n,Wt(c,s,n),Dt(c),o.stateNode=c):o.memoizedState=jx(o.type,n.memoizedProps,o.pendingProps,n.memoizedState),null;case 27:return ve(o),n===null&&Xe&&(c=o.stateNode=Hx(o.type,o.pendingProps,ye.current),Kt=o,Fn=!0,m=mt,Mo(o.type)?(dm=m,mt=jn(c.firstChild)):mt=m),Qt(n,o,o.pendingProps.children,s),Lc(n,o),n===null&&(o.flags|=4194304),o.child;case 5:return n===null&&Xe&&((m=c=mt)&&(c=JR(c,o.type,o.pendingProps,Fn),c!==null?(o.stateNode=c,Kt=o,mt=jn(c.firstChild),Fn=!1,m=!0):m=!1),m||go(o)),ve(o),m=o.type,y=o.pendingProps,S=n!==null?n.memoizedProps:null,c=y.children,am(m,y)?c=null:S!==null&&am(m,S)&&(o.flags|=32),o.memoizedState!==null&&(m=sh(n,o,mR,null,null,s),qa._currentValue=m),Lc(n,o),Qt(n,o,c,s),o.child;case 6:return n===null&&Xe&&((n=s=mt)&&(s=eA(s,o.pendingProps,Fn),s!==null?(o.stateNode=s,Kt=o,mt=null,n=!0):n=!1),n||go(o)),null;case 13:return Av(n,o,s);case 4:return ae(o,o.stateNode.containerInfo),c=o.pendingProps,n===null?o.child=bi(o,null,c,s):Qt(n,o,c,s),o.child;case 11:return xv(n,o,o.type,o.pendingProps,s);case 7:return Qt(n,o,o.pendingProps,s),o.child;case 8:return Qt(n,o,o.pendingProps.children,s),o.child;case 12:return Qt(n,o,o.pendingProps.children,s),o.child;case 10:return c=o.pendingProps,yo(o,o.type,c.value),Qt(n,o,c.children,s),o.child;case 9:return m=o.type._context,c=o.pendingProps.children,gi(o),m=Zt(m),c=c(m),o.flags|=1,Qt(n,o,c,s),o.child;case 14:return bv(n,o,o.type,o.pendingProps,s);case 15:return _v(n,o,o.type,o.pendingProps,s);case 19:return Mv(n,o,s);case 31:return ER(n,o,s);case 22:return Ev(n,o,s,o.pendingProps);case 24:return gi(o),c=Zt(zt),n===null?(m=Zd(),m===null&&(m=dt,y=$d(),m.pooledCache=y,y.refCount++,y!==null&&(m.pooledCacheLanes|=s),m=y),o.memoizedState={parent:c,cache:m},Wd(o),yo(o,zt,m)):((n.lanes&s)!==0&&(Jd(n,o),Ca(o,null,null,s),wa()),m=n.memoizedState,y=o.memoizedState,m.parent!==c?(m={parent:c,cache:c},o.memoizedState=m,o.lanes===0&&(o.memoizedState=o.updateQueue.baseState=m),yo(o,zt,c)):(c=y.cache,yo(o,zt,c),c!==m.cache&&Xd(o,[zt],s,!0))),Qt(n,o,o.pendingProps.children,s),o.child;case 29:throw o.pendingProps}throw Error(i(156,o.tag))}function Vr(n){n.flags|=4}function Bh(n,o,s,c,m){if((o=(n.mode&32)!==0)&&(o=!1),o){if(n.flags|=16777216,(m&335544128)===m)if(n.stateNode.complete)n.flags|=8192;else if(ox())n.flags|=8192;else throw xi=_c,Qd}else n.flags&=-16777217}function Dv(n,o){if(o.type!=="stylesheet"||(o.state.loading&4)!==0)n.flags&=-16777217;else if(n.flags|=16777216,!Xx(o))if(ox())n.flags|=8192;else throw xi=_c,Qd}function Ic(n,o){o!==null&&(n.flags|=4),n.flags&16384&&(o=n.tag!==22?so():536870912,n.lanes|=o,_s|=o)}function Oa(n,o){if(!Xe)switch(n.tailMode){case"hidden":o=n.tail;for(var s=null;o!==null;)o.alternate!==null&&(s=o),o=o.sibling;s===null?n.tail=null:s.sibling=null;break;case"collapsed":s=n.tail;for(var c=null;s!==null;)s.alternate!==null&&(c=s),s=s.sibling;c===null?o||n.tail===null?n.tail=null:n.tail.sibling=null:c.sibling=null}}function pt(n){var o=n.alternate!==null&&n.alternate.child===n.child,s=0,c=0;if(o)for(var m=n.child;m!==null;)s|=m.lanes|m.childLanes,c|=m.subtreeFlags&65011712,c|=m.flags&65011712,m.return=n,m=m.sibling;else for(m=n.child;m!==null;)s|=m.lanes|m.childLanes,c|=m.subtreeFlags,c|=m.flags,m.return=n,m=m.sibling;return n.subtreeFlags|=c,n.childLanes=s,o}function wR(n,o,s){var c=o.pendingProps;switch(jd(o),o.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return pt(o),null;case 1:return pt(o),null;case 3:return s=o.stateNode,c=null,n!==null&&(c=n.memoizedState.cache),o.memoizedState.cache!==c&&(o.flags|=2048),Hr(zt),be(),s.pendingContext&&(s.context=s.pendingContext,s.pendingContext=null),(n===null||n.child===null)&&(ls(o)?Vr(o):n===null||n.memoizedState.isDehydrated&&(o.flags&256)===0||(o.flags|=1024,Gd())),pt(o),null;case 26:var m=o.type,y=o.memoizedState;return n===null?(Vr(o),y!==null?(pt(o),Dv(o,y)):(pt(o),Bh(o,m,null,c,s))):y?y!==n.memoizedState?(Vr(o),pt(o),Dv(o,y)):(pt(o),o.flags&=-16777217):(n=n.memoizedProps,n!==c&&Vr(o),pt(o),Bh(o,m,n,c,s)),null;case 27:if(Te(o),s=ye.current,m=o.type,n!==null&&o.stateNode!=null)n.memoizedProps!==c&&Vr(o);else{if(!c){if(o.stateNode===null)throw Error(i(166));return pt(o),null}n=J.current,ls(o)?fy(o):(n=Hx(m,c,s),o.stateNode=n,Vr(o))}return pt(o),null;case 5:if(Te(o),m=o.type,n!==null&&o.stateNode!=null)n.memoizedProps!==c&&Vr(o);else{if(!c){if(o.stateNode===null)throw Error(i(166));return pt(o),null}if(y=J.current,ls(o))fy(o);else{var S=Jc(ye.current);switch(y){case 1:y=S.createElementNS("http://www.w3.org/2000/svg",m);break;case 2:y=S.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;default:switch(m){case"svg":y=S.createElementNS("http://www.w3.org/2000/svg",m);break;case"math":y=S.createElementNS("http://www.w3.org/1998/Math/MathML",m);break;case"script":y=S.createElement("div"),y.innerHTML="<script><\/script>",y=y.removeChild(y.firstChild);break;case"select":y=typeof c.is=="string"?S.createElement("select",{is:c.is}):S.createElement("select"),c.multiple?y.multiple=!0:c.size&&(y.size=c.size);break;default:y=typeof c.is=="string"?S.createElement(m,{is:c.is}):S.createElement(m)}}y[jt]=o,y[Jt]=c;e:for(S=o.child;S!==null;){if(S.tag===5||S.tag===6)y.appendChild(S.stateNode);else if(S.tag!==4&&S.tag!==27&&S.child!==null){S.child.return=S,S=S.child;continue}if(S===o)break e;for(;S.sibling===null;){if(S.return===null||S.return===o)break e;S=S.return}S.sibling.return=S.return,S=S.sibling}o.stateNode=y;e:switch(Wt(y,m,c),m){case"button":case"input":case"select":case"textarea":c=!!c.autoFocus;break e;case"img":c=!0;break e;default:c=!1}c&&Vr(o)}}return pt(o),Bh(o,o.type,n===null?null:n.memoizedProps,o.pendingProps,s),null;case 6:if(n&&o.stateNode!=null)n.memoizedProps!==c&&Vr(o);else{if(typeof c!="string"&&o.stateNode===null)throw Error(i(166));if(n=ye.current,ls(o)){if(n=o.stateNode,s=o.memoizedProps,c=null,m=Kt,m!==null)switch(m.tag){case 27:case 5:c=m.memoizedProps}n[jt]=o,n=!!(n.nodeValue===s||c!==null&&c.suppressHydrationWarning===!0||Ax(n.nodeValue,s)),n||go(o,!0)}else n=Jc(n).createTextNode(c),n[jt]=o,o.stateNode=n}return pt(o),null;case 31:if(s=o.memoizedState,n===null||n.memoizedState!==null){if(c=ls(o),s!==null){if(n===null){if(!c)throw Error(i(318));if(n=o.memoizedState,n=n!==null?n.dehydrated:null,!n)throw Error(i(557));n[jt]=o}else mi(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;pt(o),n=!1}else s=Gd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=s),n=!0;if(!n)return o.flags&256?(Cn(o),o):(Cn(o),null);if((o.flags&128)!==0)throw Error(i(558))}return pt(o),null;case 13:if(c=o.memoizedState,n===null||n.memoizedState!==null&&n.memoizedState.dehydrated!==null){if(m=ls(o),c!==null&&c.dehydrated!==null){if(n===null){if(!m)throw Error(i(318));if(m=o.memoizedState,m=m!==null?m.dehydrated:null,!m)throw Error(i(317));m[jt]=o}else mi(),(o.flags&128)===0&&(o.memoizedState=null),o.flags|=4;pt(o),m=!1}else m=Gd(),n!==null&&n.memoizedState!==null&&(n.memoizedState.hydrationErrors=m),m=!0;if(!m)return o.flags&256?(Cn(o),o):(Cn(o),null)}return Cn(o),(o.flags&128)!==0?(o.lanes=s,o):(s=c!==null,n=n!==null&&n.memoizedState!==null,s&&(c=o.child,m=null,c.alternate!==null&&c.alternate.memoizedState!==null&&c.alternate.memoizedState.cachePool!==null&&(m=c.alternate.memoizedState.cachePool.pool),y=null,c.memoizedState!==null&&c.memoizedState.cachePool!==null&&(y=c.memoizedState.cachePool.pool),y!==m&&(c.flags|=2048)),s!==n&&s&&(o.child.flags|=8192),Ic(o,o.updateQueue),pt(o),null);case 4:return be(),n===null&&nm(o.stateNode.containerInfo),pt(o),null;case 10:return Hr(o.type),pt(o),null;case 19:if(V(At),c=o.memoizedState,c===null)return pt(o),null;if(m=(o.flags&128)!==0,y=c.rendering,y===null)if(m)Oa(c,!1);else{if(Rt!==0||n!==null&&(n.flags&128)!==0)for(n=o.child;n!==null;){if(y=Cc(n),y!==null){for(o.flags|=128,Oa(c,!1),n=y.updateQueue,o.updateQueue=n,Ic(o,n),o.subtreeFlags=0,n=s,s=o.child;s!==null;)sy(s,n),s=s.sibling;return ee(At,At.current&1|2),Xe&&kr(o,c.treeForkCount),o.child}n=n.sibling}c.tail!==null&&_e()>Vc&&(o.flags|=128,m=!0,Oa(c,!1),o.lanes=4194304)}else{if(!m)if(n=Cc(y),n!==null){if(o.flags|=128,m=!0,n=n.updateQueue,o.updateQueue=n,Ic(o,n),Oa(c,!0),c.tail===null&&c.tailMode==="hidden"&&!y.alternate&&!Xe)return pt(o),null}else 2*_e()-c.renderingStartTime>Vc&&s!==536870912&&(o.flags|=128,m=!0,Oa(c,!1),o.lanes=4194304);c.isBackwards?(y.sibling=o.child,o.child=y):(n=c.last,n!==null?n.sibling=y:o.child=y,c.last=y)}return c.tail!==null?(n=c.tail,c.rendering=n,c.tail=n.sibling,c.renderingStartTime=_e(),n.sibling=null,s=At.current,ee(At,m?s&1|2:s&1),Xe&&kr(o,c.treeForkCount),n):(pt(o),null);case 22:case 23:return Cn(o),rh(),c=o.memoizedState!==null,n!==null?n.memoizedState!==null!==c&&(o.flags|=8192):c&&(o.flags|=8192),c?(s&536870912)!==0&&(o.flags&128)===0&&(pt(o),o.subtreeFlags&6&&(o.flags|=8192)):pt(o),s=o.updateQueue,s!==null&&Ic(o,s.retryQueue),s=null,n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),c=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(c=o.memoizedState.cachePool.pool),c!==s&&(o.flags|=2048),n!==null&&V(yi),null;case 24:return s=null,n!==null&&(s=n.memoizedState.cache),o.memoizedState.cache!==s&&(o.flags|=2048),Hr(zt),pt(o),null;case 25:return null;case 30:return null}throw Error(i(156,o.tag))}function CR(n,o){switch(jd(o),o.tag){case 1:return n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 3:return Hr(zt),be(),n=o.flags,(n&65536)!==0&&(n&128)===0?(o.flags=n&-65537|128,o):null;case 26:case 27:case 5:return Te(o),null;case 31:if(o.memoizedState!==null){if(Cn(o),o.alternate===null)throw Error(i(340));mi()}return n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 13:if(Cn(o),n=o.memoizedState,n!==null&&n.dehydrated!==null){if(o.alternate===null)throw Error(i(340));mi()}return n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 19:return V(At),null;case 4:return be(),null;case 10:return Hr(o.type),null;case 22:case 23:return Cn(o),rh(),n!==null&&V(yi),n=o.flags,n&65536?(o.flags=n&-65537|128,o):null;case 24:return Hr(zt),null;case 25:return null;default:return null}}function zv(n,o){switch(jd(o),o.tag){case 3:Hr(zt),be();break;case 26:case 27:case 5:Te(o);break;case 4:be();break;case 31:o.memoizedState!==null&&Cn(o);break;case 13:Cn(o);break;case 19:V(At);break;case 10:Hr(o.type);break;case 22:case 23:Cn(o),rh(),n!==null&&V(yi);break;case 24:Hr(zt)}}function Da(n,o){try{var s=o.updateQueue,c=s!==null?s.lastEffect:null;if(c!==null){var m=c.next;s=m;do{if((s.tag&n)===n){c=void 0;var y=s.create,S=s.inst;c=y(),S.destroy=c}s=s.next}while(s!==m)}}catch(B){it(o,o.return,B)}}function So(n,o,s){try{var c=o.updateQueue,m=c!==null?c.lastEffect:null;if(m!==null){var y=m.next;c=y;do{if((c.tag&n)===n){var S=c.inst,B=S.destroy;if(B!==void 0){S.destroy=void 0,m=o;var Y=s,ne=B;try{ne()}catch(de){it(m,Y,de)}}}c=c.next}while(c!==y)}}catch(de){it(o,o.return,de)}}function Bv(n){var o=n.updateQueue;if(o!==null){var s=n.stateNode;try{wy(o,s)}catch(c){it(n,n.return,c)}}}function Uv(n,o,s){s.props=Ei(n.type,n.memoizedProps),s.state=n.memoizedState;try{s.componentWillUnmount()}catch(c){it(n,o,c)}}function za(n,o){try{var s=n.ref;if(s!==null){switch(n.tag){case 26:case 27:case 5:var c=n.stateNode;break;case 30:c=n.stateNode;break;default:c=n.stateNode}typeof s=="function"?n.refCleanup=s(c):s.current=c}}catch(m){it(n,o,m)}}function fr(n,o){var s=n.ref,c=n.refCleanup;if(s!==null)if(typeof c=="function")try{c()}catch(m){it(n,o,m)}finally{n.refCleanup=null,n=n.alternate,n!=null&&(n.refCleanup=null)}else if(typeof s=="function")try{s(null)}catch(m){it(n,o,m)}else s.current=null}function Lv(n){var o=n.type,s=n.memoizedProps,c=n.stateNode;try{e:switch(o){case"button":case"input":case"select":case"textarea":s.autoFocus&&c.focus();break e;case"img":s.src?c.src=s.src:s.srcSet&&(c.srcset=s.srcSet)}}catch(m){it(n,n.return,m)}}function Uh(n,o,s){try{var c=n.stateNode;XR(c,n.type,s,o),c[Jt]=o}catch(m){it(n,n.return,m)}}function kv(n){return n.tag===5||n.tag===3||n.tag===26||n.tag===27&&Mo(n.type)||n.tag===4}function Lh(n){e:for(;;){for(;n.sibling===null;){if(n.return===null||kv(n.return))return null;n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.tag===27&&Mo(n.type)||n.flags&2||n.child===null||n.tag===4)continue e;n.child.return=n,n=n.child}if(!(n.flags&2))return n.stateNode}}function kh(n,o,s){var c=n.tag;if(c===5||c===6)n=n.stateNode,o?(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s).insertBefore(n,o):(o=s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,o.appendChild(n),s=s._reactRootContainer,s!=null||o.onclick!==null||(o.onclick=Br));else if(c!==4&&(c===27&&Mo(n.type)&&(s=n.stateNode,o=null),n=n.child,n!==null))for(kh(n,o,s),n=n.sibling;n!==null;)kh(n,o,s),n=n.sibling}function Hc(n,o,s){var c=n.tag;if(c===5||c===6)n=n.stateNode,o?s.insertBefore(n,o):s.appendChild(n);else if(c!==4&&(c===27&&Mo(n.type)&&(s=n.stateNode),n=n.child,n!==null))for(Hc(n,o,s),n=n.sibling;n!==null;)Hc(n,o,s),n=n.sibling}function Iv(n){var o=n.stateNode,s=n.memoizedProps;try{for(var c=n.type,m=o.attributes;m.length;)o.removeAttributeNode(m[0]);Wt(o,c,s),o[jt]=n,o[Jt]=s}catch(y){it(n,n.return,y)}}var Gr=!1,Lt=!1,Ih=!1,Hv=typeof WeakSet=="function"?WeakSet:Set,Yt=null;function TR(n,o){if(n=n.containerInfo,im=su,n=Qg(n),Od(n)){if("selectionStart"in n)var s={start:n.selectionStart,end:n.selectionEnd};else e:{s=(s=n.ownerDocument)&&s.defaultView||window;var c=s.getSelection&&s.getSelection();if(c&&c.rangeCount!==0){s=c.anchorNode;var m=c.anchorOffset,y=c.focusNode;c=c.focusOffset;try{s.nodeType,y.nodeType}catch{s=null;break e}var S=0,B=-1,Y=-1,ne=0,de=0,pe=n,oe=null;t:for(;;){for(var ce;pe!==s||m!==0&&pe.nodeType!==3||(B=S+m),pe!==y||c!==0&&pe.nodeType!==3||(Y=S+c),pe.nodeType===3&&(S+=pe.nodeValue.length),(ce=pe.firstChild)!==null;)oe=pe,pe=ce;for(;;){if(pe===n)break t;if(oe===s&&++ne===m&&(B=S),oe===y&&++de===c&&(Y=S),(ce=pe.nextSibling)!==null)break;pe=oe,oe=pe.parentNode}pe=ce}s=B===-1||Y===-1?null:{start:B,end:Y}}else s=null}s=s||{start:0,end:0}}else s=null;for(sm={focusedElem:n,selectionRange:s},su=!1,Yt=o;Yt!==null;)if(o=Yt,n=o.child,(o.subtreeFlags&1028)!==0&&n!==null)n.return=o,Yt=n;else for(;Yt!==null;){switch(o=Yt,y=o.alternate,n=o.flags,o.tag){case 0:if((n&4)!==0&&(n=o.updateQueue,n=n!==null?n.events:null,n!==null))for(s=0;s<n.length;s++)m=n[s],m.ref.impl=m.nextImpl;break;case 11:case 15:break;case 1:if((n&1024)!==0&&y!==null){n=void 0,s=o,m=y.memoizedProps,y=y.memoizedState,c=s.stateNode;try{var Re=Ei(s.type,m);n=c.getSnapshotBeforeUpdate(Re,y),c.__reactInternalSnapshotBeforeUpdate=n}catch(De){it(s,s.return,De)}}break;case 3:if((n&1024)!==0){if(n=o.stateNode.containerInfo,s=n.nodeType,s===9)cm(n);else if(s===1)switch(n.nodeName){case"HEAD":case"HTML":case"BODY":cm(n);break;default:n.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((n&1024)!==0)throw Error(i(163))}if(n=o.sibling,n!==null){n.return=o.return,Yt=n;break}Yt=o.return}}function Fv(n,o,s){var c=s.flags;switch(s.tag){case 0:case 11:case 15:Yr(n,s),c&4&&Da(5,s);break;case 1:if(Yr(n,s),c&4)if(n=s.stateNode,o===null)try{n.componentDidMount()}catch(S){it(s,s.return,S)}else{var m=Ei(s.type,o.memoizedProps);o=o.memoizedState;try{n.componentDidUpdate(m,o,n.__reactInternalSnapshotBeforeUpdate)}catch(S){it(s,s.return,S)}}c&64&&Bv(s),c&512&&za(s,s.return);break;case 3:if(Yr(n,s),c&64&&(n=s.updateQueue,n!==null)){if(o=null,s.child!==null)switch(s.child.tag){case 27:case 5:o=s.child.stateNode;break;case 1:o=s.child.stateNode}try{wy(n,o)}catch(S){it(s,s.return,S)}}break;case 27:o===null&&c&4&&Iv(s);case 26:case 5:Yr(n,s),o===null&&c&4&&Lv(s),c&512&&za(s,s.return);break;case 12:Yr(n,s);break;case 31:Yr(n,s),c&4&&Vv(n,s);break;case 13:Yr(n,s),c&4&&Gv(n,s),c&64&&(n=s.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&(s=UR.bind(null,s),tA(n,s))));break;case 22:if(c=s.memoizedState!==null||Gr,!c){o=o!==null&&o.memoizedState!==null||Lt,m=Gr;var y=Lt;Gr=c,(Lt=o)&&!y?Xr(n,s,(s.subtreeFlags&8772)!==0):Yr(n,s),Gr=m,Lt=y}break;case 30:break;default:Yr(n,s)}}function Pv(n){var o=n.alternate;o!==null&&(n.alternate=null,Pv(o)),n.child=null,n.deletions=null,n.sibling=null,n.tag===5&&(o=n.stateNode,o!==null&&ia(o)),n.stateNode=null,n.return=null,n.dependencies=null,n.memoizedProps=null,n.memoizedState=null,n.pendingProps=null,n.stateNode=null,n.updateQueue=null}var vt=null,fn=!1;function qr(n,o,s){for(s=s.child;s!==null;)jv(n,o,s),s=s.sibling}function jv(n,o,s){if(Oe&&typeof Oe.onCommitFiberUnmount=="function")try{Oe.onCommitFiberUnmount(ze,s)}catch{}switch(s.tag){case 26:Lt||fr(s,o),qr(n,o,s),s.memoizedState?s.memoizedState.count--:s.stateNode&&(s=s.stateNode,s.parentNode.removeChild(s));break;case 27:Lt||fr(s,o);var c=vt,m=fn;Mo(s.type)&&(vt=s.stateNode,fn=!1),qr(n,o,s),ja(s.stateNode),vt=c,fn=m;break;case 5:Lt||fr(s,o);case 6:if(c=vt,m=fn,vt=null,qr(n,o,s),vt=c,fn=m,vt!==null)if(fn)try{(vt.nodeType===9?vt.body:vt.nodeName==="HTML"?vt.ownerDocument.body:vt).removeChild(s.stateNode)}catch(y){it(s,o,y)}else try{vt.removeChild(s.stateNode)}catch(y){it(s,o,y)}break;case 18:vt!==null&&(fn?(n=vt,Bx(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,s.stateNode),Ns(n)):Bx(vt,s.stateNode));break;case 4:c=vt,m=fn,vt=s.stateNode.containerInfo,fn=!0,qr(n,o,s),vt=c,fn=m;break;case 0:case 11:case 14:case 15:So(2,s,o),Lt||So(4,s,o),qr(n,o,s);break;case 1:Lt||(fr(s,o),c=s.stateNode,typeof c.componentWillUnmount=="function"&&Uv(s,o,c)),qr(n,o,s);break;case 21:qr(n,o,s);break;case 22:Lt=(c=Lt)||s.memoizedState!==null,qr(n,o,s),Lt=c;break;default:qr(n,o,s)}}function Vv(n,o){if(o.memoizedState===null&&(n=o.alternate,n!==null&&(n=n.memoizedState,n!==null))){n=n.dehydrated;try{Ns(n)}catch(s){it(o,o.return,s)}}}function Gv(n,o){if(o.memoizedState===null&&(n=o.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null))))try{Ns(n)}catch(s){it(o,o.return,s)}}function RR(n){switch(n.tag){case 31:case 13:case 19:var o=n.stateNode;return o===null&&(o=n.stateNode=new Hv),o;case 22:return n=n.stateNode,o=n._retryCache,o===null&&(o=n._retryCache=new Hv),o;default:throw Error(i(435,n.tag))}}function Fc(n,o){var s=RR(n);o.forEach(function(c){if(!s.has(c)){s.add(c);var m=LR.bind(null,n,c);c.then(m,m)}})}function dn(n,o){var s=o.deletions;if(s!==null)for(var c=0;c<s.length;c++){var m=s[c],y=n,S=o,B=S;e:for(;B!==null;){switch(B.tag){case 27:if(Mo(B.type)){vt=B.stateNode,fn=!1;break e}break;case 5:vt=B.stateNode,fn=!1;break e;case 3:case 4:vt=B.stateNode.containerInfo,fn=!0;break e}B=B.return}if(vt===null)throw Error(i(160));jv(y,S,m),vt=null,fn=!1,y=m.alternate,y!==null&&(y.return=null),m.return=null}if(o.subtreeFlags&13886)for(o=o.child;o!==null;)qv(o,n),o=o.sibling}var Kn=null;function qv(n,o){var s=n.alternate,c=n.flags;switch(n.tag){case 0:case 11:case 14:case 15:dn(o,n),hn(n),c&4&&(So(3,n,n.return),Da(3,n),So(5,n,n.return));break;case 1:dn(o,n),hn(n),c&512&&(Lt||s===null||fr(s,s.return)),c&64&&Gr&&(n=n.updateQueue,n!==null&&(c=n.callbacks,c!==null&&(s=n.shared.hiddenCallbacks,n.shared.hiddenCallbacks=s===null?c:s.concat(c))));break;case 26:var m=Kn;if(dn(o,n),hn(n),c&512&&(Lt||s===null||fr(s,s.return)),c&4){var y=s!==null?s.memoizedState:null;if(c=n.memoizedState,s===null)if(c===null)if(n.stateNode===null){e:{c=n.type,s=n.memoizedProps,m=m.ownerDocument||m;t:switch(c){case"title":y=m.getElementsByTagName("title")[0],(!y||y[si]||y[jt]||y.namespaceURI==="http://www.w3.org/2000/svg"||y.hasAttribute("itemprop"))&&(y=m.createElement(c),m.head.insertBefore(y,m.querySelector("head > title"))),Wt(y,c,s),y[jt]=n,Dt(y),c=y;break e;case"link":var S=qx("link","href",m).get(c+(s.href||""));if(S){for(var B=0;B<S.length;B++)if(y=S[B],y.getAttribute("href")===(s.href==null||s.href===""?null:s.href)&&y.getAttribute("rel")===(s.rel==null?null:s.rel)&&y.getAttribute("title")===(s.title==null?null:s.title)&&y.getAttribute("crossorigin")===(s.crossOrigin==null?null:s.crossOrigin)){S.splice(B,1);break t}}y=m.createElement(c),Wt(y,c,s),m.head.appendChild(y);break;case"meta":if(S=qx("meta","content",m).get(c+(s.content||""))){for(B=0;B<S.length;B++)if(y=S[B],y.getAttribute("content")===(s.content==null?null:""+s.content)&&y.getAttribute("name")===(s.name==null?null:s.name)&&y.getAttribute("property")===(s.property==null?null:s.property)&&y.getAttribute("http-equiv")===(s.httpEquiv==null?null:s.httpEquiv)&&y.getAttribute("charset")===(s.charSet==null?null:s.charSet)){S.splice(B,1);break t}}y=m.createElement(c),Wt(y,c,s),m.head.appendChild(y);break;default:throw Error(i(468,c))}y[jt]=n,Dt(y),c=y}n.stateNode=c}else Yx(m,n.type,n.stateNode);else n.stateNode=Gx(m,c,n.memoizedProps);else y!==c?(y===null?s.stateNode!==null&&(s=s.stateNode,s.parentNode.removeChild(s)):y.count--,c===null?Yx(m,n.type,n.stateNode):Gx(m,c,n.memoizedProps)):c===null&&n.stateNode!==null&&Uh(n,n.memoizedProps,s.memoizedProps)}break;case 27:dn(o,n),hn(n),c&512&&(Lt||s===null||fr(s,s.return)),s!==null&&c&4&&Uh(n,n.memoizedProps,s.memoizedProps);break;case 5:if(dn(o,n),hn(n),c&512&&(Lt||s===null||fr(s,s.return)),n.flags&32){m=n.stateNode;try{Wi(m,"")}catch(Re){it(n,n.return,Re)}}c&4&&n.stateNode!=null&&(m=n.memoizedProps,Uh(n,m,s!==null?s.memoizedProps:m)),c&1024&&(Ih=!0);break;case 6:if(dn(o,n),hn(n),c&4){if(n.stateNode===null)throw Error(i(162));c=n.memoizedProps,s=n.stateNode;try{s.nodeValue=c}catch(Re){it(n,n.return,Re)}}break;case 3:if(nu=null,m=Kn,Kn=eu(o.containerInfo),dn(o,n),Kn=m,hn(n),c&4&&s!==null&&s.memoizedState.isDehydrated)try{Ns(o.containerInfo)}catch(Re){it(n,n.return,Re)}Ih&&(Ih=!1,Yv(n));break;case 4:c=Kn,Kn=eu(n.stateNode.containerInfo),dn(o,n),hn(n),Kn=c;break;case 12:dn(o,n),hn(n);break;case 31:dn(o,n),hn(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Fc(n,c)));break;case 13:dn(o,n),hn(n),n.child.flags&8192&&n.memoizedState!==null!=(s!==null&&s.memoizedState!==null)&&(jc=_e()),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Fc(n,c)));break;case 22:m=n.memoizedState!==null;var Y=s!==null&&s.memoizedState!==null,ne=Gr,de=Lt;if(Gr=ne||m,Lt=de||Y,dn(o,n),Lt=de,Gr=ne,hn(n),c&8192)e:for(o=n.stateNode,o._visibility=m?o._visibility&-2:o._visibility|1,m&&(s===null||Y||Gr||Lt||Si(n)),s=null,o=n;;){if(o.tag===5||o.tag===26){if(s===null){Y=s=o;try{if(y=Y.stateNode,m)S=y.style,typeof S.setProperty=="function"?S.setProperty("display","none","important"):S.display="none";else{B=Y.stateNode;var pe=Y.memoizedProps.style,oe=pe!=null&&pe.hasOwnProperty("display")?pe.display:null;B.style.display=oe==null||typeof oe=="boolean"?"":(""+oe).trim()}}catch(Re){it(Y,Y.return,Re)}}}else if(o.tag===6){if(s===null){Y=o;try{Y.stateNode.nodeValue=m?"":Y.memoizedProps}catch(Re){it(Y,Y.return,Re)}}}else if(o.tag===18){if(s===null){Y=o;try{var ce=Y.stateNode;m?Ux(ce,!0):Ux(Y.stateNode,!1)}catch(Re){it(Y,Y.return,Re)}}}else if((o.tag!==22&&o.tag!==23||o.memoizedState===null||o===n)&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===n)break e;for(;o.sibling===null;){if(o.return===null||o.return===n)break e;s===o&&(s=null),o=o.return}s===o&&(s=null),o.sibling.return=o.return,o=o.sibling}c&4&&(c=n.updateQueue,c!==null&&(s=c.retryQueue,s!==null&&(c.retryQueue=null,Fc(n,s))));break;case 19:dn(o,n),hn(n),c&4&&(c=n.updateQueue,c!==null&&(n.updateQueue=null,Fc(n,c)));break;case 30:break;case 21:break;default:dn(o,n),hn(n)}}function hn(n){var o=n.flags;if(o&2){try{for(var s,c=n.return;c!==null;){if(kv(c)){s=c;break}c=c.return}if(s==null)throw Error(i(160));switch(s.tag){case 27:var m=s.stateNode,y=Lh(n);Hc(n,y,m);break;case 5:var S=s.stateNode;s.flags&32&&(Wi(S,""),s.flags&=-33);var B=Lh(n);Hc(n,B,S);break;case 3:case 4:var Y=s.stateNode.containerInfo,ne=Lh(n);kh(n,ne,Y);break;default:throw Error(i(161))}}catch(de){it(n,n.return,de)}n.flags&=-3}o&4096&&(n.flags&=-4097)}function Yv(n){if(n.subtreeFlags&1024)for(n=n.child;n!==null;){var o=n;Yv(o),o.tag===5&&o.flags&1024&&o.stateNode.reset(),n=n.sibling}}function Yr(n,o){if(o.subtreeFlags&8772)for(o=o.child;o!==null;)Fv(n,o.alternate,o),o=o.sibling}function Si(n){for(n=n.child;n!==null;){var o=n;switch(o.tag){case 0:case 11:case 14:case 15:So(4,o,o.return),Si(o);break;case 1:fr(o,o.return);var s=o.stateNode;typeof s.componentWillUnmount=="function"&&Uv(o,o.return,s),Si(o);break;case 27:ja(o.stateNode);case 26:case 5:fr(o,o.return),Si(o);break;case 22:o.memoizedState===null&&Si(o);break;case 30:Si(o);break;default:Si(o)}n=n.sibling}}function Xr(n,o,s){for(s=s&&(o.subtreeFlags&8772)!==0,o=o.child;o!==null;){var c=o.alternate,m=n,y=o,S=y.flags;switch(y.tag){case 0:case 11:case 15:Xr(m,y,s),Da(4,y);break;case 1:if(Xr(m,y,s),c=y,m=c.stateNode,typeof m.componentDidMount=="function")try{m.componentDidMount()}catch(ne){it(c,c.return,ne)}if(c=y,m=c.updateQueue,m!==null){var B=c.stateNode;try{var Y=m.shared.hiddenCallbacks;if(Y!==null)for(m.shared.hiddenCallbacks=null,m=0;m<Y.length;m++)Sy(Y[m],B)}catch(ne){it(c,c.return,ne)}}s&&S&64&&Bv(y),za(y,y.return);break;case 27:Iv(y);case 26:case 5:Xr(m,y,s),s&&c===null&&S&4&&Lv(y),za(y,y.return);break;case 12:Xr(m,y,s);break;case 31:Xr(m,y,s),s&&S&4&&Vv(m,y);break;case 13:Xr(m,y,s),s&&S&4&&Gv(m,y);break;case 22:y.memoizedState===null&&Xr(m,y,s),za(y,y.return);break;case 30:break;default:Xr(m,y,s)}o=o.sibling}}function Hh(n,o){var s=null;n!==null&&n.memoizedState!==null&&n.memoizedState.cachePool!==null&&(s=n.memoizedState.cachePool.pool),n=null,o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(n=o.memoizedState.cachePool.pool),n!==s&&(n!=null&&n.refCount++,s!=null&&xa(s))}function Fh(n,o){n=null,o.alternate!==null&&(n=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==n&&(o.refCount++,n!=null&&xa(n))}function Zn(n,o,s,c){if(o.subtreeFlags&10256)for(o=o.child;o!==null;)Xv(n,o,s,c),o=o.sibling}function Xv(n,o,s,c){var m=o.flags;switch(o.tag){case 0:case 11:case 15:Zn(n,o,s,c),m&2048&&Da(9,o);break;case 1:Zn(n,o,s,c);break;case 3:Zn(n,o,s,c),m&2048&&(n=null,o.alternate!==null&&(n=o.alternate.memoizedState.cache),o=o.memoizedState.cache,o!==n&&(o.refCount++,n!=null&&xa(n)));break;case 12:if(m&2048){Zn(n,o,s,c),n=o.stateNode;try{var y=o.memoizedProps,S=y.id,B=y.onPostCommit;typeof B=="function"&&B(S,o.alternate===null?"mount":"update",n.passiveEffectDuration,-0)}catch(Y){it(o,o.return,Y)}}else Zn(n,o,s,c);break;case 31:Zn(n,o,s,c);break;case 13:Zn(n,o,s,c);break;case 23:break;case 22:y=o.stateNode,S=o.alternate,o.memoizedState!==null?y._visibility&2?Zn(n,o,s,c):Ba(n,o):y._visibility&2?Zn(n,o,s,c):(y._visibility|=2,vs(n,o,s,c,(o.subtreeFlags&10256)!==0||!1)),m&2048&&Hh(S,o);break;case 24:Zn(n,o,s,c),m&2048&&Fh(o.alternate,o);break;default:Zn(n,o,s,c)}}function vs(n,o,s,c,m){for(m=m&&((o.subtreeFlags&10256)!==0||!1),o=o.child;o!==null;){var y=n,S=o,B=s,Y=c,ne=S.flags;switch(S.tag){case 0:case 11:case 15:vs(y,S,B,Y,m),Da(8,S);break;case 23:break;case 22:var de=S.stateNode;S.memoizedState!==null?de._visibility&2?vs(y,S,B,Y,m):Ba(y,S):(de._visibility|=2,vs(y,S,B,Y,m)),m&&ne&2048&&Hh(S.alternate,S);break;case 24:vs(y,S,B,Y,m),m&&ne&2048&&Fh(S.alternate,S);break;default:vs(y,S,B,Y,m)}o=o.sibling}}function Ba(n,o){if(o.subtreeFlags&10256)for(o=o.child;o!==null;){var s=n,c=o,m=c.flags;switch(c.tag){case 22:Ba(s,c),m&2048&&Hh(c.alternate,c);break;case 24:Ba(s,c),m&2048&&Fh(c.alternate,c);break;default:Ba(s,c)}o=o.sibling}}var Ua=8192;function xs(n,o,s){if(n.subtreeFlags&Ua)for(n=n.child;n!==null;)$v(n,o,s),n=n.sibling}function $v(n,o,s){switch(n.tag){case 26:xs(n,o,s),n.flags&Ua&&n.memoizedState!==null&&hA(s,Kn,n.memoizedState,n.memoizedProps);break;case 5:xs(n,o,s);break;case 3:case 4:var c=Kn;Kn=eu(n.stateNode.containerInfo),xs(n,o,s),Kn=c;break;case 22:n.memoizedState===null&&(c=n.alternate,c!==null&&c.memoizedState!==null?(c=Ua,Ua=16777216,xs(n,o,s),Ua=c):xs(n,o,s));break;default:xs(n,o,s)}}function Kv(n){var o=n.alternate;if(o!==null&&(n=o.child,n!==null)){o.child=null;do o=n.sibling,n.sibling=null,n=o;while(n!==null)}}function La(n){var o=n.deletions;if((n.flags&16)!==0){if(o!==null)for(var s=0;s<o.length;s++){var c=o[s];Yt=c,Qv(c,n)}Kv(n)}if(n.subtreeFlags&10256)for(n=n.child;n!==null;)Zv(n),n=n.sibling}function Zv(n){switch(n.tag){case 0:case 11:case 15:La(n),n.flags&2048&&So(9,n,n.return);break;case 3:La(n);break;case 12:La(n);break;case 22:var o=n.stateNode;n.memoizedState!==null&&o._visibility&2&&(n.return===null||n.return.tag!==13)?(o._visibility&=-3,Pc(n)):La(n);break;default:La(n)}}function Pc(n){var o=n.deletions;if((n.flags&16)!==0){if(o!==null)for(var s=0;s<o.length;s++){var c=o[s];Yt=c,Qv(c,n)}Kv(n)}for(n=n.child;n!==null;){switch(o=n,o.tag){case 0:case 11:case 15:So(8,o,o.return),Pc(o);break;case 22:s=o.stateNode,s._visibility&2&&(s._visibility&=-3,Pc(o));break;default:Pc(o)}n=n.sibling}}function Qv(n,o){for(;Yt!==null;){var s=Yt;switch(s.tag){case 0:case 11:case 15:So(8,s,o);break;case 23:case 22:if(s.memoizedState!==null&&s.memoizedState.cachePool!==null){var c=s.memoizedState.cachePool.pool;c!=null&&c.refCount++}break;case 24:xa(s.memoizedState.cache)}if(c=s.child,c!==null)c.return=s,Yt=c;else e:for(s=n;Yt!==null;){c=Yt;var m=c.sibling,y=c.return;if(Pv(c),c===s){Yt=null;break e}if(m!==null){m.return=y,Yt=m;break e}Yt=y}}}var AR={getCacheForType:function(n){var o=Zt(zt),s=o.data.get(n);return s===void 0&&(s=n(),o.data.set(n,s)),s},cacheSignal:function(){return Zt(zt).controller.signal}},NR=typeof WeakMap=="function"?WeakMap:Map,nt=0,dt=null,Pe=null,Ge=0,ot=0,Tn=null,wo=!1,bs=!1,Ph=!1,$r=0,Rt=0,Co=0,wi=0,jh=0,Rn=0,_s=0,ka=null,mn=null,Vh=!1,jc=0,Wv=0,Vc=1/0,Gc=null,To=null,Vt=0,Ro=null,Es=null,Kr=0,Gh=0,qh=null,Jv=null,Ia=0,Yh=null;function An(){return(nt&2)!==0&&Ge!==0?Ge&-Ge:z.T!==null?Wh():Yi()}function ex(){if(Rn===0)if((Ge&536870912)===0||Xe){var n=Pt;Pt<<=1,(Pt&3932160)===0&&(Pt=262144),Rn=n}else Rn=536870912;return n=wn.current,n!==null&&(n.flags|=32),Rn}function pn(n,o,s){(n===dt&&(ot===2||ot===9)||n.cancelPendingCommit!==null)&&(Ss(n,0),Ao(n,Ge,Rn,!1)),Mr(n,s),((nt&2)===0||n!==dt)&&(n===dt&&((nt&2)===0&&(wi|=s),Rt===4&&Ao(n,Ge,Rn,!1)),dr(n))}function tx(n,o,s){if((nt&6)!==0)throw Error(i(327));var c=!s&&(o&127)===0&&(o&n.expiredLanes)===0||Un(n,o),m=c?DR(n,o):$h(n,o,!0),y=c;do{if(m===0){bs&&!c&&Ao(n,o,0,!1);break}else{if(s=n.current.alternate,y&&!MR(s)){m=$h(n,o,!1),y=!1;continue}if(m===2){if(y=o,n.errorRecoveryDisabledLanes&y)var S=0;else S=n.pendingLanes&-536870913,S=S!==0?S:S&536870912?536870912:0;if(S!==0){o=S;e:{var B=n;m=ka;var Y=B.current.memoizedState.isDehydrated;if(Y&&(Ss(B,S).flags|=256),S=$h(B,S,!1),S!==2){if(Ph&&!Y){B.errorRecoveryDisabledLanes|=y,wi|=y,m=4;break e}y=mn,mn=m,y!==null&&(mn===null?mn=y:mn.push.apply(mn,y))}m=S}if(y=!1,m!==2)continue}}if(m===1){Ss(n,0),Ao(n,o,0,!0);break}e:{switch(c=n,y=m,y){case 0:case 1:throw Error(i(345));case 4:if((o&4194048)!==o)break;case 6:Ao(c,o,Rn,!wo);break e;case 2:mn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((o&62914560)===o&&(m=jc+300-_e(),10<m)){if(Ao(c,o,Rn,!wo),_n(c,0,!0)!==0)break e;Kr=o,c.timeoutHandle=Dx(nx.bind(null,c,s,mn,Gc,Vh,o,Rn,wi,_s,wo,y,"Throttled",-0,0),m);break e}nx(c,s,mn,Gc,Vh,o,Rn,wi,_s,wo,y,null,-0,0)}}break}while(!0);dr(n)}function nx(n,o,s,c,m,y,S,B,Y,ne,de,pe,oe,ce){if(n.timeoutHandle=-1,pe=o.subtreeFlags,pe&8192||(pe&16785408)===16785408){pe={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Br},$v(o,y,pe);var Re=(y&62914560)===y?jc-_e():(y&4194048)===y?Wv-_e():0;if(Re=mA(pe,Re),Re!==null){Kr=y,n.cancelPendingCommit=Re(ux.bind(null,n,o,y,s,c,m,S,B,Y,de,pe,null,oe,ce)),Ao(n,y,S,!ne);return}}ux(n,o,y,s,c,m,S,B,Y)}function MR(n){for(var o=n;;){var s=o.tag;if((s===0||s===11||s===15)&&o.flags&16384&&(s=o.updateQueue,s!==null&&(s=s.stores,s!==null)))for(var c=0;c<s.length;c++){var m=s[c],y=m.getSnapshot;m=m.value;try{if(!En(y(),m))return!1}catch{return!1}}if(s=o.child,o.subtreeFlags&16384&&s!==null)s.return=o,o=s;else{if(o===n)break;for(;o.sibling===null;){if(o.return===null||o.return===n)return!0;o=o.return}o.sibling.return=o.return,o=o.sibling}}return!0}function Ao(n,o,s,c){o&=~jh,o&=~wi,n.suspendedLanes|=o,n.pingedLanes&=~o,c&&(n.warmLanes|=o),c=n.expirationTimes;for(var m=o;0<m;){var y=31-wt(m),S=1<<y;c[y]=-1,m&=~S}s!==0&&oi(n,s,o)}function qc(){return(nt&6)===0?(Ha(0),!1):!0}function Xh(){if(Pe!==null){if(ot===0)var n=Pe.return;else n=Pe,Ir=pi=null,ch(n),hs=null,_a=0,n=Pe;for(;n!==null;)zv(n.alternate,n),n=n.return;Pe=null}}function Ss(n,o){var s=n.timeoutHandle;s!==-1&&(n.timeoutHandle=-1,ZR(s)),s=n.cancelPendingCommit,s!==null&&(n.cancelPendingCommit=null,s()),Kr=0,Xh(),dt=n,Pe=s=Lr(n.current,null),Ge=o,ot=0,Tn=null,wo=!1,bs=Un(n,o),Ph=!1,_s=Rn=jh=wi=Co=Rt=0,mn=ka=null,Vh=!1,(o&8)!==0&&(o|=o&32);var c=n.entangledLanes;if(c!==0)for(n=n.entanglements,c&=o;0<c;){var m=31-wt(c),y=1<<m;o|=n[m],c&=~y}return $r=o,dc(),s}function rx(n,o){ke=null,z.H=Na,o===ds||o===bc?(o=xy(),ot=3):o===Qd?(o=xy(),ot=4):ot=o===Ch?8:o!==null&&typeof o=="object"&&typeof o.then=="function"?6:1,Tn=o,Pe===null&&(Rt=1,Bc(n,kn(o,n.current)))}function ox(){var n=wn.current;return n===null?!0:(Ge&4194048)===Ge?Pn===null:(Ge&62914560)===Ge||(Ge&536870912)!==0?n===Pn:!1}function ix(){var n=z.H;return z.H=Na,n===null?Na:n}function sx(){var n=z.A;return z.A=AR,n}function Yc(){Rt=4,wo||(Ge&4194048)!==Ge&&wn.current!==null||(bs=!0),(Co&134217727)===0&&(wi&134217727)===0||dt===null||Ao(dt,Ge,Rn,!1)}function $h(n,o,s){var c=nt;nt|=2;var m=ix(),y=sx();(dt!==n||Ge!==o)&&(Gc=null,Ss(n,o)),o=!1;var S=Rt;e:do try{if(ot!==0&&Pe!==null){var B=Pe,Y=Tn;switch(ot){case 8:Xh(),S=6;break e;case 3:case 2:case 9:case 6:wn.current===null&&(o=!0);var ne=ot;if(ot=0,Tn=null,ws(n,B,Y,ne),s&&bs){S=0;break e}break;default:ne=ot,ot=0,Tn=null,ws(n,B,Y,ne)}}OR(),S=Rt;break}catch(de){rx(n,de)}while(!0);return o&&n.shellSuspendCounter++,Ir=pi=null,nt=c,z.H=m,z.A=y,Pe===null&&(dt=null,Ge=0,dc()),S}function OR(){for(;Pe!==null;)ax(Pe)}function DR(n,o){var s=nt;nt|=2;var c=ix(),m=sx();dt!==n||Ge!==o?(Gc=null,Vc=_e()+500,Ss(n,o)):bs=Un(n,o);e:do try{if(ot!==0&&Pe!==null){o=Pe;var y=Tn;t:switch(ot){case 1:ot=0,Tn=null,ws(n,o,y,1);break;case 2:case 9:if(yy(y)){ot=0,Tn=null,lx(o);break}o=function(){ot!==2&&ot!==9||dt!==n||(ot=7),dr(n)},y.then(o,o);break e;case 3:ot=7;break e;case 4:ot=5;break e;case 7:yy(y)?(ot=0,Tn=null,lx(o)):(ot=0,Tn=null,ws(n,o,y,7));break;case 5:var S=null;switch(Pe.tag){case 26:S=Pe.memoizedState;case 5:case 27:var B=Pe;if(S?Xx(S):B.stateNode.complete){ot=0,Tn=null;var Y=B.sibling;if(Y!==null)Pe=Y;else{var ne=B.return;ne!==null?(Pe=ne,Xc(ne)):Pe=null}break t}}ot=0,Tn=null,ws(n,o,y,5);break;case 6:ot=0,Tn=null,ws(n,o,y,6);break;case 8:Xh(),Rt=6;break e;default:throw Error(i(462))}}zR();break}catch(de){rx(n,de)}while(!0);return Ir=pi=null,z.H=c,z.A=m,nt=s,Pe!==null?0:(dt=null,Ge=0,dc(),Rt)}function zR(){for(;Pe!==null&&!ge();)ax(Pe)}function ax(n){var o=Ov(n.alternate,n,$r);n.memoizedProps=n.pendingProps,o===null?Xc(n):Pe=o}function lx(n){var o=n,s=o.alternate;switch(o.tag){case 15:case 0:o=Cv(s,o,o.pendingProps,o.type,void 0,Ge);break;case 11:o=Cv(s,o,o.pendingProps,o.type.render,o.ref,Ge);break;case 5:ch(o);default:zv(s,o),o=Pe=sy(o,$r),o=Ov(s,o,$r)}n.memoizedProps=n.pendingProps,o===null?Xc(n):Pe=o}function ws(n,o,s,c){Ir=pi=null,ch(o),hs=null,_a=0;var m=o.return;try{if(_R(n,m,o,s,Ge)){Rt=1,Bc(n,kn(s,n.current)),Pe=null;return}}catch(y){if(m!==null)throw Pe=m,y;Rt=1,Bc(n,kn(s,n.current)),Pe=null;return}o.flags&32768?(Xe||c===1?n=!0:bs||(Ge&536870912)!==0?n=!1:(wo=n=!0,(c===2||c===9||c===3||c===6)&&(c=wn.current,c!==null&&c.tag===13&&(c.flags|=16384))),cx(o,n)):Xc(o)}function Xc(n){var o=n;do{if((o.flags&32768)!==0){cx(o,wo);return}n=o.return;var s=wR(o.alternate,o,$r);if(s!==null){Pe=s;return}if(o=o.sibling,o!==null){Pe=o;return}Pe=o=n}while(o!==null);Rt===0&&(Rt=5)}function cx(n,o){do{var s=CR(n.alternate,n);if(s!==null){s.flags&=32767,Pe=s;return}if(s=n.return,s!==null&&(s.flags|=32768,s.subtreeFlags=0,s.deletions=null),!o&&(n=n.sibling,n!==null)){Pe=n;return}Pe=n=s}while(n!==null);Rt=6,Pe=null}function ux(n,o,s,c,m,y,S,B,Y){n.cancelPendingCommit=null;do $c();while(Vt!==0);if((nt&6)!==0)throw Error(i(327));if(o!==null){if(o===n.current)throw Error(i(177));if(y=o.lanes|o.childLanes,y|=Ld,ri(n,s,y,S,B,Y),n===dt&&(Pe=dt=null,Ge=0),Es=o,Ro=n,Kr=s,Gh=y,qh=m,Jv=c,(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?(n.callbackNode=null,n.callbackPriority=0,kR(at,function(){return px(),null})):(n.callbackNode=null,n.callbackPriority=0),c=(o.flags&13878)!==0,(o.subtreeFlags&13878)!==0||c){c=z.T,z.T=null,m=L.p,L.p=2,S=nt,nt|=4;try{TR(n,o,s)}finally{nt=S,L.p=m,z.T=c}}Vt=1,fx(),dx(),hx()}}function fx(){if(Vt===1){Vt=0;var n=Ro,o=Es,s=(o.flags&13878)!==0;if((o.subtreeFlags&13878)!==0||s){s=z.T,z.T=null;var c=L.p;L.p=2;var m=nt;nt|=4;try{qv(o,n);var y=sm,S=Qg(n.containerInfo),B=y.focusedElem,Y=y.selectionRange;if(S!==B&&B&&B.ownerDocument&&Zg(B.ownerDocument.documentElement,B)){if(Y!==null&&Od(B)){var ne=Y.start,de=Y.end;if(de===void 0&&(de=ne),"selectionStart"in B)B.selectionStart=ne,B.selectionEnd=Math.min(de,B.value.length);else{var pe=B.ownerDocument||document,oe=pe&&pe.defaultView||window;if(oe.getSelection){var ce=oe.getSelection(),Re=B.textContent.length,De=Math.min(Y.start,Re),ut=Y.end===void 0?De:Math.min(Y.end,Re);!ce.extend&&De>ut&&(S=ut,ut=De,De=S);var W=Kg(B,De),$=Kg(B,ut);if(W&&$&&(ce.rangeCount!==1||ce.anchorNode!==W.node||ce.anchorOffset!==W.offset||ce.focusNode!==$.node||ce.focusOffset!==$.offset)){var te=pe.createRange();te.setStart(W.node,W.offset),ce.removeAllRanges(),De>ut?(ce.addRange(te),ce.extend($.node,$.offset)):(te.setEnd($.node,$.offset),ce.addRange(te))}}}}for(pe=[],ce=B;ce=ce.parentNode;)ce.nodeType===1&&pe.push({element:ce,left:ce.scrollLeft,top:ce.scrollTop});for(typeof B.focus=="function"&&B.focus(),B=0;B<pe.length;B++){var me=pe[B];me.element.scrollLeft=me.left,me.element.scrollTop=me.top}}su=!!im,sm=im=null}finally{nt=m,L.p=c,z.T=s}}n.current=o,Vt=2}}function dx(){if(Vt===2){Vt=0;var n=Ro,o=Es,s=(o.flags&8772)!==0;if((o.subtreeFlags&8772)!==0||s){s=z.T,z.T=null;var c=L.p;L.p=2;var m=nt;nt|=4;try{Fv(n,o.alternate,o)}finally{nt=m,L.p=c,z.T=s}}Vt=3}}function hx(){if(Vt===4||Vt===3){Vt=0,Se();var n=Ro,o=Es,s=Kr,c=Jv;(o.subtreeFlags&10256)!==0||(o.flags&10256)!==0?Vt=5:(Vt=0,Es=Ro=null,mx(n,n.pendingLanes));var m=n.pendingLanes;if(m===0&&(To=null),ii(s),o=o.stateNode,Oe&&typeof Oe.onCommitFiberRoot=="function")try{Oe.onCommitFiberRoot(ze,o,void 0,(o.current.flags&128)===128)}catch{}if(c!==null){o=z.T,m=L.p,L.p=2,z.T=null;try{for(var y=n.onRecoverableError,S=0;S<c.length;S++){var B=c[S];y(B.value,{componentStack:B.stack})}}finally{z.T=o,L.p=m}}(Kr&3)!==0&&$c(),dr(n),m=n.pendingLanes,(s&261930)!==0&&(m&42)!==0?n===Yh?Ia++:(Ia=0,Yh=n):Ia=0,Ha(0)}}function mx(n,o){(n.pooledCacheLanes&=o)===0&&(o=n.pooledCache,o!=null&&(n.pooledCache=null,xa(o)))}function $c(){return fx(),dx(),hx(),px()}function px(){if(Vt!==5)return!1;var n=Ro,o=Gh;Gh=0;var s=ii(Kr),c=z.T,m=L.p;try{L.p=32>s?32:s,z.T=null,s=qh,qh=null;var y=Ro,S=Kr;if(Vt=0,Es=Ro=null,Kr=0,(nt&6)!==0)throw Error(i(331));var B=nt;if(nt|=4,Zv(y.current),Xv(y,y.current,S,s),nt=B,Ha(0,!1),Oe&&typeof Oe.onPostCommitFiberRoot=="function")try{Oe.onPostCommitFiberRoot(ze,y)}catch{}return!0}finally{L.p=m,z.T=c,mx(n,o)}}function gx(n,o,s){o=kn(s,o),o=wh(n.stateNode,o,2),n=bo(n,o,2),n!==null&&(Mr(n,2),dr(n))}function it(n,o,s){if(n.tag===3)gx(n,n,s);else for(;o!==null;){if(o.tag===3){gx(o,n,s);break}else if(o.tag===1){var c=o.stateNode;if(typeof o.type.getDerivedStateFromError=="function"||typeof c.componentDidCatch=="function"&&(To===null||!To.has(c))){n=kn(s,n),s=yv(2),c=bo(o,s,2),c!==null&&(vv(s,c,o,n),Mr(c,2),dr(c));break}}o=o.return}}function Kh(n,o,s){var c=n.pingCache;if(c===null){c=n.pingCache=new NR;var m=new Set;c.set(o,m)}else m=c.get(o),m===void 0&&(m=new Set,c.set(o,m));m.has(s)||(Ph=!0,m.add(s),n=BR.bind(null,n,o,s),o.then(n,n))}function BR(n,o,s){var c=n.pingCache;c!==null&&c.delete(o),n.pingedLanes|=n.suspendedLanes&s,n.warmLanes&=~s,dt===n&&(Ge&s)===s&&(Rt===4||Rt===3&&(Ge&62914560)===Ge&&300>_e()-jc?(nt&2)===0&&Ss(n,0):jh|=s,_s===Ge&&(_s=0)),dr(n)}function yx(n,o){o===0&&(o=so()),n=di(n,o),n!==null&&(Mr(n,o),dr(n))}function UR(n){var o=n.memoizedState,s=0;o!==null&&(s=o.retryLane),yx(n,s)}function LR(n,o){var s=0;switch(n.tag){case 31:case 13:var c=n.stateNode,m=n.memoizedState;m!==null&&(s=m.retryLane);break;case 19:c=n.stateNode;break;case 22:c=n.stateNode._retryCache;break;default:throw Error(i(314))}c!==null&&c.delete(o),yx(n,s)}function kR(n,o){return se(n,o)}var Kc=null,Cs=null,Zh=!1,Zc=!1,Qh=!1,No=0;function dr(n){n!==Cs&&n.next===null&&(Cs===null?Kc=Cs=n:Cs=Cs.next=n),Zc=!0,Zh||(Zh=!0,HR())}function Ha(n,o){if(!Qh&&Zc){Qh=!0;do for(var s=!1,c=Kc;c!==null;){if(n!==0){var m=c.pendingLanes;if(m===0)var y=0;else{var S=c.suspendedLanes,B=c.pingedLanes;y=(1<<31-wt(42|n)+1)-1,y&=m&~(S&~B),y=y&201326741?y&201326741|1:y?y|2:0}y!==0&&(s=!0,_x(c,y))}else y=Ge,y=_n(c,c===dt?y:0,c.cancelPendingCommit!==null||c.timeoutHandle!==-1),(y&3)===0||Un(c,y)||(s=!0,_x(c,y));c=c.next}while(s);Qh=!1}}function IR(){vx()}function vx(){Zc=Zh=!1;var n=0;No!==0&&KR()&&(n=No);for(var o=_e(),s=null,c=Kc;c!==null;){var m=c.next,y=xx(c,o);y===0?(c.next=null,s===null?Kc=m:s.next=m,m===null&&(Cs=s)):(s=c,(n!==0||(y&3)!==0)&&(Zc=!0)),c=m}Vt!==0&&Vt!==5||Ha(n),No!==0&&(No=0)}function xx(n,o){for(var s=n.suspendedLanes,c=n.pingedLanes,m=n.expirationTimes,y=n.pendingLanes&-62914561;0<y;){var S=31-wt(y),B=1<<S,Y=m[S];Y===-1?((B&s)===0||(B&c)!==0)&&(m[S]=ni(B,o)):Y<=o&&(n.expiredLanes|=B),y&=~B}if(o=dt,s=Ge,s=_n(n,n===o?s:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c=n.callbackNode,s===0||n===o&&(ot===2||ot===9)||n.cancelPendingCommit!==null)return c!==null&&c!==null&&K(c),n.callbackNode=null,n.callbackPriority=0;if((s&3)===0||Un(n,s)){if(o=s&-s,o===n.callbackPriority)return o;switch(c!==null&&K(c),ii(s)){case 2:case 8:s=ft;break;case 32:s=at;break;case 268435456:s=He;break;default:s=at}return c=bx.bind(null,n),s=se(s,c),n.callbackPriority=o,n.callbackNode=s,o}return c!==null&&c!==null&&K(c),n.callbackPriority=2,n.callbackNode=null,2}function bx(n,o){if(Vt!==0&&Vt!==5)return n.callbackNode=null,n.callbackPriority=0,null;var s=n.callbackNode;if($c()&&n.callbackNode!==s)return null;var c=Ge;return c=_n(n,n===dt?c:0,n.cancelPendingCommit!==null||n.timeoutHandle!==-1),c===0?null:(tx(n,c,o),xx(n,_e()),n.callbackNode!=null&&n.callbackNode===s?bx.bind(null,n):null)}function _x(n,o){if($c())return null;tx(n,o,!0)}function HR(){QR(function(){(nt&6)!==0?se(st,IR):vx()})}function Wh(){if(No===0){var n=us;n===0&&(n=Et,Et<<=1,(Et&261888)===0&&(Et=256)),No=n}return No}function Ex(n){return n==null||typeof n=="symbol"||typeof n=="boolean"?null:typeof n=="function"?n:oc(""+n)}function Sx(n,o){var s=o.ownerDocument.createElement("input");return s.name=o.name,s.value=o.value,n.id&&s.setAttribute("form",n.id),o.parentNode.insertBefore(s,o),n=new FormData(n),s.parentNode.removeChild(s),n}function FR(n,o,s,c,m){if(o==="submit"&&s&&s.stateNode===m){var y=Ex((m[Jt]||null).action),S=c.submitter;S&&(o=(o=S[Jt]||null)?Ex(o.formAction):S.getAttribute("formAction"),o!==null&&(y=o,S=null));var B=new lc("action","action",null,c,m);n.push({event:B,listeners:[{instance:null,listener:function(){if(c.defaultPrevented){if(No!==0){var Y=S?Sx(m,S):new FormData(m);vh(s,{pending:!0,data:Y,method:m.method,action:y},null,Y)}}else typeof y=="function"&&(B.preventDefault(),Y=S?Sx(m,S):new FormData(m),vh(s,{pending:!0,data:Y,method:m.method,action:y},y,Y))},currentTarget:m}]})}}for(var Jh=0;Jh<Ud.length;Jh++){var em=Ud[Jh],PR=em.toLowerCase(),jR=em[0].toUpperCase()+em.slice(1);$n(PR,"on"+jR)}$n(ey,"onAnimationEnd"),$n(ty,"onAnimationIteration"),$n(ny,"onAnimationStart"),$n("dblclick","onDoubleClick"),$n("focusin","onFocus"),$n("focusout","onBlur"),$n(oR,"onTransitionRun"),$n(iR,"onTransitionStart"),$n(sR,"onTransitionCancel"),$n(ry,"onTransitionEnd"),fo("onMouseEnter",["mouseout","mouseover"]),fo("onMouseLeave",["mouseout","mouseover"]),fo("onPointerEnter",["pointerout","pointerover"]),fo("onPointerLeave",["pointerout","pointerover"]),Dr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),Dr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),Dr("onBeforeInput",["compositionend","keypress","textInput","paste"]),Dr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),Dr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),Dr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Fa="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(" "),VR=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Fa));function wx(n,o){o=(o&4)!==0;for(var s=0;s<n.length;s++){var c=n[s],m=c.event;c=c.listeners;e:{var y=void 0;if(o)for(var S=c.length-1;0<=S;S--){var B=c[S],Y=B.instance,ne=B.currentTarget;if(B=B.listener,Y!==y&&m.isPropagationStopped())break e;y=B,m.currentTarget=ne;try{y(m)}catch(de){fc(de)}m.currentTarget=null,y=Y}else for(S=0;S<c.length;S++){if(B=c[S],Y=B.instance,ne=B.currentTarget,B=B.listener,Y!==y&&m.isPropagationStopped())break e;y=B,m.currentTarget=ne;try{y(m)}catch(de){fc(de)}m.currentTarget=null,y=Y}}}}function je(n,o){var s=o[$i];s===void 0&&(s=o[$i]=new Set);var c=n+"__bubble";s.has(c)||(Cx(o,n,2,!1),s.add(c))}function tm(n,o,s){var c=0;o&&(c|=4),Cx(s,n,c,o)}var Qc="_reactListening"+Math.random().toString(36).slice(2);function nm(n){if(!n[Qc]){n[Qc]=!0,Wl.forEach(function(s){s!=="selectionchange"&&(VR.has(s)||tm(s,!1,n),tm(s,!0,n))});var o=n.nodeType===9?n:n.ownerDocument;o===null||o[Qc]||(o[Qc]=!0,tm("selectionchange",!1,o))}}function Cx(n,o,s,c){switch(eb(o)){case 2:var m=yA;break;case 8:m=vA;break;default:m=ym}s=m.bind(null,o,s,n),m=void 0,!Ed||o!=="touchstart"&&o!=="touchmove"&&o!=="wheel"||(m=!0),c?m!==void 0?n.addEventListener(o,s,{capture:!0,passive:m}):n.addEventListener(o,s,!0):m!==void 0?n.addEventListener(o,s,{passive:m}):n.addEventListener(o,s,!1)}function rm(n,o,s,c,m){var y=c;if((o&1)===0&&(o&2)===0&&c!==null)e:for(;;){if(c===null)return;var S=c.tag;if(S===3||S===4){var B=c.stateNode.containerInfo;if(B===m)break;if(S===4)for(S=c.return;S!==null;){var Y=S.tag;if((Y===3||Y===4)&&S.stateNode.containerInfo===m)return;S=S.return}for(;B!==null;){if(S=ao(B),S===null)return;if(Y=S.tag,Y===5||Y===6||Y===26||Y===27){c=y=S;continue e}B=B.parentNode}}c=c.return}Mg(function(){var ne=y,de=bd(s),pe=[];e:{var oe=oy.get(n);if(oe!==void 0){var ce=lc,Re=n;switch(n){case"keypress":if(sc(s)===0)break e;case"keydown":case"keyup":ce=LT;break;case"focusin":Re="focus",ce=Td;break;case"focusout":Re="blur",ce=Td;break;case"beforeblur":case"afterblur":ce=Td;break;case"click":if(s.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ce=zg;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ce=wT;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ce=HT;break;case ey:case ty:case ny:ce=RT;break;case ry:ce=PT;break;case"scroll":case"scrollend":ce=ET;break;case"wheel":ce=VT;break;case"copy":case"cut":case"paste":ce=NT;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ce=Ug;break;case"toggle":case"beforetoggle":ce=qT}var De=(o&4)!==0,ut=!De&&(n==="scroll"||n==="scrollend"),W=De?oe!==null?oe+"Capture":null:oe;De=[];for(var $=ne,te;$!==null;){var me=$;if(te=me.stateNode,me=me.tag,me!==5&&me!==26&&me!==27||te===null||W===null||(me=la($,W),me!=null&&De.push(Pa($,me,te))),ut)break;$=$.return}0<De.length&&(oe=new ce(oe,Re,null,s,de),pe.push({event:oe,listeners:De}))}}if((o&7)===0){e:{if(oe=n==="mouseover"||n==="pointerover",ce=n==="mouseout"||n==="pointerout",oe&&s!==xd&&(Re=s.relatedTarget||s.fromElement)&&(ao(Re)||Re[Or]))break e;if((ce||oe)&&(oe=de.window===de?de:(oe=de.ownerDocument)?oe.defaultView||oe.parentWindow:window,ce?(Re=s.relatedTarget||s.toElement,ce=ne,Re=Re?ao(Re):null,Re!==null&&(ut=l(Re),De=Re.tag,Re!==ut||De!==5&&De!==27&&De!==6)&&(Re=null)):(ce=null,Re=ne),ce!==Re)){if(De=zg,me="onMouseLeave",W="onMouseEnter",$="mouse",(n==="pointerout"||n==="pointerover")&&(De=Ug,me="onPointerLeave",W="onPointerEnter",$="pointer"),ut=ce==null?oe:co(ce),te=Re==null?oe:co(Re),oe=new De(me,$+"leave",ce,s,de),oe.target=ut,oe.relatedTarget=te,me=null,ao(de)===ne&&(De=new De(W,$+"enter",Re,s,de),De.target=te,De.relatedTarget=ut,me=De),ut=me,ce&&Re)t:{for(De=GR,W=ce,$=Re,te=0,me=W;me;me=De(me))te++;me=0;for(var Me=$;Me;Me=De(Me))me++;for(;0<te-me;)W=De(W),te--;for(;0<me-te;)$=De($),me--;for(;te--;){if(W===$||$!==null&&W===$.alternate){De=W;break t}W=De(W),$=De($)}De=null}else De=null;ce!==null&&Tx(pe,oe,ce,De,!1),Re!==null&&ut!==null&&Tx(pe,ut,Re,De,!0)}}e:{if(oe=ne?co(ne):window,ce=oe.nodeName&&oe.nodeName.toLowerCase(),ce==="select"||ce==="input"&&oe.type==="file")var et=Vg;else if(Pg(oe))if(Gg)et=tR;else{et=JT;var Ae=WT}else ce=oe.nodeName,!ce||ce.toLowerCase()!=="input"||oe.type!=="checkbox"&&oe.type!=="radio"?ne&&vd(ne.elementType)&&(et=Vg):et=eR;if(et&&(et=et(n,ne))){jg(pe,et,s,de);break e}Ae&&Ae(n,oe,ne),n==="focusout"&&ne&&oe.type==="number"&&ne.memoizedProps.value!=null&&aa(oe,"number",oe.value)}switch(Ae=ne?co(ne):window,n){case"focusin":(Pg(Ae)||Ae.contentEditable==="true")&&(ns=Ae,Dd=ne,ga=null);break;case"focusout":ga=Dd=ns=null;break;case"mousedown":zd=!0;break;case"contextmenu":case"mouseup":case"dragend":zd=!1,Wg(pe,s,de);break;case"selectionchange":if(rR)break;case"keydown":case"keyup":Wg(pe,s,de)}var Ie;if(Ad)e:{switch(n){case"compositionstart":var qe="onCompositionStart";break e;case"compositionend":qe="onCompositionEnd";break e;case"compositionupdate":qe="onCompositionUpdate";break e}qe=void 0}else ts?Hg(n,s)&&(qe="onCompositionEnd"):n==="keydown"&&s.keyCode===229&&(qe="onCompositionStart");qe&&(Lg&&s.locale!=="ko"&&(ts||qe!=="onCompositionStart"?qe==="onCompositionEnd"&&ts&&(Ie=Og()):(ho=de,Sd="value"in ho?ho.value:ho.textContent,ts=!0)),Ae=Wc(ne,qe),0<Ae.length&&(qe=new Bg(qe,n,null,s,de),pe.push({event:qe,listeners:Ae}),Ie?qe.data=Ie:(Ie=Fg(s),Ie!==null&&(qe.data=Ie)))),(Ie=XT?$T(n,s):KT(n,s))&&(qe=Wc(ne,"onBeforeInput"),0<qe.length&&(Ae=new Bg("onBeforeInput","beforeinput",null,s,de),pe.push({event:Ae,listeners:qe}),Ae.data=Ie)),FR(pe,n,ne,s,de)}wx(pe,o)})}function Pa(n,o,s){return{instance:n,listener:o,currentTarget:s}}function Wc(n,o){for(var s=o+"Capture",c=[];n!==null;){var m=n,y=m.stateNode;if(m=m.tag,m!==5&&m!==26&&m!==27||y===null||(m=la(n,s),m!=null&&c.unshift(Pa(n,m,y)),m=la(n,o),m!=null&&c.push(Pa(n,m,y))),n.tag===3)return c;n=n.return}return[]}function GR(n){if(n===null)return null;do n=n.return;while(n&&n.tag!==5&&n.tag!==27);return n||null}function Tx(n,o,s,c,m){for(var y=o._reactName,S=[];s!==null&&s!==c;){var B=s,Y=B.alternate,ne=B.stateNode;if(B=B.tag,Y!==null&&Y===c)break;B!==5&&B!==26&&B!==27||ne===null||(Y=ne,m?(ne=la(s,y),ne!=null&&S.unshift(Pa(s,ne,Y))):m||(ne=la(s,y),ne!=null&&S.push(Pa(s,ne,Y)))),s=s.return}S.length!==0&&n.push({event:o,listeners:S})}var qR=/\r\n?/g,YR=/\u0000|\uFFFD/g;function Rx(n){return(typeof n=="string"?n:""+n).replace(qR,`
9
+ `).replace(YR,"")}function Ax(n,o){return o=Rx(o),Rx(n)===o}function ct(n,o,s,c,m,y){switch(s){case"children":typeof c=="string"?o==="body"||o==="textarea"&&c===""||Wi(n,c):(typeof c=="number"||typeof c=="bigint")&&o!=="body"&&Wi(n,""+c);break;case"className":Zi(n,"class",c);break;case"tabIndex":Zi(n,"tabindex",c);break;case"dir":case"role":case"viewBox":case"width":case"height":Zi(n,s,c);break;case"style":Ag(n,c,y);break;case"data":if(o!=="object"){Zi(n,"data",c);break}case"src":case"href":if(c===""&&(o!=="a"||s!=="href")){n.removeAttribute(s);break}if(c==null||typeof c=="function"||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(s);break}c=oc(""+c),n.setAttribute(s,c);break;case"action":case"formAction":if(typeof c=="function"){n.setAttribute(s,"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 y=="function"&&(s==="formAction"?(o!=="input"&&ct(n,o,"name",m.name,m,null),ct(n,o,"formEncType",m.formEncType,m,null),ct(n,o,"formMethod",m.formMethod,m,null),ct(n,o,"formTarget",m.formTarget,m,null)):(ct(n,o,"encType",m.encType,m,null),ct(n,o,"method",m.method,m,null),ct(n,o,"target",m.target,m,null)));if(c==null||typeof c=="symbol"||typeof c=="boolean"){n.removeAttribute(s);break}c=oc(""+c),n.setAttribute(s,c);break;case"onClick":c!=null&&(n.onclick=Br);break;case"onScroll":c!=null&&je("scroll",n);break;case"onScrollEnd":c!=null&&je("scrollend",n);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(i(61));if(s=c.__html,s!=null){if(m.children!=null)throw Error(i(60));n.innerHTML=s}}break;case"multiple":n.multiple=c&&typeof c!="function"&&typeof c!="symbol";break;case"muted":n.muted=c&&typeof c!="function"&&typeof c!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(c==null||typeof c=="function"||typeof c=="boolean"||typeof c=="symbol"){n.removeAttribute("xlink:href");break}s=oc(""+c),n.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",s);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(s,""+c):n.removeAttribute(s);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":c&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(s,""):n.removeAttribute(s);break;case"capture":case"download":c===!0?n.setAttribute(s,""):c!==!1&&c!=null&&typeof c!="function"&&typeof c!="symbol"?n.setAttribute(s,c):n.removeAttribute(s);break;case"cols":case"rows":case"size":case"span":c!=null&&typeof c!="function"&&typeof c!="symbol"&&!isNaN(c)&&1<=c?n.setAttribute(s,c):n.removeAttribute(s);break;case"rowSpan":case"start":c==null||typeof c=="function"||typeof c=="symbol"||isNaN(c)?n.removeAttribute(s):n.setAttribute(s,c);break;case"popover":je("beforetoggle",n),je("toggle",n),Ki(n,"popover",c);break;case"xlinkActuate":Xn(n,"http://www.w3.org/1999/xlink","xlink:actuate",c);break;case"xlinkArcrole":Xn(n,"http://www.w3.org/1999/xlink","xlink:arcrole",c);break;case"xlinkRole":Xn(n,"http://www.w3.org/1999/xlink","xlink:role",c);break;case"xlinkShow":Xn(n,"http://www.w3.org/1999/xlink","xlink:show",c);break;case"xlinkTitle":Xn(n,"http://www.w3.org/1999/xlink","xlink:title",c);break;case"xlinkType":Xn(n,"http://www.w3.org/1999/xlink","xlink:type",c);break;case"xmlBase":Xn(n,"http://www.w3.org/XML/1998/namespace","xml:base",c);break;case"xmlLang":Xn(n,"http://www.w3.org/XML/1998/namespace","xml:lang",c);break;case"xmlSpace":Xn(n,"http://www.w3.org/XML/1998/namespace","xml:space",c);break;case"is":Ki(n,"is",c);break;case"innerText":case"textContent":break;default:(!(2<s.length)||s[0]!=="o"&&s[0]!=="O"||s[1]!=="n"&&s[1]!=="N")&&(s=bT.get(s)||s,Ki(n,s,c))}}function om(n,o,s,c,m,y){switch(s){case"style":Ag(n,c,y);break;case"dangerouslySetInnerHTML":if(c!=null){if(typeof c!="object"||!("__html"in c))throw Error(i(61));if(s=c.__html,s!=null){if(m.children!=null)throw Error(i(60));n.innerHTML=s}}break;case"children":typeof c=="string"?Wi(n,c):(typeof c=="number"||typeof c=="bigint")&&Wi(n,""+c);break;case"onScroll":c!=null&&je("scroll",n);break;case"onScrollEnd":c!=null&&je("scrollend",n);break;case"onClick":c!=null&&(n.onclick=Br);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Jl.hasOwnProperty(s))e:{if(s[0]==="o"&&s[1]==="n"&&(m=s.endsWith("Capture"),o=s.slice(2,m?s.length-7:void 0),y=n[Jt]||null,y=y!=null?y[s]:null,typeof y=="function"&&n.removeEventListener(o,y,m),typeof c=="function")){typeof y!="function"&&y!==null&&(s in n?n[s]=null:n.hasAttribute(s)&&n.removeAttribute(s)),n.addEventListener(o,c,m);break e}s in n?n[s]=c:c===!0?n.setAttribute(s,""):Ki(n,s,c)}}}function Wt(n,o,s){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":je("error",n),je("load",n);var c=!1,m=!1,y;for(y in s)if(s.hasOwnProperty(y)){var S=s[y];if(S!=null)switch(y){case"src":c=!0;break;case"srcSet":m=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,o));default:ct(n,o,y,S,s,null)}}m&&ct(n,o,"srcSet",s.srcSet,s,null),c&&ct(n,o,"src",s.src,s,null);return;case"input":je("invalid",n);var B=y=S=m=null,Y=null,ne=null;for(c in s)if(s.hasOwnProperty(c)){var de=s[c];if(de!=null)switch(c){case"name":m=de;break;case"type":S=de;break;case"checked":Y=de;break;case"defaultChecked":ne=de;break;case"value":y=de;break;case"defaultValue":B=de;break;case"children":case"dangerouslySetInnerHTML":if(de!=null)throw Error(i(137,o));break;default:ct(n,o,c,de,s,null)}}rc(n,y,B,Y,ne,S,m,!1);return;case"select":je("invalid",n),c=S=y=null;for(m in s)if(s.hasOwnProperty(m)&&(B=s[m],B!=null))switch(m){case"value":y=B;break;case"defaultValue":S=B;break;case"multiple":c=B;default:ct(n,o,m,B,s,null)}o=y,s=S,n.multiple=!!c,o!=null?zr(n,!!c,o,!1):s!=null&&zr(n,!!c,s,!0);return;case"textarea":je("invalid",n),y=m=c=null;for(S in s)if(s.hasOwnProperty(S)&&(B=s[S],B!=null))switch(S){case"value":c=B;break;case"defaultValue":m=B;break;case"children":y=B;break;case"dangerouslySetInnerHTML":if(B!=null)throw Error(i(91));break;default:ct(n,o,S,B,s,null)}Tg(n,c,m,y);return;case"option":for(Y in s)s.hasOwnProperty(Y)&&(c=s[Y],c!=null)&&(Y==="selected"?n.selected=c&&typeof c!="function"&&typeof c!="symbol":ct(n,o,Y,c,s,null));return;case"dialog":je("beforetoggle",n),je("toggle",n),je("cancel",n),je("close",n);break;case"iframe":case"object":je("load",n);break;case"video":case"audio":for(c=0;c<Fa.length;c++)je(Fa[c],n);break;case"image":je("error",n),je("load",n);break;case"details":je("toggle",n);break;case"embed":case"source":case"link":je("error",n),je("load",n);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(ne in s)if(s.hasOwnProperty(ne)&&(c=s[ne],c!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,o));default:ct(n,o,ne,c,s,null)}return;default:if(vd(o)){for(de in s)s.hasOwnProperty(de)&&(c=s[de],c!==void 0&&om(n,o,de,c,s,void 0));return}}for(B in s)s.hasOwnProperty(B)&&(c=s[B],c!=null&&ct(n,o,B,c,s,null))}function XR(n,o,s,c){switch(o){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var m=null,y=null,S=null,B=null,Y=null,ne=null,de=null;for(ce in s){var pe=s[ce];if(s.hasOwnProperty(ce)&&pe!=null)switch(ce){case"checked":break;case"value":break;case"defaultValue":Y=pe;default:c.hasOwnProperty(ce)||ct(n,o,ce,null,c,pe)}}for(var oe in c){var ce=c[oe];if(pe=s[oe],c.hasOwnProperty(oe)&&(ce!=null||pe!=null))switch(oe){case"type":y=ce;break;case"name":m=ce;break;case"checked":ne=ce;break;case"defaultChecked":de=ce;break;case"value":S=ce;break;case"defaultValue":B=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(i(137,o));break;default:ce!==pe&&ct(n,o,oe,ce,c,pe)}}li(n,S,B,Y,ne,de,y,m);return;case"select":ce=S=B=oe=null;for(y in s)if(Y=s[y],s.hasOwnProperty(y)&&Y!=null)switch(y){case"value":break;case"multiple":ce=Y;default:c.hasOwnProperty(y)||ct(n,o,y,null,c,Y)}for(m in c)if(y=c[m],Y=s[m],c.hasOwnProperty(m)&&(y!=null||Y!=null))switch(m){case"value":oe=y;break;case"defaultValue":B=y;break;case"multiple":S=y;default:y!==Y&&ct(n,o,m,y,c,Y)}o=B,s=S,c=ce,oe!=null?zr(n,!!s,oe,!1):!!c!=!!s&&(o!=null?zr(n,!!s,o,!0):zr(n,!!s,s?[]:"",!1));return;case"textarea":ce=oe=null;for(B in s)if(m=s[B],s.hasOwnProperty(B)&&m!=null&&!c.hasOwnProperty(B))switch(B){case"value":break;case"children":break;default:ct(n,o,B,null,c,m)}for(S in c)if(m=c[S],y=s[S],c.hasOwnProperty(S)&&(m!=null||y!=null))switch(S){case"value":oe=m;break;case"defaultValue":ce=m;break;case"children":break;case"dangerouslySetInnerHTML":if(m!=null)throw Error(i(91));break;default:m!==y&&ct(n,o,S,m,c,y)}Cg(n,oe,ce);return;case"option":for(var Re in s)oe=s[Re],s.hasOwnProperty(Re)&&oe!=null&&!c.hasOwnProperty(Re)&&(Re==="selected"?n.selected=!1:ct(n,o,Re,null,c,oe));for(Y in c)oe=c[Y],ce=s[Y],c.hasOwnProperty(Y)&&oe!==ce&&(oe!=null||ce!=null)&&(Y==="selected"?n.selected=oe&&typeof oe!="function"&&typeof oe!="symbol":ct(n,o,Y,oe,c,ce));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 De in s)oe=s[De],s.hasOwnProperty(De)&&oe!=null&&!c.hasOwnProperty(De)&&ct(n,o,De,null,c,oe);for(ne in c)if(oe=c[ne],ce=s[ne],c.hasOwnProperty(ne)&&oe!==ce&&(oe!=null||ce!=null))switch(ne){case"children":case"dangerouslySetInnerHTML":if(oe!=null)throw Error(i(137,o));break;default:ct(n,o,ne,oe,c,ce)}return;default:if(vd(o)){for(var ut in s)oe=s[ut],s.hasOwnProperty(ut)&&oe!==void 0&&!c.hasOwnProperty(ut)&&om(n,o,ut,void 0,c,oe);for(de in c)oe=c[de],ce=s[de],!c.hasOwnProperty(de)||oe===ce||oe===void 0&&ce===void 0||om(n,o,de,oe,c,ce);return}}for(var W in s)oe=s[W],s.hasOwnProperty(W)&&oe!=null&&!c.hasOwnProperty(W)&&ct(n,o,W,null,c,oe);for(pe in c)oe=c[pe],ce=s[pe],!c.hasOwnProperty(pe)||oe===ce||oe==null&&ce==null||ct(n,o,pe,oe,c,ce)}function Nx(n){switch(n){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function $R(){if(typeof performance.getEntriesByType=="function"){for(var n=0,o=0,s=performance.getEntriesByType("resource"),c=0;c<s.length;c++){var m=s[c],y=m.transferSize,S=m.initiatorType,B=m.duration;if(y&&B&&Nx(S)){for(S=0,B=m.responseEnd,c+=1;c<s.length;c++){var Y=s[c],ne=Y.startTime;if(ne>B)break;var de=Y.transferSize,pe=Y.initiatorType;de&&Nx(pe)&&(Y=Y.responseEnd,S+=de*(Y<B?1:(B-ne)/(Y-ne)))}if(--c,o+=8*(y+S)/(m.duration/1e3),n++,10<n)break}}if(0<n)return o/n/1e6}return navigator.connection&&(n=navigator.connection.downlink,typeof n=="number")?n:5}var im=null,sm=null;function Jc(n){return n.nodeType===9?n:n.ownerDocument}function Mx(n){switch(n){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Ox(n,o){if(n===0)switch(o){case"svg":return 1;case"math":return 2;default:return 0}return n===1&&o==="foreignObject"?0:n}function am(n,o){return n==="textarea"||n==="noscript"||typeof o.children=="string"||typeof o.children=="number"||typeof o.children=="bigint"||typeof o.dangerouslySetInnerHTML=="object"&&o.dangerouslySetInnerHTML!==null&&o.dangerouslySetInnerHTML.__html!=null}var lm=null;function KR(){var n=window.event;return n&&n.type==="popstate"?n===lm?!1:(lm=n,!0):(lm=null,!1)}var Dx=typeof setTimeout=="function"?setTimeout:void 0,ZR=typeof clearTimeout=="function"?clearTimeout:void 0,zx=typeof Promise=="function"?Promise:void 0,QR=typeof queueMicrotask=="function"?queueMicrotask:typeof zx<"u"?function(n){return zx.resolve(null).then(n).catch(WR)}:Dx;function WR(n){setTimeout(function(){throw n})}function Mo(n){return n==="head"}function Bx(n,o){var s=o,c=0;do{var m=s.nextSibling;if(n.removeChild(s),m&&m.nodeType===8)if(s=m.data,s==="/$"||s==="/&"){if(c===0){n.removeChild(m),Ns(o);return}c--}else if(s==="$"||s==="$?"||s==="$~"||s==="$!"||s==="&")c++;else if(s==="html")ja(n.ownerDocument.documentElement);else if(s==="head"){s=n.ownerDocument.head,ja(s);for(var y=s.firstChild;y;){var S=y.nextSibling,B=y.nodeName;y[si]||B==="SCRIPT"||B==="STYLE"||B==="LINK"&&y.rel.toLowerCase()==="stylesheet"||s.removeChild(y),y=S}}else s==="body"&&ja(n.ownerDocument.body);s=m}while(s);Ns(o)}function Ux(n,o){var s=n;n=0;do{var c=s.nextSibling;if(s.nodeType===1?o?(s._stashedDisplay=s.style.display,s.style.display="none"):(s.style.display=s._stashedDisplay||"",s.getAttribute("style")===""&&s.removeAttribute("style")):s.nodeType===3&&(o?(s._stashedText=s.nodeValue,s.nodeValue=""):s.nodeValue=s._stashedText||""),c&&c.nodeType===8)if(s=c.data,s==="/$"){if(n===0)break;n--}else s!=="$"&&s!=="$?"&&s!=="$~"&&s!=="$!"||n++;s=c}while(s)}function cm(n){var o=n.firstChild;for(o&&o.nodeType===10&&(o=o.nextSibling);o;){var s=o;switch(o=o.nextSibling,s.nodeName){case"HTML":case"HEAD":case"BODY":cm(s),ia(s);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(s.rel.toLowerCase()==="stylesheet")continue}n.removeChild(s)}}function JR(n,o,s,c){for(;n.nodeType===1;){var m=s;if(n.nodeName.toLowerCase()!==o.toLowerCase()){if(!c&&(n.nodeName!=="INPUT"||n.type!=="hidden"))break}else if(c){if(!n[si])switch(o){case"meta":if(!n.hasAttribute("itemprop"))break;return n;case"link":if(y=n.getAttribute("rel"),y==="stylesheet"&&n.hasAttribute("data-precedence"))break;if(y!==m.rel||n.getAttribute("href")!==(m.href==null||m.href===""?null:m.href)||n.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin)||n.getAttribute("title")!==(m.title==null?null:m.title))break;return n;case"style":if(n.hasAttribute("data-precedence"))break;return n;case"script":if(y=n.getAttribute("src"),(y!==(m.src==null?null:m.src)||n.getAttribute("type")!==(m.type==null?null:m.type)||n.getAttribute("crossorigin")!==(m.crossOrigin==null?null:m.crossOrigin))&&y&&n.hasAttribute("async")&&!n.hasAttribute("itemprop"))break;return n;default:return n}}else if(o==="input"&&n.type==="hidden"){var y=m.name==null?null:""+m.name;if(m.type==="hidden"&&n.getAttribute("name")===y)return n}else return n;if(n=jn(n.nextSibling),n===null)break}return null}function eA(n,o,s){if(o==="")return null;for(;n.nodeType!==3;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!s||(n=jn(n.nextSibling),n===null))return null;return n}function Lx(n,o){for(;n.nodeType!==8;)if((n.nodeType!==1||n.nodeName!=="INPUT"||n.type!=="hidden")&&!o||(n=jn(n.nextSibling),n===null))return null;return n}function um(n){return n.data==="$?"||n.data==="$~"}function fm(n){return n.data==="$!"||n.data==="$?"&&n.ownerDocument.readyState!=="loading"}function tA(n,o){var s=n.ownerDocument;if(n.data==="$~")n._reactRetry=o;else if(n.data!=="$?"||s.readyState!=="loading")o();else{var c=function(){o(),s.removeEventListener("DOMContentLoaded",c)};s.addEventListener("DOMContentLoaded",c),n._reactRetry=c}}function jn(n){for(;n!=null;n=n.nextSibling){var o=n.nodeType;if(o===1||o===3)break;if(o===8){if(o=n.data,o==="$"||o==="$!"||o==="$?"||o==="$~"||o==="&"||o==="F!"||o==="F")break;if(o==="/$"||o==="/&")return null}}return n}var dm=null;function kx(n){n=n.nextSibling;for(var o=0;n;){if(n.nodeType===8){var s=n.data;if(s==="/$"||s==="/&"){if(o===0)return jn(n.nextSibling);o--}else s!=="$"&&s!=="$!"&&s!=="$?"&&s!=="$~"&&s!=="&"||o++}n=n.nextSibling}return null}function Ix(n){n=n.previousSibling;for(var o=0;n;){if(n.nodeType===8){var s=n.data;if(s==="$"||s==="$!"||s==="$?"||s==="$~"||s==="&"){if(o===0)return n;o--}else s!=="/$"&&s!=="/&"||o++}n=n.previousSibling}return null}function Hx(n,o,s){switch(o=Jc(s),n){case"html":if(n=o.documentElement,!n)throw Error(i(452));return n;case"head":if(n=o.head,!n)throw Error(i(453));return n;case"body":if(n=o.body,!n)throw Error(i(454));return n;default:throw Error(i(451))}}function ja(n){for(var o=n.attributes;o.length;)n.removeAttributeNode(o[0]);ia(n)}var Vn=new Map,Fx=new Set;function eu(n){return typeof n.getRootNode=="function"?n.getRootNode():n.nodeType===9?n:n.ownerDocument}var Zr=L.d;L.d={f:nA,r:rA,D:oA,C:iA,L:sA,m:aA,X:cA,S:lA,M:uA};function nA(){var n=Zr.f(),o=qc();return n||o}function rA(n){var o=lo(n);o!==null&&o.tag===5&&o.type==="form"?rv(o):Zr.r(n)}var Ts=typeof document>"u"?null:document;function Px(n,o,s){var c=Ts;if(c&&typeof o=="string"&&o){var m=cn(o);m='link[rel="'+n+'"][href="'+m+'"]',typeof s=="string"&&(m+='[crossorigin="'+s+'"]'),Fx.has(m)||(Fx.add(m),n={rel:n,crossOrigin:s,href:o},c.querySelector(m)===null&&(o=c.createElement("link"),Wt(o,"link",n),Dt(o),c.head.appendChild(o)))}}function oA(n){Zr.D(n),Px("dns-prefetch",n,null)}function iA(n,o){Zr.C(n,o),Px("preconnect",n,o)}function sA(n,o,s){Zr.L(n,o,s);var c=Ts;if(c&&n&&o){var m='link[rel="preload"][as="'+cn(o)+'"]';o==="image"&&s&&s.imageSrcSet?(m+='[imagesrcset="'+cn(s.imageSrcSet)+'"]',typeof s.imageSizes=="string"&&(m+='[imagesizes="'+cn(s.imageSizes)+'"]')):m+='[href="'+cn(n)+'"]';var y=m;switch(o){case"style":y=Rs(n);break;case"script":y=As(n)}Vn.has(y)||(n=g({rel:"preload",href:o==="image"&&s&&s.imageSrcSet?void 0:n,as:o},s),Vn.set(y,n),c.querySelector(m)!==null||o==="style"&&c.querySelector(Va(y))||o==="script"&&c.querySelector(Ga(y))||(o=c.createElement("link"),Wt(o,"link",n),Dt(o),c.head.appendChild(o)))}}function aA(n,o){Zr.m(n,o);var s=Ts;if(s&&n){var c=o&&typeof o.as=="string"?o.as:"script",m='link[rel="modulepreload"][as="'+cn(c)+'"][href="'+cn(n)+'"]',y=m;switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":y=As(n)}if(!Vn.has(y)&&(n=g({rel:"modulepreload",href:n},o),Vn.set(y,n),s.querySelector(m)===null)){switch(c){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(s.querySelector(Ga(y)))return}c=s.createElement("link"),Wt(c,"link",n),Dt(c),s.head.appendChild(c)}}}function lA(n,o,s){Zr.S(n,o,s);var c=Ts;if(c&&n){var m=uo(c).hoistableStyles,y=Rs(n);o=o||"default";var S=m.get(y);if(!S){var B={loading:0,preload:null};if(S=c.querySelector(Va(y)))B.loading=5;else{n=g({rel:"stylesheet",href:n,"data-precedence":o},s),(s=Vn.get(y))&&hm(n,s);var Y=S=c.createElement("link");Dt(Y),Wt(Y,"link",n),Y._p=new Promise(function(ne,de){Y.onload=ne,Y.onerror=de}),Y.addEventListener("load",function(){B.loading|=1}),Y.addEventListener("error",function(){B.loading|=2}),B.loading|=4,tu(S,o,c)}S={type:"stylesheet",instance:S,count:1,state:B},m.set(y,S)}}}function cA(n,o){Zr.X(n,o);var s=Ts;if(s&&n){var c=uo(s).hoistableScripts,m=As(n),y=c.get(m);y||(y=s.querySelector(Ga(m)),y||(n=g({src:n,async:!0},o),(o=Vn.get(m))&&mm(n,o),y=s.createElement("script"),Dt(y),Wt(y,"link",n),s.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},c.set(m,y))}}function uA(n,o){Zr.M(n,o);var s=Ts;if(s&&n){var c=uo(s).hoistableScripts,m=As(n),y=c.get(m);y||(y=s.querySelector(Ga(m)),y||(n=g({src:n,async:!0,type:"module"},o),(o=Vn.get(m))&&mm(n,o),y=s.createElement("script"),Dt(y),Wt(y,"link",n),s.head.appendChild(y)),y={type:"script",instance:y,count:1,state:null},c.set(m,y))}}function jx(n,o,s,c){var m=(m=ye.current)?eu(m):null;if(!m)throw Error(i(446));switch(n){case"meta":case"title":return null;case"style":return typeof s.precedence=="string"&&typeof s.href=="string"?(o=Rs(s.href),s=uo(m).hoistableStyles,c=s.get(o),c||(c={type:"style",instance:null,count:0,state:null},s.set(o,c)),c):{type:"void",instance:null,count:0,state:null};case"link":if(s.rel==="stylesheet"&&typeof s.href=="string"&&typeof s.precedence=="string"){n=Rs(s.href);var y=uo(m).hoistableStyles,S=y.get(n);if(S||(m=m.ownerDocument||m,S={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},y.set(n,S),(y=m.querySelector(Va(n)))&&!y._p&&(S.instance=y,S.state.loading=5),Vn.has(n)||(s={rel:"preload",as:"style",href:s.href,crossOrigin:s.crossOrigin,integrity:s.integrity,media:s.media,hrefLang:s.hrefLang,referrerPolicy:s.referrerPolicy},Vn.set(n,s),y||fA(m,n,s,S.state))),o&&c===null)throw Error(i(528,""));return S}if(o&&c!==null)throw Error(i(529,""));return null;case"script":return o=s.async,s=s.src,typeof s=="string"&&o&&typeof o!="function"&&typeof o!="symbol"?(o=As(s),s=uo(m).hoistableScripts,c=s.get(o),c||(c={type:"script",instance:null,count:0,state:null},s.set(o,c)),c):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,n))}}function Rs(n){return'href="'+cn(n)+'"'}function Va(n){return'link[rel="stylesheet"]['+n+"]"}function Vx(n){return g({},n,{"data-precedence":n.precedence,precedence:null})}function fA(n,o,s,c){n.querySelector('link[rel="preload"][as="style"]['+o+"]")?c.loading=1:(o=n.createElement("link"),c.preload=o,o.addEventListener("load",function(){return c.loading|=1}),o.addEventListener("error",function(){return c.loading|=2}),Wt(o,"link",s),Dt(o),n.head.appendChild(o))}function As(n){return'[src="'+cn(n)+'"]'}function Ga(n){return"script[async]"+n}function Gx(n,o,s){if(o.count++,o.instance===null)switch(o.type){case"style":var c=n.querySelector('style[data-href~="'+cn(s.href)+'"]');if(c)return o.instance=c,Dt(c),c;var m=g({},s,{"data-href":s.href,"data-precedence":s.precedence,href:null,precedence:null});return c=(n.ownerDocument||n).createElement("style"),Dt(c),Wt(c,"style",m),tu(c,s.precedence,n),o.instance=c;case"stylesheet":m=Rs(s.href);var y=n.querySelector(Va(m));if(y)return o.state.loading|=4,o.instance=y,Dt(y),y;c=Vx(s),(m=Vn.get(m))&&hm(c,m),y=(n.ownerDocument||n).createElement("link"),Dt(y);var S=y;return S._p=new Promise(function(B,Y){S.onload=B,S.onerror=Y}),Wt(y,"link",c),o.state.loading|=4,tu(y,s.precedence,n),o.instance=y;case"script":return y=As(s.src),(m=n.querySelector(Ga(y)))?(o.instance=m,Dt(m),m):(c=s,(m=Vn.get(y))&&(c=g({},s),mm(c,m)),n=n.ownerDocument||n,m=n.createElement("script"),Dt(m),Wt(m,"link",c),n.head.appendChild(m),o.instance=m);case"void":return null;default:throw Error(i(443,o.type))}else o.type==="stylesheet"&&(o.state.loading&4)===0&&(c=o.instance,o.state.loading|=4,tu(c,s.precedence,n));return o.instance}function tu(n,o,s){for(var c=s.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),m=c.length?c[c.length-1]:null,y=m,S=0;S<c.length;S++){var B=c[S];if(B.dataset.precedence===o)y=B;else if(y!==m)break}y?y.parentNode.insertBefore(n,y.nextSibling):(o=s.nodeType===9?s.head:s,o.insertBefore(n,o.firstChild))}function hm(n,o){n.crossOrigin==null&&(n.crossOrigin=o.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=o.referrerPolicy),n.title==null&&(n.title=o.title)}function mm(n,o){n.crossOrigin==null&&(n.crossOrigin=o.crossOrigin),n.referrerPolicy==null&&(n.referrerPolicy=o.referrerPolicy),n.integrity==null&&(n.integrity=o.integrity)}var nu=null;function qx(n,o,s){if(nu===null){var c=new Map,m=nu=new Map;m.set(s,c)}else m=nu,c=m.get(s),c||(c=new Map,m.set(s,c));if(c.has(n))return c;for(c.set(n,null),s=s.getElementsByTagName(n),m=0;m<s.length;m++){var y=s[m];if(!(y[si]||y[jt]||n==="link"&&y.getAttribute("rel")==="stylesheet")&&y.namespaceURI!=="http://www.w3.org/2000/svg"){var S=y.getAttribute(o)||"";S=n+S;var B=c.get(S);B?B.push(y):c.set(S,[y])}}return c}function Yx(n,o,s){n=n.ownerDocument||n,n.head.insertBefore(s,o==="title"?n.querySelector("head > title"):null)}function dA(n,o,s){if(s===1||o.itemProp!=null)return!1;switch(n){case"meta":case"title":return!0;case"style":if(typeof o.precedence!="string"||typeof o.href!="string"||o.href==="")break;return!0;case"link":if(typeof o.rel!="string"||typeof o.href!="string"||o.href===""||o.onLoad||o.onError)break;return o.rel==="stylesheet"?(n=o.disabled,typeof o.precedence=="string"&&n==null):!0;case"script":if(o.async&&typeof o.async!="function"&&typeof o.async!="symbol"&&!o.onLoad&&!o.onError&&o.src&&typeof o.src=="string")return!0}return!1}function Xx(n){return!(n.type==="stylesheet"&&(n.state.loading&3)===0)}function hA(n,o,s,c){if(s.type==="stylesheet"&&(typeof c.media!="string"||matchMedia(c.media).matches!==!1)&&(s.state.loading&4)===0){if(s.instance===null){var m=Rs(c.href),y=o.querySelector(Va(m));if(y){o=y._p,o!==null&&typeof o=="object"&&typeof o.then=="function"&&(n.count++,n=ru.bind(n),o.then(n,n)),s.state.loading|=4,s.instance=y,Dt(y);return}y=o.ownerDocument||o,c=Vx(c),(m=Vn.get(m))&&hm(c,m),y=y.createElement("link"),Dt(y);var S=y;S._p=new Promise(function(B,Y){S.onload=B,S.onerror=Y}),Wt(y,"link",c),s.instance=y}n.stylesheets===null&&(n.stylesheets=new Map),n.stylesheets.set(s,o),(o=s.state.preload)&&(s.state.loading&3)===0&&(n.count++,s=ru.bind(n),o.addEventListener("load",s),o.addEventListener("error",s))}}var pm=0;function mA(n,o){return n.stylesheets&&n.count===0&&iu(n,n.stylesheets),0<n.count||0<n.imgCount?function(s){var c=setTimeout(function(){if(n.stylesheets&&iu(n,n.stylesheets),n.unsuspend){var y=n.unsuspend;n.unsuspend=null,y()}},6e4+o);0<n.imgBytes&&pm===0&&(pm=62500*$R());var m=setTimeout(function(){if(n.waitingForImages=!1,n.count===0&&(n.stylesheets&&iu(n,n.stylesheets),n.unsuspend)){var y=n.unsuspend;n.unsuspend=null,y()}},(n.imgBytes>pm?50:800)+o);return n.unsuspend=s,function(){n.unsuspend=null,clearTimeout(c),clearTimeout(m)}}:null}function ru(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)iu(this,this.stylesheets);else if(this.unsuspend){var n=this.unsuspend;this.unsuspend=null,n()}}}var ou=null;function iu(n,o){n.stylesheets=null,n.unsuspend!==null&&(n.count++,ou=new Map,o.forEach(pA,n),ou=null,ru.call(n))}function pA(n,o){if(!(o.state.loading&4)){var s=ou.get(n);if(s)var c=s.get(null);else{s=new Map,ou.set(n,s);for(var m=n.querySelectorAll("link[data-precedence],style[data-precedence]"),y=0;y<m.length;y++){var S=m[y];(S.nodeName==="LINK"||S.getAttribute("media")!=="not all")&&(s.set(S.dataset.precedence,S),c=S)}c&&s.set(null,c)}m=o.instance,S=m.getAttribute("data-precedence"),y=s.get(S)||c,y===c&&s.set(null,m),s.set(S,m),this.count++,c=ru.bind(this),m.addEventListener("load",c),m.addEventListener("error",c),y?y.parentNode.insertBefore(m,y.nextSibling):(n=n.nodeType===9?n.head:n,n.insertBefore(m,n.firstChild)),o.state.loading|=4}}var qa={$$typeof:w,Provider:null,Consumer:null,_currentValue:H,_currentValue2:H,_threadCount:0};function gA(n,o,s,c,m,y,S,B,Y){this.tag=1,this.containerInfo=n,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=Nr(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Nr(0),this.hiddenUpdates=Nr(null),this.identifierPrefix=c,this.onUncaughtError=m,this.onCaughtError=y,this.onRecoverableError=S,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Y,this.incompleteTransitions=new Map}function $x(n,o,s,c,m,y,S,B,Y,ne,de,pe){return n=new gA(n,o,s,S,Y,ne,de,pe,B),o=1,y===!0&&(o|=24),y=Sn(3,null,null,o),n.current=y,y.stateNode=n,o=$d(),o.refCount++,n.pooledCache=o,o.refCount++,y.memoizedState={element:c,isDehydrated:s,cache:o},Wd(y),n}function Kx(n){return n?(n=is,n):is}function Zx(n,o,s,c,m,y){m=Kx(m),c.context===null?c.context=m:c.pendingContext=m,c=xo(o),c.payload={element:s},y=y===void 0?null:y,y!==null&&(c.callback=y),s=bo(n,c,o),s!==null&&(pn(s,n,o),Sa(s,n,o))}function Qx(n,o){if(n=n.memoizedState,n!==null&&n.dehydrated!==null){var s=n.retryLane;n.retryLane=s!==0&&s<o?s:o}}function gm(n,o){Qx(n,o),(n=n.alternate)&&Qx(n,o)}function Wx(n){if(n.tag===13||n.tag===31){var o=di(n,67108864);o!==null&&pn(o,n,67108864),gm(n,67108864)}}function Jx(n){if(n.tag===13||n.tag===31){var o=An();o=Yn(o);var s=di(n,o);s!==null&&pn(s,n,o),gm(n,o)}}var su=!0;function yA(n,o,s,c){var m=z.T;z.T=null;var y=L.p;try{L.p=2,ym(n,o,s,c)}finally{L.p=y,z.T=m}}function vA(n,o,s,c){var m=z.T;z.T=null;var y=L.p;try{L.p=8,ym(n,o,s,c)}finally{L.p=y,z.T=m}}function ym(n,o,s,c){if(su){var m=vm(c);if(m===null)rm(n,o,c,au,s),tb(n,c);else if(bA(m,n,o,s,c))c.stopPropagation();else if(tb(n,c),o&4&&-1<xA.indexOf(n)){for(;m!==null;){var y=lo(m);if(y!==null)switch(y.tag){case 3:if(y=y.stateNode,y.current.memoizedState.isDehydrated){var S=$t(y.pendingLanes);if(S!==0){var B=y;for(B.pendingLanes|=2,B.entangledLanes|=2;S;){var Y=1<<31-wt(S);B.entanglements[1]|=Y,S&=~Y}dr(y),(nt&6)===0&&(Vc=_e()+500,Ha(0))}}break;case 31:case 13:B=di(y,2),B!==null&&pn(B,y,2),qc(),gm(y,2)}if(y=vm(c),y===null&&rm(n,o,c,au,s),y===m)break;m=y}m!==null&&c.stopPropagation()}else rm(n,o,c,null,s)}}function vm(n){return n=bd(n),xm(n)}var au=null;function xm(n){if(au=null,n=ao(n),n!==null){var o=l(n);if(o===null)n=null;else{var s=o.tag;if(s===13){if(n=u(o),n!==null)return n;n=null}else if(s===31){if(n=f(o),n!==null)return n;n=null}else if(s===3){if(o.stateNode.current.memoizedState.isDehydrated)return o.tag===3?o.stateNode.containerInfo:null;n=null}else o!==n&&(n=null)}}return au=n,null}function eb(n){switch(n){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(Je()){case st:return 2;case ft:return 8;case at:case Qe:return 32;case He:return 268435456;default:return 32}default:return 32}}var bm=!1,Oo=null,Do=null,zo=null,Ya=new Map,Xa=new Map,Bo=[],xA="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 tb(n,o){switch(n){case"focusin":case"focusout":Oo=null;break;case"dragenter":case"dragleave":Do=null;break;case"mouseover":case"mouseout":zo=null;break;case"pointerover":case"pointerout":Ya.delete(o.pointerId);break;case"gotpointercapture":case"lostpointercapture":Xa.delete(o.pointerId)}}function $a(n,o,s,c,m,y){return n===null||n.nativeEvent!==y?(n={blockedOn:o,domEventName:s,eventSystemFlags:c,nativeEvent:y,targetContainers:[m]},o!==null&&(o=lo(o),o!==null&&Wx(o)),n):(n.eventSystemFlags|=c,o=n.targetContainers,m!==null&&o.indexOf(m)===-1&&o.push(m),n)}function bA(n,o,s,c,m){switch(o){case"focusin":return Oo=$a(Oo,n,o,s,c,m),!0;case"dragenter":return Do=$a(Do,n,o,s,c,m),!0;case"mouseover":return zo=$a(zo,n,o,s,c,m),!0;case"pointerover":var y=m.pointerId;return Ya.set(y,$a(Ya.get(y)||null,n,o,s,c,m)),!0;case"gotpointercapture":return y=m.pointerId,Xa.set(y,$a(Xa.get(y)||null,n,o,s,c,m)),!0}return!1}function nb(n){var o=ao(n.target);if(o!==null){var s=l(o);if(s!==null){if(o=s.tag,o===13){if(o=u(s),o!==null){n.blockedOn=o,Xi(n.priority,function(){Jx(s)});return}}else if(o===31){if(o=f(s),o!==null){n.blockedOn=o,Xi(n.priority,function(){Jx(s)});return}}else if(o===3&&s.stateNode.current.memoizedState.isDehydrated){n.blockedOn=s.tag===3?s.stateNode.containerInfo:null;return}}}n.blockedOn=null}function lu(n){if(n.blockedOn!==null)return!1;for(var o=n.targetContainers;0<o.length;){var s=vm(n.nativeEvent);if(s===null){s=n.nativeEvent;var c=new s.constructor(s.type,s);xd=c,s.target.dispatchEvent(c),xd=null}else return o=lo(s),o!==null&&Wx(o),n.blockedOn=s,!1;o.shift()}return!0}function rb(n,o,s){lu(n)&&s.delete(o)}function _A(){bm=!1,Oo!==null&&lu(Oo)&&(Oo=null),Do!==null&&lu(Do)&&(Do=null),zo!==null&&lu(zo)&&(zo=null),Ya.forEach(rb),Xa.forEach(rb)}function cu(n,o){n.blockedOn===o&&(n.blockedOn=null,bm||(bm=!0,e.unstable_scheduleCallback(e.unstable_NormalPriority,_A)))}var uu=null;function ob(n){uu!==n&&(uu=n,e.unstable_scheduleCallback(e.unstable_NormalPriority,function(){uu===n&&(uu=null);for(var o=0;o<n.length;o+=3){var s=n[o],c=n[o+1],m=n[o+2];if(typeof c!="function"){if(xm(c||s)===null)continue;break}var y=lo(s);y!==null&&(n.splice(o,3),o-=3,vh(y,{pending:!0,data:m,method:s.method,action:c},c,m))}}))}function Ns(n){function o(Y){return cu(Y,n)}Oo!==null&&cu(Oo,n),Do!==null&&cu(Do,n),zo!==null&&cu(zo,n),Ya.forEach(o),Xa.forEach(o);for(var s=0;s<Bo.length;s++){var c=Bo[s];c.blockedOn===n&&(c.blockedOn=null)}for(;0<Bo.length&&(s=Bo[0],s.blockedOn===null);)nb(s),s.blockedOn===null&&Bo.shift();if(s=(n.ownerDocument||n).$$reactFormReplay,s!=null)for(c=0;c<s.length;c+=3){var m=s[c],y=s[c+1],S=m[Jt]||null;if(typeof y=="function")S||ob(s);else if(S){var B=null;if(y&&y.hasAttribute("formAction")){if(m=y,S=y[Jt]||null)B=S.formAction;else if(xm(m)!==null)continue}else B=S.action;typeof B=="function"?s[c+1]=B:(s.splice(c,3),c-=3),ob(s)}}}function ib(){function n(y){y.canIntercept&&y.info==="react-transition"&&y.intercept({handler:function(){return new Promise(function(S){return m=S})},focusReset:"manual",scroll:"manual"})}function o(){m!==null&&(m(),m=null),c||setTimeout(s,20)}function s(){if(!c&&!navigation.transition){var y=navigation.currentEntry;y&&y.url!=null&&navigation.navigate(y.url,{state:y.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var c=!1,m=null;return navigation.addEventListener("navigate",n),navigation.addEventListener("navigatesuccess",o),navigation.addEventListener("navigateerror",o),setTimeout(s,100),function(){c=!0,navigation.removeEventListener("navigate",n),navigation.removeEventListener("navigatesuccess",o),navigation.removeEventListener("navigateerror",o),m!==null&&(m(),m=null)}}}function _m(n){this._internalRoot=n}fu.prototype.render=_m.prototype.render=function(n){var o=this._internalRoot;if(o===null)throw Error(i(409));var s=o.current,c=An();Zx(s,c,n,o,null,null)},fu.prototype.unmount=_m.prototype.unmount=function(){var n=this._internalRoot;if(n!==null){this._internalRoot=null;var o=n.containerInfo;Zx(n.current,2,null,n,null,null),qc(),o[Or]=null}};function fu(n){this._internalRoot=n}fu.prototype.unstable_scheduleHydration=function(n){if(n){var o=Yi();n={blockedOn:null,target:n,priority:o};for(var s=0;s<Bo.length&&o!==0&&o<Bo[s].priority;s++);Bo.splice(s,0,n),s===0&&nb(n)}};var sb=t.version;if(sb!=="19.2.4")throw Error(i(527,sb,"19.2.4"));L.findDOMNode=function(n){var o=n._reactInternals;if(o===void 0)throw typeof n.render=="function"?Error(i(188)):(n=Object.keys(n).join(","),Error(i(268,n)));return n=d(o),n=n!==null?p(n):null,n=n===null?null:n.stateNode,n};var EA={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:z,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var du=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!du.isDisabled&&du.supportsFiber)try{ze=du.inject(EA),Oe=du}catch{}}return Za.createRoot=function(n,o){if(!a(n))throw Error(i(299));var s=!1,c="",m=hv,y=mv,S=pv;return o!=null&&(o.unstable_strictMode===!0&&(s=!0),o.identifierPrefix!==void 0&&(c=o.identifierPrefix),o.onUncaughtError!==void 0&&(m=o.onUncaughtError),o.onCaughtError!==void 0&&(y=o.onCaughtError),o.onRecoverableError!==void 0&&(S=o.onRecoverableError)),o=$x(n,1,!1,null,null,s,c,null,m,y,S,ib),n[Or]=o.current,nm(n),new _m(o)},Za.hydrateRoot=function(n,o,s){if(!a(n))throw Error(i(299));var c=!1,m="",y=hv,S=mv,B=pv,Y=null;return s!=null&&(s.unstable_strictMode===!0&&(c=!0),s.identifierPrefix!==void 0&&(m=s.identifierPrefix),s.onUncaughtError!==void 0&&(y=s.onUncaughtError),s.onCaughtError!==void 0&&(S=s.onCaughtError),s.onRecoverableError!==void 0&&(B=s.onRecoverableError),s.formState!==void 0&&(Y=s.formState)),o=$x(n,1,!0,o,s??null,c,m,Y,y,S,B,ib),o.context=Kx(null),s=o.current,c=An(),c=Yn(c),m=xo(c),m.callback=null,bo(s,m,c),s=c,o.current.lanes=s,Mr(o,s),dr(o),n[Or]=o.current,nm(n),new fu(o)},Za.version="19.2.4",Za}var gb;function DA(){if(gb)return wm.exports;gb=1;function e(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(e)}catch(t){console.error(t)}}return e(),wm.exports=OA(),wm.exports}var zA=DA();const _r=Object.create(null);_r.open="0";_r.close="1";_r.ping="2";_r.pong="3";_r.message="4";_r.upgrade="5";_r.noop="6";const ku=Object.create(null);Object.keys(_r).forEach(e=>{ku[_r[e]]=e});const fp={type:"error",data:"parser error"},FE=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",PE=typeof ArrayBuffer=="function",jE=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,e0=({type:e,data:t},r,i)=>FE&&t instanceof Blob?r?i(t):yb(t,i):PE&&(t instanceof ArrayBuffer||jE(t))?r?i(t):yb(new Blob([t]),i):i(_r[e]+(t||"")),yb=(e,t)=>{const r=new FileReader;return r.onload=function(){const i=r.result.split(",")[1];t("b"+(i||""))},r.readAsDataURL(e)};function vb(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Am;function BA(e,t){if(FE&&e.data instanceof Blob)return e.data.arrayBuffer().then(vb).then(t);if(PE&&(e.data instanceof ArrayBuffer||jE(e.data)))return t(vb(e.data));e0(e,!1,r=>{Am||(Am=new TextEncoder),t(Am.encode(r))})}const xb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",sl=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<xb.length;e++)sl[xb.charCodeAt(e)]=e;const UA=e=>{let t=e.length*.75,r=e.length,i,a=0,l,u,f,h;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const d=new ArrayBuffer(t),p=new Uint8Array(d);for(i=0;i<r;i+=4)l=sl[e.charCodeAt(i)],u=sl[e.charCodeAt(i+1)],f=sl[e.charCodeAt(i+2)],h=sl[e.charCodeAt(i+3)],p[a++]=l<<2|u>>4,p[a++]=(u&15)<<4|f>>2,p[a++]=(f&3)<<6|h&63;return d},LA=typeof ArrayBuffer=="function",t0=(e,t)=>{if(typeof e!="string")return{type:"message",data:VE(e,t)};const r=e.charAt(0);return r==="b"?{type:"message",data:kA(e.substring(1),t)}:ku[r]?e.length>1?{type:ku[r],data:e.substring(1)}:{type:ku[r]}:fp},kA=(e,t)=>{if(LA){const r=UA(e);return VE(r,t)}else return{base64:!0,data:e}},VE=(e,t)=>t==="blob"?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,GE="",IA=(e,t)=>{const r=e.length,i=new Array(r);let a=0;e.forEach((l,u)=>{e0(l,!1,f=>{i[u]=f,++a===r&&t(i.join(GE))})})},HA=(e,t)=>{const r=e.split(GE),i=[];for(let a=0;a<r.length;a++){const l=t0(r[a],t);if(i.push(l),l.type==="error")break}return i};function FA(){return new TransformStream({transform(e,t){BA(e,r=>{const i=r.length;let a;if(i<126)a=new Uint8Array(1),new DataView(a.buffer).setUint8(0,i);else if(i<65536){a=new Uint8Array(3);const l=new DataView(a.buffer);l.setUint8(0,126),l.setUint16(1,i)}else{a=new Uint8Array(9);const l=new DataView(a.buffer);l.setUint8(0,127),l.setBigUint64(1,BigInt(i))}e.data&&typeof e.data!="string"&&(a[0]|=128),t.enqueue(a),t.enqueue(r)})}})}let Nm;function hu(e){return e.reduce((t,r)=>t+r.length,0)}function mu(e,t){if(e[0].length===t)return e.shift();const r=new Uint8Array(t);let i=0;for(let a=0;a<t;a++)r[a]=e[0][i++],i===e[0].length&&(e.shift(),i=0);return e.length&&i<e[0].length&&(e[0]=e[0].slice(i)),r}function PA(e,t){Nm||(Nm=new TextDecoder);const r=[];let i=0,a=-1,l=!1;return new TransformStream({transform(u,f){for(r.push(u);;){if(i===0){if(hu(r)<1)break;const h=mu(r,1);l=(h[0]&128)===128,a=h[0]&127,a<126?i=3:a===126?i=1:i=2}else if(i===1){if(hu(r)<2)break;const h=mu(r,2);a=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),i=3}else if(i===2){if(hu(r)<8)break;const h=mu(r,8),d=new DataView(h.buffer,h.byteOffset,h.length),p=d.getUint32(0);if(p>Math.pow(2,21)-1){f.enqueue(fp);break}a=p*Math.pow(2,32)+d.getUint32(4),i=3}else{if(hu(r)<a)break;const h=mu(r,a);f.enqueue(t0(l?h:Nm.decode(h),t)),i=0}if(a===0||a>e){f.enqueue(fp);break}}}})}const qE=4;function kt(e){if(e)return jA(e)}function jA(e){for(var t in kt.prototype)e[t]=kt.prototype[t];return e}kt.prototype.on=kt.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};kt.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this};kt.prototype.off=kt.prototype.removeListener=kt.prototype.removeAllListeners=kt.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+e];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var i,a=0;a<r.length;a++)if(i=r[a],i===t||i.fn===t){r.splice(a,1);break}return r.length===0&&delete this._callbacks["$"+e],this};kt.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(r){r=r.slice(0);for(var i=0,a=r.length;i<a;++i)r[i].apply(this,t)}return this};kt.prototype.emitReserved=kt.prototype.emit;kt.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};kt.prototype.hasListeners=function(e){return!!this.listeners(e).length};const Df=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,r)=>r(t,0),Gn=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),VA="arraybuffer";function YE(e,...t){return t.reduce((r,i)=>(e.hasOwnProperty(i)&&(r[i]=e[i]),r),{})}const GA=Gn.setTimeout,qA=Gn.clearTimeout;function zf(e,t){t.useNativeTimers?(e.setTimeoutFn=GA.bind(Gn),e.clearTimeoutFn=qA.bind(Gn)):(e.setTimeoutFn=Gn.setTimeout.bind(Gn),e.clearTimeoutFn=Gn.clearTimeout.bind(Gn))}const YA=1.33;function XA(e){return typeof e=="string"?$A(e):Math.ceil((e.byteLength||e.size)*YA)}function $A(e){let t=0,r=0;for(let i=0,a=e.length;i<a;i++)t=e.charCodeAt(i),t<128?r+=1:t<2048?r+=2:t<55296||t>=57344?r+=3:(i++,r+=4);return r}function XE(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function KA(e){let t="";for(let r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t}function ZA(e){let t={},r=e.split("&");for(let i=0,a=r.length;i<a;i++){let l=r[i].split("=");t[decodeURIComponent(l[0])]=decodeURIComponent(l[1])}return t}class QA extends Error{constructor(t,r,i){super(t),this.description=r,this.context=i,this.type="TransportError"}}class n0 extends kt{constructor(t){super(),this.writable=!1,zf(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,r,i){return super.emitReserved("error",new QA(t,r,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const r=t0(t,this.socket.binaryType);this.onPacket(r)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,r={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const r=KA(t);return r.length?"?"+r:""}}class WA extends n0{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const r=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||r()})),this.writable||(i++,this.once("drain",function(){--i||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const r=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};HA(t,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,IA(t,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=XE()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(t,r)}}let $E=!1;try{$E=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const JA=$E;function e3(){}class t3 extends WA{constructor(t){if(super(t),typeof location<"u"){const r=location.protocol==="https:";let i=location.port;i||(i=r?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||i!==t.port}}doWrite(t,r){const i=this.request({method:"POST",data:t});i.on("success",r),i.on("error",(a,l)=>{this.onError("xhr post error",a,l)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(r,i)=>{this.onError("xhr poll error",r,i)}),this.pollXhr=t}}class yr extends kt{constructor(t,r,i){super(),this.createRequest=t,zf(this,i),this._opts=i,this._method=i.method||"GET",this._uri=r,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var t;const r=YE(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(r);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let a in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(a)&&i.setRequestHeader(a,this._opts.extraHeaders[a])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var a;i.readyState===3&&((a=this._opts.cookieJar)===null||a===void 0||a.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(a){this.setTimeoutFn(()=>{this._onError(a)},0);return}typeof document<"u"&&(this._index=yr.requestsCount++,yr.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=e3,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete yr.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}yr.requestsCount=0;yr.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",bb);else if(typeof addEventListener=="function"){const e="onpagehide"in Gn?"pagehide":"unload";addEventListener(e,bb,!1)}}function bb(){for(let e in yr.requests)yr.requests.hasOwnProperty(e)&&yr.requests[e].abort()}const n3=(function(){const e=KE({xdomain:!1});return e&&e.responseType!==null})();class r3 extends t3{constructor(t){super(t);const r=t&&t.forceBase64;this.supportsBinary=n3&&!r}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new yr(KE,this.uri(),t)}}function KE(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||JA))return new XMLHttpRequest}catch{}if(!t)try{return new Gn[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const ZE=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class o3 extends n0{get name(){return"websocket"}doOpen(){const t=this.uri(),r=this.opts.protocols,i=ZE?{}:YE(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,r,i)}catch(a){return this.emitReserved("error",a)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let r=0;r<t.length;r++){const i=t[r],a=r===t.length-1;e0(i,this.supportsBinary,l=>{try{this.doWrite(i,l)}catch{}a&&Df(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=XE()),this.supportsBinary||(r.b64=1),this.createUri(t,r)}}const Mm=Gn.WebSocket||Gn.MozWebSocket;class i3 extends o3{createSocket(t,r,i){return ZE?new Mm(t,r,i):r?new Mm(t,r):new Mm(t)}doWrite(t,r){this.ws.send(r)}}class s3 extends n0{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const r=PA(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=t.readable.pipeThrough(r).getReader(),a=FA();a.readable.pipeTo(t.writable),this._writer=a.writable.getWriter();const l=()=>{i.read().then(({done:f,value:h})=>{f||(this.onPacket(h),l())}).catch(f=>{})};l();const u={type:"open"};this.query.sid&&(u.data=`{"sid":"${this.query.sid}"}`),this._writer.write(u).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let r=0;r<t.length;r++){const i=t[r],a=r===t.length-1;this._writer.write(i).then(()=>{a&&Df(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const a3={websocket:i3,webtransport:s3,polling:r3},l3=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,c3=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function dp(e){if(e.length>8e3)throw"URI too long";const t=e,r=e.indexOf("["),i=e.indexOf("]");r!=-1&&i!=-1&&(e=e.substring(0,r)+e.substring(r,i).replace(/:/g,";")+e.substring(i,e.length));let a=l3.exec(e||""),l={},u=14;for(;u--;)l[c3[u]]=a[u]||"";return r!=-1&&i!=-1&&(l.source=t,l.host=l.host.substring(1,l.host.length-1).replace(/;/g,":"),l.authority=l.authority.replace("[","").replace("]","").replace(/;/g,":"),l.ipv6uri=!0),l.pathNames=u3(l,l.path),l.queryKey=f3(l,l.query),l}function u3(e,t){const r=/\/{2,9}/g,i=t.replace(r,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&i.splice(0,1),t.slice(-1)=="/"&&i.splice(i.length-1,1),i}function f3(e,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,a,l){a&&(r[a]=l)}),r}const hp=typeof addEventListener=="function"&&typeof removeEventListener=="function",Iu=[];hp&&addEventListener("offline",()=>{Iu.forEach(e=>e())},!1);class jo extends kt{constructor(t,r){if(super(),this.binaryType=VA,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(r=t,t=null),t){const i=dp(t);r.hostname=i.host,r.secure=i.protocol==="https"||i.protocol==="wss",r.port=i.port,i.query&&(r.query=i.query)}else r.host&&(r.hostname=dp(r.host).host);zf(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(i=>{const a=i.prototype.name;this.transports.push(a),this._transportsByName[a]=i}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=ZA(this.opts.query)),hp&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},Iu.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const r=Object.assign({},this.opts.query);r.EIO=qE,r.transport=t,this.id&&(r.sid=this.id);const i=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&jo.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(t);r.open(),this.setTransport(r)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",jo.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const r=new Error("server error");r.code=t.data,this._onError(r);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let i=0;i<this.writeBuffer.length;i++){const a=this.writeBuffer[i].data;if(a&&(r+=XA(a)),i>0&&r>this._maxPayload)return this.writeBuffer.slice(0,i);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,Df(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,r,i){return this._sendPacket("message",t,r,i),this}send(t,r,i){return this._sendPacket("message",t,r,i),this}_sendPacket(t,r,i,a){if(typeof r=="function"&&(a=r,r=void 0),typeof i=="function"&&(a=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const l={type:t,data:r,options:i};this.emitReserved("packetCreate",l),this.writeBuffer.push(l),a&&this.once("flush",a),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),t()},i=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():t()}):this.upgrading?i():t()),this}_onError(t){if(jo.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),hp&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=Iu.indexOf(this._offlineEventListener);i!==-1&&Iu.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,r),this.writeBuffer=[],this._prevBufferLen=0}}}jo.protocol=qE;class d3 extends jo{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let r=this.createTransport(t),i=!1;jo.priorWebsocketSuccess=!1;const a=()=>{i||(r.send([{type:"ping",data:"probe"}]),r.once("packet",g=>{if(!i)if(g.type==="pong"&&g.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;jo.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(p(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const v=new Error("probe error");v.transport=r.name,this.emitReserved("upgradeError",v)}}))};function l(){i||(i=!0,p(),r.close(),r=null)}const u=g=>{const v=new Error("probe error: "+g);v.transport=r.name,l(),this.emitReserved("upgradeError",v)};function f(){u("transport closed")}function h(){u("socket closed")}function d(g){r&&g.name!==r.name&&l()}const p=()=>{r.removeListener("open",a),r.removeListener("error",u),r.removeListener("close",f),this.off("close",h),this.off("upgrading",d)};r.once("open",a),r.once("error",u),r.once("close",f),this.once("close",h),this.once("upgrading",d),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{i||r.open()},200):r.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const r=[];for(let i=0;i<t.length;i++)~this.transports.indexOf(t[i])&&r.push(t[i]);return r}}let h3=class extends d3{constructor(t,r={}){const i=typeof t=="object"?t:r;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(a=>a3[a]).filter(a=>!!a)),super(t,i)}};function m3(e,t="",r){let i=e;r=r||typeof location<"u"&&location,e==null&&(e=r.protocol+"//"+r.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=r.protocol+e:e=r.host+e),/^(https?|wss?):\/\//.test(e)||(typeof r<"u"?e=r.protocol+"//"+e:e="https://"+e),i=dp(e)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const l=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+l+":"+i.port+t,i.href=i.protocol+"://"+l+(r&&r.port===i.port?"":":"+i.port),i}const p3=typeof ArrayBuffer=="function",g3=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,QE=Object.prototype.toString,y3=typeof Blob=="function"||typeof Blob<"u"&&QE.call(Blob)==="[object BlobConstructor]",v3=typeof File=="function"||typeof File<"u"&&QE.call(File)==="[object FileConstructor]";function r0(e){return p3&&(e instanceof ArrayBuffer||g3(e))||y3&&e instanceof Blob||v3&&e instanceof File}function Hu(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let r=0,i=e.length;r<i;r++)if(Hu(e[r]))return!0;return!1}if(r0(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return Hu(e.toJSON(),!0);for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&Hu(e[r]))return!0;return!1}function x3(e){const t=[],r=e.data,i=e;return i.data=mp(r,t),i.attachments=t.length,{packet:i,buffers:t}}function mp(e,t){if(!e)return e;if(r0(e)){const r={_placeholder:!0,num:t.length};return t.push(e),r}else if(Array.isArray(e)){const r=new Array(e.length);for(let i=0;i<e.length;i++)r[i]=mp(e[i],t);return r}else if(typeof e=="object"&&!(e instanceof Date)){const r={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(r[i]=mp(e[i],t));return r}return e}function b3(e,t){return e.data=pp(e.data,t),delete e.attachments,e}function pp(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let r=0;r<e.length;r++)e[r]=pp(e[r],t);else if(typeof e=="object")for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=pp(e[r],t));return e}const _3=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var $e;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})($e||($e={}));class E3{constructor(t){this.replacer=t}encode(t){return(t.type===$e.EVENT||t.type===$e.ACK)&&Hu(t)?this.encodeAsBinary({type:t.type===$e.EVENT?$e.BINARY_EVENT:$e.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let r=""+t.type;return(t.type===$e.BINARY_EVENT||t.type===$e.BINARY_ACK)&&(r+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(r+=t.nsp+","),t.id!=null&&(r+=t.id),t.data!=null&&(r+=JSON.stringify(t.data,this.replacer)),r}encodeAsBinary(t){const r=x3(t),i=this.encodeAsString(r.packet),a=r.buffers;return a.unshift(i),a}}class o0 extends kt{constructor(t){super(),this.reviver=t}add(t){let r;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(t);const i=r.type===$e.BINARY_EVENT;i||r.type===$e.BINARY_ACK?(r.type=i?$e.EVENT:$e.ACK,this.reconstructor=new S3(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(r0(t)||t.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let r=0;const i={type:Number(t.charAt(0))};if($e[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===$e.BINARY_EVENT||i.type===$e.BINARY_ACK){const l=r+1;for(;t.charAt(++r)!=="-"&&r!=t.length;);const u=t.substring(l,r);if(u!=Number(u)||t.charAt(r)!=="-")throw new Error("Illegal attachments");i.attachments=Number(u)}if(t.charAt(r+1)==="/"){const l=r+1;for(;++r&&!(t.charAt(r)===","||r===t.length););i.nsp=t.substring(l,r)}else i.nsp="/";const a=t.charAt(r+1);if(a!==""&&Number(a)==a){const l=r+1;for(;++r;){const u=t.charAt(r);if(u==null||Number(u)!=u){--r;break}if(r===t.length)break}i.id=Number(t.substring(l,r+1))}if(t.charAt(++r)){const l=this.tryParse(t.substr(r));if(o0.isPayloadValid(i.type,l))i.data=l;else throw new Error("invalid payload")}return i}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,r){switch(t){case $e.CONNECT:return _b(r);case $e.DISCONNECT:return r===void 0;case $e.CONNECT_ERROR:return typeof r=="string"||_b(r);case $e.EVENT:case $e.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&_3.indexOf(r[0])===-1);case $e.ACK:case $e.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class S3{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const r=b3(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function _b(e){return Object.prototype.toString.call(e)==="[object Object]"}const w3=Object.freeze(Object.defineProperty({__proto__:null,Decoder:o0,Encoder:E3,get PacketType(){return $e}},Symbol.toStringTag,{value:"Module"}));function Jn(e,t,r){return e.on(t,r),function(){e.off(t,r)}}const C3=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class WE extends kt{constructor(t,r,i){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=r,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Jn(t,"open",this.onopen.bind(this)),Jn(t,"packet",this.onpacket.bind(this)),Jn(t,"error",this.onerror.bind(this)),Jn(t,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...r){var i,a,l;if(C3.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(r.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const u={type:$e.EVENT,data:r};if(u.options={},u.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const p=this.ids++,g=r.pop();this._registerAckCallback(p,g),u.id=p}const f=(a=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||a===void 0?void 0:a.writable,h=this.connected&&!(!((l=this.io.engine)===null||l===void 0)&&l._hasPingExpired());return this.flags.volatile&&!f||(h?(this.notifyOutgoingListeners(u),this.packet(u)):this.sendBuffer.push(u)),this.flags={},this}_registerAckCallback(t,r){var i;const a=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(a===void 0){this.acks[t]=r;return}const l=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let f=0;f<this.sendBuffer.length;f++)this.sendBuffer[f].id===t&&this.sendBuffer.splice(f,1);r.call(this,new Error("operation has timed out"))},a),u=(...f)=>{this.io.clearTimeoutFn(l),r.apply(this,f)};u.withError=!0,this.acks[t]=u}emitWithAck(t,...r){return new Promise((i,a)=>{const l=(u,f)=>u?a(u):i(f);l.withError=!0,r.push(l),this.emit(t,...r)})}_addToQueue(t){let r;typeof t[t.length-1]=="function"&&(r=t.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((a,...l)=>(this._queue[0],a!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(a)):(this._queue.shift(),r&&r(null,...l)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!t||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:$e.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(i=>String(i.id)===t)){const i=this.acks[t];delete this.acks[t],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case $e.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case $e.EVENT:case $e.BINARY_EVENT:this.onevent(t);break;case $e.ACK:case $e.BINARY_ACK:this.onack(t);break;case $e.DISCONNECT:this.ondisconnect();break;case $e.CONNECT_ERROR:this.destroy();const i=new Error(t.data.message);i.data=t.data.data,this.emitReserved("connect_error",i);break}}onevent(t){const r=t.data||[];t.id!=null&&r.push(this.ack(t.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const i of r)i.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const r=this;let i=!1;return function(...a){i||(i=!0,r.packet({type:$e.ACK,id:t,data:a}))}}onack(t){const r=this.acks[t.id];typeof r=="function"&&(delete this.acks[t.id],r.withError&&t.data.unshift(null),r.apply(this,t.data))}onconnect(t,r){this.id=t,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:$e.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const r=this._anyListeners;for(let i=0;i<r.length;i++)if(t===r[i])return r.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const r=this._anyOutgoingListeners;for(let i=0;i<r.length;i++)if(t===r[i])return r.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const i of r)i.apply(this,t.data)}}}function Js(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Js.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=(Math.floor(t*10)&1)==0?e-r:e+r}return Math.min(e,this.max)|0};Js.prototype.reset=function(){this.attempts=0};Js.prototype.setMin=function(e){this.ms=e};Js.prototype.setMax=function(e){this.max=e};Js.prototype.setJitter=function(e){this.jitter=e};class gp extends kt{constructor(t,r){var i;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(r=t,t=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,zf(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((i=r.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new Js({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=t;const a=r.parser||w3;this.encoder=new a.Encoder,this.decoder=new a.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var r;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(r=this.backoff)===null||r===void 0||r.setMin(t),this)}randomizationFactor(t){var r;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(r=this.backoff)===null||r===void 0||r.setJitter(t),this)}reconnectionDelayMax(t){var r;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(r=this.backoff)===null||r===void 0||r.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new h3(this.uri,this.opts);const r=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const a=Jn(r,"open",function(){i.onopen(),t&&t()}),l=f=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",f),t?t(f):this.maybeReconnectOnOpen()},u=Jn(r,"error",l);if(this._timeout!==!1){const f=this._timeout,h=this.setTimeoutFn(()=>{a(),l(new Error("timeout")),r.close()},f);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(a),this.subs.push(u),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Jn(t,"ping",this.onping.bind(this)),Jn(t,"data",this.ondata.bind(this)),Jn(t,"error",this.onerror.bind(this)),Jn(t,"close",this.onclose.bind(this)),Jn(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(r){this.onclose("parse error",r)}}ondecoded(t){Df(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,r){let i=this.nsps[t];return i?this._autoConnect&&!i.active&&i.connect():(i=new WE(this,t,r),this.nsps[t]=i),i}_destroy(t){const r=Object.keys(this.nsps);for(const i of r)if(this.nsps[i].active)return;this._close()}_packet(t){const r=this.encoder.encode(t);for(let i=0;i<r.length;i++)this.engine.write(r[i],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,r){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(a=>{a?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",a)):t.onreconnect()}))},r);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Qa={};function Fu(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const r=m3(e,t.path||"/socket.io"),i=r.source,a=r.id,l=r.path,u=Qa[a]&&l in Qa[a].nsps,f=t.forceNew||t["force new connection"]||t.multiplex===!1||u;let h;return f?h=new gp(i,t):(Qa[a]||(Qa[a]=new gp(i,t)),h=Qa[a]),r.query&&!t.query&&(t.query=r.queryKey),h.socket(r.path,t)}Object.assign(Fu,{Manager:gp,Socket:WE,io:Fu,connect:Fu});const T3=`#version 300 es
10
+ precision mediump float;
11
+
12
+ uniform sampler2D u_texture; // input
13
+ uniform vec3 u_sourceColor; // color
14
+ uniform vec4 u_targetColor; // color [0, 0, 0, 0]
15
+ uniform float u_threshold; // [0, 1, 0.1]
16
+
17
+ in vec2 vUv;
18
+ out vec4 fragColor;
19
+
20
+ void main() {
21
+ vec4 texColor = texture(u_texture, vUv);
22
+
23
+ float colorDiff = distance(texColor.rgb, u_sourceColor) / 2.0;
24
+
25
+ if (colorDiff < u_threshold) {
26
+ fragColor = u_targetColor;
27
+ } else {
28
+ fragColor = texColor;
29
+ }
30
+ }
31
+ `,R3=`#version 300 es
32
+
33
+ precision highp float;
34
+
35
+
36
+ uniform float u_time; // time
37
+ uniform float u_time_multiplier; // [0.1, 5, 1]
38
+ uniform vec2 u_resolution; // resolution
39
+ uniform float u_vitality;
40
+ uniform vec2 u_mouse; //mouse
41
+
42
+ uniform float u_flower_count; // [1, 10, 5]
43
+ uniform float u_flower_rotation; // [-6, 10, 5]
44
+
45
+ uniform float u_ring_radius; // [-1, 10, 2]
46
+ uniform float u_rotation_offset; // [1, 10, 5]
47
+ uniform float u_mouse_rotation; // [0, 2, 0.1]
48
+ uniform float u_mouse_rotation_gain; // [1, 2, 1]
49
+ uniform float u_natural_rotation_scale; // [0, 5, 0.1]
50
+ uniform float u_mouse_scale_factor; // [0, 1, 0.1]
51
+ uniform vec3 u_transform; // [0, 0.5, -20]
52
+
53
+ in vec2 vUv;
54
+ out vec4 fragColor;
55
+
56
+ float sdSphere(vec3 p, float r)
57
+ {
58
+ return length(p) - r;
59
+ }
60
+
61
+ float sdCappedCylinder(vec3 p, float h, float r)
62
+ {
63
+ vec2 d = abs(vec2(length(p.xz), p.y)) - vec2(r, h);
64
+ return min(max(d.x,d.y),0.0) + length(max(d,0.0));
65
+ }
66
+
67
+ float sdCappedCone( vec3 p, float h, float r1, float r2 )
68
+ {
69
+ vec2 q = vec2( length(p.xz), p.y );
70
+ vec2 k1 = vec2(r2,h);
71
+ vec2 k2 = vec2(r2-r1,2.0*h);
72
+ vec2 ca = vec2(q.x-min(q.x,(q.y<0.0)?r1:r2), abs(q.y)-h);
73
+ vec2 cb = q - k1 + k2*clamp( dot(k1-q,k2)/dot(k2, k2), 0.0, 1.0 );
74
+ float s = (cb.x<0.0 && ca.y<0.0) ? -1.0 : 1.0;
75
+ return s*sqrt( min(dot(ca, ca),dot(cb, cb)) );
76
+ }
77
+
78
+ float sdEllipsoid(vec3 p, vec3 r)
79
+ {
80
+ return (length(p/r) - 1.0) * min(min(r.x,r.y),r.z);
81
+ }
82
+
83
+ float smin(float a, float b, float k)
84
+ {
85
+ if (k <= 0.00001) return min(a, b);
86
+ float h = clamp(0.5 + 0.5*(b-a)/k, 0.0, 1.0);
87
+ return mix(b, a, h) - k*h*(1.0-h);
88
+ }
89
+
90
+
91
+ float gain( float x, float k )
92
+ {
93
+ float a = 0.5*pow(2.0*((x<0.5)?x:1.0-x), k);
94
+ return (x<0.5)?a:1.0-a;
95
+ }
96
+
97
+ vec3 rotateAroundAxis(vec3 v, vec3 axis, float angle) {
98
+ axis = normalize(axis);
99
+ float s = sin(angle);
100
+ float c = cos(angle);
101
+ float oc = 1.0 - c;
102
+
103
+ return v * c +
104
+ cross(axis, v) * s +
105
+ axis * dot(axis, v) * oc;
106
+ }
107
+
108
+ float petals(vec3 p)
109
+ {
110
+ float petals = 1000.0;
111
+ const int PETAL_COUNT = 6;
112
+ for(int i = 0; i < PETAL_COUNT; i++)
113
+ {
114
+ float angle = float(i) / float(PETAL_COUNT) * 6.28318;
115
+ vec3 rp = p;
116
+
117
+ float c = cos(angle);
118
+ float s = sin(angle);
119
+ rp.xz = mat2(c, -s, s, c) * rp.xz;
120
+
121
+ float dist_from_center = length(rp.xz) * 7.0;
122
+
123
+ // adds dip near stem
124
+ rp.y -= 2.0 / pow(1.3 - (1.0-u_mouse.y * u_mouse_scale_factor) / 10.0, dist_from_center + abs(rp.x) * 5.0);
125
+
126
+ // adds tilt between leaves
127
+ rp.y += smoothstep(-0.9, 0.9, rp.x / 4.0) + 1.0;
128
+
129
+ // pushes petal tip out
130
+ rp.z += 1.0/(abs(rp.x) + 1.5) + 0.5 + (1.0-u_mouse.y * u_mouse_scale_factor) / 2.0;
131
+
132
+ float petal = sdEllipsoid(rp, vec3(0.1 + (1.0-u_mouse.y * u_mouse_scale_factor) / 10.0, 0.02, 0.2 + (1.0-u_mouse.y * u_mouse_scale_factor) / 10.0));
133
+ petals = smin(petals, petal, 0.1);
134
+ }
135
+ return petals;
136
+ }
137
+
138
+ float trumpet(vec3 p)
139
+ {
140
+ float dist_from_center = length(p.xz);
141
+ vec3 p_base = p;
142
+ p_base.y +=1.0;
143
+ float trumpetbase = sdCappedCone(p_base, 0.6 + (1.0-u_mouse.y * u_mouse_scale_factor), 0.3, 0.1);
144
+
145
+ vec3 p_flare = p;
146
+ p_flare.y -= 1.0 / (dist_from_center + 0.4) - 3.2 - (1.0-u_mouse.y * u_mouse_scale_factor);
147
+
148
+ float r = length(p_flare.xz);
149
+ float angle = atan(p_flare.z, p_flare.x);
150
+
151
+
152
+ float hyper = 1.0 / (r + 10.0);
153
+
154
+
155
+ p_flare.y += hyper * sin(angle * (angle - 1.6) * 2.0);
156
+
157
+
158
+ float flare = sdEllipsoid(p_flare, vec3(0.09 + (1.0-u_mouse.y * u_mouse_scale_factor) / 20.0, 0.01, 0.09 + (1.0-u_mouse.y * u_mouse_scale_factor) / 20.0));
159
+ float trumpet = smin(trumpetbase, flare, 0.6 + (1.0-u_mouse.y * u_mouse_scale_factor) / 2.0);
160
+
161
+ return trumpet;
162
+ }
163
+
164
+ float leaves(vec3 p) {
165
+ float leaves = 1000.0;
166
+ const int LEAF_COUNT = 5;
167
+ for(int i = 0; i < LEAF_COUNT; i++)
168
+ {
169
+ float angle = float(i) / float(LEAF_COUNT) * 6.28318;
170
+ vec3 rp = p;
171
+
172
+ float c = cos(angle);
173
+ float s = sin(angle);
174
+ rp.xz = mat2(c, -s, s, c) * rp.xz;
175
+
176
+ float dist_from_center = length(rp.xz);
177
+
178
+ rp.y += smoothstep(0.0,4.0, dist_from_center) * 20.0 - 15.0;
179
+ rp.z += angle / 4.0;
180
+
181
+ float leaf = sdEllipsoid(rp, vec3(0.5, 2.0, 0.5 + (1.0-u_mouse.y * u_mouse_scale_factor) / 2.0));
182
+ leaves = smin(leaves, leaf, (1.0-u_mouse.y * u_mouse_scale_factor));
183
+ }
184
+ return leaves;
185
+ }
186
+
187
+ float single_flower(vec3 p)
188
+ {
189
+ float scaledTime = u_time * u_time_multiplier / 2.0;
190
+
191
+ float bendStart = 7.0;
192
+ float bendEnd = 0.0;
193
+
194
+ float h = clamp((p.y - bendStart) / (bendEnd - bendStart), 0.0, 1.0);
195
+
196
+ h = h * h;
197
+
198
+ float maxBend =
199
+ sin(u_time * u_time_multiplier / 2.0) / 10.0
200
+ + 0.6
201
+ - (gain(u_vitality / 2.0, 2.0) - 0.5) / 5.0;
202
+
203
+ float bendAngle = h * maxBend;
204
+
205
+ //p = rotateAroundAxis(p, vec3(1.0, 0.0, 0.0), 0.2);
206
+ p = rotateAroundAxis(p, vec3(0.0, 1.0, 0.0), u_flower_rotation);
207
+
208
+ p = rotateAroundAxis(p, vec3(1.0, 0.0, 0.0), -bendAngle);
209
+
210
+ //p.xz += vec2(sin(p.y * 0.2+ scaledTime), cos(p.y * 0.20 + scaledTime)) * smoothstep(-1.0, 0.0, p.y) / 2.0;
211
+
212
+ vec3 stemP = p;
213
+ stemP.y -= 6.0;
214
+ float stem = sdCappedCylinder(stemP, 7.0, 0.01);
215
+
216
+ float flower = smin(smin(petals(p), trumpet(p), 0.0), leaves(p), 0.0);
217
+
218
+ float scene = smin(flower, stem, 1.0);
219
+
220
+ return scene;
221
+ }
222
+
223
+ float sceneSDF(vec3 p)
224
+ {
225
+ float radius = u_ring_radius + (1.0-u_mouse.y * u_mouse_scale_factor) * 3.0;
226
+
227
+ p = rotateAroundAxis(p, vec3(1.0, 0.0, 0.0), -0.5);
228
+ float angle =
229
+ atan(p.z, p.x)
230
+ + 0.4
231
+ + (sin(u_time * u_time_multiplier)) * u_natural_rotation_scale
232
+ - (gain(u_mouse.x, u_mouse_rotation_gain) - 0.5) * u_mouse_rotation
233
+ + u_rotation_offset;
234
+ float r = length(p.xz);
235
+
236
+ float sectorAngle = 6.28318 / u_flower_count;
237
+
238
+ float id = floor((angle + 3.14159) / sectorAngle);
239
+
240
+ float centerAngle = id * sectorAngle + sectorAngle * 0.5 - 3.14159;
241
+
242
+ float localAngle = angle - centerAngle;
243
+
244
+ vec3 localP;
245
+
246
+ localP.x = r * cos(localAngle) - radius;
247
+ localP.z = r * sin(localAngle);
248
+ localP.y = p.y;
249
+
250
+ float variation = sin(id * 12.37);
251
+
252
+ localP = rotateAroundAxis(localP, vec3(0.0,1.0,0.0), centerAngle);
253
+
254
+ localP.y += sin(id * 5.17) * 0.35;
255
+
256
+ return single_flower(localP);
257
+ }
258
+
259
+
260
+
261
+ void main()
262
+ {
263
+ vec2 uv = vec2(vUv.x * 2.0 - 1.0, (1.0 -vUv.y) * 2.0 - 1.0);
264
+ float aspect = u_resolution.x / u_resolution.y;
265
+ vec2 resolution = vec2(uv.x * aspect, uv.y) * 0.5;
266
+
267
+ vec3 ray_origin = vec3(0, (1.0-u_mouse.y * u_mouse_scale_factor) * 1.0, (1.0-u_mouse.y * u_mouse_scale_factor) * 7.0) + u_transform;
268
+ vec3 ray_direction = normalize(vec3(resolution, 1.0));
269
+
270
+ float MAX_DIST = 20.0 + 10.0 * (1.0-u_mouse.y * u_mouse_scale_factor);
271
+ const int MAX_STEPS = 100;
272
+ float dist_traveled = 0.0;
273
+ int steps = 0;
274
+ int intersected = 0;
275
+ float min_dist = 100.0;
276
+
277
+ for(int i = 0; i < MAX_STEPS; i++)
278
+ {
279
+ vec3 current_pos = ray_origin + ray_direction * dist_traveled;
280
+
281
+ float distance = sceneSDF(current_pos);
282
+
283
+ min_dist = min(distance, min_dist);
284
+
285
+ if(distance < 0.1)
286
+ {
287
+ intersected = 1;
288
+ break;
289
+ }
290
+
291
+ if(dist_traveled > MAX_DIST)
292
+ break;
293
+
294
+ dist_traveled += distance * 0.5;
295
+ steps += 1;
296
+ }
297
+
298
+ fragColor = vec4(
299
+ mix(
300
+ vec3(
301
+ //0.0,
302
+ //pow(max(0.0,1.0 - float(min_dist)), 2.0 * u_vitality + 1.0),
303
+ pow(max(0.0,1.0 - float(min_dist)), 0.5 * u_vitality + 1.0) * 1.2
304
+ //pow(1.0 - float(steps) / float(MAX_STEPS), 2.0),
305
+ //1.0
306
+ ),
307
+ vec3(
308
+ pow(max(0.0,1.0 - dist_traveled / MAX_DIST), 1.0)
309
+ //pow(1.0 - float(steps) / float(MAX_STEPS), 2.0)
310
+ //1.0
311
+ ),
312
+ pow(min(1.0,(1.0 - u_vitality) + 0.4), 2.0)
313
+ //float(intersected)
314
+ ),
315
+ 1.0
316
+ );
317
+ }`,A3=`#version 300 es
318
+ precision mediump float;
319
+
320
+ uniform sampler2D u_texture;
321
+ uniform vec2 u_resolution; // resolution
322
+ uniform float u_numColors; // [2, 16, 2]
323
+ uniform float u_dither_size; // [1, 100, 10]
324
+
325
+ in vec2 vUv;
326
+ out vec4 fragColor;
327
+
328
+
329
+ int bayer(int x, int y) {
330
+ int bayer64[64] = int[64](
331
+ 0, 32, 8, 40, 2, 34, 10, 42,
332
+ 48, 16, 56, 24, 50, 18, 58, 26,
333
+ 12, 44, 4, 36, 14, 46, 6, 38,
334
+ 60, 28, 52, 20, 62, 30, 54, 22,
335
+ 3, 35, 11, 43, 1, 33, 9, 41,
336
+ 51, 19, 59, 27, 49, 17, 57, 25,
337
+ 15, 47, 7, 39, 13, 45, 5, 37,
338
+ 63, 31, 55, 23, 61, 29, 53, 21
339
+ );
340
+ return bayer64[(y % 8) * 8 + (x % 8)];
341
+ }
342
+
343
+ void main() {
344
+ vec2 cell = floor(vUv * u_resolution / u_dither_size);
345
+ vec2 cellUv = cell / u_resolution * u_dither_size;
346
+
347
+ vec4 color = texture(u_texture, cellUv);
348
+
349
+ float threshold = (float(bayer(int(cell.x), int(cell.y))) + 0.5) / 64.0 - 0.5;
350
+
351
+ float n = max(2.0, u_numColors);
352
+ float step = 1.0 / (n - 1.0);
353
+ vec3 dithered = clamp(round((color.rgb + threshold * step) / step) * step, 0.0, 1.0);
354
+
355
+ fragColor = vec4(dithered, color.a);
356
+ }
357
+ `,N3=`#version 300 es
358
+ precision mediump float;
359
+
360
+ uniform sampler2D u_texture; // input
361
+ uniform vec2 u_resolution; // resolution
362
+ uniform float u_frequency; // [1, 1000, 20]
363
+ uniform float u_radius; // [0, 1, 0.5]
364
+ uniform float u_rotation; // [0, 6.28, 0]
365
+ uniform float u_constantSize; // [0, 1, 0]
366
+ uniform vec4 u_background; // color [1, 1, 1, 1]
367
+
368
+ in vec2 vUv;
369
+ out vec4 fragColor;
370
+
371
+ vec2 rot(vec2 v, float a) {
372
+ float c = cos(a), s = sin(a);
373
+ return mat2(c, -s, s, c) * v;
374
+ }
375
+
376
+ void main() {
377
+ float aspect = u_resolution.x / u_resolution.y;
378
+
379
+ // rotate UV space around center (aspect-corrected)
380
+ vec2 aUv = vec2((vUv.x - 0.5) * aspect, vUv.y - 0.5);
381
+ vec2 rotUv = rot(aUv, u_rotation);
382
+
383
+ // find nearest grid cell center in rotated space
384
+ vec2 cellUv = rotUv * u_frequency;
385
+ vec2 cellId = round(cellUv);
386
+
387
+ // unrotate cell center back to texture UV space
388
+ vec2 sampleUv = rot(cellId / u_frequency, -u_rotation) / vec2(aspect, 1.0) + 0.5;
389
+ vec4 cellColor = texture(u_texture, clamp(sampleUv, 0.0, 1.0));
390
+
391
+ // luminance drives dot radius unless constant size is toggled
392
+ float lum = dot(cellColor.rgb, vec3(0.299, 0.587, 0.114));
393
+ float dotRadius = u_radius * mix(lum, 1.0, step(0.5, u_constantSize));
394
+
395
+ // distance from current pixel to nearest cell center (in cell-space units)
396
+ float dist = length(cellUv - cellId);
397
+
398
+ fragColor = dist < dotRadius ? cellColor : u_background;
399
+ }
400
+ `,M3=`#version 300 es
401
+ precision highp float;
402
+
403
+ in vec2 vUv;
404
+ out vec4 fragColor;
405
+
406
+ uniform vec2 u_resolution; // [100, 100]
407
+ uniform float u_time; // time
408
+ uniform float u_mod_size; // [0, 2, 1]
409
+ uniform float u_tile_factor; // [1, 100, 10]
410
+ uniform vec2 u_translation; // [0,0]
411
+
412
+ float modSigned(float x, float y) {
413
+ return x - y * sign(x) * floor(abs(x/y));
414
+ }
415
+
416
+ void main() {
417
+ // Map UV coordinates to RGB
418
+ float aspect = u_resolution.x / u_resolution.y;
419
+ vec2 uv = vec2(
420
+ (vUv.x + sin((u_translation.x +vUv.x) * 10.0) * sin(vUv.y + u_translation.y + u_time / 100.0) * .01 ) * aspect,
421
+ vUv.y + sin((u_translation.y+vUv.y) * 7.0) * 0.05 * sin(vUv.x + u_translation.x + u_time / 100.)) * u_tile_factor + u_translation;
422
+
423
+ vec2 localUv = vec2(
424
+ mod(uv.x, u_mod_size),
425
+ mod(uv.y,u_mod_size)
426
+ );
427
+
428
+ float dist = length(
429
+ localUv - (u_mod_size / 2.0)
430
+ );
431
+
432
+
433
+ fragColor = mix(
434
+ vec4(1.0 - localUv.x, localUv.y,1., 1.0),
435
+ vec4(vec3(1.0), 1.0),
436
+ smoothstep(0.6, 0.5, dist)
437
+ );
438
+ }`,O3=`#version 300 es
439
+ precision mediump float;
440
+
441
+ uniform sampler2D u_texture;
442
+ uniform sampler2D u_gradientTexture; // gradient
443
+ in vec2 vUv;
444
+ out vec4 fragColor;
445
+
446
+ void main() {
447
+ vec4 color = texture(u_texture, vUv);
448
+
449
+ float brightness = dot(color.rgb, vec3(0.299, 0.587, 0.114));
450
+
451
+ vec4 gradientColor = texture(u_gradientTexture, vec2(brightness, 0.5));
452
+
453
+ fragColor = vec4(gradientColor.rgb, 1.0);
454
+ }
455
+ `,D3=`#version 300 es
456
+ precision mediump float;
457
+
458
+ uniform sampler2D u_texture; // input
459
+ uniform vec3 u_hslAdjust; // H (degrees), S (0-1), L (0-1) — [0, 0, 0]
460
+
461
+ in vec2 vUv;
462
+ out vec4 fragColor;
463
+
464
+ vec3 rgb2hsl(vec3 color) {
465
+ float maxC = max(max(color.r, color.g), color.b);
466
+ float minC = min(min(color.r, color.g), color.b);
467
+ float delta = maxC - minC;
468
+
469
+ float h = 0.0;
470
+ float s = 0.0;
471
+ float l = (maxC + minC) / 2.0;
472
+
473
+ if (delta != 0.0) {
474
+ s = l > 0.5 ? delta / (2.0 - maxC - minC) : delta / (maxC + minC);
475
+
476
+ if (color.r == maxC) {
477
+ h = (color.g - color.b) / delta + (color.g < color.b ? 6.0 : 0.0);
478
+ } else if (color.g == maxC) {
479
+ h = (color.b - color.r) / delta + 2.0;
480
+ } else {
481
+ h = (color.r - color.g) / delta + 4.0;
482
+ }
483
+ h /= 6.0;
484
+ }
485
+
486
+ return vec3(h, s, l);
487
+ }
488
+
489
+ float hue2rgb(float p, float q, float t) {
490
+ if (t < 0.0) t += 1.0;
491
+ if (t > 1.0) t -= 1.0;
492
+ if (t < 1.0/6.0) return p + (q - p) * 6.0 * t;
493
+ if (t < 1.0/2.0) return q;
494
+ if (t < 2.0/3.0) return p + (q - p) * (2.0/3.0 - t) * 6.0;
495
+ return p;
496
+ }
497
+
498
+ vec3 hsl2rgb(vec3 hsl) {
499
+ float h = hsl.x;
500
+ float s = hsl.y;
501
+ float l = hsl.z;
502
+
503
+ if (s == 0.0) {
504
+ return vec3(l);
505
+ }
506
+
507
+ float q = l < 0.5 ? l * (1.0 + s) : l + s - l * s;
508
+ float p = 2.0 * l - q;
509
+ return vec3(
510
+ hue2rgb(p, q, h + 1.0/3.0),
511
+ hue2rgb(p, q, h),
512
+ hue2rgb(p, q, h - 1.0/3.0)
513
+ );
514
+ }
515
+
516
+ void main() {
517
+ vec4 color = texture(u_texture, vUv);
518
+
519
+ vec3 hsl = rgb2hsl(color.rgb);
520
+
521
+ hsl.x = mod(hsl.x + u_hslAdjust.x / 360.0, 1.0);
522
+ hsl.y = clamp(hsl.y + u_hslAdjust.y, 0.0, 1.0);
523
+ hsl.z = clamp(hsl.z + u_hslAdjust.z, 0.0, 1.0);
524
+
525
+ fragColor = vec4(hsl2rgb(hsl), color.a);
526
+ }
527
+ `,z3=`#version 300 es
528
+ precision highp float;
529
+
530
+ in vec2 vUv;
531
+ out vec4 fragColor;
532
+
533
+ uniform sampler2D u_image_source; // texture
534
+ uniform vec2 resolution; // resolution
535
+ uniform float scale; // [0.1, 3, 1]
536
+
537
+ void main() {
538
+ ivec2 size = textureSize(u_image_source, 0);
539
+ vec2 aspect = vec2(
540
+ float(size.x) / float(size.y),
541
+ 1.0
542
+ );
543
+
544
+ vec2 uv = vUv - 0.5;
545
+ uv /= aspect;
546
+ uv *= vec2(
547
+ resolution.x / resolution.y, 1.0
548
+ );
549
+ uv *= scale;
550
+ uv += 0.5;
551
+
552
+ uv.y = 1.0 - uv.y;
553
+
554
+ if (
555
+ any(lessThan(uv, vec2(0.0))) ||
556
+ any(greaterThan(uv, vec2(1.0)))
557
+ ) {
558
+ fragColor = vec4(vec3(0.0), 1.0);
559
+ return;
560
+ }
561
+
562
+ fragColor = texture(
563
+ u_image_source,
564
+ vec2(uv.x, uv.y)
565
+ );
566
+ }`,B3=`#version 300 es
567
+ precision highp float;
568
+
569
+ uniform vec2 u_resolution; // resolution
570
+ uniform float u_doubling; // [-5, 5, 0.1]
571
+ uniform float u_amplitude;
572
+
573
+ uniform float u_rotation; // [0, 6.28, 0]
574
+ uniform float u_density; // [10, 200, 30]
575
+ uniform vec4 u_color_1; // color [0,0,0,1]
576
+ uniform vec4 u_color_2; // color [1,1,1,1]
577
+
578
+ uniform sampler2D u_input_tex;
579
+ uniform float u_invert; // [0, 1, 1]
580
+
581
+
582
+ in vec2 vUv;
583
+ out vec4 fragColor;
584
+
585
+ const float PI = 3.1415926535897932384626433832795;
586
+
587
+ /*
588
+ angle is in radians
589
+ */
590
+ vec2 rotate(vec2 uv, float angle) {
591
+ float c = cos(angle);
592
+ float s = sin(angle);
593
+ return mat2(c, -s, s, c) * uv;
594
+ }
595
+
596
+ vec2 invRotate(vec2 uv, float angle) {
597
+ float c = cos(angle);
598
+ float s = sin(angle);
599
+ return mat2(c, s, -s, c) * uv;
600
+ }
601
+
602
+ vec2 rotateCenter(vec2 uv, float angle) {
603
+ return rotate(uv - vec2(.5), u_rotation) + vec2(.5);
604
+ }
605
+
606
+ void main() {
607
+ vec2 uv = vec2(vUv.x, vUv.y);
608
+ vec2 uvInRotatedSpace = invRotate(uv, u_rotation);
609
+ vec2 targetPixInRot = vec2(floor(uvInRotatedSpace.x * u_density + 0.5)/u_density, uvInRotatedSpace.y);
610
+ vec2 targetPixInRot2 = vec2(floor((uvInRotatedSpace.x) * u_density + 0.5)/u_density, uvInRotatedSpace.y + u_doubling / 20.0);
611
+
612
+ float distanceFromTargetInRot = smoothstep(0.0, 1.0, abs(targetPixInRot.x - uvInRotatedSpace.x) * 1.2) * 15.0 / (1.0 + u_amplitude * 5.0);
613
+ float maxDist = 1.0 / u_density;
614
+
615
+ vec2 targetInCart = invRotate(targetPixInRot, -u_rotation);
616
+ vec2 targetInCart2 = invRotate(targetPixInRot2, -u_rotation);
617
+ vec4 targetColor = (texture(u_input_tex, targetInCart) + texture(u_input_tex, targetInCart2)) * 0.5;
618
+
619
+ float targetLum = pow(dot(targetColor.rgb, vec3(0.299, 0.587, 0.114)), 2.0);
620
+
621
+ // 1.0 is solid; should be shaded. 0.0 should be white space
622
+ float solidMask = clamp(targetLum, 0.0, 1.0) < distanceFromTargetInRot * u_density ? 1.0 : 0.0;
623
+
624
+
625
+ if (u_invert > 0.5) {
626
+ if (solidMask < 0.5) {
627
+ fragColor = u_color_2;
628
+ } else {
629
+ fragColor = u_color_1;
630
+ }
631
+ } else {
632
+ if (solidMask > 0.5) {
633
+ fragColor = u_color_2;
634
+ } else {
635
+ fragColor = u_color_1;
636
+ }
637
+ }
638
+
639
+ }`,U3=`#version 300 es
640
+ precision mediump float;
641
+
642
+ uniform sampler2D u_texture; // input
643
+ uniform vec3 u_rgbAdjust; // RGB offset in [−255, 255] — [0, 0, 0]
644
+
645
+ in vec2 vUv;
646
+ out vec4 fragColor;
647
+
648
+ void main() {
649
+ vec4 color = texture(u_texture, vUv);
650
+ vec3 adjusted = clamp(color.rgb + u_rgbAdjust / 255.0, 0.0, 1.0);
651
+ fragColor = vec4(adjusted, color.a);
652
+ }
653
+ `,L3=`#version 300 es
654
+ precision mediump float;
655
+
656
+ in vec2 vUv;
657
+ out vec4 fragColor;
658
+
659
+ uniform sampler2D u_texture_1;
660
+ uniform sampler2D u_texture_2;
661
+
662
+ void main() {
663
+ fragColor = clamp(
664
+ texture(u_texture_1, vUv) + texture(u_texture_2, vUv),
665
+ vec4(0.),
666
+ vec4(1.)
667
+ );
668
+
669
+ }`,k3=`#version 300 es
670
+ precision mediump float;
671
+
672
+ in vec2 vUv;
673
+ out vec4 fragColor;
674
+
675
+ uniform sampler2D u_texture_1;
676
+ uniform sampler2D u_texture_2;
677
+
678
+ void main() {
679
+ fragColor = clamp(
680
+ texture(u_texture_1, vUv) - texture(u_texture_2, vUv),
681
+ vec4(0.),
682
+ vec4(1.)
683
+ );
684
+
685
+ }`,I3=`#version 300 es
686
+ precision mediump float;
687
+
688
+ in vec2 vUv;
689
+ out vec4 fragColor;
690
+
691
+ uniform sampler2D u_texture_1;
692
+ uniform sampler2D u_texture_2;
693
+ uniform float u_factor; // [0, 1, 0.5]
694
+
695
+ void main() {
696
+ fragColor = mix(
697
+ texture(u_texture_1, vUv),
698
+ texture(u_texture_2, vUv),
699
+ u_factor
700
+ );
701
+ }
702
+
703
+ `,H3=`#version 300 es
704
+ precision mediump float;
705
+
706
+ in vec2 vUv;
707
+ out vec4 fragColor;
708
+
709
+ uniform sampler2D u_texture_1;
710
+ uniform sampler2D u_texture_2;
711
+
712
+ void main() {
713
+ fragColor = clamp(
714
+ texture(u_texture_1, vUv) * texture(u_texture_2, vUv),
715
+ vec4(0.),
716
+ vec4(1.)
717
+ );
718
+
719
+ }`,F3=`#version 300 es
720
+ precision mediump float;
721
+
722
+ in vec2 vUv;
723
+ out vec4 fragColor;
724
+
725
+ uniform sampler2D u_texture_1;
726
+ uniform sampler2D u_texture_2;
727
+
728
+ void main() {
729
+ fragColor = clamp(
730
+ texture(u_texture_1, vUv) / (texture(u_texture_2, vUv) + 0.001),
731
+ vec4(0.),
732
+ vec4(1.)
733
+ );
734
+ }`,P3=`#version 300 es
735
+ precision mediump float;
736
+
737
+ uniform sampler2D u_texture;
738
+ uniform float u_blur_radius; // [0, 3, 0.1]
739
+ uniform vec2 u_resolution; // resolution
740
+ uniform vec2 u_center; // [0.5, 0.5]
741
+ uniform float u_blur_sample_count; // [2, 50, 5]
742
+
743
+ in vec2 vUv;
744
+ out vec4 fragColor;
745
+
746
+ void main() {
747
+ vec2 aspect = vec2(u_resolution.x / u_resolution.y, 1.0);
748
+ vec2 uv = vUv * aspect;
749
+ vec2 center = u_center * aspect;
750
+
751
+ vec2 offset = uv - center;
752
+ float r = atan(offset.y, offset.x);
753
+ float dist = length(offset);
754
+
755
+ vec4 result = vec4(0.);
756
+
757
+ int count = int(floor(u_blur_sample_count));
758
+ float invCount = 1.0 / float(count);
759
+
760
+ for (int i = 0; i < count; i++) {
761
+ float progress = float(i) * invCount;
762
+ float angle = r - u_blur_radius * 0.5 + progress * u_blur_radius;
763
+
764
+ vec2 rotated = vec2(cos(angle), sin(angle)) * dist;
765
+
766
+ vec2 sample_uv = center + rotated;
767
+ sample_uv /= aspect;
768
+
769
+ result += texture(u_texture, sample_uv);
770
+ }
771
+
772
+ fragColor = result * invCount;
773
+ }
774
+ `,j3=`#version 300 es
775
+ precision mediump float;
776
+
777
+ in vec2 vUv;
778
+ out vec4 fragColor;
779
+
780
+ uniform sampler2D u_input_tex;
781
+ uniform float u_blur_dist; // [0, 1, 0.1]
782
+ uniform vec2 u_resolution; // resolution
783
+ uniform float u_angle; // [0, 10, 0]
784
+ uniform float u_blur_sample_count; // [2, 50, 5]
785
+ uniform float u_start_offset; // [0, 1, 0.5]
786
+
787
+
788
+ mat2 rotate2D(float angle) {
789
+ float c = cos(angle);
790
+ float s = sin(angle);
791
+ return mat2(
792
+ c, -s,
793
+ s, c
794
+ );
795
+ }
796
+
797
+ void main() {
798
+ vec2 aspect = vec2(
799
+ u_resolution.x / u_resolution.y,
800
+ 1.0
801
+ );
802
+
803
+ vec2 uv = vUv * aspect;
804
+
805
+ mat2 rot_mat = rotate2D(u_angle);
806
+ mat2 inv_rot_mat = rotate2D(-u_angle);
807
+ vec2 rotated_uv = rot_mat * uv;
808
+
809
+ int count = int(floor(u_blur_sample_count));
810
+
811
+ vec4 result = vec4(0.0);
812
+
813
+ float offset_bias = u_blur_dist * u_start_offset;
814
+
815
+ for (int i = 0; i < count; i++) {
816
+ float offset = float(i) / float(count) * u_blur_dist - offset_bias;
817
+ vec2 target_pos = rotated_uv + vec2(offset, 0.0);
818
+
819
+ result += texture(
820
+ u_input_tex,
821
+ (inv_rot_mat * target_pos) / aspect
822
+ );
823
+ }
824
+
825
+ fragColor = result / float(count);
826
+ }`,V3=`#version 300 es
827
+ precision mediump float;
828
+
829
+ // from book of shaders
830
+
831
+ uniform vec2 u_resolution; // resolution
832
+ uniform float u_time; // time
833
+
834
+ in vec2 vUv;
835
+ out vec4 fragColor;
836
+
837
+ float random (vec2 st) {
838
+ return fract(sin(dot(st.xy,
839
+ vec2(12.9898,78.233)))*
840
+ 438758.5453123);
841
+ }
842
+
843
+ void main() {
844
+ vec2 st = vUv.xy/u_resolution.xy + u_time;
845
+
846
+ float rnd1 = random(st);
847
+ float rnd2 = random(st + rnd1);
848
+ float rnd3 = random(vec2(rnd1, rnd2));
849
+ float rnd4 = random(vec2(rnd1, rnd3));
850
+
851
+ fragColor = vec4(rnd1, rnd3, rnd4,1.0);
852
+ }`,G3=`#version 300 es
853
+ precision mediump float;
854
+
855
+
856
+ uniform sampler2D u_input_tex;
857
+ uniform vec2 u_resolution; // resolution
858
+ uniform float disperse_distance; // [0, 1, 0.1]
859
+
860
+ in vec2 vUv;
861
+ out vec4 fragColor;
862
+
863
+ float random (vec2 st) {
864
+ return fract(sin(dot(st.xy,
865
+ vec2(12.9898,78.233)))*
866
+ 438758.5453123);
867
+ }
868
+
869
+ void main() {
870
+ vec2 aspect = vec2(
871
+ u_resolution.x / u_resolution.y,
872
+ 1.0
873
+ );
874
+ vec2 uv = vUv.xy * aspect;
875
+
876
+ float rnd1 = random(uv);
877
+ float rnd2 = random(uv.yx);
878
+
879
+ fragColor = texture(u_input_tex,
880
+ (vec2(rnd1, rnd2) * disperse_distance - disperse_distance * 0.5 + uv)
881
+ / aspect
882
+ );
883
+ }`,q3=`#version 300 es
884
+ #define PI 3.14159
885
+ precision mediump float;
886
+
887
+ in vec2 vUv;
888
+ out vec4 fragColor;
889
+
890
+ uniform sampler2D input_tex;
891
+ uniform vec2 resolution; // resolution
892
+ uniform vec3 rotation; // [0, 0, 0]
893
+ uniform vec3 translation; // [0, 0, 1]
894
+ uniform vec2 scale; // [1, 1]
895
+ uniform vec4 background_color; // color [1, 1, 1, 0]
896
+
897
+ vec2 rotate(vec2 x, float angle_rad) {
898
+ float cos_val = cos(angle_rad);
899
+ float sin_val = sin(angle_rad);
900
+
901
+ return vec2(
902
+ cos_val * x.x - sin_val * x.y,
903
+ sin_val * x.x + cos_val * x.y
904
+ );
905
+ }
906
+
907
+ vec3 rotate3(vec3 v, vec3 rotation) {
908
+ v.yz = rotate(v.yz, rotation.x);
909
+ v.xz = rotate(v.xz, rotation.y);
910
+ v.xy = rotate(v.xy, rotation.z);
911
+ return v;
912
+ }
913
+
914
+ vec2 get_intersection_uv(vec3 ray_direction) {
915
+ // camera facing (0, 0, 1)
916
+ // initial image facing (0, 0, -1)
917
+ vec3 texture_normal = vec3(0.0, 0.0, -1.0);
918
+ vec3 texture_positive_x = vec3(1.0, 0.0, 0.0) * scale.x;
919
+ vec3 texture_positive_y = vec3(0.0, 1.0, 0.0) * scale.y;
920
+
921
+
922
+ texture_normal = rotate3(texture_normal, rotation);
923
+ texture_positive_x = rotate3(texture_positive_x, rotation);
924
+ texture_positive_y = rotate3(texture_positive_y, rotation);
925
+
926
+ float numerator = dot(translation, texture_normal);
927
+ float denominator = dot(ray_direction, texture_normal);
928
+ if (abs(denominator) < 1e-5) {
929
+ return vec2(-1.0);
930
+ }
931
+ float t = numerator / denominator;
932
+ vec3 intersection_point = t * ray_direction;
933
+ vec3 relative_dist = intersection_point - translation;
934
+
935
+ float proj_x = dot(relative_dist, texture_positive_x);
936
+ float proj_y = dot(relative_dist, texture_positive_y);
937
+
938
+ return vec2(proj_x, proj_y);
939
+ }
940
+
941
+
942
+
943
+ void main() {
944
+ vec2 aspect = vec2(
945
+ resolution.x / resolution.y,
946
+ 1.0
947
+ );
948
+
949
+ vec2 uv = (vUv - 0.5) * aspect;
950
+
951
+ vec3 ray_direction = normalize(vec3(
952
+ uv,
953
+ 1.0
954
+ ));
955
+
956
+ vec2 intersection_loc = get_intersection_uv(ray_direction);
957
+ uv = intersection_loc + 0.5;
958
+
959
+
960
+ if (any(greaterThan(uv, vec2(1.0))) || any(lessThan(uv, vec2(0.0)))) {
961
+ fragColor = clamp(background_color, vec4(0.0), vec4(1.0));
962
+ fragColor.rgb *= fragColor.a;
963
+ return;
964
+ }
965
+
966
+ fragColor = texture(input_tex, uv);
967
+ }`,Y3=`#version 300 es
968
+ precision mediump float;
969
+
970
+
971
+ in vec2 vUv;
972
+ out vec4 fragColor;
973
+
974
+ uniform sampler2D u_input;
975
+ uniform sampler2D u_tile_atlas;
976
+
977
+ uniform vec2 u_resolution; // resolution
978
+ uniform float u_divide_into; // [0.1, 100, 1]
979
+ uniform vec2 u_tile_size; // [0.1, 0.1]
980
+ uniform float u_scale; // [0.1, 1000, 1]
981
+
982
+ void main () {
983
+ vec2 aspect = vec2(u_resolution.x / u_resolution.y, 1.0);
984
+ vec2 uv = vUv;
985
+ uv -= 0.5;
986
+ uv *= aspect;
987
+ uv += 0.5;
988
+
989
+ vec2 scaled_tile_size = u_tile_size * u_scale;
990
+
991
+ float num_of_atlases_fit_x = 1.0 / scaled_tile_size.x;
992
+ float atlas_mult_y = num_of_atlases_fit_x * scaled_tile_size.y / scaled_tile_size.x;
993
+
994
+ vec2 target_uv = vec2(
995
+ floor(uv.x * num_of_atlases_fit_x) / num_of_atlases_fit_x,
996
+ floor(uv.y * atlas_mult_y) / atlas_mult_y
997
+ );
998
+
999
+ vec2 next_target_uv = vec2(
1000
+ ceil(uv.x * num_of_atlases_fit_x) / num_of_atlases_fit_x,
1001
+ ceil(uv.y * atlas_mult_y) / atlas_mult_y
1002
+ );
1003
+
1004
+ vec4 target_color = texture(u_input, (target_uv - 0.5)/ aspect + 0.5);
1005
+
1006
+ float lum = (target_color.r + target_color.g + target_color.b) / 3.0;
1007
+
1008
+ float start_x = floor(lum * u_divide_into) / u_divide_into;
1009
+ float end_x = ceil(lum * u_divide_into) / u_divide_into;
1010
+
1011
+ vec2 tile_space_uv = (uv - target_uv) / (next_target_uv - target_uv);
1012
+
1013
+ vec2 atlas_space_uv = tile_space_uv * vec2(end_x - start_x, 1.0) + vec2(start_x, 0.0);
1014
+
1015
+ vec4 tile_color = texture(u_tile_atlas, atlas_space_uv);
1016
+
1017
+ fragColor = vec4(
1018
+ tile_color.rgb,
1019
+ 1.0
1020
+ );
1021
+ }`,X3=`#version 300 es
1022
+ precision mediump float;
1023
+
1024
+ uniform sampler2D u_texture; // input
1025
+ uniform float u_brightness; // [-1, 1, 0]
1026
+ uniform float u_contrast; // [-1, 1, 0]
1027
+
1028
+ in vec2 vUv;
1029
+ out vec4 fragColor;
1030
+
1031
+ void main() {
1032
+ vec4 c = texture(u_texture, vUv);
1033
+
1034
+ vec3 rgb = (c.rgb - 0.5) * (1.0 + u_contrast) + 0.5 + u_brightness;
1035
+
1036
+ fragColor = vec4(clamp(rgb, 0.0, 1.0), c.a);
1037
+ }
1038
+ `,$3=`#version 300 es
1039
+ precision mediump float;
1040
+
1041
+ uniform sampler2D u_texture; // input
1042
+ uniform float u_amount; // [0, 0.05, 0.01]
1043
+ uniform float u_angle; // [0, 6.28, 0]
1044
+
1045
+ in vec2 vUv;
1046
+ out vec4 fragColor;
1047
+
1048
+ void main() {
1049
+ vec2 dir = vec2(cos(u_angle), sin(u_angle)) * u_amount;
1050
+
1051
+ float r = texture(u_texture, vUv + dir).r;
1052
+ float g = texture(u_texture, vUv).g;
1053
+ float b = texture(u_texture, vUv - dir).b;
1054
+ float a = texture(u_texture, vUv).a;
1055
+
1056
+ fragColor = vec4(r, g, b, a);
1057
+ }
1058
+ `,K3=`#version 300 es
1059
+ precision highp float;
1060
+
1061
+ uniform vec2 u_resolution; // resolution
1062
+ uniform float u_time; // time
1063
+ uniform float u_roundness; // [0, 0.45, 0.05]
1064
+ uniform vec3 u_light_dir; // [1,1,0]
1065
+ uniform vec3 u_rotation_rate; // [1,1,0]
1066
+ uniform float u_distance; // [1, 10, 3]
1067
+
1068
+ in vec2 vUv;
1069
+ out vec4 fragColor;
1070
+
1071
+ vec3 rotX(vec3 p, float a) {
1072
+ float c = cos(a), s = sin(a);
1073
+ return vec3(p.x, c * p.y - s * p.z, s * p.y + c * p.z);
1074
+ }
1075
+
1076
+ vec3 rotY(vec3 p, float a) {
1077
+ float c = cos(a), s = sin(a);
1078
+ return vec3(c * p.x + s * p.z, p.y, -s * p.x + c * p.z);
1079
+ }
1080
+
1081
+ vec3 rotZ(vec3 p, float a) {
1082
+ float c = cos(a), s = sin(a);
1083
+ return vec3(c * p.x - s * p.y, s * p.x + c * p.y, p.z);
1084
+ }
1085
+
1086
+ float sdRoundBox(vec3 p, vec3 b, float r) {
1087
+ vec3 q = abs(p) - b;
1088
+ return length(max(q, 0.0)) + min(max(q.x, max(q.y, q.z)), 0.0) - r;
1089
+ }
1090
+
1091
+ float scene(vec3 p) {
1092
+ vec3 q = rotX(p, u_time * u_rotation_rate.x);
1093
+ q = rotY(q, u_time * u_rotation_rate.y);
1094
+ q = rotZ(q, u_time * u_rotation_rate.z);
1095
+ return sdRoundBox(q, vec3(0.5 - u_roundness), u_roundness);
1096
+ }
1097
+
1098
+ vec3 calcNormal(vec3 p) {
1099
+ vec2 e = vec2(0.001, 0.0);
1100
+ return normalize(vec3(
1101
+ scene(p + e.xyy) - scene(p - e.xyy),
1102
+ scene(p + e.yxy) - scene(p - e.yxy),
1103
+ scene(p + e.yyx) - scene(p - e.yyx)
1104
+ ));
1105
+ }
1106
+
1107
+ void main() {
1108
+ vec2 uv = vUv * 2.0 - 1.0;
1109
+ uv.x *= u_resolution.x / u_resolution.y;
1110
+
1111
+ vec3 ro = vec3(0.0, 0.0, u_distance);
1112
+ vec3 rd = normalize(vec3(uv, -1.5));
1113
+
1114
+ float t = 0.0;
1115
+ bool hit = false;
1116
+ for (int i = 0; i < 80; i++) {
1117
+ float d = scene(ro + rd * t);
1118
+ if (d < 0.001) { hit = true; break; }
1119
+ if (t > 20.0) break;
1120
+ t += d;
1121
+ }
1122
+
1123
+ float brightness = 0.0;
1124
+ if (hit) {
1125
+ vec3 p = ro + rd * t;
1126
+ vec3 n = calcNormal(p);
1127
+ vec3 l = normalize(u_light_dir);
1128
+ float diff = max(dot(n, l), 0.0);
1129
+ brightness = 0.12 + diff * 0.88;
1130
+ }
1131
+
1132
+ fragColor = vec4(vec3(brightness), 1.0);
1133
+ }
1134
+ `,Z3=`#version 300 es
1135
+ precision mediump float;
1136
+
1137
+
1138
+ in vec2 vUv;
1139
+ out vec4 fragColor;
1140
+
1141
+ uniform sampler2D u_input;
1142
+
1143
+ uniform float u_atlas_width; // [0.1, 100, 1]
1144
+ uniform float u_divide_into; // [0.1, 100, 1]
1145
+ uniform float u_scale; // [0.1, 1000, 1]
1146
+
1147
+ void main () {
1148
+
1149
+ vec2 uv = vUv;
1150
+
1151
+ vec2 u_atlas_size = vec2(1.0 / ((u_atlas_width/ u_divide_into) * u_scale * u_scale), 1.0 / (u_scale * u_scale));
1152
+
1153
+ float num_of_atlases_fit_x = 1.0 / u_atlas_size.x;
1154
+ float atlas_mult_y = num_of_atlases_fit_x * u_atlas_size.y / u_atlas_size.x;
1155
+
1156
+ vec2 target_uv = vec2(
1157
+ floor(uv.x * num_of_atlases_fit_x) / num_of_atlases_fit_x,
1158
+ floor(uv.y * atlas_mult_y) / atlas_mult_y
1159
+ );
1160
+
1161
+ vec4 target_color = texture(u_input, target_uv);
1162
+
1163
+ fragColor = vec4(
1164
+ target_color.rgb,
1165
+ 1.0
1166
+ );
1167
+ }`,Q3=`#version 300 es
1168
+ precision mediump float;
1169
+
1170
+ uniform sampler2D u_texture; // input
1171
+ uniform vec2 u_resolution; // resolution
1172
+ uniform float u_strength; // [0, 5, 1]
1173
+ uniform float u_invert; // [0, 1, 0]
1174
+
1175
+ in vec2 vUv;
1176
+ out vec4 fragColor;
1177
+
1178
+ float lum(vec2 uv) {
1179
+ return dot(texture(u_texture, uv).rgb, vec3(0.299, 0.587, 0.114));
1180
+ }
1181
+
1182
+ void main() {
1183
+ vec2 px = 1.0 / u_resolution;
1184
+
1185
+ // Sobel kernels
1186
+ float tl = lum(vUv + vec2(-px.x, px.y));
1187
+ float tc = lum(vUv + vec2( 0.0, px.y));
1188
+ float tr = lum(vUv + vec2( px.x, px.y));
1189
+ float ml = lum(vUv + vec2(-px.x, 0.0));
1190
+ float mr = lum(vUv + vec2( px.x, 0.0));
1191
+ float bl = lum(vUv + vec2(-px.x, -px.y));
1192
+ float bc = lum(vUv + vec2( 0.0, -px.y));
1193
+ float br = lum(vUv + vec2( px.x, -px.y));
1194
+
1195
+ float gx = -tl - 2.0*ml - bl + tr + 2.0*mr + br;
1196
+ float gy = -tl - 2.0*tc - tr + bl + 2.0*bc + br;
1197
+
1198
+ float edge = clamp(length(vec2(gx, gy)) * u_strength, 0.0, 1.0);
1199
+ edge = mix(edge, 1.0 - edge, step(0.5, u_invert));
1200
+
1201
+ fragColor = vec4(vec3(edge), 1.0);
1202
+ }
1203
+ `,W3=`#version 300 es
1204
+ precision mediump float;
1205
+
1206
+ uniform vec2 u_resolution; // resolution
1207
+ uniform vec2 u_center; // [0.5, 0.5]
1208
+ uniform float u_rx; // [0, 1, 0.4]
1209
+ uniform float u_ry; // [0, 1, 0.25]
1210
+ uniform float u_feather; // [0, 0.1, 0.01]
1211
+ uniform float u_invert; // [0, 1, 0]
1212
+
1213
+ in vec2 vUv;
1214
+ out vec4 fragColor;
1215
+
1216
+ void main() {
1217
+ float aspect = u_resolution.x / u_resolution.y;
1218
+ vec2 uv = vec2((vUv.x - u_center.x) * aspect, vUv.y - u_center.y);
1219
+
1220
+ // SDF for ellipse
1221
+ float d = length(uv / vec2(u_rx * aspect, u_ry)) - 1.0;
1222
+
1223
+ float v = 1.0 - smoothstep(-u_feather, u_feather, d);
1224
+ v = mix(v, 1.0 - v, step(0.5, u_invert));
1225
+
1226
+ fragColor = vec4(vec3(v), 1.0);
1227
+ }
1228
+ `,J3=`#version 300 es
1229
+ precision mediump float;
1230
+
1231
+ uniform sampler2D u_texture; // input
1232
+ uniform vec2 u_resolution; // resolution
1233
+ uniform float u_angle; // [0, 6.28, 0.785]
1234
+ uniform float u_strength; // [0, 5, 1]
1235
+
1236
+ in vec2 vUv;
1237
+ out vec4 fragColor;
1238
+
1239
+ void main() {
1240
+ vec2 px = 1.0 / u_resolution;
1241
+ vec2 dir = vec2(cos(u_angle), sin(u_angle));
1242
+
1243
+ vec3 a = texture(u_texture, vUv - px * dir).rgb;
1244
+ vec3 b = texture(u_texture, vUv + px * dir).rgb;
1245
+
1246
+ // emboss: difference from opposite directions, lifted to mid-grey
1247
+ vec3 emboss = clamp((b - a) * u_strength + 0.5, 0.0, 1.0);
1248
+
1249
+ fragColor = vec4(emboss, 1.0);
1250
+ }
1251
+ `,eN=`#version 300 es
1252
+ precision mediump float;
1253
+
1254
+ // Author @patriciogv - 2015
1255
+ // http://patriciogonzalezvivo.com
1256
+
1257
+ uniform vec2 u_resolution; // resolution
1258
+ uniform float u_time; // time
1259
+ uniform float u_scale; // [1, 20, 3]
1260
+ uniform float u_octaves; // [1, 12, 6]
1261
+ uniform float u_speed; // [0, 2, 0.1]
1262
+
1263
+ in vec2 vUv;
1264
+ out vec4 fragColor;
1265
+
1266
+ float random(vec2 st) {
1267
+ return fract(sin(dot(st, vec2(12.9898, 78.233))) * 43758.5453123);
1268
+ }
1269
+
1270
+ // Based on Morgan McGuire @morgan3d
1271
+ // https://www.shadertoy.com/view/4dS3Wd
1272
+ float noise(vec2 st) {
1273
+ vec2 i = floor(st);
1274
+ vec2 f = fract(st);
1275
+
1276
+ float a = random(i);
1277
+ float b = random(i + vec2(1.0, 0.0));
1278
+ float c = random(i + vec2(0.0, 1.0));
1279
+ float d = random(i + vec2(1.0, 1.0));
1280
+
1281
+ vec2 u = f * f * (3.0 - 2.0 * f);
1282
+
1283
+ return mix(a, b, u.x) +
1284
+ (c - a) * u.y * (1.0 - u.x) +
1285
+ (d - b) * u.x * u.y;
1286
+ }
1287
+
1288
+ float fbm(vec2 st) {
1289
+ float value = 0.0;
1290
+ float amplitude = 0.5;
1291
+ int octaves = int(u_octaves);
1292
+ for (int i = 0; i < 12; i++) {
1293
+ if (i >= octaves) break;
1294
+ value += amplitude * noise(st);
1295
+ st *= 2.0;
1296
+ amplitude *= 0.5;
1297
+ }
1298
+ return value;
1299
+ }
1300
+
1301
+ void main() {
1302
+ vec2 st = vUv * u_scale;
1303
+ st.x *= u_resolution.x / u_resolution.y;
1304
+
1305
+ // animate by scrolling noise space over time
1306
+ st += u_time * u_speed;
1307
+
1308
+ fragColor = vec4(vec3(fbm(st)), 1.0);
1309
+ }
1310
+ `,tN=`#version 300 es
1311
+ precision mediump float;
1312
+
1313
+ in vec2 vUv;
1314
+ out vec4 fragColor;
1315
+
1316
+ uniform sampler2D u_input;
1317
+ uniform vec2 u_resolution; // resolution
1318
+ uniform float u_dot_count; // [0, 100, 3]
1319
+ uniform float u_bias; // [-100, 100, 0]
1320
+ uniform float u_sensitivity; // [0, 100, 1]
1321
+ uniform float u_smoothing; // [0, 100, 1]
1322
+ uniform float u_rotation; // [0, 100, 0]
1323
+
1324
+ float lum(vec3 a) {
1325
+ return dot(a, vec3(0.299, 0.587, 0.114));
1326
+ }
1327
+
1328
+ float smin(float a, float b, float k) {
1329
+ float h = max(k - abs(a - b), 0.0) / k;
1330
+ return min(a, b) - h*h*h*k*(1.0/6.0);
1331
+ }
1332
+
1333
+ mat2 rotate2D(float angle) {
1334
+ float c = cos(angle);
1335
+ float s = sin(angle);
1336
+ return mat2(
1337
+ c, -s,
1338
+ s, c
1339
+ );
1340
+ }
1341
+
1342
+ void main() {
1343
+ vec2 uv = vUv;
1344
+
1345
+ uv = vec2(
1346
+ uv.x * u_resolution.x / u_resolution.y,
1347
+ uv.y
1348
+ );
1349
+
1350
+ vec2 rot_uv = rotate2D(u_rotation) * (uv - 0.5) + 0.5;
1351
+
1352
+ vec2 cell_uv = fract(rot_uv * u_dot_count);
1353
+
1354
+ vec2 source_uv = floor(rot_uv * u_dot_count) / u_dot_count;
1355
+ source_uv = transpose(rotate2D(u_rotation)) * (source_uv - 0.5) + 0.5;
1356
+
1357
+ float distance = length(
1358
+ cell_uv - vec2(0.5)
1359
+ );
1360
+
1361
+ vec4 cellColor = texture(
1362
+ u_input,
1363
+ (source_uv)
1364
+ );
1365
+ float distance_to_center = distance - lum(cellColor.rgb) / 2.0;
1366
+
1367
+ // right
1368
+
1369
+ vec2 source_right_uv = floor(
1370
+ (rot_uv + vec2(1./u_dot_count, 0.0)) * u_dot_count
1371
+ ) / u_dot_count;
1372
+ source_right_uv = transpose(rotate2D(u_rotation)) * (source_right_uv - 0.5) + 0.5;
1373
+
1374
+ float distance_right = length(
1375
+ cell_uv - vec2(1.5, 0.5)
1376
+ );
1377
+
1378
+ vec4 rightCellColor = texture(
1379
+ u_input,
1380
+ source_right_uv
1381
+ );
1382
+ float distance_to_right_center = distance_right - lum(rightCellColor.rgb) / 2.0;
1383
+
1384
+
1385
+ // left
1386
+
1387
+ vec2 source_left_uv = floor(
1388
+ (rot_uv - vec2(1./u_dot_count, 0.0)) * u_dot_count
1389
+ ) / u_dot_count;
1390
+ source_left_uv = transpose(rotate2D(u_rotation)) * (source_left_uv - 0.5) + 0.5;
1391
+
1392
+ float distance_left = length(
1393
+ cell_uv - vec2(-0.5, 0.5)
1394
+ );
1395
+
1396
+ vec4 leftCellColor = texture(
1397
+ u_input,
1398
+ source_left_uv
1399
+ );
1400
+ float distance_to_left_center = distance_left - lum(rightCellColor.rgb) / 2.0;
1401
+
1402
+
1403
+ // up
1404
+
1405
+ vec2 source_up_uv = floor(
1406
+ (rot_uv + vec2(0.0, 1./u_dot_count)) * u_dot_count
1407
+ ) / u_dot_count;
1408
+ source_up_uv = transpose(rotate2D(u_rotation)) * (source_up_uv - 0.5) + 0.5;
1409
+
1410
+ float distance_up = length(
1411
+ cell_uv - vec2(0.5, -0.5)
1412
+ );
1413
+
1414
+ vec4 upCellColor = texture(
1415
+ u_input,
1416
+ source_up_uv
1417
+ );
1418
+ float distance_to_up_center = distance_up - lum(rightCellColor.rgb) / 2.0;
1419
+
1420
+
1421
+
1422
+ // down
1423
+
1424
+ vec2 source_down_uv = floor(
1425
+ (rot_uv - vec2(0.0, 1./u_dot_count)) * u_dot_count
1426
+ ) / u_dot_count;
1427
+ source_down_uv = transpose(rotate2D(u_rotation)) * (source_down_uv - 0.5) + 0.5;
1428
+
1429
+ float distance_down = length(
1430
+ cell_uv - vec2(0.5, 1.5)
1431
+ );
1432
+
1433
+ vec4 downCellColor = texture(
1434
+ u_input,
1435
+ source_down_uv
1436
+ );
1437
+ float distance_to_down_center = distance_down - lum(rightCellColor.rgb) / 2.0;
1438
+
1439
+
1440
+ fragColor = vec4(vec3(
1441
+ step(
1442
+ 0.0,
1443
+ smin(
1444
+ smin(
1445
+ smin(
1446
+ smin(
1447
+ distance_to_center,
1448
+ distance_to_right_center,
1449
+ u_smoothing
1450
+ ),
1451
+ distance_to_left_center,
1452
+ u_smoothing
1453
+ ),
1454
+ distance_to_up_center,
1455
+ u_smoothing
1456
+ ),
1457
+ distance_to_down_center,
1458
+ u_smoothing
1459
+ ) / 2.0
1460
+ )
1461
+ ), 1.0);
1462
+
1463
+ }`,nN=`#version 300 es
1464
+ precision mediump float;
1465
+
1466
+ uniform sampler2D u_texture; // input
1467
+ uniform float u_in_black; // [0, 1, 0]
1468
+ uniform float u_in_white; // [0, 1, 1]
1469
+ uniform float u_gamma; // [0.1, 10, 1]
1470
+ uniform float u_out_black; // [0, 1, 0]
1471
+ uniform float u_out_white; // [0, 1, 1]
1472
+
1473
+ in vec2 vUv;
1474
+ out vec4 fragColor;
1475
+
1476
+ void main() {
1477
+ vec4 c = texture(u_texture, vUv);
1478
+
1479
+ // input remap
1480
+ vec3 rgb = clamp((c.rgb - u_in_black) / max(u_in_white - u_in_black, 0.0001), 0.0, 1.0);
1481
+
1482
+ // gamma
1483
+ rgb = pow(rgb, vec3(1.0 / u_gamma));
1484
+
1485
+ // output remap
1486
+ rgb = u_out_black + rgb * (u_out_white - u_out_black);
1487
+
1488
+ fragColor = vec4(rgb, c.a);
1489
+ }
1490
+ `,rN=`#version 300 es
1491
+ precision mediump float;
1492
+
1493
+ in vec2 vUv;
1494
+ out vec4 fragColor;
1495
+
1496
+ uniform sampler2D u_texture_1;
1497
+ uniform sampler2D u_texture_2;
1498
+ uniform sampler2D u_mask;
1499
+
1500
+ void main() {
1501
+ vec4 color1 = texture(u_texture_1, vUv);
1502
+ vec4 color2 = texture(u_texture_2, vUv);
1503
+ vec4 maskColor = texture(u_mask, vUv);
1504
+
1505
+ float brightness = (maskColor.r + maskColor.g + maskColor.b) / 3.0;
1506
+
1507
+ fragColor = mix(color1, color2, brightness);
1508
+ }
1509
+ `,oN=`#version 300 es
1510
+ precision mediump float;
1511
+
1512
+ uniform vec2 u_resolution; // resolution
1513
+ uniform vec2 u_mouse; // mouse
1514
+ uniform float u_size; // [0, 0.5, 0.15]
1515
+ uniform float u_brightness; // [0, 1, 1]
1516
+
1517
+ in vec2 vUv;
1518
+ out vec4 fragColor;
1519
+
1520
+ void main() {
1521
+ float aspect = u_resolution.x / u_resolution.y;
1522
+ vec2 uv = vec2(vUv.x * aspect, 1.0-vUv.y);
1523
+ vec2 mouse = vec2(u_mouse.x * aspect, u_mouse.y);
1524
+
1525
+ float dist = length(uv - mouse);
1526
+ float orb = clamp(1.0 - dist / u_size, 0.0, 1.0);
1527
+
1528
+ fragColor = vec4(vec3(orb * u_brightness), 1.0);
1529
+ }
1530
+ `,iN=`#version 300 es
1531
+ precision mediump float;
1532
+
1533
+
1534
+ in vec2 vUv;
1535
+ out vec4 fragColor;
1536
+
1537
+ uniform sampler2D u_input;
1538
+ uniform vec2 u_resolution; // resolution
1539
+ uniform float u_pixel_size; // [0.01, 1000, 5]
1540
+
1541
+ void main () {
1542
+ vec2 destination = vec2(
1543
+ floor(vUv.x / u_pixel_size * u_resolution.x),
1544
+ floor(vUv.y / u_pixel_size * u_resolution.y)
1545
+ ) * u_pixel_size / u_resolution;
1546
+ fragColor = vec4(
1547
+ vec3(
1548
+ texture(u_input, destination)
1549
+ ),
1550
+ 1.0
1551
+ );
1552
+ }`,sN=`#version 300 es
1553
+ precision mediump float;
1554
+
1555
+ uniform sampler2D u_texture; // input
1556
+ uniform float u_steps; // [2, 32, 4]
1557
+
1558
+ in vec2 vUv;
1559
+ out vec4 fragColor;
1560
+
1561
+ void main() {
1562
+ vec4 c = texture(u_texture, vUv);
1563
+ vec3 rgb = floor(c.rgb * u_steps + 0.5) / u_steps;
1564
+ fragColor = vec4(rgb, c.a);
1565
+ }
1566
+ `,aN=`#version 300 es
1567
+ precision mediump float;
1568
+
1569
+ uniform vec2 u_resolution; // resolution
1570
+ uniform vec2 u_center; // [0.5, 0.5]
1571
+ uniform vec2 u_size; // [0.1, 0.1]
1572
+ uniform float u_roundness; // [0, 0.5, 0.0]
1573
+ uniform float u_feather; // [0, 0.1, 0.005]
1574
+ uniform float u_invert; // [0, 1, 0]
1575
+
1576
+ in vec2 vUv;
1577
+ out vec4 fragColor;
1578
+
1579
+ float sdRoundRect(vec2 p, vec2 b, float r) {
1580
+ vec2 q = abs(p) - b + r;
1581
+ return length(max(q, 0.0)) + min(max(q.x, q.y), 0.0) - r;
1582
+ }
1583
+
1584
+ void main() {
1585
+ float aspect = u_resolution.x / u_resolution.y;
1586
+ vec2 uv = vec2((vUv.x - u_center.x) * aspect, vUv.y - u_center.y);
1587
+ vec2 halfSize = vec2(u_size.x * aspect, u_size.y);
1588
+
1589
+ float d = sdRoundRect(uv, halfSize, u_roundness);
1590
+
1591
+ float v = 1.0 - smoothstep(-u_feather, u_feather, d);
1592
+ v = mix(v, 1.0 - v, step(0.5, u_invert));
1593
+
1594
+ fragColor = vec4(vec3(v), 1.0);
1595
+ }
1596
+ `,lN=`#version 300 es
1597
+ precision mediump float;
1598
+
1599
+ uniform sampler2D u_texture; // input
1600
+ uniform vec2 u_resolution; // resolution
1601
+ uniform float u_amount; // [0, 3, 1]
1602
+
1603
+ in vec2 vUv;
1604
+ out vec4 fragColor;
1605
+
1606
+ void main() {
1607
+ vec2 px = 1.0 / u_resolution;
1608
+
1609
+ vec4 center = texture(u_texture, vUv);
1610
+ vec4 n = texture(u_texture, vUv + vec2( 0.0, px.y));
1611
+ vec4 s = texture(u_texture, vUv + vec2( 0.0, -px.y));
1612
+ vec4 e = texture(u_texture, vUv + vec2( px.x, 0.0));
1613
+ vec4 w = texture(u_texture, vUv + vec2(-px.x, 0.0));
1614
+
1615
+ // unsharp: output = center + amount * (center - blur)
1616
+ vec4 blur = (n + s + e + w) * 0.25;
1617
+ fragColor = clamp(center + u_amount * (center - blur), 0.0, 1.0);
1618
+ }
1619
+ `,cN=`#version 300 es
1620
+ precision highp float;
1621
+
1622
+ uniform float u_time; // time
1623
+ uniform vec2 u_resolution; // resolution
1624
+ uniform float u_speed; // [0, 100, 2]
1625
+ uniform float u_period; // [0, 100, 2]
1626
+ uniform float u_amplitude; // [0, 100, 2]
1627
+
1628
+ in vec2 vUv;
1629
+ out vec4 fragColor;
1630
+
1631
+ void main() {
1632
+ vec2 uv = vec2(vUv.x * 2.0 - 1.0, (1.0 - vUv.y) * 2.0 - 1.0);
1633
+ float aspect = u_resolution.x / u_resolution.y;
1634
+ uv.x *= aspect;
1635
+
1636
+ float brightness = sin(uv.x * u_period + u_time * u_speed) * u_amplitude;
1637
+ fragColor = vec4(vec3(brightness + 1.0) * 0.5, 1.0);
1638
+ }
1639
+ `,uN=`#version 300 es
1640
+ precision mediump float;
1641
+
1642
+ uniform sampler2D u_texture; // input
1643
+ uniform float u_threshold; // [0, 1, 0.5]
1644
+ uniform float u_feather; // [0, 0.5, 0.0]
1645
+ uniform float u_invert; // [0, 1, 0]
1646
+
1647
+ in vec2 vUv;
1648
+ out vec4 fragColor;
1649
+
1650
+ void main() {
1651
+ vec4 c = texture(u_texture, vUv);
1652
+ float lum = dot(c.rgb, vec3(0.299, 0.587, 0.114));
1653
+
1654
+ float v = smoothstep(u_threshold - u_feather, u_threshold + u_feather, lum);
1655
+ v = mix(v, 1.0 - v, step(0.5, u_invert));
1656
+
1657
+ fragColor = vec4(vec3(v), c.a);
1658
+ }
1659
+ `,fN=`#version 300 es
1660
+ precision mediump float;
1661
+
1662
+ in vec2 vUv;
1663
+ out vec4 fragColor;
1664
+
1665
+ uniform sampler2D u_input_tex;
1666
+ uniform vec2 u_tile; // [2, 2]
1667
+ uniform vec2 u_resolution; // resolution
1668
+ uniform float u_tile_scale; // [0.01, 100, 2]
1669
+
1670
+ void main() {
1671
+ vec2 tile_uv = fract(vUv * vec2(u_tile.x, u_tile.y));
1672
+ vec2 tile_aspect = vec2(u_tile.x / u_tile.y, 1.0);
1673
+
1674
+ vec2 centered = tile_uv - 0.5;
1675
+ centered /= u_tile_scale;
1676
+ vec2 texture_space = centered / tile_aspect + 0.5;
1677
+
1678
+ if (
1679
+ any(lessThan(texture_space, vec2(0.0))) ||
1680
+ any(greaterThan(texture_space, vec2(1.0)))
1681
+ ) {
1682
+ fragColor = vec4(vec3(0.0), 1.0);
1683
+ return;
1684
+ }
1685
+
1686
+ fragColor = texture(
1687
+ u_input_tex,
1688
+ texture_space
1689
+ );
1690
+ }`,dN=`#version 300 es
1691
+ precision mediump float;
1692
+
1693
+ in vec2 vUv;
1694
+ out vec4 fragColor;
1695
+
1696
+ uniform float u_time; // time
1697
+ uniform vec2 u_resolution; // resolution
1698
+ uniform float u_speed; // [0, 100, 2]
1699
+ uniform float u_period; // [0, 100, 2]
1700
+ uniform float u_amplitude; // [0, 1, 1]
1701
+
1702
+
1703
+ void main() {
1704
+ float aspect = u_resolution.x / u_resolution.y;
1705
+ float current_x = vUv.x * aspect + u_time * u_speed;
1706
+ float value = abs(mod(current_x * u_period, 2.0) - 1.0);
1707
+ value -= 0.5;
1708
+ value *= u_amplitude;
1709
+ value += 0.5;
1710
+
1711
+ fragColor = vec4(
1712
+ vec3(
1713
+ value
1714
+ ),
1715
+ 1.0
1716
+ );
1717
+ }`,hN=`#version 300 es
1718
+ precision mediump float;
1719
+
1720
+ uniform sampler2D u_texture; // input
1721
+ uniform float u_strength; // [0, 1, 0.5]
1722
+ uniform float u_radius; // [0, 2, 0.75]
1723
+ uniform float u_softness; // [0, 1, 0.45]
1724
+ uniform vec2 u_speed; // mouse
1725
+
1726
+ in vec2 vUv;
1727
+ out vec4 fragColor;
1728
+
1729
+ void main() {
1730
+ vec4 c = texture(u_texture, vUv);
1731
+
1732
+ float dist = length(vUv - 0.5) * 2.0;
1733
+ float vig = smoothstep(u_radius, u_radius - u_softness, dist);
1734
+ vig = mix(1.0, vig, u_strength);
1735
+
1736
+ fragColor = vec4(c.rgb * vig, c.a);
1737
+ }
1738
+ `,mN={"image viewer":z3,noise:V3,fbm:eN,sin:cN,cube:K3,"mouse orb":oN,daffodil:R3,ellipse:W3,rect:aN,triangle:dN,"hue/saturation/value":D3,"color adjust":U3,"brightness/contrast":X3,levels:nN,threshold:uN,posterize:sN,"gradient map":O3,"chromatic aberration":$3,"blur (radial)":P3,"blur (linear)":j3,sharpen:lN,edge_detect:Q3,emboss:J3,dispersion:G3,vignette:hN,dots:N3,halftone:tN,diamonds:M3,lines:B3,ascii:Y3,dither:A3,pixellate:iN,"pixellate (dynamic)":Z3,"mix (add)":L3,"mix (subtract)":k3,"mix (multiply)":H3,"mix (linear)":I3,"mix (divide)":F3,mask:rN,"transform 3D":q3,tile:fN,key:T3};let i0=Float32Array;function s0(e,t,r){const i=new i0(3);return e&&(i[0]=e),t&&(i[1]=t),r&&(i[2]=r),i}function pN(e,t,r){return r=r||new i0(3),r[0]=e[0]+t[0],r[1]=e[1]+t[1],r[2]=e[2]+t[2],r}function gN(e,t,r){return r=r||new i0(3),r[0]=e[0]*t[0],r[1]=e[1]*t[1],r[2]=e[2]*t[2],r}let JE=Float32Array;function yN(e){return e=e||new JE(16),e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function vN(e,t){t=t||new JE(16);const r=e[0],i=e[1],a=e[2],l=e[3],u=e[4],f=e[5],h=e[6],d=e[7],p=e[8],g=e[9],v=e[10],x=e[11],b=e[12],_=e[13],C=e[14],E=e[15],N=v*E,w=C*x,A=h*E,M=C*d,T=h*x,O=v*d,I=a*E,j=C*l,Z=a*x,P=v*l,q=a*d,G=h*l,k=p*_,F=b*g,z=u*_,L=b*f,H=u*g,X=p*f,Q=r*_,U=b*i,V=r*g,ee=p*i,J=r*f,fe=u*i,ye=N*f+M*g+T*_-(w*f+A*g+O*_),he=w*i+I*g+P*_-(N*i+j*g+Z*_),ae=A*i+j*f+q*_-(M*i+I*f+G*_),be=O*i+Z*f+G*g-(T*i+P*f+q*g),ve=1/(r*ye+u*he+p*ae+b*be);return t[0]=ve*ye,t[1]=ve*he,t[2]=ve*ae,t[3]=ve*be,t[4]=ve*(w*u+A*p+O*b-(N*u+M*p+T*b)),t[5]=ve*(N*r+j*p+Z*b-(w*r+I*p+P*b)),t[6]=ve*(M*r+I*u+G*b-(A*r+j*u+q*b)),t[7]=ve*(T*r+P*u+q*p-(O*r+Z*u+G*p)),t[8]=ve*(k*d+L*x+H*E-(F*d+z*x+X*E)),t[9]=ve*(F*l+Q*x+ee*E-(k*l+U*x+V*E)),t[10]=ve*(z*l+U*d+J*E-(L*l+Q*d+fe*E)),t[11]=ve*(X*l+V*d+fe*x-(H*l+ee*d+J*x)),t[12]=ve*(z*v+X*C+F*h-(H*C+k*h+L*v)),t[13]=ve*(V*C+k*a+U*v-(Q*v+ee*C+F*a)),t[14]=ve*(Q*h+fe*C+L*a-(J*C+z*a+U*h)),t[15]=ve*(J*v+H*a+ee*h-(V*h+fe*v+X*a)),t}function xN(e,t,r){r=r||s0();const i=t[0],a=t[1],l=t[2],u=i*e[3]+a*e[7]+l*e[11]+e[15];return r[0]=(i*e[0]+a*e[4]+l*e[8]+e[12])/u,r[1]=(i*e[1]+a*e[5]+l*e[9]+e[13])/u,r[2]=(i*e[2]+a*e[6]+l*e[10]+e[14])/u,r}function bN(e,t,r){r=r||s0();const i=t[0],a=t[1],l=t[2];return r[0]=i*e[0]+a*e[4]+l*e[8],r[1]=i*e[1]+a*e[5]+l*e[9],r[2]=i*e[2]+a*e[6]+l*e[10],r}const a0=5120,pl=5121,l0=5122,c0=5123,u0=5124,f0=5125,d0=5126,_N=32819,EN=32820,SN=33635,wN=5131,CN=33640,TN=35899,RN=35902,AN=36269,NN=34042,eS={};{const e=eS;e[a0]=Int8Array,e[pl]=Uint8Array,e[l0]=Int16Array,e[c0]=Uint16Array,e[u0]=Int32Array,e[f0]=Uint32Array,e[d0]=Float32Array,e[_N]=Uint16Array,e[EN]=Uint16Array,e[SN]=Uint16Array,e[wN]=Uint16Array,e[CN]=Uint32Array,e[TN]=Uint32Array,e[RN]=Uint32Array,e[AN]=Uint32Array,e[NN]=Uint32Array}function Bf(e){if(e instanceof Int8Array)return a0;if(e instanceof Uint8Array||e instanceof Uint8ClampedArray)return pl;if(e instanceof Int16Array)return l0;if(e instanceof Uint16Array)return c0;if(e instanceof Int32Array)return u0;if(e instanceof Uint32Array)return f0;if(e instanceof Float32Array)return d0;throw new Error("unsupported typed array type")}function tS(e){if(e===Int8Array)return a0;if(e===Uint8Array||e===Uint8ClampedArray)return pl;if(e===Int16Array)return l0;if(e===Uint16Array)return c0;if(e===Int32Array)return u0;if(e===Uint32Array)return f0;if(e===Float32Array)return d0;throw new Error("unsupported typed array type")}function nS(e){const t=eS[e];if(!t)throw new Error("unknown gl type");return t}const gl=typeof SharedArrayBuffer<"u"?function(t){return t&&t.buffer&&(t.buffer instanceof ArrayBuffer||t.buffer instanceof SharedArrayBuffer)}:function(t){return t&&t.buffer&&t.buffer instanceof ArrayBuffer};function MN(e,t,r){e.forEach(function(i){const a=t[i];a!==void 0&&(r[i]=a)})}function rS(...e){console.error(...e)}const Eb=new Map;function Uf(e,t){if(!e||typeof e!="object")return!1;let r=Eb.get(t);r||(r=new WeakMap,Eb.set(t,r));let i=r.get(e);if(i===void 0){const a=Object.prototype.toString.call(e);i=a.substring(8,a.length-1)===t,r.set(e,i)}return i}function ON(e,t){return typeof WebGLBuffer<"u"&&Uf(t,"WebGLBuffer")}function DN(e,t){return typeof WebGLRenderbuffer<"u"&&Uf(t,"WebGLRenderbuffer")}function h0(e,t){return typeof WebGLTexture<"u"&&Uf(t,"WebGLTexture")}function zN(e,t){return typeof WebGLSampler<"u"&&Uf(t,"WebGLSampler")}const oS=35044,Vo=34962,iS=34963,BN=34660,UN=5120,LN=5121,kN=5122,IN=5123,HN=5124,FN=5125,sS=5126,aS={attribPrefix:""};function PN(e,t,r,i,a){e.bindBuffer(t,r),e.bufferData(t,i,a||oS)}function m0(e,t,r,i){if(ON(e,t))return t;r=r||Vo;const a=e.createBuffer();return PN(e,r,a,t,i),a}function lS(e){return e==="indices"}function jN(e){return e===Int8Array||e===Uint8Array}function p0(e){return e.length?e:e.data}const VN=/coord|texture/i,GN=/color|colour/i;function qN(e,t){let r;if(VN.test(e)?r=2:GN.test(e)?r=4:r=3,t%r>0)throw new Error(`Can not guess numComponents for attribute '${e}'. Tried ${r} but ${t} values is not evenly divisible by ${r}. You should specify it.`);return r}function g0(e,t,r){return e.numComponents||e.size||qN(t,r||p0(e).length)}function Lf(e,t){if(gl(e))return e;if(gl(e.data))return e.data;Array.isArray(e)&&(e={data:e});let r=e.type?y0(e.type):void 0;return r||(lS(t)?r=Uint16Array:r=Float32Array),new r(e.data)}function YN(e){return typeof e=="number"?e:e?tS(e):sS}function y0(e){return typeof e=="number"?nS(e):e||Float32Array}function XN(e,t){return{buffer:t.buffer,numValues:24,type:YN(t.type),arrayType:y0(t.type)}}function $N(e,t){const r=t.data||t,i=y0(t.type),a=r*i.BYTES_PER_ELEMENT,l=e.createBuffer();return e.bindBuffer(Vo,l),e.bufferData(Vo,a,t.drawType||oS),{buffer:l,numValues:r,type:tS(i),arrayType:i}}function KN(e,t,r){const i=Lf(t,r);return{arrayType:i.constructor,buffer:m0(e,i,void 0,t.drawType),type:Bf(i),numValues:0}}function ZN(e,t){const r={};return Object.keys(t).forEach(function(i){if(!lS(i)){const a=t[i],l=a.attrib||a.name||a.attribName||aS.attribPrefix+i;if(a.value){if(!Array.isArray(a.value)&&!gl(a.value))throw new Error("array.value is not array or typedarray");r[l]={value:a.value}}else{let u;a.buffer&&a.buffer instanceof WebGLBuffer?u=XN:typeof a=="number"||typeof a.data=="number"?u=$N:u=KN;const{buffer:f,type:h,numValues:d,arrayType:p}=u(e,a,i),g=a.normalize!==void 0?a.normalize:jN(p),v=g0(a,i,d);r[l]={buffer:f,numComponents:v,type:h,normalize:g,stride:a.stride||0,offset:a.offset||0,divisor:a.divisor===void 0?void 0:a.divisor,drawType:a.drawType}}}}),e.bindBuffer(Vo,null),r}function QN(e,t){return t===UN||t===LN?1:t===kN||t===IN?2:t===HN||t===FN||t===sS?4:0}const ks=["position","positions","a_position"];function WN(e){let t,r;for(r=0;r<ks.length&&(t=ks[r],!(t in e));++r);r===ks.length&&(t=Object.keys(e)[0]);const i=e[t],a=p0(i).length;if(a===void 0)return 1;const l=g0(i,t),u=a/l;if(a%l>0)throw new Error(`numComponents ${l} not correct for length ${a}`);return u}function JN(e,t){let r,i;for(i=0;i<ks.length&&(r=ks[i],!(r in t||(r=aS.attribPrefix+r,r in t)));++i);i===ks.length&&(r=Object.keys(t)[0]);const a=t[r];if(!a.buffer)return 1;e.bindBuffer(Vo,a.buffer);const l=e.getBufferParameter(Vo,BN);e.bindBuffer(Vo,null);const u=QN(e,a.type),f=l/u,h=a.numComponents||a.size,d=f/h;if(d%1!==0)throw new Error(`numComponents ${h} not correct for length ${length}`);return d}function eM(e,t,r){const i=ZN(e,t),a=Object.assign({},r||{});a.attribs=Object.assign({},r?r.attribs:{},i);const l=t.indices;if(l){const u=Lf(l,"indices");a.indices=m0(e,u,iS),a.numElements=u.length,a.elementType=Bf(u)}else a.numElements||(a.numElements=JN(e,a.attribs));return a}function tM(e,t,r){const i=r==="indices"?iS:Vo,a=Lf(t,r);return m0(e,a,i)}function nM(e,t){const r={};return Object.keys(t).forEach(function(i){r[i]=tM(e,t[i],i)}),t.indices?(r.numElements=t.indices.length,r.elementType=Bf(Lf(t.indices))):r.numElements=WN(t),r}const Ni=p0,rM=g0;function cS(e,t){let r=0;return e.push=function(){for(let i=0;i<arguments.length;++i){const a=arguments[i];if(a instanceof Array||gl(a))for(let l=0;l<a.length;++l)e[r++]=a[l];else e[r++]=a}},e.reset=function(i){r=i||0},e.numComponents=t,Object.defineProperty(e,"numElements",{get:function(){return this.length/this.numComponents|0}}),e}function Ye(e,t,r){const i=r||Float32Array;return cS(new i(e*t),e)}function oM(e){return e!=="indices"}function iM(e){const t=e.indices,r={},i=t.length;function a(l){const u=e[l],f=u.numComponents,h=Ye(f,i,u.constructor);for(let d=0;d<i;++d){const g=t[d]*f;for(let v=0;v<f;++v)h.push(u[g+v])}r[l]=h}return Object.keys(e).filter(oM).forEach(a),r}function sM(e){if(e.indices)throw new Error("can not flatten normals of indexed vertices. deindex them first");const t=e.normal,r=t.length;for(let i=0;i<r;i+=9){const a=t[i+0],l=t[i+1],u=t[i+2],f=t[i+3],h=t[i+4],d=t[i+5],p=t[i+6],g=t[i+7],v=t[i+8];let x=a+f+p,b=l+h+g,_=u+d+v;const C=Math.sqrt(x*x+b*b+_*_);x/=C,b/=C,_/=C,t[i+0]=x,t[i+1]=b,t[i+2]=_,t[i+3]=x,t[i+4]=b,t[i+5]=_,t[i+6]=x,t[i+7]=b,t[i+8]=_}return e}function v0(e,t,r){const i=e.length,a=new Float32Array(3);for(let l=0;l<i;l+=3)r(t,[e[l],e[l+1],e[l+2]],a),e[l]=a[0],e[l+1]=a[1],e[l+2]=a[2]}function aM(e,t,r){r=r||s0();const i=t[0],a=t[1],l=t[2];return r[0]=i*e[0]+a*e[1]+l*e[2],r[1]=i*e[4]+a*e[5]+l*e[6],r[2]=i*e[8]+a*e[9]+l*e[10],r}function uS(e,t){return v0(e,t,bN),e}function fS(e,t){return v0(e,vN(t),aM),e}function dS(e,t){return v0(e,t,xN),e}function hS(e,t){return Object.keys(e).forEach(function(r){const i=e[r];r.indexOf("pos")>=0?dS(i,t):r.indexOf("tan")>=0||r.indexOf("binorm")>=0?uS(i,t):r.indexOf("norm")>=0&&fS(i,t)}),e}function x0(e,t,r){return e=e||2,t=t||0,r=r||0,e*=.5,{position:{numComponents:2,data:[t+-1*e,r+-1*e,t+1*e,r+-1*e,t+-1*e,r+1*e,t+1*e,r+1*e]},normal:[0,0,1,0,0,1,0,0,1,0,0,1],texcoord:[0,0,1,0,0,1,1,1],indices:[0,1,2,2,1,3]}}function b0(e,t,r,i,a){e=e||1,t=t||1,r=r||1,i=i||1,a=a||yN();const l=(r+1)*(i+1),u=Ye(3,l),f=Ye(3,l),h=Ye(2,l);for(let v=0;v<=i;v++)for(let x=0;x<=r;x++){const b=x/r,_=v/i;u.push(e*b-e*.5,0,t*_-t*.5),f.push(0,1,0),h.push(b,_)}const d=r+1,p=Ye(3,r*i*2,Uint16Array);for(let v=0;v<i;v++)for(let x=0;x<r;x++)p.push((v+0)*d+x,(v+1)*d+x,(v+0)*d+x+1),p.push((v+1)*d+x,(v+1)*d+x+1,(v+0)*d+x+1);return hS({position:u,normal:f,texcoord:h,indices:p},a)}function _0(e,t,r,i,a,l,u){if(t<=0||r<=0)throw new Error("subdivisionAxis and subdivisionHeight must be > 0");i=i||0,a=a||Math.PI,l=l||0,u=u||Math.PI*2;const f=a-i,h=u-l,d=(t+1)*(r+1),p=Ye(3,d),g=Ye(3,d),v=Ye(2,d);for(let _=0;_<=r;_++)for(let C=0;C<=t;C++){const E=C/t,N=_/r,w=h*E+l,A=f*N+i,M=Math.sin(w),T=Math.cos(w),O=Math.sin(A),I=Math.cos(A),j=T*O,Z=I,P=M*O;p.push(e*j,e*Z,e*P),g.push(j,Z,P),v.push(1-E,N)}const x=t+1,b=Ye(3,t*r*2,Uint16Array);for(let _=0;_<t;_++)for(let C=0;C<r;C++)b.push((C+0)*x+_,(C+0)*x+_+1,(C+1)*x+_),b.push((C+1)*x+_,(C+0)*x+_+1,(C+1)*x+_+1);return{position:p,normal:g,texcoord:v,indices:b}}const lM=[[3,7,5,1],[6,2,0,4],[6,7,3,2],[0,1,5,4],[7,6,4,5],[2,3,1,0]];function E0(e){e=e||1;const t=e/2,r=[[-t,-t,-t],[+t,-t,-t],[-t,+t,-t],[+t,+t,-t],[-t,-t,+t],[+t,-t,+t],[-t,+t,+t],[+t,+t,+t]],i=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],a=[[1,0],[0,0],[0,1],[1,1]],l=24,u=Ye(3,l),f=Ye(3,l),h=Ye(2,l),d=Ye(3,12,Uint16Array);for(let p=0;p<6;++p){const g=lM[p];for(let x=0;x<4;++x){const b=r[g[x]],_=i[p],C=a[x];u.push(b),f.push(_),h.push(C)}const v=4*p;d.push(v+0,v+1,v+2),d.push(v+0,v+2,v+3)}return{position:u,normal:f,texcoord:h,indices:d}}function kf(e,t,r,i,a,l,u){if(i<3)throw new Error("radialSubdivisions must be 3 or greater");if(a<1)throw new Error("verticalSubdivisions must be 1 or greater");const f=l===void 0?!0:l,h=u===void 0?!0:u,d=(f?2:0)+(h?2:0),p=(i+1)*(a+1+d),g=Ye(3,p),v=Ye(3,p),x=Ye(2,p),b=Ye(3,i*(a+d/2)*2,Uint16Array),_=i+1,C=Math.atan2(e-t,r),E=Math.cos(C),N=Math.sin(C),w=f?-2:0,A=a+(h?2:0);for(let M=w;M<=A;++M){let T=M/a,O=r*T,I;M<0?(O=0,T=1,I=e):M>a?(O=r,T=1,I=t):I=e+(t-e)*(M/a),(M===-2||M===a+2)&&(I=0,T=0),O-=r/2;for(let j=0;j<_;++j){const Z=Math.sin(j*Math.PI*2/i),P=Math.cos(j*Math.PI*2/i);g.push(Z*I,O,P*I),M<0?v.push(0,-1,0):M>a?v.push(0,1,0):I===0?v.push(0,0,0):v.push(Z*E,N,P*E),x.push(j/i,1-T)}}for(let M=0;M<a+d;++M)if(!(M===1&&f||M===a+d-2&&h))for(let T=0;T<i;++T)b.push(_*(M+0)+0+T,_*(M+0)+1+T,_*(M+1)+1+T),b.push(_*(M+0)+0+T,_*(M+1)+1+T,_*(M+1)+0+T);return{position:g,normal:v,texcoord:x,indices:b}}function Sb(e,t){t=t||[];const r=[];for(let i=0;i<e.length;i+=4){const a=e[i],l=e.slice(i+1,i+4);l.push.apply(l,t);for(let u=0;u<a;++u)r.push.apply(r,l)}return r}function S0(){const e=[0,0,0,0,150,0,30,0,0,0,150,0,30,150,0,30,0,0,30,0,0,30,30,0,100,0,0,30,30,0,100,30,0,100,0,0,30,60,0,30,90,0,67,60,0,30,90,0,67,90,0,67,60,0,0,0,30,30,0,30,0,150,30,0,150,30,30,0,30,30,150,30,30,0,30,100,0,30,30,30,30,30,30,30,100,0,30,100,30,30,30,60,30,67,60,30,30,90,30,30,90,30,67,60,30,67,90,30,0,0,0,100,0,0,100,0,30,0,0,0,100,0,30,0,0,30,100,0,0,100,30,0,100,30,30,100,0,0,100,30,30,100,0,30,30,30,0,30,30,30,100,30,30,30,30,0,100,30,30,100,30,0,30,30,0,30,60,30,30,30,30,30,30,0,30,60,0,30,60,30,30,60,0,67,60,30,30,60,30,30,60,0,67,60,0,67,60,30,67,60,0,67,90,30,67,60,30,67,60,0,67,90,0,67,90,30,30,90,0,30,90,30,67,90,30,30,90,0,67,90,30,67,90,0,30,90,0,30,150,30,30,90,30,30,90,0,30,150,0,30,150,30,0,150,0,0,150,30,30,150,30,0,150,0,30,150,30,30,150,0,0,0,0,0,0,30,0,150,30,0,0,0,0,150,30,0,150,0],t=[.22,.19,.22,.79,.34,.19,.22,.79,.34,.79,.34,.19,.34,.19,.34,.31,.62,.19,.34,.31,.62,.31,.62,.19,.34,.43,.34,.55,.49,.43,.34,.55,.49,.55,.49,.43,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,1,1,0],r=Sb([18,0,0,1,18,0,0,-1,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,-1,0,6,-1,0,0]),i=Sb([18,200,70,120,18,80,70,200,6,70,200,210,6,200,200,70,6,210,100,70,6,210,160,70,6,70,180,210,6,100,70,210,6,76,210,100,6,140,210,80,6,90,130,110,6,160,160,220],[255]),a=e.length/3,l={position:Ye(3,a),texcoord:Ye(2,a),normal:Ye(3,a),color:Ye(4,a,Uint8Array),indices:Ye(3,a/3,Uint16Array)};l.position.push(e),l.texcoord.push(t),l.normal.push(r),l.color.push(i);for(let u=0;u<a;++u)l.indices.push(u);return l}function If(e,t,r,i,a,l,u){if(a<=0)throw new Error("subdivisionDown must be > 0");l=l||0,u=u||1;const f=2,h=u-l,d=(a+1)*2*(2+f),p=Ye(3,d),g=Ye(3,d),v=Ye(2,d);function x(N,w,A){return N+(w-N)*A}function b(N,w,A,M,T,O){for(let I=0;I<=a;I++){const j=w/(f-1),Z=I/a,P=(j-.5)*2,q=(l+Z*h)*Math.PI,G=Math.sin(q),k=Math.cos(q),F=x(e,N,G),z=P*i,L=k*e,H=G*F;p.push(z,L,H);const X=pN(gN([0,G,k],A),M);g.push(X),v.push(j*T+O,Z)}}for(let N=0;N<f;N++){const w=(N/(f-1)-.5)*2;b(t,N,[1,1,1],[0,0,0],1,0),b(t,N,[0,0,0],[w,0,0],0,0),b(r,N,[1,1,1],[0,0,0],1,0),b(r,N,[0,0,0],[w,0,0],0,1)}const _=Ye(3,a*2*(2+f),Uint16Array);function C(N,w){for(let A=0;A<a;++A)_.push(N+A+0,N+A+1,w+A+0),_.push(N+A+1,w+A+1,w+A+0)}const E=a+1;return C(E*0,E*4),C(E*5,E*7),C(E*6,E*2),C(E*3,E*1),{position:p,normal:g,texcoord:v,indices:_}}function w0(e,t,r,i,a,l){return kf(e,e,t,r,i,a,l)}function C0(e,t,r,i,a,l){if(r<3)throw new Error("radialSubdivisions must be 3 or greater");if(i<3)throw new Error("verticalSubdivisions must be 3 or greater");a=a||0,l=l||Math.PI*2;const u=l-a,f=r+1,h=i+1,d=f*h,p=Ye(3,d),g=Ye(3,d),v=Ye(2,d),x=Ye(3,r*i*2,Uint16Array);for(let b=0;b<h;++b){const _=b/i,C=_*Math.PI*2,E=Math.sin(C),N=e+E*t,w=Math.cos(C),A=w*t;for(let M=0;M<f;++M){const T=M/r,O=a+T*u,I=Math.sin(O),j=Math.cos(O),Z=I*N,P=j*N,q=I*E,G=j*E;p.push(Z,A,P),g.push(q,w,G),v.push(T,1-_)}}for(let b=0;b<i;++b)for(let _=0;_<r;++_){const C=1+_,E=1+b;x.push(f*b+_,f*E+_,f*b+C),x.push(f*E+_,f*E+C,f*b+C)}return{position:p,normal:g,texcoord:v,indices:x}}function T0(e,t,r,i,a){if(t<3)throw new Error("divisions must be at least 3");r=r||1,a=a||1,i=i||0;const l=(t+1)*(r+1),u=Ye(3,l),f=Ye(3,l),h=Ye(2,l),d=Ye(3,r*t*2,Uint16Array);let p=0;const g=e-i,v=t+1;for(let x=0;x<=r;++x){const b=i+g*Math.pow(x/r,a);for(let _=0;_<=t;++_){const C=2*Math.PI*_/t,E=b*Math.cos(C),N=b*Math.sin(C);if(u.push(E,0,N),f.push(0,1,0),h.push(1-_/t,x/r),x>0&&_!==t){const w=p+(_+1),A=p+_,M=p+_-v,T=p+(_+1)-v;d.push(w,A,M),d.push(w,M,T)}}p+=t+1}return{position:u,normal:f,texcoord:h,indices:d}}function cM(e){return Math.random()*e|0}function uM(e,t){t=t||{};const r=e.position.numElements,i=Ye(4,r,Uint8Array),a=t.rand||function(l,u){return u<3?cM(256):255};if(e.color=i,e.indices)for(let l=0;l<r;++l)i.push(a(l,0),a(l,1),a(l,2),a(l,3));else{const l=t.vertsPerColor||3,u=r/l;for(let f=0;f<u;++f){const h=[a(f,0),a(f,1),a(f,2),a(f,3)];for(let d=0;d<l;++d)i.push(h)}}return e}function Cr(e){return function(t){const r=e.apply(this,Array.prototype.slice.call(arguments,1));return nM(t,r)}}function Tr(e){return function(t){const r=e.apply(null,Array.prototype.slice.call(arguments,1));return eM(t,r)}}const fM=["numComponents","size","type","normalize","stride","offset","attrib","name","attribName"];function yp(e,t,r,i){i=i||0;const a=e.length;for(let l=0;l<a;++l)t[r+l]=e[l]+i}function mS(e,t){const r=Ni(e),i=new r.constructor(t);let a=i;return r.numComponents&&r.numElements&&cS(i,r.numComponents),e.data&&(a={data:i},MN(fM,e,a)),a}function dM(e){const t={};let r;for(let f=0;f<e.length;++f){const h=e[f];Object.keys(h).forEach(function(d){t[d]||(t[d]=[]),!r&&d!=="indices"&&(r=d);const p=h[d],g=rM(p,d),x=Ni(p).length/g;t[d].push(x)})}function i(f){let h=0,d;for(let p=0;p<e.length;++p){const v=e[p][f],x=Ni(v);h+=x.length,(!d||v.data)&&(d=v)}return{length:h,spec:d}}function a(f,h,d){let p=0,g=0;for(let v=0;v<e.length;++v){const b=e[v][f],_=Ni(b);f==="indices"?(yp(_,d,g,p),p+=h[v]):yp(_,d,g),g+=_.length}}const l=t[r],u={};return Object.keys(t).forEach(function(f){const h=i(f),d=mS(h.spec,h.length);a(f,l,Ni(d)),u[f]=d}),u}function hM(e){const t={};return Object.keys(e).forEach(function(r){const i=e[r],a=Ni(i),l=mS(i,a.length);yp(a,Ni(l),0),t[r]=l}),t}const mM=Tr(S0),pM=Cr(S0),gM=Tr(E0),yM=Cr(E0),vM=Tr(b0),xM=Cr(b0),bM=Tr(_0),_M=Cr(_0),EM=Tr(kf),SM=Cr(kf),wM=Tr(x0),CM=Cr(x0),pS=Tr(If),gS=Cr(If),TM=Tr(w0),RM=Cr(w0),AM=Tr(C0),NM=Cr(C0),MM=Tr(T0),OM=Cr(T0),DM=pS,zM=gS,BM=If;var UM=Object.freeze({__proto__:null,create3DFBufferInfo:mM,create3DFBuffers:pM,create3DFVertices:S0,createAugmentedTypedArray:Ye,createCubeBufferInfo:gM,createCubeBuffers:yM,createCubeVertices:E0,createPlaneBufferInfo:vM,createPlaneBuffers:xM,createPlaneVertices:b0,createSphereBufferInfo:bM,createSphereBuffers:_M,createSphereVertices:_0,createTruncatedConeBufferInfo:EM,createTruncatedConeBuffers:SM,createTruncatedConeVertices:kf,createXYQuadBufferInfo:wM,createXYQuadBuffers:CM,createXYQuadVertices:x0,createCresentBufferInfo:DM,createCresentBuffers:zM,createCresentVertices:BM,createCrescentBufferInfo:pS,createCrescentBuffers:gS,createCrescentVertices:If,createCylinderBufferInfo:TM,createCylinderBuffers:RM,createCylinderVertices:w0,createTorusBufferInfo:AM,createTorusBuffers:NM,createTorusVertices:C0,createDiscBufferInfo:MM,createDiscBuffers:OM,createDiscVertices:T0,deindexVertices:iM,flattenNormals:sM,makeRandomVertexColors:uM,reorientDirections:uS,reorientNormals:fS,reorientPositions:dS,reorientVertices:hS,concatVertices:dM,duplicateVertices:hM});function Ul(e){return!!e.texStorage2D}const yS=(function(){const e={},t={};function r(i){const a=i.constructor.name;if(!e[a]){for(const l in i)if(typeof i[l]=="number"){const u=t[i[l]];t[i[l]]=u?`${u} | ${l}`:l}e[a]=!0}}return function(a,l){return r(a),t[l]||(typeof l=="number"?`0x${l.toString(16)}`:l)}})(),Wa=void 0,$o={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},yl=gl,vS=(function(){let e;return function(){return e=e||(typeof document<"u"&&document.createElement?document.createElement("canvas").getContext("2d"):null),e}})(),wb=6406,hr=6407,St=6408,Cb=6409,Tb=6410,Ja=6402,Rb=34041,Ju=33071,Om=9728,Dm=9729,LM=9986,eo=3553,to=34067,Pi=32879,Bi=35866,R0=34069,kM=34070,IM=34071,HM=34072,FM=34073,PM=34074,ef=10241,tf=10240,nf=10242,rf=10243,Ab=32882,jM=33082,VM=33083,GM=33084,qM=33085,YM=34892,XM=34893,A0=3317,xS=3314,bS=32878,_S=3316,ES=3315,SS=32877,Pu=37443,ju=37441,Vu=37440,$M=33321,KM=36756,ZM=33325,QM=33326,WM=33330,JM=33329,eO=33338,tO=33337,nO=33340,rO=33339,oO=33323,iO=36757,sO=33327,aO=33328,lO=33336,cO=33335,uO=33332,fO=33331,dO=33334,hO=33333,mO=32849,pO=35905,gO=36194,yO=36758,vO=35898,xO=35901,bO=34843,_O=34837,EO=36221,SO=36239,wO=36215,CO=36233,TO=36209,RO=36227,AO=32856,NO=35907,MO=36759,OO=32855,DO=32854,zO=32857,BO=34842,UO=34836,LO=36220,kO=36238,IO=36975,HO=36214,FO=36232,PO=36226,jO=36208,VO=33189,GO=33190,qO=36012,YO=36013,XO=35056,Lo=5120,gt=5121,pu=5122,Ms=5123,gu=5124,Ci=5125,tn=5126,Nb=32819,Mb=32820,Ob=33635,Qn=5131,el=36193,zm=33640,$O=35899,KO=35902,ZO=36269,QO=34042,yu=33319,Os=33320,vu=6403,Ds=36244,zs=36248,Ti=36249,Db=33776,zb=33777,Bb=33778,Ub=33779,Lb=35916,kb=35917,Ib=35918,Hb=35919,Fb=36196,Pb=37488,jb=37489,Vb=37490,Gb=37491,qb=37492,Yb=37493,Xb=37494,$b=37495,Kb=37496,Zb=37497,Qb=35840,Wb=35841,Jb=35842,e1=35843,t1=37808,n1=37809,r1=37810,o1=37811,i1=37812,s1=37813,a1=37814,l1=37815,c1=37816,u1=37817,f1=37818,d1=37819,h1=37820,m1=37821,p1=37840,g1=37841,y1=37842,v1=37843,x1=37844,b1=37845,_1=37846,E1=37847,S1=37848,w1=37849,C1=37850,T1=37851,R1=37852,A1=37853,N1=36492,M1=36493,O1=36494,D1=36495,z1=36283,B1=36284,U1=36285,L1=36286;let Bm;function ea(e){if(!Bm){const r={};r[wb]={textureFormat:wb,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[gt,Qn,el,tn]},r[Cb]={textureFormat:Cb,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[gt,Qn,el,tn]},r[Tb]={textureFormat:Tb,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2,4,4,8],type:[gt,Qn,el,tn]},r[hr]={textureFormat:hr,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,6,6,12,2],type:[gt,Qn,el,tn,Ob]},r[St]={textureFormat:St,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,8,8,16,2,2],type:[gt,Qn,el,tn,Nb,Mb]},r[Ja]={textureFormat:Ja,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[Ci,Ms]},r[$M]={textureFormat:vu,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1],type:[gt]},r[KM]={textureFormat:vu,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[1],type:[Lo]},r[ZM]={textureFormat:vu,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4,2],type:[tn,Qn]},r[QM]={textureFormat:vu,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[4],type:[tn]},r[WM]={textureFormat:Ds,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[gt]},r[JM]={textureFormat:Ds,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[Lo]},r[uO]={textureFormat:Ds,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[Ms]},r[fO]={textureFormat:Ds,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[pu]},r[dO]={textureFormat:Ds,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Ci]},r[hO]={textureFormat:Ds,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[gu]},r[oO]={textureFormat:yu,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2],type:[gt]},r[iO]={textureFormat:yu,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[2],type:[Lo]},r[sO]={textureFormat:yu,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[8,4],type:[tn,Qn]},r[aO]={textureFormat:yu,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[8],type:[tn]},r[lO]={textureFormat:Os,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[gt]},r[cO]={textureFormat:Os,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[Lo]},r[eO]={textureFormat:Os,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Ms]},r[tO]={textureFormat:Os,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[pu]},r[nO]={textureFormat:Os,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[Ci]},r[rO]={textureFormat:Os,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[gu]},r[mO]={textureFormat:hr,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3],type:[gt]},r[pO]={textureFormat:hr,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[gt]},r[gO]={textureFormat:hr,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,2],type:[gt,Ob]},r[yO]={textureFormat:hr,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[Lo]},r[vO]={textureFormat:hr,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[tn,Qn,$O]},r[xO]={textureFormat:hr,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[tn,Qn,KO]},r[bO]={textureFormat:hr,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6],type:[tn,Qn]},r[_O]={textureFormat:hr,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[tn]},r[EO]={textureFormat:zs,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[gt]},r[SO]={textureFormat:zs,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[Lo]},r[wO]={textureFormat:zs,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[Ms]},r[CO]={textureFormat:zs,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[pu]},r[TO]={textureFormat:zs,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[Ci]},r[RO]={textureFormat:zs,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[gu]},r[AO]={textureFormat:St,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[gt]},r[NO]={textureFormat:St,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[gt]},r[MO]={textureFormat:St,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4],type:[Lo]},r[OO]={textureFormat:St,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2,4],type:[gt,Mb,zm]},r[DO]={textureFormat:St,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2],type:[gt,Nb]},r[zO]={textureFormat:St,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[zm]},r[BO]={textureFormat:St,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[16,8],type:[tn,Qn]},r[UO]={textureFormat:St,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[16],type:[tn]},r[LO]={textureFormat:Ti,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[gt]},r[kO]={textureFormat:Ti,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Lo]},r[IO]={textureFormat:Ti,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[zm]},r[HO]={textureFormat:Ti,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[Ms]},r[FO]={textureFormat:Ti,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[pu]},r[PO]={textureFormat:Ti,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[gu]},r[jO]={textureFormat:Ti,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[Ci]},r[VO]={textureFormat:Ja,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[Ms,Ci]},r[GO]={textureFormat:Ja,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[Ci]},r[qO]={textureFormat:Ja,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[tn]},r[XO]={textureFormat:Rb,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[QO]},r[YO]={textureFormat:Rb,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[ZO]},Object.keys(r).forEach(function(l){const u=r[l];u.bytesPerElementMap={},u.bytesPerElement.forEach(function(f,h){const d=u.type[h];u.bytesPerElementMap[d]=f})});const i={bytes:8,width:4,height:4},a={bytes:16,width:4,height:4};r[Db]={textureFormat:Db,colorRenderable:!1,textureFilterable:!0,block:i},r[zb]={textureFormat:zb,colorRenderable:!1,textureFilterable:!0,block:i},r[Bb]={textureFormat:Bb,colorRenderable:!1,textureFilterable:!0,block:a},r[Ub]={textureFormat:Ub,colorRenderable:!1,textureFilterable:!0,block:a},r[Lb]={textureFormat:Lb,colorRenderable:!1,textureFilterable:!0,block:i},r[kb]={textureFormat:kb,colorRenderable:!1,textureFilterable:!0,block:i},r[Ib]={textureFormat:Ib,colorRenderable:!1,textureFilterable:!0,block:a},r[Hb]={textureFormat:Hb,colorRenderable:!1,textureFilterable:!0,block:a},r[Fb]={textureFormat:Fb,colorRenderable:!1,textureFilterable:!0,block:i},r[Pb]={textureFormat:Pb,colorRenderable:!1,textureFilterable:!0,block:i},r[jb]={textureFormat:jb,colorRenderable:!1,textureFilterable:!0,block:i},r[Vb]={textureFormat:Vb,colorRenderable:!1,textureFilterable:!0,block:a},r[Gb]={textureFormat:Gb,colorRenderable:!1,textureFilterable:!0,block:a},r[qb]={textureFormat:qb,colorRenderable:!1,textureFilterable:!0,block:i},r[Yb]={textureFormat:Yb,colorRenderable:!1,textureFilterable:!0,block:i},r[Xb]={textureFormat:Xb,colorRenderable:!1,textureFilterable:!0,block:i},r[$b]={textureFormat:$b,colorRenderable:!1,textureFilterable:!0,block:i},r[Kb]={textureFormat:Kb,colorRenderable:!1,textureFilterable:!0,block:a},r[Zb]={textureFormat:Zb,colorRenderable:!1,textureFilterable:!0,block:a},r[Qb]={textureFormat:Qb,colorRenderable:!1,textureFilterable:!0,block:{bytes:32,width:8,height:8}},r[Wb]={textureFormat:Wb,colorRenderable:!1,textureFilterable:!0,block:{bytes:32,width:16,height:8}},r[Jb]={textureFormat:Jb,colorRenderable:!1,textureFilterable:!0,block:{bytes:32,width:8,height:8}},r[e1]={textureFormat:e1,colorRenderable:!1,textureFilterable:!0,block:{bytes:32,width:16,height:8}},r[t1]={textureFormat:t1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:4,height:4}},r[n1]={textureFormat:n1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:5,height:4}},r[r1]={textureFormat:r1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:5,height:5}},r[o1]={textureFormat:o1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:6,height:5}},r[i1]={textureFormat:i1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:6,height:6}},r[s1]={textureFormat:s1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:8,height:5}},r[a1]={textureFormat:a1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:8,height:6}},r[l1]={textureFormat:l1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:8,height:8}},r[c1]={textureFormat:c1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:5}},r[u1]={textureFormat:u1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:6}},r[f1]={textureFormat:f1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:8}},r[d1]={textureFormat:d1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:10}},r[h1]={textureFormat:h1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:12,height:10}},r[m1]={textureFormat:m1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:12,height:12}},r[p1]={textureFormat:p1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:4,height:4}},r[g1]={textureFormat:g1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:5,height:4}},r[y1]={textureFormat:y1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:5,height:5}},r[v1]={textureFormat:v1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:6,height:5}},r[x1]={textureFormat:x1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:6,height:6}},r[b1]={textureFormat:b1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:8,height:5}},r[_1]={textureFormat:_1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:8,height:6}},r[E1]={textureFormat:E1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:8,height:8}},r[S1]={textureFormat:S1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:5}},r[w1]={textureFormat:w1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:6}},r[C1]={textureFormat:C1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:8}},r[T1]={textureFormat:T1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:10,height:10}},r[R1]={textureFormat:R1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:12,height:10}},r[A1]={textureFormat:A1,colorRenderable:!1,textureFilterable:!0,block:{bytes:16,width:12,height:12}},r[N1]={textureFormat:N1,colorRenderable:!1,textureFilterable:!0,block:a},r[M1]={textureFormat:M1,colorRenderable:!1,textureFilterable:!0,block:a},r[O1]={textureFormat:O1,colorRenderable:!1,textureFilterable:!0,block:a},r[D1]={textureFormat:D1,colorRenderable:!1,textureFilterable:!0,block:a},r[z1]={textureFormat:z1,colorRenderable:!1,textureFilterable:!0,block:i},r[B1]={textureFormat:B1,colorRenderable:!1,textureFilterable:!0,block:i},r[U1]={textureFormat:U1,colorRenderable:!1,textureFilterable:!0,block:i},r[L1]={textureFormat:L1,colorRenderable:!1,textureFilterable:!0,block:i},Bm=r}const t=Bm[e];if(!t)throw new Error("unknown internal format");return t}function wS(e,t){const i=ea(e).bytesPerElementMap[t];if(i===void 0)throw new Error("type not supported for internal format");return i}function Ll(e){const t=ea(e);if(!t)throw new Error("unknown internal format");return{format:t.textureFormat,type:t.type?.[0]??gt}}function CS(e){return!!ea(e).block}function WO(e,t){const r=ea(e);return r.block?{blockWidth:r.block.width,blockHeight:r.block.height,bytesPerBlock:r.block.bytes}:{blockWidth:1,blockHeight:1,bytesPerBlock:wS(e,t)}}function k1(e){return(e&e-1)===0}function JO(e,t,r,i){if(!Ul(e))return k1(t)&&k1(r);const a=ea(i);return a.colorRenderable&&a.textureFilterable}function Um(e){return ea(e).textureFilterable}function eD(e,t,r){return yl(t)?Bf(t):r||gt}function xu(e,t,r,i,a){if(a%1!==0)throw new Error("can't guess dimensions");if(!r&&!i){const l=Math.sqrt(a/(t===to?6:1));l%1===0?(r=l,i=l):(r=a,i=1)}else if(i){if(!r&&(r=a/i,r%1))throw new Error("can't guess dimensions")}else if(i=a/r,i%1)throw new Error("can't guess dimensions");return{width:r,height:i}}function Fo(e,t,r){let i,a,l;t.colorspaceConversion!==void 0&&(i=e.getParameter(Pu),e.pixelStorei(Pu,t.colorspaceConversion)),t.premultiplyAlpha!==void 0&&(a=e.getParameter(ju),e.pixelStorei(ju,t.premultiplyAlpha)),t.flipY!==void 0&&(l=e.getParameter(Vu),e.pixelStorei(Vu,t.flipY)),r(),i!==void 0&&e.pixelStorei(Pu,i),a!==void 0&&e.pixelStorei(ju,a),l!==void 0&&e.pixelStorei(Vu,l)}function Lm(e,t,r,i){const a=t[r];return{[r]:a===void 0?e.getParameter(i):a}}function N0(e,t){return{...t,...Lm(e,t,"flipY",Vu),...Lm(e,t,"premultiplyAlpha",ju),...Lm(e,t,"colorspaceConversion",Pu)}}function TS(e){e.pixelStorei(A0,4),Ul(e)&&(e.pixelStorei(xS,0),e.pixelStorei(bS,0),e.pixelStorei(_S,0),e.pixelStorei(ES,0),e.pixelStorei(SS,0))}function tD(e,t,r,i){i.minMag&&(r.call(e,t,ef,i.minMag),r.call(e,t,tf,i.minMag)),i.min&&r.call(e,t,ef,i.min),i.mag&&r.call(e,t,tf,i.mag),i.wrap&&(r.call(e,t,nf,i.wrap),r.call(e,t,rf,i.wrap),(t===Pi||zN(e,t))&&r.call(e,t,Ab,i.wrap)),i.wrapR&&r.call(e,t,Ab,i.wrapR),i.wrapS&&r.call(e,t,nf,i.wrapS),i.wrapT&&r.call(e,t,rf,i.wrapT),i.minLod!==void 0&&r.call(e,t,jM,i.minLod),i.maxLod!==void 0&&r.call(e,t,VM,i.maxLod),i.baseLevel!==void 0&&r.call(e,t,GM,i.baseLevel),i.maxLevel!==void 0&&r.call(e,t,qM,i.maxLevel),i.compareFunc!==void 0&&r.call(e,t,XM,i.compareFunc),i.compareMode!==void 0&&r.call(e,t,YM,i.compareMode)}function RS(e,t,r){const i=r.target||eo;e.bindTexture(i,t),tD(e,i,e.texParameteri,r)}function nD(e){return e=e||$o.textureColor,yl(e)?e:new Uint8Array([e[0]*255,e[1]*255,e[2]*255,e[3]*255])}function AS(e,t,{options:r,width:i,height:a,internalFormat:l,lastMipLevelUploaded:u}){r=r||$o.textureOptions,l=l||St;const f=r.target||eo;if(i=i||r.width,a=a||r.height,e.bindTexture(f,t),u>1){const h=Math.max(1,i>>u),d=Math.max(1,a>>u),p=h===1&&d===1,g=Um(l)?Dm:Om,v=Um(l)?p?LM:Dm:Om;e.texParameteri(f,tf,g),e.texParameteri(f,ef,v)}else if(JO(e,i,a,l))e.generateMipmap(f);else{const h=Um(l)?Dm:Om;e.texParameteri(f,ef,h),e.texParameteri(f,tf,h),e.texParameteri(f,nf,Ju),e.texParameteri(f,rf,Ju)}}function I1(e,t,r,i,a,l){AS(e,t,{options:r,width:i,height:a,internalFormat:l})}function vl(e){return e.auto===!0||e.auto===void 0&&e.level===void 0}function vp(e,t){return t=t||{},t.cubeFaceOrder||[R0,kM,IM,HM,FM,PM]}function xp(e,t){const i=vp(e,t).map(function(a,l){return{face:a,ndx:l}});return i.sort(function(a,l){return a.face-l.face}),i}function of(e,t,r,i){i=i||$o.textureOptions;const a=i.target||eo,l=i.level||0;let u=r.width,f=r.height;const h=i.internalFormat||i.format||St,d=Ll(h),p=i.format||d.format,g=i.type||d.type;if(e.bindTexture(a,t),a===to){const v=r.width,x=r.height;let b,_;if(v/6===x)b=x,_=[0,0,1,0,2,0,3,0,4,0,5,0];else if(x/6===v)b=v,_=[0,0,0,1,0,2,0,3,0,4,0,5];else if(v/3===x/2)b=v/3,_=[0,0,1,0,2,0,0,1,1,1,2,1];else if(v/2===x/3)b=v/2,_=[0,0,1,0,0,1,1,1,0,2,1,2];else throw new Error(`can't figure out cube map from element: ${r.src?r.src:r.nodeName}`);const C=vS();C?(C.canvas.width=b,C.canvas.height=b,u=b,f=b,Fo(e,i,()=>{xp(e,i).forEach(function(E){const N=_[E.ndx*2+0]*b,w=_[E.ndx*2+1]*b;C.drawImage(r,N,w,b,b,0,0,b,b),e.texImage2D(E.face,l,h,p,g,C.canvas)}),C.canvas.width=1,C.canvas.height=1})):typeof createImageBitmap<"u"&&(u=b,f=b,xp(e,i).forEach(function(E){const N=_[E.ndx*2+0]*b,w=_[E.ndx*2+1]*b;e.texImage2D(E.face,l,h,b,b,0,p,g,null),createImageBitmap(r,N,w,b,b,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then(function(A){Fo(e,i,()=>{e.bindTexture(a,t),e.texImage2D(E.face,l,h,p,g,A),vl(i)&&I1(e,t,i,u,f,h)})})}))}else a===Pi||a===Bi?Fo(e,i,()=>{const v=Math.min(r.width,r.height),x=Math.max(r.width,r.height),b=x/v;if(b%1!==0)throw new Error("can not compute 3D dimensions of element");const _=r.width===x?1:0,C=r.height===x?1:0;e.pixelStorei(A0,1),e.pixelStorei(xS,r.width),e.pixelStorei(bS,0),e.pixelStorei(SS,0),e.texImage3D(a,l,h,v,v,v,0,p,g,null);for(let E=0;E<b;++E){const N=E*v*_,w=E*v*C;e.pixelStorei(_S,N),e.pixelStorei(ES,w),e.texSubImage3D(a,l,0,0,E,v,v,1,p,g,r)}TS(e)}):Fo(e,i,()=>{e.texImage2D(a,l,h,p,g,r)});vl(i)&&I1(e,t,i,u,f,h),RS(e,t,i)}function kl(){}function rD(e){if(typeof document<"u"){const t=document.createElement("a");return t.href=e,t.hostname===location.hostname&&t.port===location.port&&t.protocol===location.protocol}else{const t=new URL(location.href).origin;return new URL(e,location.href).origin===t}}function oD(e,t){return t===void 0&&!rD(e)?"anonymous":t}function iD(e,t,r){r=r||kl;let i;if(t=t!==void 0?t:$o.crossOrigin,t=oD(e,t),typeof Image<"u"){i=new Image,t!==void 0&&(i.crossOrigin=t);const a=function(){i.removeEventListener("error",l),i.removeEventListener("load",u),i=null},l=function(){const h="couldn't load image: "+e;rS(h),r(h,i),a()},u=function(){r(null,i),a()};return i.addEventListener("error",l),i.addEventListener("load",u),i.src=e,i}else if(typeof ImageBitmap<"u"){let a,l;const u=function(){r(a,l)},f={};t&&(f.mode="cors"),fetch(e,f).then(function(h){if(!h.ok)throw h;return h.blob()}).then(function(h){return createImageBitmap(h,{premultiplyAlpha:"none",colorSpaceConversion:"none"})}).then(function(h){l=h,setTimeout(u)}).catch(function(h){a=h,setTimeout(u)}),i=null}return i}function NS(e){return typeof ImageBitmap<"u"&&e instanceof ImageBitmap||typeof ImageData<"u"&&e instanceof ImageData||typeof HTMLElement<"u"&&e instanceof HTMLElement}function M0(e,t,r){return NS(e)?(setTimeout(function(){r(null,e)}),e):iD(e,t,r)}function O0(e,t,r){r=r||$o.textureOptions;const i=r.target||eo;if(e.bindTexture(i,t),r.color===!1)return;const a=nD(r.color);if(i===to)for(let l=0;l<6;++l)e.texImage2D(R0+l,0,St,1,1,0,St,gt,a);else i===Pi||i===Bi?e.texImage3D(i,0,St,1,1,1,0,St,gt,a):e.texImage2D(i,0,St,1,1,0,St,gt,a)}function sD(e,t,r,i){return i=i||kl,r=r||$o.textureOptions,O0(e,t,r),r=N0(e,r),M0(r.src,r.crossOrigin,function(l,u){l?i(l,t,u):(of(e,t,u,r),i(null,t,u))})}function aD(e,t,r,i){i=i||kl;const a=r.src;if(a.length!==6)throw new Error("there must be 6 urls for a cubemap");const l=r.level||0,u=r.internalFormat||r.format||St,f=Ll(u),h=r.format||f.format,d=r.type||gt,p=r.target||eo;if(p!==to)throw new Error("target must be TEXTURE_CUBE_MAP");O0(e,t,r),r=N0(e,r);let g=6;const v=[],x=vp(e,r);let b;function _(C){return function(E,N){--g,E?v.push(E):N.width!==N.height?v.push("cubemap face img is not a square: "+N.src):Fo(e,r,()=>{e.bindTexture(p,t),g===5?vp().forEach(function(w){e.texImage2D(w,l,u,h,d,N)}):e.texImage2D(C,l,u,h,d,N),vl(r)&&e.generateMipmap(p)}),g===0&&i(v.length?v:void 0,t,b)}}b=a.map(function(C,E){return M0(C,r.crossOrigin,_(x[E]))})}function lD(e,t,r,i){i=i||kl;const a=r.src,l=r.internalFormat||r.format||St,u=Ll(l),f=r.format||u.format,h=r.type||gt,d=r.target||Bi;if(d!==Pi&&d!==Bi)throw new Error("target must be TEXTURE_3D or TEXTURE_2D_ARRAY");O0(e,t,r),r=N0(e,r);let p=a.length;const g=[];let v;const x=r.level||0;let b=r.width,_=r.height;const C=a.length;let E=!0;function N(w){return function(A,M){--p,A?g.push(A):Fo(e,r,()=>{if(e.bindTexture(d,t),E){E=!1,b=r.width||M.width,_=r.height||M.height,e.texImage3D(d,x,l,b,_,C,0,f,h,null);for(let T=0;T<C;++T)e.texSubImage3D(d,x,0,0,T,b,_,1,f,h,M)}else{let T=M,O;(M.width!==b||M.height!==_)&&(O=vS(),T=O.canvas,O.canvas.width=b,O.canvas.height=_,O.drawImage(M,0,0,b,_)),e.texSubImage3D(d,x,0,0,w,b,_,1,f,h,T),O&&T===O.canvas&&(O.canvas.width=0,O.canvas.height=0)}vl(r)&&e.generateMipmap(d)}),p===0&&i(g.length?g:void 0,t,v)}}v=a.map(function(w,A){return M0(w,r.crossOrigin,N(A))})}function bp(e,t,r,i){i=i||$o.textureOptions;const a=i.target||eo;e.bindTexture(a,t);const l=i.level||0,u=i.internalFormat||i.format||St,f=Ll(u),h=i.format||f.format,d=i.type||eD(e,r,f.type);if(yl(r))r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));else{const _=nS(d);r=new _(r)}const{width:p,height:g,depth:v}=cD(a,r,i,u,h,d),x=CS(u);TS(e),e.pixelStorei(A0,i.unpackAlignment||1);let b=0;return Fo(e,i,()=>{let _=0;const{blockWidth:C,blockHeight:E,bytesPerBlock:N}=WO(u,d);for(;_<r.byteLength;){const w=Math.max(1,p>>b),A=Math.max(1,g>>b),M=a===eo?Math.max(1,v>>b):v,T=Math.ceil(w/C),O=Math.ceil(A/E),I=a===to?6:1,j=T*O*N*M*I;if(_+j>r.byteLength)throw new Error("src size does not match number of mip levels");const Z=r.subarray(_/r.BYTES_PER_ELEMENT,(_+j)/r.BYTES_PER_ELEMENT),P=l+b;if(a===to){const q=Z.length/6;xp(e,i).forEach(G=>{const k=q*G.ndx,F=Z.subarray(k,k+q);x?e.compressedTexImage2D(G.face,P,u,w,A,0,F):e.texImage2D(G.face,P,u,w,A,0,h,d,F)})}else a===Pi||a===Bi?e.texImage3D(a,P,u,w,A,M,0,h,d,Z):x?e.compressedTexImage2D(a,P,u,w,A,0,Z):e.texImage2D(a,P,u,w,A,0,h,d,Z);if(++b,_+=j,w===1&&A===1&&M===1&&_!==r.byteLength)throw new Error("src size has more data than can fit in mip levels")}}),{width:p,height:g,depth:v,type:d,lastMipLevelUploaded:l+b-1}}function cD(e,t,r,i,a,l){let u=r.width,f=r.height,h=r.depth;const d=CS(i);if(d){if(!u||!f)throw new Error("compressed texture needs to set width and height!");h=h||1}else{const p=wS(i,l),g=t.byteLength/p;if(g%1)throw new Error(`length wrong size for format: ${yS(Wa,a)}`);if(d&&(!u||!f))throw new Error("compressed texture needs to set width and height!");let v;if(e===Pi||e===Bi)if(!u&&!f&&!h){const x=Math.cbrt(g);if(x%1!==0)throw new Error(`can't guess cube size of array of numElements: ${g}`);u=x,f=x,h=x}else u&&(!f||!h)?(v=xu(Wa,e,f,h,g/u),f=v.width,h=v.height):f&&(!u||!h)?(v=xu(Wa,e,u,h,g/f),u=v.width,h=v.height):(v=xu(Wa,e,u,f,g/h),u=v.width,f=v.height);else v=xu(Wa,e,u,f,g),u=v.width,f=v.height}return{width:u,height:f,depth:h}}function uD(e,t,r){const i=r.target||eo;e.bindTexture(i,t);const a=r.level||0,l=r.internalFormat||r.format||St,u=Ll(l),f=r.format||u.format,h=r.type||u.type;Fo(e,r,()=>{if(i===to)for(let d=0;d<6;++d)e.texImage2D(R0+d,a,l,r.width,r.height,0,f,h,null);else i===Pi||i===Bi?e.texImage3D(i,a,l,r.width,r.height,r.depth,0,f,h,null):e.texImage2D(i,a,l,r.width,r.height,0,f,h,null)})}function _p(e,t,r){r=r||kl,t=t||$o.textureOptions;const i=e.createTexture(),a=t.target||eo;let l=t.width||1,u=t.height||1,f=0;const h=t.internalFormat||St;e.bindTexture(a,i),a===to&&(e.texParameteri(a,nf,Ju),e.texParameteri(a,rf,Ju));let d=t.src;if(d)if(typeof d=="function"&&(d=d(e,t)),typeof d=="string")sD(e,i,t,r);else if(yl(d)||Array.isArray(d)&&(typeof d[0]=="number"||Array.isArray(d[0])||yl(d[0]))){const p=bp(e,i,d,t);l=p.width,u=p.height,f=p.lastMipLevelUploaded}else Array.isArray(d)&&(typeof d[0]=="string"||NS(d[0]))?a===to?aD(e,i,t,r):lD(e,i,t,r):(of(e,i,d,t),l=d.width,u=d.height);else uD(e,i,t);return vl(t)&&AS(e,i,{options:t,width:l,height:u,internalFormat:h,lastMipLevelUploaded:f}),RS(e,i,t),i}const D0=rS;function MS(e){return typeof document<"u"&&document.getElementById?document.getElementById(e):null}const sf=33984,Hf=34962,fD=34963,dD=35713,hD=35714,mD=35632,pD=35633,gD=35981,OS=35718,yD=35721,vD=35971,xD=35382,bD=35396,_D=35398,ED=35392,SD=35395,Ff=5126,DS=35664,zS=35665,BS=35666,z0=5124,US=35667,LS=35668,kS=35669,IS=35670,HS=35671,FS=35672,PS=35673,jS=35674,VS=35675,GS=35676,wD=35678,CD=35680,TD=35679,RD=35682,AD=35685,ND=35686,MD=35687,OD=35688,DD=35689,zD=35690,BD=36289,UD=36292,LD=36293,B0=5125,qS=36294,YS=36295,XS=36296,kD=36298,ID=36299,HD=36300,FD=36303,PD=36306,jD=36307,VD=36308,GD=36311,Pf=3553,jf=34067,U0=32879,Vf=35866,Le={};function $S(e,t){return Le[t].bindPoint}function qD(e,t){return function(r){e.uniform1f(t,r)}}function YD(e,t){return function(r){e.uniform1fv(t,r)}}function XD(e,t){return function(r){e.uniform2fv(t,r)}}function $D(e,t){return function(r){e.uniform3fv(t,r)}}function KD(e,t){return function(r){e.uniform4fv(t,r)}}function KS(e,t){return function(r){e.uniform1i(t,r)}}function ZS(e,t){return function(r){e.uniform1iv(t,r)}}function QS(e,t){return function(r){e.uniform2iv(t,r)}}function WS(e,t){return function(r){e.uniform3iv(t,r)}}function JS(e,t){return function(r){e.uniform4iv(t,r)}}function ZD(e,t){return function(r){e.uniform1ui(t,r)}}function QD(e,t){return function(r){e.uniform1uiv(t,r)}}function WD(e,t){return function(r){e.uniform2uiv(t,r)}}function JD(e,t){return function(r){e.uniform3uiv(t,r)}}function e4(e,t){return function(r){e.uniform4uiv(t,r)}}function t4(e,t){return function(r){e.uniformMatrix2fv(t,!1,r)}}function n4(e,t){return function(r){e.uniformMatrix3fv(t,!1,r)}}function r4(e,t){return function(r){e.uniformMatrix4fv(t,!1,r)}}function o4(e,t){return function(r){e.uniformMatrix2x3fv(t,!1,r)}}function i4(e,t){return function(r){e.uniformMatrix3x2fv(t,!1,r)}}function s4(e,t){return function(r){e.uniformMatrix2x4fv(t,!1,r)}}function a4(e,t){return function(r){e.uniformMatrix4x2fv(t,!1,r)}}function l4(e,t){return function(r){e.uniformMatrix3x4fv(t,!1,r)}}function c4(e,t){return function(r){e.uniformMatrix4x3fv(t,!1,r)}}function on(e,t,r,i){const a=$S(e,t);return Ul(e)?function(l){let u,f;!l||h0(e,l)?(u=l,f=null):(u=l.texture,f=l.sampler),e.uniform1i(i,r),e.activeTexture(sf+r),e.bindTexture(a,u),e.bindSampler(r,f)}:function(l){e.uniform1i(i,r),e.activeTexture(sf+r),e.bindTexture(a,l)}}function sn(e,t,r,i,a){const l=$S(e,t),u=new Int32Array(a);for(let f=0;f<a;++f)u[f]=r+f;return Ul(e)?function(f){e.uniform1iv(i,u),f.forEach(function(h,d){e.activeTexture(sf+u[d]);let p,g;!h||h0(e,h)?(p=h,g=null):(p=h.texture,g=h.sampler),e.bindSampler(r,g),e.bindTexture(l,p)})}:function(f){e.uniform1iv(i,u),f.forEach(function(h,d){e.activeTexture(sf+u[d]),e.bindTexture(l,h)})}}Le[Ff]={Type:Float32Array,size:4,setter:qD,arraySetter:YD};Le[DS]={Type:Float32Array,size:8,setter:XD,cols:2};Le[zS]={Type:Float32Array,size:12,setter:$D,cols:3};Le[BS]={Type:Float32Array,size:16,setter:KD,cols:4};Le[z0]={Type:Int32Array,size:4,setter:KS,arraySetter:ZS};Le[US]={Type:Int32Array,size:8,setter:QS,cols:2};Le[LS]={Type:Int32Array,size:12,setter:WS,cols:3};Le[kS]={Type:Int32Array,size:16,setter:JS,cols:4};Le[B0]={Type:Uint32Array,size:4,setter:ZD,arraySetter:QD};Le[qS]={Type:Uint32Array,size:8,setter:WD,cols:2};Le[YS]={Type:Uint32Array,size:12,setter:JD,cols:3};Le[XS]={Type:Uint32Array,size:16,setter:e4,cols:4};Le[IS]={Type:Uint32Array,size:4,setter:KS,arraySetter:ZS};Le[HS]={Type:Uint32Array,size:8,setter:QS,cols:2};Le[FS]={Type:Uint32Array,size:12,setter:WS,cols:3};Le[PS]={Type:Uint32Array,size:16,setter:JS,cols:4};Le[jS]={Type:Float32Array,size:32,setter:t4,rows:2,cols:2};Le[VS]={Type:Float32Array,size:48,setter:n4,rows:3,cols:3};Le[GS]={Type:Float32Array,size:64,setter:r4,rows:4,cols:4};Le[AD]={Type:Float32Array,size:32,setter:o4,rows:2,cols:3};Le[ND]={Type:Float32Array,size:32,setter:s4,rows:2,cols:4};Le[MD]={Type:Float32Array,size:48,setter:i4,rows:3,cols:2};Le[OD]={Type:Float32Array,size:48,setter:l4,rows:3,cols:4};Le[DD]={Type:Float32Array,size:64,setter:a4,rows:4,cols:2};Le[zD]={Type:Float32Array,size:64,setter:c4,rows:4,cols:3};Le[wD]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:Pf};Le[CD]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:jf};Le[TD]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:U0};Le[RD]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:Pf};Le[BD]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:Vf};Le[UD]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:Vf};Le[LD]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:jf};Le[kD]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:Pf};Le[ID]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:U0};Le[HD]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:jf};Le[FD]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:Vf};Le[PD]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:Pf};Le[jD]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:U0};Le[VD]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:jf};Le[GD]={Type:null,size:0,setter:on,arraySetter:sn,bindPoint:Vf};function Gf(e,t){return function(r){if(r.value)switch(e.disableVertexAttribArray(t),r.value.length){case 4:e.vertexAttrib4fv(t,r.value);break;case 3:e.vertexAttrib3fv(t,r.value);break;case 2:e.vertexAttrib2fv(t,r.value);break;case 1:e.vertexAttrib1fv(t,r.value);break;default:throw new Error("the length of a float constant value must be between 1 and 4!")}else e.bindBuffer(Hf,r.buffer),e.enableVertexAttribArray(t),e.vertexAttribPointer(t,r.numComponents||r.size,r.type||Ff,r.normalize||!1,r.stride||0,r.offset||0),e.vertexAttribDivisor&&e.vertexAttribDivisor(t,r.divisor||0)}}function Ko(e,t){return function(r){if(r.value)if(e.disableVertexAttribArray(t),r.value.length===4)e.vertexAttrib4iv(t,r.value);else throw new Error("The length of an integer constant value must be 4!");else e.bindBuffer(Hf,r.buffer),e.enableVertexAttribArray(t),e.vertexAttribIPointer(t,r.numComponents||r.size,r.type||z0,r.stride||0,r.offset||0),e.vertexAttribDivisor&&e.vertexAttribDivisor(t,r.divisor||0)}}function qf(e,t){return function(r){if(r.value)if(e.disableVertexAttribArray(t),r.value.length===4)e.vertexAttrib4uiv(t,r.value);else throw new Error("The length of an unsigned integer constant value must be 4!");else e.bindBuffer(Hf,r.buffer),e.enableVertexAttribArray(t),e.vertexAttribIPointer(t,r.numComponents||r.size,r.type||B0,r.stride||0,r.offset||0),e.vertexAttribDivisor&&e.vertexAttribDivisor(t,r.divisor||0)}}function L0(e,t,r){const i=r.size,a=r.count;return function(l){e.bindBuffer(Hf,l.buffer);const u=l.size||l.numComponents||i,f=u/a,h=l.type||Ff,p=Le[h].size*u,g=l.normalize||!1,v=l.offset||0,x=p/a;for(let b=0;b<a;++b)e.enableVertexAttribArray(t+b),e.vertexAttribPointer(t+b,f,h,g,p,v+x*b),e.vertexAttribDivisor&&e.vertexAttribDivisor(t+b,l.divisor||0)}}const Ht={};Ht[Ff]={size:4,setter:Gf};Ht[DS]={size:8,setter:Gf};Ht[zS]={size:12,setter:Gf};Ht[BS]={size:16,setter:Gf};Ht[z0]={size:4,setter:Ko};Ht[US]={size:8,setter:Ko};Ht[LS]={size:12,setter:Ko};Ht[kS]={size:16,setter:Ko};Ht[B0]={size:4,setter:qf};Ht[qS]={size:8,setter:qf};Ht[YS]={size:12,setter:qf};Ht[XS]={size:16,setter:qf};Ht[IS]={size:4,setter:Ko};Ht[HS]={size:8,setter:Ko};Ht[FS]={size:12,setter:Ko};Ht[PS]={size:16,setter:Ko};Ht[jS]={size:4,setter:L0,count:2};Ht[VS]={size:9,setter:L0,count:3};Ht[GS]={size:16,setter:L0,count:4};const u4=/ERROR:\s*\d+:(\d+)/gi;function f4(e,t="",r=0){const i=[...t.matchAll(u4)],a=new Map(i.map((l,u)=>{const f=parseInt(l[1]),h=i[u+1],d=h?h.index:t.length,p=t.substring(l.index,d);return[f-1,p]}));return e.split(`
1739
+ `).map((l,u)=>{const f=a.get(u);return`${u+1+r}: ${l}${f?`
1740
+
1741
+ ^^^ ${f}`:""}`}).join(`
1742
+ `)}const H1=/^[ \t]*\n/;function e2(e){let t=0;return H1.test(e)&&(t=1,e=e.replace(H1,"")),{lineOffset:t,shaderSource:e}}function d4(e,t){return e.errorCallback(t),e.callback&&setTimeout(()=>{e.callback(`${t}
1743
+ ${e.errors.join(`
1744
+ `)}`)}),null}function h4(e,t,r,i){if(i=i||D0,!e.getShaderParameter(r,dD)){const l=e.getShaderInfoLog(r),{lineOffset:u,shaderSource:f}=e2(e.getShaderSource(r)),h=`${f4(f,l,u)}
1745
+ Error compiling ${yS(e,t)}: ${l}`;return i(h),h}return""}function k0(e,t,r){let i,a,l;if(typeof t=="function"&&(r=t,t=void 0),typeof e=="function")r=e,e=void 0;else if(e&&!Array.isArray(e)){const d=e;r=d.errorCallback,e=d.attribLocations,i=d.transformFeedbackVaryings,a=d.transformFeedbackMode,l=d.callback}const u=r||D0,f=[],h={errorCallback(d,...p){f.push(d),u(d,...p)},transformFeedbackVaryings:i,transformFeedbackMode:a,callback:l,errors:f};{let d={};Array.isArray(e)?e.forEach(function(p,g){d[p]=t?t[g]:g}):d=e||{},h.attribLocations=d}return h}const m4=["VERTEX_SHADER","FRAGMENT_SHADER"];function p4(e,t){if(t.indexOf("frag")>=0)return mD;if(t.indexOf("vert")>=0)return pD}function g4(e,t,r){const i=e.getAttachedShaders(t);for(const a of i)r.has(a)||e.deleteShader(a);e.deleteProgram(t)}const y4=(e=0)=>new Promise(t=>setTimeout(t,e));function v4(e,t,r){const i=e.createProgram(),{attribLocations:a,transformFeedbackVaryings:l,transformFeedbackMode:u}=k0(r);for(let f=0;f<t.length;++f){let h=t[f];if(typeof h=="string"){const d=MS(h),p=d?d.text:h;let g=e[m4[f]];d&&d.type&&(g=p4(e,d.type)||g),h=e.createShader(g),e.shaderSource(h,e2(p).shaderSource),e.compileShader(h)}e.attachShader(i,h)}Object.entries(a).forEach(([f,h])=>e.bindAttribLocation(i,h,f));{let f=l;f&&(f.attribs&&(f=f.attribs),Array.isArray(f)||(f=Object.keys(f)),e.transformFeedbackVaryings(i,f,u||gD))}return e.linkProgram(i),i}function x4(e,t,r,i,a){const l=k0(r,i,a),u=new Set(t),f=v4(e,t,l);function h(d,p){const g=_4(d,p,l.errorCallback);return g&&g4(d,p,u),g}if(l.callback){b4(e,f).then(()=>{const d=h(e,f);l.callback(d,d?void 0:f)});return}return h(e,f)?void 0:f}async function b4(e,t){const r=e.getExtension("KHR_parallel_shader_compile"),i=r?(l,u)=>l.getProgramParameter(u,r.COMPLETION_STATUS_KHR):()=>!0;let a=0;do await y4(a),a=1e3/60;while(!i(e,t))}function _4(e,t,r){if(r=r||D0,!e.getProgramParameter(t,hD)){const a=e.getProgramInfoLog(t);r(`Error in program linking: ${a}`);const u=e.getAttachedShaders(t).map(f=>h4(e,e.getShaderParameter(f,e.SHADER_TYPE),f,r));return`${a}
1746
+ ${u.filter(f=>f).join(`
1747
+ `)}`}}function E4(e,t,r,i,a){return x4(e,t,r,i,a)}function t2(e){const t=e.name;return t.startsWith("gl_")||t.startsWith("webgl_")}const S4=/(\.|\[|]|\w+)/g,w4=e=>e>="0"&&e<="9";function C4(e,t,r,i){const a=e.split(S4).filter(f=>f!=="");let l=0,u="";for(;;){const f=a[l++];u+=f;const h=w4(f[0]),d=h?parseInt(f):f;if(h&&(u+=a[l++]),l===a.length){r[d]=t;break}else{const g=a[l++],v=g==="[",x=r[d]||(v?[]:{});r[d]=x,r=x,i[u]=i[u]||(function(b){return function(_){n2(b,_)}})(x),u+=g}}}function T4(e,t){let r=0;function i(f,h,d){const p=h.name.endsWith("[0]"),g=h.type,v=Le[g];if(!v)throw new Error(`unknown type: 0x${g.toString(16)}`);let x;if(v.bindPoint){const b=r;r+=h.size,p?x=v.arraySetter(e,g,b,d,h.size):x=v.setter(e,g,b,d,h.size)}else v.arraySetter&&p?x=v.arraySetter(e,d):x=v.setter(e,d);return x.location=d,x}const a={},l={},u=e.getProgramParameter(t,OS);for(let f=0;f<u;++f){const h=e.getActiveUniform(t,f);if(t2(h))continue;let d=h.name;d.endsWith("[0]")&&(d=d.substr(0,d.length-3));const p=e.getUniformLocation(t,h.name);if(p){const g=i(t,h,p);a[d]=g,C4(d,g,l,a)}}return a}function R4(e,t){const r={},i=e.getProgramParameter(t,vD);for(let a=0;a<i;++a){const l=e.getTransformFeedbackVarying(t,a);r[l.name]={index:a,type:l.type,size:l.size}}return r}function A4(e,t){const r=e.getProgramParameter(t,OS),i=[],a=[];for(let f=0;f<r;++f){a.push(f),i.push({});const h=e.getActiveUniform(t,f);i[f].name=h.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach(function(f){const h=f[0],d=f[1];e.getActiveUniforms(t,a,e[h]).forEach(function(p,g){i[g][d]=p})});const l={},u=e.getProgramParameter(t,xD);for(let f=0;f<u;++f){const h=e.getActiveUniformBlockName(t,f),d={index:e.getUniformBlockIndex(t,h),usedByVertexShader:e.getActiveUniformBlockParameter(t,f,bD),usedByFragmentShader:e.getActiveUniformBlockParameter(t,f,_D),size:e.getActiveUniformBlockParameter(t,f,ED),uniformIndices:e.getActiveUniformBlockParameter(t,f,SD)};d.used=d.usedByVertexShader||d.usedByFragmentShader,l[h]=d}return{blockSpecs:l,uniformData:i}}function n2(e,t){for(const r in t){const i=e[r];typeof i=="function"?i(t[r]):n2(e[r],t[r])}}function r2(e,...t){const r=e.uniformSetters||e,i=t.length;for(let a=0;a<i;++a){const l=t[a];if(Array.isArray(l)){const u=l.length;for(let f=0;f<u;++f)r2(r,l[f])}else for(const u in l){const f=r[u];f&&f(l[u])}}}function N4(e,t){const r={},i=e.getProgramParameter(t,yD);for(let a=0;a<i;++a){const l=e.getActiveAttrib(t,a);if(t2(l))continue;const u=e.getAttribLocation(t,l.name),f=Ht[l.type],h=f.setter(e,u,f);h.location=u,r[l.name]=h}return r}function M4(e,t){for(const r in t){const i=e[r];i&&i(t[r])}}function O4(e,t,r){r.vertexArrayObject?e.bindVertexArray(r.vertexArrayObject):(M4(t.attribSetters||t,r.attribs),r.indices&&e.bindBuffer(fD,r.indices))}function F1(e,t){const r=T4(e,t),i=N4(e,t),a={program:t,uniformSetters:r,attribSetters:i,uniformLocations:Object.fromEntries(Object.entries(r).map(([l,u])=>[l,u.location])),attribLocations:Object.fromEntries(Object.entries(i).map(([l,u])=>[l,u.location]))};return Ul(e)&&(a.uniformBlockSpec=A4(e,t),a.transformFeedbackInfo=R4(e,t)),a}const D4=/\s|{|}|;/;function z4(e,t,r,i,a){const l=k0(r,i,a),u=[];if(t=t.map(function(d){if(!D4.test(d)){const p=MS(d);if(p)d=p.text;else{const g=`no element with id: ${d}`;l.errorCallback(g),u.push(g)}}return d}),u.length)return d4(l,"");const f=l.callback;f&&(l.callback=(d,p)=>{f(d,d?void 0:F1(e,p))});const h=E4(e,t,l);return h?F1(e,h):null}const B4=4,P1=5123;function U4(e,t,r,i,a,l){r=r===void 0?B4:r;const u=t.indices,f=t.elementType,h=i===void 0?t.numElements:i;a=a===void 0?0:a,f||u?l!==void 0?e.drawElementsInstanced(r,h,f===void 0?P1:t.elementType,a,l):e.drawElements(r,h,f===void 0?P1:t.elementType,a):l!==void 0?e.drawArraysInstanced(r,a,h,l):e.drawArrays(r,a,h)}const o2=36160,bu=36161,L4=3553,k4=5121,I4=6402,H4=6408,F4=33190,P4=36012,j4=35056,V4=36013,G4=32854,q4=32855,Y4=36194,i2=33189,s2=6401,a2=36168,I0=34041,Ep=36064,Yf=36096,l2=36128,H0=33306,Sp=33071,wp=9729,X4=[{format:H4,type:k4,min:wp,wrap:Sp},{format:I0}],ir={};ir[I0]=H0;ir[s2]=l2;ir[a2]=l2;ir[I4]=Yf;ir[i2]=Yf;ir[F4]=Yf;ir[P4]=Yf;ir[j4]=H0;ir[V4]=H0;function $4(e,t){return ir[e]||ir[t]}const Zo={};Zo[G4]=!0;Zo[q4]=!0;Zo[Y4]=!0;Zo[I0]=!0;Zo[i2]=!0;Zo[s2]=!0;Zo[a2]=!0;function K4(e){return Zo[e]}const Z4=32;function Q4(e){return e>=Ep&&e<Ep+Z4}function W4(e,t,r,i){const a=o2,l=e.createFramebuffer();e.bindFramebuffer(a,l),r=r||e.drawingBufferWidth,i=i||e.drawingBufferHeight,t=t||X4;const u=[],f={framebuffer:l,attachments:[],width:r,height:i};return t.forEach(function(h,d){let p=h.attachment;const g=h.samples,v=h.format;let x=h.attachmentPoint||$4(v,h.internalFormat);if(x||(x=Ep+d),Q4(x)&&u.push(x),!p)if(g!==void 0||K4(v))p=e.createRenderbuffer(),e.bindRenderbuffer(bu,p),g>1?e.renderbufferStorageMultisample(bu,g,v,r,i):e.renderbufferStorage(bu,v,r,i);else{const b=Object.assign({},h);b.width=r,b.height=i,b.auto===void 0&&(b.auto=!1,b.min=b.min||b.minMag||wp,b.mag=b.mag||b.minMag||wp,b.wrapS=b.wrapS||b.wrap||Sp,b.wrapT=b.wrapT||b.wrap||Sp),p=_p(e,b)}if(DN(e,p))e.framebufferRenderbuffer(a,x,bu,p);else if(h0(e,p))h.layer!==void 0?e.framebufferTextureLayer(a,x,p,h.level||0,h.layer):e.framebufferTexture2D(a,x,h.target||L4,p,h.level||0);else throw new Error("unknown attachment type");f.attachments.push(p)}),e.drawBuffers&&e.drawBuffers(u),f}function j1(e,t,r){r=r||o2,t?(e.bindFramebuffer(r,t.framebuffer),e.viewport(0,0,t.width,t.height)):(e.bindFramebuffer(r,null),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight))}const V1=e=>{const t=e.replace("#","");return[parseInt(t.substring(0,2),16),parseInt(t.substring(2,4),16),parseInt(t.substring(4,6),16)]},J4=(e,t,r)=>{const[i,a,l]=V1(e),[u,f,h]=V1(t),d=Math.round(i+(u-i)*r).toString(16).padStart(2,"0"),p=Math.round(a+(f-a)*r).toString(16).padStart(2,"0"),g=Math.round(l+(h-l)*r).toString(16).padStart(2,"0");return`#${d}${p}${g}`},c2=(e,t)=>{const r=Math.max(0,Math.min(1,t)),i=[...e].sort((h,d)=>h.position-d.position);if(i.length===0)return"#000000";if(i.length===1||r<=i[0].position)return i[0].color;if(r>=i[i.length-1].position)return i[i.length-1].color;let a=i[0],l=i[i.length-1];for(let h=0;h<i.length-1;h++)if(r>=i[h].position&&r<=i[h+1].position){a=i[h],l=i[h+1];break}const u=l.position-a.position,f=u===0?0:(r-a.position)/u;return J4(a.color,l.color,f)},e5=e=>typeof e=="object"&&e!==null&&e.type==="texture"&&"src"in e,t5=e=>typeof e=="object"&&e!==null&&e.type==="gradient",n5=`#version 300 es
1748
+
1749
+ precision highp float;
1750
+
1751
+ in vec2 position;
1752
+ in vec2 texcoord;
1753
+
1754
+ out vec2 vUv;
1755
+
1756
+ void main() {
1757
+ vUv = vec2(texcoord.x, texcoord.y);
1758
+ gl_Position = vec4(position, 0.0, 1.0);
1759
+ }
1760
+ `;class r5{programs={};fbos={};renderOrder=[];dependencyMapping={};quad;textures={};textureSrcs={};gradientCanvases={};defaultTexture;patch;gl;uniforms;onTextureLoaded;error=null;constructor(t,r){this.patch=r,this.gl=t,this.defaultTexture=_p(this.gl,{minMag:this.gl.NEAREST,wrap:this.gl.CLAMP_TO_EDGE,auto:!1}),bp(this.gl,this.defaultTexture,new Uint8Array([0,0,0,255]),{width:1,height:1,minMag:this.gl.NEAREST,wrap:this.gl.CLAMP_TO_EDGE,auto:!1});let i=!1;for(let f=0;f<r.shaders.length&&!i;f++){const h=r.shaders[f];if(this.programs[h.id]=z4(this.gl,[n5,h.source],void 0,d=>{const p=d.match(/ERROR:\s*\d+:(\d+):/),g=p?parseInt(p[1],10):0;this.error={message:d,line:g,shaderName:h.name},i=!0}),i)break;this.fbos[h.id]=W4(this.gl,[{format:this.gl.RGBA,min:this.gl.NEAREST,mag:this.gl.NEAREST,wrap:this.gl.CLAMP_TO_EDGE,auto:!1}],h.resolution.width,h.resolution.height)}this.quad=UM.createXYQuadBufferInfo(this.gl);const a={},l={};this.uniforms={};for(let f=0;f<this.patch.shaders.length;f++){const h=this.patch.shaders[f];a[h.id]=[],l[h.id]=0,this.dependencyMapping[h.id]=[],this.uniforms[h.id]={}}for(const f of this.patch.connections)a[f.from].push(f.to),l[f.to]+=1,this.dependencyMapping[f.to].push({input:f.input,from:f.from});const u=[...Object.entries(l)].reduce((f,[h,d])=>d===0?[...f,h]:f,[]);for(;u.length>0;){const f=u.shift();this.renderOrder.push(f);for(const h of a[f]){const d=l[h]-1;l[h]=d,d===0&&u.push(h)}}if(this.renderOrder.length<this.patch.shaders.length)throw console.log(this.patch,this.renderOrder),Error("Cycle detected in graph")}_getOrCreateTexture(t){if(!this.textures[t]){const r=_p(this.gl,{minMag:this.gl.NEAREST,wrap:this.gl.CLAMP_TO_EDGE,auto:!1});bp(this.gl,r,new Uint8Array([0,0,0,255]),{width:1,height:1,minMag:this.gl.NEAREST,wrap:this.gl.CLAMP_TO_EDGE,auto:!1}),this.textures[t]=r}return this.textures[t]}_updateGradientUniform(t,r){let i=this.gradientCanvases[t];i||(i=document.createElement("canvas"),i.width=256,i.height=1,this.gradientCanvases[t]=i);const a=i.getContext("2d");for(let l=0;l<256;l++)a.fillStyle=c2(r.stops,l/255),a.fillRect(l,0,1,1);return this._updateTextureUniform(t,{type:"texture",src:i})}_updateTextureUniform(t,r){const i=this._getOrCreateTexture(t),a=r.src;if(typeof a=="string"){if(this.textureSrcs[t]!==a){this.textureSrcs[t]=a;const l=new Image;l.onload=()=>{this.textures[t]===i&&(of(this.gl,i,l,{minMag:this.gl.NEAREST,wrap:this.gl.CLAMP_TO_EDGE,auto:!1}),this.onTextureLoaded?.())},l.src=a}}else of(this.gl,i,a,{minMag:this.gl.NEAREST,wrap:this.gl.CLAMP_TO_EDGE,auto:!1});return i}render(){if(!this.error)for(let t=0;t<this.renderOrder.length;t++){const r=this.renderOrder[t],i=this.programs[r],a={...this.uniforms[r]};for(const[l,u]of Object.entries(a))e5(u)?a[l]=this._updateTextureUniform(`${r}::${l}`,u):t5(u)&&(a[l]=this._updateGradientUniform(`${r}::${l}`,u));for(const l of this.dependencyMapping[r])a[l.input]=this.fbos[l.from].attachments[0];this.gl.useProgram(i.program),t!==this.renderOrder.length-1?j1(this.gl,this.fbos[r]):j1(this.gl,null),r2(i,a),O4(this.gl,i,this.quad),U4(this.gl,this.quad)}}dispose(){for(const t of Object.values(this.programs))t&&t.program&&this.gl.deleteProgram(t.program);this.programs={};for(const t of Object.values(this.fbos)){for(const r of t.attachments)r instanceof WebGLTexture?this.gl.deleteTexture(r):r instanceof WebGLRenderbuffer&&this.gl.deleteRenderbuffer(r);this.gl.deleteFramebuffer(t.framebuffer)}this.fbos={};for(const t of Object.values(this.textures))this.gl.deleteTexture(t);this.textures={},this.textureSrcs={},this.gradientCanvases={},this.gl.deleteTexture(this.defaultTexture),this.quad.indices&&this.gl.deleteBuffer(this.quad.indices);for(const t of Object.values(this.quad.attribs??{}))t.buffer&&this.gl.deleteBuffer(t.buffer)}}const u2=R.forwardRef(({patch:e,uniforms:t,className:r,style:i,width:a=100,height:l=100,animate:u,onError:f},h)=>{const d=R.useRef(null);return R.useEffect(()=>{if(d.current){const p=d.current.getContext("webgl2",{preserveDrawingBuffer:!0}),g=new r5(p,e);f?.(g.error);let v=null;const x=()=>{g.uniforms=t.current,g.render()};return u?v=requestAnimationFrame(function b(){x(),v=requestAnimationFrame(b)}):(g.onTextureLoaded=x,x()),()=>{v!==null&&cancelAnimationFrame(v),g.dispose()}}},[e,a,l,u]),D.jsx("canvas",{className:`image-crisp ${r??""}`,style:i,width:a,height:l,ref:p=>{d.current=p,typeof h=="function"?h(p):h&&(h.current=p)}})}),Gt="([-\\d.]+)",Nn="\\s*,\\s*",js=e=>{const t=[],r=e.source.split(`
1761
+ `);for(const i of r){const a=i.trim(),l=a.match(new RegExp(`^uniform\\s+float\\s+(\\w+)\\s*;.*\\/\\/\\s*\\[\\s*${Gt}${Nn}${Gt}${Nn}${Gt}\\s*\\]`));if(l?.[1]){const E=parseFloat(l[2]),N=parseFloat(l[3]),w=parseFloat(l[4]);t.push({name:l[1],type:"float",min:E,max:N,default:w});continue}const u=a.match(/^uniform\s+float\s+(\w+)\s*;.*\/\/\s*time\b/);if(u?.[1]){t.push({name:u[1],type:"float",special:"time"});continue}const f=a.match(/^uniform\s+float\s+(\w+)\s*;/);if(f?.[1]){t.push({name:f[1],type:"float"});continue}const h=a.match(new RegExp(`^uniform\\s+vec2\\s+(\\w+)\\s*;.*\\/\\/\\s*\\[\\s*${Gt}${Nn}${Gt}\\s*\\]`));if(h?.[1]){const E=[parseFloat(h[2]),parseFloat(h[3])];t.push({name:h[1],type:"vec2",default:E});continue}const d=a.match(new RegExp(`^uniform\\s+vec3\\s+(\\w+)\\s*;.*\\/\\/\\s*color(?:\\s*\\[\\s*${Gt}${Nn}${Gt}${Nn}${Gt}\\s*\\])?`));if(d?.[1]){const E=d[2]!==void 0?[parseFloat(d[2]),parseFloat(d[3]),parseFloat(d[4])]:void 0;t.push({name:d[1],type:"vec3",color:!0,...E&&{default:E}});continue}const p=a.match(new RegExp(`^uniform\\s+vec3\\s+(\\w+)\\s*;.*\\/\\/\\s*\\[\\s*${Gt}${Nn}${Gt}${Nn}${Gt}\\s*\\]`));if(p?.[1]){const E=[parseFloat(p[2]),parseFloat(p[3]),parseFloat(p[4])];t.push({name:p[1],type:"vec3",default:E});continue}const g=a.match(new RegExp(`^uniform\\s+vec4\\s+(\\w+)\\s*;.*\\/\\/\\s*color(?:\\s*\\[\\s*${Gt}${Nn}${Gt}${Nn}${Gt}${Nn}${Gt}\\s*\\])?`));if(g?.[1]){const E=g[2]!==void 0?[parseFloat(g[2]),parseFloat(g[3]),parseFloat(g[4]),parseFloat(g[5])]:void 0;t.push({name:g[1],type:"vec4",color:!0,...E&&{default:E}});continue}const v=a.match(new RegExp(`^uniform\\s+vec4\\s+(\\w+)\\s*;.*\\/\\/\\s*\\[\\s*${Gt}${Nn}${Gt}${Nn}${Gt}${Nn}${Gt}\\s*\\]`));if(v?.[1]){const E=[parseFloat(v[2]),parseFloat(v[3]),parseFloat(v[4]),parseFloat(v[5])];t.push({name:v[1],type:"vec4",default:E});continue}const x=a.match(/^uniform\s+vec2\s+(\w+)\s*;.*\/\/\s*mouse\b/);if(x?.[1]){t.push({name:x[1],type:"vec2",special:"mouse"});continue}const b=a.match(/^uniform\s+vec2\s+(\w+)\s*;.*\/\/\s*resolution\b/);if(b?.[1]){t.push({name:b[1],type:"vec2",special:"resolution"});continue}const _=a.match(/^uniform\s+(vec[234])\s+(\w+)\s*;/);if(_){const E=_[1],N=_[2];E==="vec2"?t.push({name:N,type:"vec2"}):E==="vec3"?t.push({name:N,type:"vec3"}):E==="vec4"&&t.push({name:N,type:"vec4"});continue}const C=a.match(/^uniform\s+sampler2D\s+(\w+)\s*;(?:.*\/\/\s*(texture|gradient)\b)?/);if(C?.[1]){const E=C[2],N=E==="texture"?"texture":E==="gradient"?"gradient":"input";t.push({name:C[1],type:"sampler2D",source:N})}}return t};function o5(e,t){switch(t.type){case"float":return typeof e=="number";case"vec2":return Array.isArray(e)&&e.length===2;case"vec3":return Array.isArray(e)&&e.length===3;case"vec4":return Array.isArray(e)&&e.length===4;case"sampler2D":return t.source==="gradient"?e?.type==="gradient":t.source==="texture"?e?.type==="texture":!1}}function f2(e){switch(e.type){case"float":return e.default??0;case"vec2":return e.default??[0,0];case"vec3":return e.default??(e.color?[1,1,1]:[0,0,0]);case"vec4":return e.default??(e.color?[1,1,1,1]:[0,0,0,0]);case"sampler2D":return}}const i5=`import { RendererComponent, extractFields, type Uniforms, type Patch } from "@sequenza/lib";
1762
+ import "@sequenza/lib/style.css";
1763
+ import { useEffect, useRef } from "react";
1764
+
1765
+ function SequenzaComponent() {
1766
+ const uniformRef = useRef<Record<string, Uniforms>>(getInitialUniforms());
1767
+
1768
+ useEffect(() => {
1769
+ const patch = getPatch();
1770
+
1771
+ const timeFields: Array<{ shaderId: string; fieldName: string }> = [];
1772
+ const mouseFields: Array<{ shaderId: string; fieldName: string }> = [];
1773
+
1774
+ for (const shader of patch.shaders) {
1775
+ const fields = extractFields(shader);
1776
+ for (const field of fields) {
1777
+ if (field.type === "float" && field.special === "time") {
1778
+ timeFields.push({ shaderId: shader.id, fieldName: field.name });
1779
+ } else if (field.type === "vec2" && field.special === "mouse") {
1780
+ mouseFields.push({ shaderId: shader.id, fieldName: field.name });
1781
+ } else if (field.type === "vec2" && field.special === "resolution") {
1782
+ uniformRef.current[shader.id] ??= {};
1783
+ uniformRef.current[shader.id][field.name] = [
1784
+ shader.resolution.width,
1785
+ shader.resolution.height,
1786
+ ];
1787
+ }
1788
+ }
1789
+ }
1790
+
1791
+ let onMouseMove: ((e: MouseEvent) => void) | undefined;
1792
+ if (mouseFields.length > 0) {
1793
+ onMouseMove = (e: MouseEvent) => {
1794
+ const x = Math.min(1, e.clientX / window.innerWidth);
1795
+ const y = Math.min(1, e.clientY / window.innerHeight);
1796
+ for (const { shaderId, fieldName } of mouseFields) {
1797
+ uniformRef.current[shaderId] ??= {};
1798
+ uniformRef.current[shaderId][fieldName] = [x, y];
1799
+ }
1800
+ };
1801
+ window.addEventListener("mousemove", onMouseMove);
1802
+ }
1803
+
1804
+ let rafId: number | undefined;
1805
+ if (timeFields.length > 0) {
1806
+ const startTime = performance.now();
1807
+ const loop = () => {
1808
+ const elapsed = (performance.now() - startTime) / 1000;
1809
+ for (const { shaderId, fieldName } of timeFields) {
1810
+ uniformRef.current[shaderId] ??= {};
1811
+ uniformRef.current[shaderId][fieldName] = elapsed;
1812
+ }
1813
+ rafId = requestAnimationFrame(loop);
1814
+ };
1815
+ rafId = requestAnimationFrame(loop);
1816
+ }
1817
+
1818
+ return () => {
1819
+ if (onMouseMove) window.removeEventListener("mousemove", onMouseMove);
1820
+ if (rafId !== undefined) cancelAnimationFrame(rafId);
1821
+ };
1822
+ }, []);
1823
+
1824
+ return (
1825
+ <RendererComponent
1826
+ patch={getPatch()}
1827
+ uniforms={uniformRef}
1828
+ animate={true}
1829
+ width={100}
1830
+ height={100}
1831
+ ></RendererComponent>
1832
+ );
1833
+ }
1834
+
1835
+ export default SequenzaComponent;
1836
+
1837
+ function getInitialUniforms(): Record<string, Uniforms> {
1838
+ throw new Error("placeholder for initial uniforms");
1839
+ }
1840
+
1841
+ function getPatch(): Patch {
1842
+ throw new Error("placeholder for patch");
1843
+ }
1844
+ `;function s5(e,t){let r=i5;const i=Object.keys(e).filter(l=>t.shaders.some(u=>u.id===l)),a={};for(const l of i)a[l]=e[l];return r=r.replace('throw new Error("placeholder for initial uniforms");',`return ${JSON.stringify(a,null,2)};`),r=r.replace('throw new Error("placeholder for patch");',`return ${JSON.stringify(t,null,2)};`),r}function Ft(e){if(typeof e=="string"||typeof e=="number")return""+e;let t="";if(Array.isArray(e))for(let r=0,i;r<e.length;r++)(i=Ft(e[r]))!==""&&(t+=(t&&" ")+i);else for(let r in e)e[r]&&(t+=(t&&" ")+r);return t}var a5={value:()=>{}};function Xf(){for(var e=0,t=arguments.length,r={},i;e<t;++e){if(!(i=arguments[e]+"")||i in r||/[\s.]/.test(i))throw new Error("illegal type: "+i);r[i]=[]}return new Gu(r)}function Gu(e){this._=e}function l5(e,t){return e.trim().split(/^|\s+/).map(function(r){var i="",a=r.indexOf(".");if(a>=0&&(i=r.slice(a+1),r=r.slice(0,a)),r&&!t.hasOwnProperty(r))throw new Error("unknown type: "+r);return{type:r,name:i}})}Gu.prototype=Xf.prototype={constructor:Gu,on:function(e,t){var r=this._,i=l5(e+"",r),a,l=-1,u=i.length;if(arguments.length<2){for(;++l<u;)if((a=(e=i[l]).type)&&(a=c5(r[a],e.name)))return a;return}if(t!=null&&typeof t!="function")throw new Error("invalid callback: "+t);for(;++l<u;)if(a=(e=i[l]).type)r[a]=G1(r[a],e.name,t);else if(t==null)for(a in r)r[a]=G1(r[a],e.name,null);return this},copy:function(){var e={},t=this._;for(var r in t)e[r]=t[r].slice();return new Gu(e)},call:function(e,t){if((a=arguments.length-2)>0)for(var r=new Array(a),i=0,a,l;i<a;++i)r[i]=arguments[i+2];if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(l=this._[e],i=0,a=l.length;i<a;++i)l[i].value.apply(t,r)},apply:function(e,t,r){if(!this._.hasOwnProperty(e))throw new Error("unknown type: "+e);for(var i=this._[e],a=0,l=i.length;a<l;++a)i[a].value.apply(t,r)}};function c5(e,t){for(var r=0,i=e.length,a;r<i;++r)if((a=e[r]).name===t)return a.value}function G1(e,t,r){for(var i=0,a=e.length;i<a;++i)if(e[i].name===t){e[i]=a5,e=e.slice(0,i).concat(e.slice(i+1));break}return r!=null&&e.push({name:t,value:r}),e}var Cp="http://www.w3.org/1999/xhtml";const q1={svg:"http://www.w3.org/2000/svg",xhtml:Cp,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function $f(e){var t=e+="",r=t.indexOf(":");return r>=0&&(t=e.slice(0,r))!=="xmlns"&&(e=e.slice(r+1)),q1.hasOwnProperty(t)?{space:q1[t],local:e}:e}function u5(e){return function(){var t=this.ownerDocument,r=this.namespaceURI;return r===Cp&&t.documentElement.namespaceURI===Cp?t.createElement(e):t.createElementNS(r,e)}}function f5(e){return function(){return this.ownerDocument.createElementNS(e.space,e.local)}}function d2(e){var t=$f(e);return(t.local?f5:u5)(t)}function d5(){}function F0(e){return e==null?d5:function(){return this.querySelector(e)}}function h5(e){typeof e!="function"&&(e=F0(e));for(var t=this._groups,r=t.length,i=new Array(r),a=0;a<r;++a)for(var l=t[a],u=l.length,f=i[a]=new Array(u),h,d,p=0;p<u;++p)(h=l[p])&&(d=e.call(h,h.__data__,p,l))&&("__data__"in h&&(d.__data__=h.__data__),f[p]=d);return new zn(i,this._parents)}function m5(e){return e==null?[]:Array.isArray(e)?e:Array.from(e)}function p5(){return[]}function h2(e){return e==null?p5:function(){return this.querySelectorAll(e)}}function g5(e){return function(){return m5(e.apply(this,arguments))}}function y5(e){typeof e=="function"?e=g5(e):e=h2(e);for(var t=this._groups,r=t.length,i=[],a=[],l=0;l<r;++l)for(var u=t[l],f=u.length,h,d=0;d<f;++d)(h=u[d])&&(i.push(e.call(h,h.__data__,d,u)),a.push(h));return new zn(i,a)}function m2(e){return function(){return this.matches(e)}}function p2(e){return function(t){return t.matches(e)}}var v5=Array.prototype.find;function x5(e){return function(){return v5.call(this.children,e)}}function b5(){return this.firstElementChild}function _5(e){return this.select(e==null?b5:x5(typeof e=="function"?e:p2(e)))}var E5=Array.prototype.filter;function S5(){return Array.from(this.children)}function w5(e){return function(){return E5.call(this.children,e)}}function C5(e){return this.selectAll(e==null?S5:w5(typeof e=="function"?e:p2(e)))}function T5(e){typeof e!="function"&&(e=m2(e));for(var t=this._groups,r=t.length,i=new Array(r),a=0;a<r;++a)for(var l=t[a],u=l.length,f=i[a]=[],h,d=0;d<u;++d)(h=l[d])&&e.call(h,h.__data__,d,l)&&f.push(h);return new zn(i,this._parents)}function g2(e){return new Array(e.length)}function R5(){return new zn(this._enter||this._groups.map(g2),this._parents)}function af(e,t){this.ownerDocument=e.ownerDocument,this.namespaceURI=e.namespaceURI,this._next=null,this._parent=e,this.__data__=t}af.prototype={constructor:af,appendChild:function(e){return this._parent.insertBefore(e,this._next)},insertBefore:function(e,t){return this._parent.insertBefore(e,t)},querySelector:function(e){return this._parent.querySelector(e)},querySelectorAll:function(e){return this._parent.querySelectorAll(e)}};function A5(e){return function(){return e}}function N5(e,t,r,i,a,l){for(var u=0,f,h=t.length,d=l.length;u<d;++u)(f=t[u])?(f.__data__=l[u],i[u]=f):r[u]=new af(e,l[u]);for(;u<h;++u)(f=t[u])&&(a[u]=f)}function M5(e,t,r,i,a,l,u){var f,h,d=new Map,p=t.length,g=l.length,v=new Array(p),x;for(f=0;f<p;++f)(h=t[f])&&(v[f]=x=u.call(h,h.__data__,f,t)+"",d.has(x)?a[f]=h:d.set(x,h));for(f=0;f<g;++f)x=u.call(e,l[f],f,l)+"",(h=d.get(x))?(i[f]=h,h.__data__=l[f],d.delete(x)):r[f]=new af(e,l[f]);for(f=0;f<p;++f)(h=t[f])&&d.get(v[f])===h&&(a[f]=h)}function O5(e){return e.__data__}function D5(e,t){if(!arguments.length)return Array.from(this,O5);var r=t?M5:N5,i=this._parents,a=this._groups;typeof e!="function"&&(e=A5(e));for(var l=a.length,u=new Array(l),f=new Array(l),h=new Array(l),d=0;d<l;++d){var p=i[d],g=a[d],v=g.length,x=z5(e.call(p,p&&p.__data__,d,i)),b=x.length,_=f[d]=new Array(b),C=u[d]=new Array(b),E=h[d]=new Array(v);r(p,g,_,C,E,x,t);for(var N=0,w=0,A,M;N<b;++N)if(A=_[N]){for(N>=w&&(w=N+1);!(M=C[w])&&++w<b;);A._next=M||null}}return u=new zn(u,i),u._enter=f,u._exit=h,u}function z5(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function B5(){return new zn(this._exit||this._groups.map(g2),this._parents)}function U5(e,t,r){var i=this.enter(),a=this,l=this.exit();return typeof e=="function"?(i=e(i),i&&(i=i.selection())):i=i.append(e+""),t!=null&&(a=t(a),a&&(a=a.selection())),r==null?l.remove():r(l),i&&a?i.merge(a).order():a}function L5(e){for(var t=e.selection?e.selection():e,r=this._groups,i=t._groups,a=r.length,l=i.length,u=Math.min(a,l),f=new Array(a),h=0;h<u;++h)for(var d=r[h],p=i[h],g=d.length,v=f[h]=new Array(g),x,b=0;b<g;++b)(x=d[b]||p[b])&&(v[b]=x);for(;h<a;++h)f[h]=r[h];return new zn(f,this._parents)}function k5(){for(var e=this._groups,t=-1,r=e.length;++t<r;)for(var i=e[t],a=i.length-1,l=i[a],u;--a>=0;)(u=i[a])&&(l&&u.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(u,l),l=u);return this}function I5(e){e||(e=H5);function t(g,v){return g&&v?e(g.__data__,v.__data__):!g-!v}for(var r=this._groups,i=r.length,a=new Array(i),l=0;l<i;++l){for(var u=r[l],f=u.length,h=a[l]=new Array(f),d,p=0;p<f;++p)(d=u[p])&&(h[p]=d);h.sort(t)}return new zn(a,this._parents).order()}function H5(e,t){return e<t?-1:e>t?1:e>=t?0:NaN}function F5(){var e=arguments[0];return arguments[0]=this,e.apply(null,arguments),this}function P5(){return Array.from(this)}function j5(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var i=e[t],a=0,l=i.length;a<l;++a){var u=i[a];if(u)return u}return null}function V5(){let e=0;for(const t of this)++e;return e}function G5(){return!this.node()}function q5(e){for(var t=this._groups,r=0,i=t.length;r<i;++r)for(var a=t[r],l=0,u=a.length,f;l<u;++l)(f=a[l])&&e.call(f,f.__data__,l,a);return this}function Y5(e){return function(){this.removeAttribute(e)}}function X5(e){return function(){this.removeAttributeNS(e.space,e.local)}}function $5(e,t){return function(){this.setAttribute(e,t)}}function K5(e,t){return function(){this.setAttributeNS(e.space,e.local,t)}}function Z5(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttribute(e):this.setAttribute(e,r)}}function Q5(e,t){return function(){var r=t.apply(this,arguments);r==null?this.removeAttributeNS(e.space,e.local):this.setAttributeNS(e.space,e.local,r)}}function W5(e,t){var r=$f(e);if(arguments.length<2){var i=this.node();return r.local?i.getAttributeNS(r.space,r.local):i.getAttribute(r)}return this.each((t==null?r.local?X5:Y5:typeof t=="function"?r.local?Q5:Z5:r.local?K5:$5)(r,t))}function y2(e){return e.ownerDocument&&e.ownerDocument.defaultView||e.document&&e||e.defaultView}function J5(e){return function(){this.style.removeProperty(e)}}function e8(e,t,r){return function(){this.style.setProperty(e,t,r)}}function t8(e,t,r){return function(){var i=t.apply(this,arguments);i==null?this.style.removeProperty(e):this.style.setProperty(e,i,r)}}function n8(e,t,r){return arguments.length>1?this.each((t==null?J5:typeof t=="function"?t8:e8)(e,t,r??"")):Vs(this.node(),e)}function Vs(e,t){return e.style.getPropertyValue(t)||y2(e).getComputedStyle(e,null).getPropertyValue(t)}function r8(e){return function(){delete this[e]}}function o8(e,t){return function(){this[e]=t}}function i8(e,t){return function(){var r=t.apply(this,arguments);r==null?delete this[e]:this[e]=r}}function s8(e,t){return arguments.length>1?this.each((t==null?r8:typeof t=="function"?i8:o8)(e,t)):this.node()[e]}function v2(e){return e.trim().split(/^|\s+/)}function P0(e){return e.classList||new x2(e)}function x2(e){this._node=e,this._names=v2(e.getAttribute("class")||"")}x2.prototype={add:function(e){var t=this._names.indexOf(e);t<0&&(this._names.push(e),this._node.setAttribute("class",this._names.join(" ")))},remove:function(e){var t=this._names.indexOf(e);t>=0&&(this._names.splice(t,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(e){return this._names.indexOf(e)>=0}};function b2(e,t){for(var r=P0(e),i=-1,a=t.length;++i<a;)r.add(t[i])}function _2(e,t){for(var r=P0(e),i=-1,a=t.length;++i<a;)r.remove(t[i])}function a8(e){return function(){b2(this,e)}}function l8(e){return function(){_2(this,e)}}function c8(e,t){return function(){(t.apply(this,arguments)?b2:_2)(this,e)}}function u8(e,t){var r=v2(e+"");if(arguments.length<2){for(var i=P0(this.node()),a=-1,l=r.length;++a<l;)if(!i.contains(r[a]))return!1;return!0}return this.each((typeof t=="function"?c8:t?a8:l8)(r,t))}function f8(){this.textContent=""}function d8(e){return function(){this.textContent=e}}function h8(e){return function(){var t=e.apply(this,arguments);this.textContent=t??""}}function m8(e){return arguments.length?this.each(e==null?f8:(typeof e=="function"?h8:d8)(e)):this.node().textContent}function p8(){this.innerHTML=""}function g8(e){return function(){this.innerHTML=e}}function y8(e){return function(){var t=e.apply(this,arguments);this.innerHTML=t??""}}function v8(e){return arguments.length?this.each(e==null?p8:(typeof e=="function"?y8:g8)(e)):this.node().innerHTML}function x8(){this.nextSibling&&this.parentNode.appendChild(this)}function b8(){return this.each(x8)}function _8(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function E8(){return this.each(_8)}function S8(e){var t=typeof e=="function"?e:d2(e);return this.select(function(){return this.appendChild(t.apply(this,arguments))})}function w8(){return null}function C8(e,t){var r=typeof e=="function"?e:d2(e),i=t==null?w8:typeof t=="function"?t:F0(t);return this.select(function(){return this.insertBefore(r.apply(this,arguments),i.apply(this,arguments)||null)})}function T8(){var e=this.parentNode;e&&e.removeChild(this)}function R8(){return this.each(T8)}function A8(){var e=this.cloneNode(!1),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function N8(){var e=this.cloneNode(!0),t=this.parentNode;return t?t.insertBefore(e,this.nextSibling):e}function M8(e){return this.select(e?N8:A8)}function O8(e){return arguments.length?this.property("__data__",e):this.node().__data__}function D8(e){return function(t){e.call(this,t,this.__data__)}}function z8(e){return e.trim().split(/^|\s+/).map(function(t){var r="",i=t.indexOf(".");return i>=0&&(r=t.slice(i+1),t=t.slice(0,i)),{type:t,name:r}})}function B8(e){return function(){var t=this.__on;if(t){for(var r=0,i=-1,a=t.length,l;r<a;++r)l=t[r],(!e.type||l.type===e.type)&&l.name===e.name?this.removeEventListener(l.type,l.listener,l.options):t[++i]=l;++i?t.length=i:delete this.__on}}}function U8(e,t,r){return function(){var i=this.__on,a,l=D8(t);if(i){for(var u=0,f=i.length;u<f;++u)if((a=i[u]).type===e.type&&a.name===e.name){this.removeEventListener(a.type,a.listener,a.options),this.addEventListener(a.type,a.listener=l,a.options=r),a.value=t;return}}this.addEventListener(e.type,l,r),a={type:e.type,name:e.name,value:t,listener:l,options:r},i?i.push(a):this.__on=[a]}}function L8(e,t,r){var i=z8(e+""),a,l=i.length,u;if(arguments.length<2){var f=this.node().__on;if(f){for(var h=0,d=f.length,p;h<d;++h)for(a=0,p=f[h];a<l;++a)if((u=i[a]).type===p.type&&u.name===p.name)return p.value}return}for(f=t?U8:B8,a=0;a<l;++a)this.each(f(i[a],t,r));return this}function E2(e,t,r){var i=y2(e),a=i.CustomEvent;typeof a=="function"?a=new a(t,r):(a=i.document.createEvent("Event"),r?(a.initEvent(t,r.bubbles,r.cancelable),a.detail=r.detail):a.initEvent(t,!1,!1)),e.dispatchEvent(a)}function k8(e,t){return function(){return E2(this,e,t)}}function I8(e,t){return function(){return E2(this,e,t.apply(this,arguments))}}function H8(e,t){return this.each((typeof t=="function"?I8:k8)(e,t))}function*F8(){for(var e=this._groups,t=0,r=e.length;t<r;++t)for(var i=e[t],a=0,l=i.length,u;a<l;++a)(u=i[a])&&(yield u)}var S2=[null];function zn(e,t){this._groups=e,this._parents=t}function Il(){return new zn([[document.documentElement]],S2)}function P8(){return this}zn.prototype=Il.prototype={constructor:zn,select:h5,selectAll:y5,selectChild:_5,selectChildren:C5,filter:T5,data:D5,enter:R5,exit:B5,join:U5,merge:L5,selection:P8,order:k5,sort:I5,call:F5,nodes:P5,node:j5,size:V5,empty:G5,each:q5,attr:W5,style:n8,property:s8,classed:u8,text:m8,html:v8,raise:b8,lower:E8,append:S8,insert:C8,remove:R8,clone:M8,datum:O8,on:L8,dispatch:H8,[Symbol.iterator]:F8};function Dn(e){return typeof e=="string"?new zn([[document.querySelector(e)]],[document.documentElement]):new zn([[e]],S2)}function j8(e){let t;for(;t=e.sourceEvent;)e=t;return e}function er(e,t){if(e=j8(e),t===void 0&&(t=e.currentTarget),t){var r=t.ownerSVGElement||t;if(r.createSVGPoint){var i=r.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,i=i.matrixTransform(t.getScreenCTM().inverse()),[i.x,i.y]}if(t.getBoundingClientRect){var a=t.getBoundingClientRect();return[e.clientX-a.left-t.clientLeft,e.clientY-a.top-t.clientTop]}}return[e.pageX,e.pageY]}const V8={passive:!1},xl={capture:!0,passive:!1};function km(e){e.stopImmediatePropagation()}function Is(e){e.preventDefault(),e.stopImmediatePropagation()}function w2(e){var t=e.document.documentElement,r=Dn(e).on("dragstart.drag",Is,xl);"onselectstart"in t?r.on("selectstart.drag",Is,xl):(t.__noselect=t.style.MozUserSelect,t.style.MozUserSelect="none")}function C2(e,t){var r=e.document.documentElement,i=Dn(e).on("dragstart.drag",null);t&&(i.on("click.drag",Is,xl),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in r?i.on("selectstart.drag",null):(r.style.MozUserSelect=r.__noselect,delete r.__noselect)}const _u=e=>()=>e;function Tp(e,{sourceEvent:t,subject:r,target:i,identifier:a,active:l,x:u,y:f,dx:h,dy:d,dispatch:p}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},subject:{value:r,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:a,enumerable:!0,configurable:!0},active:{value:l,enumerable:!0,configurable:!0},x:{value:u,enumerable:!0,configurable:!0},y:{value:f,enumerable:!0,configurable:!0},dx:{value:h,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:p}})}Tp.prototype.on=function(){var e=this._.on.apply(this._,arguments);return e===this._?this:e};function G8(e){return!e.ctrlKey&&!e.button}function q8(){return this.parentNode}function Y8(e,t){return t??{x:e.x,y:e.y}}function X8(){return navigator.maxTouchPoints||"ontouchstart"in this}function T2(){var e=G8,t=q8,r=Y8,i=X8,a={},l=Xf("start","drag","end"),u=0,f,h,d,p,g=0;function v(A){A.on("mousedown.drag",x).filter(i).on("touchstart.drag",C).on("touchmove.drag",E,V8).on("touchend.drag touchcancel.drag",N).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function x(A,M){if(!(p||!e.call(this,A,M))){var T=w(this,t.call(this,A,M),A,M,"mouse");T&&(Dn(A.view).on("mousemove.drag",b,xl).on("mouseup.drag",_,xl),w2(A.view),km(A),d=!1,f=A.clientX,h=A.clientY,T("start",A))}}function b(A){if(Is(A),!d){var M=A.clientX-f,T=A.clientY-h;d=M*M+T*T>g}a.mouse("drag",A)}function _(A){Dn(A.view).on("mousemove.drag mouseup.drag",null),C2(A.view,d),Is(A),a.mouse("end",A)}function C(A,M){if(e.call(this,A,M)){var T=A.changedTouches,O=t.call(this,A,M),I=T.length,j,Z;for(j=0;j<I;++j)(Z=w(this,O,A,M,T[j].identifier,T[j]))&&(km(A),Z("start",A,T[j]))}}function E(A){var M=A.changedTouches,T=M.length,O,I;for(O=0;O<T;++O)(I=a[M[O].identifier])&&(Is(A),I("drag",A,M[O]))}function N(A){var M=A.changedTouches,T=M.length,O,I;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),O=0;O<T;++O)(I=a[M[O].identifier])&&(km(A),I("end",A,M[O]))}function w(A,M,T,O,I,j){var Z=l.copy(),P=er(j||T,M),q,G,k;if((k=r.call(A,new Tp("beforestart",{sourceEvent:T,target:v,identifier:I,active:u,x:P[0],y:P[1],dx:0,dy:0,dispatch:Z}),O))!=null)return q=k.x-P[0]||0,G=k.y-P[1]||0,function F(z,L,H){var X=P,Q;switch(z){case"start":a[I]=F,Q=u++;break;case"end":delete a[I],--u;case"drag":P=er(H||L,M),Q=u;break}Z.call(z,A,new Tp(z,{sourceEvent:L,subject:k,target:v,identifier:I,active:Q,x:P[0]+q,y:P[1]+G,dx:P[0]-X[0],dy:P[1]-X[1],dispatch:Z}),O)}}return v.filter=function(A){return arguments.length?(e=typeof A=="function"?A:_u(!!A),v):e},v.container=function(A){return arguments.length?(t=typeof A=="function"?A:_u(A),v):t},v.subject=function(A){return arguments.length?(r=typeof A=="function"?A:_u(A),v):r},v.touchable=function(A){return arguments.length?(i=typeof A=="function"?A:_u(!!A),v):i},v.on=function(){var A=l.on.apply(l,arguments);return A===l?v:A},v.clickDistance=function(A){return arguments.length?(g=(A=+A)*A,v):Math.sqrt(g)},v}function j0(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function R2(e,t){var r=Object.create(e.prototype);for(var i in t)r[i]=t[i];return r}function Hl(){}var bl=.7,lf=1/bl,Hs="\\s*([+-]?\\d+)\\s*",_l="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",vr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",$8=/^#([0-9a-f]{3,8})$/,K8=new RegExp(`^rgb\\(${Hs},${Hs},${Hs}\\)$`),Z8=new RegExp(`^rgb\\(${vr},${vr},${vr}\\)$`),Q8=new RegExp(`^rgba\\(${Hs},${Hs},${Hs},${_l}\\)$`),W8=new RegExp(`^rgba\\(${vr},${vr},${vr},${_l}\\)$`),J8=new RegExp(`^hsl\\(${_l},${vr},${vr}\\)$`),ez=new RegExp(`^hsla\\(${_l},${vr},${vr},${_l}\\)$`),Y1={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};j0(Hl,Ui,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:X1,formatHex:X1,formatHex8:tz,formatHsl:nz,formatRgb:$1,toString:$1});function X1(){return this.rgb().formatHex()}function tz(){return this.rgb().formatHex8()}function nz(){return A2(this).formatHsl()}function $1(){return this.rgb().formatRgb()}function Ui(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=$8.exec(e))?(r=t[1].length,t=parseInt(t[1],16),r===6?K1(t):r===3?new vn(t>>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):r===8?Eu(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):r===4?Eu(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=K8.exec(e))?new vn(t[1],t[2],t[3],1):(t=Z8.exec(e))?new vn(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Q8.exec(e))?Eu(t[1],t[2],t[3],t[4]):(t=W8.exec(e))?Eu(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=J8.exec(e))?W1(t[1],t[2]/100,t[3]/100,1):(t=ez.exec(e))?W1(t[1],t[2]/100,t[3]/100,t[4]):Y1.hasOwnProperty(e)?K1(Y1[e]):e==="transparent"?new vn(NaN,NaN,NaN,0):null}function K1(e){return new vn(e>>16&255,e>>8&255,e&255,1)}function Eu(e,t,r,i){return i<=0&&(e=t=r=NaN),new vn(e,t,r,i)}function rz(e){return e instanceof Hl||(e=Ui(e)),e?(e=e.rgb(),new vn(e.r,e.g,e.b,e.opacity)):new vn}function Rp(e,t,r,i){return arguments.length===1?rz(e):new vn(e,t,r,i??1)}function vn(e,t,r,i){this.r=+e,this.g=+t,this.b=+r,this.opacity=+i}j0(vn,Rp,R2(Hl,{brighter(e){return e=e==null?lf:Math.pow(lf,e),new vn(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?bl:Math.pow(bl,e),new vn(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new vn(Di(this.r),Di(this.g),Di(this.b),cf(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Z1,formatHex:Z1,formatHex8:oz,formatRgb:Q1,toString:Q1}));function Z1(){return`#${Mi(this.r)}${Mi(this.g)}${Mi(this.b)}`}function oz(){return`#${Mi(this.r)}${Mi(this.g)}${Mi(this.b)}${Mi((isNaN(this.opacity)?1:this.opacity)*255)}`}function Q1(){const e=cf(this.opacity);return`${e===1?"rgb(":"rgba("}${Di(this.r)}, ${Di(this.g)}, ${Di(this.b)}${e===1?")":`, ${e})`}`}function cf(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Di(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function Mi(e){return e=Di(e),(e<16?"0":"")+e.toString(16)}function W1(e,t,r,i){return i<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new tr(e,t,r,i)}function A2(e){if(e instanceof tr)return new tr(e.h,e.s,e.l,e.opacity);if(e instanceof Hl||(e=Ui(e)),!e)return new tr;if(e instanceof tr)return e;e=e.rgb();var t=e.r/255,r=e.g/255,i=e.b/255,a=Math.min(t,r,i),l=Math.max(t,r,i),u=NaN,f=l-a,h=(l+a)/2;return f?(t===l?u=(r-i)/f+(r<i)*6:r===l?u=(i-t)/f+2:u=(t-r)/f+4,f/=h<.5?l+a:2-l-a,u*=60):f=h>0&&h<1?0:u,new tr(u,f,h,e.opacity)}function iz(e,t,r,i){return arguments.length===1?A2(e):new tr(e,t,r,i??1)}function tr(e,t,r,i){this.h=+e,this.s=+t,this.l=+r,this.opacity=+i}j0(tr,iz,R2(Hl,{brighter(e){return e=e==null?lf:Math.pow(lf,e),new tr(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?bl:Math.pow(bl,e),new tr(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,i=r+(r<.5?r:1-r)*t,a=2*r-i;return new vn(Im(e>=240?e-240:e+120,a,i),Im(e,a,i),Im(e<120?e+240:e-120,a,i),this.opacity)},clamp(){return new tr(J1(this.h),Su(this.s),Su(this.l),cf(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const e=cf(this.opacity);return`${e===1?"hsl(":"hsla("}${J1(this.h)}, ${Su(this.s)*100}%, ${Su(this.l)*100}%${e===1?")":`, ${e})`}`}}));function J1(e){return e=(e||0)%360,e<0?e+360:e}function Su(e){return Math.max(0,Math.min(1,e||0))}function Im(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}const V0=e=>()=>e;function sz(e,t){return function(r){return e+r*t}}function az(e,t,r){return e=Math.pow(e,r),t=Math.pow(t,r)-e,r=1/r,function(i){return Math.pow(e+i*t,r)}}function lz(e){return(e=+e)==1?N2:function(t,r){return r-t?az(t,r,e):V0(isNaN(t)?r:t)}}function N2(e,t){var r=t-e;return r?sz(e,r):V0(isNaN(e)?t:e)}const uf=(function e(t){var r=lz(t);function i(a,l){var u=r((a=Rp(a)).r,(l=Rp(l)).r),f=r(a.g,l.g),h=r(a.b,l.b),d=N2(a.opacity,l.opacity);return function(p){return a.r=u(p),a.g=f(p),a.b=h(p),a.opacity=d(p),a+""}}return i.gamma=e,i})(1);function cz(e,t){t||(t=[]);var r=e?Math.min(t.length,e.length):0,i=t.slice(),a;return function(l){for(a=0;a<r;++a)i[a]=e[a]*(1-l)+t[a]*l;return i}}function uz(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function fz(e,t){var r=t?t.length:0,i=e?Math.min(r,e.length):0,a=new Array(i),l=new Array(r),u;for(u=0;u<i;++u)a[u]=ul(e[u],t[u]);for(;u<r;++u)l[u]=t[u];return function(f){for(u=0;u<i;++u)l[u]=a[u](f);return l}}function dz(e,t){var r=new Date;return e=+e,t=+t,function(i){return r.setTime(e*(1-i)+t*i),r}}function mr(e,t){return e=+e,t=+t,function(r){return e*(1-r)+t*r}}function hz(e,t){var r={},i={},a;(e===null||typeof e!="object")&&(e={}),(t===null||typeof t!="object")&&(t={});for(a in t)a in e?r[a]=ul(e[a],t[a]):i[a]=t[a];return function(l){for(a in r)i[a]=r[a](l);return i}}var Ap=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Hm=new RegExp(Ap.source,"g");function mz(e){return function(){return e}}function pz(e){return function(t){return e(t)+""}}function M2(e,t){var r=Ap.lastIndex=Hm.lastIndex=0,i,a,l,u=-1,f=[],h=[];for(e=e+"",t=t+"";(i=Ap.exec(e))&&(a=Hm.exec(t));)(l=a.index)>r&&(l=t.slice(r,l),f[u]?f[u]+=l:f[++u]=l),(i=i[0])===(a=a[0])?f[u]?f[u]+=a:f[++u]=a:(f[++u]=null,h.push({i:u,x:mr(i,a)})),r=Hm.lastIndex;return r<t.length&&(l=t.slice(r),f[u]?f[u]+=l:f[++u]=l),f.length<2?h[0]?pz(h[0].x):mz(t):(t=h.length,function(d){for(var p=0,g;p<t;++p)f[(g=h[p]).i]=g.x(d);return f.join("")})}function ul(e,t){var r=typeof t,i;return t==null||r==="boolean"?V0(t):(r==="number"?mr:r==="string"?(i=Ui(t))?(t=i,uf):M2:t instanceof Ui?uf:t instanceof Date?dz:uz(t)?cz:Array.isArray(t)?fz:typeof t.valueOf!="function"&&typeof t.toString!="function"||isNaN(t)?hz:mr)(e,t)}var e_=180/Math.PI,Np={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function O2(e,t,r,i,a,l){var u,f,h;return(u=Math.sqrt(e*e+t*t))&&(e/=u,t/=u),(h=e*r+t*i)&&(r-=e*h,i-=t*h),(f=Math.sqrt(r*r+i*i))&&(r/=f,i/=f,h/=f),e*i<t*r&&(e=-e,t=-t,h=-h,u=-u),{translateX:a,translateY:l,rotate:Math.atan2(t,e)*e_,skewX:Math.atan(h)*e_,scaleX:u,scaleY:f}}var wu;function gz(e){const t=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(e+"");return t.isIdentity?Np:O2(t.a,t.b,t.c,t.d,t.e,t.f)}function yz(e){return e==null||(wu||(wu=document.createElementNS("http://www.w3.org/2000/svg","g")),wu.setAttribute("transform",e),!(e=wu.transform.baseVal.consolidate()))?Np:(e=e.matrix,O2(e.a,e.b,e.c,e.d,e.e,e.f))}function D2(e,t,r,i){function a(d){return d.length?d.pop()+" ":""}function l(d,p,g,v,x,b){if(d!==g||p!==v){var _=x.push("translate(",null,t,null,r);b.push({i:_-4,x:mr(d,g)},{i:_-2,x:mr(p,v)})}else(g||v)&&x.push("translate("+g+t+v+r)}function u(d,p,g,v){d!==p?(d-p>180?p+=360:p-d>180&&(d+=360),v.push({i:g.push(a(g)+"rotate(",null,i)-2,x:mr(d,p)})):p&&g.push(a(g)+"rotate("+p+i)}function f(d,p,g,v){d!==p?v.push({i:g.push(a(g)+"skewX(",null,i)-2,x:mr(d,p)}):p&&g.push(a(g)+"skewX("+p+i)}function h(d,p,g,v,x,b){if(d!==g||p!==v){var _=x.push(a(x)+"scale(",null,",",null,")");b.push({i:_-4,x:mr(d,g)},{i:_-2,x:mr(p,v)})}else(g!==1||v!==1)&&x.push(a(x)+"scale("+g+","+v+")")}return function(d,p){var g=[],v=[];return d=e(d),p=e(p),l(d.translateX,d.translateY,p.translateX,p.translateY,g,v),u(d.rotate,p.rotate,g,v),f(d.skewX,p.skewX,g,v),h(d.scaleX,d.scaleY,p.scaleX,p.scaleY,g,v),d=p=null,function(x){for(var b=-1,_=v.length,C;++b<_;)g[(C=v[b]).i]=C.x(x);return g.join("")}}}var vz=D2(gz,"px, ","px)","deg)"),xz=D2(yz,", ",")",")"),bz=1e-12;function t_(e){return((e=Math.exp(e))+1/e)/2}function _z(e){return((e=Math.exp(e))-1/e)/2}function Ez(e){return((e=Math.exp(2*e))-1)/(e+1)}const qu=(function e(t,r,i){function a(l,u){var f=l[0],h=l[1],d=l[2],p=u[0],g=u[1],v=u[2],x=p-f,b=g-h,_=x*x+b*b,C,E;if(_<bz)E=Math.log(v/d)/t,C=function(O){return[f+O*x,h+O*b,d*Math.exp(t*O*E)]};else{var N=Math.sqrt(_),w=(v*v-d*d+i*_)/(2*d*r*N),A=(v*v-d*d-i*_)/(2*v*r*N),M=Math.log(Math.sqrt(w*w+1)-w),T=Math.log(Math.sqrt(A*A+1)-A);E=(T-M)/t,C=function(O){var I=O*E,j=t_(M),Z=d/(r*N)*(j*Ez(t*I+M)-_z(M));return[f+Z*x,h+Z*b,d*j/t_(t*I+M)]}}return C.duration=E*1e3*t/Math.SQRT2,C}return a.rho=function(l){var u=Math.max(.001,+l),f=u*u,h=f*f;return e(u,f,h)},a})(Math.SQRT2,2,4);var Gs=0,al=0,tl=0,z2=1e3,ff,ll,df=0,Li=0,Kf=0,El=typeof performance=="object"&&performance.now?performance:Date,B2=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function G0(){return Li||(B2(Sz),Li=El.now()+Kf)}function Sz(){Li=0}function hf(){this._call=this._time=this._next=null}hf.prototype=U2.prototype={constructor:hf,restart:function(e,t,r){if(typeof e!="function")throw new TypeError("callback is not a function");r=(r==null?G0():+r)+(t==null?0:+t),!this._next&&ll!==this&&(ll?ll._next=this:ff=this,ll=this),this._call=e,this._time=r,Mp()},stop:function(){this._call&&(this._call=null,this._time=1/0,Mp())}};function U2(e,t,r){var i=new hf;return i.restart(e,t,r),i}function wz(){G0(),++Gs;for(var e=ff,t;e;)(t=Li-e._time)>=0&&e._call.call(void 0,t),e=e._next;--Gs}function n_(){Li=(df=El.now())+Kf,Gs=al=0;try{wz()}finally{Gs=0,Tz(),Li=0}}function Cz(){var e=El.now(),t=e-df;t>z2&&(Kf-=t,df=e)}function Tz(){for(var e,t=ff,r,i=1/0;t;)t._call?(i>t._time&&(i=t._time),e=t,t=t._next):(r=t._next,t._next=null,t=e?e._next=r:ff=r);ll=e,Mp(i)}function Mp(e){if(!Gs){al&&(al=clearTimeout(al));var t=e-Li;t>24?(e<1/0&&(al=setTimeout(n_,e-El.now()-Kf)),tl&&(tl=clearInterval(tl))):(tl||(df=El.now(),tl=setInterval(Cz,z2)),Gs=1,B2(n_))}}function r_(e,t,r){var i=new hf;return t=t==null?0:+t,i.restart(a=>{i.stop(),e(a+t)},t,r),i}var Rz=Xf("start","end","cancel","interrupt"),Az=[],L2=0,o_=1,Op=2,Yu=3,i_=4,Dp=5,Xu=6;function Zf(e,t,r,i,a,l){var u=e.__transition;if(!u)e.__transition={};else if(r in u)return;Nz(e,r,{name:t,index:i,group:a,on:Rz,tween:Az,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:L2})}function q0(e,t){var r=ar(e,t);if(r.state>L2)throw new Error("too late; already scheduled");return r}function Rr(e,t){var r=ar(e,t);if(r.state>Yu)throw new Error("too late; already running");return r}function ar(e,t){var r=e.__transition;if(!r||!(r=r[t]))throw new Error("transition not found");return r}function Nz(e,t,r){var i=e.__transition,a;i[t]=r,r.timer=U2(l,0,r.time);function l(d){r.state=o_,r.timer.restart(u,r.delay,r.time),r.delay<=d&&u(d-r.delay)}function u(d){var p,g,v,x;if(r.state!==o_)return h();for(p in i)if(x=i[p],x.name===r.name){if(x.state===Yu)return r_(u);x.state===i_?(x.state=Xu,x.timer.stop(),x.on.call("interrupt",e,e.__data__,x.index,x.group),delete i[p]):+p<t&&(x.state=Xu,x.timer.stop(),x.on.call("cancel",e,e.__data__,x.index,x.group),delete i[p])}if(r_(function(){r.state===Yu&&(r.state=i_,r.timer.restart(f,r.delay,r.time),f(d))}),r.state=Op,r.on.call("start",e,e.__data__,r.index,r.group),r.state===Op){for(r.state=Yu,a=new Array(v=r.tween.length),p=0,g=-1;p<v;++p)(x=r.tween[p].value.call(e,e.__data__,r.index,r.group))&&(a[++g]=x);a.length=g+1}}function f(d){for(var p=d<r.duration?r.ease.call(null,d/r.duration):(r.timer.restart(h),r.state=Dp,1),g=-1,v=a.length;++g<v;)a[g].call(e,p);r.state===Dp&&(r.on.call("end",e,e.__data__,r.index,r.group),h())}function h(){r.state=Xu,r.timer.stop(),delete i[t];for(var d in i)return;delete e.__transition}}function $u(e,t){var r=e.__transition,i,a,l=!0,u;if(r){t=t==null?null:t+"";for(u in r){if((i=r[u]).name!==t){l=!1;continue}a=i.state>Op&&i.state<Dp,i.state=Xu,i.timer.stop(),i.on.call(a?"interrupt":"cancel",e,e.__data__,i.index,i.group),delete r[u]}l&&delete e.__transition}}function Mz(e){return this.each(function(){$u(this,e)})}function Oz(e,t){var r,i;return function(){var a=Rr(this,e),l=a.tween;if(l!==r){i=r=l;for(var u=0,f=i.length;u<f;++u)if(i[u].name===t){i=i.slice(),i.splice(u,1);break}}a.tween=i}}function Dz(e,t,r){var i,a;if(typeof r!="function")throw new Error;return function(){var l=Rr(this,e),u=l.tween;if(u!==i){a=(i=u).slice();for(var f={name:t,value:r},h=0,d=a.length;h<d;++h)if(a[h].name===t){a[h]=f;break}h===d&&a.push(f)}l.tween=a}}function zz(e,t){var r=this._id;if(e+="",arguments.length<2){for(var i=ar(this.node(),r).tween,a=0,l=i.length,u;a<l;++a)if((u=i[a]).name===e)return u.value;return null}return this.each((t==null?Oz:Dz)(r,e,t))}function Y0(e,t,r){var i=e._id;return e.each(function(){var a=Rr(this,i);(a.value||(a.value={}))[t]=r.apply(this,arguments)}),function(a){return ar(a,i).value[t]}}function k2(e,t){var r;return(typeof t=="number"?mr:t instanceof Ui?uf:(r=Ui(t))?(t=r,uf):M2)(e,t)}function Bz(e){return function(){this.removeAttribute(e)}}function Uz(e){return function(){this.removeAttributeNS(e.space,e.local)}}function Lz(e,t,r){var i,a=r+"",l;return function(){var u=this.getAttribute(e);return u===a?null:u===i?l:l=t(i=u,r)}}function kz(e,t,r){var i,a=r+"",l;return function(){var u=this.getAttributeNS(e.space,e.local);return u===a?null:u===i?l:l=t(i=u,r)}}function Iz(e,t,r){var i,a,l;return function(){var u,f=r(this),h;return f==null?void this.removeAttribute(e):(u=this.getAttribute(e),h=f+"",u===h?null:u===i&&h===a?l:(a=h,l=t(i=u,f)))}}function Hz(e,t,r){var i,a,l;return function(){var u,f=r(this),h;return f==null?void this.removeAttributeNS(e.space,e.local):(u=this.getAttributeNS(e.space,e.local),h=f+"",u===h?null:u===i&&h===a?l:(a=h,l=t(i=u,f)))}}function Fz(e,t){var r=$f(e),i=r==="transform"?xz:k2;return this.attrTween(e,typeof t=="function"?(r.local?Hz:Iz)(r,i,Y0(this,"attr."+e,t)):t==null?(r.local?Uz:Bz)(r):(r.local?kz:Lz)(r,i,t))}function Pz(e,t){return function(r){this.setAttribute(e,t.call(this,r))}}function jz(e,t){return function(r){this.setAttributeNS(e.space,e.local,t.call(this,r))}}function Vz(e,t){var r,i;function a(){var l=t.apply(this,arguments);return l!==i&&(r=(i=l)&&jz(e,l)),r}return a._value=t,a}function Gz(e,t){var r,i;function a(){var l=t.apply(this,arguments);return l!==i&&(r=(i=l)&&Pz(e,l)),r}return a._value=t,a}function qz(e,t){var r="attr."+e;if(arguments.length<2)return(r=this.tween(r))&&r._value;if(t==null)return this.tween(r,null);if(typeof t!="function")throw new Error;var i=$f(e);return this.tween(r,(i.local?Vz:Gz)(i,t))}function Yz(e,t){return function(){q0(this,e).delay=+t.apply(this,arguments)}}function Xz(e,t){return t=+t,function(){q0(this,e).delay=t}}function $z(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Yz:Xz)(t,e)):ar(this.node(),t).delay}function Kz(e,t){return function(){Rr(this,e).duration=+t.apply(this,arguments)}}function Zz(e,t){return t=+t,function(){Rr(this,e).duration=t}}function Qz(e){var t=this._id;return arguments.length?this.each((typeof e=="function"?Kz:Zz)(t,e)):ar(this.node(),t).duration}function Wz(e,t){if(typeof t!="function")throw new Error;return function(){Rr(this,e).ease=t}}function Jz(e){var t=this._id;return arguments.length?this.each(Wz(t,e)):ar(this.node(),t).ease}function e6(e,t){return function(){var r=t.apply(this,arguments);if(typeof r!="function")throw new Error;Rr(this,e).ease=r}}function t6(e){if(typeof e!="function")throw new Error;return this.each(e6(this._id,e))}function n6(e){typeof e!="function"&&(e=m2(e));for(var t=this._groups,r=t.length,i=new Array(r),a=0;a<r;++a)for(var l=t[a],u=l.length,f=i[a]=[],h,d=0;d<u;++d)(h=l[d])&&e.call(h,h.__data__,d,l)&&f.push(h);return new no(i,this._parents,this._name,this._id)}function r6(e){if(e._id!==this._id)throw new Error;for(var t=this._groups,r=e._groups,i=t.length,a=r.length,l=Math.min(i,a),u=new Array(i),f=0;f<l;++f)for(var h=t[f],d=r[f],p=h.length,g=u[f]=new Array(p),v,x=0;x<p;++x)(v=h[x]||d[x])&&(g[x]=v);for(;f<i;++f)u[f]=t[f];return new no(u,this._parents,this._name,this._id)}function o6(e){return(e+"").trim().split(/^|\s+/).every(function(t){var r=t.indexOf(".");return r>=0&&(t=t.slice(0,r)),!t||t==="start"})}function i6(e,t,r){var i,a,l=o6(t)?q0:Rr;return function(){var u=l(this,e),f=u.on;f!==i&&(a=(i=f).copy()).on(t,r),u.on=a}}function s6(e,t){var r=this._id;return arguments.length<2?ar(this.node(),r).on.on(e):this.each(i6(r,e,t))}function a6(e){return function(){var t=this.parentNode;for(var r in this.__transition)if(+r!==e)return;t&&t.removeChild(this)}}function l6(){return this.on("end.remove",a6(this._id))}function c6(e){var t=this._name,r=this._id;typeof e!="function"&&(e=F0(e));for(var i=this._groups,a=i.length,l=new Array(a),u=0;u<a;++u)for(var f=i[u],h=f.length,d=l[u]=new Array(h),p,g,v=0;v<h;++v)(p=f[v])&&(g=e.call(p,p.__data__,v,f))&&("__data__"in p&&(g.__data__=p.__data__),d[v]=g,Zf(d[v],t,r,v,d,ar(p,r)));return new no(l,this._parents,t,r)}function u6(e){var t=this._name,r=this._id;typeof e!="function"&&(e=h2(e));for(var i=this._groups,a=i.length,l=[],u=[],f=0;f<a;++f)for(var h=i[f],d=h.length,p,g=0;g<d;++g)if(p=h[g]){for(var v=e.call(p,p.__data__,g,h),x,b=ar(p,r),_=0,C=v.length;_<C;++_)(x=v[_])&&Zf(x,t,r,_,v,b);l.push(v),u.push(p)}return new no(l,u,t,r)}var f6=Il.prototype.constructor;function d6(){return new f6(this._groups,this._parents)}function h6(e,t){var r,i,a;return function(){var l=Vs(this,e),u=(this.style.removeProperty(e),Vs(this,e));return l===u?null:l===r&&u===i?a:a=t(r=l,i=u)}}function I2(e){return function(){this.style.removeProperty(e)}}function m6(e,t,r){var i,a=r+"",l;return function(){var u=Vs(this,e);return u===a?null:u===i?l:l=t(i=u,r)}}function p6(e,t,r){var i,a,l;return function(){var u=Vs(this,e),f=r(this),h=f+"";return f==null&&(h=f=(this.style.removeProperty(e),Vs(this,e))),u===h?null:u===i&&h===a?l:(a=h,l=t(i=u,f))}}function g6(e,t){var r,i,a,l="style."+t,u="end."+l,f;return function(){var h=Rr(this,e),d=h.on,p=h.value[l]==null?f||(f=I2(t)):void 0;(d!==r||a!==p)&&(i=(r=d).copy()).on(u,a=p),h.on=i}}function y6(e,t,r){var i=(e+="")=="transform"?vz:k2;return t==null?this.styleTween(e,h6(e,i)).on("end.style."+e,I2(e)):typeof t=="function"?this.styleTween(e,p6(e,i,Y0(this,"style."+e,t))).each(g6(this._id,e)):this.styleTween(e,m6(e,i,t),r).on("end.style."+e,null)}function v6(e,t,r){return function(i){this.style.setProperty(e,t.call(this,i),r)}}function x6(e,t,r){var i,a;function l(){var u=t.apply(this,arguments);return u!==a&&(i=(a=u)&&v6(e,u,r)),i}return l._value=t,l}function b6(e,t,r){var i="style."+(e+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(t==null)return this.tween(i,null);if(typeof t!="function")throw new Error;return this.tween(i,x6(e,t,r??""))}function _6(e){return function(){this.textContent=e}}function E6(e){return function(){var t=e(this);this.textContent=t??""}}function S6(e){return this.tween("text",typeof e=="function"?E6(Y0(this,"text",e)):_6(e==null?"":e+""))}function w6(e){return function(t){this.textContent=e.call(this,t)}}function C6(e){var t,r;function i(){var a=e.apply(this,arguments);return a!==r&&(t=(r=a)&&w6(a)),t}return i._value=e,i}function T6(e){var t="text";if(arguments.length<1)return(t=this.tween(t))&&t._value;if(e==null)return this.tween(t,null);if(typeof e!="function")throw new Error;return this.tween(t,C6(e))}function R6(){for(var e=this._name,t=this._id,r=H2(),i=this._groups,a=i.length,l=0;l<a;++l)for(var u=i[l],f=u.length,h,d=0;d<f;++d)if(h=u[d]){var p=ar(h,t);Zf(h,e,r,d,u,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new no(i,this._parents,e,r)}function A6(){var e,t,r=this,i=r._id,a=r.size();return new Promise(function(l,u){var f={value:u},h={value:function(){--a===0&&l()}};r.each(function(){var d=Rr(this,i),p=d.on;p!==e&&(t=(e=p).copy(),t._.cancel.push(f),t._.interrupt.push(f),t._.end.push(h)),d.on=t}),a===0&&l()})}var N6=0;function no(e,t,r,i){this._groups=e,this._parents=t,this._name=r,this._id=i}function H2(){return++N6}var Qr=Il.prototype;no.prototype={constructor:no,select:c6,selectAll:u6,selectChild:Qr.selectChild,selectChildren:Qr.selectChildren,filter:n6,merge:r6,selection:d6,transition:R6,call:Qr.call,nodes:Qr.nodes,node:Qr.node,size:Qr.size,empty:Qr.empty,each:Qr.each,on:s6,attr:Fz,attrTween:qz,style:y6,styleTween:b6,text:S6,textTween:T6,remove:l6,tween:zz,delay:$z,duration:Qz,ease:Jz,easeVarying:t6,end:A6,[Symbol.iterator]:Qr[Symbol.iterator]};function M6(e){return((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2}var O6={time:null,delay:0,duration:250,ease:M6};function D6(e,t){for(var r;!(r=e.__transition)||!(r=r[t]);)if(!(e=e.parentNode))throw new Error(`transition ${t} not found`);return r}function z6(e){var t,r;e instanceof no?(t=e._id,e=e._name):(t=H2(),(r=O6).time=G0(),e=e==null?null:e+"");for(var i=this._groups,a=i.length,l=0;l<a;++l)for(var u=i[l],f=u.length,h,d=0;d<f;++d)(h=u[d])&&Zf(h,e,t,d,u,r||D6(h,t));return new no(i,this._parents,e,t)}Il.prototype.interrupt=Mz;Il.prototype.transition=z6;const Cu=e=>()=>e;function B6(e,{sourceEvent:t,target:r,transform:i,dispatch:a}){Object.defineProperties(this,{type:{value:e,enumerable:!0,configurable:!0},sourceEvent:{value:t,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:a}})}function Jr(e,t,r){this.k=e,this.x=t,this.y=r}Jr.prototype={constructor:Jr,scale:function(e){return e===1?this:new Jr(this.k*e,this.x,this.y)},translate:function(e,t){return e===0&t===0?this:new Jr(this.k,this.x+this.k*e,this.y+this.k*t)},apply:function(e){return[e[0]*this.k+this.x,e[1]*this.k+this.y]},applyX:function(e){return e*this.k+this.x},applyY:function(e){return e*this.k+this.y},invert:function(e){return[(e[0]-this.x)/this.k,(e[1]-this.y)/this.k]},invertX:function(e){return(e-this.x)/this.k},invertY:function(e){return(e-this.y)/this.k},rescaleX:function(e){return e.copy().domain(e.range().map(this.invertX,this).map(e.invert,e))},rescaleY:function(e){return e.copy().domain(e.range().map(this.invertY,this).map(e.invert,e))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var Qf=new Jr(1,0,0);F2.prototype=Jr.prototype;function F2(e){for(;!e.__zoom;)if(!(e=e.parentNode))return Qf;return e.__zoom}function Fm(e){e.stopImmediatePropagation()}function nl(e){e.preventDefault(),e.stopImmediatePropagation()}function U6(e){return(!e.ctrlKey||e.type==="wheel")&&!e.button}function L6(){var e=this;return e instanceof SVGElement?(e=e.ownerSVGElement||e,e.hasAttribute("viewBox")?(e=e.viewBox.baseVal,[[e.x,e.y],[e.x+e.width,e.y+e.height]]):[[0,0],[e.width.baseVal.value,e.height.baseVal.value]]):[[0,0],[e.clientWidth,e.clientHeight]]}function s_(){return this.__zoom||Qf}function k6(e){return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*(e.ctrlKey?10:1)}function I6(){return navigator.maxTouchPoints||"ontouchstart"in this}function H6(e,t,r){var i=e.invertX(t[0][0])-r[0][0],a=e.invertX(t[1][0])-r[1][0],l=e.invertY(t[0][1])-r[0][1],u=e.invertY(t[1][1])-r[1][1];return e.translate(a>i?(i+a)/2:Math.min(0,i)||Math.max(0,a),u>l?(l+u)/2:Math.min(0,l)||Math.max(0,u))}function P2(){var e=U6,t=L6,r=H6,i=k6,a=I6,l=[0,1/0],u=[[-1/0,-1/0],[1/0,1/0]],f=250,h=qu,d=Xf("start","zoom","end"),p,g,v,x=500,b=150,_=0,C=10;function E(k){k.property("__zoom",s_).on("wheel.zoom",I,{passive:!1}).on("mousedown.zoom",j).on("dblclick.zoom",Z).filter(a).on("touchstart.zoom",P).on("touchmove.zoom",q).on("touchend.zoom touchcancel.zoom",G).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(k,F,z,L){var H=k.selection?k.selection():k;H.property("__zoom",s_),k!==H?M(k,F,z,L):H.interrupt().each(function(){T(this,arguments).event(L).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},E.scaleBy=function(k,F,z,L){E.scaleTo(k,function(){var H=this.__zoom.k,X=typeof F=="function"?F.apply(this,arguments):F;return H*X},z,L)},E.scaleTo=function(k,F,z,L){E.transform(k,function(){var H=t.apply(this,arguments),X=this.__zoom,Q=z==null?A(H):typeof z=="function"?z.apply(this,arguments):z,U=X.invert(Q),V=typeof F=="function"?F.apply(this,arguments):F;return r(w(N(X,V),Q,U),H,u)},z,L)},E.translateBy=function(k,F,z,L){E.transform(k,function(){return r(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof z=="function"?z.apply(this,arguments):z),t.apply(this,arguments),u)},null,L)},E.translateTo=function(k,F,z,L,H){E.transform(k,function(){var X=t.apply(this,arguments),Q=this.__zoom,U=L==null?A(X):typeof L=="function"?L.apply(this,arguments):L;return r(Qf.translate(U[0],U[1]).scale(Q.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof z=="function"?-z.apply(this,arguments):-z),X,u)},L,H)};function N(k,F){return F=Math.max(l[0],Math.min(l[1],F)),F===k.k?k:new Jr(F,k.x,k.y)}function w(k,F,z){var L=F[0]-z[0]*k.k,H=F[1]-z[1]*k.k;return L===k.x&&H===k.y?k:new Jr(k.k,L,H)}function A(k){return[(+k[0][0]+ +k[1][0])/2,(+k[0][1]+ +k[1][1])/2]}function M(k,F,z,L){k.on("start.zoom",function(){T(this,arguments).event(L).start()}).on("interrupt.zoom end.zoom",function(){T(this,arguments).event(L).end()}).tween("zoom",function(){var H=this,X=arguments,Q=T(H,X).event(L),U=t.apply(H,X),V=z==null?A(U):typeof z=="function"?z.apply(H,X):z,ee=Math.max(U[1][0]-U[0][0],U[1][1]-U[0][1]),J=H.__zoom,fe=typeof F=="function"?F.apply(H,X):F,ye=h(J.invert(V).concat(ee/J.k),fe.invert(V).concat(ee/fe.k));return function(he){if(he===1)he=fe;else{var ae=ye(he),be=ee/ae[2];he=new Jr(be,V[0]-ae[0]*be,V[1]-ae[1]*be)}Q.zoom(null,he)}})}function T(k,F,z){return!z&&k.__zooming||new O(k,F)}function O(k,F){this.that=k,this.args=F,this.active=0,this.sourceEvent=null,this.extent=t.apply(k,F),this.taps=0}O.prototype={event:function(k){return k&&(this.sourceEvent=k),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(k,F){return this.mouse&&k!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&k!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&k!=="touch"&&(this.touch1[1]=F.invert(this.touch1[0])),this.that.__zoom=F,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(k){var F=Dn(this.that).datum();d.call(k,this.that,new B6(k,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:d}),F)}};function I(k,...F){if(!e.apply(this,arguments))return;var z=T(this,F).event(k),L=this.__zoom,H=Math.max(l[0],Math.min(l[1],L.k*Math.pow(2,i.apply(this,arguments)))),X=er(k);if(z.wheel)(z.mouse[0][0]!==X[0]||z.mouse[0][1]!==X[1])&&(z.mouse[1]=L.invert(z.mouse[0]=X)),clearTimeout(z.wheel);else{if(L.k===H)return;z.mouse=[X,L.invert(X)],$u(this),z.start()}nl(k),z.wheel=setTimeout(Q,b),z.zoom("mouse",r(w(N(L,H),z.mouse[0],z.mouse[1]),z.extent,u));function Q(){z.wheel=null,z.end()}}function j(k,...F){if(v||!e.apply(this,arguments))return;var z=k.currentTarget,L=T(this,F,!0).event(k),H=Dn(k.view).on("mousemove.zoom",V,!0).on("mouseup.zoom",ee,!0),X=er(k,z),Q=k.clientX,U=k.clientY;w2(k.view),Fm(k),L.mouse=[X,this.__zoom.invert(X)],$u(this),L.start();function V(J){if(nl(J),!L.moved){var fe=J.clientX-Q,ye=J.clientY-U;L.moved=fe*fe+ye*ye>_}L.event(J).zoom("mouse",r(w(L.that.__zoom,L.mouse[0]=er(J,z),L.mouse[1]),L.extent,u))}function ee(J){H.on("mousemove.zoom mouseup.zoom",null),C2(J.view,L.moved),nl(J),L.event(J).end()}}function Z(k,...F){if(e.apply(this,arguments)){var z=this.__zoom,L=er(k.changedTouches?k.changedTouches[0]:k,this),H=z.invert(L),X=z.k*(k.shiftKey?.5:2),Q=r(w(N(z,X),L,H),t.apply(this,F),u);nl(k),f>0?Dn(this).transition().duration(f).call(M,Q,L,k):Dn(this).call(E.transform,Q,L,k)}}function P(k,...F){if(e.apply(this,arguments)){var z=k.touches,L=z.length,H=T(this,F,k.changedTouches.length===L).event(k),X,Q,U,V;for(Fm(k),Q=0;Q<L;++Q)U=z[Q],V=er(U,this),V=[V,this.__zoom.invert(V),U.identifier],H.touch0?!H.touch1&&H.touch0[2]!==V[2]&&(H.touch1=V,H.taps=0):(H.touch0=V,X=!0,H.taps=1+!!p);p&&(p=clearTimeout(p)),X&&(H.taps<2&&(g=V[0],p=setTimeout(function(){p=null},x)),$u(this),H.start())}}function q(k,...F){if(this.__zooming){var z=T(this,F).event(k),L=k.changedTouches,H=L.length,X,Q,U,V;for(nl(k),X=0;X<H;++X)Q=L[X],U=er(Q,this),z.touch0&&z.touch0[2]===Q.identifier?z.touch0[0]=U:z.touch1&&z.touch1[2]===Q.identifier&&(z.touch1[0]=U);if(Q=z.that.__zoom,z.touch1){var ee=z.touch0[0],J=z.touch0[1],fe=z.touch1[0],ye=z.touch1[1],he=(he=fe[0]-ee[0])*he+(he=fe[1]-ee[1])*he,ae=(ae=ye[0]-J[0])*ae+(ae=ye[1]-J[1])*ae;Q=N(Q,Math.sqrt(he/ae)),U=[(ee[0]+fe[0])/2,(ee[1]+fe[1])/2],V=[(J[0]+ye[0])/2,(J[1]+ye[1])/2]}else if(z.touch0)U=z.touch0[0],V=z.touch0[1];else return;z.zoom("touch",r(w(Q,U,V),z.extent,u))}}function G(k,...F){if(this.__zooming){var z=T(this,F).event(k),L=k.changedTouches,H=L.length,X,Q;for(Fm(k),v&&clearTimeout(v),v=setTimeout(function(){v=null},x),X=0;X<H;++X)Q=L[X],z.touch0&&z.touch0[2]===Q.identifier?delete z.touch0:z.touch1&&z.touch1[2]===Q.identifier&&delete z.touch1;if(z.touch1&&!z.touch0&&(z.touch0=z.touch1,delete z.touch1),z.touch0)z.touch0[1]=this.__zoom.invert(z.touch0[0]);else if(z.end(),z.taps===2&&(Q=er(Q,this),Math.hypot(g[0]-Q[0],g[1]-Q[1])<C)){var U=Dn(this).on("dblclick.zoom");U&&U.apply(this,arguments)}}}return E.wheelDelta=function(k){return arguments.length?(i=typeof k=="function"?k:Cu(+k),E):i},E.filter=function(k){return arguments.length?(e=typeof k=="function"?k:Cu(!!k),E):e},E.touchable=function(k){return arguments.length?(a=typeof k=="function"?k:Cu(!!k),E):a},E.extent=function(k){return arguments.length?(t=typeof k=="function"?k:Cu([[+k[0][0],+k[0][1]],[+k[1][0],+k[1][1]]]),E):t},E.scaleExtent=function(k){return arguments.length?(l[0]=+k[0],l[1]=+k[1],E):[l[0],l[1]]},E.translateExtent=function(k){return arguments.length?(u[0][0]=+k[0][0],u[1][0]=+k[1][0],u[0][1]=+k[0][1],u[1][1]=+k[1][1],E):[[u[0][0],u[0][1]],[u[1][0],u[1][1]]]},E.constrain=function(k){return arguments.length?(r=k,E):r},E.duration=function(k){return arguments.length?(f=+k,E):f},E.interpolate=function(k){return arguments.length?(h=k,E):h},E.on=function(){var k=d.on.apply(d,arguments);return k===d?E:k},E.clickDistance=function(k){return arguments.length?(_=(k=+k)*k,E):Math.sqrt(_)},E.tapDistance=function(k){return arguments.length?(C=+k,E):C},E}const Er={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:e=>`Node type "${e}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:e=>`The old edge with id=${e} does not exist.`,error009:e=>`Marker type "${e}" doesn't exist.`,error008:(e,{id:t,sourceHandle:r,targetHandle:i})=>`Couldn't create edge for ${e} handle id: "${e==="source"?r:i}", edge id: ${t}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:e=>`Edge type "${e}" not found. Using fallback type "default".`,error012:e=>`Node with id "${e}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(e="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${e}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Sl=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],j2=["Enter"," ","Escape"],V2={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:e,x:t,y:r})=>`Moved selected node ${e}. New position, x: ${t}, y: ${r}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var qs;(function(e){e.Strict="strict",e.Loose="loose"})(qs||(qs={}));var zi;(function(e){e.Free="free",e.Vertical="vertical",e.Horizontal="horizontal"})(zi||(zi={}));var wl;(function(e){e.Partial="partial",e.Full="full"})(wl||(wl={}));const G2={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Ho;(function(e){e.Bezier="default",e.Straight="straight",e.Step="step",e.SmoothStep="smoothstep",e.SimpleBezier="simplebezier"})(Ho||(Ho={}));var mf;(function(e){e.Arrow="arrow",e.ArrowClosed="arrowclosed"})(mf||(mf={}));var Ne;(function(e){e.Left="left",e.Top="top",e.Right="right",e.Bottom="bottom"})(Ne||(Ne={}));const a_={[Ne.Left]:Ne.Right,[Ne.Right]:Ne.Left,[Ne.Top]:Ne.Bottom,[Ne.Bottom]:Ne.Top};function q2(e){return e===null?null:e?"valid":"invalid"}const Y2=e=>"id"in e&&"source"in e&&"target"in e,F6=e=>"id"in e&&"position"in e&&!("source"in e)&&!("target"in e),X0=e=>"id"in e&&"internals"in e&&!("source"in e)&&!("target"in e),P6=(e,t,r)=>{if(!e.id)return[];const i=new Set;return r.forEach(a=>{a.source===e.id&&i.add(a.target)}),t.filter(a=>i.has(a.id))},Fl=(e,t=[0,0])=>{const{width:r,height:i}=io(e),a=e.origin??t,l=r*a[0],u=i*a[1];return{x:e.position.x-l,y:e.position.y-u}},j6=(e,t={nodeOrigin:[0,0]})=>{if(e.length===0)return{x:0,y:0,width:0,height:0};const r=e.reduce((i,a)=>{const l=typeof a=="string";let u=!t.nodeLookup&&!l?a:void 0;t.nodeLookup&&(u=l?t.nodeLookup.get(a):X0(a)?a:t.nodeLookup.get(a.id));const f=u?pf(u,t.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Wf(i,f)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Jf(r)},Pl=(e,t={})=>{let r={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return e.forEach(a=>{(t.filter===void 0||t.filter(a))&&(r=Wf(r,pf(a)),i=!0)}),i?Jf(r):{x:0,y:0,width:0,height:0}},$0=(e,t,[r,i,a]=[0,0,1],l=!1,u=!1)=>{const f={...Vl(t,[r,i,a]),width:t.width/a,height:t.height/a},h=[];for(const d of e.values()){const{measured:p,selectable:g=!0,hidden:v=!1}=d;if(u&&!g||v)continue;const x=p.width??d.width??d.initialWidth??null,b=p.height??d.height??d.initialHeight??null,_=Cl(f,Xs(d)),C=(x??0)*(b??0),E=l&&_>0;(!d.internals.handleBounds||E||_>=C||d.dragging)&&h.push(d)}return h},V6=(e,t)=>{const r=new Set;return e.forEach(i=>{r.add(i.id)}),t.filter(i=>r.has(i.source)||r.has(i.target))};function G6(e,t){const r=new Map,i=t?.nodes?new Set(t.nodes.map(a=>a.id)):null;return e.forEach(a=>{a.measured.width&&a.measured.height&&(t?.includeHiddenNodes||!a.hidden)&&(!i||i.has(a.id))&&r.set(a.id,a)}),r}async function q6({nodes:e,width:t,height:r,panZoom:i,minZoom:a,maxZoom:l},u){if(e.size===0)return Promise.resolve(!0);const f=G6(e,u),h=Pl(f),d=K0(h,t,r,u?.minZoom??a,u?.maxZoom??l,u?.padding??.1);return await i.setViewport(d,{duration:u?.duration,ease:u?.ease,interpolate:u?.interpolate}),Promise.resolve(!0)}function X2({nodeId:e,nextPosition:t,nodeLookup:r,nodeOrigin:i=[0,0],nodeExtent:a,onError:l}){const u=r.get(e),f=u.parentId?r.get(u.parentId):void 0,{x:h,y:d}=f?f.internals.positionAbsolute:{x:0,y:0},p=u.origin??i;let g=u.extent||a;if(u.extent==="parent"&&!u.expandParent)if(!f)l?.("005",Er.error005());else{const x=f.measured.width,b=f.measured.height;x&&b&&(g=[[h,d],[h+x,d+b]])}else f&&$s(u.extent)&&(g=[[u.extent[0][0]+h,u.extent[0][1]+d],[u.extent[1][0]+h,u.extent[1][1]+d]]);const v=$s(g)?ki(t,g,u.measured):t;return(u.measured.width===void 0||u.measured.height===void 0)&&l?.("015",Er.error015()),{position:{x:v.x-h+(u.measured.width??0)*p[0],y:v.y-d+(u.measured.height??0)*p[1]},positionAbsolute:v}}async function Y6({nodesToRemove:e=[],edgesToRemove:t=[],nodes:r,edges:i,onBeforeDelete:a}){const l=new Set(e.map(v=>v.id)),u=[];for(const v of r){if(v.deletable===!1)continue;const x=l.has(v.id),b=!x&&v.parentId&&u.find(_=>_.id===v.parentId);(x||b)&&u.push(v)}const f=new Set(t.map(v=>v.id)),h=i.filter(v=>v.deletable!==!1),p=V6(u,h);for(const v of h)f.has(v.id)&&!p.find(b=>b.id===v.id)&&p.push(v);if(!a)return{edges:p,nodes:u};const g=await a({nodes:u,edges:p});return typeof g=="boolean"?g?{edges:p,nodes:u}:{edges:[],nodes:[]}:g}const Ys=(e,t=0,r=1)=>Math.min(Math.max(e,t),r),ki=(e={x:0,y:0},t,r)=>({x:Ys(e.x,t[0][0],t[1][0]-(r?.width??0)),y:Ys(e.y,t[0][1],t[1][1]-(r?.height??0))});function $2(e,t,r){const{width:i,height:a}=io(r),{x:l,y:u}=r.internals.positionAbsolute;return ki(e,[[l,u],[l+i,u+a]],t)}const l_=(e,t,r)=>e<t?Ys(Math.abs(e-t),1,t)/t:e>r?-Ys(Math.abs(e-r),1,t)/t:0,K2=(e,t,r=15,i=40)=>{const a=l_(e.x,i,t.width-i)*r,l=l_(e.y,i,t.height-i)*r;return[a,l]},Wf=(e,t)=>({x:Math.min(e.x,t.x),y:Math.min(e.y,t.y),x2:Math.max(e.x2,t.x2),y2:Math.max(e.y2,t.y2)}),zp=({x:e,y:t,width:r,height:i})=>({x:e,y:t,x2:e+r,y2:t+i}),Jf=({x:e,y:t,x2:r,y2:i})=>({x:e,y:t,width:r-e,height:i-t}),Xs=(e,t=[0,0])=>{const{x:r,y:i}=X0(e)?e.internals.positionAbsolute:Fl(e,t);return{x:r,y:i,width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}},pf=(e,t=[0,0])=>{const{x:r,y:i}=X0(e)?e.internals.positionAbsolute:Fl(e,t);return{x:r,y:i,x2:r+(e.measured?.width??e.width??e.initialWidth??0),y2:i+(e.measured?.height??e.height??e.initialHeight??0)}},Z2=(e,t)=>Jf(Wf(zp(e),zp(t))),Cl=(e,t)=>{const r=Math.max(0,Math.min(e.x+e.width,t.x+t.width)-Math.max(e.x,t.x)),i=Math.max(0,Math.min(e.y+e.height,t.y+t.height)-Math.max(e.y,t.y));return Math.ceil(r*i)},c_=e=>rr(e.width)&&rr(e.height)&&rr(e.x)&&rr(e.y),rr=e=>!isNaN(e)&&isFinite(e),X6=(e,t)=>{},jl=(e,t=[1,1])=>({x:t[0]*Math.round(e.x/t[0]),y:t[1]*Math.round(e.y/t[1])}),Vl=({x:e,y:t},[r,i,a],l=!1,u=[1,1])=>{const f={x:(e-r)/a,y:(t-i)/a};return l?jl(f,u):f},gf=({x:e,y:t},[r,i,a])=>({x:e*a+r,y:t*a+i});function Bs(e,t){if(typeof e=="number")return Math.floor((t-t/(1+e))*.5);if(typeof e=="string"&&e.endsWith("px")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(r)}if(typeof e=="string"&&e.endsWith("%")){const r=parseFloat(e);if(!Number.isNaN(r))return Math.floor(t*r*.01)}return console.error(`[React Flow] The padding value "${e}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function $6(e,t,r){if(typeof e=="string"||typeof e=="number"){const i=Bs(e,r),a=Bs(e,t);return{top:i,right:a,bottom:i,left:a,x:a*2,y:i*2}}if(typeof e=="object"){const i=Bs(e.top??e.y??0,r),a=Bs(e.bottom??e.y??0,r),l=Bs(e.left??e.x??0,t),u=Bs(e.right??e.x??0,t);return{top:i,right:u,bottom:a,left:l,x:l+u,y:i+a}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function K6(e,t,r,i,a,l){const{x:u,y:f}=gf(e,[t,r,i]),{x:h,y:d}=gf({x:e.x+e.width,y:e.y+e.height},[t,r,i]),p=a-h,g=l-d;return{left:Math.floor(u),top:Math.floor(f),right:Math.floor(p),bottom:Math.floor(g)}}const K0=(e,t,r,i,a,l)=>{const u=$6(l,t,r),f=(t-u.x)/e.width,h=(r-u.y)/e.height,d=Math.min(f,h),p=Ys(d,i,a),g=e.x+e.width/2,v=e.y+e.height/2,x=t/2-g*p,b=r/2-v*p,_=K6(e,x,b,p,t,r),C={left:Math.min(_.left-u.left,0),top:Math.min(_.top-u.top,0),right:Math.min(_.right-u.right,0),bottom:Math.min(_.bottom-u.bottom,0)};return{x:x-C.left+C.right,y:b-C.top+C.bottom,zoom:p}},Tl=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function $s(e){return e!=null&&e!=="parent"}function io(e){return{width:e.measured?.width??e.width??e.initialWidth??0,height:e.measured?.height??e.height??e.initialHeight??0}}function Q2(e){return(e.measured?.width??e.width??e.initialWidth)!==void 0&&(e.measured?.height??e.height??e.initialHeight)!==void 0}function W2(e,t={width:0,height:0},r,i,a){const l={...e},u=i.get(r);if(u){const f=u.origin||a;l.x+=u.internals.positionAbsolute.x-(t.width??0)*f[0],l.y+=u.internals.positionAbsolute.y-(t.height??0)*f[1]}return l}function u_(e,t){if(e.size!==t.size)return!1;for(const r of e)if(!t.has(r))return!1;return!0}function Z6(){let e,t;return{promise:new Promise((i,a)=>{e=i,t=a}),resolve:e,reject:t}}function Q6(e){return{...V2,...e||{}}}function fl(e,{snapGrid:t=[0,0],snapToGrid:r=!1,transform:i,containerBounds:a}){const{x:l,y:u}=or(e),f=Vl({x:l-(a?.left??0),y:u-(a?.top??0)},i),{x:h,y:d}=r?jl(f,t):f;return{xSnapped:h,ySnapped:d,...f}}const Z0=e=>({width:e.offsetWidth,height:e.offsetHeight}),J2=e=>e?.getRootNode?.()||window?.document,W6=["INPUT","SELECT","TEXTAREA"];function ew(e){const t=e.composedPath?.()?.[0]||e.target;return t?.nodeType!==1?!1:W6.includes(t.nodeName)||t.hasAttribute("contenteditable")||!!t.closest(".nokey")}const tw=e=>"clientX"in e,or=(e,t)=>{const r=tw(e),i=r?e.clientX:e.touches?.[0].clientX,a=r?e.clientY:e.touches?.[0].clientY;return{x:i-(t?.left??0),y:a-(t?.top??0)}},f_=(e,t,r,i,a)=>{const l=t.querySelectorAll(`.${e}`);return!l||!l.length?null:Array.from(l).map(u=>{const f=u.getBoundingClientRect();return{id:u.getAttribute("data-handleid"),type:e,nodeId:a,position:u.getAttribute("data-handlepos"),x:(f.left-r.left)/i,y:(f.top-r.top)/i,...Z0(u)}})};function nw({sourceX:e,sourceY:t,targetX:r,targetY:i,sourceControlX:a,sourceControlY:l,targetControlX:u,targetControlY:f}){const h=e*.125+a*.375+u*.375+r*.125,d=t*.125+l*.375+f*.375+i*.125,p=Math.abs(h-e),g=Math.abs(d-t);return[h,d,p,g]}function Tu(e,t){return e>=0?.5*e:t*25*Math.sqrt(-e)}function d_({pos:e,x1:t,y1:r,x2:i,y2:a,c:l}){switch(e){case Ne.Left:return[t-Tu(t-i,l),r];case Ne.Right:return[t+Tu(i-t,l),r];case Ne.Top:return[t,r-Tu(r-a,l)];case Ne.Bottom:return[t,r+Tu(a-r,l)]}}function ed({sourceX:e,sourceY:t,sourcePosition:r=Ne.Bottom,targetX:i,targetY:a,targetPosition:l=Ne.Top,curvature:u=.25}){const[f,h]=d_({pos:r,x1:e,y1:t,x2:i,y2:a,c:u}),[d,p]=d_({pos:l,x1:i,y1:a,x2:e,y2:t,c:u}),[g,v,x,b]=nw({sourceX:e,sourceY:t,targetX:i,targetY:a,sourceControlX:f,sourceControlY:h,targetControlX:d,targetControlY:p});return[`M${e},${t} C${f},${h} ${d},${p} ${i},${a}`,g,v,x,b]}function rw({sourceX:e,sourceY:t,targetX:r,targetY:i}){const a=Math.abs(r-e)/2,l=r<e?r+a:r-a,u=Math.abs(i-t)/2,f=i<t?i+u:i-u;return[l,f,a,u]}function J6({sourceNode:e,targetNode:t,selected:r=!1,zIndex:i=0,elevateOnSelect:a=!1,zIndexMode:l="basic"}){if(l==="manual")return i;const u=a&&r?i+1e3:i,f=Math.max(e.parentId||a&&e.selected?e.internals.z:0,t.parentId||a&&t.selected?t.internals.z:0);return u+f}function eB({sourceNode:e,targetNode:t,width:r,height:i,transform:a}){const l=Wf(pf(e),pf(t));l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const u={x:-a[0]/a[2],y:-a[1]/a[2],width:r/a[2],height:i/a[2]};return Cl(u,Jf(l))>0}const tB=({source:e,sourceHandle:t,target:r,targetHandle:i})=>`xy-edge__${e}${t||""}-${r}${i||""}`,nB=(e,t)=>t.some(r=>r.source===e.source&&r.target===e.target&&(r.sourceHandle===e.sourceHandle||!r.sourceHandle&&!e.sourceHandle)&&(r.targetHandle===e.targetHandle||!r.targetHandle&&!e.targetHandle)),Bp=(e,t,r={})=>{if(!e.source||!e.target)return t;const i=r.getEdgeId||tB;let a;return Y2(e)?a={...e}:a={...e,id:i(e)},nB(a,t)?t:(a.sourceHandle===null&&delete a.sourceHandle,a.targetHandle===null&&delete a.targetHandle,t.concat(a))};function ow({sourceX:e,sourceY:t,targetX:r,targetY:i}){const[a,l,u,f]=rw({sourceX:e,sourceY:t,targetX:r,targetY:i});return[`M ${e},${t}L ${r},${i}`,a,l,u,f]}const h_={[Ne.Left]:{x:-1,y:0},[Ne.Right]:{x:1,y:0},[Ne.Top]:{x:0,y:-1},[Ne.Bottom]:{x:0,y:1}},rB=({source:e,sourcePosition:t=Ne.Bottom,target:r})=>t===Ne.Left||t===Ne.Right?e.x<r.x?{x:1,y:0}:{x:-1,y:0}:e.y<r.y?{x:0,y:1}:{x:0,y:-1},m_=(e,t)=>Math.sqrt(Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2));function oB({source:e,sourcePosition:t=Ne.Bottom,target:r,targetPosition:i=Ne.Top,center:a,offset:l,stepPosition:u}){const f=h_[t],h=h_[i],d={x:e.x+f.x*l,y:e.y+f.y*l},p={x:r.x+h.x*l,y:r.y+h.y*l},g=rB({source:d,sourcePosition:t,target:p}),v=g.x!==0?"x":"y",x=g[v];let b=[],_,C;const E={x:0,y:0},N={x:0,y:0},[,,w,A]=rw({sourceX:e.x,sourceY:e.y,targetX:r.x,targetY:r.y});if(f[v]*h[v]===-1){v==="x"?(_=a.x??d.x+(p.x-d.x)*u,C=a.y??(d.y+p.y)/2):(_=a.x??(d.x+p.x)/2,C=a.y??d.y+(p.y-d.y)*u);const T=[{x:_,y:d.y},{x:_,y:p.y}],O=[{x:d.x,y:C},{x:p.x,y:C}];f[v]===x?b=v==="x"?T:O:b=v==="x"?O:T}else{const T=[{x:d.x,y:p.y}],O=[{x:p.x,y:d.y}];if(v==="x"?b=f.x===x?O:T:b=f.y===x?T:O,t===i){const q=Math.abs(e[v]-r[v]);if(q<=l){const G=Math.min(l-1,l-q);f[v]===x?E[v]=(d[v]>e[v]?-1:1)*G:N[v]=(p[v]>r[v]?-1:1)*G}}if(t!==i){const q=v==="x"?"y":"x",G=f[v]===h[q],k=d[q]>p[q],F=d[q]<p[q];(f[v]===1&&(!G&&k||G&&F)||f[v]!==1&&(!G&&F||G&&k))&&(b=v==="x"?T:O)}const I={x:d.x+E.x,y:d.y+E.y},j={x:p.x+N.x,y:p.y+N.y},Z=Math.max(Math.abs(I.x-b[0].x),Math.abs(j.x-b[0].x)),P=Math.max(Math.abs(I.y-b[0].y),Math.abs(j.y-b[0].y));Z>=P?(_=(I.x+j.x)/2,C=b[0].y):(_=b[0].x,C=(I.y+j.y)/2)}return[[e,{x:d.x+E.x,y:d.y+E.y},...b,{x:p.x+N.x,y:p.y+N.y},r],_,C,w,A]}function iB(e,t,r,i){const a=Math.min(m_(e,t)/2,m_(t,r)/2,i),{x:l,y:u}=t;if(e.x===l&&l===r.x||e.y===u&&u===r.y)return`L${l} ${u}`;if(e.y===u){const d=e.x<r.x?-1:1,p=e.y<r.y?1:-1;return`L ${l+a*d},${u}Q ${l},${u} ${l},${u+a*p}`}const f=e.x<r.x?1:-1,h=e.y<r.y?-1:1;return`L ${l},${u+a*h}Q ${l},${u} ${l+a*f},${u}`}function Up({sourceX:e,sourceY:t,sourcePosition:r=Ne.Bottom,targetX:i,targetY:a,targetPosition:l=Ne.Top,borderRadius:u=5,centerX:f,centerY:h,offset:d=20,stepPosition:p=.5}){const[g,v,x,b,_]=oB({source:{x:e,y:t},sourcePosition:r,target:{x:i,y:a},targetPosition:l,center:{x:f,y:h},offset:d,stepPosition:p});return[g.reduce((E,N,w)=>{let A="";return w>0&&w<g.length-1?A=iB(g[w-1],N,g[w+1],u):A=`${w===0?"M":"L"}${N.x} ${N.y}`,E+=A,E},""),v,x,b,_]}function p_(e){return e&&!!(e.internals.handleBounds||e.handles?.length)&&!!(e.measured.width||e.width||e.initialWidth)}function sB(e){const{sourceNode:t,targetNode:r}=e;if(!p_(t)||!p_(r))return null;const i=t.internals.handleBounds||g_(t.handles),a=r.internals.handleBounds||g_(r.handles),l=y_(i?.source??[],e.sourceHandle),u=y_(e.connectionMode===qs.Strict?a?.target??[]:(a?.target??[]).concat(a?.source??[]),e.targetHandle);if(!l||!u)return e.onError?.("008",Er.error008(l?"target":"source",{id:e.id,sourceHandle:e.sourceHandle,targetHandle:e.targetHandle})),null;const f=l?.position||Ne.Bottom,h=u?.position||Ne.Top,d=Ii(t,l,f),p=Ii(r,u,h);return{sourceX:d.x,sourceY:d.y,targetX:p.x,targetY:p.y,sourcePosition:f,targetPosition:h}}function g_(e){if(!e)return null;const t=[],r=[];for(const i of e)i.width=i.width??1,i.height=i.height??1,i.type==="source"?t.push(i):i.type==="target"&&r.push(i);return{source:t,target:r}}function Ii(e,t,r=Ne.Left,i=!1){const a=(t?.x??0)+e.internals.positionAbsolute.x,l=(t?.y??0)+e.internals.positionAbsolute.y,{width:u,height:f}=t??io(e);if(i)return{x:a+u/2,y:l+f/2};switch(t?.position??r){case Ne.Top:return{x:a+u/2,y:l};case Ne.Right:return{x:a+u,y:l+f/2};case Ne.Bottom:return{x:a+u/2,y:l+f};case Ne.Left:return{x:a,y:l+f/2}}}function y_(e,t){return e&&(t?e.find(r=>r.id===t):e[0])||null}function Lp(e,t){return e?typeof e=="string"?e:`${t?`${t}__`:""}${Object.keys(e).sort().map(i=>`${i}=${e[i]}`).join("&")}`:""}function aB(e,{id:t,defaultColor:r,defaultMarkerStart:i,defaultMarkerEnd:a}){const l=new Set;return e.reduce((u,f)=>([f.markerStart||i,f.markerEnd||a].forEach(h=>{if(h&&typeof h=="object"){const d=Lp(h,t);l.has(d)||(u.push({id:d,color:h.color||r,...h}),l.add(d))}}),u),[]).sort((u,f)=>u.id.localeCompare(f.id))}const iw=1e3,lB=10,Q0={nodeOrigin:[0,0],nodeExtent:Sl,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},cB={...Q0,checkEquality:!0};function W0(e,t){const r={...e};for(const i in t)t[i]!==void 0&&(r[i]=t[i]);return r}function uB(e,t,r){const i=W0(Q0,r);for(const a of e.values())if(a.parentId)eg(a,e,t,i);else{const l=Fl(a,i.nodeOrigin),u=$s(a.extent)?a.extent:i.nodeExtent,f=ki(l,u,io(a));a.internals.positionAbsolute=f}}function fB(e,t){if(!e.handles)return e.measured?t?.internals.handleBounds:void 0;const r=[],i=[];for(const a of e.handles){const l={id:a.id,width:a.width??1,height:a.height??1,nodeId:e.id,x:a.x,y:a.y,position:a.position,type:a.type};a.type==="source"?r.push(l):a.type==="target"&&i.push(l)}return{source:r,target:i}}function J0(e){return e==="manual"}function kp(e,t,r,i={}){const a=W0(cB,i),l={i:0},u=new Map(t),f=a?.elevateNodesOnSelect&&!J0(a.zIndexMode)?iw:0;let h=e.length>0;t.clear(),r.clear();for(const d of e){let p=u.get(d.id);if(a.checkEquality&&d===p?.internals.userNode)t.set(d.id,p);else{const g=Fl(d,a.nodeOrigin),v=$s(d.extent)?d.extent:a.nodeExtent,x=ki(g,v,io(d));p={...a.defaults,...d,measured:{width:d.measured?.width,height:d.measured?.height},internals:{positionAbsolute:x,handleBounds:fB(d,p),z:sw(d,f,a.zIndexMode),userNode:d}},t.set(d.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(h=!1),d.parentId&&eg(p,t,r,i,l)}return h}function dB(e,t){if(!e.parentId)return;const r=t.get(e.parentId);r?r.set(e.id,e):t.set(e.parentId,new Map([[e.id,e]]))}function eg(e,t,r,i,a){const{elevateNodesOnSelect:l,nodeOrigin:u,nodeExtent:f,zIndexMode:h}=W0(Q0,i),d=e.parentId,p=t.get(d);if(!p){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}dB(e,r),a&&!p.parentId&&p.internals.rootParentIndex===void 0&&h==="auto"&&(p.internals.rootParentIndex=++a.i,p.internals.z=p.internals.z+a.i*lB),a&&p.internals.rootParentIndex!==void 0&&(a.i=p.internals.rootParentIndex);const g=l&&!J0(h)?iw:0,{x:v,y:x,z:b}=hB(e,p,u,f,g,h),{positionAbsolute:_}=e.internals,C=v!==_.x||x!==_.y;(C||b!==e.internals.z)&&t.set(e.id,{...e,internals:{...e.internals,positionAbsolute:C?{x:v,y:x}:_,z:b}})}function sw(e,t,r){const i=rr(e.zIndex)?e.zIndex:0;return J0(r)?i:i+(e.selected?t:0)}function hB(e,t,r,i,a,l){const{x:u,y:f}=t.internals.positionAbsolute,h=io(e),d=Fl(e,r),p=$s(e.extent)?ki(d,e.extent,h):d;let g=ki({x:u+p.x,y:f+p.y},i,h);e.extent==="parent"&&(g=$2(g,h,t));const v=sw(e,a,l),x=t.internals.z??0;return{x:g.x,y:g.y,z:x>=v?x+1:v}}function tg(e,t,r,i=[0,0]){const a=[],l=new Map;for(const u of e){const f=t.get(u.parentId);if(!f)continue;const h=l.get(u.parentId)?.expandedRect??Xs(f),d=Z2(h,u.rect);l.set(u.parentId,{expandedRect:d,parent:f})}return l.size>0&&l.forEach(({expandedRect:u,parent:f},h)=>{const d=f.internals.positionAbsolute,p=io(f),g=f.origin??i,v=u.x<d.x?Math.round(Math.abs(d.x-u.x)):0,x=u.y<d.y?Math.round(Math.abs(d.y-u.y)):0,b=Math.max(p.width,Math.round(u.width)),_=Math.max(p.height,Math.round(u.height)),C=(b-p.width)*g[0],E=(_-p.height)*g[1];(v>0||x>0||C||E)&&(a.push({id:h,type:"position",position:{x:f.position.x-v+C,y:f.position.y-x+E}}),r.get(h)?.forEach(N=>{e.some(w=>w.id===N.id)||a.push({id:N.id,type:"position",position:{x:N.position.x+v,y:N.position.y+x}})})),(p.width<u.width||p.height<u.height||v||x)&&a.push({id:h,type:"dimensions",setAttributes:!0,dimensions:{width:b+(v?g[0]*v-C:0),height:_+(x?g[1]*x-E:0)}})}),a}function mB(e,t,r,i,a,l,u){const f=i?.querySelector(".xyflow__viewport");let h=!1;if(!f)return{changes:[],updatedInternals:h};const d=[],p=window.getComputedStyle(f),{m22:g}=new window.DOMMatrixReadOnly(p.transform),v=[];for(const x of e.values()){const b=t.get(x.id);if(!b)continue;if(b.hidden){t.set(b.id,{...b,internals:{...b.internals,handleBounds:void 0}}),h=!0;continue}const _=Z0(x.nodeElement),C=b.measured.width!==_.width||b.measured.height!==_.height;if(!!(_.width&&_.height&&(C||!b.internals.handleBounds||x.force))){const N=x.nodeElement.getBoundingClientRect(),w=$s(b.extent)?b.extent:l;let{positionAbsolute:A}=b.internals;b.parentId&&b.extent==="parent"?A=$2(A,_,t.get(b.parentId)):w&&(A=ki(A,w,_));const M={...b,measured:_,internals:{...b.internals,positionAbsolute:A,handleBounds:{source:f_("source",x.nodeElement,N,g,b.id),target:f_("target",x.nodeElement,N,g,b.id)}}};t.set(b.id,M),b.parentId&&eg(M,t,r,{nodeOrigin:a,zIndexMode:u}),h=!0,C&&(d.push({id:b.id,type:"dimensions",dimensions:_}),b.expandParent&&b.parentId&&v.push({id:b.id,parentId:b.parentId,rect:Xs(M,a)}))}}if(v.length>0){const x=tg(v,t,r,a);d.push(...x)}return{changes:d,updatedInternals:h}}async function pB({delta:e,panZoom:t,transform:r,translateExtent:i,width:a,height:l}){if(!t||!e.x&&!e.y)return Promise.resolve(!1);const u=await t.setViewportConstrained({x:r[0]+e.x,y:r[1]+e.y,zoom:r[2]},[[0,0],[a,l]],i),f=!!u&&(u.x!==r[0]||u.y!==r[1]||u.k!==r[2]);return Promise.resolve(f)}function v_(e,t,r,i,a,l){let u=a;const f=i.get(u)||new Map;i.set(u,f.set(r,t)),u=`${a}-${e}`;const h=i.get(u)||new Map;if(i.set(u,h.set(r,t)),l){u=`${a}-${e}-${l}`;const d=i.get(u)||new Map;i.set(u,d.set(r,t))}}function aw(e,t,r){e.clear(),t.clear();for(const i of r){const{source:a,target:l,sourceHandle:u=null,targetHandle:f=null}=i,h={edgeId:i.id,source:a,target:l,sourceHandle:u,targetHandle:f},d=`${a}-${u}--${l}-${f}`,p=`${l}-${f}--${a}-${u}`;v_("source",h,p,e,a,u),v_("target",h,d,e,l,f),t.set(i.id,i)}}function lw(e,t){if(!e.parentId)return!1;const r=t.get(e.parentId);return r?r.selected?!0:lw(r,t):!1}function x_(e,t,r){let i=e;do{if(i?.matches?.(t))return!0;if(i===r)return!1;i=i?.parentElement}while(i);return!1}function gB(e,t,r,i){const a=new Map;for(const[l,u]of e)if((u.selected||u.id===i)&&(!u.parentId||!lw(u,e))&&(u.draggable||t&&typeof u.draggable>"u")){const f=e.get(l);f&&a.set(l,{id:l,position:f.position||{x:0,y:0},distance:{x:r.x-f.internals.positionAbsolute.x,y:r.y-f.internals.positionAbsolute.y},extent:f.extent,parentId:f.parentId,origin:f.origin,expandParent:f.expandParent,internals:{positionAbsolute:f.internals.positionAbsolute||{x:0,y:0}},measured:{width:f.measured.width??0,height:f.measured.height??0}})}return a}function Pm({nodeId:e,dragItems:t,nodeLookup:r,dragging:i=!0}){const a=[];for(const[u,f]of t){const h=r.get(u)?.internals.userNode;h&&a.push({...h,position:f.position,dragging:i})}if(!e)return[a[0],a];const l=r.get(e)?.internals.userNode;return[l?{...l,position:t.get(e)?.position||l.position,dragging:i}:a[0],a]}function yB({dragItems:e,snapGrid:t,x:r,y:i}){const a=e.values().next().value;if(!a)return null;const l={x:r-a.distance.x,y:i-a.distance.y},u=jl(l,t);return{x:u.x-l.x,y:u.y-l.y}}function vB({onNodeMouseDown:e,getStoreItems:t,onDragStart:r,onDrag:i,onDragStop:a}){let l={x:null,y:null},u=0,f=new Map,h=!1,d={x:0,y:0},p=null,g=!1,v=null,x=!1,b=!1,_=null;function C({noDragClassName:N,handleSelector:w,domNode:A,isSelectable:M,nodeId:T,nodeClickDistance:O=0}){v=Dn(A);function I({x:q,y:G}){const{nodeLookup:k,nodeExtent:F,snapGrid:z,snapToGrid:L,nodeOrigin:H,onNodeDrag:X,onSelectionDrag:Q,onError:U,updateNodePositions:V}=t();l={x:q,y:G};let ee=!1;const J=f.size>1,fe=J&&F?zp(Pl(f)):null,ye=J&&L?yB({dragItems:f,snapGrid:z,x:q,y:G}):null;for(const[he,ae]of f){if(!k.has(he))continue;let be={x:q-ae.distance.x,y:G-ae.distance.y};L&&(be=ye?{x:Math.round(be.x+ye.x),y:Math.round(be.y+ye.y)}:jl(be,z));let ve=null;if(J&&F&&!ae.extent&&fe){const{positionAbsolute:xe}=ae.internals,Ee=xe.x-fe.x+F[0][0],Ce=xe.x+ae.measured.width-fe.x2+F[1][0],ie=xe.y-fe.y+F[0][1],re=xe.y+ae.measured.height-fe.y2+F[1][1];ve=[[Ee,ie],[Ce,re]]}const{position:Te,positionAbsolute:we}=X2({nodeId:he,nextPosition:be,nodeLookup:k,nodeExtent:ve||F,nodeOrigin:H,onError:U});ee=ee||ae.position.x!==Te.x||ae.position.y!==Te.y,ae.position=Te,ae.internals.positionAbsolute=we}if(b=b||ee,!!ee&&(V(f,!0),_&&(i||X||!T&&Q))){const[he,ae]=Pm({nodeId:T,dragItems:f,nodeLookup:k});i?.(_,f,he,ae),X?.(_,he,ae),T||Q?.(_,ae)}}async function j(){if(!p)return;const{transform:q,panBy:G,autoPanSpeed:k,autoPanOnNodeDrag:F}=t();if(!F){h=!1,cancelAnimationFrame(u);return}const[z,L]=K2(d,p,k);(z!==0||L!==0)&&(l.x=(l.x??0)-z/q[2],l.y=(l.y??0)-L/q[2],await G({x:z,y:L})&&I(l)),u=requestAnimationFrame(j)}function Z(q){const{nodeLookup:G,multiSelectionActive:k,nodesDraggable:F,transform:z,snapGrid:L,snapToGrid:H,selectNodesOnDrag:X,onNodeDragStart:Q,onSelectionDragStart:U,unselectNodesAndEdges:V}=t();g=!0,(!X||!M)&&!k&&T&&(G.get(T)?.selected||V()),M&&X&&T&&e?.(T);const ee=fl(q.sourceEvent,{transform:z,snapGrid:L,snapToGrid:H,containerBounds:p});if(l=ee,f=gB(G,F,ee,T),f.size>0&&(r||Q||!T&&U)){const[J,fe]=Pm({nodeId:T,dragItems:f,nodeLookup:G});r?.(q.sourceEvent,f,J,fe),Q?.(q.sourceEvent,J,fe),T||U?.(q.sourceEvent,fe)}}const P=T2().clickDistance(O).on("start",q=>{const{domNode:G,nodeDragThreshold:k,transform:F,snapGrid:z,snapToGrid:L}=t();p=G?.getBoundingClientRect()||null,x=!1,b=!1,_=q.sourceEvent,k===0&&Z(q),l=fl(q.sourceEvent,{transform:F,snapGrid:z,snapToGrid:L,containerBounds:p}),d=or(q.sourceEvent,p)}).on("drag",q=>{const{autoPanOnNodeDrag:G,transform:k,snapGrid:F,snapToGrid:z,nodeDragThreshold:L,nodeLookup:H}=t(),X=fl(q.sourceEvent,{transform:k,snapGrid:F,snapToGrid:z,containerBounds:p});if(_=q.sourceEvent,(q.sourceEvent.type==="touchmove"&&q.sourceEvent.touches.length>1||T&&!H.has(T))&&(x=!0),!x){if(!h&&G&&g&&(h=!0,j()),!g){const Q=or(q.sourceEvent,p),U=Q.x-d.x,V=Q.y-d.y;Math.sqrt(U*U+V*V)>L&&Z(q)}(l.x!==X.xSnapped||l.y!==X.ySnapped)&&f&&g&&(d=or(q.sourceEvent,p),I(X))}}).on("end",q=>{if(!(!g||x)&&(h=!1,g=!1,cancelAnimationFrame(u),f.size>0)){const{nodeLookup:G,updateNodePositions:k,onNodeDragStop:F,onSelectionDragStop:z}=t();if(b&&(k(f,!1),b=!1),a||F||!T&&z){const[L,H]=Pm({nodeId:T,dragItems:f,nodeLookup:G,dragging:!1});a?.(q.sourceEvent,f,L,H),F?.(q.sourceEvent,L,H),T||z?.(q.sourceEvent,H)}}}).filter(q=>{const G=q.target;return!q.button&&(!N||!x_(G,`.${N}`,A))&&(!w||x_(G,w,A))});v.call(P)}function E(){v?.on(".drag",null)}return{update:C,destroy:E}}function xB(e,t,r){const i=[],a={x:e.x-r,y:e.y-r,width:r*2,height:r*2};for(const l of t.values())Cl(a,Xs(l))>0&&i.push(l);return i}const bB=250;function _B(e,t,r,i){let a=[],l=1/0;const u=xB(e,r,t+bB);for(const f of u){const h=[...f.internals.handleBounds?.source??[],...f.internals.handleBounds?.target??[]];for(const d of h){if(i.nodeId===d.nodeId&&i.type===d.type&&i.id===d.id)continue;const{x:p,y:g}=Ii(f,d,d.position,!0),v=Math.sqrt(Math.pow(p-e.x,2)+Math.pow(g-e.y,2));v>t||(v<l?(a=[{...d,x:p,y:g}],l=v):v===l&&a.push({...d,x:p,y:g}))}}if(!a.length)return null;if(a.length>1){const f=i.type==="source"?"target":"source";return a.find(h=>h.type===f)??a[0]}return a[0]}function cw(e,t,r,i,a,l=!1){const u=i.get(e);if(!u)return null;const f=a==="strict"?u.internals.handleBounds?.[t]:[...u.internals.handleBounds?.source??[],...u.internals.handleBounds?.target??[]],h=(r?f?.find(d=>d.id===r):f?.[0])??null;return h&&l?{...h,...Ii(u,h,h.position,!0)}:h}function uw(e,t){return e||(t?.classList.contains("target")?"target":t?.classList.contains("source")?"source":null)}function EB(e,t){let r=null;return t?r=!0:e&&!t&&(r=!1),r}const fw=()=>!0;function SB(e,{connectionMode:t,connectionRadius:r,handleId:i,nodeId:a,edgeUpdaterType:l,isTarget:u,domNode:f,nodeLookup:h,lib:d,autoPanOnConnect:p,flowId:g,panBy:v,cancelConnection:x,onConnectStart:b,onConnect:_,onConnectEnd:C,isValidConnection:E=fw,onReconnectEnd:N,updateConnection:w,getTransform:A,getFromHandle:M,autoPanSpeed:T,dragThreshold:O=1,handleDomNode:I}){const j=J2(e.target);let Z=0,P;const{x:q,y:G}=or(e),k=uw(l,I),F=f?.getBoundingClientRect();let z=!1;if(!F||!k)return;const L=cw(a,k,i,h,t);if(!L)return;let H=or(e,F),X=!1,Q=null,U=!1,V=null;function ee(){if(!p||!F)return;const[Te,we]=K2(H,F,T);v({x:Te,y:we}),Z=requestAnimationFrame(ee)}const J={...L,nodeId:a,type:k,position:L.position},fe=h.get(a);let he={inProgress:!0,isValid:null,from:Ii(fe,J,Ne.Left,!0),fromHandle:J,fromPosition:J.position,fromNode:fe,to:H,toHandle:null,toPosition:a_[J.position],toNode:null,pointer:H};function ae(){z=!0,w(he),b?.(e,{nodeId:a,handleId:i,handleType:k})}O===0&&ae();function be(Te){if(!z){const{x:re,y:ue}=or(Te),le=re-q,se=ue-G;if(!(le*le+se*se>O*O))return;ae()}if(!M()||!J){ve(Te);return}const we=A();H=or(Te,F),P=_B(Vl(H,we,!1,[1,1]),r,h,J),X||(ee(),X=!0);const xe=dw(Te,{handle:P,connectionMode:t,fromNodeId:a,fromHandleId:i,fromType:u?"target":"source",isValidConnection:E,doc:j,lib:d,flowId:g,nodeLookup:h});V=xe.handleDomNode,Q=xe.connection,U=EB(!!P,xe.isValid);const Ee=h.get(a),Ce=Ee?Ii(Ee,J,Ne.Left,!0):he.from,ie={...he,from:Ce,isValid:U,to:xe.toHandle&&U?gf({x:xe.toHandle.x,y:xe.toHandle.y},we):H,toHandle:xe.toHandle,toPosition:U&&xe.toHandle?xe.toHandle.position:a_[J.position],toNode:xe.toHandle?h.get(xe.toHandle.nodeId):null,pointer:H};w(ie),he=ie}function ve(Te){if(!("touches"in Te&&Te.touches.length>0)){if(z){(P||V)&&Q&&U&&_?.(Q);const{inProgress:we,...xe}=he,Ee={...xe,toPosition:he.toHandle?he.toPosition:null};C?.(Te,Ee),l&&N?.(Te,Ee)}x(),cancelAnimationFrame(Z),X=!1,U=!1,Q=null,V=null,j.removeEventListener("mousemove",be),j.removeEventListener("mouseup",ve),j.removeEventListener("touchmove",be),j.removeEventListener("touchend",ve)}}j.addEventListener("mousemove",be),j.addEventListener("mouseup",ve),j.addEventListener("touchmove",be),j.addEventListener("touchend",ve)}function dw(e,{handle:t,connectionMode:r,fromNodeId:i,fromHandleId:a,fromType:l,doc:u,lib:f,flowId:h,isValidConnection:d=fw,nodeLookup:p}){const g=l==="target",v=t?u.querySelector(`.${f}-flow__handle[data-id="${h}-${t?.nodeId}-${t?.id}-${t?.type}"]`):null,{x,y:b}=or(e),_=u.elementFromPoint(x,b),C=_?.classList.contains(`${f}-flow__handle`)?_:v,E={handleDomNode:C,isValid:!1,connection:null,toHandle:null};if(C){const N=uw(void 0,C),w=C.getAttribute("data-nodeid"),A=C.getAttribute("data-handleid"),M=C.classList.contains("connectable"),T=C.classList.contains("connectableend");if(!w||!N)return E;const O={source:g?w:i,sourceHandle:g?A:a,target:g?i:w,targetHandle:g?a:A};E.connection=O;const j=M&&T&&(r===qs.Strict?g&&N==="source"||!g&&N==="target":w!==i||A!==a);E.isValid=j&&d(O),E.toHandle=cw(w,N,A,p,r,!0)}return E}const Ip={onPointerDown:SB,isValid:dw};function wB({domNode:e,panZoom:t,getTransform:r,getViewScale:i}){const a=Dn(e);function l({translateExtent:f,width:h,height:d,zoomStep:p=1,pannable:g=!0,zoomable:v=!0,inversePan:x=!1}){const b=w=>{if(w.sourceEvent.type!=="wheel"||!t)return;const A=r(),M=w.sourceEvent.ctrlKey&&Tl()?10:1,T=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*p,O=A[2]*Math.pow(2,T*M);t.scaleTo(O)};let _=[0,0];const C=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(_=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY])},E=w=>{const A=r();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!t)return;const M=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],T=[M[0]-_[0],M[1]-_[1]];_=M;const O=i()*Math.max(A[2],Math.log(A[2]))*(x?-1:1),I={x:A[0]-T[0]*O,y:A[1]-T[1]*O},j=[[0,0],[h,d]];t.setViewportConstrained({x:I.x,y:I.y,zoom:A[2]},j,f)},N=P2().on("start",C).on("zoom",g?E:null).on("zoom.wheel",v?b:null);a.call(N,{})}function u(){a.on("zoom",null)}return{update:l,destroy:u,pointer:er}}const td=e=>({x:e.x,y:e.y,zoom:e.k}),jm=({x:e,y:t,zoom:r})=>Qf.translate(e,t).scale(r),Us=(e,t)=>e.target.closest(`.${t}`),hw=(e,t)=>t===2&&Array.isArray(e)&&e.includes(2),CB=e=>((e*=2)<=1?e*e*e:(e-=2)*e*e+2)/2,Vm=(e,t=0,r=CB,i=()=>{})=>{const a=typeof t=="number"&&t>0;return a||i(),a?e.transition().duration(t).ease(r).on("end",i):e},mw=e=>{const t=e.ctrlKey&&Tl()?10:1;return-e.deltaY*(e.deltaMode===1?.05:e.deltaMode?1:.002)*t};function TB({zoomPanValues:e,noWheelClassName:t,d3Selection:r,d3Zoom:i,panOnScrollMode:a,panOnScrollSpeed:l,zoomOnPinch:u,onPanZoomStart:f,onPanZoom:h,onPanZoomEnd:d}){return p=>{if(Us(p,t))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const g=r.property("__zoom").k||1;if(p.ctrlKey&&u){const C=er(p),E=mw(p),N=g*Math.pow(2,E);i.scaleTo(r,N,C,p);return}const v=p.deltaMode===1?20:1;let x=a===zi.Vertical?0:p.deltaX*v,b=a===zi.Horizontal?0:p.deltaY*v;!Tl()&&p.shiftKey&&a!==zi.Vertical&&(x=p.deltaY*v,b=0),i.translateBy(r,-(x/g)*l,-(b/g)*l,{internal:!0});const _=td(r.property("__zoom"));clearTimeout(e.panScrollTimeout),e.isPanScrolling?(h?.(p,_),e.panScrollTimeout=setTimeout(()=>{d?.(p,_),e.isPanScrolling=!1},150)):(e.isPanScrolling=!0,f?.(p,_))}}function RB({noWheelClassName:e,preventScrolling:t,d3ZoomHandler:r}){return function(i,a){const l=i.type==="wheel",u=!t&&l&&!i.ctrlKey,f=Us(i,e);if(i.ctrlKey&&l&&f&&i.preventDefault(),u||f)return null;i.preventDefault(),r.call(this,i,a)}}function AB({zoomPanValues:e,onDraggingChange:t,onPanZoomStart:r}){return i=>{if(i.sourceEvent?.internal)return;const a=td(i.transform);e.mouseButton=i.sourceEvent?.button||0,e.isZoomingOrPanning=!0,e.prevViewport=a,i.sourceEvent?.type==="mousedown"&&t(!0),r&&r?.(i.sourceEvent,a)}}function NB({zoomPanValues:e,panOnDrag:t,onPaneContextMenu:r,onTransformChange:i,onPanZoom:a}){return l=>{e.usedRightMouseButton=!!(r&&hw(t,e.mouseButton??0)),l.sourceEvent?.sync||i([l.transform.x,l.transform.y,l.transform.k]),a&&!l.sourceEvent?.internal&&a?.(l.sourceEvent,td(l.transform))}}function MB({zoomPanValues:e,panOnDrag:t,panOnScroll:r,onDraggingChange:i,onPanZoomEnd:a,onPaneContextMenu:l}){return u=>{if(!u.sourceEvent?.internal&&(e.isZoomingOrPanning=!1,l&&hw(t,e.mouseButton??0)&&!e.usedRightMouseButton&&u.sourceEvent&&l(u.sourceEvent),e.usedRightMouseButton=!1,i(!1),a)){const f=td(u.transform);e.prevViewport=f,clearTimeout(e.timerId),e.timerId=setTimeout(()=>{a?.(u.sourceEvent,f)},r?150:0)}}}function OB({zoomActivationKeyPressed:e,zoomOnScroll:t,zoomOnPinch:r,panOnDrag:i,panOnScroll:a,zoomOnDoubleClick:l,userSelectionActive:u,noWheelClassName:f,noPanClassName:h,lib:d,connectionInProgress:p}){return g=>{const v=e||t,x=r&&g.ctrlKey,b=g.type==="wheel";if(g.button===1&&g.type==="mousedown"&&(Us(g,`${d}-flow__node`)||Us(g,`${d}-flow__edge`)))return!0;if(!i&&!v&&!a&&!l&&!r||u||p&&!b||Us(g,f)&&b||Us(g,h)&&(!b||a&&b&&!e)||!r&&g.ctrlKey&&b)return!1;if(!r&&g.type==="touchstart"&&g.touches?.length>1)return g.preventDefault(),!1;if(!v&&!a&&!x&&b||!i&&(g.type==="mousedown"||g.type==="touchstart")||Array.isArray(i)&&!i.includes(g.button)&&g.type==="mousedown")return!1;const _=Array.isArray(i)&&i.includes(g.button)||!g.button||g.button<=1;return(!g.ctrlKey||b)&&_}}function DB({domNode:e,minZoom:t,maxZoom:r,translateExtent:i,viewport:a,onPanZoom:l,onPanZoomStart:u,onPanZoomEnd:f,onDraggingChange:h}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=e.getBoundingClientRect(),g=P2().scaleExtent([t,r]).translateExtent(i),v=Dn(e).call(g);N({x:a.x,y:a.y,zoom:Ys(a.zoom,t,r)},[[0,0],[p.width,p.height]],i);const x=v.on("wheel.zoom"),b=v.on("dblclick.zoom");g.wheelDelta(mw);function _(P,q){return v?new Promise(G=>{g?.interpolate(q?.interpolate==="linear"?ul:qu).transform(Vm(v,q?.duration,q?.ease,()=>G(!0)),P)}):Promise.resolve(!1)}function C({noWheelClassName:P,noPanClassName:q,onPaneContextMenu:G,userSelectionActive:k,panOnScroll:F,panOnDrag:z,panOnScrollMode:L,panOnScrollSpeed:H,preventScrolling:X,zoomOnPinch:Q,zoomOnScroll:U,zoomOnDoubleClick:V,zoomActivationKeyPressed:ee,lib:J,onTransformChange:fe,connectionInProgress:ye,paneClickDistance:he,selectionOnDrag:ae}){k&&!d.isZoomingOrPanning&&E();const be=F&&!ee&&!k;g.clickDistance(ae?1/0:!rr(he)||he<0?0:he);const ve=be?TB({zoomPanValues:d,noWheelClassName:P,d3Selection:v,d3Zoom:g,panOnScrollMode:L,panOnScrollSpeed:H,zoomOnPinch:Q,onPanZoomStart:u,onPanZoom:l,onPanZoomEnd:f}):RB({noWheelClassName:P,preventScrolling:X,d3ZoomHandler:x});if(v.on("wheel.zoom",ve,{passive:!1}),!k){const we=AB({zoomPanValues:d,onDraggingChange:h,onPanZoomStart:u});g.on("start",we);const xe=NB({zoomPanValues:d,panOnDrag:z,onPaneContextMenu:!!G,onPanZoom:l,onTransformChange:fe});g.on("zoom",xe);const Ee=MB({zoomPanValues:d,panOnDrag:z,panOnScroll:F,onPaneContextMenu:G,onPanZoomEnd:f,onDraggingChange:h});g.on("end",Ee)}const Te=OB({zoomActivationKeyPressed:ee,panOnDrag:z,zoomOnScroll:U,panOnScroll:F,zoomOnDoubleClick:V,zoomOnPinch:Q,userSelectionActive:k,noPanClassName:q,noWheelClassName:P,lib:J,connectionInProgress:ye});g.filter(Te),V?v.on("dblclick.zoom",b):v.on("dblclick.zoom",null)}function E(){g.on("zoom",null)}async function N(P,q,G){const k=jm(P),F=g?.constrain()(k,q,G);return F&&await _(F),new Promise(z=>z(F))}async function w(P,q){const G=jm(P);return await _(G,q),new Promise(k=>k(G))}function A(P){if(v){const q=jm(P),G=v.property("__zoom");(G.k!==P.zoom||G.x!==P.x||G.y!==P.y)&&g?.transform(v,q,null,{sync:!0})}}function M(){const P=v?F2(v.node()):{x:0,y:0,k:1};return{x:P.x,y:P.y,zoom:P.k}}function T(P,q){return v?new Promise(G=>{g?.interpolate(q?.interpolate==="linear"?ul:qu).scaleTo(Vm(v,q?.duration,q?.ease,()=>G(!0)),P)}):Promise.resolve(!1)}function O(P,q){return v?new Promise(G=>{g?.interpolate(q?.interpolate==="linear"?ul:qu).scaleBy(Vm(v,q?.duration,q?.ease,()=>G(!0)),P)}):Promise.resolve(!1)}function I(P){g?.scaleExtent(P)}function j(P){g?.translateExtent(P)}function Z(P){const q=!rr(P)||P<0?0:P;g?.clickDistance(q)}return{update:C,destroy:E,setViewport:w,setViewportConstrained:N,getViewport:M,scaleTo:T,scaleBy:O,setScaleExtent:I,setTranslateExtent:j,syncViewport:A,setClickDistance:Z}}var Ks;(function(e){e.Line="line",e.Handle="handle"})(Ks||(Ks={}));function zB({width:e,prevWidth:t,height:r,prevHeight:i,affectsX:a,affectsY:l}){const u=e-t,f=r-i,h=[u>0?1:u<0?-1:0,f>0?1:f<0?-1:0];return u&&a&&(h[0]=h[0]*-1),f&&l&&(h[1]=h[1]*-1),h}function b_(e){const t=e.includes("right")||e.includes("left"),r=e.includes("bottom")||e.includes("top"),i=e.includes("left"),a=e.includes("top");return{isHorizontal:t,isVertical:r,affectsX:i,affectsY:a}}function ko(e,t){return Math.max(0,t-e)}function Io(e,t){return Math.max(0,e-t)}function Ru(e,t,r){return Math.max(0,t-e,e-r)}function __(e,t){return e?!t:t}function BB(e,t,r,i,a,l,u,f){let{affectsX:h,affectsY:d}=t;const{isHorizontal:p,isVertical:g}=t,v=p&&g,{xSnapped:x,ySnapped:b}=r,{minWidth:_,maxWidth:C,minHeight:E,maxHeight:N}=i,{x:w,y:A,width:M,height:T,aspectRatio:O}=e;let I=Math.floor(p?x-e.pointerX:0),j=Math.floor(g?b-e.pointerY:0);const Z=M+(h?-I:I),P=T+(d?-j:j),q=-l[0]*M,G=-l[1]*T;let k=Ru(Z,_,C),F=Ru(P,E,N);if(u){let H=0,X=0;h&&I<0?H=ko(w+I+q,u[0][0]):!h&&I>0&&(H=Io(w+Z+q,u[1][0])),d&&j<0?X=ko(A+j+G,u[0][1]):!d&&j>0&&(X=Io(A+P+G,u[1][1])),k=Math.max(k,H),F=Math.max(F,X)}if(f){let H=0,X=0;h&&I>0?H=Io(w+I,f[0][0]):!h&&I<0&&(H=ko(w+Z,f[1][0])),d&&j>0?X=Io(A+j,f[0][1]):!d&&j<0&&(X=ko(A+P,f[1][1])),k=Math.max(k,H),F=Math.max(F,X)}if(a){if(p){const H=Ru(Z/O,E,N)*O;if(k=Math.max(k,H),u){let X=0;!h&&!d||h&&!d&&v?X=Io(A+G+Z/O,u[1][1])*O:X=ko(A+G+(h?I:-I)/O,u[0][1])*O,k=Math.max(k,X)}if(f){let X=0;!h&&!d||h&&!d&&v?X=ko(A+Z/O,f[1][1])*O:X=Io(A+(h?I:-I)/O,f[0][1])*O,k=Math.max(k,X)}}if(g){const H=Ru(P*O,_,C)/O;if(F=Math.max(F,H),u){let X=0;!h&&!d||d&&!h&&v?X=Io(w+P*O+q,u[1][0])/O:X=ko(w+(d?j:-j)*O+q,u[0][0])/O,F=Math.max(F,X)}if(f){let X=0;!h&&!d||d&&!h&&v?X=ko(w+P*O,f[1][0])/O:X=Io(w+(d?j:-j)*O,f[0][0])/O,F=Math.max(F,X)}}}j=j+(j<0?F:-F),I=I+(I<0?k:-k),a&&(v?Z>P*O?j=(__(h,d)?-I:I)/O:I=(__(h,d)?-j:j)*O:p?(j=I/O,d=h):(I=j*O,h=d));const z=h?w+I:w,L=d?A+j:A;return{width:M+(h?-I:I),height:T+(d?-j:j),x:l[0]*I*(h?-1:1)+z,y:l[1]*j*(d?-1:1)+L}}const pw={width:0,height:0,x:0,y:0},UB={...pw,pointerX:0,pointerY:0,aspectRatio:1};function LB(e){return[[0,0],[e.measured.width,e.measured.height]]}function kB(e,t,r){const i=t.position.x+e.position.x,a=t.position.y+e.position.y,l=e.measured.width??0,u=e.measured.height??0,f=r[0]*l,h=r[1]*u;return[[i-f,a-h],[i+l-f,a+u-h]]}function IB({domNode:e,nodeId:t,getStoreItems:r,onChange:i,onEnd:a}){const l=Dn(e);let u={controlDirection:b_("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function f({controlPosition:d,boundaries:p,keepAspectRatio:g,resizeDirection:v,onResizeStart:x,onResize:b,onResizeEnd:_,shouldResize:C}){let E={...pw},N={...UB};u={boundaries:p,resizeDirection:v,keepAspectRatio:g,controlDirection:b_(d)};let w,A=null,M=[],T,O,I,j=!1;const Z=T2().on("start",P=>{const{nodeLookup:q,transform:G,snapGrid:k,snapToGrid:F,nodeOrigin:z,paneDomNode:L}=r();if(w=q.get(t),!w)return;A=L?.getBoundingClientRect()??null;const{xSnapped:H,ySnapped:X}=fl(P.sourceEvent,{transform:G,snapGrid:k,snapToGrid:F,containerBounds:A});E={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},N={...E,pointerX:H,pointerY:X,aspectRatio:E.width/E.height},T=void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(T=q.get(w.parentId),O=T&&w.extent==="parent"?LB(T):void 0),M=[],I=void 0;for(const[Q,U]of q)if(U.parentId===t&&(M.push({id:Q,position:{...U.position},extent:U.extent}),U.extent==="parent"||U.expandParent)){const V=kB(U,w,U.origin??z);I?I=[[Math.min(V[0][0],I[0][0]),Math.min(V[0][1],I[0][1])],[Math.max(V[1][0],I[1][0]),Math.max(V[1][1],I[1][1])]]:I=V}x?.(P,{...E})}).on("drag",P=>{const{transform:q,snapGrid:G,snapToGrid:k,nodeOrigin:F}=r(),z=fl(P.sourceEvent,{transform:q,snapGrid:G,snapToGrid:k,containerBounds:A}),L=[];if(!w)return;const{x:H,y:X,width:Q,height:U}=E,V={},ee=w.origin??F,{width:J,height:fe,x:ye,y:he}=BB(N,u.controlDirection,z,u.boundaries,u.keepAspectRatio,ee,O,I),ae=J!==Q,be=fe!==U,ve=ye!==H&&ae,Te=he!==X&&be;if(!ve&&!Te&&!ae&&!be)return;if((ve||Te||ee[0]===1||ee[1]===1)&&(V.x=ve?ye:E.x,V.y=Te?he:E.y,E.x=V.x,E.y=V.y,M.length>0)){const Ce=ye-H,ie=he-X;for(const re of M)re.position={x:re.position.x-Ce+ee[0]*(J-Q),y:re.position.y-ie+ee[1]*(fe-U)},L.push(re)}if((ae||be)&&(V.width=ae&&(!u.resizeDirection||u.resizeDirection==="horizontal")?J:E.width,V.height=be&&(!u.resizeDirection||u.resizeDirection==="vertical")?fe:E.height,E.width=V.width,E.height=V.height),T&&w.expandParent){const Ce=ee[0]*(V.width??0);V.x&&V.x<Ce&&(E.x=Ce,N.x=N.x-(V.x-Ce));const ie=ee[1]*(V.height??0);V.y&&V.y<ie&&(E.y=ie,N.y=N.y-(V.y-ie))}const we=zB({width:E.width,prevWidth:Q,height:E.height,prevHeight:U,affectsX:u.controlDirection.affectsX,affectsY:u.controlDirection.affectsY}),xe={...E,direction:we};C?.(P,xe)!==!1&&(j=!0,b?.(P,xe),i(V,L))}).on("end",P=>{j&&(_?.(P,{...E}),a?.({...E}),j=!1)});l.call(Z)}function h(){l.on(".drag",null)}return{update:f,destroy:h}}var Gm={exports:{}},qm={},Ym={exports:{}},Xm={};var E_;function HB(){if(E_)return Xm;E_=1;var e=Bl();function t(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}var r=typeof Object.is=="function"?Object.is:t,i=e.useState,a=e.useEffect,l=e.useLayoutEffect,u=e.useDebugValue;function f(g,v){var x=v(),b=i({inst:{value:x,getSnapshot:v}}),_=b[0].inst,C=b[1];return l(function(){_.value=x,_.getSnapshot=v,h(_)&&C({inst:_})},[g,x,v]),a(function(){return h(_)&&C({inst:_}),g(function(){h(_)&&C({inst:_})})},[g]),u(x),x}function h(g){var v=g.getSnapshot;g=g.value;try{var x=v();return!r(g,x)}catch{return!0}}function d(g,v){return v()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?d:f;return Xm.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:p,Xm}var S_;function gw(){return S_||(S_=1,Ym.exports=HB()),Ym.exports}var w_;function FB(){if(w_)return qm;w_=1;var e=Bl(),t=gw();function r(d,p){return d===p&&(d!==0||1/d===1/p)||d!==d&&p!==p}var i=typeof Object.is=="function"?Object.is:r,a=t.useSyncExternalStore,l=e.useRef,u=e.useEffect,f=e.useMemo,h=e.useDebugValue;return qm.useSyncExternalStoreWithSelector=function(d,p,g,v,x){var b=l(null);if(b.current===null){var _={hasValue:!1,value:null};b.current=_}else _=b.current;b=f(function(){function E(T){if(!N){if(N=!0,w=T,T=v(T),x!==void 0&&_.hasValue){var O=_.value;if(x(O,T))return A=O}return A=T}if(O=A,i(w,T))return O;var I=v(T);return x!==void 0&&x(O,I)?(w=T,O):(w=T,A=I)}var N=!1,w,A,M=g===void 0?null:g;return[function(){return E(p())},M===null?void 0:function(){return E(M())}]},[p,g,v,x]);var C=a(d,b[0],b[1]);return u(function(){_.hasValue=!0,_.value=C},[C]),h(C),C},qm}var C_;function PB(){return C_||(C_=1,Gm.exports=FB()),Gm.exports}var yw=PB();const jB=LE(yw),VB={},T_=e=>{let t;const r=new Set,i=(p,g)=>{const v=typeof p=="function"?p(t):p;if(!Object.is(v,t)){const x=t;t=g??(typeof v!="object"||v===null)?v:Object.assign({},t,v),r.forEach(b=>b(t,x))}},a=()=>t,h={setState:i,getState:a,getInitialState:()=>d,subscribe:p=>(r.add(p),()=>r.delete(p)),destroy:()=>{(VB?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},d=t=e(i,a,h);return h},GB=e=>e?T_(e):T_,{useDebugValue:qB}=kE,{useSyncExternalStoreWithSelector:YB}=jB,XB=e=>e;function vw(e,t=XB,r){const i=YB(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return qB(i),i}const R_=(e,t)=>{const r=GB(e),i=(a,l=t)=>vw(r,a,l);return Object.assign(i,r),i},$B=(e,t)=>e?R_(e,t):R_;function bt(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;if(e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(const[i,a]of e)if(!Object.is(a,t.get(i)))return!1;return!0}if(e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(const i of e)if(!t.has(i))return!1;return!0}const r=Object.keys(e);if(r.length!==Object.keys(t).length)return!1;for(const i of r)if(!Object.prototype.hasOwnProperty.call(t,i)||!Object.is(e[i],t[i]))return!1;return!0}var Gl=HE();const nd=R.createContext(null),KB=nd.Provider,xw=Er.error001();function Ke(e,t){const r=R.useContext(nd);if(r===null)throw new Error(xw);return vw(r,e,t)}function ht(){const e=R.useContext(nd);if(e===null)throw new Error(xw);return R.useMemo(()=>({getState:e.getState,setState:e.setState,subscribe:e.subscribe}),[e])}const A_={display:"none"},ZB={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},bw="react-flow__node-desc",_w="react-flow__edge-desc",QB="react-flow__aria-live",WB=e=>e.ariaLiveMessage,JB=e=>e.ariaLabelConfig;function eU({rfId:e}){const t=Ke(WB);return D.jsx("div",{id:`${QB}-${e}`,"aria-live":"assertive","aria-atomic":"true",style:ZB,children:t})}function tU({rfId:e,disableKeyboardA11y:t}){const r=Ke(JB);return D.jsxs(D.Fragment,{children:[D.jsx("div",{id:`${bw}-${e}`,style:A_,children:t?r["node.a11yDescription.default"]:r["node.a11yDescription.keyboardDisabled"]}),D.jsx("div",{id:`${_w}-${e}`,style:A_,children:r["edge.a11yDescription.default"]}),!t&&D.jsx(eU,{rfId:e})]})}const Zs=R.forwardRef(({position:e="top-left",children:t,className:r,style:i,...a},l)=>{const u=`${e}`.split("-");return D.jsx("div",{className:Ft(["react-flow__panel",r,...u]),style:i,ref:l,...a,children:t})});Zs.displayName="Panel";function nU({proOptions:e,position:t="bottom-right"}){return e?.hideAttribution?null:D.jsx(Zs,{position:t,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:D.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const rU=e=>{const t=[],r=[];for(const[,i]of e.nodeLookup)i.selected&&t.push(i.internals.userNode);for(const[,i]of e.edgeLookup)i.selected&&r.push(i);return{selectedNodes:t,selectedEdges:r}},Au=e=>e.id;function oU(e,t){return bt(e.selectedNodes.map(Au),t.selectedNodes.map(Au))&&bt(e.selectedEdges.map(Au),t.selectedEdges.map(Au))}function iU({onSelectionChange:e}){const t=ht(),{selectedNodes:r,selectedEdges:i}=Ke(rU,oU);return R.useEffect(()=>{const a={nodes:r,edges:i};e?.(a),t.getState().onSelectionChangeHandlers.forEach(l=>l(a))},[r,i,e]),null}const sU=e=>!!e.onSelectionChangeHandlers;function aU({onSelectionChange:e}){const t=Ke(sU);return e||t?D.jsx(iU,{onSelectionChange:e}):null}const Ew=[0,0],lU={x:0,y:0,zoom:1},cU=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],N_=[...cU,"rfId"],uU=e=>({setNodes:e.setNodes,setEdges:e.setEdges,setMinZoom:e.setMinZoom,setMaxZoom:e.setMaxZoom,setTranslateExtent:e.setTranslateExtent,setNodeExtent:e.setNodeExtent,reset:e.reset,setDefaultNodesAndEdges:e.setDefaultNodesAndEdges}),M_={translateExtent:Sl,nodeOrigin:Ew,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function fU(e){const{setNodes:t,setEdges:r,setMinZoom:i,setMaxZoom:a,setTranslateExtent:l,setNodeExtent:u,reset:f,setDefaultNodesAndEdges:h}=Ke(uU,bt),d=ht();R.useEffect(()=>(h(e.defaultNodes,e.defaultEdges),()=>{p.current=M_,f()}),[]);const p=R.useRef(M_);return R.useEffect(()=>{for(const g of N_){const v=e[g],x=p.current[g];v!==x&&(typeof e[g]>"u"||(g==="nodes"?t(v):g==="edges"?r(v):g==="minZoom"?i(v):g==="maxZoom"?a(v):g==="translateExtent"?l(v):g==="nodeExtent"?u(v):g==="ariaLabelConfig"?d.setState({ariaLabelConfig:Q6(v)}):g==="fitView"?d.setState({fitViewQueued:v}):g==="fitViewOptions"?d.setState({fitViewOptions:v}):d.setState({[g]:v})))}p.current=e},N_.map(g=>e[g])),null}function O_(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function dU(e){const[t,r]=R.useState(e==="system"?null:e);return R.useEffect(()=>{if(e!=="system"){r(e);return}const i=O_(),a=()=>r(i?.matches?"dark":"light");return a(),i?.addEventListener("change",a),()=>{i?.removeEventListener("change",a)}},[e]),t!==null?t:O_()?.matches?"dark":"light"}const D_=typeof document<"u"?document:null;function Rl(e=null,t={target:D_,actInsideInputWithModifier:!0}){const[r,i]=R.useState(!1),a=R.useRef(!1),l=R.useRef(new Set([])),[u,f]=R.useMemo(()=>{if(e!==null){const d=(Array.isArray(e)?e:[e]).filter(g=>typeof g=="string").map(g=>g.replace("+",`
1845
+ `).replace(`
1846
+
1847
+ `,`
1848
+ +`).split(`
1849
+ `)),p=d.reduce((g,v)=>g.concat(...v),[]);return[d,p]}return[[],[]]},[e]);return R.useEffect(()=>{const h=t?.target??D_,d=t?.actInsideInputWithModifier??!0;if(e!==null){const p=x=>{if(a.current=x.ctrlKey||x.metaKey||x.shiftKey||x.altKey,(!a.current||a.current&&!d)&&ew(x))return!1;const _=B_(x.code,f);if(l.current.add(x[_]),z_(u,l.current,!1)){const C=x.composedPath?.()?.[0]||x.target,E=C?.nodeName==="BUTTON"||C?.nodeName==="A";t.preventDefault!==!1&&(a.current||!E)&&x.preventDefault(),i(!0)}},g=x=>{const b=B_(x.code,f);z_(u,l.current,!0)?(i(!1),l.current.clear()):l.current.delete(x[b]),x.key==="Meta"&&l.current.clear(),a.current=!1},v=()=>{l.current.clear(),i(!1)};return h?.addEventListener("keydown",p),h?.addEventListener("keyup",g),window.addEventListener("blur",v),window.addEventListener("contextmenu",v),()=>{h?.removeEventListener("keydown",p),h?.removeEventListener("keyup",g),window.removeEventListener("blur",v),window.removeEventListener("contextmenu",v)}}},[e,i]),r}function z_(e,t,r){return e.filter(i=>r||i.length===t.size).some(i=>i.every(a=>t.has(a)))}function B_(e,t){return t.includes(e)?"code":"key"}const hU=()=>{const e=ht();return R.useMemo(()=>({zoomIn:t=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomOut:t=>{const{panZoom:r}=e.getState();return r?r.scaleBy(1/1.2,{duration:t?.duration}):Promise.resolve(!1)},zoomTo:(t,r)=>{const{panZoom:i}=e.getState();return i?i.scaleTo(t,{duration:r?.duration}):Promise.resolve(!1)},getZoom:()=>e.getState().transform[2],setViewport:async(t,r)=>{const{transform:[i,a,l],panZoom:u}=e.getState();return u?(await u.setViewport({x:t.x??i,y:t.y??a,zoom:t.zoom??l},r),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[t,r,i]=e.getState().transform;return{x:t,y:r,zoom:i}},setCenter:async(t,r,i)=>e.getState().setCenter(t,r,i),fitBounds:async(t,r)=>{const{width:i,height:a,minZoom:l,maxZoom:u,panZoom:f}=e.getState(),h=K0(t,i,a,l,u,r?.padding??.1);return f?(await f.setViewport(h,{duration:r?.duration,ease:r?.ease,interpolate:r?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(t,r={})=>{const{transform:i,snapGrid:a,snapToGrid:l,domNode:u}=e.getState();if(!u)return t;const{x:f,y:h}=u.getBoundingClientRect(),d={x:t.x-f,y:t.y-h},p=r.snapGrid??a,g=r.snapToGrid??l;return Vl(d,i,g,p)},flowToScreenPosition:t=>{const{transform:r,domNode:i}=e.getState();if(!i)return t;const{x:a,y:l}=i.getBoundingClientRect(),u=gf(t,r);return{x:u.x+a,y:u.y+l}}}),[])};function Sw(e,t){const r=[],i=new Map,a=[];for(const l of e)if(l.type==="add"){a.push(l);continue}else if(l.type==="remove"||l.type==="replace")i.set(l.id,[l]);else{const u=i.get(l.id);u?u.push(l):i.set(l.id,[l])}for(const l of t){const u=i.get(l.id);if(!u){r.push(l);continue}if(u[0].type==="remove")continue;if(u[0].type==="replace"){r.push({...u[0].item});continue}const f={...l};for(const h of u)mU(h,f);r.push(f)}return a.length&&a.forEach(l=>{l.index!==void 0?r.splice(l.index,0,{...l.item}):r.push({...l.item})}),r}function mU(e,t){switch(e.type){case"select":{t.selected=e.selected;break}case"position":{typeof e.position<"u"&&(t.position=e.position),typeof e.dragging<"u"&&(t.dragging=e.dragging);break}case"dimensions":{typeof e.dimensions<"u"&&(t.measured={...e.dimensions},e.setAttributes&&((e.setAttributes===!0||e.setAttributes==="width")&&(t.width=e.dimensions.width),(e.setAttributes===!0||e.setAttributes==="height")&&(t.height=e.dimensions.height))),typeof e.resizing=="boolean"&&(t.resizing=e.resizing);break}}}function ww(e,t){return Sw(e,t)}function Cw(e,t){return Sw(e,t)}function Ai(e,t){return{id:e,type:"select",selected:t}}function Ls(e,t=new Set,r=!1){const i=[];for(const[a,l]of e){const u=t.has(a);!(l.selected===void 0&&!u)&&l.selected!==u&&(r&&(l.selected=u),i.push(Ai(l.id,u)))}return i}function U_({items:e=[],lookup:t}){const r=[],i=new Map(e.map(a=>[a.id,a]));for(const[a,l]of e.entries()){const u=t.get(l.id),f=u?.internals?.userNode??u;f!==void 0&&f!==l&&r.push({id:l.id,item:l,type:"replace"}),f===void 0&&r.push({item:l,type:"add",index:a})}for(const[a]of t)i.get(a)===void 0&&r.push({id:a,type:"remove"});return r}function L_(e){return{id:e.id,type:"remove"}}const k_=e=>F6(e),pU=e=>Y2(e);function Tw(e){return R.forwardRef(e)}const gU=typeof window<"u"?R.useLayoutEffect:R.useEffect;function I_(e){const[t,r]=R.useState(BigInt(0)),[i]=R.useState(()=>yU(()=>r(a=>a+BigInt(1))));return gU(()=>{const a=i.get();a.length&&(e(a),i.reset())},[t]),i}function yU(e){let t=[];return{get:()=>t,reset:()=>{t=[]},push:r=>{t.push(r),e()}}}const Rw=R.createContext(null);function vU({children:e}){const t=ht(),r=R.useCallback(f=>{const{nodes:h=[],setNodes:d,hasDefaultNodes:p,onNodesChange:g,nodeLookup:v,fitViewQueued:x,onNodesChangeMiddlewareMap:b}=t.getState();let _=h;for(const E of f)_=typeof E=="function"?E(_):E;let C=U_({items:_,lookup:v});for(const E of b.values())C=E(C);p&&d(_),C.length>0?g?.(C):x&&window.requestAnimationFrame(()=>{const{fitViewQueued:E,nodes:N,setNodes:w}=t.getState();E&&w(N)})},[]),i=I_(r),a=R.useCallback(f=>{const{edges:h=[],setEdges:d,hasDefaultEdges:p,onEdgesChange:g,edgeLookup:v}=t.getState();let x=h;for(const b of f)x=typeof b=="function"?b(x):b;p?d(x):g&&g(U_({items:x,lookup:v}))},[]),l=I_(a),u=R.useMemo(()=>({nodeQueue:i,edgeQueue:l}),[]);return D.jsx(Rw.Provider,{value:u,children:e})}function xU(){const e=R.useContext(Rw);if(!e)throw new Error("useBatchContext must be used within a BatchProvider");return e}const bU=e=>!!e.panZoom;function rd(){const e=hU(),t=ht(),r=xU(),i=Ke(bU),a=R.useMemo(()=>{const l=g=>t.getState().nodeLookup.get(g),u=g=>{r.nodeQueue.push(g)},f=g=>{r.edgeQueue.push(g)},h=g=>{const{nodeLookup:v,nodeOrigin:x}=t.getState(),b=k_(g)?g:v.get(g.id),_=b.parentId?W2(b.position,b.measured,b.parentId,v,x):b.position,C={...b,position:_,width:b.measured?.width??b.width,height:b.measured?.height??b.height};return Xs(C)},d=(g,v,x={replace:!1})=>{u(b=>b.map(_=>{if(_.id===g){const C=typeof v=="function"?v(_):v;return x.replace&&k_(C)?C:{..._,...C}}return _}))},p=(g,v,x={replace:!1})=>{f(b=>b.map(_=>{if(_.id===g){const C=typeof v=="function"?v(_):v;return x.replace&&pU(C)?C:{..._,...C}}return _}))};return{getNodes:()=>t.getState().nodes.map(g=>({...g})),getNode:g=>l(g)?.internals.userNode,getInternalNode:l,getEdges:()=>{const{edges:g=[]}=t.getState();return g.map(v=>({...v}))},getEdge:g=>t.getState().edgeLookup.get(g),setNodes:u,setEdges:f,addNodes:g=>{const v=Array.isArray(g)?g:[g];r.nodeQueue.push(x=>[...x,...v])},addEdges:g=>{const v=Array.isArray(g)?g:[g];r.edgeQueue.push(x=>[...x,...v])},toObject:()=>{const{nodes:g=[],edges:v=[],transform:x}=t.getState(),[b,_,C]=x;return{nodes:g.map(E=>({...E})),edges:v.map(E=>({...E})),viewport:{x:b,y:_,zoom:C}}},deleteElements:async({nodes:g=[],edges:v=[]})=>{const{nodes:x,edges:b,onNodesDelete:_,onEdgesDelete:C,triggerNodeChanges:E,triggerEdgeChanges:N,onDelete:w,onBeforeDelete:A}=t.getState(),{nodes:M,edges:T}=await Y6({nodesToRemove:g,edgesToRemove:v,nodes:x,edges:b,onBeforeDelete:A}),O=T.length>0,I=M.length>0;if(O){const j=T.map(L_);C?.(T),N(j)}if(I){const j=M.map(L_);_?.(M),E(j)}return(I||O)&&w?.({nodes:M,edges:T}),{deletedNodes:M,deletedEdges:T}},getIntersectingNodes:(g,v=!0,x)=>{const b=c_(g),_=b?g:h(g),C=x!==void 0;return _?(x||t.getState().nodes).filter(E=>{const N=t.getState().nodeLookup.get(E.id);if(N&&!b&&(E.id===g.id||!N.internals.positionAbsolute))return!1;const w=Xs(C?E:N),A=Cl(w,_);return v&&A>0||A>=w.width*w.height||A>=_.width*_.height}):[]},isNodeIntersecting:(g,v,x=!0)=>{const _=c_(g)?g:h(g);if(!_)return!1;const C=Cl(_,v);return x&&C>0||C>=v.width*v.height||C>=_.width*_.height},updateNode:d,updateNodeData:(g,v,x={replace:!1})=>{d(g,b=>{const _=typeof v=="function"?v(b):v;return x.replace?{...b,data:_}:{...b,data:{...b.data,..._}}},x)},updateEdge:p,updateEdgeData:(g,v,x={replace:!1})=>{p(g,b=>{const _=typeof v=="function"?v(b):v;return x.replace?{...b,data:_}:{...b,data:{...b.data,..._}}},x)},getNodesBounds:g=>{const{nodeLookup:v,nodeOrigin:x}=t.getState();return j6(g,{nodeLookup:v,nodeOrigin:x})},getHandleConnections:({type:g,id:v,nodeId:x})=>Array.from(t.getState().connectionLookup.get(`${x}-${g}${v?`-${v}`:""}`)?.values()??[]),getNodeConnections:({type:g,handleId:v,nodeId:x})=>Array.from(t.getState().connectionLookup.get(`${x}${g?v?`-${g}-${v}`:`-${g}`:""}`)?.values()??[]),fitView:async g=>{const v=t.getState().fitViewResolver??Z6();return t.setState({fitViewQueued:!0,fitViewOptions:g,fitViewResolver:v}),r.nodeQueue.push(x=>[...x]),v.promise}}},[]);return R.useMemo(()=>({...a,...e,viewportInitialized:i}),[i])}const H_=e=>e.selected,_U=typeof window<"u"?window:void 0;function EU({deleteKeyCode:e,multiSelectionKeyCode:t}){const r=ht(),{deleteElements:i}=rd(),a=Rl(e,{actInsideInputWithModifier:!1}),l=Rl(t,{target:_U});R.useEffect(()=>{if(a){const{edges:u,nodes:f}=r.getState();i({nodes:f.filter(H_),edges:u.filter(H_)}),r.setState({nodesSelectionActive:!1})}},[a]),R.useEffect(()=>{r.setState({multiSelectionActive:l})},[l])}function SU(e){const t=ht();R.useEffect(()=>{const r=()=>{if(!e.current||!(e.current.checkVisibility?.()??!0))return!1;const i=Z0(e.current);(i.height===0||i.width===0)&&t.getState().onError?.("004",Er.error004()),t.setState({width:i.width||500,height:i.height||500})};if(e.current){r(),window.addEventListener("resize",r);const i=new ResizeObserver(()=>r());return i.observe(e.current),()=>{window.removeEventListener("resize",r),i&&e.current&&i.unobserve(e.current)}}},[])}const od={position:"absolute",width:"100%",height:"100%",top:0,left:0},wU=e=>({userSelectionActive:e.userSelectionActive,lib:e.lib,connectionInProgress:e.connection.inProgress});function CU({onPaneContextMenu:e,zoomOnScroll:t=!0,zoomOnPinch:r=!0,panOnScroll:i=!1,panOnScrollSpeed:a=.5,panOnScrollMode:l=zi.Free,zoomOnDoubleClick:u=!0,panOnDrag:f=!0,defaultViewport:h,translateExtent:d,minZoom:p,maxZoom:g,zoomActivationKeyCode:v,preventScrolling:x=!0,children:b,noWheelClassName:_,noPanClassName:C,onViewportChange:E,isControlledViewport:N,paneClickDistance:w,selectionOnDrag:A}){const M=ht(),T=R.useRef(null),{userSelectionActive:O,lib:I,connectionInProgress:j}=Ke(wU,bt),Z=Rl(v),P=R.useRef();SU(T);const q=R.useCallback(G=>{E?.({x:G[0],y:G[1],zoom:G[2]}),N||M.setState({transform:G})},[E,N]);return R.useEffect(()=>{if(T.current){P.current=DB({domNode:T.current,minZoom:p,maxZoom:g,translateExtent:d,viewport:h,onDraggingChange:z=>M.setState(L=>L.paneDragging===z?L:{paneDragging:z}),onPanZoomStart:(z,L)=>{const{onViewportChangeStart:H,onMoveStart:X}=M.getState();X?.(z,L),H?.(L)},onPanZoom:(z,L)=>{const{onViewportChange:H,onMove:X}=M.getState();X?.(z,L),H?.(L)},onPanZoomEnd:(z,L)=>{const{onViewportChangeEnd:H,onMoveEnd:X}=M.getState();X?.(z,L),H?.(L)}});const{x:G,y:k,zoom:F}=P.current.getViewport();return M.setState({panZoom:P.current,transform:[G,k,F],domNode:T.current.closest(".react-flow")}),()=>{P.current?.destroy()}}},[]),R.useEffect(()=>{P.current?.update({onPaneContextMenu:e,zoomOnScroll:t,zoomOnPinch:r,panOnScroll:i,panOnScrollSpeed:a,panOnScrollMode:l,zoomOnDoubleClick:u,panOnDrag:f,zoomActivationKeyPressed:Z,preventScrolling:x,noPanClassName:C,userSelectionActive:O,noWheelClassName:_,lib:I,onTransformChange:q,connectionInProgress:j,selectionOnDrag:A,paneClickDistance:w})},[e,t,r,i,a,l,u,f,Z,x,C,O,_,I,q,j,A,w]),D.jsx("div",{className:"react-flow__renderer",ref:T,style:od,children:b})}const TU=e=>({userSelectionActive:e.userSelectionActive,userSelectionRect:e.userSelectionRect});function RU(){const{userSelectionActive:e,userSelectionRect:t}=Ke(TU,bt);return e&&t?D.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:t.width,height:t.height,transform:`translate(${t.x}px, ${t.y}px)`}}):null}const $m=(e,t)=>r=>{r.target===t.current&&e?.(r)},AU=e=>({userSelectionActive:e.userSelectionActive,elementsSelectable:e.elementsSelectable,connectionInProgress:e.connection.inProgress,dragging:e.paneDragging});function NU({isSelecting:e,selectionKeyPressed:t,selectionMode:r=wl.Full,panOnDrag:i,paneClickDistance:a,selectionOnDrag:l,onSelectionStart:u,onSelectionEnd:f,onPaneClick:h,onPaneContextMenu:d,onPaneScroll:p,onPaneMouseEnter:g,onPaneMouseMove:v,onPaneMouseLeave:x,children:b}){const _=ht(),{userSelectionActive:C,elementsSelectable:E,dragging:N,connectionInProgress:w}=Ke(AU,bt),A=E&&(e||C),M=R.useRef(null),T=R.useRef(),O=R.useRef(new Set),I=R.useRef(new Set),j=R.useRef(!1),Z=H=>{if(j.current||w){j.current=!1;return}h?.(H),_.getState().resetSelectedElements(),_.setState({nodesSelectionActive:!1})},P=H=>{if(Array.isArray(i)&&i?.includes(2)){H.preventDefault();return}d?.(H)},q=p?H=>p(H):void 0,G=H=>{j.current&&(H.stopPropagation(),j.current=!1)},k=H=>{const{domNode:X}=_.getState();if(T.current=X?.getBoundingClientRect(),!T.current)return;const Q=H.target===M.current;if(!Q&&!!H.target.closest(".nokey")||!e||!(l&&Q||t)||H.button!==0||!H.isPrimary)return;H.target?.setPointerCapture?.(H.pointerId),j.current=!1;const{x:ee,y:J}=or(H.nativeEvent,T.current);_.setState({userSelectionRect:{width:0,height:0,startX:ee,startY:J,x:ee,y:J}}),Q||(H.stopPropagation(),H.preventDefault())},F=H=>{const{userSelectionRect:X,transform:Q,nodeLookup:U,edgeLookup:V,connectionLookup:ee,triggerNodeChanges:J,triggerEdgeChanges:fe,defaultEdgeOptions:ye,resetSelectedElements:he}=_.getState();if(!T.current||!X)return;const{x:ae,y:be}=or(H.nativeEvent,T.current),{startX:ve,startY:Te}=X;if(!j.current){const ie=t?0:a;if(Math.hypot(ae-ve,be-Te)<=ie)return;he(),u?.(H)}j.current=!0;const we={startX:ve,startY:Te,x:ae<ve?ae:ve,y:be<Te?be:Te,width:Math.abs(ae-ve),height:Math.abs(be-Te)},xe=O.current,Ee=I.current;O.current=new Set($0(U,we,Q,r===wl.Partial,!0).map(ie=>ie.id)),I.current=new Set;const Ce=ye?.selectable??!0;for(const ie of O.current){const re=ee.get(ie);if(re)for(const{edgeId:ue}of re.values()){const le=V.get(ue);le&&(le.selectable??Ce)&&I.current.add(ue)}}if(!u_(xe,O.current)){const ie=Ls(U,O.current,!0);J(ie)}if(!u_(Ee,I.current)){const ie=Ls(V,I.current);fe(ie)}_.setState({userSelectionRect:we,userSelectionActive:!0,nodesSelectionActive:!1})},z=H=>{H.button===0&&(H.target?.releasePointerCapture?.(H.pointerId),!C&&H.target===M.current&&_.getState().userSelectionRect&&Z?.(H),_.setState({userSelectionActive:!1,userSelectionRect:null}),j.current&&(f?.(H),_.setState({nodesSelectionActive:O.current.size>0})))},L=i===!0||Array.isArray(i)&&i.includes(0);return D.jsxs("div",{className:Ft(["react-flow__pane",{draggable:L,dragging:N,selection:e}]),onClick:A?void 0:$m(Z,M),onContextMenu:$m(P,M),onWheel:$m(q,M),onPointerEnter:A?void 0:g,onPointerMove:A?F:v,onPointerUp:A?z:void 0,onPointerDownCapture:A?k:void 0,onClickCapture:A?G:void 0,onPointerLeave:x,ref:M,style:od,children:[b,D.jsx(RU,{})]})}function Hp({id:e,store:t,unselect:r=!1,nodeRef:i}){const{addSelectedNodes:a,unselectNodesAndEdges:l,multiSelectionActive:u,nodeLookup:f,onError:h}=t.getState(),d=f.get(e);if(!d){h?.("012",Er.error012(e));return}t.setState({nodesSelectionActive:!1}),d.selected?(r||d.selected&&u)&&(l({nodes:[d],edges:[]}),requestAnimationFrame(()=>i?.current?.blur())):a([e])}function Aw({nodeRef:e,disabled:t=!1,noDragClassName:r,handleSelector:i,nodeId:a,isSelectable:l,nodeClickDistance:u}){const f=ht(),[h,d]=R.useState(!1),p=R.useRef();return R.useEffect(()=>{p.current=vB({getStoreItems:()=>f.getState(),onNodeMouseDown:g=>{Hp({id:g,store:f,nodeRef:e})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),R.useEffect(()=>{if(!(t||!e.current||!p.current))return p.current.update({noDragClassName:r,handleSelector:i,domNode:e.current,isSelectable:l,nodeId:a,nodeClickDistance:u}),()=>{p.current?.destroy()}},[r,i,t,l,e,a,u]),h}const MU=e=>t=>t.selected&&(t.draggable||e&&typeof t.draggable>"u");function Nw(){const e=ht();return R.useCallback(r=>{const{nodeExtent:i,snapToGrid:a,snapGrid:l,nodesDraggable:u,onError:f,updateNodePositions:h,nodeLookup:d,nodeOrigin:p}=e.getState(),g=new Map,v=MU(u),x=a?l[0]:5,b=a?l[1]:5,_=r.direction.x*x*r.factor,C=r.direction.y*b*r.factor;for(const[,E]of d){if(!v(E))continue;let N={x:E.internals.positionAbsolute.x+_,y:E.internals.positionAbsolute.y+C};a&&(N=jl(N,l));const{position:w,positionAbsolute:A}=X2({nodeId:E.id,nextPosition:N,nodeLookup:d,nodeExtent:i,nodeOrigin:p,onError:f});E.position=w,E.internals.positionAbsolute=A,g.set(E.id,E)}h(g)},[])}const ng=R.createContext(null),OU=ng.Provider;ng.Consumer;const Mw=()=>R.useContext(ng),DU=e=>({connectOnClick:e.connectOnClick,noPanClassName:e.noPanClassName,rfId:e.rfId}),zU=(e,t,r)=>i=>{const{connectionClickStartHandle:a,connectionMode:l,connection:u}=i,{fromHandle:f,toHandle:h,isValid:d}=u,p=h?.nodeId===e&&h?.id===t&&h?.type===r;return{connectingFrom:f?.nodeId===e&&f?.id===t&&f?.type===r,connectingTo:p,clickConnecting:a?.nodeId===e&&a?.id===t&&a?.type===r,isPossibleEndHandle:l===qs.Strict?f?.type!==r:e!==f?.nodeId||t!==f?.id,connectionInProcess:!!f,clickConnectionInProcess:!!a,valid:p&&d}};function BU({type:e="source",position:t=Ne.Top,isValidConnection:r,isConnectable:i=!0,isConnectableStart:a=!0,isConnectableEnd:l=!0,id:u,onConnect:f,children:h,className:d,onMouseDown:p,onTouchStart:g,...v},x){const b=u||null,_=e==="target",C=ht(),E=Mw(),{connectOnClick:N,noPanClassName:w,rfId:A}=Ke(DU,bt),{connectingFrom:M,connectingTo:T,clickConnecting:O,isPossibleEndHandle:I,connectionInProcess:j,clickConnectionInProcess:Z,valid:P}=Ke(zU(E,b,e),bt);E||C.getState().onError?.("010",Er.error010());const q=F=>{const{defaultEdgeOptions:z,onConnect:L,hasDefaultEdges:H}=C.getState(),X={...z,...F};if(H){const{edges:Q,setEdges:U}=C.getState();U(Bp(X,Q))}L?.(X),f?.(X)},G=F=>{if(!E)return;const z=tw(F.nativeEvent);if(a&&(z&&F.button===0||!z)){const L=C.getState();Ip.onPointerDown(F.nativeEvent,{handleDomNode:F.currentTarget,autoPanOnConnect:L.autoPanOnConnect,connectionMode:L.connectionMode,connectionRadius:L.connectionRadius,domNode:L.domNode,nodeLookup:L.nodeLookup,lib:L.lib,isTarget:_,handleId:b,nodeId:E,flowId:L.rfId,panBy:L.panBy,cancelConnection:L.cancelConnection,onConnectStart:L.onConnectStart,onConnectEnd:(...H)=>C.getState().onConnectEnd?.(...H),updateConnection:L.updateConnection,onConnect:q,isValidConnection:r||((...H)=>C.getState().isValidConnection?.(...H)??!0),getTransform:()=>C.getState().transform,getFromHandle:()=>C.getState().connection.fromHandle,autoPanSpeed:L.autoPanSpeed,dragThreshold:L.connectionDragThreshold})}z?p?.(F):g?.(F)},k=F=>{const{onClickConnectStart:z,onClickConnectEnd:L,connectionClickStartHandle:H,connectionMode:X,isValidConnection:Q,lib:U,rfId:V,nodeLookup:ee,connection:J}=C.getState();if(!E||!H&&!a)return;if(!H){z?.(F.nativeEvent,{nodeId:E,handleId:b,handleType:e}),C.setState({connectionClickStartHandle:{nodeId:E,type:e,id:b}});return}const fe=J2(F.target),ye=r||Q,{connection:he,isValid:ae}=Ip.isValid(F.nativeEvent,{handle:{nodeId:E,id:b,type:e},connectionMode:X,fromNodeId:H.nodeId,fromHandleId:H.id||null,fromType:H.type,isValidConnection:ye,flowId:V,doc:fe,lib:U,nodeLookup:ee});ae&&he&&q(he);const be=structuredClone(J);delete be.inProgress,be.toPosition=be.toHandle?be.toHandle.position:null,L?.(F,be),C.setState({connectionClickStartHandle:null})};return D.jsx("div",{"data-handleid":b,"data-nodeid":E,"data-handlepos":t,"data-id":`${A}-${E}-${b}-${e}`,className:Ft(["react-flow__handle",`react-flow__handle-${t}`,"nodrag",w,d,{source:!_,target:_,connectable:i,connectablestart:a,connectableend:l,clickconnecting:O,connectingfrom:M,connectingto:T,valid:P,connectionindicator:i&&(!j||I)&&(j||Z?l:a)}]),onMouseDown:G,onTouchStart:G,onClick:N?k:void 0,ref:x,...v,children:h})}const Al=R.memo(Tw(BU));function UU({data:e,isConnectable:t,sourcePosition:r=Ne.Bottom}){return D.jsxs(D.Fragment,{children:[e?.label,D.jsx(Al,{type:"source",position:r,isConnectable:t})]})}function LU({data:e,isConnectable:t,targetPosition:r=Ne.Top,sourcePosition:i=Ne.Bottom}){return D.jsxs(D.Fragment,{children:[D.jsx(Al,{type:"target",position:r,isConnectable:t}),e?.label,D.jsx(Al,{type:"source",position:i,isConnectable:t})]})}function kU(){return null}function IU({data:e,isConnectable:t,targetPosition:r=Ne.Top}){return D.jsxs(D.Fragment,{children:[D.jsx(Al,{type:"target",position:r,isConnectable:t}),e?.label]})}const yf={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},F_={input:UU,default:LU,output:IU,group:kU};function HU(e){return e.internals.handleBounds===void 0?{width:e.width??e.initialWidth??e.style?.width,height:e.height??e.initialHeight??e.style?.height}:{width:e.width??e.style?.width,height:e.height??e.style?.height}}const FU=e=>{const{width:t,height:r,x:i,y:a}=Pl(e.nodeLookup,{filter:l=>!!l.selected});return{width:rr(t)?t:null,height:rr(r)?r:null,userSelectionActive:e.userSelectionActive,transformString:`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]}) translate(${i}px,${a}px)`}};function PU({onSelectionContextMenu:e,noPanClassName:t,disableKeyboardA11y:r}){const i=ht(),{width:a,height:l,transformString:u,userSelectionActive:f}=Ke(FU,bt),h=Nw(),d=R.useRef(null);R.useEffect(()=>{r||d.current?.focus({preventScroll:!0})},[r]);const p=!f&&a!==null&&l!==null;if(Aw({nodeRef:d,disabled:!p}),!p)return null;const g=e?x=>{const b=i.getState().nodes.filter(_=>_.selected);e(x,b)}:void 0,v=x=>{Object.prototype.hasOwnProperty.call(yf,x.key)&&(x.preventDefault(),h({direction:yf[x.key],factor:x.shiftKey?4:1}))};return D.jsx("div",{className:Ft(["react-flow__nodesselection","react-flow__container",t]),style:{transform:u},children:D.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:g,tabIndex:r?void 0:-1,onKeyDown:r?void 0:v,style:{width:a,height:l}})})}const P_=typeof window<"u"?window:void 0,jU=e=>({nodesSelectionActive:e.nodesSelectionActive,userSelectionActive:e.userSelectionActive});function Ow({children:e,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:u,paneClickDistance:f,deleteKeyCode:h,selectionKeyCode:d,selectionOnDrag:p,selectionMode:g,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:b,panActivationKeyCode:_,zoomActivationKeyCode:C,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:w,panOnScroll:A,panOnScrollSpeed:M,panOnScrollMode:T,zoomOnDoubleClick:O,panOnDrag:I,defaultViewport:j,translateExtent:Z,minZoom:P,maxZoom:q,preventScrolling:G,onSelectionContextMenu:k,noWheelClassName:F,noPanClassName:z,disableKeyboardA11y:L,onViewportChange:H,isControlledViewport:X}){const{nodesSelectionActive:Q,userSelectionActive:U}=Ke(jU,bt),V=Rl(d,{target:P_}),ee=Rl(_,{target:P_}),J=ee||I,fe=ee||A,ye=p&&J!==!0,he=V||U||ye;return EU({deleteKeyCode:h,multiSelectionKeyCode:b}),D.jsx(CU,{onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:N,zoomOnPinch:w,panOnScroll:fe,panOnScrollSpeed:M,panOnScrollMode:T,zoomOnDoubleClick:O,panOnDrag:!V&&J,defaultViewport:j,translateExtent:Z,minZoom:P,maxZoom:q,zoomActivationKeyCode:C,preventScrolling:G,noWheelClassName:F,noPanClassName:z,onViewportChange:H,isControlledViewport:X,paneClickDistance:f,selectionOnDrag:ye,children:D.jsxs(NU,{onSelectionStart:v,onSelectionEnd:x,onPaneClick:t,onPaneMouseEnter:r,onPaneMouseMove:i,onPaneMouseLeave:a,onPaneContextMenu:l,onPaneScroll:u,panOnDrag:J,isSelecting:!!he,selectionMode:g,selectionKeyPressed:V,paneClickDistance:f,selectionOnDrag:ye,children:[e,Q&&D.jsx(PU,{onSelectionContextMenu:k,noPanClassName:z,disableKeyboardA11y:L})]})})}Ow.displayName="FlowRenderer";const VU=R.memo(Ow),GU=e=>t=>e?$0(t.nodeLookup,{x:0,y:0,width:t.width,height:t.height},t.transform,!0).map(r=>r.id):Array.from(t.nodeLookup.keys());function qU(e){return Ke(R.useCallback(GU(e),[e]),bt)}const YU=e=>e.updateNodeInternals;function XU(){const e=Ke(YU),[t]=R.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(r=>{const i=new Map;r.forEach(a=>{const l=a.target.getAttribute("data-id");i.set(l,{id:l,nodeElement:a.target,force:!0})}),e(i)}));return R.useEffect(()=>()=>{t?.disconnect()},[t]),t}function $U({node:e,nodeType:t,hasDimensions:r,resizeObserver:i}){const a=ht(),l=R.useRef(null),u=R.useRef(null),f=R.useRef(e.sourcePosition),h=R.useRef(e.targetPosition),d=R.useRef(t),p=r&&!!e.internals.handleBounds;return R.useEffect(()=>{l.current&&!e.hidden&&(!p||u.current!==l.current)&&(u.current&&i?.unobserve(u.current),i?.observe(l.current),u.current=l.current)},[p,e.hidden]),R.useEffect(()=>()=>{u.current&&(i?.unobserve(u.current),u.current=null)},[]),R.useEffect(()=>{if(l.current){const g=d.current!==t,v=f.current!==e.sourcePosition,x=h.current!==e.targetPosition;(g||v||x)&&(d.current=t,f.current=e.sourcePosition,h.current=e.targetPosition,a.getState().updateNodeInternals(new Map([[e.id,{id:e.id,nodeElement:l.current,force:!0}]])))}},[e.id,t,e.sourcePosition,e.targetPosition]),l}function KU({id:e,onClick:t,onMouseEnter:r,onMouseMove:i,onMouseLeave:a,onContextMenu:l,onDoubleClick:u,nodesDraggable:f,elementsSelectable:h,nodesConnectable:d,nodesFocusable:p,resizeObserver:g,noDragClassName:v,noPanClassName:x,disableKeyboardA11y:b,rfId:_,nodeTypes:C,nodeClickDistance:E,onError:N}){const{node:w,internals:A,isParent:M}=Ke(ae=>{const be=ae.nodeLookup.get(e),ve=ae.parentLookup.has(e);return{node:be,internals:be.internals,isParent:ve}},bt);let T=w.type||"default",O=C?.[T]||F_[T];O===void 0&&(N?.("003",Er.error003(T)),T="default",O=C?.default||F_.default);const I=!!(w.draggable||f&&typeof w.draggable>"u"),j=!!(w.selectable||h&&typeof w.selectable>"u"),Z=!!(w.connectable||d&&typeof w.connectable>"u"),P=!!(w.focusable||p&&typeof w.focusable>"u"),q=ht(),G=Q2(w),k=$U({node:w,nodeType:T,hasDimensions:G,resizeObserver:g}),F=Aw({nodeRef:k,disabled:w.hidden||!I,noDragClassName:v,handleSelector:w.dragHandle,nodeId:e,isSelectable:j,nodeClickDistance:E}),z=Nw();if(w.hidden)return null;const L=io(w),H=HU(w),X=j||I||t||r||i||a,Q=r?ae=>r(ae,{...A.userNode}):void 0,U=i?ae=>i(ae,{...A.userNode}):void 0,V=a?ae=>a(ae,{...A.userNode}):void 0,ee=l?ae=>l(ae,{...A.userNode}):void 0,J=u?ae=>u(ae,{...A.userNode}):void 0,fe=ae=>{const{selectNodesOnDrag:be,nodeDragThreshold:ve}=q.getState();j&&(!be||!I||ve>0)&&Hp({id:e,store:q,nodeRef:k}),t&&t(ae,{...A.userNode})},ye=ae=>{if(!(ew(ae.nativeEvent)||b)){if(j2.includes(ae.key)&&j){const be=ae.key==="Escape";Hp({id:e,store:q,unselect:be,nodeRef:k})}else if(I&&w.selected&&Object.prototype.hasOwnProperty.call(yf,ae.key)){ae.preventDefault();const{ariaLabelConfig:be}=q.getState();q.setState({ariaLiveMessage:be["node.a11yDescription.ariaLiveMessage"]({direction:ae.key.replace("Arrow","").toLowerCase(),x:~~A.positionAbsolute.x,y:~~A.positionAbsolute.y})}),z({direction:yf[ae.key],factor:ae.shiftKey?4:1})}}},he=()=>{if(b||!k.current?.matches(":focus-visible"))return;const{transform:ae,width:be,height:ve,autoPanOnNodeFocus:Te,setCenter:we}=q.getState();if(!Te)return;$0(new Map([[e,w]]),{x:0,y:0,width:be,height:ve},ae,!0).length>0||we(w.position.x+L.width/2,w.position.y+L.height/2,{zoom:ae[2]})};return D.jsx("div",{className:Ft(["react-flow__node",`react-flow__node-${T}`,{[x]:I},w.className,{selected:w.selected,selectable:j,parent:M,draggable:I,dragging:F}]),ref:k,style:{zIndex:A.z,transform:`translate(${A.positionAbsolute.x}px,${A.positionAbsolute.y}px)`,pointerEvents:X?"all":"none",visibility:G?"visible":"hidden",...w.style,...H},"data-id":e,"data-testid":`rf__node-${e}`,onMouseEnter:Q,onMouseMove:U,onMouseLeave:V,onContextMenu:ee,onClick:fe,onDoubleClick:J,onKeyDown:P?ye:void 0,tabIndex:P?0:void 0,onFocus:P?he:void 0,role:w.ariaRole??(P?"group":void 0),"aria-roledescription":"node","aria-describedby":b?void 0:`${bw}-${_}`,"aria-label":w.ariaLabel,...w.domAttributes,children:D.jsx(OU,{value:e,children:D.jsx(O,{id:e,data:w.data,type:T,positionAbsoluteX:A.positionAbsolute.x,positionAbsoluteY:A.positionAbsolute.y,selected:w.selected??!1,selectable:j,draggable:I,deletable:w.deletable??!0,isConnectable:Z,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:F,dragHandle:w.dragHandle,zIndex:A.z,parentId:w.parentId,...L})})})}var ZU=R.memo(KU);const QU=e=>({nodesDraggable:e.nodesDraggable,nodesConnectable:e.nodesConnectable,nodesFocusable:e.nodesFocusable,elementsSelectable:e.elementsSelectable,onError:e.onError});function Dw(e){const{nodesDraggable:t,nodesConnectable:r,nodesFocusable:i,elementsSelectable:a,onError:l}=Ke(QU,bt),u=qU(e.onlyRenderVisibleElements),f=XU();return D.jsx("div",{className:"react-flow__nodes",style:od,children:u.map(h=>D.jsx(ZU,{id:h,nodeTypes:e.nodeTypes,nodeExtent:e.nodeExtent,onClick:e.onNodeClick,onMouseEnter:e.onNodeMouseEnter,onMouseMove:e.onNodeMouseMove,onMouseLeave:e.onNodeMouseLeave,onContextMenu:e.onNodeContextMenu,onDoubleClick:e.onNodeDoubleClick,noDragClassName:e.noDragClassName,noPanClassName:e.noPanClassName,rfId:e.rfId,disableKeyboardA11y:e.disableKeyboardA11y,resizeObserver:f,nodesDraggable:t,nodesConnectable:r,nodesFocusable:i,elementsSelectable:a,nodeClickDistance:e.nodeClickDistance,onError:l},h))})}Dw.displayName="NodeRenderer";const WU=R.memo(Dw);function JU(e){return Ke(R.useCallback(r=>{if(!e)return r.edges.map(a=>a.id);const i=[];if(r.width&&r.height)for(const a of r.edges){const l=r.nodeLookup.get(a.source),u=r.nodeLookup.get(a.target);l&&u&&eB({sourceNode:l,targetNode:u,width:r.width,height:r.height,transform:r.transform})&&i.push(a.id)}return i},[e]),bt)}const eL=({color:e="none",strokeWidth:t=1})=>{const r={strokeWidth:t,...e&&{stroke:e}};return D.jsx("polyline",{className:"arrow",style:r,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},tL=({color:e="none",strokeWidth:t=1})=>{const r={strokeWidth:t,...e&&{stroke:e,fill:e}};return D.jsx("polyline",{className:"arrowclosed",style:r,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},j_={[mf.Arrow]:eL,[mf.ArrowClosed]:tL};function nL(e){const t=ht();return R.useMemo(()=>Object.prototype.hasOwnProperty.call(j_,e)?j_[e]:(t.getState().onError?.("009",Er.error009(e)),null),[e])}const rL=({id:e,type:t,color:r,width:i=12.5,height:a=12.5,markerUnits:l="strokeWidth",strokeWidth:u,orient:f="auto-start-reverse"})=>{const h=nL(t);return h?D.jsx("marker",{className:"react-flow__arrowhead",id:e,markerWidth:`${i}`,markerHeight:`${a}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:f,refX:"0",refY:"0",children:D.jsx(h,{color:r,strokeWidth:u})}):null},zw=({defaultColor:e,rfId:t})=>{const r=Ke(l=>l.edges),i=Ke(l=>l.defaultEdgeOptions),a=R.useMemo(()=>aB(r,{id:t,defaultColor:e,defaultMarkerStart:i?.markerStart,defaultMarkerEnd:i?.markerEnd}),[r,i,t,e]);return a.length?D.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:D.jsx("defs",{children:a.map(l=>D.jsx(rL,{id:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,strokeWidth:l.strokeWidth,orient:l.orient},l.id))})}):null};zw.displayName="MarkerDefinitions";var oL=R.memo(zw);function Bw({x:e,y:t,label:r,labelStyle:i,labelShowBg:a=!0,labelBgStyle:l,labelBgPadding:u=[2,4],labelBgBorderRadius:f=2,children:h,className:d,...p}){const[g,v]=R.useState({x:1,y:0,width:0,height:0}),x=Ft(["react-flow__edge-textwrapper",d]),b=R.useRef(null);return R.useEffect(()=>{if(b.current){const _=b.current.getBBox();v({x:_.x,y:_.y,width:_.width,height:_.height})}},[r]),r?D.jsxs("g",{transform:`translate(${e-g.width/2} ${t-g.height/2})`,className:x,visibility:g.width?"visible":"hidden",...p,children:[a&&D.jsx("rect",{width:g.width+2*u[0],x:-u[0],y:-u[1],height:g.height+2*u[1],className:"react-flow__edge-textbg",style:l,rx:f,ry:f}),D.jsx("text",{className:"react-flow__edge-text",y:g.height/2,dy:"0.3em",ref:b,style:i,children:r}),h]}):null}Bw.displayName="EdgeText";const iL=R.memo(Bw);function ql({path:e,labelX:t,labelY:r,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h,interactionWidth:d=20,...p}){return D.jsxs(D.Fragment,{children:[D.jsx("path",{...p,d:e,fill:"none",className:Ft(["react-flow__edge-path",p.className])}),d?D.jsx("path",{d:e,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,i&&rr(t)&&rr(r)?D.jsx(iL,{x:t,y:r,label:i,labelStyle:a,labelShowBg:l,labelBgStyle:u,labelBgPadding:f,labelBgBorderRadius:h}):null]})}function V_({pos:e,x1:t,y1:r,x2:i,y2:a}){return e===Ne.Left||e===Ne.Right?[.5*(t+i),r]:[t,.5*(r+a)]}function rg({sourceX:e,sourceY:t,sourcePosition:r=Ne.Bottom,targetX:i,targetY:a,targetPosition:l=Ne.Top}){const[u,f]=V_({pos:r,x1:e,y1:t,x2:i,y2:a}),[h,d]=V_({pos:l,x1:i,y1:a,x2:e,y2:t}),[p,g,v,x]=nw({sourceX:e,sourceY:t,targetX:i,targetY:a,sourceControlX:u,sourceControlY:f,targetControlX:h,targetControlY:d});return[`M${e},${t} C${u},${f} ${h},${d} ${i},${a}`,p,g,v,x]}function Uw(e){return R.memo(({id:t,sourceX:r,sourceY:i,targetX:a,targetY:l,sourcePosition:u,targetPosition:f,label:h,labelStyle:d,labelShowBg:p,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:x,style:b,markerEnd:_,markerStart:C,interactionWidth:E})=>{const[N,w,A]=rg({sourceX:r,sourceY:i,sourcePosition:u,targetX:a,targetY:l,targetPosition:f}),M=e.isInternal?void 0:t;return D.jsx(ql,{id:M,path:N,labelX:w,labelY:A,label:h,labelStyle:d,labelShowBg:p,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:x,style:b,markerEnd:_,markerStart:C,interactionWidth:E})})}const sL=Uw({isInternal:!1}),Lw=Uw({isInternal:!0});sL.displayName="SimpleBezierEdge";Lw.displayName="SimpleBezierEdgeInternal";function kw(e){return R.memo(({id:t,sourceX:r,sourceY:i,targetX:a,targetY:l,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:g,style:v,sourcePosition:x=Ne.Bottom,targetPosition:b=Ne.Top,markerEnd:_,markerStart:C,pathOptions:E,interactionWidth:N})=>{const[w,A,M]=Up({sourceX:r,sourceY:i,sourcePosition:x,targetX:a,targetY:l,targetPosition:b,borderRadius:E?.borderRadius,offset:E?.offset,stepPosition:E?.stepPosition}),T=e.isInternal?void 0:t;return D.jsx(ql,{id:T,path:w,labelX:A,labelY:M,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:g,style:v,markerEnd:_,markerStart:C,interactionWidth:N})})}const Iw=kw({isInternal:!1}),Hw=kw({isInternal:!0});Iw.displayName="SmoothStepEdge";Hw.displayName="SmoothStepEdgeInternal";function Fw(e){return R.memo(({id:t,...r})=>{const i=e.isInternal?void 0:t;return D.jsx(Iw,{...r,id:i,pathOptions:R.useMemo(()=>({borderRadius:0,offset:r.pathOptions?.offset}),[r.pathOptions?.offset])})})}const aL=Fw({isInternal:!1}),Pw=Fw({isInternal:!0});aL.displayName="StepEdge";Pw.displayName="StepEdgeInternal";function jw(e){return R.memo(({id:t,sourceX:r,sourceY:i,targetX:a,targetY:l,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:g,style:v,markerEnd:x,markerStart:b,interactionWidth:_})=>{const[C,E,N]=ow({sourceX:r,sourceY:i,targetX:a,targetY:l}),w=e.isInternal?void 0:t;return D.jsx(ql,{id:w,path:C,labelX:E,labelY:N,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:d,labelBgPadding:p,labelBgBorderRadius:g,style:v,markerEnd:x,markerStart:b,interactionWidth:_})})}const lL=jw({isInternal:!1}),Vw=jw({isInternal:!0});lL.displayName="StraightEdge";Vw.displayName="StraightEdgeInternal";function Gw(e){return R.memo(({id:t,sourceX:r,sourceY:i,targetX:a,targetY:l,sourcePosition:u=Ne.Bottom,targetPosition:f=Ne.Top,label:h,labelStyle:d,labelShowBg:p,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:x,style:b,markerEnd:_,markerStart:C,pathOptions:E,interactionWidth:N})=>{const[w,A,M]=ed({sourceX:r,sourceY:i,sourcePosition:u,targetX:a,targetY:l,targetPosition:f,curvature:E?.curvature}),T=e.isInternal?void 0:t;return D.jsx(ql,{id:T,path:w,labelX:A,labelY:M,label:h,labelStyle:d,labelShowBg:p,labelBgStyle:g,labelBgPadding:v,labelBgBorderRadius:x,style:b,markerEnd:_,markerStart:C,interactionWidth:N})})}const cL=Gw({isInternal:!1}),qw=Gw({isInternal:!0});cL.displayName="BezierEdge";qw.displayName="BezierEdgeInternal";const G_={default:qw,straight:Vw,step:Pw,smoothstep:Hw,simplebezier:Lw},q_={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},uL=(e,t,r)=>r===Ne.Left?e-t:r===Ne.Right?e+t:e,fL=(e,t,r)=>r===Ne.Top?e-t:r===Ne.Bottom?e+t:e,Y_="react-flow__edgeupdater";function X_({position:e,centerX:t,centerY:r,radius:i=10,onMouseDown:a,onMouseEnter:l,onMouseOut:u,type:f}){return D.jsx("circle",{onMouseDown:a,onMouseEnter:l,onMouseOut:u,className:Ft([Y_,`${Y_}-${f}`]),cx:uL(t,i,e),cy:fL(r,i,e),r:i,stroke:"transparent",fill:"transparent"})}function dL({isReconnectable:e,reconnectRadius:t,edge:r,sourceX:i,sourceY:a,targetX:l,targetY:u,sourcePosition:f,targetPosition:h,onReconnect:d,onReconnectStart:p,onReconnectEnd:g,setReconnecting:v,setUpdateHover:x}){const b=ht(),_=(A,M)=>{if(A.button!==0)return;const{autoPanOnConnect:T,domNode:O,connectionMode:I,connectionRadius:j,lib:Z,onConnectStart:P,cancelConnection:q,nodeLookup:G,rfId:k,panBy:F,updateConnection:z}=b.getState(),L=M.type==="target",H=(U,V)=>{v(!1),g?.(U,r,M.type,V)},X=U=>d?.(r,U),Q=(U,V)=>{v(!0),p?.(A,r,M.type),P?.(U,V)};Ip.onPointerDown(A.nativeEvent,{autoPanOnConnect:T,connectionMode:I,connectionRadius:j,domNode:O,handleId:M.id,nodeId:M.nodeId,nodeLookup:G,isTarget:L,edgeUpdaterType:M.type,lib:Z,flowId:k,cancelConnection:q,panBy:F,isValidConnection:(...U)=>b.getState().isValidConnection?.(...U)??!0,onConnect:X,onConnectStart:Q,onConnectEnd:(...U)=>b.getState().onConnectEnd?.(...U),onReconnectEnd:H,updateConnection:z,getTransform:()=>b.getState().transform,getFromHandle:()=>b.getState().connection.fromHandle,dragThreshold:b.getState().connectionDragThreshold,handleDomNode:A.currentTarget})},C=A=>_(A,{nodeId:r.target,id:r.targetHandle??null,type:"target"}),E=A=>_(A,{nodeId:r.source,id:r.sourceHandle??null,type:"source"}),N=()=>x(!0),w=()=>x(!1);return D.jsxs(D.Fragment,{children:[(e===!0||e==="source")&&D.jsx(X_,{position:f,centerX:i,centerY:a,radius:t,onMouseDown:C,onMouseEnter:N,onMouseOut:w,type:"source"}),(e===!0||e==="target")&&D.jsx(X_,{position:h,centerX:l,centerY:u,radius:t,onMouseDown:E,onMouseEnter:N,onMouseOut:w,type:"target"})]})}function hL({id:e,edgesFocusable:t,edgesReconnectable:r,elementsSelectable:i,onClick:a,onDoubleClick:l,onContextMenu:u,onMouseEnter:f,onMouseMove:h,onMouseLeave:d,reconnectRadius:p,onReconnect:g,onReconnectStart:v,onReconnectEnd:x,rfId:b,edgeTypes:_,noPanClassName:C,onError:E,disableKeyboardA11y:N}){let w=Ke(we=>we.edgeLookup.get(e));const A=Ke(we=>we.defaultEdgeOptions);w=A?{...A,...w}:w;let M=w.type||"default",T=_?.[M]||G_[M];T===void 0&&(E?.("011",Er.error011(M)),M="default",T=_?.default||G_.default);const O=!!(w.focusable||t&&typeof w.focusable>"u"),I=typeof g<"u"&&(w.reconnectable||r&&typeof w.reconnectable>"u"),j=!!(w.selectable||i&&typeof w.selectable>"u"),Z=R.useRef(null),[P,q]=R.useState(!1),[G,k]=R.useState(!1),F=ht(),{zIndex:z,sourceX:L,sourceY:H,targetX:X,targetY:Q,sourcePosition:U,targetPosition:V}=Ke(R.useCallback(we=>{const xe=we.nodeLookup.get(w.source),Ee=we.nodeLookup.get(w.target);if(!xe||!Ee)return{zIndex:w.zIndex,...q_};const Ce=sB({id:e,sourceNode:xe,targetNode:Ee,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:we.connectionMode,onError:E});return{zIndex:J6({selected:w.selected,zIndex:w.zIndex,sourceNode:xe,targetNode:Ee,elevateOnSelect:we.elevateEdgesOnSelect,zIndexMode:we.zIndexMode}),...Ce||q_}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),bt),ee=R.useMemo(()=>w.markerStart?`url('#${Lp(w.markerStart,b)}')`:void 0,[w.markerStart,b]),J=R.useMemo(()=>w.markerEnd?`url('#${Lp(w.markerEnd,b)}')`:void 0,[w.markerEnd,b]);if(w.hidden||L===null||H===null||X===null||Q===null)return null;const fe=we=>{const{addSelectedEdges:xe,unselectNodesAndEdges:Ee,multiSelectionActive:Ce}=F.getState();j&&(F.setState({nodesSelectionActive:!1}),w.selected&&Ce?(Ee({nodes:[],edges:[w]}),Z.current?.blur()):xe([e])),a&&a(we,w)},ye=l?we=>{l(we,{...w})}:void 0,he=u?we=>{u(we,{...w})}:void 0,ae=f?we=>{f(we,{...w})}:void 0,be=h?we=>{h(we,{...w})}:void 0,ve=d?we=>{d(we,{...w})}:void 0,Te=we=>{if(!N&&j2.includes(we.key)&&j){const{unselectNodesAndEdges:xe,addSelectedEdges:Ee}=F.getState();we.key==="Escape"?(Z.current?.blur(),xe({edges:[w]})):Ee([e])}};return D.jsx("svg",{style:{zIndex:z},children:D.jsxs("g",{className:Ft(["react-flow__edge",`react-flow__edge-${M}`,w.className,C,{selected:w.selected,animated:w.animated,inactive:!j&&!a,updating:P,selectable:j}]),onClick:fe,onDoubleClick:ye,onContextMenu:he,onMouseEnter:ae,onMouseMove:be,onMouseLeave:ve,onKeyDown:O?Te:void 0,tabIndex:O?0:void 0,role:w.ariaRole??(O?"group":"img"),"aria-roledescription":"edge","data-id":e,"data-testid":`rf__edge-${e}`,"aria-label":w.ariaLabel===null?void 0:w.ariaLabel||`Edge from ${w.source} to ${w.target}`,"aria-describedby":O?`${_w}-${b}`:void 0,ref:Z,...w.domAttributes,children:[!G&&D.jsx(T,{id:e,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:j,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:L,sourceY:H,targetX:X,targetY:Q,sourcePosition:U,targetPosition:V,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:ee,markerEnd:J,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),I&&D.jsx(dL,{edge:w,isReconnectable:I,reconnectRadius:p,onReconnect:g,onReconnectStart:v,onReconnectEnd:x,sourceX:L,sourceY:H,targetX:X,targetY:Q,sourcePosition:U,targetPosition:V,setUpdateHover:q,setReconnecting:k})]})})}var mL=R.memo(hL);const pL=e=>({edgesFocusable:e.edgesFocusable,edgesReconnectable:e.edgesReconnectable,elementsSelectable:e.elementsSelectable,connectionMode:e.connectionMode,onError:e.onError});function Yw({defaultMarkerColor:e,onlyRenderVisibleElements:t,rfId:r,edgeTypes:i,noPanClassName:a,onReconnect:l,onEdgeContextMenu:u,onEdgeMouseEnter:f,onEdgeMouseMove:h,onEdgeMouseLeave:d,onEdgeClick:p,reconnectRadius:g,onEdgeDoubleClick:v,onReconnectStart:x,onReconnectEnd:b,disableKeyboardA11y:_}){const{edgesFocusable:C,edgesReconnectable:E,elementsSelectable:N,onError:w}=Ke(pL,bt),A=JU(t);return D.jsxs("div",{className:"react-flow__edges",children:[D.jsx(oL,{defaultColor:e,rfId:r}),A.map(M=>D.jsx(mL,{id:M,edgesFocusable:C,edgesReconnectable:E,elementsSelectable:N,noPanClassName:a,onReconnect:l,onContextMenu:u,onMouseEnter:f,onMouseMove:h,onMouseLeave:d,onClick:p,reconnectRadius:g,onDoubleClick:v,onReconnectStart:x,onReconnectEnd:b,rfId:r,onError:w,edgeTypes:i,disableKeyboardA11y:_},M))]})}Yw.displayName="EdgeRenderer";const gL=R.memo(Yw),yL=e=>`translate(${e.transform[0]}px,${e.transform[1]}px) scale(${e.transform[2]})`;function vL({children:e}){const t=Ke(yL);return D.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:t},children:e})}function xL(e){const t=rd(),r=R.useRef(!1);R.useEffect(()=>{!r.current&&t.viewportInitialized&&e&&(setTimeout(()=>e(t),1),r.current=!0)},[e,t.viewportInitialized])}const bL=e=>e.panZoom?.syncViewport;function _L(e){const t=Ke(bL),r=ht();return R.useEffect(()=>{e&&(t?.(e),r.setState({transform:[e.x,e.y,e.zoom]}))},[e,t]),null}function EL(e){return e.connection.inProgress?{...e.connection,to:Vl(e.connection.to,e.transform)}:{...e.connection}}function SL(e){return EL}function wL(e){const t=SL();return Ke(t,bt)}const CL=e=>({nodesConnectable:e.nodesConnectable,isValid:e.connection.isValid,inProgress:e.connection.inProgress,width:e.width,height:e.height});function TL({containerStyle:e,style:t,type:r,component:i}){const{nodesConnectable:a,width:l,height:u,isValid:f,inProgress:h}=Ke(CL,bt);return!(l&&a&&h)?null:D.jsx("svg",{style:e,width:l,height:u,className:"react-flow__connectionline react-flow__container",children:D.jsx("g",{className:Ft(["react-flow__connection",q2(f)]),children:D.jsx(Xw,{style:t,type:r,CustomComponent:i,isValid:f})})})}const Xw=({style:e,type:t=Ho.Bezier,CustomComponent:r,isValid:i})=>{const{inProgress:a,from:l,fromNode:u,fromHandle:f,fromPosition:h,to:d,toNode:p,toHandle:g,toPosition:v,pointer:x}=wL();if(!a)return;if(r)return D.jsx(r,{connectionLineType:t,connectionLineStyle:e,fromNode:u,fromHandle:f,fromX:l.x,fromY:l.y,toX:d.x,toY:d.y,fromPosition:h,toPosition:v,connectionStatus:q2(i),toNode:p,toHandle:g,pointer:x});let b="";const _={sourceX:l.x,sourceY:l.y,sourcePosition:h,targetX:d.x,targetY:d.y,targetPosition:v};switch(t){case Ho.Bezier:[b]=ed(_);break;case Ho.SimpleBezier:[b]=rg(_);break;case Ho.Step:[b]=Up({..._,borderRadius:0});break;case Ho.SmoothStep:[b]=Up(_);break;default:[b]=ow(_)}return D.jsx("path",{d:b,fill:"none",className:"react-flow__connection-path",style:e})};Xw.displayName="ConnectionLine";const RL={};function $_(e=RL){R.useRef(e),ht(),R.useEffect(()=>{},[e])}function AL(){ht(),R.useRef(!1),R.useEffect(()=>{},[])}function $w({nodeTypes:e,edgeTypes:t,onInit:r,onNodeClick:i,onEdgeClick:a,onNodeDoubleClick:l,onEdgeDoubleClick:u,onNodeMouseEnter:f,onNodeMouseMove:h,onNodeMouseLeave:d,onNodeContextMenu:p,onSelectionContextMenu:g,onSelectionStart:v,onSelectionEnd:x,connectionLineType:b,connectionLineStyle:_,connectionLineComponent:C,connectionLineContainerStyle:E,selectionKeyCode:N,selectionOnDrag:w,selectionMode:A,multiSelectionKeyCode:M,panActivationKeyCode:T,zoomActivationKeyCode:O,deleteKeyCode:I,onlyRenderVisibleElements:j,elementsSelectable:Z,defaultViewport:P,translateExtent:q,minZoom:G,maxZoom:k,preventScrolling:F,defaultMarkerColor:z,zoomOnScroll:L,zoomOnPinch:H,panOnScroll:X,panOnScrollSpeed:Q,panOnScrollMode:U,zoomOnDoubleClick:V,panOnDrag:ee,onPaneClick:J,onPaneMouseEnter:fe,onPaneMouseMove:ye,onPaneMouseLeave:he,onPaneScroll:ae,onPaneContextMenu:be,paneClickDistance:ve,nodeClickDistance:Te,onEdgeContextMenu:we,onEdgeMouseEnter:xe,onEdgeMouseMove:Ee,onEdgeMouseLeave:Ce,reconnectRadius:ie,onReconnect:re,onReconnectStart:ue,onReconnectEnd:le,noDragClassName:se,noWheelClassName:K,noPanClassName:ge,disableKeyboardA11y:Se,nodeExtent:_e,rfId:Je,viewport:st,onViewportChange:ft}){return $_(e),$_(t),AL(),xL(r),_L(st),D.jsx(VU,{onPaneClick:J,onPaneMouseEnter:fe,onPaneMouseMove:ye,onPaneMouseLeave:he,onPaneContextMenu:be,onPaneScroll:ae,paneClickDistance:ve,deleteKeyCode:I,selectionKeyCode:N,selectionOnDrag:w,selectionMode:A,onSelectionStart:v,onSelectionEnd:x,multiSelectionKeyCode:M,panActivationKeyCode:T,zoomActivationKeyCode:O,elementsSelectable:Z,zoomOnScroll:L,zoomOnPinch:H,zoomOnDoubleClick:V,panOnScroll:X,panOnScrollSpeed:Q,panOnScrollMode:U,panOnDrag:ee,defaultViewport:P,translateExtent:q,minZoom:G,maxZoom:k,onSelectionContextMenu:g,preventScrolling:F,noDragClassName:se,noWheelClassName:K,noPanClassName:ge,disableKeyboardA11y:Se,onViewportChange:ft,isControlledViewport:!!st,children:D.jsxs(vL,{children:[D.jsx(gL,{edgeTypes:t,onEdgeClick:a,onEdgeDoubleClick:u,onReconnect:re,onReconnectStart:ue,onReconnectEnd:le,onlyRenderVisibleElements:j,onEdgeContextMenu:we,onEdgeMouseEnter:xe,onEdgeMouseMove:Ee,onEdgeMouseLeave:Ce,reconnectRadius:ie,defaultMarkerColor:z,noPanClassName:ge,disableKeyboardA11y:Se,rfId:Je}),D.jsx(TL,{style:_,type:b,component:C,containerStyle:E}),D.jsx("div",{className:"react-flow__edgelabel-renderer"}),D.jsx(WU,{nodeTypes:e,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:f,onNodeMouseMove:h,onNodeMouseLeave:d,onNodeContextMenu:p,nodeClickDistance:Te,onlyRenderVisibleElements:j,noPanClassName:ge,noDragClassName:se,disableKeyboardA11y:Se,nodeExtent:_e,rfId:Je}),D.jsx("div",{className:"react-flow__viewport-portal"})]})})}$w.displayName="GraphView";const NL=R.memo($w),K_=({nodes:e,edges:t,defaultNodes:r,defaultEdges:i,width:a,height:l,fitView:u,fitViewOptions:f,minZoom:h=.5,maxZoom:d=2,nodeOrigin:p,nodeExtent:g,zIndexMode:v="basic"}={})=>{const x=new Map,b=new Map,_=new Map,C=new Map,E=i??t??[],N=r??e??[],w=p??[0,0],A=g??Sl;aw(_,C,E);const M=kp(N,x,b,{nodeOrigin:w,nodeExtent:A,zIndexMode:v});let T=[0,0,1];if(u&&a&&l){const O=Pl(x,{filter:P=>!!((P.width||P.initialWidth)&&(P.height||P.initialHeight))}),{x:I,y:j,zoom:Z}=K0(O,a,l,h,d,f?.padding??.1);T=[I,j,Z]}return{rfId:"1",width:a??0,height:l??0,transform:T,nodes:N,nodesInitialized:M,nodeLookup:x,parentLookup:b,edges:E,edgeLookup:C,connectionLookup:_,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:r!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:h,maxZoom:d,translateExtent:Sl,nodeExtent:A,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:qs.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:w,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:u??!1,fitViewOptions:f,fitViewResolver:null,connection:{...G2},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:X6,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:V2,zIndexMode:v,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},ML=({nodes:e,edges:t,defaultNodes:r,defaultEdges:i,width:a,height:l,fitView:u,fitViewOptions:f,minZoom:h,maxZoom:d,nodeOrigin:p,nodeExtent:g,zIndexMode:v})=>$B((x,b)=>{async function _(){const{nodeLookup:C,panZoom:E,fitViewOptions:N,fitViewResolver:w,width:A,height:M,minZoom:T,maxZoom:O}=b();E&&(await q6({nodes:C,width:A,height:M,panZoom:E,minZoom:T,maxZoom:O},N),w?.resolve(!0),x({fitViewResolver:null}))}return{...K_({nodes:e,edges:t,width:a,height:l,fitView:u,fitViewOptions:f,minZoom:h,maxZoom:d,nodeOrigin:p,nodeExtent:g,defaultNodes:r,defaultEdges:i,zIndexMode:v}),setNodes:C=>{const{nodeLookup:E,parentLookup:N,nodeOrigin:w,elevateNodesOnSelect:A,fitViewQueued:M,zIndexMode:T}=b(),O=kp(C,E,N,{nodeOrigin:w,nodeExtent:g,elevateNodesOnSelect:A,checkEquality:!0,zIndexMode:T});M&&O?(_(),x({nodes:C,nodesInitialized:O,fitViewQueued:!1,fitViewOptions:void 0})):x({nodes:C,nodesInitialized:O})},setEdges:C=>{const{connectionLookup:E,edgeLookup:N}=b();aw(E,N,C),x({edges:C})},setDefaultNodesAndEdges:(C,E)=>{if(C){const{setNodes:N}=b();N(C),x({hasDefaultNodes:!0})}if(E){const{setEdges:N}=b();N(E),x({hasDefaultEdges:!0})}},updateNodeInternals:C=>{const{triggerNodeChanges:E,nodeLookup:N,parentLookup:w,domNode:A,nodeOrigin:M,nodeExtent:T,debug:O,fitViewQueued:I,zIndexMode:j}=b(),{changes:Z,updatedInternals:P}=mB(C,N,w,A,M,T,j);P&&(uB(N,w,{nodeOrigin:M,nodeExtent:T,zIndexMode:j}),I?(_(),x({fitViewQueued:!1,fitViewOptions:void 0})):x({}),Z?.length>0&&(O&&console.log("React Flow: trigger node changes",Z),E?.(Z)))},updateNodePositions:(C,E=!1)=>{const N=[];let w=[];const{nodeLookup:A,triggerNodeChanges:M,connection:T,updateConnection:O,onNodesChangeMiddlewareMap:I}=b();for(const[j,Z]of C){const P=A.get(j),q=!!(P?.expandParent&&P?.parentId&&Z?.position),G={id:j,type:"position",position:q?{x:Math.max(0,Z.position.x),y:Math.max(0,Z.position.y)}:Z.position,dragging:E};if(P&&T.inProgress&&T.fromNode.id===P.id){const k=Ii(P,T.fromHandle,Ne.Left,!0);O({...T,from:k})}q&&P.parentId&&N.push({id:j,parentId:P.parentId,rect:{...Z.internals.positionAbsolute,width:Z.measured.width??0,height:Z.measured.height??0}}),w.push(G)}if(N.length>0){const{parentLookup:j,nodeOrigin:Z}=b(),P=tg(N,A,j,Z);w.push(...P)}for(const j of I.values())w=j(w);M(w)},triggerNodeChanges:C=>{const{onNodesChange:E,setNodes:N,nodes:w,hasDefaultNodes:A,debug:M}=b();if(C?.length){if(A){const T=ww(C,w);N(T)}M&&console.log("React Flow: trigger node changes",C),E?.(C)}},triggerEdgeChanges:C=>{const{onEdgesChange:E,setEdges:N,edges:w,hasDefaultEdges:A,debug:M}=b();if(C?.length){if(A){const T=Cw(C,w);N(T)}M&&console.log("React Flow: trigger edge changes",C),E?.(C)}},addSelectedNodes:C=>{const{multiSelectionActive:E,edgeLookup:N,nodeLookup:w,triggerNodeChanges:A,triggerEdgeChanges:M}=b();if(E){const T=C.map(O=>Ai(O,!0));A(T);return}A(Ls(w,new Set([...C]),!0)),M(Ls(N))},addSelectedEdges:C=>{const{multiSelectionActive:E,edgeLookup:N,nodeLookup:w,triggerNodeChanges:A,triggerEdgeChanges:M}=b();if(E){const T=C.map(O=>Ai(O,!0));M(T);return}M(Ls(N,new Set([...C]))),A(Ls(w,new Set,!0))},unselectNodesAndEdges:({nodes:C,edges:E}={})=>{const{edges:N,nodes:w,nodeLookup:A,triggerNodeChanges:M,triggerEdgeChanges:T}=b(),O=C||w,I=E||N,j=[];for(const P of O){if(!P.selected)continue;const q=A.get(P.id);q&&(q.selected=!1),j.push(Ai(P.id,!1))}const Z=[];for(const P of I)P.selected&&Z.push(Ai(P.id,!1));M(j),T(Z)},setMinZoom:C=>{const{panZoom:E,maxZoom:N}=b();E?.setScaleExtent([C,N]),x({minZoom:C})},setMaxZoom:C=>{const{panZoom:E,minZoom:N}=b();E?.setScaleExtent([N,C]),x({maxZoom:C})},setTranslateExtent:C=>{b().panZoom?.setTranslateExtent(C),x({translateExtent:C})},resetSelectedElements:()=>{const{edges:C,nodes:E,triggerNodeChanges:N,triggerEdgeChanges:w,elementsSelectable:A}=b();if(!A)return;const M=E.reduce((O,I)=>I.selected?[...O,Ai(I.id,!1)]:O,[]),T=C.reduce((O,I)=>I.selected?[...O,Ai(I.id,!1)]:O,[]);N(M),w(T)},setNodeExtent:C=>{const{nodes:E,nodeLookup:N,parentLookup:w,nodeOrigin:A,elevateNodesOnSelect:M,nodeExtent:T,zIndexMode:O}=b();C[0][0]===T[0][0]&&C[0][1]===T[0][1]&&C[1][0]===T[1][0]&&C[1][1]===T[1][1]||(kp(E,N,w,{nodeOrigin:A,nodeExtent:C,elevateNodesOnSelect:M,checkEquality:!1,zIndexMode:O}),x({nodeExtent:C}))},panBy:C=>{const{transform:E,width:N,height:w,panZoom:A,translateExtent:M}=b();return pB({delta:C,panZoom:A,transform:E,translateExtent:M,width:N,height:w})},setCenter:async(C,E,N)=>{const{width:w,height:A,maxZoom:M,panZoom:T}=b();if(!T)return Promise.resolve(!1);const O=typeof N?.zoom<"u"?N.zoom:M;return await T.setViewport({x:w/2-C*O,y:A/2-E*O,zoom:O},{duration:N?.duration,ease:N?.ease,interpolate:N?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{x({connection:{...G2}})},updateConnection:C=>{x({connection:C})},reset:()=>x({...K_()})}},Object.is);function Kw({initialNodes:e,initialEdges:t,defaultNodes:r,defaultEdges:i,initialWidth:a,initialHeight:l,initialMinZoom:u,initialMaxZoom:f,initialFitViewOptions:h,fitView:d,nodeOrigin:p,nodeExtent:g,zIndexMode:v,children:x}){const[b]=R.useState(()=>ML({nodes:e,edges:t,defaultNodes:r,defaultEdges:i,width:a,height:l,fitView:d,minZoom:u,maxZoom:f,fitViewOptions:h,nodeOrigin:p,nodeExtent:g,zIndexMode:v}));return D.jsx(KB,{value:b,children:D.jsx(vU,{children:x})})}function OL({children:e,nodes:t,edges:r,defaultNodes:i,defaultEdges:a,width:l,height:u,fitView:f,fitViewOptions:h,minZoom:d,maxZoom:p,nodeOrigin:g,nodeExtent:v,zIndexMode:x}){return R.useContext(nd)?D.jsx(D.Fragment,{children:e}):D.jsx(Kw,{initialNodes:t,initialEdges:r,defaultNodes:i,defaultEdges:a,initialWidth:l,initialHeight:u,fitView:f,initialFitViewOptions:h,initialMinZoom:d,initialMaxZoom:p,nodeOrigin:g,nodeExtent:v,zIndexMode:x,children:e})}const DL={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function zL({nodes:e,edges:t,defaultNodes:r,defaultEdges:i,className:a,nodeTypes:l,edgeTypes:u,onNodeClick:f,onEdgeClick:h,onInit:d,onMove:p,onMoveStart:g,onMoveEnd:v,onConnect:x,onConnectStart:b,onConnectEnd:_,onClickConnectStart:C,onClickConnectEnd:E,onNodeMouseEnter:N,onNodeMouseMove:w,onNodeMouseLeave:A,onNodeContextMenu:M,onNodeDoubleClick:T,onNodeDragStart:O,onNodeDrag:I,onNodeDragStop:j,onNodesDelete:Z,onEdgesDelete:P,onDelete:q,onSelectionChange:G,onSelectionDragStart:k,onSelectionDrag:F,onSelectionDragStop:z,onSelectionContextMenu:L,onSelectionStart:H,onSelectionEnd:X,onBeforeDelete:Q,connectionMode:U,connectionLineType:V=Ho.Bezier,connectionLineStyle:ee,connectionLineComponent:J,connectionLineContainerStyle:fe,deleteKeyCode:ye="Backspace",selectionKeyCode:he="Shift",selectionOnDrag:ae=!1,selectionMode:be=wl.Full,panActivationKeyCode:ve="Space",multiSelectionKeyCode:Te=Tl()?"Meta":"Control",zoomActivationKeyCode:we=Tl()?"Meta":"Control",snapToGrid:xe,snapGrid:Ee,onlyRenderVisibleElements:Ce=!1,selectNodesOnDrag:ie,nodesDraggable:re,autoPanOnNodeFocus:ue,nodesConnectable:le,nodesFocusable:se,nodeOrigin:K=Ew,edgesFocusable:ge,edgesReconnectable:Se,elementsSelectable:_e=!0,defaultViewport:Je=lU,minZoom:st=.5,maxZoom:ft=2,translateExtent:at=Sl,preventScrolling:Qe=!0,nodeExtent:He,defaultMarkerColor:_t="#b1b1b7",zoomOnScroll:an=!0,zoomOnPinch:ze=!0,panOnScroll:Oe=!1,panOnScrollSpeed:rt=.5,panOnScrollMode:wt=zi.Free,zoomOnDoubleClick:Ze=!0,panOnDrag:Ct=!0,onPaneClick:qt,onPaneMouseEnter:Et,onPaneMouseMove:Pt,onPaneMouseLeave:Ot,onPaneScroll:$t,onPaneContextMenu:_n,paneClickDistance:Un=1,nodeClickDistance:ni=0,children:so,onReconnect:Nr,onReconnectStart:Mr,onReconnectEnd:ri,onEdgeContextMenu:oi,onEdgeDoubleClick:Gi,onEdgeMouseEnter:qi,onEdgeMouseMove:Yn,onEdgeMouseLeave:ii,reconnectRadius:Yi=10,onNodesChange:Xi,onEdgesChange:lr,noDragClassName:jt="nodrag",noWheelClassName:Jt="nowheel",noPanClassName:Or="nopan",fitView:$i,fitViewOptions:Zl,connectOnClick:hd,attributionPosition:Ql,proOptions:si,defaultEdgeOptions:ia,elevateNodesOnSelect:ao=!0,elevateEdgesOnSelect:lo=!1,disableKeyboardA11y:co=!1,autoPanOnConnect:uo,autoPanOnNodeDrag:Dt,autoPanSpeed:Wl,connectionRadius:Jl,isValidConnection:Dr,onError:fo,style:md,id:sa,nodeDragThreshold:ec,connectionDragThreshold:pd,viewport:Ki,onViewportChange:Zi,width:Xn,height:ln,colorMode:tc="light",debug:gd,onScroll:Qi,ariaLabelConfig:nc,zIndexMode:ai="basic",...yd},cn){const li=sa||"1",rc=dU(tc),aa=R.useCallback(zr=>{zr.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Qi?.(zr)},[Qi]);return D.jsx("div",{"data-testid":"rf__wrapper",...yd,onScroll:aa,style:{...md,...DL},ref:cn,className:Ft(["react-flow",a,rc]),id:sa,role:"application",children:D.jsxs(OL,{nodes:e,edges:t,width:Xn,height:ln,fitView:$i,fitViewOptions:Zl,minZoom:st,maxZoom:ft,nodeOrigin:K,nodeExtent:He,zIndexMode:ai,children:[D.jsx(NL,{onInit:d,onNodeClick:f,onEdgeClick:h,onNodeMouseEnter:N,onNodeMouseMove:w,onNodeMouseLeave:A,onNodeContextMenu:M,onNodeDoubleClick:T,nodeTypes:l,edgeTypes:u,connectionLineType:V,connectionLineStyle:ee,connectionLineComponent:J,connectionLineContainerStyle:fe,selectionKeyCode:he,selectionOnDrag:ae,selectionMode:be,deleteKeyCode:ye,multiSelectionKeyCode:Te,panActivationKeyCode:ve,zoomActivationKeyCode:we,onlyRenderVisibleElements:Ce,defaultViewport:Je,translateExtent:at,minZoom:st,maxZoom:ft,preventScrolling:Qe,zoomOnScroll:an,zoomOnPinch:ze,zoomOnDoubleClick:Ze,panOnScroll:Oe,panOnScrollSpeed:rt,panOnScrollMode:wt,panOnDrag:Ct,onPaneClick:qt,onPaneMouseEnter:Et,onPaneMouseMove:Pt,onPaneMouseLeave:Ot,onPaneScroll:$t,onPaneContextMenu:_n,paneClickDistance:Un,nodeClickDistance:ni,onSelectionContextMenu:L,onSelectionStart:H,onSelectionEnd:X,onReconnect:Nr,onReconnectStart:Mr,onReconnectEnd:ri,onEdgeContextMenu:oi,onEdgeDoubleClick:Gi,onEdgeMouseEnter:qi,onEdgeMouseMove:Yn,onEdgeMouseLeave:ii,reconnectRadius:Yi,defaultMarkerColor:_t,noDragClassName:jt,noWheelClassName:Jt,noPanClassName:Or,rfId:li,disableKeyboardA11y:co,nodeExtent:He,viewport:Ki,onViewportChange:Zi}),D.jsx(fU,{nodes:e,edges:t,defaultNodes:r,defaultEdges:i,onConnect:x,onConnectStart:b,onConnectEnd:_,onClickConnectStart:C,onClickConnectEnd:E,nodesDraggable:re,autoPanOnNodeFocus:ue,nodesConnectable:le,nodesFocusable:se,edgesFocusable:ge,edgesReconnectable:Se,elementsSelectable:_e,elevateNodesOnSelect:ao,elevateEdgesOnSelect:lo,minZoom:st,maxZoom:ft,nodeExtent:He,onNodesChange:Xi,onEdgesChange:lr,snapToGrid:xe,snapGrid:Ee,connectionMode:U,translateExtent:at,connectOnClick:hd,defaultEdgeOptions:ia,fitView:$i,fitViewOptions:Zl,onNodesDelete:Z,onEdgesDelete:P,onDelete:q,onNodeDragStart:O,onNodeDrag:I,onNodeDragStop:j,onSelectionDrag:F,onSelectionDragStart:k,onSelectionDragStop:z,onMove:p,onMoveStart:g,onMoveEnd:v,noPanClassName:Or,nodeOrigin:K,rfId:li,autoPanOnConnect:uo,autoPanOnNodeDrag:Dt,autoPanSpeed:Wl,onError:fo,connectionRadius:Jl,isValidConnection:Dr,selectNodesOnDrag:ie,nodeDragThreshold:ec,connectionDragThreshold:pd,onBeforeDelete:Q,debug:gd,ariaLabelConfig:nc,zIndexMode:ai}),D.jsx(aU,{onSelectionChange:G}),so,D.jsx(nU,{proOptions:si,position:Ql}),D.jsx(tU,{rfId:li,disableKeyboardA11y:co})]})})}var BL=Tw(zL);const UL=e=>e.domNode?.querySelector(".react-flow__edgelabel-renderer");function LL({children:e}){const t=Ke(UL);return t?Gl.createPortal(e,t):null}function kL({onChange:e}){const t=ht();R.useEffect(()=>{const r=[...t.getState().onSelectionChangeHandlers,e];return t.setState({onSelectionChangeHandlers:r}),()=>{const i=t.getState().onSelectionChangeHandlers.filter(a=>a!==e);t.setState({onSelectionChangeHandlers:i})}},[e])}function IL({dimensions:e,lineWidth:t,variant:r,className:i}){return D.jsx("path",{strokeWidth:t,d:`M${e[0]/2} 0 V${e[1]} M0 ${e[1]/2} H${e[0]}`,className:Ft(["react-flow__background-pattern",r,i])})}function HL({radius:e,className:t}){return D.jsx("circle",{cx:e,cy:e,r:e,className:Ft(["react-flow__background-pattern","dots",t])})}var Go;(function(e){e.Lines="lines",e.Dots="dots",e.Cross="cross"})(Go||(Go={}));const FL={[Go.Dots]:1,[Go.Lines]:1,[Go.Cross]:6},PL=e=>({transform:e.transform,patternId:`pattern-${e.rfId}`});function Zw({id:e,variant:t=Go.Dots,gap:r=20,size:i,lineWidth:a=1,offset:l=0,color:u,bgColor:f,style:h,className:d,patternClassName:p}){const g=R.useRef(null),{transform:v,patternId:x}=Ke(PL,bt),b=i||FL[t],_=t===Go.Dots,C=t===Go.Cross,E=Array.isArray(r)?r:[r,r],N=[E[0]*v[2]||1,E[1]*v[2]||1],w=b*v[2],A=Array.isArray(l)?l:[l,l],M=C?[w,w]:N,T=[A[0]*v[2]||1+M[0]/2,A[1]*v[2]||1+M[1]/2],O=`${x}${e||""}`;return D.jsxs("svg",{className:Ft(["react-flow__background",d]),style:{...h,...od,"--xy-background-color-props":f,"--xy-background-pattern-color-props":u},ref:g,"data-testid":"rf__background",children:[D.jsx("pattern",{id:O,x:v[0]%N[0],y:v[1]%N[1],width:N[0],height:N[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${T[0]},-${T[1]})`,children:_?D.jsx(HL,{radius:w/2,className:p}):D.jsx(IL,{dimensions:M,lineWidth:a,variant:t,className:p})}),D.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${O})`})]})}Zw.displayName="Background";R.memo(Zw);function jL(){return D.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:D.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function VL(){return D.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:D.jsx("path",{d:"M0 0h32v4.2H0z"})})}function GL(){return D.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:D.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function qL(){return D.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:D.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function YL(){return D.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:D.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Nu({children:e,className:t,...r}){return D.jsx("button",{type:"button",className:Ft(["react-flow__controls-button",t]),...r,children:e})}const XL=e=>({isInteractive:e.nodesDraggable||e.nodesConnectable||e.elementsSelectable,minZoomReached:e.transform[2]<=e.minZoom,maxZoomReached:e.transform[2]>=e.maxZoom,ariaLabelConfig:e.ariaLabelConfig});function Qw({style:e,showZoom:t=!0,showFitView:r=!0,showInteractive:i=!0,fitViewOptions:a,onZoomIn:l,onZoomOut:u,onFitView:f,onInteractiveChange:h,className:d,children:p,position:g="bottom-left",orientation:v="vertical","aria-label":x}){const b=ht(),{isInteractive:_,minZoomReached:C,maxZoomReached:E,ariaLabelConfig:N}=Ke(XL,bt),{zoomIn:w,zoomOut:A,fitView:M}=rd(),T=()=>{w(),l?.()},O=()=>{A(),u?.()},I=()=>{M(a),f?.()},j=()=>{b.setState({nodesDraggable:!_,nodesConnectable:!_,elementsSelectable:!_}),h?.(!_)},Z=v==="horizontal"?"horizontal":"vertical";return D.jsxs(Zs,{className:Ft(["react-flow__controls",Z,d]),position:g,style:e,"data-testid":"rf__controls","aria-label":x??N["controls.ariaLabel"],children:[t&&D.jsxs(D.Fragment,{children:[D.jsx(Nu,{onClick:T,className:"react-flow__controls-zoomin",title:N["controls.zoomIn.ariaLabel"],"aria-label":N["controls.zoomIn.ariaLabel"],disabled:E,children:D.jsx(jL,{})}),D.jsx(Nu,{onClick:O,className:"react-flow__controls-zoomout",title:N["controls.zoomOut.ariaLabel"],"aria-label":N["controls.zoomOut.ariaLabel"],disabled:C,children:D.jsx(VL,{})})]}),r&&D.jsx(Nu,{className:"react-flow__controls-fitview",onClick:I,title:N["controls.fitView.ariaLabel"],"aria-label":N["controls.fitView.ariaLabel"],children:D.jsx(GL,{})}),i&&D.jsx(Nu,{className:"react-flow__controls-interactive",onClick:j,title:N["controls.interactive.ariaLabel"],"aria-label":N["controls.interactive.ariaLabel"],children:_?D.jsx(YL,{}):D.jsx(qL,{})}),p]})}Qw.displayName="Controls";const $L=R.memo(Qw);function KL({id:e,x:t,y:r,width:i,height:a,style:l,color:u,strokeColor:f,strokeWidth:h,className:d,borderRadius:p,shapeRendering:g,selected:v,onClick:x}){const{background:b,backgroundColor:_}=l||{},C=u||b||_;return D.jsx("rect",{className:Ft(["react-flow__minimap-node",{selected:v},d]),x:t,y:r,rx:p,ry:p,width:i,height:a,style:{fill:C,stroke:f,strokeWidth:h},shapeRendering:g,onClick:x?E=>x(E,e):void 0})}const ZL=R.memo(KL),QL=e=>e.nodes.map(t=>t.id),Km=e=>e instanceof Function?e:()=>e;function WL({nodeStrokeColor:e,nodeColor:t,nodeClassName:r="",nodeBorderRadius:i=5,nodeStrokeWidth:a,nodeComponent:l=ZL,onClick:u}){const f=Ke(QL,bt),h=Km(t),d=Km(e),p=Km(r),g=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return D.jsx(D.Fragment,{children:f.map(v=>D.jsx(ek,{id:v,nodeColorFunc:h,nodeStrokeColorFunc:d,nodeClassNameFunc:p,nodeBorderRadius:i,nodeStrokeWidth:a,NodeComponent:l,onClick:u,shapeRendering:g},v))})}function JL({id:e,nodeColorFunc:t,nodeStrokeColorFunc:r,nodeClassNameFunc:i,nodeBorderRadius:a,nodeStrokeWidth:l,shapeRendering:u,NodeComponent:f,onClick:h}){const{node:d,x:p,y:g,width:v,height:x}=Ke(b=>{const _=b.nodeLookup.get(e);if(!_)return{node:void 0,x:0,y:0,width:0,height:0};const C=_.internals.userNode,{x:E,y:N}=_.internals.positionAbsolute,{width:w,height:A}=io(C);return{node:C,x:E,y:N,width:w,height:A}},bt);return!d||d.hidden||!Q2(d)?null:D.jsx(f,{x:p,y:g,width:v,height:x,style:d.style,selected:!!d.selected,className:i(d),color:t(d),borderRadius:a,strokeColor:r(d),strokeWidth:l,shapeRendering:u,onClick:h,id:d.id})}const ek=R.memo(JL);var tk=R.memo(WL);const nk=200,rk=150,ok=e=>!e.hidden,ik=e=>{const t={x:-e.transform[0]/e.transform[2],y:-e.transform[1]/e.transform[2],width:e.width/e.transform[2],height:e.height/e.transform[2]};return{viewBB:t,boundingRect:e.nodeLookup.size>0?Z2(Pl(e.nodeLookup,{filter:ok}),t):t,rfId:e.rfId,panZoom:e.panZoom,translateExtent:e.translateExtent,flowWidth:e.width,flowHeight:e.height,ariaLabelConfig:e.ariaLabelConfig}},sk="react-flow__minimap-desc";function Ww({style:e,className:t,nodeStrokeColor:r,nodeColor:i,nodeClassName:a="",nodeBorderRadius:l=5,nodeStrokeWidth:u,nodeComponent:f,bgColor:h,maskColor:d,maskStrokeColor:p,maskStrokeWidth:g,position:v="bottom-right",onClick:x,onNodeClick:b,pannable:_=!1,zoomable:C=!1,ariaLabel:E,inversePan:N,zoomStep:w=1,offsetScale:A=5}){const M=ht(),T=R.useRef(null),{boundingRect:O,viewBB:I,rfId:j,panZoom:Z,translateExtent:P,flowWidth:q,flowHeight:G,ariaLabelConfig:k}=Ke(ik,bt),F=e?.width??nk,z=e?.height??rk,L=O.width/F,H=O.height/z,X=Math.max(L,H),Q=X*F,U=X*z,V=A*X,ee=O.x-(Q-O.width)/2-V,J=O.y-(U-O.height)/2-V,fe=Q+V*2,ye=U+V*2,he=`${sk}-${j}`,ae=R.useRef(0),be=R.useRef();ae.current=X,R.useEffect(()=>{if(T.current&&Z)return be.current=wB({domNode:T.current,panZoom:Z,getTransform:()=>M.getState().transform,getViewScale:()=>ae.current}),()=>{be.current?.destroy()}},[Z]),R.useEffect(()=>{be.current?.update({translateExtent:P,width:q,height:G,inversePan:N,pannable:_,zoomStep:w,zoomable:C})},[_,C,N,w,P,q,G]);const ve=x?xe=>{const[Ee,Ce]=be.current?.pointer(xe)||[0,0];x(xe,{x:Ee,y:Ce})}:void 0,Te=b?R.useCallback((xe,Ee)=>{const Ce=M.getState().nodeLookup.get(Ee).internals.userNode;b(xe,Ce)},[]):void 0,we=E??k["minimap.ariaLabel"];return D.jsx(Zs,{position:v,style:{...e,"--xy-minimap-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof g=="number"?g*X:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-width-props":typeof u=="number"?u:void 0},className:Ft(["react-flow__minimap",t]),"data-testid":"rf__minimap",children:D.jsxs("svg",{width:F,height:z,viewBox:`${ee} ${J} ${fe} ${ye}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":he,ref:T,onClick:ve,children:[we&&D.jsx("title",{id:he,children:we}),D.jsx(tk,{onClick:Te,nodeColor:i,nodeStrokeColor:r,nodeBorderRadius:l,nodeClassName:a,nodeStrokeWidth:u,nodeComponent:f}),D.jsx("path",{className:"react-flow__minimap-mask",d:`M${ee-V},${J-V}h${fe+V*2}v${ye+V*2}h${-fe-V*2}z
1850
+ M${I.x},${I.y}h${I.width}v${I.height}h${-I.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Ww.displayName="MiniMap";R.memo(Ww);const ak=e=>t=>e?`${Math.max(1/t.transform[2],1)}`:void 0,lk={[Ks.Line]:"right",[Ks.Handle]:"bottom-right"};function ck({nodeId:e,position:t,variant:r=Ks.Handle,className:i,style:a=void 0,children:l,color:u,minWidth:f=10,minHeight:h=10,maxWidth:d=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:g=!1,resizeDirection:v,autoScale:x=!0,shouldResize:b,onResizeStart:_,onResize:C,onResizeEnd:E}){const N=Mw(),w=typeof e=="string"?e:N,A=ht(),M=R.useRef(null),T=r===Ks.Handle,O=Ke(R.useCallback(ak(T&&x),[T,x]),bt),I=R.useRef(null),j=t??lk[r];R.useEffect(()=>{if(!(!M.current||!w))return I.current||(I.current=IB({domNode:M.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:P,transform:q,snapGrid:G,snapToGrid:k,nodeOrigin:F,domNode:z}=A.getState();return{nodeLookup:P,transform:q,snapGrid:G,snapToGrid:k,nodeOrigin:F,paneDomNode:z}},onChange:(P,q)=>{const{triggerNodeChanges:G,nodeLookup:k,parentLookup:F,nodeOrigin:z}=A.getState(),L=[],H={x:P.x,y:P.y},X=k.get(w);if(X&&X.expandParent&&X.parentId){const Q=X.origin??z,U=P.width??X.measured.width??0,V=P.height??X.measured.height??0,ee={id:X.id,parentId:X.parentId,rect:{width:U,height:V,...W2({x:P.x??X.position.x,y:P.y??X.position.y},{width:U,height:V},X.parentId,k,Q)}},J=tg([ee],k,F,z);L.push(...J),H.x=P.x?Math.max(Q[0]*U,P.x):void 0,H.y=P.y?Math.max(Q[1]*V,P.y):void 0}if(H.x!==void 0&&H.y!==void 0){const Q={id:w,type:"position",position:{...H}};L.push(Q)}if(P.width!==void 0&&P.height!==void 0){const U={id:w,type:"dimensions",resizing:!0,setAttributes:v?v==="horizontal"?"width":"height":!0,dimensions:{width:P.width,height:P.height}};L.push(U)}for(const Q of q){const U={...Q,type:"position"};L.push(U)}G(L)},onEnd:({width:P,height:q})=>{const G={id:w,type:"dimensions",resizing:!1,dimensions:{width:P,height:q}};A.getState().triggerNodeChanges([G])}})),I.current.update({controlPosition:j,boundaries:{minWidth:f,minHeight:h,maxWidth:d,maxHeight:p},keepAspectRatio:g,resizeDirection:v,onResizeStart:_,onResize:C,onResizeEnd:E,shouldResize:b}),()=>{I.current?.destroy()}},[j,f,h,d,p,g,_,C,E,b]);const Z=j.split("-");return D.jsx("div",{className:Ft(["react-flow__resize-control","nodrag",...Z,r,i]),ref:M,style:{...a,scale:O,...u&&{[T?"backgroundColor":"borderColor"]:u}},children:l})}R.memo(ck);const Zm=14,Z_=50,Q_=({id:e,type:t,position:r,count:i})=>{const a=t==="source";let l;return a?l="bg-neutral-300 text-neutral-500 hover:border-neutral-500 hover:text-neutral-800 bg-[#78A3C4]":l="bg-neutral-300",D.jsx(Al,{id:e,type:t,position:r,className:`${r===Ne.Top?"top-0 ":r===Ne.Bottom?"bottom-0":""}`,style:{background:"none",border:"none",width:Zm*2,height:Zm,...i?{transform:`translateX(${i.index/(i.total-1)*Z_-Z_/2-Zm}px)`}:{}},children:D.jsx("div",{className:`absolute inset-0 rounded-full flex items-center justify-center text-xs font-mono leading-none pointer-events-none transition-colors ${l}`})})},Sr=({value:e,min:t=-1/0,max:r=1/0,step:i=.01,label:a,onChange:l})=>{const u=R.useRef(!1),f=R.useRef(0),h=R.useRef(0),[d,p]=R.useState(!1),[g,v]=R.useState(""),x=R.useRef(null),b=R.useRef(null),_=M=>Math.min(r,Math.max(t,M)),C=R.useCallback(M=>{d||(u.current=!0,f.current=M.clientX,h.current=e,M.preventDefault())},[e,d]);R.useEffect(()=>{const M=O=>{if(!u.current)return;const I=(O.clientX-f.current)*i;l(_(parseFloat((h.current+I).toFixed(6))))},T=()=>{u.current=!1};return window.addEventListener("mousemove",M),window.addEventListener("mouseup",T),()=>{window.removeEventListener("mousemove",M),window.removeEventListener("mouseup",T)}},[i,t,r,l]);const E=()=>{v(String(e)),p(!0),setTimeout(()=>x.current?.select(),0)},N=()=>{const M=parseFloat(g);isNaN(M)||l(_(M)),p(!1)},w=M=>{d||(M.key==="Enter"||M.key===" "?(M.preventDefault(),v(String(e)),p(!0),setTimeout(()=>x.current?.select(),0)):M.key==="ArrowRight"||M.key==="ArrowUp"?(M.preventDefault(),l(_(parseFloat((e+i).toFixed(6))))):(M.key==="ArrowLeft"||M.key==="ArrowDown")&&(M.preventDefault(),l(_(parseFloat((e-i).toFixed(6))))))},A=Number.isInteger(e)?e.toFixed(1):e.toFixed(3).replace(/0+$/,"");return D.jsxs("div",{className:"flex items-center w-20 relative nodrag",children:[a&&D.jsx("span",{className:"absolute left-1 z-10 bg-neutral-200 h-4 w-4 grid place-items-center pointer-events-none rounded-sm",children:D.jsx("p",{className:"text-[11px] font-mono w-3 text-neutral-500 height-3 leading-0 -translate-y-0.5 translate-x-0.5 ",children:a})}),D.jsx("div",{ref:b,tabIndex:0,onMouseDown:C,onDoubleClick:E,onKeyDown:w,className:["flex items-center justify-center","rounded overflow-hidden select-none w-full h-6","focus:outline-2 focus:outline-neutral-400 focus:outline-offset-1",d?"cursor-text":"cursor-ew-resize"].join(" "),children:d?D.jsx("input",{ref:x,value:g,onChange:M=>v(M.target.value),onBlur:N,onKeyDown:M=>{M.key==="Enter"&&N(),M.key==="Escape"&&p(!1)},className:"outline-none text-neutral-500 text-xs font-mono border-neutral-200 pl-5 rounded-sm text-right w-full h-full bg-white"}):D.jsx("span",{className:"text-xs font-mono text-neutral-500 pl-5 pointer-events-none border-neutral-200 bg-white rounded-sm w-full h-full flex items-center justify-end px-1",children:D.jsx("p",{children:A})})})]})},Yl=R.createContext({currentTime:{current:0},mousePosition:{current:[0,0]},shaders:[],patches:{},showStats:!1,openExportNodeId:null,setOpenExportNodeId:()=>{},openPreviewNodeId:null,setOpenPreviewNodeId:()=>{},uniforms:{current:{}},handleUpdateUniforms:()=>{},handleUpdateNode:e=>e,handleInsertShader:()=>{}}),Qm=e=>Math.round(Math.min(1,Math.max(0,e))*255).toString(16).padStart(2,"0"),Wm=e=>parseInt(e,16)/255,Jw=([e,t,r])=>`#${Qm(e)}${Qm(t)}${Qm(r)}`,eC=e=>[Wm(e.slice(1,3)),Wm(e.slice(3,5)),Wm(e.slice(5,7))],og=({color:e,onChange:t})=>{const r=R.useRef(null);return D.jsxs("div",{className:"relative",children:[D.jsx("button",{onClick:()=>r.current?.click(),className:"w-8 h-5.5 rounded border-2 border-neutral-200 cursor-pointer",style:{backgroundColor:e},title:e}),D.jsx("input",{ref:r,type:"color",value:e,onChange:i=>t(i.target.value),className:"absolute opacity-0 w-0 h-0 pointer-events-none"})]})},ji=({onClick:e})=>D.jsx("button",{onClick:e,className:"w-6 h-6 flex items-center justify-center text-neutral-400 hover:text-neutral-700 hover:bg-neutral-100 rounded-sm select-none shrink-0",title:"Reset to default",children:"↺"}),uk=({name:e,type:t})=>{const{showStats:r}=R.useContext(Yl);return D.jsxs("div",{className:" min-w-40 flex flex-col gap-0.5 items-end",children:[D.jsx("span",{className:"font-mono text-xs text-neutral-900",children:e.replace("u_","").replaceAll("_"," ").replace(/\b\w/g,i=>i.toUpperCase())}),r&&D.jsx("span",{className:"font-mono text-[10px] text-neutral-500",children:t})]})},fk=({field:e,initialValue:t,handleUpdateUniformField:r})=>{const[i,a]=R.useState(t);R.useEffect(()=>{a(t),r(t)},[t]);const l=u=>{a(u),r(u)};return D.jsxs("div",{className:"flex items-center ",children:[D.jsx(Sr,{value:i,min:e.min,max:e.max,step:.01,onChange:l}),e.default!==void 0&&D.jsx(ji,{onClick:()=>l(e.default)})]})},dk=({handleUpdateUniformField:e})=>{const[t,r]=R.useState(!1),[i,a]=R.useState(0);R.useEffect(()=>{if(!t)return;const u=Date.now()-i*1e3;let f;const h=()=>{const d=(Date.now()-u)/1e3;a(d),e(d),f=requestAnimationFrame(h)};return f=requestAnimationFrame(h),()=>cancelAnimationFrame(f)},[t]);const l=()=>{r(!1),a(0),e(0)};return D.jsxs("div",{className:"flex items-center ",children:[D.jsx("button",{onClick:()=>r(u=>!u),className:"text-xs font-mono text-neutral-500 bg-neutral-100 hover:bg-neutral-200 rounded-sm w-6 h-6 flex items-center justify-center select-none",title:t?"Pause":"Play",children:t?"⏸":"▶"}),D.jsxs("span",{className:"font-mono text-xs text-neutral-500 px-2 w-16 text-right tabular-nums",children:[i.toFixed(2),"s"]}),D.jsx(ji,{onClick:l})]})},hk=({field:e,initialValue:t,handleUpdateUniformField:r})=>{const[i,a]=R.useState(t);R.useEffect(()=>{a(t),r(t)},[t]);const l=(f,h)=>{const d=[...i];d[f]=h,a(d),r(d)},u=f=>{a(f),r(f)};return D.jsxs("div",{className:"flex items-center ",children:[D.jsx("div",{className:"flex gap-2 flex-wrap flex-col",children:["x","y"].map((f,h)=>D.jsx(Sr,{label:f,value:i[h],onChange:d=>l(h,d)},f))}),e.default!==void 0&&D.jsx(ji,{onClick:()=>u(e.default)})]})},mk=({field:e,initialValue:t,handleUpdateUniformField:r})=>{const[i,a]=R.useState(t);R.useEffect(()=>{a(t),r(t)},[t]);const l=(f,h)=>{const d=[...i];d[f]=h,a(d),r(d)},u=f=>{a(f),r(f)};return D.jsxs("div",{className:"flex items-center ",children:[D.jsx("div",{className:"flex flex-col gap-2",children:["x","y","z"].map((f,h)=>D.jsx(Sr,{label:f,value:i[h],onChange:d=>l(h,d)},f))}),e.default!==void 0&&D.jsx(ji,{onClick:()=>u(e.default)})]})},pk=({field:e,initialValue:t,handleUpdateUniformField:r})=>{const[i,a]=R.useState(t);R.useEffect(()=>{a(t)},[t]);const l=u=>{a(u),r(u)};return D.jsxs("div",{className:"flex items-center ",children:[D.jsx(og,{color:Jw(i),onChange:u=>l(eC(u))}),e.default!==void 0&&D.jsx(ji,{onClick:()=>l(e.default)})]})},gk=({field:e,initialValue:t,handleUpdateUniformField:r})=>{const[i,a]=R.useState(t);R.useEffect(()=>{a(t),r(t)},[t]);const l=(f,h)=>{const d=[...i];d[f]=h,a(d),r(d)},u=f=>{a(f),r(f)};return D.jsxs("div",{className:"flex items-center gap-2 px-2",children:[D.jsx("div",{className:"flex flex-col gap-2",children:["x","y","z","w"].map((f,h)=>D.jsx(Sr,{label:f,value:i[h],onChange:d=>l(h,d)},f))}),e.default!==void 0&&D.jsx(ji,{onClick:()=>u(e.default)})]})},yk=({field:e,initialValue:t,handleUpdateUniformField:r})=>{const[i,a]=R.useState(t);R.useEffect(()=>{a(t),r(t)},[t]);const[l,u,f,h]=i,d=p=>{a(p),r(p)};return D.jsxs("div",{className:"flex items-center ",children:[D.jsx(og,{color:Jw([l,u,f]),onChange:p=>{const[g,v,x]=eC(p);d([g,v,x,h])}}),D.jsx(Sr,{label:"a",value:h,min:0,max:1,step:.01,onChange:p=>d([l,u,f,p])}),e.default!==void 0&&D.jsx(ji,{onClick:()=>d(e.default)})]})},vk=({handleUpdateUniformField:e})=>{const{mousePosition:t}=R.useContext(Yl),[r,i]=R.useState([0,0]);return R.useEffect(()=>{let a;const l=()=>{const u=[t.current[0],t.current[1]];i(u),e(u),a=requestAnimationFrame(l)};return a=requestAnimationFrame(l),()=>cancelAnimationFrame(a)},[e]),D.jsx("div",{className:"flex items-center ",children:D.jsx("div",{className:"flex gap-2 flex-col",children:["x","y"].map((a,l)=>D.jsxs("div",{className:"flex items-center w-20 relative",children:[D.jsx("span",{className:"absolute left-1 z-10 bg-neutral-200 h-4 w-4 grid place-items-center pointer-events-none rounded-sm",children:D.jsx("p",{className:"text-[11px] font-mono w-3 text-neutral-500 leading-0 -translate-y-0.5 translate-x-0.5",children:a})}),D.jsx("span",{className:"text-xs font-mono text-neutral-500 pl-5 pointer-events-none bg-neutral-100 rounded-sm w-full h-6 flex items-center justify-end px-1 tabular-nums",children:r[l].toFixed(3)})]},a))})})},xk=({width:e,height:t,handleUpdateUniformField:r})=>{const i=R.useRef(r);return i.current=r,R.useEffect(()=>{i.current([e,t])},[e,t]),D.jsx("div",{className:"flex items-center ",children:D.jsx("div",{className:"flex gap-2 flex-col",children:["w","h"].map((a,l)=>D.jsxs("div",{className:"flex items-center w-20 relative",children:[D.jsx("span",{className:"absolute left-1 z-10 bg-neutral-200 h-4 w-4 grid place-items-center pointer-events-none rounded-sm",children:D.jsx("p",{className:"text-[11px] font-mono w-3 text-neutral-500 leading-0 -translate-y-0.5 translate-x-0.5",children:a})}),D.jsx("span",{className:"text-xs font-mono text-neutral-500 pl-5 pointer-events-none bg-neutral-100 rounded-sm w-full h-6 flex items-center justify-end px-1 tabular-nums",children:l===0?e:t})]},a))})})},bk=({value:e,handleUpdateUniformField:t})=>{const[r,i]=R.useState(!1),a=e?.src instanceof HTMLVideoElement?e.src:null,l=typeof e?.src=="string"?e.src:a?.src??null,u=a!==null,[f,h]=R.useState(l),[d,p]=R.useState(u),[g,v]=R.useState(l?l.split("/").pop()??null:null),[x,b]=R.useState(()=>a&&a.readyState>=1?[a.videoWidth,a.videoHeight]:null);R.useEffect(()=>{if(x===null){if(a){const E=()=>b([a.videoWidth,a.videoHeight]);a.readyState>=1?E():a.addEventListener("loadedmetadata",E,{once:!0})}else if(l&&!u){const E=new Image;E.onload=()=>b([E.naturalWidth,E.naturalHeight]),E.src=l}}},[]);const _=R.useRef(null),C=E=>{if(!E)return;const N=URL.createObjectURL(E),w=E.type.startsWith("video/");if(h(N),p(w),v(E.name),b(null),w){const A=document.createElement("video");A.autoplay=!0,A.muted=!0,A.loop=!0,A.playsInline=!0,A.onloadedmetadata=()=>b([A.videoWidth,A.videoHeight]),A.src=N,A.play(),t({type:"texture",src:A})}else{const A=new Image;A.onload=()=>b([A.naturalWidth,A.naturalHeight]),A.src=N,t({type:"texture",src:N})}};return R.useEffect(()=>{if(!r)return;const E=N=>{if(N.clipboardData){for(const w of N.clipboardData.items)if(w.type.startsWith("image/")||w.type.startsWith("video/")){C(w.getAsFile());break}}};return window.addEventListener("paste",E),()=>window.removeEventListener("paste",E)},[r]),D.jsx("div",{className:"flex items-center ",children:D.jsxs("div",{className:"flex flex-col items-start gap-2",children:[D.jsx("div",{tabIndex:0,onFocus:()=>i(!0),onBlur:()=>i(!1),className:`w-32 h-32 rounded overflow-hidden flex flex-col items-center justify-center cursor-pointer select-none transition border-4 text-neutral-500 text-xs font-mono p-2 ${r?"bg-neutral-50 border-neutral-300":"bg-neutral-100 border-neutral-50"}`,children:f?d?D.jsx("video",{src:f,className:"w-full h-full object-contain",autoPlay:!0,muted:!0,loop:!0,playsInline:!0}):D.jsx("img",{src:f,className:"w-full h-full object-contain"}):r?"cmd+V":D.jsxs(D.Fragment,{children:[D.jsx("p",{children:"Paste"}),D.jsx("p",{children:"Here"})]})}),D.jsxs("div",{className:"flex flex-col items-start gap-0.5",children:[D.jsx("button",{className:"button-base",onClick:()=>_.current?.click(),children:f?"Replace":"Upload"}),g&&D.jsx("span",{className:"text-[10px] text-neutral-400 font-mono truncate max-w-32",title:g,children:g}),x&&D.jsxs("span",{className:"text-[10px] text-neutral-400 font-mono",children:[x[0],"×",x[1]]})]}),D.jsx("input",{ref:_,type:"file",accept:"image/*,video/*",className:"hidden",onChange:E=>C(E.target.files?.[0]??null)})]})})},W_=[{position:0,color:"#000000"},{position:1,color:"#ffffff"}],_k=({value:e,handleUpdateUniformField:t})=>{const[r,i]=R.useState(e?.stops??W_),a=R.useRef(null),l=R.useRef(null);R.useEffect(()=>{i(e?.stops??W_)},[e]),R.useEffect(()=>{const g=a.current;if(!g)return;const v=g.getContext("2d");if(v){for(let x=0;x<g.width;x++)v.fillStyle=c2(r,x/(g.width-1)),v.fillRect(x,0,1,g.height);t({type:"gradient",stops:r})}},[r]);const u=g=>v=>{v.preventDefault();const x=l.current;if(!x)return;const b=C=>{const E=x.getBoundingClientRect(),w=Math.max(0,Math.min(C.clientX-E.left,E.width))/E.width;i(A=>A.map((M,T)=>T===g?{...M,position:w}:M))},_=()=>{window.removeEventListener("mousemove",b),window.removeEventListener("mouseup",_)};window.addEventListener("mousemove",b),window.addEventListener("mouseup",_)},f=()=>i(g=>[...g,{position:1,color:"#ffffff"}]),h=g=>{r.length<=1||i(v=>v.filter((x,b)=>b!==g))},d=(g,v)=>i(x=>x.map((b,_)=>_===g?{...b,position:v}:b)),p=(g,v)=>i(x=>x.map((b,_)=>_===g?{...b,color:v}:b));return D.jsxs("div",{className:"flex flex-col gap-3 p-2",children:[D.jsxs("div",{ref:l,className:"relative w-32 h-4 nodrag nopan",children:[D.jsx("canvas",{ref:a,width:128,height:16,className:"w-32 h-4 rounded-sm border-2 border-neutral-200"}),r.map((g,v)=>D.jsx("button",{"aria-label":`gradient stop ${v}`,className:"absolute w-4 h-4 -translate-x-1/2 -bottom-2 rounded-sm border-2 border-neutral-200 cursor-ew-resize",style:{left:`${g.position*100}%`,backgroundColor:g.color},onMouseDown:u(v)},v))]}),D.jsxs("div",{className:"flex items-center justify-between w-32",children:[D.jsx("span",{className:"font-mono text-[10px] text-neutral-500",children:"STOPS"}),D.jsx("button",{onClick:f,className:"font-mono text-[10px] text-neutral-500 hover:text-neutral-800 leading-none",children:"ADD +"})]}),D.jsx("div",{className:"flex flex-col gap-1.5",children:r.map((g,v)=>D.jsxs("div",{className:"flex items-center gap-2",children:[D.jsx(Sr,{value:g.position,min:0,max:1,step:.01,onChange:x=>d(v,x)}),D.jsx(og,{color:g.color,onChange:x=>p(v,x)}),r.length>1&&D.jsx("button",{onClick:()=>h(v),className:"text-xs text-neutral-400 hover:text-neutral-700 leading-none px-1","aria-label":`remove stop ${v}`,children:"×"})]},v))})]})};function Ek(e){switch(e.type){case"float":return e.special==="time"?"float time":"float";case"vec2":return e.special==="mouse"?"vec2 mouse":e.special==="resolution"?"vec2 resolution":"vec2";case"vec3":return e.color?"vec3 color":"vec3";case"vec4":return e.color?"vec4 color":"vec4";case"sampler2D":return e.source==="gradient"?"sampler2D gradient":"sampler2D texture"}}const tC=({shader:e,savedUniforms:t,handleUpdateUniform:r})=>{const i=R.useMemo(()=>js(e),[e.source]);return i.filter(a=>!(a.type==="sampler2D"&&a.source==="input")).length===0?D.jsx(D.Fragment,{}):D.jsx("div",{className:"rounded flex flex-col gap-1",children:i.map(a=>{const l=`${a.name}-${a.type}`,u=g=>r(a.name,g),f=g=>{r(a.name,g)},h=t[a.name],d=f2(a);let p=null;switch(a.type){case"float":p=a.special==="time"?D.jsx(dk,{field:a,handleUpdateUniformField:u}):D.jsx(fk,{field:a,initialValue:h??d,handleUpdateUniformField:u});break;case"vec2":p=a.special==="mouse"?D.jsx(vk,{field:a,handleUpdateUniformField:u}):a.special==="resolution"?D.jsx(xk,{field:a,width:e.resolution.width,height:e.resolution.height,handleUpdateUniformField:u}):D.jsx(hk,{field:a,initialValue:h??d,handleUpdateUniformField:u});break;case"vec3":p=a.color?D.jsx(pk,{field:a,initialValue:h??d,handleUpdateUniformField:u}):D.jsx(mk,{field:a,initialValue:h??d,handleUpdateUniformField:u});break;case"vec4":p=a.color?D.jsx(yk,{field:a,initialValue:h??d,handleUpdateUniformField:u}):D.jsx(gk,{field:a,initialValue:h??d,handleUpdateUniformField:u});break;case"sampler2D":a.source==="texture"?p=D.jsx(bk,{field:a,value:h,handleUpdateUniformField:f}):a.source==="gradient"&&(p=D.jsx(_k,{field:a,value:h,handleUpdateUniformField:u}));break}return p===null?null:D.jsxs("div",{className:"flex items-center gap-4 rounded-sm mb-1",children:[D.jsx(uk,{name:a.name,type:Ek(a)}),D.jsx("div",{className:"bg-neutral-100 p-1 rounded-md",children:p})]},l)})})},ig=({children:e,open:t,className:r,handleOpenChange:i})=>{const a=R.useRef(null),[l,u]=R.useState(t);return R.useEffect(()=>{u(!!t)},[t]),R.useEffect(()=>{a.current!==null&&(l?a.current.showModal():a.current.close()),i(l)},[l]),D.jsx("dialog",{ref:a,className:`top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-3xl h-5/6 border border-neutral-300 rounded-lg starting:opacity-0 opacity-100 transition-all transition-discrete ${l?"visible":"hidden"} ${r} nopan nodrag nowheel`,children:t&&e})},J_="pnpm i @sequenza/lib",nC=({uniforms:e,patch:t,open:r,onOpenChange:i})=>{const a=s5(e,t),l=JSON.stringify({uniforms:e,shader:t},null,2),[u,f]=R.useState("idle"),[h,d]=R.useState("idle"),[p,g]=R.useState("idle"),v=()=>{navigator.clipboard.writeText(J_),f("done"),setTimeout(()=>f("idle"),1800)},x=()=>{navigator.clipboard.writeText(a),d("done"),setTimeout(()=>d("idle"),1800)},b=()=>{navigator.clipboard.writeText(l),g("done"),setTimeout(()=>g("idle"),1800)};return D.jsxs(ig,{open:r,handleOpenChange:i,className:"flex flex-col gap-4 p-6 overflow-y-auto",children:[D.jsxs("div",{className:"flex items-center justify-between",children:[D.jsx("h2",{className:"text-sm font-medium text-neutral-800",children:"Integrate shader"}),D.jsx("button",{className:"button-base",onClick:()=>i(!1),children:"Close"})]}),D.jsxs("div",{className:"flex flex-col gap-1",children:[D.jsx("p",{className:"text-xs text-neutral-500",children:"Install"}),D.jsxs("div",{className:"flex items-center gap-2 bg-neutral-50 rounded py-4 px-4",children:[D.jsx("code",{className:"text-xs text-neutral-700 w-full select-all",children:J_}),D.jsx("button",{className:"button-base",onClick:v,children:u==="done"?"Copied!":"Copy"})]})]}),D.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-h-0",children:[D.jsx("p",{className:"text-xs text-neutral-500",children:"Component"}),D.jsxs("div",{className:"relative flex-1 min-h-0 bg-neutral-50 rounded",children:[D.jsx("button",{className:"absolute top-4 right-4 button-base",onClick:x,children:h==="done"?"Copied!":"Copy"}),D.jsx("textarea",{readOnly:!0,value:a,className:"w-full h-full resize-none bg-transparent text-xs text-neutral-700 font-mono p-4 pr-12 outline-none"})]})]}),D.jsxs("div",{className:"flex flex-col gap-1 flex-1 min-h-0",children:[D.jsx("p",{className:"text-xs text-neutral-500",children:"JSON"}),D.jsxs("div",{className:"relative flex-1 min-h-0 bg-neutral-50 rounded",children:[D.jsx("button",{className:"absolute top-4 right-4 button-base",onClick:b,children:p==="done"?"Copied!":"Copy"}),D.jsx("textarea",{readOnly:!0,value:l,className:"w-full h-full resize-none bg-transparent text-xs text-neutral-700 font-mono p-4 pr-12 outline-none"})]})]})]})},Sk=({open:e,onOpenChange:t,shader:r,patch:i,uniforms:a,savedUniforms:l,nodeId:u,handleFieldUpdate:f,handleUpdateNode:h})=>{const d=R.useRef(null),p=R.useRef(null),[g,v]=R.useState(!1),[x,b]=R.useState(null),_=(T,O)=>{const I=T.split(/\n(?=\d+: )/),j={};for(const G of I){const k=G.match(/^(\d+): ([\s\S]*)/);k&&(j[parseInt(k[1],10)]=k[2].trimEnd())}const Z=Math.max(1,O-3),P=O+3,q=[];for(let G=Z;G<=P;G++)j[G]!==void 0&&q.push(`${G}: ${j[G]}`);return q.join(`
1851
+ `)},[C,E]=R.useState({w:1,h:1}),{width:N,height:w}=r.resolution;R.useEffect(()=>{const T=p.current;if(!T)return;const O=new ResizeObserver(([I])=>{const{width:j,height:Z}=I.contentRect;E({w:j,h:Z})});return O.observe(T),()=>O.disconnect()},[]);const A=()=>{d.current?.toBlob(T=>{T&&navigator.clipboard.write([new ClipboardItem({"image/png":T})])})},M=()=>{const T=d.current?.toDataURL("image/png");if(!T)return;const O=document.createElement("a");O.href=T,O.download=`${r.name}.png`,O.click()};return D.jsxs(ig,{open:e,handleOpenChange:t,className:"flex flex-col w-full h-full",children:[D.jsxs("div",{className:"flex items-center justify-between px-6 py-4 shrink-0",children:[D.jsx("h2",{className:"text-sm font-medium text-neutral-800",children:r.name}),D.jsx("button",{className:"button-base",onClick:()=>t(!1),children:"Close"})]}),D.jsxs("div",{className:"flex gap-16 px-6 pb-6 flex-1 min-h-0 items-center",children:[D.jsx("div",{className:"flex flex-col gap-8",children:D.jsx("div",{className:"flex flex-col gap-2",children:D.jsx(tC,{shader:r,savedUniforms:l,handleUpdateUniform:f})})}),D.jsxs("div",{className:"h-full w-full flex flex-col gap-4 ",children:[D.jsx("div",{ref:p,className:"flex bg-neutral-50 rounded w-4/5 items-center justify-center h-full",children:D.jsx(u2,{ref:d,animate:!0,width:N,height:w,patch:i,uniforms:a,className:N/w>C.w/C.h?"w-full":"h-full",onError:T=>b(T)})}),D.jsxs("div",{className:"flex flex-col gap-2 ",children:[D.jsxs("div",{className:"flex gap-1 bg-neutral-100 p-1 rounded-md w-min",children:[D.jsx(Sr,{label:"w",value:N,min:1,step:1,onChange:T=>h(u,O=>({...O,shader:{...O.shader,resolution:{width:T,height:w}}}))}),D.jsx(Sr,{label:"h",value:w,min:1,step:1,onChange:T=>h(u,O=>({...O,shader:{...O.shader,resolution:{width:N,height:T}}}))})]}),D.jsxs("div",{className:"flex gap-1 h-min w-min",children:[D.jsx("button",{className:"button-base",onClick:()=>v(!0),children:"Export"}),D.jsx(nC,{uniforms:a.current,patch:i,open:g,onOpenChange:v}),D.jsx("button",{className:"button-base",onClick:A,children:"Copy"}),D.jsx("button",{className:"button-base",onClick:M,children:"Save"})]})]})]})]}),x&&D.jsxs("div",{className:"flex flex-col gap-2 mx-6 mb-6 p-2 bg-white border-2 border-red-100 rounded-md",children:[D.jsx("p",{className:"text-white w-min text-nowrap bg-red-700 px-2 py-1 rounded text-xs",children:x.shaderName}),D.jsx("pre",{className:"text-xs text-red-600 font-mono whitespace-pre-wrap break-all",children:_(x.message,x.line)}),D.jsx("button",{className:"self-start text-xs px-2 py-1 rounded border border-red-200 bg-white text-red-600 hover:bg-red-50 cursor-pointer",onClick:()=>navigator.clipboard.writeText(x.message),children:"Copy error"})]})]})},wk=({data:e,selected:t,id:r})=>{const{patches:i,uniforms:a,handleUpdateUniforms:l,handleUpdateNode:u,showStats:f,setOpenExportNodeId:h,openPreviewNodeId:d,setOpenPreviewNodeId:p}=R.useContext(Yl),[g,v]=R.useState(()=>a.current[e.shader.id]??{}),x=(P,q)=>{l(e.shader.id,G=>({...G,[P]:q}))},{width:b,height:_}=e.shader.resolution,[C,E]=R.useState(null),N=R.useRef(null),[w,A]=R.useState("idle"),[M,T]=R.useState("idle"),O=()=>{N.current?.toBlob(P=>{P&&navigator.clipboard.write([new ClipboardItem({"image/png":P})])}),A("done"),setTimeout(()=>A("idle"),1800)},I=()=>{const P=N.current?.toDataURL("image/png");if(!P)return;const q=document.createElement("a");q.href=P,q.download=`${e.shader.name}.png`,q.click()},j=R.useMemo(()=>js(e.shader).filter(P=>P.type==="sampler2D"&&P.source==="input").map(P=>P.name),[e.shader]),Z=(P,q)=>{const G=P.split(/\n(?=\d+: )/),k={};for(const H of G){const X=H.match(/^(\d+): ([\s\S]*)/);X&&(k[parseInt(X[1],10)]=X[2].trimEnd())}const F=Math.max(1,q-3),z=q+3,L=[];for(let H=F;H<=z;H++)k[H]!==void 0&&L.push(`${H}: ${k[H]}`);return L.join(`
1852
+ `)};return!i||i[e.shader.id]===void 0?null:D.jsxs("div",{className:`
1853
+ flex flex-col gap-8 bg-white rounded-lg p-6 relative outline-neutral-200
1854
+ ${t?"outline-neutral-300 outline-4":"outline-0"}
1855
+ group min-w-96 items-center justify-center
1856
+ `,children:[D.jsxs("div",{className:"w-full flex justify-between",children:[D.jsx("p",{className:"text-sm w-min py-1 px-2 text-lg rounded-md text-neutral-500 text-nowrap",children:e.shader.name.charAt(0).toUpperCase()+e.shader.name.slice(1)}),D.jsxs("div",{className:"flex gap-2",children:[D.jsx("button",{className:"button-base group-hover:block hidden",onClick:()=>{p(r),v(a.current[e.shader.id]??{})},children:"Expand"}),D.jsx(Sk,{open:d===r,onOpenChange:P=>{v(a.current[e.shader.id]??{}),p(P?r:null)},shader:e.shader,patch:i[e.shader.id],uniforms:a,savedUniforms:g,nodeId:r,handleFieldUpdate:x,handleUpdateNode:u}),D.jsx("button",{className:`button-base ${e.paused?"":"group-hover:block hidden"}`,onClick:()=>{u(r,P=>({...P,paused:!P.paused}))},children:e.paused?"Resume":"Pause"})]})]}),f&&D.jsxs(D.Fragment,{children:[D.jsxs("p",{className:"text-xs text-neutral-500 absolute -top-6",children:["ID: ",e.shader.id]}),D.jsx("p",{className:"text-xs text-neutral-500 absolute -top-10",children:e.shader.name})]}),j.map((P,q)=>D.jsx(Q_,{id:P,type:"target",position:Ne.Top,count:{total:j.length,index:q}},P)),D.jsxs("div",{className:"flex gap-8",children:[D.jsx(tC,{shader:e.shader,savedUniforms:g,handleUpdateUniform:x}),D.jsx("div",{className:"flex flex-col justify-center items-start gap-4 ",children:D.jsxs("div",{className:"flex flex-col gap-2",children:[D.jsxs("div",{className:"flex gap-1",children:[D.jsx("button",{className:"button-base",onClick:()=>h(r),children:"Export"}),D.jsx("button",{className:"button-base",onClick:O,children:w==="done"?"Copied!":"Copy"}),D.jsx("button",{className:"button-base",onClick:I,children:"Save"})]}),D.jsx("div",{className:"relative max-w-144",children:D.jsx(u2,{ref:N,animate:!e.paused,width:b,height:_,patch:i[e.shader.id],uniforms:a,className:"w-full h-auto",style:{maxWidth:`${b/_*36}rem`},onError:P=>{E(P)}})}),D.jsxs("div",{className:"flex gap-1 bg-neutral-100 rounded-md p-1 w-min",children:[D.jsx(Sr,{label:"w",value:b,min:1,step:1,onChange:P=>u(r,q=>({...q,shader:{...q.shader,resolution:{width:P,height:_}}}))}),D.jsx(Sr,{label:"h",value:_,min:1,step:1,onChange:P=>u(r,q=>({...q,shader:{...q.shader,resolution:{width:b,height:P}}}))})]})]})})]}),C&&D.jsxs("div",{className:"flex flex-col gap-2 p-2 bg-white border-2 border-red-100 rounded-md relative",children:[D.jsx("p",{className:"text-white w-min text-nowrap bg-red-700 px-2 py-1 rounded text-xs",children:C.shaderName}),D.jsx("pre",{className:"text-xs text-red-600 font-mono whitespace-pre-wrap break-all",children:Z(C.message,C.line)}),D.jsx("button",{className:"self-start text-xs px-2 py-1 rounded border border-red-200 bg-white text-red-600 hover:bg-red-50 cursor-pointer",onClick:()=>{navigator.clipboard.writeText(C.message),T("done"),setTimeout(()=>T("idle"),1800)},children:M==="done"?"Copied!":"Copy error"})]}),D.jsx(Q_,{id:"out",type:"source",position:Ne.Bottom})]})},rC=({open:e,handleOpenChange:t,shaders:r,handleAddShader:i})=>{const[a,l]=R.useState("");return D.jsx(ig,{open:e,handleOpenChange:t,children:D.jsxs("div",{className:"w-full h-full flex flex-col p-4 gap-4",children:[D.jsxs("div",{className:"w-full flex justify-between",children:[D.jsx("p",{children:"Add a Shader"}),D.jsx("button",{className:"button-base",onClick:()=>t(!1),children:"Close"})]}),D.jsxs("div",{className:"w-full flex flex-col h-full overflow-hidden gap-2",children:[D.jsx("input",{type:"text",value:a,onChange:u=>l(u.target.value),placeholder:"Search shaders...",className:"text-xs p-1 rounded-sm border border-neutral-200 outline-none mb-1"}),D.jsx("div",{className:"h-full flex flex-col overflow-y-auto",children:r.filter(u=>u.name.toLowerCase().includes(a.toLowerCase())).map(u=>D.jsx("button",{className:"text-xs flex justify-start p-1 rounded-sm hover:bg-neutral-100 cursor-pointer text-neutral-500 focus:outline-none focus:bg-neutral-200",onClick:()=>{i(u),t(!1)},children:u.id},u.id))})]})]})})};function Ck({sourceX:e,sourceY:t,targetX:r,targetY:i,sourcePosition:a,targetPosition:l,markerEnd:u,id:f,selected:h}){const[d,p,g]=ed({sourceX:e,sourceY:t,sourcePosition:a,targetX:r,targetY:i,targetPosition:l}),{shaders:v,handleInsertShader:x}=R.useContext(Yl),[b,_]=R.useState(!1);return D.jsxs(D.Fragment,{children:[D.jsx(ql,{path:d,markerEnd:u,style:h?{strokeWidth:"5px"}:{strokeWidth:"2px"}}),D.jsx(LL,{children:D.jsxs("div",{className:"absolute -translate-1/2 origin-center pointer-events-auto",style:{transform:`translate(${p}px,${g}px)`},children:[D.jsx("button",{className:"w-6 h-6 bg-neutral-200 rounded-full active:bg-neutral-200 z-10 flex items-center justify-center hover:bg-neutral-300",onClick:()=>_(!0),children:"+"}),D.jsx(rC,{open:b,handleOpenChange:_,shaders:v,handleAddShader:C=>x(C,f)})]})})]})}function Tk({fromX:e,fromY:t,toX:r,toY:i,fromPosition:a,toPosition:l,toHandle:u}){const[f]=ed({sourceX:e,sourceY:t,sourcePosition:a,targetX:r,targetY:i,targetPosition:l}),h=u?"connect":"new",d=i-26,p=6,g=16,v=h.length*6+p*2;return D.jsxs("g",{children:[D.jsx("path",{fill:"none",stroke:"#b1b1b7",strokeWidth:1.5,d:f}),D.jsx("rect",{x:r-v/2,y:d-g/2,width:v,height:g,rx:4,fill:u?"#404040":"#e5e5e5",style:{pointerEvents:"none"}}),D.jsx("text",{x:r,y:d,textAnchor:"middle",dominantBaseline:"central",fontSize:10,fontFamily:"monospace",fill:u?"#ffffff":"#525252",style:{userSelect:"none",pointerEvents:"none"},children:h}),D.jsx("foreignObject",{x:r-8,y:i-8,width:16,height:16,style:{overflow:"visible"},children:D.jsx("div",{className:"w-4 h-4 rounded-full bg-neutral-400"})})]})}const Rk={...IE};let eE=0;function Ak(e,t="mui"){const[r,i]=R.useState(e),a=e||r;return R.useEffect(()=>{r==null&&(eE+=1,i(`${t}-${eE}`))},[r,t]),a}const tE=Rk.useId;function Qo(e,t){if(tE!==void 0){const r=tE();return e??(t?`${t}-${r}`:r)}return Ak(e,t)}function Nk(e,t){return function(i,...a){const l=new URL(e);return l.searchParams.set("code",i.toString()),a.forEach(u=>l.searchParams.append("args[]",u)),`${t} error #${i}; visit ${l} for the full message.`}}const ta=Nk("https://base-ui.com/production-error","Base UI"),oC=R.createContext(void 0);function Xl(e=!0){const t=R.useContext(oC);if(t===void 0&&!e)throw new Error(ta(25));return t}const iC=R.createContext(void 0);function sC(e){const t=R.useContext(iC);if(t===void 0&&!e)throw new Error(ta(33));return t}const sg=R.createContext(void 0);function Vi(e){const t=R.useContext(sg);if(t===void 0&&!e)throw new Error(ta(36));return t}const nE={};function bn(e,t){const r=R.useRef(nE);return r.current===nE&&(r.current=e(t)),r}function Nl(e,t,r,i){const a=bn(aC).current;return Ok(a,e,t,r,i)&&lC(a,[e,t,r,i]),a.callback}function Mk(e){const t=bn(aC).current;return Dk(t,e)&&lC(t,e),t.callback}function aC(){return{callback:null,cleanup:null,refs:[]}}function Ok(e,t,r,i,a){return e.refs[0]!==t||e.refs[1]!==r||e.refs[2]!==i||e.refs[3]!==a}function Dk(e,t){return e.refs.length!==t.length||e.refs.some((r,i)=>r!==t[i])}function lC(e,t){if(e.refs=t,t.every(r=>r==null)){e.callback=null;return}e.callback=r=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),r!=null){const i=Array(t.length).fill(null);for(let a=0;a<t.length;a+=1){const l=t[a];if(l!=null)switch(typeof l){case"function":{const u=l(r);typeof u=="function"&&(i[a]=u);break}case"object":{l.current=r;break}}}e.cleanup=()=>{for(let a=0;a<t.length;a+=1){const l=t[a];if(l!=null)switch(typeof l){case"function":{const u=i[a];typeof u=="function"?u():l(null);break}case"object":{l.current=null;break}}}}}}}const zk=parseInt(R.version,10);function ag(e){return zk>=e}function rE(e){if(!R.isValidElement(e))return null;const t=e,r=t.props;return(ag(19)?r?.ref:t.ref)??null}function Fp(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function Bk(e,t){const r={};for(const i in e){const a=e[i];if(t?.hasOwnProperty(i)){const l=t[i](a);l!=null&&Object.assign(r,l);continue}a===!0?r[`data-${i.toLowerCase()}`]="":a&&(r[`data-${i.toLowerCase()}`]=a.toString())}return r}function Uk(e,t){return typeof e=="function"?e(t):e}function Lk(e,t){return typeof e=="function"?e(t):e}const dl={};function Ml(e,t,r,i,a){let l={...Pp(e,dl)};return t&&(l=Ku(l,t)),r&&(l=Ku(l,r)),i&&(l=Ku(l,i)),l}function kk(e){if(e.length===0)return dl;if(e.length===1)return Pp(e[0],dl);let t={...Pp(e[0],dl)};for(let r=1;r<e.length;r+=1)t=Ku(t,e[r]);return t}function Ku(e,t){return cC(t)?t(e):Ik(e,t)}function Ik(e,t){if(!t)return e;for(const r in t){const i=t[r];switch(r){case"style":{e[r]=Fp(e.style,i);break}case"className":{e[r]=uC(e.className,i);break}default:Hk(r,i)?e[r]=Fk(e[r],i):e[r]=i}}return e}function Hk(e,t){const r=e.charCodeAt(0),i=e.charCodeAt(1),a=e.charCodeAt(2);return r===111&&i===110&&a>=65&&a<=90&&(typeof t=="function"||typeof t>"u")}function cC(e){return typeof e=="function"}function Pp(e,t){return cC(e)?e(t):e??dl}function Fk(e,t){return t?e?r=>{if(Pk(r)){const a=r;jp(a);const l=t(a);return a.baseUIHandlerPrevented||e?.(a),l}const i=t(r);return e?.(r),i}:t:e}function jp(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function uC(e,t){return t?e?t+" "+e:t:e}function Pk(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function fC(){}const jk=Object.freeze([]),yn=Object.freeze({}),Vk=500,Gk={style:{transition:"none"}},qk="data-base-ui-click-trigger",Yk={fallbackAxisSide:"none"},Xk={fallbackAxisSide:"end"},$k={clipPath:"inset(50%)",position:"fixed",top:0,left:0};function na(e,t,r={}){const i=t.render,a=Kk(t,r);if(r.enabled===!1)return null;const l=r.state??yn;return Qk(e,i,a,l)}function Kk(e,t={}){const{className:r,style:i,render:a}=e,{state:l=yn,ref:u,props:f,stateAttributesMapping:h,enabled:d=!0}=t,p=d?Uk(r,l):void 0,g=d?Lk(i,l):void 0,v=d?Bk(l,h):yn,x=d?Fp(v,Array.isArray(f)?kk(f):f)??yn:yn;return typeof document<"u"&&(d?Array.isArray(u)?x.ref=Mk([x.ref,rE(a),...u]):x.ref=Nl(x.ref,rE(a),u):Nl(null,null)),d?(p!==void 0&&(x.className=uC(x.className,p)),g!==void 0&&(x.style=Fp(x.style,g)),x):yn}const Zk=Symbol.for("react.lazy");function Qk(e,t,r,i){if(t){if(typeof t=="function")return t(r,i);const a=Ml(r,t.props);a.ref=r.ref;let l=t;return l?.$$typeof===Zk&&(l=R.Children.toArray(t)[0]),R.cloneElement(l,a)}return Wk(e,r)}function Wk(e,t){return R.createElement(e,t)}let Ol=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const Jk={[Ol.startingStyle]:""},eI={[Ol.endingStyle]:""},dC={transitionStatus(e){return e==="starting"?Jk:e==="ending"?eI:null}};let lg=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=Ol.startingStyle]="startingStyle",e[e.endingStyle=Ol.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),oE=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const tI={[oE.popupOpen]:"",[oE.pressed]:""},nI={[lg.open]:""},rI={[lg.closed]:""},oI={[lg.anchorHidden]:""},iI={open(e){return e?tI:null}},cg={open(e){return e?nI:rI},anchorHidden(e){return e?oI:null}},vf="trigger-press",Hi="trigger-hover",iE="trigger-focus",ug="outside-press",hC="item-press",id="focus-out",mC="escape-key",Zu="list-navigation",sI="cancel-open",cl="sibling-open",aI="imperative-action",lI={...cg,...dC},cI=R.forwardRef(function(t,r){const{className:i,render:a,...l}=t,{store:u}=Vi(),f=u.useState("open"),h=u.useState("mounted"),d=u.useState("transitionStatus"),p=u.useState("lastOpenChangeReason"),g=Xl(),v={open:f,transitionStatus:d};return na("div",t,{ref:g?.backdropRef?[r,g.backdropRef]:r,state:v,stateAttributesMapping:lI,props:[{role:"presentation",hidden:!h,style:{pointerEvents:p===Hi?"none":void 0,userSelect:"none",WebkitUserSelect:"none"}},l]})}),Jm=IE[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],uI=Jm&&Jm!==R.useLayoutEffect?Jm:e=>e();function Ve(e){const t=bn(fI).current;return t.next=e,uI(t.effect),t.trampoline}function fI(){const e={next:void 0,callback:dI,trampoline:(...t)=>e.callback?.(...t),effect:()=>{e.callback=e.next}};return e}function dI(){}function sd(){return typeof window<"u"}function Wo(e){return fg(e)?(e.nodeName||"").toLowerCase():"#document"}function Xt(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ar(e){var t;return(t=(fg(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function fg(e){return sd()?e instanceof Node||e instanceof Xt(e).Node:!1}function xt(e){return sd()?e instanceof Element||e instanceof Xt(e).Element:!1}function Mt(e){return sd()?e instanceof HTMLElement||e instanceof Xt(e).HTMLElement:!1}function Dl(e){return!sd()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Xt(e).ShadowRoot}function Jo(e){const{overflow:t,overflowX:r,overflowY:i,display:a}=Bn(e);return/auto|scroll|overlay|hidden|clip/.test(t+i+r)&&a!=="inline"&&a!=="contents"}function hI(e){return/^(table|td|th)$/.test(Wo(e))}function ad(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const mI=/transform|translate|scale|rotate|perspective|filter/,pI=/paint|layout|strict|content/,Ri=e=>!!e&&e!=="none";let ep;function dg(e){const t=xt(e)?Bn(e):e;return Ri(t.transform)||Ri(t.translate)||Ri(t.scale)||Ri(t.rotate)||Ri(t.perspective)||!ld()&&(Ri(t.backdropFilter)||Ri(t.filter))||mI.test(t.willChange||"")||pI.test(t.contain||"")}function gI(e){let t=wr(e);for(;Mt(t)&&!xr(t);){if(dg(t))return t;if(ad(t))return null;t=wr(t)}return null}function ld(){return ep==null&&(ep=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),ep}function xr(e){return/^(html|body|#document)$/.test(Wo(e))}function Bn(e){return Xt(e).getComputedStyle(e)}function cd(e){return xt(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function wr(e){if(Wo(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Dl(e)&&e.host||Ar(e);return Dl(t)?t.host:t}function pC(e){const t=wr(e);return xr(t)?e.ownerDocument?e.ownerDocument.body:e.body:Mt(t)&&Jo(t)?t:pC(t)}function zl(e,t,r){var i;t===void 0&&(t=[]),r===void 0&&(r=!0);const a=pC(e),l=a===((i=e.ownerDocument)==null?void 0:i.body),u=Xt(a);if(l){const f=Vp(u);return t.concat(u,u.visualViewport||[],Jo(a)?a:[],f&&r?zl(f):[])}else return t.concat(a,zl(a,[],r))}function Vp(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}const yI=()=>{},Be=typeof document<"u"?R.useLayoutEffect:yI,vI=R.createContext(void 0);function xI(e=!1){const t=R.useContext(vI);if(t===void 0&&!e)throw new Error(ta(16));return t}function bI(e){const{focusableWhenDisabled:t,disabled:r,composite:i=!1,tabIndex:a=0,isNativeButton:l}=e,u=i&&t!==!1,f=i&&t===!1;return{props:R.useMemo(()=>{const d={onKeyDown(p){r&&t&&p.key!=="Tab"&&p.preventDefault()}};return i||(d.tabIndex=a,!l&&r&&(d.tabIndex=t?a:-1)),(l&&(t||u)||!l&&r)&&(d["aria-disabled"]=r),l&&(!t||f)&&(d.disabled=r),d},[i,r,t,u,f,l,a])}}function _I(e={}){const{disabled:t=!1,focusableWhenDisabled:r,tabIndex:i=0,native:a=!0,composite:l}=e,u=R.useRef(null),f=xI(!0),h=l??f!==void 0,{props:d}=bI({focusableWhenDisabled:r,disabled:t,composite:h,tabIndex:i,isNativeButton:a}),p=R.useCallback(()=>{const x=u.current;tp(x)&&h&&t&&d.disabled===void 0&&x.disabled&&(x.disabled=!1)},[t,d.disabled,h]);Be(p,[p]);const g=R.useCallback((x={})=>{const{onClick:b,onMouseDown:_,onKeyUp:C,onKeyDown:E,onPointerDown:N,...w}=x;return Ml({type:a?"button":void 0,onClick(M){if(t){M.preventDefault();return}b?.(M)},onMouseDown(M){t||_?.(M)},onKeyDown(M){if(t||(jp(M),E?.(M),M.baseUIHandlerPrevented))return;const T=M.target===M.currentTarget,O=M.currentTarget,I=tp(O),j=!a&&EI(O),Z=T&&(a?I:!j),P=M.key==="Enter",q=M.key===" ",G=O.getAttribute("role"),k=G?.startsWith("menuitem")||G==="option"||G==="gridcell";if(T&&h&&q){if(M.defaultPrevented&&k)return;M.preventDefault(),j||a&&I?(O.click(),M.preventBaseUIHandler()):Z&&(b?.(M),M.preventBaseUIHandler());return}Z&&(!a&&(q||P)&&M.preventDefault(),!a&&P&&b?.(M))},onKeyUp(M){if(!t){if(jp(M),C?.(M),M.target===M.currentTarget&&a&&h&&tp(M.currentTarget)&&M.key===" "){M.preventDefault();return}M.baseUIHandlerPrevented||M.target===M.currentTarget&&!a&&!h&&M.key===" "&&b?.(M)}},onPointerDown(M){if(t){M.preventDefault();return}N?.(M)}},a?void 0:{role:"button"},d,w)},[t,d,h,a]),v=Ve(x=>{u.current=x,p()});return{getButtonProps:g,buttonRef:v}}function tp(e){return Mt(e)&&e.tagName==="BUTTON"}function EI(e){return!!(e?.tagName==="A"&&e?.href)}const ra=typeof navigator<"u",np=TI(),gC=AI(),yC=RI(),vC=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),xC=np.platform==="MacIntel"&&np.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(np.platform),SI=ra&&/apple/i.test(navigator.vendor),Gp=ra&&/android/i.test(gC)||/android/i.test(yC),wI=ra&&gC.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,CI=yC.includes("jsdom/");function TI(){if(!ra)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function RI(){if(!ra)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:r})=>`${t}/${r}`).join(" "):navigator.userAgent}function AI(){if(!ra)return"";const e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??""}function NI(e){const{closeOnClick:t,highlighted:r,id:i,nodeId:a,store:l,typingRef:u,itemRef:f,itemMetadata:h}=e,{events:d}=l.useState("floatingTreeRoot"),p=Xl(!0),g=p!==void 0;return R.useMemo(()=>({id:i,role:"menuitem",tabIndex:r?0:-1,onKeyDown(v){v.key===" "&&u?.current&&v.preventDefault()},onMouseMove(v){a&&d.emit("itemhover",{nodeId:a,target:v.currentTarget})},onClick(v){t&&d.emit("close",{domEvent:v,reason:hC})},onMouseUp(v){if(p){const x=p.initialCursorPointRef.current;if(p.initialCursorPointRef.current=null,g&&x&&Math.abs(v.clientX-x.x)<=1&&Math.abs(v.clientY-x.y)<=1||g&&!wI&&v.button===2)return}f.current&&l.context.allowMouseUpTriggerRef.current&&(!g||v.button===2)&&(!h||h.type==="regular-item")&&f.current.click()}}),[t,r,i,d,a,l,u,f,p,g,h])}const MI={type:"regular-item"};function OI(e){const{closeOnClick:t,disabled:r=!1,highlighted:i,id:a,store:l,typingRef:u=l.context.typingRef,nativeButton:f,itemMetadata:h,nodeId:d}=e,p=R.useRef(null),{getButtonProps:g,buttonRef:v}=_I({disabled:r,focusableWhenDisabled:!0,native:f,composite:!0}),x=NI({closeOnClick:t,highlighted:i,id:a,nodeId:d,store:l,typingRef:u,itemRef:p,itemMetadata:h}),b=R.useCallback(C=>Ml(x,{onMouseEnter(){h.type==="submenu-trigger"&&h.setActive()}},C,g),[x,g,h]),_=Nl(p,v);return R.useMemo(()=>({getItemProps:b,itemRef:_}),[b,_])}const bC=R.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function DI(){return R.useContext(bC)}let zI=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function BI(e={}){const{label:t,metadata:r,textRef:i,indexGuessBehavior:a,index:l}=e,{register:u,unregister:f,subscribeMapChange:h,elementsRef:d,labelsRef:p,nextIndexRef:g}=DI(),v=R.useRef(-1),[x,b]=R.useState(l??(a===zI.GuessFromOrder?()=>{if(v.current===-1){const E=g.current;g.current+=1,v.current=E}return v.current}:-1)),_=R.useRef(null),C=R.useCallback(E=>{if(_.current=E,x!==-1&&E!==null&&(d.current[x]=E,p)){const N=t!==void 0;p.current[x]=N?t:i?.current?.textContent??E.textContent}},[x,d,p,t,i]);return Be(()=>{if(l!=null)return;const E=_.current;if(E)return u(E,r),()=>{f(E)}},[l,u,f,r]),Be(()=>{if(l==null)return h(E=>{const N=_.current?E.get(_.current)?.index:null;N!=null&&b(N)})},[l,h,b]),R.useMemo(()=>({ref:C,index:x}),[x,C])}function UI(e){return Qo(e,"base-ui")}function It(e,t,r,i){let a=!1,l=!1;const u=yn;return{reason:e,event:t??new Event("base-ui"),cancel(){a=!0},allowPropagation(){l=!0},get isCanceled(){return a},get isPropagationAllowed(){return l},trigger:r,...u}}const LI=[];function hg(e){R.useEffect(e,LI)}const Mu=null;class kI{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=t=>{this.isScheduled=!1;const r=this.callbacks,i=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,i>0)for(let a=0;a<r.length;a+=1)r[a]?.(t)};request(t){const r=this.nextId;return this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),r}cancel(t){const r=t-this.startId;r<0||r>=this.callbacks.length||(this.callbacks[r]=null,this.callbacksCount-=1)}}const Ou=new kI;class pr{static create(){return new pr}static request(t){return Ou.request(t)}static cancel(t){return Ou.cancel(t)}currentId=Mu;request(t){this.cancel(),this.currentId=Ou.request(()=>{this.currentId=Mu,t()})}cancel=()=>{this.currentId!==Mu&&(Ou.cancel(this.currentId),this.currentId=Mu)};disposeEffect=()=>this.cancel}function _C(){const e=bn(pr.create).current;return hg(e.disposeEffect),e}function II(e,t=!1,r=!1){const[i,a]=R.useState(e&&t?"idle":void 0),[l,u]=R.useState(e);return e&&!l&&(u(!0),a("starting")),!e&&l&&i!=="ending"&&!r&&a("ending"),!e&&!l&&i==="ending"&&a(void 0),Be(()=>{if(!e&&l&&i!=="ending"&&r){const f=pr.request(()=>{a("ending")});return()=>{pr.cancel(f)}}},[e,l,i,r]),Be(()=>{if(!e||t)return;const f=pr.request(()=>{a(void 0)});return()=>{pr.cancel(f)}},[t,e]),Be(()=>{if(!e||!t)return;e&&l&&i!=="idle"&&a("starting");const f=pr.request(()=>{a("idle")});return()=>{pr.cancel(f)}},[t,e,l,a,i]),R.useMemo(()=>({mounted:l,setMounted:u,transitionStatus:i}),[l,i])}function Wr(e){return e==null?e:"current"in e?e.current:e}function EC(e,t=!1,r=!0){const i=_C();return Ve((a,l=null)=>{i.cancel();function u(){Gl.flushSync(a)}const f=Wr(e);if(f==null)return;const h=f;if(typeof h.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)a();else{let g=function(){const x=Ol.startingStyle;if(!h.hasAttribute(x)){i.request(v);return}const b=new MutationObserver(()=>{h.hasAttribute(x)||(b.disconnect(),v())});b.observe(h,{attributes:!0,attributeFilter:[x]}),l?.addEventListener("abort",()=>b.disconnect(),{once:!0})},v=function(){Promise.all(h.getAnimations().map(x=>x.finished)).then(()=>{l?.aborted||u()}).catch(()=>{const x=h.getAnimations();if(r){if(l?.aborted)return;u()}else x.length>0&&x.some(b=>b.pending||b.playState!=="finished")&&v()})};var d=g,p=v;if(t){g();return}i.request(v)}})}function SC(e){const{enabled:t=!0,open:r,ref:i,onComplete:a}=e,l=Ve(a),u=EC(i,r,!1);R.useEffect(()=>{if(!t)return;const f=new AbortController;return u(l,f.signal),()=>{f.abort()}},[t,r,l,u])}const HI=R.forwardRef(function(t,r){const{render:i,className:a,id:l,label:u,nativeButton:f=!1,disabled:h=!1,closeOnClick:d=!0,...p}=t,g=BI({label:u}),v=sC(!0),x=UI(l),{store:b}=Vi(),_=b.useState("isActive",g.index),C=b.useState("itemProps"),{getItemProps:E,itemRef:N}=OI({closeOnClick:d,disabled:h,highlighted:_,id:x,store:b,nativeButton:f,nodeId:v?.nodeId,itemMetadata:MI});return na("div",t,{state:{disabled:h,highlighted:_},props:[C,p,E],ref:[N,r,g.ref]})}),rl=0;class ro{static create(){return new ro}currentId=rl;start(t,r){this.clear(),this.currentId=setTimeout(()=>{this.currentId=rl,r()},t)}isStarted(){return this.currentId!==rl}clear=()=>{this.currentId!==rl&&(clearTimeout(this.currentId),this.currentId=rl)};disposeEffect=()=>this.clear}function sr(){const e=bn(ro.create).current;return hg(e.disposeEffect),e}const qp="data-base-ui-focusable",wC="active",CC="selected",TC="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",qo="ArrowLeft",Yo="ArrowRight",mg="ArrowUp",$l="ArrowDown";function gr(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function We(e,t){if(!e||!t)return!1;const r=t.getRootNode?.();if(e.contains(t))return!0;if(r&&Dl(r)){let i=t;for(;i;){if(e===i)return!0;i=i.parentNode||i.host}}return!1}function FI(e,t){if(!xt(e))return!1;const r=e;if(t.hasElement(r))return!r.hasAttribute("data-trigger-disabled");for(const[,i]of t.entries())if(We(i,r))return!i.hasAttribute("data-trigger-disabled");return!1}function Mn(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Wn(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const r=e;return r.target!=null&&t.contains(r.target)}function PI(e){return e.matches("html,body")}function RC(e){return Mt(e)&&e.matches(TC)}function Yp(e){return e?e.getAttribute("role")==="combobox"&&RC(e):!1}function xf(e){return e?e.hasAttribute(qp)?e:e.querySelector(`[${qp}]`)||e:null}function Xo(e,t,r=!0){return e.filter(a=>a.parentId===t&&(!r||a.context?.open)).flatMap(a=>[a,...Xo(e,a.id,r)])}function sE(e,t){let r=[],i=e.find(a=>a.id===t)?.parentId;for(;i;){const a=e.find(l=>l.id===i);i=a?.parentId,a&&(r=r.concat(a))}return r}function gn(e){e.preventDefault(),e.stopPropagation()}function jI(e){return"nativeEvent"in e}function AC(e){return e.pointerType===""&&e.isTrusted?!0:Gp&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function NC(e){return CI?!1:!Gp&&e.width===0&&e.height===0||Gp&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function VI(e,t){const r=["mouse","pen"];return r.push("",void 0),r.includes(e)}function GI(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const qI=["top","right","bottom","left"],Qs=Math.min,On=Math.max,bf=Math.round,Oi=Math.floor,br=e=>({x:e,y:e}),YI={left:"right",right:"left",bottom:"top",top:"bottom"};function Xp(e,t,r){return On(e,Qs(t,r))}function oo(e,t){return typeof e=="function"?e(t):e}function xn(e){return e.split("-")[0]}function ei(e){return e.split("-")[1]}function pg(e){return e==="x"?"y":"x"}function gg(e){return e==="y"?"height":"width"}function qn(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function yg(e){return pg(qn(e))}function XI(e,t,r){r===void 0&&(r=!1);const i=ei(e),a=yg(e),l=gg(a);let u=a==="x"?i===(r?"end":"start")?"right":"left":i==="start"?"bottom":"top";return t.reference[l]>t.floating[l]&&(u=_f(u)),[u,_f(u)]}function $I(e){const t=_f(e);return[$p(e),t,$p(t)]}function $p(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const aE=["left","right"],lE=["right","left"],KI=["top","bottom"],ZI=["bottom","top"];function QI(e,t,r){switch(e){case"top":case"bottom":return r?t?lE:aE:t?aE:lE;case"left":case"right":return t?KI:ZI;default:return[]}}function WI(e,t,r,i){const a=ei(e);let l=QI(xn(e),r==="start",i);return a&&(l=l.map(u=>u+"-"+a),t&&(l=l.concat(l.map($p)))),l}function _f(e){const t=xn(e);return YI[t]+e.slice(t.length)}function JI(e){return{top:0,right:0,bottom:0,left:0,...e}}function MC(e){return typeof e!="number"?JI(e):{top:e,right:e,bottom:e,left:e}}function Ef(e){const{x:t,y:r,width:i,height:a}=e;return{width:i,height:a,top:r,left:t,right:t+i,bottom:r+a,x:t,y:r}}function Du(e,t,r){return Math.floor(e/t)!==r}function Sf(e,t){return t<0||t>=e.current.length}function rp(e,t){return rn(e,{disabledIndices:t})}function cE(e,t){return rn(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function rn(e,{startingIndex:t=-1,decrement:r=!1,disabledIndices:i,amount:a=1}={}){let l=t;do l+=r?-a:a;while(l>=0&&l<=e.current.length-1&&Fs(e,l,i));return l}function eH(e,{event:t,orientation:r,loopFocus:i,rtl:a,cols:l,disabledIndices:u,minIndex:f,maxIndex:h,prevIndex:d,stopEvent:p=!1}){let g=d,v;if(t.key===mg?v="up":t.key===$l&&(v="down"),v){const x=[],b=[];let _=!1,C=0;{let I=null,j=-1;e.current.forEach((Z,P)=>{if(Z==null)return;C+=1;const q=Z.closest('[role="row"]');q&&(_=!0),(q!==I||j===-1)&&(I=q,j+=1,x[j]=[]),x[j].push(P),b[P]=j})}let E=!1,N=0;if(_)for(const I of x){const j=I.length;j>N&&(N=j),j!==l&&(E=!0)}const w=E&&C<e.current.length,A=N||l,M=I=>{if(!E||d===-1)return;const j=b[d];if(j==null)return;const Z=x[j].indexOf(d),P=I==="up"?-1:1;for(let q=j+P,G=0;G<x.length;G+=1,q+=P){if(q<0||q>=x.length){if(!i||w)return;q=q<0?x.length-1:0}const k=x[q];for(let F=Math.min(Z,k.length-1);F>=0;F-=1){const z=k[F];if(!Fs(e,z,u))return z}}},T=I=>{if(!w||d===-1)return;const j=d%A,Z=I==="up"?-A:A,P=h-h%A,q=Oi(h/A)+1;for(let G=d-j+Z,k=0;k<q;k+=1,G+=Z){if(G<0||G>h){if(!i)return;G=G<0?P:0}const F=Math.min(G+A-1,h);for(let z=Math.min(G+j,F);z>=G;z-=1)if(!Fs(e,z,u))return z}};p&&gn(t);const O=M(v)??T(v);if(O!==void 0)g=O;else if(d===-1)g=v==="up"?h:f;else if(g=rn(e,{startingIndex:d,amount:A,decrement:v==="up",disabledIndices:u}),i){if(v==="up"&&(d-A<f||g<0)){const I=d%A,j=h%A,Z=h-(j-I);j===I?g=h:g=j>I?Z:Z-A}v==="down"&&d+A>h&&(g=rn(e,{startingIndex:d%A-A,amount:A,disabledIndices:u}))}Sf(e,g)&&(g=d)}if(r==="both"){const x=Oi(d/l);t.key===(a?qo:Yo)&&(p&&gn(t),d%l!==l-1?(g=rn(e,{startingIndex:d,disabledIndices:u}),i&&Du(g,l,x)&&(g=rn(e,{startingIndex:d-d%l-1,disabledIndices:u}))):i&&(g=rn(e,{startingIndex:d-d%l-1,disabledIndices:u})),Du(g,l,x)&&(g=d)),t.key===(a?Yo:qo)&&(p&&gn(t),d%l!==0?(g=rn(e,{startingIndex:d,decrement:!0,disabledIndices:u}),i&&Du(g,l,x)&&(g=rn(e,{startingIndex:d+(l-d%l),decrement:!0,disabledIndices:u}))):i&&(g=rn(e,{startingIndex:d+(l-d%l),decrement:!0,disabledIndices:u})),Du(g,l,x)&&(g=d));const b=Oi(h/l)===x;Sf(e,g)&&(i&&b?g=t.key===(a?Yo:qo)?h:rn(e,{startingIndex:d-d%l-1,disabledIndices:u}):g=d)}return g}function tH(e,t,r){const i=[];let a=0;return e.forEach(({width:l,height:u},f)=>{let h=!1;for(;!h;){const d=[];for(let p=0;p<l;p+=1)for(let g=0;g<u;g+=1)d.push(a+p+g*t);a%t+l<=t&&d.every(p=>i[p]==null)?(d.forEach(p=>{i[p]=f}),h=!0):a+=1}}),[...i]}function nH(e,t,r,i,a){if(e===-1)return-1;const l=r.indexOf(e),u=t[e];switch(a){case"tl":return l;case"tr":return u?l+u.width-1:l;case"bl":return u?l+(u.height-1)*i:l;case"br":return r.lastIndexOf(e);default:return-1}}function rH(e,t){return t.flatMap((r,i)=>e.includes(r)?[i]:[])}function Fs(e,t,r){if(typeof r=="function"?r(t):r?.includes(t)??!1)return!0;const a=e.current[t];return a?vg(a)?!r&&(a.hasAttribute("disabled")||a.getAttribute("aria-disabled")==="true"):!0:!1}function vg(e){return Bn(e).display!=="none"}var oH=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],wf=oH.join(","),OC=typeof Element>"u",Ws=OC?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Cf=!OC&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e?.ownerDocument},Tf=function(t,r){var i;r===void 0&&(r=!0);var a=t==null||(i=t.getAttribute)===null||i===void 0?void 0:i.call(t,"inert"),l=a===""||a==="true",u=l||r&&t&&(typeof t.closest=="function"?t.closest("[inert]"):Tf(t.parentNode));return u},iH=function(t){var r,i=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"contenteditable");return i===""||i==="true"},DC=function(t,r,i){if(Tf(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(wf));return r&&Ws.call(t,wf)&&a.unshift(t),a=a.filter(i),a},Rf=function(t,r,i){for(var a=[],l=Array.from(t);l.length;){var u=l.shift();if(!Tf(u,!1))if(u.tagName==="SLOT"){var f=u.assignedElements(),h=f.length?f:u.children,d=Rf(h,!0,i);i.flatten?a.push.apply(a,d):a.push({scopeParent:u,candidates:d})}else{var p=Ws.call(u,wf);p&&i.filter(u)&&(r||!t.includes(u))&&a.push(u);var g=u.shadowRoot||typeof i.getShadowRoot=="function"&&i.getShadowRoot(u),v=!Tf(g,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(u));if(g&&v){var x=Rf(g===!0?u.children:g.children,!0,i);i.flatten?a.push.apply(a,x):a.push({scopeParent:u,candidates:x})}else l.unshift.apply(l,u.children)}}return a},zC=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},BC=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||iH(t))&&!zC(t)?0:t.tabIndex},sH=function(t,r){var i=BC(t);return i<0&&r&&!zC(t)?0:i},aH=function(t,r){return t.tabIndex===r.tabIndex?t.documentOrder-r.documentOrder:t.tabIndex-r.tabIndex},UC=function(t){return t.tagName==="INPUT"},lH=function(t){return UC(t)&&t.type==="hidden"},cH=function(t){var r=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(i){return i.tagName==="SUMMARY"});return r},uH=function(t,r){for(var i=0;i<t.length;i++)if(t[i].checked&&t[i].form===r)return t[i]},fH=function(t){if(!t.name)return!0;var r=t.form||Cf(t),i=function(f){return r.querySelectorAll('input[type="radio"][name="'+f+'"]')},a;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")a=i(window.CSS.escape(t.name));else try{a=i(t.name)}catch(u){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",u.message),!1}var l=uH(a,t.form);return!l||l===t},dH=function(t){return UC(t)&&t.type==="radio"},hH=function(t){return dH(t)&&!fH(t)},mH=function(t){var r,i=t&&Cf(t),a=(r=i)===null||r===void 0?void 0:r.host,l=!1;if(i&&i!==t){var u,f,h;for(l=!!((u=a)!==null&&u!==void 0&&(f=u.ownerDocument)!==null&&f!==void 0&&f.contains(a)||t!=null&&(h=t.ownerDocument)!==null&&h!==void 0&&h.contains(t));!l&&a;){var d,p,g;i=Cf(a),a=(d=i)===null||d===void 0?void 0:d.host,l=!!((p=a)!==null&&p!==void 0&&(g=p.ownerDocument)!==null&&g!==void 0&&g.contains(a))}}return l},uE=function(t){var r=t.getBoundingClientRect(),i=r.width,a=r.height;return i===0&&a===0},pH=function(t,r){var i=r.displayCheck,a=r.getShadowRoot;if(i==="full-native"&&"checkVisibility"in t){var l=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!l}if(getComputedStyle(t).visibility==="hidden")return!0;var u=Ws.call(t,"details>summary:first-of-type"),f=u?t.parentElement:t;if(Ws.call(f,"details:not([open]) *"))return!0;if(!i||i==="full"||i==="full-native"||i==="legacy-full"){if(typeof a=="function"){for(var h=t;t;){var d=t.parentElement,p=Cf(t);if(d&&!d.shadowRoot&&a(d)===!0)return uE(t);t.assignedSlot?t=t.assignedSlot:!d&&p!==t.ownerDocument?t=p.host:t=d}t=h}if(mH(t))return!t.getClientRects().length;if(i!=="legacy-full")return!0}else if(i==="non-zero-area")return uE(t);return!1},gH=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var r=t.parentElement;r;){if(r.tagName==="FIELDSET"&&r.disabled){for(var i=0;i<r.children.length;i++){var a=r.children.item(i);if(a.tagName==="LEGEND")return Ws.call(r,"fieldset[disabled] *")?!0:!a.contains(t)}return!0}r=r.parentElement}return!1},Kp=function(t,r){return!(r.disabled||lH(r)||pH(r,t)||cH(r)||gH(r))},Zp=function(t,r){return!(hH(r)||BC(r)<0||!Kp(t,r))},yH=function(t){var r=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(r)||r>=0)},LC=function(t){var r=[],i=[];return t.forEach(function(a,l){var u=!!a.scopeParent,f=u?a.scopeParent:a,h=sH(f,u),d=u?LC(a.candidates):f;h===0?u?r.push.apply(r,d):r.push(f):i.push({documentOrder:l,tabIndex:h,item:a,isScope:u,content:d})}),i.sort(aH).reduce(function(a,l){return l.isScope?a.push.apply(a,l.content):a.push(l.content),a},[]).concat(r)},ud=function(t,r){r=r||{};var i;return r.getShadowRoot?i=Rf([t],r.includeContainer,{filter:Zp.bind(null,r),flatten:!1,getShadowRoot:r.getShadowRoot,shadowRootFilter:yH}):i=DC(t,r.includeContainer,Zp.bind(null,r)),LC(i)},vH=function(t,r){r=r||{};var i;return r.getShadowRoot?i=Rf([t],r.includeContainer,{filter:Kp.bind(null,r),flatten:!0,getShadowRoot:r.getShadowRoot}):i=DC(t,r.includeContainer,Kp.bind(null,r)),i},kC=function(t,r){if(r=r||{},!t)throw new Error("No node provided");return Ws.call(t,wf)===!1?!1:Zp(r,t)};function yt(e){return e?.ownerDocument||document}const Kl=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function IC(e,t){const r=ud(e,Kl()),i=r.length;if(i===0)return;const a=gr(yt(e)),l=r.indexOf(a),u=l===-1?t===1?0:i-1:l+t;return r[u]}function HC(e){return IC(yt(e).body,1)||e}function FC(e){return IC(yt(e).body,-1)||e}function hl(e,t){const r=t||e.currentTarget,i=e.relatedTarget;return!i||!We(r,i)}function xH(e){ud(e,Kl()).forEach(r=>{r.dataset.tabindex=r.getAttribute("tabindex")||"",r.setAttribute("tabindex","-1")})}function fE(e){e.querySelectorAll("[data-tabindex]").forEach(r=>{const i=r.dataset.tabindex;delete r.dataset.tabindex,i?r.setAttribute("tabindex",i):r.removeAttribute("tabindex")})}function bH(e,t){return t!=null&&!VI(t)?0:typeof e=="function"?e():e}function _H(e,t,r){const i=bH(e,r);return typeof i=="number"?i:i?.[t]}function EH(e,t){return t||e==="click"||e==="mousedown"}function nr(e){const t=bn(SH,e).current;return t.next=e,Be(t.effect),t}function SH(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const wH={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},CH={...wH,position:"fixed",top:0,left:0},Af=R.forwardRef(function(t,r){const[i,a]=R.useState();Be(()=>{SI&&a("button")},[]);const l={tabIndex:0,role:i};return D.jsx("span",{...t,ref:r,style:CH,"aria-hidden":i?void 0:!0,...l,"data-base-ui-focus-guard":""})});function Nf(e){return`data-base-ui-${e}`}let dE=0;function ml(e,t={}){const{preventScroll:r=!1,cancelPrevious:i=!0,sync:a=!1}=t;i&&cancelAnimationFrame(dE);const l=()=>e?.focus({preventScroll:r});a?l():dE=requestAnimationFrame(l)}const op={inert:new WeakMap,"aria-hidden":new WeakMap},hE="data-base-ui-inert",Qp={inert:new WeakSet,"aria-hidden":new WeakSet};let ol=new WeakMap,ip=0;function TH(e){return Qp[e]}function PC(e){return e?Dl(e)?e.host:PC(e.parentNode):null}const sp=(e,t)=>t.map(r=>{if(e.contains(r))return r;const i=PC(r);return e.contains(i)?i:null}).filter(r=>r!=null),mE=e=>{const t=new Set;return e.forEach(r=>{let i=r;for(;i&&!t.has(i);)t.add(i),i=i.parentNode}),t},pE=(e,t,r)=>{const i=[],a=l=>{!l||r.has(l)||Array.from(l.children).forEach(u=>{Wo(u)!=="script"&&(t.has(u)?a(u):i.push(u))})};return a(e),i};function RH(e,t,r,i,{mark:a=!0,markerIgnoreElements:l=[]}){const u=i?"inert":r?"aria-hidden":null;let f=null,h=null;const d=sp(t,e),p=a?sp(t,l):[],g=new Set(p),v=a?pE(t,mE(d),new Set(d)).filter(_=>!g.has(_)):[],x=[],b=[];if(u){const _=op[u],C=TH(u);h=C,f=_;const E=sp(t,Array.from(t.querySelectorAll("[aria-live]"))),N=d.concat(E);pE(t,mE(N),new Set(N)).forEach(A=>{const M=A.getAttribute(u),T=M!==null&&M!=="false",O=(_.get(A)||0)+1;_.set(A,O),x.push(A),O===1&&T&&C.add(A),T||A.setAttribute(u,u==="inert"?"":"true")})}return a&&v.forEach(_=>{const C=(ol.get(_)||0)+1;ol.set(_,C),b.push(_),C===1&&_.setAttribute(hE,"")}),ip+=1,()=>{f&&x.forEach(_=>{const E=(f.get(_)||0)-1;f.set(_,E),E||(!h?.has(_)&&u&&_.removeAttribute(u),h?.delete(_))}),a&&b.forEach(_=>{const C=(ol.get(_)||0)-1;ol.set(_,C),C||_.removeAttribute(hE)}),ip-=1,ip||(op.inert=new WeakMap,op["aria-hidden"]=new WeakMap,Qp.inert=new WeakSet,Qp["aria-hidden"]=new WeakSet,ol=new WeakMap)}}function gE(e,t={}){const{ariaHidden:r=!1,inert:i=!1,mark:a=!0,markerIgnoreElements:l=[]}=t,u=yt(e[0]).body;return RH(e,u,r,i,{mark:a,markerIgnoreElements:l})}const jC=R.createContext(null),VC=()=>R.useContext(jC),AH=Nf("portal");function NH(e={}){const{ref:t,container:r,componentProps:i=yn,elementProps:a}=e,l=Qo(),f=VC()?.portalNode,[h,d]=R.useState(null),[p,g]=R.useState(null),v=Ve(C=>{C!==null&&g(C)}),x=R.useRef(null);Be(()=>{if(r===null){x.current&&(x.current=null,g(null),d(null));return}if(l==null)return;const C=(r&&(fg(r)?r:r.current))??f??document.body;if(C==null){x.current&&(x.current=null,g(null),d(null));return}x.current!==C&&(x.current=C,g(null),d(C))},[r,f,l]);const b=na("div",i,{ref:[t,v],props:[{id:l,[AH]:""},a]});return{portalNode:p,portalSubtree:h&&b?Gl.createPortal(b,h):null}}const MH=R.forwardRef(function(t,r){const{children:i,container:a,className:l,render:u,renderGuards:f,...h}=t,{portalNode:d,portalSubtree:p}=NH({container:a,ref:r,componentProps:t,elementProps:h}),g=R.useRef(null),v=R.useRef(null),x=R.useRef(null),b=R.useRef(null),[_,C]=R.useState(null),E=_?.modal,N=_?.open,w=typeof f=="boolean"?f:!!_&&!_.modal&&_.open&&!!d;R.useEffect(()=>{if(!d||E)return;function M(T){d&&T.relatedTarget&&hl(T)&&(T.type==="focusin"?fE:xH)(d)}return d.addEventListener("focusin",M,!0),d.addEventListener("focusout",M,!0),()=>{d.removeEventListener("focusin",M,!0),d.removeEventListener("focusout",M,!0)}},[d,E]),R.useEffect(()=>{!d||N||fE(d)},[N,d]);const A=R.useMemo(()=>({beforeOutsideRef:g,afterOutsideRef:v,beforeInsideRef:x,afterInsideRef:b,portalNode:d,setFocusManagerState:C}),[d]);return D.jsxs(R.Fragment,{children:[p,D.jsxs(jC.Provider,{value:A,children:[w&&d&&D.jsx(Af,{"data-type":"outside",ref:g,onFocus:M=>{if(hl(M,d))x.current?.focus();else{const T=_?_.domReference:null;FC(T)?.focus()}}}),w&&d&&D.jsx("span",{"aria-owns":d.id,style:$k}),d&&Gl.createPortal(i,d),w&&d&&D.jsx(Af,{"data-type":"outside",ref:v,onFocus:M=>{if(hl(M,d))b.current?.focus();else{const T=_?_.domReference:null;HC(T)?.focus(),_?.closeOnFocusOut&&_?.onOpenChange(!1,It(id,M.nativeEvent))}}})]})]})});function GC(){const e=new Map;return{emit(t,r){e.get(t)?.forEach(i=>i(r))},on(t,r){e.has(t)||e.set(t,new Set),e.get(t).add(r)},off(t,r){e.get(t)?.delete(r)}}}class qC{nodesRef={current:[]};events=GC();addNode(t){this.nodesRef.current.push(t)}removeNode(t){const r=this.nodesRef.current.findIndex(i=>i===t);r!==-1&&this.nodesRef.current.splice(r,1)}}const YC=R.createContext(null),XC=R.createContext(null),ti=()=>R.useContext(YC)?.id||null,oa=e=>{const t=R.useContext(XC);return e??t};function OH(e){const t=Qo(),r=oa(e),i=ti();return Be(()=>{if(!t)return;const a={id:t,parentId:i};return r?.addNode(a),()=>{r?.removeNode(a)}},[r,t,i]),t}function DH(e){const{children:t,id:r}=e,i=ti();return D.jsx(YC.Provider,{value:R.useMemo(()=>({id:r,parentId:i}),[r,i]),children:t})}function zH(e){const{children:t,externalTree:r}=e,i=bn(()=>r??new qC).current;return D.jsx(XC.Provider,{value:i,children:t})}function BH(e,t){const r=Xt(e.target);return e instanceof r.KeyboardEvent?"keyboard":e instanceof r.FocusEvent?t||"keyboard":"pointerType"in e?e.pointerType||"keyboard":"touches"in e?"touch":e instanceof r.MouseEvent?t||(e.detail===0?"keyboard":"mouse"):""}const yE=20;let Po=[];function xg(){Po=Po.filter(e=>e.deref()?.isConnected)}function UH(e){xg(),e&&Wo(e)!=="body"&&(Po.push(new WeakRef(e)),Po.length>yE&&(Po=Po.slice(-yE)))}function ap(){return xg(),Po[Po.length-1]?.deref()}function LH(e){if(!e)return null;const t=Kl();return kC(e,t)?e:ud(e,t)[0]||e}function kH(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():vg(e)}function vE(e,t){if(!t.current.includes("floating")&&!e.getAttribute("role")?.includes("dialog"))return;const r=Kl(),a=vH(e,r).filter(u=>{const f=u.getAttribute("data-tabindex")||"";return kC(u,r)||u.hasAttribute("data-tabindex")&&!f.startsWith("-")}),l=e.getAttribute("tabindex");t.current.includes("floating")||a.length===0?l!=="0"&&e.setAttribute("tabindex","0"):(l!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function IH(e){const{context:t,children:r,disabled:i=!1,initialFocus:a=!0,returnFocus:l=!0,restoreFocus:u=!1,modal:f=!0,closeOnFocusOut:h=!0,openInteractionType:d="",nextFocusableElement:p,previousFocusableElement:g,beforeContentFocusGuardRef:v,externalTree:x,getInsideElements:b}=e,_="rootStore"in t?t.rootStore:t,C=_.useState("open"),E=_.useState("domReferenceElement"),N=_.useState("floatingElement"),{events:w,dataRef:A}=_.context,M=Ve(()=>A.current.floatingContext?.nodeId),T=a===!1,O=Yp(E)&&T,I=R.useRef(["content"]),j=nr(a),Z=nr(l),P=nr(d),q=oa(x),G=VC(),k=R.useRef(!1),F=R.useRef(!1),z=R.useRef(!1),L=R.useRef(-1),H=R.useRef(""),X=R.useRef(""),Q=R.useRef(null),U=R.useRef(null),V=Nl(Q,v,G?.beforeInsideRef),ee=Nl(U,G?.afterInsideRef),J=sr(),fe=sr(),ye=_C(),he=G!=null,ae=xf(N),be=Ve((xe=ae)=>xe?ud(xe,Kl()):[]),ve=Ve(()=>b?.().filter(xe=>xe!=null)??[]),Te=Ve(xe=>{const Ee=be(xe);return I.current.map(()=>Ee).filter(Boolean).flat()});R.useEffect(()=>{if(i||!f)return;function xe(Ce){Ce.key==="Tab"&&We(ae,gr(yt(ae)))&&be().length===0&&!O&&gn(Ce)}const Ee=yt(ae);return Ee.addEventListener("keydown",xe),()=>{Ee.removeEventListener("keydown",xe)}},[i,E,ae,f,I,O,be,Te]),R.useEffect(()=>{if(i||!C)return;const xe=yt(ae);function Ee(){z.current=!1}function Ce(re){const ue=Mn(re),le=ve(),se=We(N,ue)||We(E,ue)||We(G?.portalNode,ue)||le.some(K=>K===ue||We(K,ue));z.current=!se,X.current=re.pointerType||"keyboard",ue?.closest(`[${qk}]`)&&(F.current=!0)}function ie(){X.current="keyboard"}return xe.addEventListener("pointerdown",Ce,!0),xe.addEventListener("pointerup",Ee,!0),xe.addEventListener("pointercancel",Ee,!0),xe.addEventListener("keydown",ie,!0),()=>{xe.removeEventListener("pointerdown",Ce,!0),xe.removeEventListener("pointerup",Ee,!0),xe.removeEventListener("pointercancel",Ee,!0),xe.removeEventListener("keydown",ie,!0)}},[i,N,E,ae,C,G,ve]),R.useEffect(()=>{if(i||!h)return;const xe=yt(ae);function Ee(){F.current=!0,fe.start(0,()=>{F.current=!1})}function Ce(se){const K=Mn(se),Se=be().indexOf(K);Se!==-1&&(L.current=Se)}function ie(se){const K=se.relatedTarget,ge=se.currentTarget,Se=Mn(se);queueMicrotask(()=>{const _e=M(),Je=_.context.triggerElements,st=ve(),ft=K?.hasAttribute(Nf("focus-guard"))&&[Q.current,U.current,G?.beforeInsideRef.current,G?.afterInsideRef.current,G?.beforeOutsideRef.current,G?.afterOutsideRef.current,Wr(g),Wr(p)].includes(K),at=!(We(E,K)||We(N,K)||We(K,N)||We(G?.portalNode,K)||st.some(Qe=>Qe===K||We(Qe,K))||K!=null&&Je.hasElement(K)||Je.hasMatchingElement(Qe=>We(Qe,K))||ft||q&&(Xo(q.nodesRef.current,_e).find(Qe=>We(Qe.context?.elements.floating,K)||We(Qe.context?.elements.domReference,K))||sE(q.nodesRef.current,_e).find(Qe=>[Qe.context?.elements.floating,xf(Qe.context?.elements.floating)].includes(K)||Qe.context?.elements.domReference===K)));if(ge===E&&ae&&vE(ae,I),u&&ge!==E&&!kH(Se)&&gr(xe)===xe.body){if(Mt(ae)&&(ae.focus(),u==="popup")){ye.request(()=>{ae.focus()});return}const Qe=L.current,He=be(),_t=He[Qe]||He[He.length-1]||ae;Mt(_t)&&_t.focus()}if(A.current.insideReactTree){A.current.insideReactTree=!1;return}(O||!f)&&K&&at&&!F.current&&(O||K!==ap())&&(k.current=!0,_.setOpen(!1,It(id,se)))})}function re(){z.current||(A.current.insideReactTree=!0,J.start(0,()=>{A.current.insideReactTree=!1}))}const ue=Mt(E)?E:null,le=[];if(!(!N&&!ue))return ue&&(ue.addEventListener("focusout",ie),ue.addEventListener("pointerdown",Ee),le.push(()=>{ue.removeEventListener("focusout",ie),ue.removeEventListener("pointerdown",Ee)})),N&&(N.addEventListener("focusin",Ce),N.addEventListener("focusout",ie),G&&(N.addEventListener("focusout",re,!0),le.push(()=>{N.removeEventListener("focusout",re,!0)})),le.push(()=>{N.removeEventListener("focusin",Ce),N.removeEventListener("focusout",ie)})),()=>{le.forEach(se=>{se()})}},[i,E,N,ae,f,q,G,_,h,u,be,O,M,I,A,J,fe,ye,p,g,ve]),R.useEffect(()=>{if(i||!N||!C)return;const xe=Array.from(G?.portalNode?.querySelectorAll(`[${Nf("portal")}]`)||[]),Ce=(q?sE(q.nodesRef.current,M()):[]).find(K=>Yp(K.context?.elements.domReference||null))?.context?.elements.domReference,re=[...[N,...xe,Q.current,U.current,G?.beforeOutsideRef.current,G?.afterOutsideRef.current,...ve()],Ce,Wr(g),Wr(p),O?E:null].filter(K=>K!=null),ue=gE(re,{ariaHidden:f||O,mark:!1}),le=[N,...xe].filter(K=>K!=null),se=gE(le);return()=>{se(),ue()}},[C,i,E,N,f,I,G,O,q,M,p,g,ve]),Be(()=>{if(!C||i||!Mt(ae))return;const xe=yt(ae),Ee=gr(xe);queueMicrotask(()=>{const Ce=Te(ae),ie=j.current,re=typeof ie=="function"?ie(P.current||""):ie;if(re===void 0||re===!1)return;let ue;re===!0||re===null?ue=Ce[0]||ae:ue=Wr(re),ue=ue||Ce[0]||ae,!We(ae,Ee)&&ml(ue,{preventScroll:ue===ae})})},[i,C,ae,T,Te,j,P]),Be(()=>{if(i||!ae)return;const xe=yt(ae),Ee=gr(xe);UH(Ee);function Ce(re){if(re.open||(H.current=BH(re.nativeEvent,X.current)),re.reason===Hi&&re.nativeEvent.type==="mouseleave"&&(k.current=!0),re.reason===ug)if(re.nested)k.current=!1;else if(AC(re.nativeEvent)||NC(re.nativeEvent))k.current=!1;else{let ue=!1;document.createElement("div").focus({get preventScroll(){return ue=!0,!1}}),ue?k.current=!1:k.current=!0}}w.on("openchange",Ce);function ie(){const re=Z.current;let ue=typeof re=="function"?re(H.current):re;if(ue===void 0||ue===!1)return null;if(ue===null&&(ue=!0),typeof ue=="boolean"){const se=E||ap();return se&&se.isConnected?se:null}const le=E||ap();return Wr(ue)||le||null}return()=>{w.off("openchange",Ce);const re=gr(xe),ue=ve(),le=We(N,re)||ue.some(K=>K===re||We(K,re))||q&&Xo(q.nodesRef.current,M(),!1).some(K=>We(K.context?.elements.floating,re)),se=ie();queueMicrotask(()=>{const K=LH(se),ge=typeof Z.current!="boolean";Z.current&&!k.current&&Mt(K)&&(!(!ge&&K!==re&&re!==xe.body)||le)&&K.focus({preventScroll:!0}),k.current=!1})}},[i,N,ae,Z,A,w,q,E,M,ve]),Be(()=>{if(!vC||C||!N)return;const xe=gr(yt(N));!Mt(xe)||!RC(xe)||We(N,xe)&&xe.blur()},[C,N]),Be(()=>{if(!(i||!G))return G.setFocusManagerState({modal:f,closeOnFocusOut:h,open:C,onOpenChange:_.setOpen,domReference:E}),()=>{G.setFocusManagerState(null)}},[i,G,f,C,_,h,E]),Be(()=>{if(!(i||!ae))return vE(ae,I),()=>{queueMicrotask(xg)}},[i,ae,I]);const we=!i&&(f?!O:!0)&&(he||f);return D.jsxs(R.Fragment,{children:[we&&D.jsx(Af,{"data-type":"inside",ref:V,onFocus:xe=>{if(f){const Ee=Te();ml(Ee[Ee.length-1])}else G?.portalNode&&(k.current=!1,hl(xe,G.portalNode)?HC(E)?.focus():Wr(g??G.beforeOutsideRef)?.focus())}}),r,we&&D.jsx(Af,{"data-type":"inside",ref:ee,onFocus:xe=>{f?ml(Te()[0]):G?.portalNode&&(h&&(k.current=!0),hl(xe,G.portalNode)?FC(E)?.focus():Wr(p??G.afterOutsideRef)?.focus())}})]})}const HH={intentional:"onClick",sloppy:"onPointerDown"};function FH(){return!1}function PH(e){return{escapeKey:typeof e=="boolean"?e:e?.escapeKey??!1,outsidePress:typeof e=="boolean"?e:e?.outsidePress??!0}}function jH(e,t={}){const r="rootStore"in e?e.rootStore:e,i=r.useState("open"),a=r.useState("floatingElement"),{dataRef:l}=r.context,{enabled:u=!0,escapeKey:f=!0,outsidePress:h=!0,outsidePressEvent:d="sloppy",referencePress:p=FH,referencePressEvent:g="sloppy",bubbles:v,externalTree:x}=t,b=oa(x),_=Ve(typeof h=="function"?h:()=>!1),C=typeof h=="function"?_:h,E=C!==!1,N=Ve(()=>d),w=R.useRef(!1),A=R.useRef(!1),M=R.useRef(!1),{escapeKey:T,outsidePress:O}=PH(v),I=R.useRef(null),j=sr(),Z=sr(),P=Ve(()=>{Z.clear(),l.current.insideReactTree=!1}),q=R.useRef(!1),G=R.useRef(""),k=Ve(p),F=Ve(U=>{if(!i||!u||!f||U.key!=="Escape"||q.current)return;const V=l.current.floatingContext?.nodeId,ee=b?Xo(b.nodesRef.current,V):[];if(!T&&ee.length>0){let ye=!0;if(ee.forEach(he=>{he.context?.open&&!he.context.dataRef.current.__escapeKeyBubbles&&(ye=!1)}),!ye)return}const J=jI(U)?U.nativeEvent:U,fe=It(mC,J);r.setOpen(!1,fe),!T&&!fe.isPropagationAllowed&&U.stopPropagation()}),z=Ve(()=>{l.current.insideReactTree=!0,Z.start(0,P)});R.useEffect(()=>{if(!i||!u)return;l.current.__escapeKeyBubbles=T,l.current.__outsidePressBubbles=O;const U=new ro,V=new ro;function ee(){U.clear(),q.current=!0}function J(){U.start(ld()?5:0,()=>{q.current=!1})}function fe(){M.current=!0,V.start(0,()=>{M.current=!1})}function ye(){w.current=!1,A.current=!1}function he(){const K=G.current,ge=K==="pen"||!K?"mouse":K,Se=N(),_e=typeof Se=="function"?Se():Se;return typeof _e=="string"?_e:_e[ge]}function ae(K){const ge=he();return ge==="intentional"&&K.type!=="click"||ge==="sloppy"&&K.type==="click"}function be(K){const ge=l.current.floatingContext?.nodeId,Se=b&&Xo(b.nodesRef.current,ge).some(_e=>Wn(K,_e.context?.elements.floating));return Wn(K,r.select("floatingElement"))||Wn(K,r.select("domReferenceElement"))||Se}function ve(K){if(ae(K)){P();return}if(l.current.insideReactTree){P();return}const ge=Mn(K),Se=`[${Nf("inert")}]`;let _e=Array.from(yt(r.select("floatingElement")).querySelectorAll(Se));const Je=xt(ge)?ge.getRootNode():null;Dl(Je)&&(_e=_e.concat(Array.from(Je.querySelectorAll(Se))));const st=r.context.triggerElements;if(ge&&(st.hasElement(ge)||st.hasMatchingElement(He=>We(He,ge))))return;let ft=xt(ge)?ge:null;for(;ft&&!xr(ft);){const He=wr(ft);if(xr(He)||!xt(He))break;ft=He}if(_e.length&&xt(ge)&&!PI(ge)&&!We(ge,r.select("floatingElement"))&&_e.every(He=>!We(ft,He)))return;if(Mt(ge)&&!("touches"in K)){const He=xr(ge),_t=Bn(ge),an=/auto|scroll/,ze=He||an.test(_t.overflowX),Oe=He||an.test(_t.overflowY),rt=ze&&ge.clientWidth>0&&ge.scrollWidth>ge.clientWidth,wt=Oe&&ge.clientHeight>0&&ge.scrollHeight>ge.clientHeight,Ze=_t.direction==="rtl",Ct=wt&&(Ze?K.offsetX<=ge.offsetWidth-ge.clientWidth:K.offsetX>ge.clientWidth),qt=rt&&K.offsetY>ge.clientHeight;if(Ct||qt)return}if(be(K))return;if(he()==="intentional"&&M.current){V.clear(),M.current=!1;return}if(typeof C=="function"&&!C(K))return;const at=l.current.floatingContext?.nodeId,Qe=b?Xo(b.nodesRef.current,at):[];if(Qe.length>0){let He=!0;if(Qe.forEach(_t=>{_t.context?.open&&!_t.context.dataRef.current.__outsidePressBubbles&&(He=!1)}),!He)return}r.setOpen(!1,It(ug,K)),P()}function Te(K){he()!=="sloppy"||K.pointerType==="touch"||!r.select("open")||!u||Wn(K,r.select("floatingElement"))||Wn(K,r.select("domReferenceElement"))||ve(K)}function we(K){if(he()!=="sloppy"||!r.select("open")||!u||Wn(K,r.select("floatingElement"))||Wn(K,r.select("domReferenceElement")))return;const ge=K.touches[0];ge&&(I.current={startTime:Date.now(),startX:ge.clientX,startY:ge.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},j.start(1e3,()=>{I.current&&(I.current.dismissOnTouchEnd=!1,I.current.dismissOnMouseDown=!1)}))}function xe(K){G.current="touch";const ge=Mn(K);function Se(){we(K),ge?.removeEventListener(K.type,Se)}ge?.addEventListener(K.type,Se)}function Ee(K){if(j.clear(),K.type==="pointerdown"&&(G.current=K.pointerType),K.type==="mousedown"&&I.current&&!I.current.dismissOnMouseDown)return;const ge=Mn(K);function Se(){K.type==="pointerdown"?Te(K):ve(K),ge?.removeEventListener(K.type,Se)}ge?.addEventListener(K.type,Se)}function Ce(K){if(!w.current)return;const ge=A.current;if(ye(),he()==="intentional"){if(K.type==="pointercancel"){ge&&fe();return}if(!be(K)){if(ge){fe();return}typeof C=="function"&&!C(K)||(V.clear(),M.current=!0,P())}}}function ie(K){if(he()!=="sloppy"||!I.current||Wn(K,r.select("floatingElement"))||Wn(K,r.select("domReferenceElement")))return;const ge=K.touches[0];if(!ge)return;const Se=Math.abs(ge.clientX-I.current.startX),_e=Math.abs(ge.clientY-I.current.startY),Je=Math.sqrt(Se*Se+_e*_e);Je>5&&(I.current.dismissOnTouchEnd=!0),Je>10&&(ve(K),j.clear(),I.current=null)}function re(K){const ge=Mn(K);function Se(){ie(K),ge?.removeEventListener(K.type,Se)}ge?.addEventListener(K.type,Se)}function ue(K){he()!=="sloppy"||!I.current||Wn(K,r.select("floatingElement"))||Wn(K,r.select("domReferenceElement"))||(I.current.dismissOnTouchEnd&&ve(K),j.clear(),I.current=null)}function le(K){const ge=Mn(K);function Se(){ue(K),ge?.removeEventListener(K.type,Se)}ge?.addEventListener(K.type,Se)}const se=yt(a);return f&&(se.addEventListener("keydown",F),se.addEventListener("compositionstart",ee),se.addEventListener("compositionend",J)),E&&(se.addEventListener("click",Ee,!0),se.addEventListener("pointerdown",Ee,!0),se.addEventListener("pointerup",Ce,!0),se.addEventListener("pointercancel",Ce,!0),se.addEventListener("mousedown",Ee,!0),se.addEventListener("mouseup",Ce,!0),se.addEventListener("touchstart",xe,!0),se.addEventListener("touchmove",re,!0),se.addEventListener("touchend",le,!0)),()=>{f&&(se.removeEventListener("keydown",F),se.removeEventListener("compositionstart",ee),se.removeEventListener("compositionend",J)),E&&(se.removeEventListener("click",Ee,!0),se.removeEventListener("pointerdown",Ee,!0),se.removeEventListener("pointerup",Ce,!0),se.removeEventListener("pointercancel",Ce,!0),se.removeEventListener("mousedown",Ee,!0),se.removeEventListener("mouseup",Ce,!0),se.removeEventListener("touchstart",xe,!0),se.removeEventListener("touchmove",re,!0),se.removeEventListener("touchend",le,!0)),U.clear(),V.clear(),ye(),M.current=!1}},[l,a,f,E,C,i,u,T,O,F,P,N,b,r,j]),R.useEffect(P,[C,P]);const L=R.useMemo(()=>({onKeyDown:F,[HH[g]]:U=>{k()&&r.setOpen(!1,It(vf,U.nativeEvent))},...g!=="intentional"&&{onClick(U){k()&&r.setOpen(!1,It(vf,U.nativeEvent))}}}),[F,r,g,k]),H=Ve(U=>{if(!i||!u||U.button!==0)return;const V=Mn(U.nativeEvent);We(r.select("floatingElement"),V)&&(w.current||(w.current=!0,A.current=!1))}),X=Ve(U=>{!i||!u||(U.defaultPrevented||U.nativeEvent.defaultPrevented)&&w.current&&(A.current=!0)}),Q=R.useMemo(()=>({onKeyDown:F,onPointerDown:X,onMouseDown:X,onClickCapture:z,onMouseDownCapture(U){z(),H(U)},onPointerDownCapture(U){z(),H(U)},onMouseUpCapture:z,onTouchEndCapture:z,onTouchMoveCapture:z}),[F,z,H,X]);return R.useMemo(()=>u?{reference:L,floating:Q,trigger:L}:{},[u,L,Q])}function xE(e,t,r){let{reference:i,floating:a}=e;const l=qn(t),u=yg(t),f=gg(u),h=xn(t),d=l==="y",p=i.x+i.width/2-a.width/2,g=i.y+i.height/2-a.height/2,v=i[f]/2-a[f]/2;let x;switch(h){case"top":x={x:p,y:i.y-a.height};break;case"bottom":x={x:p,y:i.y+i.height};break;case"right":x={x:i.x+i.width,y:g};break;case"left":x={x:i.x-a.width,y:g};break;default:x={x:i.x,y:i.y}}switch(ei(t)){case"start":x[u]-=v*(r&&d?-1:1);break;case"end":x[u]+=v*(r&&d?-1:1);break}return x}async function VH(e,t){var r;t===void 0&&(t={});const{x:i,y:a,platform:l,rects:u,elements:f,strategy:h}=e,{boundary:d="clippingAncestors",rootBoundary:p="viewport",elementContext:g="floating",altBoundary:v=!1,padding:x=0}=oo(t,e),b=MC(x),C=f[v?g==="floating"?"reference":"floating":g],E=Ef(await l.getClippingRect({element:(r=await(l.isElement==null?void 0:l.isElement(C)))==null||r?C:C.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(f.floating)),boundary:d,rootBoundary:p,strategy:h})),N=g==="floating"?{x:i,y:a,width:u.floating.width,height:u.floating.height}:u.reference,w=await(l.getOffsetParent==null?void 0:l.getOffsetParent(f.floating)),A=await(l.isElement==null?void 0:l.isElement(w))?await(l.getScale==null?void 0:l.getScale(w))||{x:1,y:1}:{x:1,y:1},M=Ef(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:f,rect:N,offsetParent:w,strategy:h}):N);return{top:(E.top-M.top+b.top)/A.y,bottom:(M.bottom-E.bottom+b.bottom)/A.y,left:(E.left-M.left+b.left)/A.x,right:(M.right-E.right+b.right)/A.x}}const GH=50,qH=async(e,t,r)=>{const{placement:i="bottom",strategy:a="absolute",middleware:l=[],platform:u}=r,f=u.detectOverflow?u:{...u,detectOverflow:VH},h=await(u.isRTL==null?void 0:u.isRTL(t));let d=await u.getElementRects({reference:e,floating:t,strategy:a}),{x:p,y:g}=xE(d,i,h),v=i,x=0;const b={};for(let _=0;_<l.length;_++){const C=l[_];if(!C)continue;const{name:E,fn:N}=C,{x:w,y:A,data:M,reset:T}=await N({x:p,y:g,initialPlacement:i,placement:v,strategy:a,middlewareData:b,rects:d,platform:f,elements:{reference:e,floating:t}});p=w??p,g=A??g,b[E]={...b[E],...M},T&&x<GH&&(x++,typeof T=="object"&&(T.placement&&(v=T.placement),T.rects&&(d=T.rects===!0?await u.getElementRects({reference:e,floating:t,strategy:a}):T.rects),{x:p,y:g}=xE(d,v,h)),_=-1)}return{x:p,y:g,placement:v,strategy:a,middlewareData:b}},YH=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var r,i;const{placement:a,middlewareData:l,rects:u,initialPlacement:f,platform:h,elements:d}=t,{mainAxis:p=!0,crossAxis:g=!0,fallbackPlacements:v,fallbackStrategy:x="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:_=!0,...C}=oo(e,t);if((r=l.arrow)!=null&&r.alignmentOffset)return{};const E=xn(a),N=qn(f),w=xn(f)===f,A=await(h.isRTL==null?void 0:h.isRTL(d.floating)),M=v||(w||!_?[_f(f)]:$I(f)),T=b!=="none";!v&&T&&M.push(...WI(f,_,b,A));const O=[f,...M],I=await h.detectOverflow(t,C),j=[];let Z=((i=l.flip)==null?void 0:i.overflows)||[];if(p&&j.push(I[E]),g){const k=XI(a,u,A);j.push(I[k[0]],I[k[1]])}if(Z=[...Z,{placement:a,overflows:j}],!j.every(k=>k<=0)){var P,q;const k=(((P=l.flip)==null?void 0:P.index)||0)+1,F=O[k];if(F&&(!(g==="alignment"?N!==qn(F):!1)||Z.every(H=>qn(H.placement)===N?H.overflows[0]>0:!0)))return{data:{index:k,overflows:Z},reset:{placement:F}};let z=(q=Z.filter(L=>L.overflows[0]<=0).sort((L,H)=>L.overflows[1]-H.overflows[1])[0])==null?void 0:q.placement;if(!z)switch(x){case"bestFit":{var G;const L=(G=Z.filter(H=>{if(T){const X=qn(H.placement);return X===N||X==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(X=>X>0).reduce((X,Q)=>X+Q,0)]).sort((H,X)=>H[1]-X[1])[0])==null?void 0:G[0];L&&(z=L);break}case"initialPlacement":z=f;break}if(a!==z)return{reset:{placement:z}}}return{}}}};function bE(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function _E(e){return qI.some(t=>e[t]>=0)}const XH=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:r,platform:i}=t,{strategy:a="referenceHidden",...l}=oo(e,t);switch(a){case"referenceHidden":{const u=await i.detectOverflow(t,{...l,elementContext:"reference"}),f=bE(u,r.reference);return{data:{referenceHiddenOffsets:f,referenceHidden:_E(f)}}}case"escaped":{const u=await i.detectOverflow(t,{...l,altBoundary:!0}),f=bE(u,r.floating);return{data:{escapedOffsets:f,escaped:_E(f)}}}default:return{}}}}},$C=new Set(["left","top"]);async function $H(e,t){const{placement:r,platform:i,elements:a}=e,l=await(i.isRTL==null?void 0:i.isRTL(a.floating)),u=xn(r),f=ei(r),h=qn(r)==="y",d=$C.has(u)?-1:1,p=l&&h?-1:1,g=oo(t,e);let{mainAxis:v,crossAxis:x,alignmentAxis:b}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return f&&typeof b=="number"&&(x=f==="end"?b*-1:b),h?{x:x*p,y:v*d}:{x:v*d,y:x*p}}const KH=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var r,i;const{x:a,y:l,placement:u,middlewareData:f}=t,h=await $H(t,e);return u===((r=f.offset)==null?void 0:r.placement)&&(i=f.arrow)!=null&&i.alignmentOffset?{}:{x:a+h.x,y:l+h.y,data:{...h,placement:u}}}}},ZH=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:r,y:i,placement:a,platform:l}=t,{mainAxis:u=!0,crossAxis:f=!1,limiter:h={fn:E=>{let{x:N,y:w}=E;return{x:N,y:w}}},...d}=oo(e,t),p={x:r,y:i},g=await l.detectOverflow(t,d),v=qn(xn(a)),x=pg(v);let b=p[x],_=p[v];if(u){const E=x==="y"?"top":"left",N=x==="y"?"bottom":"right",w=b+g[E],A=b-g[N];b=Xp(w,b,A)}if(f){const E=v==="y"?"top":"left",N=v==="y"?"bottom":"right",w=_+g[E],A=_-g[N];_=Xp(w,_,A)}const C=h.fn({...t,[x]:b,[v]:_});return{...C,data:{x:C.x-r,y:C.y-i,enabled:{[x]:u,[v]:f}}}}}},QH=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:r,y:i,placement:a,rects:l,middlewareData:u}=t,{offset:f=0,mainAxis:h=!0,crossAxis:d=!0}=oo(e,t),p={x:r,y:i},g=qn(a),v=pg(g);let x=p[v],b=p[g];const _=oo(f,t),C=typeof _=="number"?{mainAxis:_,crossAxis:0}:{mainAxis:0,crossAxis:0,..._};if(h){const w=v==="y"?"height":"width",A=l.reference[v]-l.floating[w]+C.mainAxis,M=l.reference[v]+l.reference[w]-C.mainAxis;x<A?x=A:x>M&&(x=M)}if(d){var E,N;const w=v==="y"?"width":"height",A=$C.has(xn(a)),M=l.reference[g]-l.floating[w]+(A&&((E=u.offset)==null?void 0:E[g])||0)+(A?0:C.crossAxis),T=l.reference[g]+l.reference[w]+(A?0:((N=u.offset)==null?void 0:N[g])||0)-(A?C.crossAxis:0);b<M?b=M:b>T&&(b=T)}return{[v]:x,[g]:b}}}},WH=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var r,i;const{placement:a,rects:l,platform:u,elements:f}=t,{apply:h=()=>{},...d}=oo(e,t),p=await u.detectOverflow(t,d),g=xn(a),v=ei(a),x=qn(a)==="y",{width:b,height:_}=l.floating;let C,E;g==="top"||g==="bottom"?(C=g,E=v===(await(u.isRTL==null?void 0:u.isRTL(f.floating))?"start":"end")?"left":"right"):(E=g,C=v==="end"?"top":"bottom");const N=_-p.top-p.bottom,w=b-p.left-p.right,A=Qs(_-p[C],N),M=Qs(b-p[E],w),T=!t.middlewareData.shift;let O=A,I=M;if((r=t.middlewareData.shift)!=null&&r.enabled.x&&(I=w),(i=t.middlewareData.shift)!=null&&i.enabled.y&&(O=N),T&&!v){const Z=On(p.left,0),P=On(p.right,0),q=On(p.top,0),G=On(p.bottom,0);x?I=b-2*(Z!==0||P!==0?Z+P:On(p.left,p.right)):O=_-2*(q!==0||G!==0?q+G:On(p.top,p.bottom))}await h({...t,availableWidth:I,availableHeight:O});const j=await u.getDimensions(f.floating);return b!==j.width||_!==j.height?{reset:{rects:!0}}:{}}}};function KC(e){const t=Bn(e);let r=parseFloat(t.width)||0,i=parseFloat(t.height)||0;const a=Mt(e),l=a?e.offsetWidth:r,u=a?e.offsetHeight:i,f=bf(r)!==l||bf(i)!==u;return f&&(r=l,i=u),{width:r,height:i,$:f}}function bg(e){return xt(e)?e:e.contextElement}function Ps(e){const t=bg(e);if(!Mt(t))return br(1);const r=t.getBoundingClientRect(),{width:i,height:a,$:l}=KC(t);let u=(l?bf(r.width):r.width)/i,f=(l?bf(r.height):r.height)/a;return(!u||!Number.isFinite(u))&&(u=1),(!f||!Number.isFinite(f))&&(f=1),{x:u,y:f}}const JH=br(0);function ZC(e){const t=Xt(e);return!ld()||!t.visualViewport?JH:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function eF(e,t,r){return t===void 0&&(t=!1),!r||t&&r!==Xt(e)?!1:t}function Fi(e,t,r,i){t===void 0&&(t=!1),r===void 0&&(r=!1);const a=e.getBoundingClientRect(),l=bg(e);let u=br(1);t&&(i?xt(i)&&(u=Ps(i)):u=Ps(e));const f=eF(l,r,i)?ZC(l):br(0);let h=(a.left+f.x)/u.x,d=(a.top+f.y)/u.y,p=a.width/u.x,g=a.height/u.y;if(l){const v=Xt(l),x=i&&xt(i)?Xt(i):i;let b=v,_=Vp(b);for(;_&&i&&x!==b;){const C=Ps(_),E=_.getBoundingClientRect(),N=Bn(_),w=E.left+(_.clientLeft+parseFloat(N.paddingLeft))*C.x,A=E.top+(_.clientTop+parseFloat(N.paddingTop))*C.y;h*=C.x,d*=C.y,p*=C.x,g*=C.y,h+=w,d+=A,b=Xt(_),_=Vp(b)}}return Ef({width:p,height:g,x:h,y:d})}function fd(e,t){const r=cd(e).scrollLeft;return t?t.left+r:Fi(Ar(e)).left+r}function QC(e,t){const r=e.getBoundingClientRect(),i=r.left+t.scrollLeft-fd(e,r),a=r.top+t.scrollTop;return{x:i,y:a}}function tF(e){let{elements:t,rect:r,offsetParent:i,strategy:a}=e;const l=a==="fixed",u=Ar(i),f=t?ad(t.floating):!1;if(i===u||f&&l)return r;let h={scrollLeft:0,scrollTop:0},d=br(1);const p=br(0),g=Mt(i);if((g||!g&&!l)&&((Wo(i)!=="body"||Jo(u))&&(h=cd(i)),g)){const x=Fi(i);d=Ps(i),p.x=x.x+i.clientLeft,p.y=x.y+i.clientTop}const v=u&&!g&&!l?QC(u,h):br(0);return{width:r.width*d.x,height:r.height*d.y,x:r.x*d.x-h.scrollLeft*d.x+p.x+v.x,y:r.y*d.y-h.scrollTop*d.y+p.y+v.y}}function nF(e){return Array.from(e.getClientRects())}function rF(e){const t=Ar(e),r=cd(e),i=e.ownerDocument.body,a=On(t.scrollWidth,t.clientWidth,i.scrollWidth,i.clientWidth),l=On(t.scrollHeight,t.clientHeight,i.scrollHeight,i.clientHeight);let u=-r.scrollLeft+fd(e);const f=-r.scrollTop;return Bn(i).direction==="rtl"&&(u+=On(t.clientWidth,i.clientWidth)-a),{width:a,height:l,x:u,y:f}}const EE=25;function oF(e,t){const r=Xt(e),i=Ar(e),a=r.visualViewport;let l=i.clientWidth,u=i.clientHeight,f=0,h=0;if(a){l=a.width,u=a.height;const p=ld();(!p||p&&t==="fixed")&&(f=a.offsetLeft,h=a.offsetTop)}const d=fd(i);if(d<=0){const p=i.ownerDocument,g=p.body,v=getComputedStyle(g),x=p.compatMode==="CSS1Compat"&&parseFloat(v.marginLeft)+parseFloat(v.marginRight)||0,b=Math.abs(i.clientWidth-g.clientWidth-x);b<=EE&&(l-=b)}else d<=EE&&(l+=d);return{width:l,height:u,x:f,y:h}}function iF(e,t){const r=Fi(e,!0,t==="fixed"),i=r.top+e.clientTop,a=r.left+e.clientLeft,l=Mt(e)?Ps(e):br(1),u=e.clientWidth*l.x,f=e.clientHeight*l.y,h=a*l.x,d=i*l.y;return{width:u,height:f,x:h,y:d}}function SE(e,t,r){let i;if(t==="viewport")i=oF(e,r);else if(t==="document")i=rF(Ar(e));else if(xt(t))i=iF(t,r);else{const a=ZC(e);i={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Ef(i)}function WC(e,t){const r=wr(e);return r===t||!xt(r)||xr(r)?!1:Bn(r).position==="fixed"||WC(r,t)}function sF(e,t){const r=t.get(e);if(r)return r;let i=zl(e,[],!1).filter(f=>xt(f)&&Wo(f)!=="body"),a=null;const l=Bn(e).position==="fixed";let u=l?wr(e):e;for(;xt(u)&&!xr(u);){const f=Bn(u),h=dg(u);!h&&f.position==="fixed"&&(a=null),(l?!h&&!a:!h&&f.position==="static"&&!!a&&(a.position==="absolute"||a.position==="fixed")||Jo(u)&&!h&&WC(e,u))?i=i.filter(p=>p!==u):a=f,u=wr(u)}return t.set(e,i),i}function aF(e){let{element:t,boundary:r,rootBoundary:i,strategy:a}=e;const u=[...r==="clippingAncestors"?ad(t)?[]:sF(t,this._c):[].concat(r),i],f=SE(t,u[0],a);let h=f.top,d=f.right,p=f.bottom,g=f.left;for(let v=1;v<u.length;v++){const x=SE(t,u[v],a);h=On(x.top,h),d=Qs(x.right,d),p=Qs(x.bottom,p),g=On(x.left,g)}return{width:d-g,height:p-h,x:g,y:h}}function lF(e){const{width:t,height:r}=KC(e);return{width:t,height:r}}function cF(e,t,r){const i=Mt(t),a=Ar(t),l=r==="fixed",u=Fi(e,!0,l,t);let f={scrollLeft:0,scrollTop:0};const h=br(0);function d(){h.x=fd(a)}if(i||!i&&!l)if((Wo(t)!=="body"||Jo(a))&&(f=cd(t)),i){const x=Fi(t,!0,l,t);h.x=x.x+t.clientLeft,h.y=x.y+t.clientTop}else a&&d();l&&!i&&a&&d();const p=a&&!i&&!l?QC(a,f):br(0),g=u.left+f.scrollLeft-h.x-p.x,v=u.top+f.scrollTop-h.y-p.y;return{x:g,y:v,width:u.width,height:u.height}}function lp(e){return Bn(e).position==="static"}function wE(e,t){if(!Mt(e)||Bn(e).position==="fixed")return null;if(t)return t(e);let r=e.offsetParent;return Ar(e)===r&&(r=r.ownerDocument.body),r}function JC(e,t){const r=Xt(e);if(ad(e))return r;if(!Mt(e)){let a=wr(e);for(;a&&!xr(a);){if(xt(a)&&!lp(a))return a;a=wr(a)}return r}let i=wE(e,t);for(;i&&hI(i)&&lp(i);)i=wE(i,t);return i&&xr(i)&&lp(i)&&!dg(i)?r:i||gI(e)||r}const uF=async function(e){const t=this.getOffsetParent||JC,r=this.getDimensions,i=await r(e.floating);return{reference:cF(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function fF(e){return Bn(e).direction==="rtl"}const dF={convertOffsetParentRelativeRectToViewportRelativeRect:tF,getDocumentElement:Ar,getClippingRect:aF,getOffsetParent:JC,getElementRects:uF,getClientRects:nF,getDimensions:lF,getScale:Ps,isElement:xt,isRTL:fF};function eT(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function hF(e,t){let r=null,i;const a=Ar(e);function l(){var f;clearTimeout(i),(f=r)==null||f.disconnect(),r=null}function u(f,h){f===void 0&&(f=!1),h===void 0&&(h=1),l();const d=e.getBoundingClientRect(),{left:p,top:g,width:v,height:x}=d;if(f||t(),!v||!x)return;const b=Oi(g),_=Oi(a.clientWidth-(p+v)),C=Oi(a.clientHeight-(g+x)),E=Oi(p),w={rootMargin:-b+"px "+-_+"px "+-C+"px "+-E+"px",threshold:On(0,Qs(1,h))||1};let A=!0;function M(T){const O=T[0].intersectionRatio;if(O!==h){if(!A)return u();O?u(!1,O):i=setTimeout(()=>{u(!1,1e-7)},1e3)}O===1&&!eT(d,e.getBoundingClientRect())&&u(),A=!1}try{r=new IntersectionObserver(M,{...w,root:a.ownerDocument})}catch{r=new IntersectionObserver(M,w)}r.observe(e)}return u(!0),l}function CE(e,t,r,i){i===void 0&&(i={});const{ancestorScroll:a=!0,ancestorResize:l=!0,elementResize:u=typeof ResizeObserver=="function",layoutShift:f=typeof IntersectionObserver=="function",animationFrame:h=!1}=i,d=bg(e),p=a||l?[...d?zl(d):[],...t?zl(t):[]]:[];p.forEach(E=>{a&&E.addEventListener("scroll",r,{passive:!0}),l&&E.addEventListener("resize",r)});const g=d&&f?hF(d,r):null;let v=-1,x=null;u&&(x=new ResizeObserver(E=>{let[N]=E;N&&N.target===d&&x&&t&&(x.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var w;(w=x)==null||w.observe(t)})),r()}),d&&!h&&x.observe(d),t&&x.observe(t));let b,_=h?Fi(e):null;h&&C();function C(){const E=Fi(e);_&&!eT(_,E)&&r(),_=E,b=requestAnimationFrame(C)}return r(),()=>{var E;p.forEach(N=>{a&&N.removeEventListener("scroll",r),l&&N.removeEventListener("resize",r)}),g?.(),(E=x)==null||E.disconnect(),x=null,h&&cancelAnimationFrame(b)}}const mF=KH,pF=ZH,gF=YH,yF=WH,vF=XH,xF=QH,bF=(e,t,r)=>{const i=new Map,a={platform:dF,...r},l={...a.platform,_c:i};return qH(e,t,{...a,platform:l})};var _F=typeof document<"u",EF=function(){},Qu=_F?R.useLayoutEffect:EF;function Mf(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let r,i,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(r=e.length,r!==t.length)return!1;for(i=r;i--!==0;)if(!Mf(e[i],t[i]))return!1;return!0}if(a=Object.keys(e),r=a.length,r!==Object.keys(t).length)return!1;for(i=r;i--!==0;)if(!{}.hasOwnProperty.call(t,a[i]))return!1;for(i=r;i--!==0;){const l=a[i];if(!(l==="_owner"&&e.$$typeof)&&!Mf(e[l],t[l]))return!1}return!0}return e!==e&&t!==t}function tT(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function TE(e,t){const r=tT(e);return Math.round(t*r)/r}function cp(e){const t=R.useRef(e);return Qu(()=>{t.current=e}),t}function SF(e){e===void 0&&(e={});const{placement:t="bottom",strategy:r="absolute",middleware:i=[],platform:a,elements:{reference:l,floating:u}={},transform:f=!0,whileElementsMounted:h,open:d}=e,[p,g]=R.useState({x:0,y:0,strategy:r,placement:t,middlewareData:{},isPositioned:!1}),[v,x]=R.useState(i);Mf(v,i)||x(i);const[b,_]=R.useState(null),[C,E]=R.useState(null),N=R.useCallback(H=>{H!==T.current&&(T.current=H,_(H))},[]),w=R.useCallback(H=>{H!==O.current&&(O.current=H,E(H))},[]),A=l||b,M=u||C,T=R.useRef(null),O=R.useRef(null),I=R.useRef(p),j=h!=null,Z=cp(h),P=cp(a),q=cp(d),G=R.useCallback(()=>{if(!T.current||!O.current)return;const H={placement:t,strategy:r,middleware:v};P.current&&(H.platform=P.current),bF(T.current,O.current,H).then(X=>{const Q={...X,isPositioned:q.current!==!1};k.current&&!Mf(I.current,Q)&&(I.current=Q,Gl.flushSync(()=>{g(Q)}))})},[v,t,r,P,q]);Qu(()=>{d===!1&&I.current.isPositioned&&(I.current.isPositioned=!1,g(H=>({...H,isPositioned:!1})))},[d]);const k=R.useRef(!1);Qu(()=>(k.current=!0,()=>{k.current=!1}),[]),Qu(()=>{if(A&&(T.current=A),M&&(O.current=M),A&&M){if(Z.current)return Z.current(A,M,G);G()}},[A,M,G,Z,j]);const F=R.useMemo(()=>({reference:T,floating:O,setReference:N,setFloating:w}),[N,w]),z=R.useMemo(()=>({reference:A,floating:M}),[A,M]),L=R.useMemo(()=>{const H={position:r,left:0,top:0};if(!z.floating)return H;const X=TE(z.floating,p.x),Q=TE(z.floating,p.y);return f?{...H,transform:"translate("+X+"px, "+Q+"px)",...tT(z.floating)>=1.5&&{willChange:"transform"}}:{position:r,left:X,top:Q}},[r,f,z.floating,p.x,p.y]);return R.useMemo(()=>({...p,update:G,refs:F,elements:z,floatingStyles:L}),[p,G,F,z,L])}const wF=(e,t)=>{const r=mF(e);return{name:r.name,fn:r.fn,options:[e,t]}},CF=(e,t)=>{const r=pF(e);return{name:r.name,fn:r.fn,options:[e,t]}},TF=(e,t)=>({fn:xF(e).fn,options:[e,t]}),RF=(e,t)=>{const r=gF(e);return{name:r.name,fn:r.fn,options:[e,t]}},AF=(e,t)=>{const r=yF(e);return{name:r.name,fn:r.fn,options:[e,t]}},NF=(e,t)=>{const r=vF(e);return{name:r.name,fn:r.fn,options:[e,t]}};var Of=Symbol("NOT_FOUND");function MF(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function OF(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function DF(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(r=>typeof r=="function")){const r=e.map(i=>typeof i=="function"?`function ${i.name||"unnamed"}()`:typeof i).join(", ");throw new TypeError(`${t}[${r}]`)}}var RE=e=>Array.isArray(e)?e:[e];function zF(e){const t=Array.isArray(e[0])?e[0]:e;return DF(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function BF(e,t){const r=[],{length:i}=e;for(let a=0;a<i;a++)r.push(e[a].apply(null,t));return r}function UF(e){let t;return{get(r){return t&&e(t.key,r)?t.value:Of},put(r,i){t={key:r,value:i}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function LF(e,t){let r=[];function i(f){const h=r.findIndex(d=>t(f,d.key));if(h>-1){const d=r[h];return h>0&&(r.splice(h,1),r.unshift(d)),d.value}return Of}function a(f,h){i(f)===Of&&(r.unshift({key:f,value:h}),r.length>e&&r.pop())}function l(){return r}function u(){r=[]}return{get:i,put:a,getEntries:l,clear:u}}var kF=(e,t)=>e===t;function IF(e){return function(r,i){if(r===null||i===null||r.length!==i.length)return!1;const{length:a}=r;for(let l=0;l<a;l++)if(!e(r[l],i[l]))return!1;return!0}}function HF(e,t){const r=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:i=kF,maxSize:a=1,resultEqualityCheck:l}=r,u=IF(i);let f=0;const h=a<=1?UF(u):LF(a,u);function d(){let p=h.get(arguments);if(p===Of){if(p=e.apply(null,arguments),f++,l){const v=h.getEntries().find(x=>l(x.value,p));v&&(p=v.value,f!==0&&f--)}h.put(arguments,p)}return p}return d.clearCache=()=>{h.clear(),d.resetResultsCount()},d.resultsCount=()=>f,d.resetResultsCount=()=>{f=0},d}var FF=class{constructor(e){this.value=e}deref(){return this.value}},PF=typeof WeakRef<"u"?WeakRef:FF,jF=0,AE=1;function zu(){return{s:jF,v:void 0,o:null,p:null}}function nT(e,t={}){let r=zu();const{resultEqualityCheck:i}=t;let a,l=0;function u(){let f=r;const{length:h}=arguments;for(let g=0,v=h;g<v;g++){const x=arguments[g];if(typeof x=="function"||typeof x=="object"&&x!==null){let b=f.o;b===null&&(f.o=b=new WeakMap);const _=b.get(x);_===void 0?(f=zu(),b.set(x,f)):f=_}else{let b=f.p;b===null&&(f.p=b=new Map);const _=b.get(x);_===void 0?(f=zu(),b.set(x,f)):f=_}}const d=f;let p;if(f.s===AE)p=f.v;else if(p=e.apply(null,arguments),l++,i){const g=a?.deref?.()??a;g!=null&&i(g,p)&&(p=g,l!==0&&l--),a=typeof p=="object"&&p!==null||typeof p=="function"?new PF(p):p}return d.s=AE,d.v=p,p}return u.clearCache=()=>{r=zu(),u.resetResultsCount()},u.resultsCount=()=>l,u.resetResultsCount=()=>{l=0},u}function rT(e,...t){const r=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,i=(...a)=>{let l=0,u=0,f,h={},d=a.pop();typeof d=="object"&&(h=d,d=a.pop()),MF(d,`createSelector expects an output function after the inputs, but received: [${typeof d}]`);const p={...r,...h},{memoize:g,memoizeOptions:v=[],argsMemoize:x=nT,argsMemoizeOptions:b=[]}=p,_=RE(v),C=RE(b),E=zF(a),N=g(function(){return l++,d.apply(null,arguments)},..._),w=x(function(){u++;const M=BF(E,arguments);return f=N.apply(null,M),f},...C);return Object.assign(w,{resultFunc:d,memoizedResultFunc:N,dependencies:E,dependencyRecomputations:()=>u,resetDependencyRecomputations:()=>{u=0},lastResult:()=>f,recomputations:()=>l,resetRecomputations:()=>{l=0},memoize:g,argsMemoize:x})};return Object.assign(i,{withTypes:()=>i}),i}var VF=rT(nT),GF=Object.assign((e,t=VF)=>{OF(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const r=Object.keys(e),i=r.map(l=>e[l]);return t(i,(...l)=>l.reduce((u,f,h)=>(u[r[h]]=f,u),{}))},{withTypes:()=>GF});rT({memoize:HF,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const Fe=(e,t,r,i,a,l,...u)=>{if(u.length>0)throw new Error(ta(1));let f;if(e)f=e;else throw new Error("Missing arguments");return f};var oT=gw();const Wp=[];let Jp;function qF(){return Jp}function YF(e){Wp.push(e)}function XF(e){const t=(r,i)=>{const a=bn($F).current;let l;try{Jp=a;for(const u of Wp)u.before(a);l=e(r,i);for(const u of Wp)u.after(a);a.didInitialize=!0}finally{Jp=void 0}return l};return t.displayName=e.displayName||e.name,t}function $F(){return{didInitialize:!1}}const KF=ag(19),ZF=KF?WF:JF;function iT(e,t,r,i,a){return ZF(e,t,r,i,a)}function QF(e,t,r,i,a){const l=R.useCallback(()=>t(e.getSnapshot(),r,i,a),[e,t,r,i,a]);return oT.useSyncExternalStore(e.subscribe,l,l)}YF({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let r=0;r<e.syncHooks.length;r+=1){const i=e.syncHooks[r],a=i.selector(i.store.state,i.a1,i.a2,i.a3);(i.didChange||!Object.is(i.value,a))&&(t=!0,i.value=a,i.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const r=new Set;for(const a of e.syncHooks)r.add(a.store);const i=[];for(const a of r)i.push(a.subscribe(t));return()=>{for(const a of i)a()}}),oT.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function WF(e,t,r,i,a){const l=qF();if(!l)return QF(e,t,r,i,a);const u=l.syncIndex;l.syncIndex+=1;let f;return l.didInitialize?(f=l.syncHooks[u],(f.store!==e||f.selector!==t||!Object.is(f.a1,r)||!Object.is(f.a2,i)||!Object.is(f.a3,a))&&(f.store!==e&&(l.didChangeStore=!0),f.store=e,f.selector=t,f.a1=r,f.a2=i,f.a3=a,f.didChange=!0)):(f={store:e,selector:t,a1:r,a2:i,a3:a,value:t(e.getSnapshot(),r,i,a),didChange:!1},l.syncHooks.push(f)),f.value}function JF(e,t,r,i,a){return yw.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,l=>t(l,r,i,a))}class eP{constructor(t){this.state=t,this.listeners=new Set,this.updateTick=0}subscribe=t=>(this.listeners.add(t),()=>{this.listeners.delete(t)});getSnapshot=()=>this.state;setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const r=this.updateTick;for(const i of this.listeners){if(r!==this.updateTick)return;i(t)}}update(t){for(const r in t)if(!Object.is(this.state[r],t[r])){this.setState({...this.state,...t});return}}set(t,r){Object.is(this.state[t],r)||this.setState({...this.state,[t]:r})}notifyAll(){const t={...this.state};this.setState(t)}use(t,r,i,a){return iT(this,t,r,i,a)}}class sT extends eP{constructor(t,r={},i){super(t),this.context=r,this.selectors=i}useSyncedValue(t,r){R.useDebugValue(t),Be(()=>{this.state[t]!==r&&this.set(t,r)},[t,r])}useSyncedValueWithCleanup(t,r){const i=this;Be(()=>(i.state[t]!==r&&i.set(t,r),()=>{i.set(t,void 0)}),[i,t,r])}useSyncedValues(t){const r=this,i=Object.values(t);Be(()=>{r.update(t)},[r,...i])}useControlledProp(t,r){R.useDebugValue(t);const i=r!==void 0;Be(()=>{i&&!Object.is(this.state[t],r)&&super.setState({...this.state,[t]:r})},[t,r,i])}select(t,r,i,a){const l=this.selectors[t];return l(this.state,r,i,a)}useState(t,r,i,a){return R.useDebugValue(t),iT(this,this.selectors[t],r,i,a)}useContextCallback(t,r){R.useDebugValue(t);const i=Ve(r??fC);this.context[t]=i}useStateSetter(t){const r=R.useRef(void 0);return r.current===void 0&&(r.current=i=>{this.set(t,i)}),r.current}observe(t,r){let i;typeof t=="function"?i=t:i=this.selectors[t];let a=i(this.state);return r(a,a,this),this.subscribe(l=>{const u=i(l);if(!Object.is(a,u)){const f=a;a=u,r(u,f,this)}})}}const tP={open:Fe(e=>e.open),domReferenceElement:Fe(e=>e.domReferenceElement),referenceElement:Fe(e=>e.positionReference??e.referenceElement),floatingElement:Fe(e=>e.floatingElement),floatingId:Fe(e=>e.floatingId)};class _g extends sT{constructor(t){const{nested:r,noEmit:i,onOpenChange:a,triggerElements:l,...u}=t;super({...u,positionReference:u.referenceElement,domReferenceElement:u.referenceElement},{onOpenChange:a,dataRef:{current:{}},events:GC(),nested:r,noEmit:i,triggerElements:l},tP)}setOpen=(t,r)=>{if((!t||!this.state.open||GI(r.event))&&(this.context.dataRef.current.openEvent=t?r.event:void 0),!this.context.noEmit){const i={open:t,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",i)}this.context.onOpenChange?.(t,r)}}function nP(e){const t=e.useState("open");Be(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const r=e.context.triggerElements.entries().next();if(!r.done){const[i,a]=r.value;e.update({activeTriggerId:i,activeTriggerElement:a})}}},[t,e])}function rP(e,t,r){const{mounted:i,setMounted:a,transitionStatus:l}=II(e);t.useSyncedValues({mounted:i,transitionStatus:l});const u=Ve(()=>{a(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),r?.(),t.context.onOpenChangeComplete?.(!1)}),f=t.useState("preventUnmountingOnClose");return SC({enabled:!f,open:e,ref:t.context.popupRef,onComplete(){e||u()}}),{forceUnmount:u,transitionStatus:l}}class Eg{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,r){const i=this.idMap.get(t);i!==r&&(i!==void 0&&this.elementsSet.delete(i),this.elementsSet.add(r),this.idMap.set(t,r))}delete(t){const r=this.idMap.get(t);r&&(this.elementsSet.delete(r),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const r of this.elementsSet)if(t(r))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function oP(){return new _g({open:!1,floatingElement:null,referenceElement:null,triggerElements:new Eg,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function iP(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:"idle",floatingRootContext:oP(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:yn,inactiveTriggerProps:yn,popupProps:yn}}const Bu=Fe(e=>e.triggerIdProp??e.activeTriggerId),sP={open:Fe(e=>e.openProp??e.open),mounted:Fe(e=>e.mounted),transitionStatus:Fe(e=>e.transitionStatus),floatingRootContext:Fe(e=>e.floatingRootContext),preventUnmountingOnClose:Fe(e=>e.preventUnmountingOnClose),payload:Fe(e=>e.payload),activeTriggerId:Bu,activeTriggerElement:Fe(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:Fe((e,t)=>t!==void 0&&Bu(e)===t),isOpenedByTrigger:Fe((e,t)=>t!==void 0&&Bu(e)===t&&e.open),isMountedByTrigger:Fe((e,t)=>t!==void 0&&Bu(e)===t&&e.mounted),triggerProps:Fe((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:Fe(e=>e.popupProps),popupElement:Fe(e=>e.popupElement),positionerElement:Fe(e=>e.positionerElement)};function aP(e){const{open:t=!1,onOpenChange:r,elements:i={}}=e,a=Qo(),l=ti()!=null,u=bn(()=>new _g({open:t,onOpenChange:r,referenceElement:i.reference??null,floatingElement:i.floating??null,triggerElements:new Eg,floatingId:a,nested:l,noEmit:!1})).current;return Be(()=>{const f={open:t,floatingId:a};i.reference!==void 0&&(f.referenceElement=i.reference,f.domReferenceElement=xt(i.reference)?i.reference:null),i.floating!==void 0&&(f.floatingElement=i.floating),u.update(f)},[t,a,i.reference,i.floating,u]),u.context.onOpenChange=r,u.context.nested=l,u.context.noEmit=!1,u}function lP(e={}){const{nodeId:t,externalTree:r}=e,i=aP(e),a=e.rootContext||i,l={reference:a.useState("referenceElement"),floating:a.useState("floatingElement"),domReference:a.useState("domReferenceElement")},[u,f]=R.useState(null),h=R.useRef(null),d=oa(r);Be(()=>{l.domReference&&(h.current=l.domReference)},[l.domReference]);const p=SF({...e,elements:{...l,...u&&{reference:u}}}),g=R.useCallback(O=>{const I=xt(O)?{getBoundingClientRect:()=>O.getBoundingClientRect(),getClientRects:()=>O.getClientRects(),contextElement:O}:O;f(I),p.refs.setReference(I)},[p.refs]),[v,x]=R.useState(null),[b,_]=R.useState(null);a.useSyncedValue("referenceElement",v),a.useSyncedValue("domReferenceElement",xt(v)?v:null),a.useSyncedValue("floatingElement",b);const C=R.useCallback(O=>{(xt(O)||O===null)&&(h.current=O,x(O)),(xt(p.refs.reference.current)||p.refs.reference.current===null||O!==null&&!xt(O))&&p.refs.setReference(O)},[p.refs,x]),E=R.useCallback(O=>{_(O),p.refs.setFloating(O)},[p.refs]),N=R.useMemo(()=>({...p.refs,setReference:C,setFloating:E,setPositionReference:g,domReference:h}),[p.refs,C,E,g]),w=R.useMemo(()=>({...p.elements,domReference:l.domReference}),[p.elements,l.domReference]),A=a.useState("open"),M=a.useState("floatingId"),T=R.useMemo(()=>({...p,dataRef:a.context.dataRef,open:A,onOpenChange:a.setOpen,events:a.context.events,floatingId:M,refs:N,elements:w,nodeId:t,rootStore:a}),[p,N,w,t,a,A,M]);return Be(()=>{a.context.dataRef.current.floatingContext=T;const O=d?.nodesRef.current.find(I=>I.id===t);O&&(O.context=T)}),R.useMemo(()=>({...p,context:T,refs:N,elements:w,rootStore:a}),[p,N,w,T,a])}function cP(e){const{popupStore:t,noEmit:r=!1,treatPopupAsFloatingElement:i=!1,onOpenChange:a}=e,l=Qo(),u=ti()!=null,f=t.useState("open"),h=t.useState("activeTriggerElement"),d=t.useState(i?"popupElement":"positionerElement"),p=t.context.triggerElements,g=bn(()=>new _g({open:f,referenceElement:h,floatingElement:d,triggerElements:p,onOpenChange:a,floatingId:l,nested:u,noEmit:r})).current;return Be(()=>{const v={open:f,floatingId:l,referenceElement:h,floatingElement:d};xt(h)&&(v.domReferenceElement=h),g.state.positionReference===g.state.referenceElement&&(v.positionReference=h),g.update(v)},[f,l,h,d,g]),g.context.onOpenChange=a,g.context.nested=u,g.context.noEmit=r,g}const uP=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${TC}`;function fP(e){return e?!!e.closest(uP):!1}class Sg{constructor(){this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.pointerEventsScopeElement=null,this.pointerEventsReferenceElement=null,this.pointerEventsFloatingElement=null,this.restTimeoutPending=!1,this.openChangeTimeout=new ro,this.restTimeout=new ro,this.handleCloseOptions=void 0}static create(){return new Sg}dispose=()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()};disposeEffect=()=>this.dispose}function aT(e){e.performedPointerEventsMutation&&(e.pointerEventsScopeElement?.style.removeProperty("pointer-events"),e.pointerEventsReferenceElement?.style.removeProperty("pointer-events"),e.pointerEventsFloatingElement?.style.removeProperty("pointer-events"),e.performedPointerEventsMutation=!1,e.pointerEventsScopeElement=null,e.pointerEventsReferenceElement=null,e.pointerEventsFloatingElement=null)}function dP(e,t){const{scopeElement:r,referenceElement:i,floatingElement:a}=t;aT(e),e.performedPointerEventsMutation=!0,e.pointerEventsScopeElement=r,e.pointerEventsReferenceElement=i,e.pointerEventsFloatingElement=a,r.style.pointerEvents="none",i.style.pointerEvents="auto",a.style.pointerEvents="auto"}function hP(e){const t=bn(Sg.create).current,r=e.context.dataRef.current;return r.hoverInteractionState||(r.hoverInteractionState=t),hg(r.hoverInteractionState.disposeEffect),r.hoverInteractionState}function mP(e,t={}){const r="rootStore"in e?e.rootStore:e,i=r.useState("open"),a=r.useState("floatingElement"),l=r.useState("domReferenceElement"),{dataRef:u}=r.context,{enabled:f=!0,closeDelay:h=0}=t,d=hP(r),p=oa(),g=ti(),v=Ve(()=>EH(u.current.openEvent?.type,d.interactedInside)),x=Ve(()=>{const w=u.current.openEvent?.type;return w?.includes("mouse")&&w!=="mousedown"}),b=Ve(w=>FI(w,r.context.triggerElements)),_=R.useCallback(w=>{const A=_H(h,"close",d.pointerType),M=()=>{r.setOpen(!1,It(Hi,w)),p?.events.emit("floating.closed",w)};A?d.openChangeTimeout.start(A,M):(d.openChangeTimeout.clear(),M())},[h,r,d,p]),C=Ve(()=>{aT(d)}),E=Ve(w=>{const A=Mn(w);if(!fP(A)){d.interactedInside=!1;return}d.interactedInside=A?.closest("[aria-haspopup]")!=null});Be(()=>{i||(d.pointerType=void 0,d.restTimeoutPending=!1,d.interactedInside=!1,C())},[i,d,C]),R.useEffect(()=>C,[C]),Be(()=>{if(f&&i&&d.handleCloseOptions?.blockPointerEvents&&x()&&xt(l)&&a){const w=l,A=a,M=yt(a),T=p?.nodesRef.current.find(I=>I.id===g)?.context?.elements.floating;T&&(T.style.pointerEvents="");const O=d.handleCloseOptions?.getScope?.()??d.pointerEventsScopeElement??T??w.closest("[data-rootownerid]")??M.body;return dP(d,{scopeElement:O,referenceElement:w,floatingElement:A}),()=>{C()}}},[f,i,l,a,d,x,p,g,C]);const N=sr();R.useEffect(()=>{if(!f)return;function w(){d.openChangeTimeout.clear(),N.clear(),p?.events.off("floating.closed",M),C()}function A(O){if(p&&g&&Xo(p.nodesRef.current,g).length>0){p.events.on("floating.closed",M);return}if(!b(O.relatedTarget)){if(d.handler){d.handler(O);return}C(),v()||_(O)}}function M(O){!p||!g||Xo(p.nodesRef.current,g).length>0||N.start(0,()=>{p.events.off("floating.closed",M),r.setOpen(!1,It(Hi,O)),p.events.emit("floating.closed",O)})}const T=a;return T&&(T.addEventListener("mouseenter",w),T.addEventListener("mouseleave",A),T.addEventListener("pointerdown",E,!0)),()=>{T&&(T.removeEventListener("mouseenter",w),T.removeEventListener("mouseleave",A),T.removeEventListener("pointerdown",E,!0)),p?.events.off("floating.closed",M)}},[f,a,r,u,v,b,_,C,E,d,p,g,N])}function pP(e=[]){const t=e.map(d=>d?.reference),r=e.map(d=>d?.floating),i=e.map(d=>d?.item),a=e.map(d=>d?.trigger),l=R.useCallback(d=>Uu(d,e,"reference"),t),u=R.useCallback(d=>Uu(d,e,"floating"),r),f=R.useCallback(d=>Uu(d,e,"item"),i),h=R.useCallback(d=>Uu(d,e,"trigger"),a);return R.useMemo(()=>({getReferenceProps:l,getFloatingProps:u,getItemProps:f,getTriggerProps:h}),[l,u,f,h])}function Uu(e,t,r){const i=new Map,a=r==="item",l={};r==="floating"&&(l.tabIndex=-1,l[qp]="");for(const u in e)a&&e&&(u===wC||u===CC)||(l[u]=e[u]);for(let u=0;u<t.length;u+=1){let f;const h=t[u]?.[r];typeof h=="function"?f=e?h(e):null:f=h,f&&NE(l,f,a,i)}return NE(l,e,a,i),l}function NE(e,t,r,i){for(const a in t){const l=t[a];r&&(a===wC||a===CC)||(a.startsWith("on")?(i.has(a)||i.set(a,[]),typeof l=="function"&&(i.get(a)?.push(l),e[a]=(...u)=>i.get(a)?.map(f=>f(...u)).find(f=>f!==void 0))):e[a]=l)}}const gP="Escape";function dd(e,t,r){switch(e){case"vertical":return t;case"horizontal":return r;default:return t||r}}function Lu(e,t){return dd(t,e===mg||e===$l,e===qo||e===Yo)}function up(e,t,r){return dd(t,e===$l,r?e===qo:e===Yo)||e==="Enter"||e===" "||e===""}function yP(e,t,r){return dd(t,r?e===qo:e===Yo,e===$l)}function vP(e,t,r,i){const a=r?e===Yo:e===qo,l=e===mg;return t==="both"||t==="horizontal"&&i&&i>1?e===gP:dd(t,a,l)}function xP(e,t){const r="rootStore"in e?e.rootStore:e,i=r.useState("open"),a=r.useState("floatingElement"),l=r.useState("domReferenceElement"),u=r.context.dataRef,{listRef:f,activeIndex:h,onNavigate:d=()=>{},enabled:p=!0,selectedIndex:g=null,allowEscape:v=!1,loopFocus:x=!1,nested:b=!1,rtl:_=!1,virtual:C=!1,focusItemOnOpen:E="auto",focusItemOnHover:N=!0,openOnArrowKeyDown:w=!0,disabledIndices:A=void 0,orientation:M="vertical",parentOrientation:T,cols:O=1,id:I,resetOnPointerLeave:j=!0,externalTree:Z}=t,P=xf(a),q=nr(P),G=ti(),k=oa(Z);Be(()=>{u.current.orientation=M},[u,M]);const F=Yp(l),z=R.useRef(E),L=R.useRef(g??-1),H=R.useRef(null),X=R.useRef(!0),Q=Ve(le=>{d(L.current===-1?null:L.current,le)}),U=R.useRef(Q),V=R.useRef(!!a),ee=R.useRef(i),J=R.useRef(!1),fe=R.useRef(!1),ye=nr(A),he=nr(i),ae=nr(g),be=nr(j),ve=Ve(()=>{function le(Se){C?k?.events.emit("virtualfocus",Se):ml(Se,{sync:J.current,preventScroll:!0})}const se=f.current[L.current],K=fe.current;se&&le(se),(J.current?Se=>Se():requestAnimationFrame)(()=>{const Se=f.current[L.current]||se;if(!Se)return;se||le(Se),we&&(K||!X.current)&&Se.scrollIntoView?.({block:"nearest",inline:"nearest"})})});Be(()=>{p&&(i&&a?(L.current=g??-1,z.current&&g!=null&&(fe.current=!0,Q())):V.current&&(L.current=-1,U.current()))},[p,i,a,g,Q]),Be(()=>{if(p){if(!i){J.current=!1;return}if(a)if(h==null){if(J.current=!1,ae.current!=null)return;if(V.current&&(L.current=-1,ve()),(!ee.current||!V.current)&&z.current&&(H.current!=null||z.current===!0&&H.current==null)){let le=0;const se=()=>{f.current[0]==null?(le<2&&(le?requestAnimationFrame:queueMicrotask)(se),le+=1):(L.current=H.current==null||up(H.current,M,_)||b?rp(f):cE(f),H.current=null,Q())};se()}}else Sf(f,h)||(L.current=h,ve(),fe.current=!1)}},[p,i,a,h,ae,b,f,M,_,Q,ve,ye]),Be(()=>{if(!p||a||!k||C||!V.current)return;const le=k.nodesRef.current,se=le.find(Se=>Se.id===G)?.context?.elements.floating,K=gr(yt(a)),ge=le.some(Se=>Se.context&&We(Se.context.elements.floating,K));se&&!ge&&X.current&&se.focus({preventScroll:!0})},[p,a,k,G,C]),Be(()=>{U.current=Q,ee.current=i,V.current=!!a}),Be(()=>{i||(H.current=null,z.current=E)},[i,E]);const Te=h!=null,we=R.useMemo(()=>{function le(K){if(!he.current)return;const ge=f.current.indexOf(K.currentTarget);ge!==-1&&L.current!==ge&&(L.current=ge,Q(K))}return{onFocus(K){J.current=!0,le(K)},onClick:({currentTarget:K})=>K.focus({preventScroll:!0}),onMouseMove(K){J.current=!0,fe.current=!1,N&&le(K)},onPointerLeave(K){if(!he.current||!X.current||K.pointerType==="touch")return;J.current=!0;const ge=K.relatedTarget;if(!(!N||f.current.includes(ge))&&be.current&&(ml(null,{sync:!0}),L.current=-1,Q(K),!C)){const Se=q.current,_e=gr(yt(Se));Se&&We(Se,_e)&&Se.focus({preventScroll:!0})}}}},[he,q,N,f,Q,be,C]),xe=R.useCallback(()=>T??k?.nodesRef.current.find(le=>le.id===G)?.context?.dataRef?.current.orientation,[G,k,T]),Ee=Ve(le=>{if(X.current=!1,J.current=!0,le.which===229||!he.current&&le.currentTarget===q.current)return;if(b&&vP(le.key,M,_,O)){Lu(le.key,xe())||gn(le),r.setOpen(!1,It(Zu,le.nativeEvent)),Mt(l)&&(C?k?.events.emit("virtualfocus",l):l.focus());return}const se=L.current,K=rp(f,A),ge=cE(f,A);if(F||(le.key==="Home"&&(gn(le),L.current=K,Q(le)),le.key==="End"&&(gn(le),L.current=ge,Q(le))),O>1){const Se=Array.from({length:f.current.length},()=>({width:1,height:1})),_e=tH(Se,O),Je=_e.findIndex(at=>at!=null&&!Fs(f,at,A)),st=_e.reduce((at,Qe,He)=>Qe!=null&&!Fs(f,Qe,A)?He:at,-1),ft=_e[eH({current:_e.map(at=>at!=null?f.current[at]:null)},{event:le,orientation:M,loopFocus:x,rtl:_,cols:O,disabledIndices:rH([...(typeof A!="function"?A:null)||f.current.map((at,Qe)=>Fs(f,Qe,A)?Qe:void 0),void 0],_e),minIndex:Je,maxIndex:st,prevIndex:nH(L.current>ge?K:L.current,Se,_e,O,le.key===$l?"bl":le.key===(_?qo:Yo)?"tr":"tl"),stopEvent:!0})];if(ft!=null&&(L.current=ft,Q(le)),M==="both")return}if(Lu(le.key,M)){if(gn(le),i&&!C&&gr(le.currentTarget.ownerDocument)===le.currentTarget){L.current=up(le.key,M,_)?K:ge,Q(le);return}up(le.key,M,_)?x?se>=ge?v&&se!==f.current.length?L.current=-1:(J.current=!1,L.current=K):L.current=rn(f,{startingIndex:se,disabledIndices:A}):L.current=Math.min(ge,rn(f,{startingIndex:se,disabledIndices:A})):x?se<=K?v&&se!==-1?L.current=f.current.length:(J.current=!1,L.current=ge):L.current=rn(f,{startingIndex:se,decrement:!0,disabledIndices:A}):L.current=Math.max(K,rn(f,{startingIndex:se,decrement:!0,disabledIndices:A})),Sf(f,L.current)&&(L.current=-1),Q(le)}}),Ce=R.useMemo(()=>C&&i&&Te&&{"aria-activedescendant":`${I}-${h}`},[C,i,Te,I,h]),ie=R.useMemo(()=>({"aria-orientation":M==="both"?void 0:M,...F?{}:Ce,onKeyDown(le){if(le.key==="Tab"&&le.shiftKey&&i&&!C){const se=Mn(le.nativeEvent);if(se&&!We(q.current,se))return;gn(le),r.setOpen(!1,It(id,le.nativeEvent)),Mt(l)&&l.focus();return}Ee(le)},onPointerMove(){X.current=!0}}),[Ce,Ee,q,M,F,r,i,C,l]),re=R.useMemo(()=>{function le(K){E==="auto"&&AC(K.nativeEvent)&&(z.current=!C)}function se(K){z.current=E,E==="auto"&&NC(K.nativeEvent)&&(z.current=!0)}return{onKeyDown(K){const ge=r.select("open");X.current=!1;const Se=K.key.startsWith("Arrow"),_e=yP(K.key,xe(),_),Je=Lu(K.key,M),st=(b?_e:Je)||K.key==="Enter"||K.key.trim()==="";if(C&&ge)return Ee(K);if(!(!ge&&!w&&Se)){if(st){const ft=Lu(K.key,xe());H.current=b&&ft?null:K.key}if(b){_e&&(gn(K),ge?(L.current=rp(f,ye.current),Q(K)):r.setOpen(!0,It(Zu,K.nativeEvent,K.currentTarget)));return}Je&&(ae.current!=null&&(L.current=ae.current),gn(K),!ge&&w?r.setOpen(!0,It(Zu,K.nativeEvent,K.currentTarget)):Ee(K),ge&&Q(K))}},onFocus(K){r.select("open")&&!C&&(L.current=-1,Q(K))},onPointerDown:se,onPointerEnter:se,onMouseDown:le,onClick:le}},[Ee,ye,E,f,b,Q,r,w,M,xe,_,ae,C]),ue=R.useMemo(()=>({...Ce,...re}),[Ce,re]);return R.useMemo(()=>p?{reference:ue,floating:ie,item:we,trigger:re}:{},[p,ue,ie,re,we])}const bP=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function _P(e,t={}){const r="rootStore"in e?e.rootStore:e,i=r.useState("open"),a=r.useState("floatingId"),l=r.useState("domReferenceElement"),u=r.useState("floatingElement"),{role:f="dialog"}=t,h=Qo(),d=l?.id||h,p=R.useMemo(()=>xf(u)?.id||a,[u,a]),g=bP.get(f)??f,x=ti()!=null,b=R.useMemo(()=>g==="tooltip"||f==="label"?yn:{"aria-haspopup":g==="alertdialog"?"dialog":g,"aria-expanded":"false",...g==="listbox"&&{role:"combobox"},...g==="menu"&&x&&{role:"menuitem"},...f==="select"&&{"aria-autocomplete":"none"},...f==="combobox"&&{"aria-autocomplete":"list"}},[g,x,f]),_=R.useMemo(()=>g==="tooltip"||f==="label"?{[`aria-${f==="label"?"labelledby":"describedby"}`]:i?p:void 0}:{...b,"aria-expanded":i?"true":"false","aria-controls":i?p:void 0,...g==="menu"&&{id:d}},[g,p,i,d,f,b]),C=R.useMemo(()=>{const N={id:p,...g&&{role:g}};return g==="tooltip"||f==="label"?N:{...N,...g==="menu"&&{"aria-labelledby":d}}},[g,p,d,f]),E=R.useCallback(({active:N,selected:w})=>{const A={role:"option",...N&&{id:`${p}-fui-option`}};switch(f){case"select":case"combobox":return{...A,"aria-selected":w}}return{}},[p,f]);return R.useMemo(()=>({reference:_,floating:C,item:E,trigger:b}),[_,C,b,E])}function EP(e,t){const r="rootStore"in e?e.rootStore:e,i=r.context.dataRef,a=r.useState("open"),{listRef:l,elementsRef:u,activeIndex:f,onMatch:h,onTypingChange:d,enabled:p=!0,resetMs:g=750,selectedIndex:v=null}=t,x=sr(),b=R.useRef(""),_=R.useRef(v??f??-1),C=R.useRef(null);Be(()=>{!a&&v!==null||(x.clear(),C.current=null,b.current!==""&&(b.current=""))},[a,v,x]),Be(()=>{a&&b.current===""&&(_.current=v??f??-1)},[a,v,f]);const E=Ve(T=>{T?i.current.typing||(i.current.typing=T,d?.(T)):i.current.typing&&(i.current.typing=T,d?.(T))}),N=Ve(T=>{function O(F){const z=u?.current[F];return!z||vg(z)}function I(F,z,L=0){if(F.length===0)return-1;const H=(L%F.length+F.length)%F.length,X=z.toLocaleLowerCase();for(let Q=0;Q<F.length;Q+=1){const U=(H+Q)%F.length;if(!(!F[U]?.toLocaleLowerCase().startsWith(X)||!O(U)))return U}return-1}const j=l.current;if(b.current.length>0&&T.key===" "&&(gn(T),E(!0)),b.current.length>0&&b.current[0]!==" "&&I(j,b.current)===-1&&T.key!==" "&&E(!1),j==null||T.key.length!==1||T.ctrlKey||T.metaKey||T.altKey)return;a&&T.key!==" "&&(gn(T),E(!0));const Z=b.current==="";Z&&(_.current=v??f??-1),j.every(F=>F?F[0]?.toLocaleLowerCase()!==F[1]?.toLocaleLowerCase():!0)&&b.current===T.key&&(b.current="",_.current=C.current),b.current+=T.key,x.start(g,()=>{b.current="",_.current=C.current,E(!1)});const G=((Z?v??f??-1:_.current)??0)+1,k=I(j,b.current,G);k!==-1?(h?.(k),C.current=k):T.key!==" "&&(b.current="",E(!1))}),w=Ve(T=>{const O=T.relatedTarget,I=r.select("domReferenceElement"),j=r.select("floatingElement"),Z=We(I,O),P=We(j,O);Z||P||(x.clear(),b.current="",_.current=C.current,E(!1))}),A=R.useMemo(()=>({onKeyDown:N,onBlur:w}),[N,w]),M=R.useMemo(()=>({onKeyDown:N,onBlur:w}),[N,w]);return R.useMemo(()=>p?{reference:A,floating:M}:{},[p,A,M])}const SP=R.createContext(void 0);function wP(e){return R.useContext(SP)}const lT="ArrowUp",cT="ArrowDown",uT="ArrowLeft",fT="ArrowRight",dT="Home",hT="End",CP=new Set([uT,fT]),TP=new Set([lT,cT]),RP=new Set([...CP,...TP]);[...RP];const AP=new Set([lT,cT,uT,fT,dT,hT]);function mT(e){return e==="starting"?Gk:yn}const NP={...cg,...dC},MP=R.forwardRef(function(t,r){const{render:i,className:a,finalFocus:l,...u}=t,{store:f}=Vi(),{side:h,align:d}=sC(),p=wP()!=null,g=f.useState("open"),v=f.useState("transitionStatus"),x=f.useState("popupProps"),b=f.useState("mounted"),_=f.useState("instantType"),C=f.useState("activeTriggerElement"),E=f.useState("parent"),N=f.useState("lastOpenChangeReason"),w=f.useState("rootId"),A=f.useState("floatingRootContext"),M=f.useState("floatingTreeRoot"),T=f.useState("closeDelay"),O=f.useState("activeTriggerElement"),I=E.type==="context-menu";SC({open:g,ref:f.context.popupRef,onComplete(){g&&f.context.onOpenChangeComplete?.(!0)}}),R.useEffect(()=>{function F(z){f.setOpen(!1,It(z.reason,z.domEvent))}return M.events.on("close",F),()=>{M.events.off("close",F)}},[M.events,f]);const j=f.useState("hoverEnabled"),Z=f.useState("disabled");mP(A,{enabled:j&&!Z&&!I&&E.type!=="menubar",closeDelay:T});const P={transitionStatus:v,side:h,align:d,open:g,nested:E.type==="menu",instant:_},q=R.useCallback(F=>{f.set("popupElement",F)},[f]),G=na("div",t,{state:P,ref:[r,f.context.popupRef,q],stateAttributesMapping:NP,props:[x,{onKeyDown(F){p&&AP.has(F.key)&&F.stopPropagation()}},mT(v),u,{"data-rootownerid":w}]});let k=E.type===void 0||I;return(C||E.type==="menubar"&&N!==ug)&&(k=!0),D.jsx(IH,{context:A,modal:I,disabled:!b,returnFocus:l===void 0?k:l,initialFocus:E.type!=="menu",restoreFocus:!0,externalTree:E.type!=="menubar"?M:void 0,previousFocusableElement:O,nextFocusableElement:E.type===void 0?f.context.triggerFocusTargetRef:void 0,beforeContentFocusGuardRef:E.type===void 0?f.context.beforeContentFocusGuardRef:void 0,children:G})}),pT=R.createContext(void 0);function OP(){const e=R.useContext(pT);if(e===void 0)throw new Error(ta(32));return e}const DP=R.forwardRef(function(t,r){const{keepMounted:i=!1,...a}=t,{store:l}=Vi();return l.useState("mounted")||i?D.jsx(pT.Provider,{value:i,children:D.jsx(MH,{ref:r,...a})}):null});function zP(e){return ag(19)?e:e?"true":void 0}const BP=R.createContext(void 0);function gT(){return R.useContext(BP)?.direction??"ltr"}const UP=e=>({name:"arrow",options:e,async fn(t){const{x:r,y:i,placement:a,rects:l,platform:u,elements:f,middlewareData:h}=t,{element:d,padding:p=0,offsetParent:g="real"}=oo(e,t)||{};if(d==null)return{};const v=MC(p),x={x:r,y:i},b=yg(a),_=gg(b),C=await u.getDimensions(d),E=b==="y",N=E?"top":"left",w=E?"bottom":"right",A=E?"clientHeight":"clientWidth",M=l.reference[_]+l.reference[b]-x[b]-l.floating[_],T=x[b]-l.reference[b],O=g==="real"?await u.getOffsetParent?.(d):f.floating;let I=f.floating[A]||l.floating[_];(!I||!await u.isElement?.(O))&&(I=f.floating[A]||l.floating[_]);const j=M/2-T/2,Z=I/2-C[_]/2-1,P=Math.min(v[N],Z),q=Math.min(v[w],Z),G=P,k=I-C[_]-q,F=I/2-C[_]/2+j,z=Xp(G,F,k),L=!h.arrow&&ei(a)!=null&&F!==z&&l.reference[_]/2-(F<G?P:q)-C[_]/2<0,H=L?F<G?F-G:F-k:0;return{[b]:x[b]+H,data:{[b]:z,centerOffset:F-z-H,...L&&{alignmentOffset:H}},reset:L}}}),LP=(e,t)=>({...UP(e),options:[e,t]}),kP={name:"hide",async fn(e){const{width:t,height:r,x:i,y:a}=e.rects.reference,l=t===0&&r===0&&i===0&&a===0;return{data:{referenceHidden:(await NF().fn(e)).data?.referenceHidden||l}}}},Wu={sideX:"left",sideY:"top"},IP={name:"adaptiveOrigin",async fn(e){const{x:t,y:r,rects:{floating:i},elements:{floating:a},platform:l,strategy:u,placement:f}=e,h=Xt(a),d=h.getComputedStyle(a);if(!(d.transitionDuration!=="0s"&&d.transitionDuration!==""))return{x:t,y:r,data:Wu};const g=await l.getOffsetParent?.(a);let v={width:0,height:0};if(u==="fixed"&&h?.visualViewport)v={width:h.visualViewport.width,height:h.visualViewport.height};else if(g===h){const N=yt(a);v={width:N.documentElement.clientWidth,height:N.documentElement.clientHeight}}else await l.isElement?.(g)&&(v=await l.getDimensions(g));const x=xn(f);let b=t,_=r;x==="left"&&(b=v.width-(t+i.width)),x==="top"&&(_=v.height-(r+i.height));const C=x==="left"?"right":Wu.sideX,E=x==="top"?"bottom":Wu.sideY;return{x:b,y:_,data:{sideX:C,sideY:E}}}};function yT(e,t,r){const i=e==="inline-start"||e==="inline-end";return{top:"top",right:i?r?"inline-start":"inline-end":"right",bottom:"bottom",left:i?r?"inline-end":"inline-start":"left"}[t]}function ME(e,t,r){const{rects:i,placement:a}=e;return{side:yT(t,xn(a),r),align:ei(a)||"center",anchor:{width:i.reference.width,height:i.reference.height},positioner:{width:i.floating.width,height:i.floating.height}}}function HP(e){const{anchor:t,positionMethod:r="absolute",side:i="bottom",sideOffset:a=0,align:l="center",alignOffset:u=0,collisionBoundary:f,collisionPadding:h=5,sticky:d=!1,arrowPadding:p=5,disableAnchorTracking:g=!1,keepMounted:v=!1,floatingRootContext:x,mounted:b,collisionAvoidance:_,shiftCrossAxis:C=!1,nodeId:E,adaptiveOrigin:N,lazyFlip:w=!1,externalTree:A}=e,[M,T]=R.useState(null);!b&&M!==null&&T(null);const O=_.side||"flip",I=_.align||"flip",j=_.fallbackAxisSide||"end",Z=typeof t=="function"?t:void 0,P=Ve(Z),q=Z?P:t,G=nr(t),F=gT()==="rtl",z=M||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":F?"left":"right","inline-start":F?"right":"left"}[i],L=l==="center"?z:`${z}-${l}`;let H=h;const X=1,Q=i==="bottom"?X:0,U=i==="top"?X:0,V=i==="right"?X:0,ee=i==="left"?X:0;typeof H=="number"?H={top:H+Q,right:H+ee,bottom:H+U,left:H+V}:H&&(H={top:(H.top||0)+Q,right:(H.right||0)+ee,bottom:(H.bottom||0)+U,left:(H.left||0)+V});const J={boundary:f==="clipping-ancestors"?"clippingAncestors":f,padding:H},fe=R.useRef(null),ye=nr(a),he=nr(u),ve=[wF(Ze=>{const Ct=ME(Ze,i,F),qt=typeof ye.current=="function"?ye.current(Ct):ye.current,Et=typeof he.current=="function"?he.current(Ct):he.current;return{mainAxis:qt,crossAxis:Et,alignmentAxis:Et}},[typeof a!="function"?a:0,typeof u!="function"?u:0,F,i])],Te=I==="none"&&O!=="shift",we=!Te&&(d||C||O==="shift"),xe=O==="none"?null:RF({...J,padding:{top:H.top+X,right:H.right+X,bottom:H.bottom+X,left:H.left+X},mainAxis:!C&&O==="flip",crossAxis:I==="flip"?"alignment":!1,fallbackAxisSideDirection:j}),Ee=Te?null:CF(Ze=>{const Ct=yt(Ze.elements.floating).documentElement;return{...J,rootBoundary:C?{x:0,y:0,width:Ct.clientWidth,height:Ct.clientHeight}:void 0,mainAxis:I!=="none",crossAxis:we,limiter:d||C?void 0:TF(qt=>{if(!fe.current)return{};const{width:Et,height:Pt}=fe.current.getBoundingClientRect(),Ot=qn(xn(qt.placement)),$t=Ot==="y"?Et:Pt,_n=Ot==="y"?H.left+H.right:H.top+H.bottom;return{offset:$t/2+_n/2}})}},[J,d,C,H,I]);O==="shift"||I==="shift"||l==="center"?ve.push(Ee,xe):ve.push(xe,Ee),ve.push(AF({...J,apply({elements:{floating:Ze},availableWidth:Ct,availableHeight:qt,rects:Et}){const Pt=Ze.style;Pt.setProperty("--available-width",`${Ct}px`),Pt.setProperty("--available-height",`${qt}px`);const Ot=window.devicePixelRatio||1,{x:$t,y:_n,width:Un,height:ni}=Et.reference,so=(Math.round(($t+Un)*Ot)-Math.round($t*Ot))/Ot,Nr=(Math.round((_n+ni)*Ot)-Math.round(_n*Ot))/Ot;Pt.setProperty("--anchor-width",`${so}px`),Pt.setProperty("--anchor-height",`${Nr}px`)}}),LP(()=>({element:fe.current||document.createElement("div"),padding:p,offsetParent:"floating"}),[p]),{name:"transformOrigin",fn(Ze){const{elements:Ct,middlewareData:qt,placement:Et,rects:Pt,y:Ot}=Ze,$t=xn(Et),_n=qn($t),Un=fe.current,ni=qt.arrow?.x||0,so=qt.arrow?.y||0,Nr=Un?.clientWidth||0,Mr=Un?.clientHeight||0,ri=ni+Nr/2,oi=so+Mr/2,Gi=Math.abs(qt.shift?.y||0),qi=Pt.reference.height/2,Yn=typeof a=="function"?a(ME(Ze,i,F)):a,ii=Gi>Yn,Yi={top:`${ri}px calc(100% + ${Yn}px)`,bottom:`${ri}px ${-Yn}px`,left:`calc(100% + ${Yn}px) ${oi}px`,right:`${-Yn}px ${oi}px`}[$t],Xi=`${ri}px ${Pt.reference.y+qi-Ot}px`;return Ct.floating.style.setProperty("--transform-origin",we&&_n==="y"&&ii?Xi:Yi),{}}},kP,N),Be(()=>{!b&&x&&x.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[b,x]);const Ce=R.useMemo(()=>({elementResize:!g&&typeof ResizeObserver<"u",layoutShift:!g&&typeof IntersectionObserver<"u"}),[g]),{refs:ie,elements:re,x:ue,y:le,middlewareData:se,update:K,placement:ge,context:Se,isPositioned:_e,floatingStyles:Je}=lP({rootContext:x,placement:L,middleware:ve,strategy:r,whileElementsMounted:v?void 0:(...Ze)=>CE(...Ze,Ce),nodeId:E,externalTree:A}),{sideX:st,sideY:ft}=se.adaptiveOrigin||Wu,at=_e?r:"fixed",Qe=R.useMemo(()=>{const Ze=N?{position:at,[st]:ue,[ft]:le}:{position:at,...Je};return _e||(Ze.opacity=0),Ze},[N,at,st,ue,ft,le,Je,_e]),He=R.useRef(null);Be(()=>{if(!b)return;const Ze=G.current,Ct=typeof Ze=="function"?Ze():Ze,Et=(OE(Ct)?Ct.current:Ct)||null||null;Et!==He.current&&(ie.setPositionReference(Et),He.current=Et)},[b,ie,q,G]),R.useEffect(()=>{if(!b)return;const Ze=G.current;typeof Ze!="function"&&OE(Ze)&&Ze.current!==He.current&&(ie.setPositionReference(Ze.current),He.current=Ze.current)},[b,ie,q,G]),R.useEffect(()=>{if(v&&b&&re.domReference&&re.floating)return CE(re.domReference,re.floating,K,Ce)},[v,b,re,K,Ce]);const _t=xn(ge),an=yT(i,_t,F),ze=ei(ge)||"center",Oe=!!se.hide?.referenceHidden;Be(()=>{w&&b&&_e&&T(_t)},[w,b,_e,_t]);const rt=R.useMemo(()=>({position:"absolute",top:se.arrow?.y,left:se.arrow?.x}),[se.arrow]),wt=se.arrow?.centerOffset!==0;return R.useMemo(()=>({positionerStyles:Qe,arrowStyles:rt,arrowRef:fe,arrowUncentered:wt,side:an,align:ze,physicalSide:_t,anchorHidden:Oe,refs:ie,context:Se,isPositioned:_e,update:K}),[Qe,rt,fe,wt,an,ze,_t,Oe,ie,Se,_e,K])}function OE(e){return e!=null&&"current"in e}function FP(e){const{children:t,elementsRef:r,labelsRef:i,onMapChange:a}=e,l=Ve(a),u=R.useRef(0),f=bn(jP).current,h=bn(PP).current,[d,p]=R.useState(0),g=R.useRef(d),v=Ve((E,N)=>{h.set(E,N??null),g.current+=1,p(g.current)}),x=Ve(E=>{h.delete(E),g.current+=1,p(g.current)}),b=R.useMemo(()=>{const E=new Map;return Array.from(h.keys()).filter(w=>w.isConnected).sort(VP).forEach((w,A)=>{const M=h.get(w)??{};E.set(w,{...M,index:A})}),E},[h,d]);Be(()=>{if(typeof MutationObserver!="function"||b.size===0)return;const E=new MutationObserver(N=>{const w=new Set,A=M=>w.has(M)?w.delete(M):w.add(M);N.forEach(M=>{M.removedNodes.forEach(A),M.addedNodes.forEach(A)}),w.size===0&&(g.current+=1,p(g.current))});return b.forEach((N,w)=>{w.parentElement&&E.observe(w.parentElement,{childList:!0})}),()=>{E.disconnect()}},[b]),Be(()=>{g.current===d&&(r.current.length!==b.size&&(r.current.length=b.size),i&&i.current.length!==b.size&&(i.current.length=b.size),u.current=b.size),l(b)},[l,b,r,i,d]),Be(()=>()=>{r.current=[]},[r]),Be(()=>()=>{i&&(i.current=[])},[i]);const _=Ve(E=>(f.add(E),()=>{f.delete(E)}));Be(()=>{f.forEach(E=>E(b))},[f,b]);const C=R.useMemo(()=>({register:v,unregister:x,subscribeMapChange:_,elementsRef:r,labelsRef:i,nextIndexRef:u}),[v,x,_,r,i,u]);return D.jsx(bC.Provider,{value:C,children:t})}function PP(){return new Map}function jP(){return new Set}function VP(e,t){const r=e.compareDocumentPosition(t);return r&Node.DOCUMENT_POSITION_FOLLOWING||r&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:r&Node.DOCUMENT_POSITION_PRECEDING||r&Node.DOCUMENT_POSITION_CONTAINS?1:0}const GP=R.forwardRef(function(t,r){const{cutout:i,...a}=t;let l;if(i){const u=i?.getBoundingClientRect();l=`polygon(
1857
+ 0% 0%,
1858
+ 100% 0%,
1859
+ 100% 100%,
1860
+ 0% 100%,
1861
+ 0% 0%,
1862
+ ${u.left}px ${u.top}px,
1863
+ ${u.left}px ${u.bottom}px,
1864
+ ${u.right}px ${u.bottom}px,
1865
+ ${u.right}px ${u.top}px,
1866
+ ${u.left}px ${u.top}px
1867
+ )`}return D.jsx("div",{ref:r,role:"presentation","data-base-ui-inert":"",...a,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:l}})}),qP=R.forwardRef(function(t,r){const{anchor:i,positionMethod:a="absolute",className:l,render:u,side:f,align:h,sideOffset:d=0,alignOffset:p=0,collisionBoundary:g="clipping-ancestors",collisionPadding:v=5,arrowPadding:x=5,sticky:b=!1,disableAnchorTracking:_=!1,collisionAvoidance:C=Yk,...E}=t,{store:N}=Vi(),w=OP(),A=Xl(!0),M=N.useState("parent"),T=N.useState("floatingRootContext"),O=N.useState("floatingTreeRoot"),I=N.useState("mounted"),j=N.useState("open"),Z=N.useState("modal"),P=N.useState("activeTriggerElement"),q=N.useState("transitionStatus"),G=N.useState("positionerElement"),k=N.useState("instantType"),F=N.useState("hasViewport"),z=N.useState("lastOpenChangeReason"),L=N.useState("floatingNodeId"),H=N.useState("floatingParentNodeId"),X=T.useState("domReferenceElement"),Q=R.useRef(null),U=EC(G,!1,!1);let V=i,ee=d,J=p,fe=h,ye=C;M.type==="context-menu"&&(V=i??M.context?.anchor,fe=fe??"start",!f&&fe!=="center"&&(J=t.alignOffset??2,ee=t.sideOffset??-5));let he=f,ae=fe;M.type==="menu"?(he=he??"inline-end",ae=ae??"start",ye=t.collisionAvoidance??Xk):M.type==="menubar"&&(he=he??"bottom",ae=ae??"start");const be=M.type==="context-menu",ve=HP({anchor:V,floatingRootContext:T,positionMethod:A?"fixed":a,mounted:I,side:he,sideOffset:ee,align:ae,alignOffset:J,arrowPadding:be?0:x,collisionBoundary:g,collisionPadding:v,sticky:b,nodeId:L,keepMounted:w,disableAnchorTracking:_,collisionAvoidance:ye,shiftCrossAxis:be&&!("side"in ye&&ye.side==="flip"),externalTree:O,adaptiveOrigin:F?IP:void 0}),Te=R.useMemo(()=>{const ue={};return j||(ue.pointerEvents="none"),{role:"presentation",hidden:!I,style:{...ve.positionerStyles,...ue}}},[j,I,ve.positionerStyles]);R.useEffect(()=>{function ue(le){le.open&&(le.parentNodeId===L&&N.set("hoverEnabled",!1),le.nodeId!==L&&le.parentNodeId===N.select("floatingParentNodeId")&&N.setOpen(!1,It(cl)))}return O.events.on("menuopenchange",ue),()=>{O.events.off("menuopenchange",ue)}},[N,O.events,L]),R.useEffect(()=>{if(N.select("floatingParentNodeId")==null)return;function ue(le){if(le.open||le.nodeId!==N.select("floatingParentNodeId"))return;const se=le.reason??cl;N.setOpen(!1,It(se))}return O.events.on("menuopenchange",ue),()=>{O.events.off("menuopenchange",ue)}},[O.events,N]);const we=sr();R.useEffect(()=>{j||we.clear()},[j,we]),R.useEffect(()=>{function ue(le){if(!(!j||le.nodeId!==N.select("floatingParentNodeId")))if(le.target&&P&&P!==le.target){const se=N.select("closeDelay");se>0?we.isStarted()||we.start(se,()=>{N.setOpen(!1,It(cl))}):N.setOpen(!1,It(cl))}else we.clear()}return O.events.on("itemhover",ue),()=>{O.events.off("itemhover",ue)}},[O.events,j,P,N,we]),R.useEffect(()=>{const ue={open:j,nodeId:L,parentNodeId:H,reason:N.select("lastOpenChangeReason")};O.events.emit("menuopenchange",ue)},[O.events,j,N,L,H]),Be(()=>{const ue=X,le=Q.current;if(ue&&(Q.current=ue),le&&ue&&ue!==le){N.set("instantType",void 0);const se=new AbortController;return U(()=>{N.set("instantType","trigger-change")},se.signal),()=>{se.abort()}}},[X,U,N]);const xe={open:j,side:ve.side,align:ve.align,anchorHidden:ve.anchorHidden,nested:M.type==="menu",instant:k},Ee=R.useMemo(()=>({side:ve.side,align:ve.align,arrowRef:ve.arrowRef,arrowUncentered:ve.arrowUncentered,arrowStyles:ve.arrowStyles,nodeId:ve.context.nodeId}),[ve.side,ve.align,ve.arrowRef,ve.arrowUncentered,ve.arrowStyles,ve.context.nodeId]),Ce=na("div",t,{state:xe,stateAttributesMapping:cg,ref:[r,N.useStateSetter("positionerElement")],props:[Te,mT(q),E]}),ie=I&&M.type!=="menu"&&(M.type!=="menubar"&&Z&&z!==Hi||M.type==="menubar"&&M.context.modal);let re=null;return M.type==="menubar"?re=M.context.contentElement:M.type===void 0&&(re=P),D.jsxs(iC.Provider,{value:Ee,children:[ie&&D.jsx(GP,{ref:M.type==="context-menu"||M.type==="nested-context-menu"?M.context.internalBackdropRef:null,inert:zP(!j),cutout:re}),D.jsx(DH,{id:L,children:D.jsx(FP,{elementsRef:N.context.itemDomElements,labelsRef:N.context.itemLabels,children:Ce})})]})});function YP(e){const t=R.useRef(!0);t.current&&(t.current=!1,e())}let DE={},zE={},BE="";function XP(e){if(typeof document>"u")return!1;const t=yt(e);return Xt(t).innerWidth-t.documentElement.clientWidth>0}function $P(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const r=yt(e),i=r.documentElement,a=r.body,l=Jo(i)?i:a,u=l.style.overflowY,f=i.style.scrollbarGutter;i.style.scrollbarGutter="stable",l.style.overflowY="scroll";const h=l.offsetWidth;l.style.overflowY="hidden";const d=l.offsetWidth;return l.style.overflowY=u,i.style.scrollbarGutter=f,h===d}function KP(e){const t=yt(e),r=t.documentElement,i=t.body,a=Jo(r)?r:i,l={overflowY:a.style.overflowY,overflowX:a.style.overflowX};return Object.assign(a.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(a.style,l)}}function ZP(e){const t=yt(e),r=t.documentElement,i=t.body,a=Xt(r);let l=0,u=0,f=!1;const h=pr.create();if(vC&&(a.visualViewport?.scale??1)!==1)return()=>{};function d(){const v=a.getComputedStyle(r),x=a.getComputedStyle(i),C=(v.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";l=r.scrollTop,u=r.scrollLeft,DE={scrollbarGutter:r.style.scrollbarGutter,overflowY:r.style.overflowY,overflowX:r.style.overflowX},BE=r.style.scrollBehavior,zE={position:i.style.position,height:i.style.height,width:i.style.width,boxSizing:i.style.boxSizing,overflowY:i.style.overflowY,overflowX:i.style.overflowX,scrollBehavior:i.style.scrollBehavior};const E=r.scrollHeight>r.clientHeight,N=r.scrollWidth>r.clientWidth,w=v.overflowY==="scroll"||x.overflowY==="scroll",A=v.overflowX==="scroll"||x.overflowX==="scroll",M=Math.max(0,a.innerWidth-i.clientWidth),T=Math.max(0,a.innerHeight-i.clientHeight),O=parseFloat(x.marginTop)+parseFloat(x.marginBottom),I=parseFloat(x.marginLeft)+parseFloat(x.marginRight),j=Jo(r)?r:i;if(f=$P(e),f){r.style.scrollbarGutter=C,j.style.overflowY="hidden",j.style.overflowX="hidden";return}Object.assign(r.style,{scrollbarGutter:C,overflowY:"hidden",overflowX:"hidden"}),(E||w)&&(r.style.overflowY="scroll"),(N||A)&&(r.style.overflowX="scroll"),Object.assign(i.style,{position:"relative",height:O||T?`calc(100dvh - ${O+T}px)`:"100dvh",width:I||M?`calc(100vw - ${I+M}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),i.scrollTop=l,i.scrollLeft=u,r.setAttribute("data-base-ui-scroll-locked",""),r.style.scrollBehavior="unset"}function p(){Object.assign(r.style,DE),Object.assign(i.style,zE),f||(r.scrollTop=l,r.scrollLeft=u,r.removeAttribute("data-base-ui-scroll-locked"),r.style.scrollBehavior=BE)}function g(){p(),h.request(d)}return d(),a.addEventListener("resize",g),()=>{h.cancel(),p(),typeof a.removeEventListener=="function"&&a.removeEventListener("resize",g)}}class QP{lockCount=0;restore=null;timeoutLock=ro.create();timeoutUnlock=ro.create();acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}release=()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(t){if(this.lockCount===0||this.restore!==null)return;const i=yt(t).documentElement,a=Xt(i).getComputedStyle(i).overflowY;if(a==="hidden"||a==="clip"){this.restore=fC;return}const l=xC||!XP(t);this.restore=l?KP(t):ZP(t)}}const WP=new QP;function JP(e=!0,t=null){Be(()=>{if(e)return WP.acquire(t)},[e,t])}const ej=R.createContext(null);function tj(e){return R.useContext(ej)}function nj(e){const t=R.useRef(""),r=R.useCallback(a=>{a.defaultPrevented||(t.current=a.pointerType,e(a,a.pointerType))},[e]);return{onClick:R.useCallback(a=>{if(a.detail===0){e(a,"keyboard");return}"pointerType"in a?e(a,a.pointerType):e(a,t.current),t.current=""},[e]),onPointerDown:r}}function rj(e,t){const r=R.useRef(e),i=Ve(t);Be(()=>{r.current!==e&&i(r.current)},[e,i]),Be(()=>{r.current=e},[e])}function oj(e){const[t,r]=R.useState(null),i=Ve((u,f)=>{e||r(f||(xC?"touch":""))});rj(e,u=>{u&&!e&&r(null)});const{onClick:a,onPointerDown:l}=nj(i);return R.useMemo(()=>({openMethod:t,triggerProps:{onClick:a,onPointerDown:l}}),[t,a,l])}const ij={...sP,disabled:Fe(e=>e.parent.type==="menubar"&&e.parent.context.disabled||e.disabled),modal:Fe(e=>(e.parent.type===void 0||e.parent.type==="context-menu")&&(e.modal??!0)),allowMouseEnter:Fe(e=>e.allowMouseEnter),stickIfOpen:Fe(e=>e.stickIfOpen),parent:Fe(e=>e.parent),rootId:Fe(e=>e.parent.type==="menu"?e.parent.store.select("rootId"):e.parent.type!==void 0?e.parent.context.rootId:e.rootId),activeIndex:Fe(e=>e.activeIndex),isActive:Fe((e,t)=>e.activeIndex===t),hoverEnabled:Fe(e=>e.hoverEnabled),instantType:Fe(e=>e.instantType),lastOpenChangeReason:Fe(e=>e.openChangeReason),floatingTreeRoot:Fe(e=>e.parent.type==="menu"?e.parent.store.select("floatingTreeRoot"):e.floatingTreeRoot),floatingNodeId:Fe(e=>e.floatingNodeId),floatingParentNodeId:Fe(e=>e.floatingParentNodeId),itemProps:Fe(e=>e.itemProps),closeDelay:Fe(e=>e.closeDelay),hasViewport:Fe(e=>e.hasViewport),keyboardEventRelay:Fe(e=>{if(e.keyboardEventRelay)return e.keyboardEventRelay;if(e.parent.type==="menu")return e.parent.store.select("keyboardEventRelay")})};class wg extends sT{constructor(t){super({...sj(),...t},{positionerRef:R.createRef(),popupRef:R.createRef(),typingRef:{current:!1},itemDomElements:{current:[]},itemLabels:{current:[]},allowMouseUpTriggerRef:{current:!1},triggerFocusTargetRef:R.createRef(),beforeContentFocusGuardRef:R.createRef(),onOpenChangeComplete:void 0,triggerElements:new Eg},ij),this.unsubscribeParentListener=this.observe("parent",r=>{if(this.unsubscribeParentListener?.(),r.type==="menu"){let i=r.store.select("rootId"),a=r.store.select("floatingTreeRoot"),l=r.store.select("keyboardEventRelay");this.unsubscribeParentListener=r.store.subscribe(()=>{const u=r.store.select("rootId"),f=r.store.select("floatingTreeRoot"),h=r.store.select("keyboardEventRelay");i===u&&a===f&&l===h||(i=u,a=f,l=h,this.notifyAll())}),this.context.allowMouseUpTriggerRef=r.store.context.allowMouseUpTriggerRef;return}r.type!==void 0&&(this.context.allowMouseUpTriggerRef=r.context.allowMouseUpTriggerRef),this.unsubscribeParentListener=null})}setOpen(t,r){this.state.floatingRootContext.context.events.emit("setOpen",{open:t,eventDetails:r})}static useStore(t,r){const i=bn(()=>new wg(r)).current;return t??i}unsubscribeParentListener=null}function sj(){return{...iP(),disabled:!1,modal:!0,allowMouseEnter:!1,stickIfOpen:!0,parent:{type:void 0},rootId:void 0,activeIndex:null,hoverEnabled:!0,instantType:void 0,openChangeReason:null,floatingTreeRoot:new qC,floatingNodeId:void 0,floatingParentNodeId:null,itemProps:yn,keyboardEventRelay:void 0,closeDelay:0,hasViewport:!1}}const aj=R.createContext(void 0);function lj(){return R.useContext(aj)}const cj=XF(function(t){const{children:r,open:i,onOpenChange:a,onOpenChangeComplete:l,defaultOpen:u=!1,disabled:f=!1,modal:h,loopFocus:d=!0,orientation:p="vertical",actionsRef:g,closeParentOnEsc:v=!1,handle:x,triggerId:b,defaultTriggerId:_=null,highlightItemOnHover:C=!0}=t,E=Xl(!0),N=Vi(!0),w=tj(!0),A=lj(),M=R.useMemo(()=>A&&N?{type:"menu",store:N.store}:w?{type:"menubar",context:w}:E&&!N?{type:"context-menu",context:E}:{type:void 0},[E,N,w,A]),T=wg.useStore(x?.store,{open:u,openProp:i,activeTriggerId:_,triggerIdProp:b,parent:M});YP(()=>{i===void 0&&T.state.open===!1&&u===!0&&T.update({open:!0,activeTriggerId:_})}),T.useControlledProp("openProp",i),T.useControlledProp("triggerIdProp",b),T.useContextCallback("onOpenChangeComplete",l);const O=T.useState("floatingTreeRoot"),I=OH(O),j=ti();Be(()=>{E&&!N?T.update({parent:{type:"context-menu",context:E},floatingNodeId:I,floatingParentNodeId:j}):N&&T.update({floatingNodeId:I,floatingParentNodeId:j})},[E,N,I,j,T]);const Z=T.useState("open"),P=T.useState("activeTriggerElement"),q=T.useState("positionerElement"),G=T.useState("hoverEnabled"),k=T.useState("modal"),F=T.useState("disabled"),z=T.useState("lastOpenChangeReason"),L=T.useState("parent"),H=T.useState("activeIndex"),X=T.useState("payload"),Q=T.useState("floatingParentNodeId"),U=R.useRef(null),V=Q!=null;let ee;T.useSyncedValues({disabled:f,modal:L.type===void 0?h:void 0,rootId:Qo()});const{openMethod:J,triggerProps:fe}=oj(Z);nP(T);const{forceUnmount:ye}=rP(Z,T,()=>{T.update({allowMouseEnter:!1,stickIfOpen:!0})}),he=R.useRef(L.type!=="context-menu"),ae=sr();R.useEffect(()=>{if(Z||(U.current=null),L.type==="context-menu"){if(!Z){ae.clear(),he.current=!1;return}ae.start(500,()=>{he.current=!0})}},[ae,Z,L.type]),JP(Z&&k&&z!==Hi&&J!=="touch",q),Be(()=>{!Z&&!G&&T.set("hoverEnabled",!0)},[Z,G,T]);const be=R.useRef(!0),ve=sr(),Te=Ve((ze,Oe)=>{const rt=Oe.reason;if(Z===ze&&Oe.trigger===P&&z===rt||(Oe.preventUnmountOnClose=()=>{T.set("preventUnmountingOnClose",!0)},!ze&&Oe.trigger==null&&(Oe.trigger=P??void 0),a?.(ze,Oe),Oe.isCanceled))return;const wt={open:ze,nativeEvent:Oe.event,reason:Oe.reason,nested:V};ee?.emit("openchange",wt);const Ze=Oe.event;if(ze===!1&&Ze?.type==="click"&&Ze.pointerType==="touch"&&!be.current)return;if(!ze&&H!==null){const Ot=T.context.itemDomElements.current[H];queueMicrotask(()=>{Ot?.setAttribute("tabindex","-1")})}ze&&rt===iE?(be.current=!1,ve.start(300,()=>{be.current=!0})):(be.current=!0,ve.clear());const Ct=(rt===vf||rt===hC)&&Ze.detail===0&&Ze?.isTrusted,qt=!ze&&(rt===mC||rt==null),Et={open:ze,openChangeReason:rt};U.current=Oe.event??null;const Pt=Oe.trigger?.id??null;(Pt||ze)&&(Et.activeTriggerId=Pt,Et.activeTriggerElement=Oe.trigger??null),T.update(Et),L.type==="menubar"&&(rt===iE||rt===id||rt===Hi||rt===Zu||rt===cl)?T.set("instantType","group"):Ct||qt?T.set("instantType",Ct?"click":"dismiss"):T.set("instantType",void 0)}),we=R.useCallback(ze=>{const Oe=It(ze);return Oe.preventUnmountOnClose=()=>{T.set("preventUnmountingOnClose",!0)},Oe},[T]),xe=R.useCallback(()=>{T.setOpen(!1,we(aI))},[T,we]);R.useImperativeHandle(g,()=>({unmount:ye,close:xe}),[ye,xe]);let Ee;L.type==="context-menu"&&(Ee=L.context),R.useImperativeHandle(Ee?.positionerRef,()=>q,[q]),R.useImperativeHandle(Ee?.actionsRef,()=>({setOpen:Te}),[Te]);const Ce=cP({popupStore:T,onOpenChange:Te});ee=Ce.context.events,R.useEffect(()=>{const ze=({open:Oe,eventDetails:rt})=>Te(Oe,rt);return ee.on("setOpen",ze),()=>{ee?.off("setOpen",ze)}},[ee,Te]);const ie=jH(Ce,{enabled:!F,bubbles:{escapeKey:v&&L.type==="menu"},outsidePress(){return L.type!=="context-menu"||U.current?.type==="contextmenu"?!0:he.current},externalTree:V?O:void 0}),re=_P(Ce,{role:"menu"}),ue=gT(),le=R.useCallback(ze=>{T.select("activeIndex")!==ze&&T.set("activeIndex",ze)},[T]),se=xP(Ce,{enabled:!F,listRef:T.context.itemDomElements,activeIndex:H,nested:L.type!==void 0,loopFocus:d,orientation:p,parentOrientation:L.type==="menubar"?L.context.orientation:void 0,rtl:ue==="rtl",disabledIndices:jk,onNavigate:le,openOnArrowKeyDown:L.type!=="context-menu",externalTree:V?O:void 0,focusItemOnHover:C}),K=R.useCallback(ze=>{T.context.typingRef.current=ze},[T]),ge=EP(Ce,{listRef:T.context.itemLabels,elementsRef:T.context.itemDomElements,activeIndex:H,resetMs:Vk,onMatch:ze=>{Z&&ze!==H&&T.set("activeIndex",ze)},onTypingChange:K}),{getReferenceProps:Se,getFloatingProps:_e,getItemProps:Je,getTriggerProps:st}=pP([ie,re,se,ge]),ft=R.useMemo(()=>{const ze=Ml(Se(),{onMouseMove(){T.set("allowMouseEnter",!0)}},fe);return delete ze.role,ze},[Se,T,fe]),at=R.useMemo(()=>{const ze=st();if(!ze)return ze;const Oe=Ml(ze,fe);return delete Oe.role,delete Oe["aria-controls"],Oe},[st,fe]),Qe=R.useMemo(()=>_e({onMouseMove(){T.set("allowMouseEnter",!0),L.type==="menu"&&T.set("hoverEnabled",!1)},onClick(){T.select("hoverEnabled")&&T.set("hoverEnabled",!1)},onKeyDown(ze){const Oe=T.select("keyboardEventRelay");Oe&&!ze.isPropagationStopped()&&Oe(ze)}}),[_e,L.type,T]),He=R.useMemo(()=>Je(),[Je]);T.useSyncedValues({floatingRootContext:Ce,activeTriggerProps:ft,inactiveTriggerProps:at,popupProps:Qe,itemProps:He});const _t=R.useMemo(()=>({store:T,parent:M}),[T,M]),an=D.jsx(sg.Provider,{value:_t,children:typeof r=="function"?r({payload:X}):r});return L.type===void 0||L.type==="context-menu"?D.jsx(zH,{externalTree:O,children:an}):an});function vT(e){if(Mt(e)&&e.hasAttribute("data-rootownerid"))return e.getAttribute("data-rootownerid")??void 0;if(!xr(e))return vT(wr(e))}function uj(e){const[t,r]=R.useState({getBoundingClientRect(){return DOMRect.fromRect({width:0,height:0,x:0,y:0})}}),i=R.useRef(null),a=R.useRef(null),l=R.useRef(null),u=R.useRef(null),f=R.useRef(!0),h=R.useRef(null),d=Qo(),p=R.useMemo(()=>({anchor:t,setAnchor:r,actionsRef:l,backdropRef:i,internalBackdropRef:a,positionerRef:u,allowMouseUpTriggerRef:f,initialCursorPointRef:h,rootId:d}),[t,d]);return D.jsx(oC.Provider,{value:p,children:D.jsx(sg.Provider,{value:void 0,children:D.jsx(cj,{...e})})})}const UE=500,fj=R.forwardRef(function(t,r){const{render:i,className:a,...l}=t,{setAnchor:u,actionsRef:f,internalBackdropRef:h,backdropRef:d,positionerRef:p,allowMouseUpTriggerRef:g,initialCursorPointRef:v,rootId:x}=Xl(!1),{store:b}=Vi(!1),_=b.useState("open"),C=b.useState("disabled"),E=R.useRef(null),N=R.useRef(null),w=sr(),A=sr(),M=R.useRef(!1);function T(G,k,F){const z=F.type.startsWith("touch");v.current={x:G,y:k},u({getBoundingClientRect(){return DOMRect.fromRect({width:z?10:0,height:z?10:0,x:G,y:k})}}),M.current=!1,f.current?.setOpen(!0,It(vf,F)),A.start(UE,()=>{M.current=!0})}function O(G){if(C)return;g.current=!0,gn(G),T(G.clientX,G.clientY,G.nativeEvent),yt(E.current).addEventListener("mouseup",F=>{if(g.current=!1,!M.current)return;A.clear(),M.current=!1;const z=Mn(F);We(p.current,z)||x&&z&&vT(z)===x||f.current?.setOpen(!1,It(sI,F))},{once:!0})}function I(G){if(!C&&(g.current=!1,G.touches.length===1)){G.stopPropagation();const k=G.touches[0];N.current={x:k.clientX,y:k.clientY},w.start(UE,()=>{N.current&&T(N.current.x,N.current.y,G.nativeEvent)})}}function j(G){if(w.isStarted()&&N.current&&G.touches.length===1){const k=G.touches[0],F=10,z=Math.abs(k.clientX-N.current.x),L=Math.abs(k.clientY-N.current.y);(z>F||L>F)&&w.clear()}}function Z(){w.clear(),N.current=null}return R.useEffect(()=>{function G(F){if(C)return;const L=Mn(F);(We(E.current,L)||We(h.current,L)||We(d.current,L))&&F.preventDefault()}const k=yt(E.current);return k.addEventListener("contextmenu",G),()=>{k.removeEventListener("contextmenu",G)}},[d,C,h]),na("div",t,{state:{open:_},ref:[E,r],props:[{onContextMenu:O,onTouchStart:I,onTouchMove:j,onTouchEnd:Z,onTouchCancel:Z,style:{WebkitTouchCallout:"none"}},l],stateAttributesMapping:iI})});function dj(e,t,r,i){const a=new Map(e.map(p=>[p.id,p])),l=new Map;for(const p of e)l.set(p.id,[]);for(const p of t)l.get(p.source)?.push(p.target);const u=new Map;for(const p of e)u.set(p.id,0);for(const p of t)u.set(p.target,(u.get(p.target)??0)+1);const f=[],h=[];for(const[p,g]of u)g===0&&h.push(p);for(;h.length>0;){const p=h.shift();f.push(p);for(const g of l.get(p)??[]){const v=(u.get(g)??1)-1;u.set(g,v),v===0&&h.push(g)}}let d=f;if(i!==void 0){const p=new Set,g=[i];for(;g.length>0;){const v=g.shift();if(!p.has(v)){p.add(v);for(const x of l.get(v)??[])g.push(x)}}d=f.filter(v=>p.has(v))}for(const p of d){const g=a.get(p);g&&a.set(p,r(g,a))}return[...a.values()]}const hj=500,mj=500;function pj(e,t,r={x:0,y:0}){const{shaders:i,connections:a}=e;if(i.length===0)return{nodes:[],edges:[],uniforms:{},idMap:new Map};const l=new Map;for(const T of i)l.set(T.id,`${Math.random()*1e5}`);const u=i.map(T=>T.id),f=new Map,h=new Map;for(const T of u)f.set(T,[]),h.set(T,[]);for(const T of a)f.get(T.to)?.push(T.from),h.get(T.from)?.push(T.to);const d=new Map(u.map(T=>[T,f.get(T).length])),p=u.filter(T=>d.get(T)===0),g=[];for(;p.length>0;){const T=p.shift();g.push(T);for(const O of h.get(T)){const I=d.get(O)-1;d.set(O,I),I===0&&p.push(O)}}const v=new Map(u.map(T=>[T,0]));for(const T of g){const O=f.get(T);O.length>0&&v.set(T,Math.max(...O.map(I=>v.get(I)+1)))}const x=Math.max(...v.values()),b=new Map;for(const T of u){const O=v.get(T);b.has(O)||b.set(O,[]),b.get(O).push(T)}for(const[,T]of b)T.sort((O,I)=>g.indexOf(O)-g.indexOf(I));const _=T=>b.get(v.get(T)).indexOf(T),C=(T,O)=>O.length?O.reduce((I,j)=>I+_(j),0)/O.length:_(T);for(let T=1;T<=x;T++)b.get(T)?.sort((O,I)=>C(O,f.get(O))-C(I,f.get(I)));for(let T=x-1;T>=0;T--)b.get(T)?.sort((O,I)=>C(O,h.get(O))-C(I,h.get(I)));const E=new Map;for(const[T,O]of b)for(let I=0;I<O.length;I++)E.set(O[I],{x:(I-(O.length-1)/2)*hj,y:T*mj});const N={};for(const[T,O]of l)N[O]=t?.[T]??{};const w={current:N},A=i.map(T=>{const O=l.get(T.id),{x:I,y:j}=E.get(T.id);return{id:O,type:"shader",position:{x:r.x+I,y:r.y+j},data:{shader:{...T,id:O},uniforms:w,paused:!1}}}),M=a.map(T=>({id:`${Math.random()*1e5}`,source:l.get(T.from),target:l.get(T.to),targetHandle:T.input,type:"insert"}));return{nodes:A,edges:M,uniforms:N,idMap:l}}function il(e,t,r){const i=new Map;for(const u of t){const f=i.get(u.target)??[];f.push(u),i.set(u.target,f)}const a=new Map;for(const u of e)a.set(u.id,[]);for(const u of t)a.get(u.source)?.push(u.target);let l=null;if(r!==void 0){l=new Set;const u=[r];for(;u.length>0;){const f=u.shift();if(!l.has(f)){l.add(f);for(const h of a.get(f)??[])u.push(h)}}}return dj(e,t,(u,f)=>{if(u.id===r||u.type!=="shader")return u;const h=i.get(u.id);if(!h||h.length===0)return u;const d=l?h.find(b=>l.has(b.source)):h[0];if(!d)return u;const p=f.get(d.source);if(!p||p.type!=="shader")return u;const{width:g,height:v}=p.data.shader.resolution,x=u;return{...x,data:{...x.data,shader:{...x.data.shader,resolution:{width:g,height:v}}}}},r)}const gj=({shaders:e,initialState:t,handleSave:r,className:i,initialShowStats:a,initialOpenPreviewNodeId:l,onOpenPreviewNodeIdChange:u,locked:f})=>{const[h,d]=R.useState(t?.edges??[]),[p,g]=R.useState(()=>{const ie=t?.nodes??[],re=t?.edges??[];return il(ie,re)}),v=R.useCallback(ie=>g(re=>ww(ie,re)),[g]),x=R.useCallback(ie=>d(re=>Cw(ie,re)),[d]),b=R.useCallback(ie=>{const re=new Set,ue=le=>re.has(le)?!1:le===ie.source?!0:(re.add(le),P6({id:le},p,h).some(se=>ue(se.id)));return!ue(ie.target)},[p,h]),_=R.useCallback(ie=>{const re=Bp({...ie,type:"insert"},h),ue=il(p,re,ie.source);d(re),g(ue)},[h,p]),{screenToFlowPosition:C}=rd(),[E,N]=R.useState(null),w=R.useCallback((ie,re)=>{if(!re.isValid&&re.fromNode){const{clientX:ue,clientY:le}="changedTouches"in ie?ie.changedTouches[0]:ie;N({position:C({x:ue,y:le}),sourceId:re.fromNode.id}),ve(!0)}},[C]),A=R.useRef(t?.uniforms??{}),M=R.useRef([]),T=R.useCallback(({nodes:ie})=>{M.current=ie},[]);kL({onChange:T}),R.useEffect(()=>{g(ie=>ie.map(re=>{if(re.type==="shader"){const ue=re;for(const le of e)if(ue.data.shader.name===le.name)return{...ue,data:{...ue.data,shader:{...ue.data.shader,source:le.source}}};return ue}return re}))},[e]);const O=R.useCallback(()=>{const ie=M.current;if(ie.length===0)return;const re=new Set(ie.map(se=>se.id)),ue=h.filter(se=>re.has(se.source)&&re.has(se.target)),le={};for(const se of ie)A.current[se.id]&&(le[se.id]=A.current[se.id]);navigator.clipboard.writeText(JSON.stringify({__sequenza_clipboard__:!0,nodes:ie,edges:ue,uniforms:le})).catch(console.error)},[h]),I=R.useCallback(ie=>{const re=new Map;for(const se of ie.nodes)re.set(se.id,`${Math.random()*1e5}`);const ue=ie.nodes.map(se=>{const K=re.get(se.id),ge=se,Se={...ge.data.shader,id:K};return A.current[K]=ie.uniforms[se.id]??{},{...ge,id:K,position:{x:se.position.x+50,y:se.position.y+50},data:{...ge.data,shader:Se,uniforms:A},selected:!1}}),le=ie.edges.filter(se=>re.has(se.source)&&re.has(se.target)).map(se=>({...se,id:`${Math.random()*1e5}`,source:re.get(se.source),target:re.get(se.target)}));g(se=>[...se,...ue]),d(se=>[...se,...le])},[]),[j,Z]=R.useState(null);R.useEffect(()=>{const ie=re=>{(re.metaKey||re.ctrlKey)&&re.key==="s"&&(re.preventDefault(),r({nodes:p,edges:h,uniforms:A.current}),Z(new Date)),(re.metaKey||re.ctrlKey)&&re.key==="c"&&!(document.activeElement instanceof HTMLInputElement)&&!(document.activeElement instanceof HTMLTextAreaElement)&&O()};return window.addEventListener("keydown",ie),()=>window.removeEventListener("keydown",ie)},[p,h,O]);const P=ie=>{const re=`${Math.random()*1e5}`,ue={...ie,id:re};return A.current[re]={},{id:re,position:{x:0,y:0},data:{shader:ue,uniforms:A,paused:!1},type:"shader"}},q=ht(),G=R.useCallback(ie=>{const re=P(ie);if(E===null){const ue=q.getState().domNode;if(ue){const le=ue.getBoundingClientRect(),se=C({x:le.x+le.width/2,y:le.y+le.height/2});re.position=se}}else if(E.sourceId){J(ie,E.sourceId,E.position);return}else re.position=E.position;N(null),g(ue=>[...ue,re])},[E]),k=R.useCallback((ie,re)=>{const ue=h.find(_e=>_e.id===re);if(!ue)return;const le=ue.source,se=ue.target,K=p.find(_e=>_e.id===le),ge=p.find(_e=>_e.id===se),Se=ue.targetHandle;if(K&&ge&&Se){const _e=P(ie),Je=js(_e.data.shader);let st;for(const Oe of Je)if(Oe.type==="sampler2D"&&Oe.source==="input"){st=Oe.name;break}if(st===void 0)return;const[ft,at,Qe]=rg({sourceX:K.position.x,sourceY:K.position.y,sourcePosition:Ne.Bottom,targetX:ge.position.x,targetY:ge.position.y,targetPosition:Ne.Top});_e.position.x=at,_e.position.y=Qe;const He=h.filter(Oe=>Oe.id!==re),_t={id:""+Math.random()*1e4,source:K.id,target:_e.id,targetHandle:st,type:"insert"},an={id:""+Math.random()*1e4,source:_e.id,target:ge.id,targetHandle:Se,type:"insert"};He.push(_t),He.push(an),d(He);const ze=il([...p,_e],He,K.id);g(ze)}},[p,h]),[F,z]=R.useMemo(()=>{const ie={};for(const ue of p)ie[ue.id]=[];for(const ue of h)ie[ue.target].push({from:ue.source,to:ue.target,input:ue.targetHandle??""});return[JSON.stringify(ie),ie]},[h,p]),[L,H]=R.useMemo(()=>{const ie={};for(const re of p)if(re.type==="shader"){const ue=re;ie[ue.id]=ue.data.shader}return[JSON.stringify(ie),ie]},[p]),X=R.useMemo(()=>{const ie={};for(const[re,ue]of Object.entries(H)){ie[re]={shaders:[ue],connections:[]};const le=[re];for(;le.length!==0;){const se=le.shift();for(const K of z[se]){const ge=K.from;le.push(ge);const Se=H[ge];ie[re].shaders.find(_e=>_e.id===Se.id)||ie[re].shaders.push(Se),ie[re].connections.push(K)}}}return ie},[L,F]),Q=R.useCallback((ie,re)=>{A.current[ie]=re(A.current[ie])},[]),U=R.useCallback((ie,re)=>{g(ue=>{const le=ue.map(se=>{if(se.id===ie&&se.type==="shader"){const K=se,ge=re(K.data);return{...K,data:ge}}return se});return il(le,h,ie)})},[h]),V=R.useRef(0),ee=R.useRef([0,0]);R.useEffect(()=>{const ie=setInterval(()=>{V.current=Date.now()},10),re=ue=>{ee.current=[Math.min(1,ue.clientX/window.innerWidth),Math.min(ue.clientY/innerHeight,1)]};return window.addEventListener("mousemove",re),()=>{clearInterval(ie),window.removeEventListener("mousemove",re)}},[]);const J=R.useCallback((ie,re,ue)=>{const le=p.find(se=>se.id===re);if(le){const se=P(ie);se.position=ue;const K=js(se.data.shader);let ge;for(const Se of K)if(Se.type==="sampler2D"&&Se.source==="input"){ge=Se.name;break}if(ge!==void 0){const Se={id:""+Math.random(),source:re,target:se.id,targetHandle:ge,type:"insert"},_e=Bp(Se,h),Je=il([...p,se],_e,le.id);d(_e),g(Je)}}},[p,h]),fe=R.useCallback(ie=>{try{const re=JSON.parse(ie),ue=q.getState().domNode,le=ue?(()=>{const _e=ue.getBoundingClientRect();return C({x:_e.x+_e.width/2,y:_e.y+_e.height/2})})():{x:0,y:0},{nodes:se,edges:K,uniforms:ge}=pj(re.shader,re.uniforms,le);for(const[_e,Je]of Object.entries(ge))A.current[_e]=Je;const Se=se.map(_e=>({..._e,data:{..._e.data,uniforms:A}}));g(_e=>[..._e,...Se]),d(_e=>[..._e,...K])}catch(re){console.error(re)}},[C,q]);R.useEffect(()=>{const ie=re=>{if(re.target instanceof HTMLInputElement||re.target instanceof HTMLTextAreaElement)return;const ue=re.clipboardData?.getData("text/plain");if(ue){try{const le=JSON.parse(ue);if(le.__sequenza_clipboard__){I(le);return}}catch(le){console.log("imported value treated as JSON import, ",le)}fe(ue)}};return window.addEventListener("paste",ie),()=>window.removeEventListener("paste",ie)},[fe,I]);const ye=R.useRef(null),[he,ae]=R.useState(a??!1),[be,ve]=R.useState(!1),[Te,we]=R.useState(null),[xe,Ee]=R.useState(l??null),Ce=ie=>{Ee(ie),u?.(ie)};return D.jsx(D.Fragment,{children:D.jsxs(uj,{children:[D.jsx(fj,{render:D.jsxs("div",{className:`w-full h-full ${i} relative`,children:[D.jsx(Yl.Provider,{value:{currentTime:V,mousePosition:ee,shaders:e,patches:X,showStats:he,openExportNodeId:Te,setOpenExportNodeId:we,openPreviewNodeId:xe,setOpenPreviewNodeId:Ce,uniforms:A,handleUpdateUniforms:Q,handleUpdateNode:U,handleInsertShader:k},children:D.jsxs(BL,{preventScrolling:!f,panOnScroll:!f,proOptions:{hideAttribution:!0},nodes:p,nodeTypes:{shader:wk},edges:h,edgeTypes:{insert:Ck},onNodesChange:v,onEdgesChange:x,onConnect:_,onConnectEnd:w,connectionLineComponent:Tk,isValidConnection:b,minZoom:.1,style:{background:"#F1F1F1"},fitView:!0,children:[!f&&D.jsx($L,{style:{"--xy-controls-button-background-color-default":"transparent","--xy-controls-box-shadow-default":"none"}}),!f&&D.jsxs(Zs,{position:"top-right",className:"flex flex-col gap-4 items-end",children:[D.jsxs("div",{className:"flex gap-1 p-1 bg-white rounded-md w-min",children:[D.jsxs("button",{className:"button-base flex items-center gap-1",onClick:()=>ve(!0),children:["Add Shader",D.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"#000000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:[D.jsx("path",{d:"M12 5l0 14"}),D.jsx("path",{d:"M5 12l14 0"})]})]}),D.jsx("button",{className:"button-base",onClick:()=>ae(!he),children:he?"Hide Stats":"Show Stats"}),D.jsx("button",{className:"button-base",onClick:()=>ye.current?.click(),children:"Import"}),D.jsx("input",{ref:ye,type:"file",accept:".json",className:"hidden",onChange:ie=>{const re=ie.target.files?.[0];re&&(re.text().then(ue=>fe(ue)),ie.target.value="")}})]}),he&&D.jsxs(D.Fragment,{children:[D.jsx("div",{className:"flex flex-col gap-2",children:p.map(ie=>D.jsx("p",{className:"text-xs text-neutral-400",children:ie.id},ie.id))}),D.jsx("div",{className:"flex flex-col gap-2",children:h.map(ie=>D.jsxs("p",{className:"text-xs text-neutral-400",children:[ie.source," ",">"," ",ie.target," ",ie.targetHandle]},ie.id))})]})]}),j&&D.jsx(Zs,{position:"bottom-center",children:D.jsxs("p",{className:"text-xs text-neutral-400",children:["Last saved at ",j.toLocaleTimeString()]})})]})}),Te!==null&&X[Te]&&D.jsx(nC,{uniforms:A.current,patch:X[Te],open:!0,onOpenChange:ie=>{ie||we(null)}}),D.jsx(rC,{open:be,handleOpenChange:ve,shaders:e,handleAddShader:G})]})}),D.jsxs(DP,{children:[D.jsx(cI,{}),D.jsx(qP,{children:D.jsx(MP,{className:"w-32 h-min bg-white outline-none flex flex-col p-1 rounded-md",children:D.jsx(HI,{onClick:ie=>{const re=C({x:ie.clientX,y:ie.clientY});N({position:re}),ve(!0)},className:"button-base w-full",children:"Add Node"})})})]})]})})},yj=e=>D.jsx(Kw,{children:D.jsx(gj,{...e})});function vj(){const[e,t]=R.useState(null),r=R.useRef({});R.useEffect(()=>{const a={};for(const[u,f]of Object.entries(mN))a[u]={id:u,source:f,name:u,resolution:{width:100,height:100}},r.current[u]={};console.log("[CONNECT]");const l=Fu("http://localhost:3001");return l.on("shaders-found",u=>{const f={};for(const[h,d]of Object.entries(u))f[h]={id:h,source:d,name:h,resolution:{width:100,height:100}},r.current[h]={};t({...f,...a})}),()=>{console.log("[DISCONNECT]"),l.disconnect()}},[]);const i=R.useMemo(()=>{if(e===null)return null;try{const a=JSON.parse(localStorage.getItem("sequenza-nodes")??"[]");let l=JSON.parse(localStorage.getItem("sequenza-edges")??"[]");const u=JSON.parse(localStorage.getItem("sequenza-uniforms")??"{}");for(const h of a)if(h.type==="shader"){const d=h,p=e[d.data.shader.name];if(p&&d.data.shader.source!==p?.source){const g={...p,id:d.data.shader.id};d.data.shader=g}}const f=new Set(a.map(h=>h.id));for(const h of Object.keys(u))f.has(h)||delete u[h];for(const h of a){if(h.type!=="shader")continue;const d=h,p=u[d.id];if(!p)continue;const g=js(d.data.shader),v={};for(const x of g){if(x.type==="sampler2D"&&x.source==="input")continue;const b=p[x.name];if(b!==void 0&&o5(b,x))v[x.name]=b;else{const _=f2(x);_!==void 0&&(v[x.name]=_)}}u[d.id]=v}if(l=l.filter(h=>{const d=a.find(b=>b.id===h.source),p=a.find(b=>b.id===h.target),g=h.targetHandle;if(!p||p&&p.type!=="shader")return!1;const x=js(p.data.shader);return!(!d||g===null||g===void 0||x.find(b=>b.name===g&&b.type==="sampler2D")===void 0)}),a!==null&&l!==null&&u!==null)return{nodes:a,edges:l,uniforms:u}}catch(a){console.error(a)}},[e]);return D.jsx("main",{className:"",children:D.jsx("div",{className:"w-full min-h-screen h-screen ",children:e&&i&&D.jsx(yj,{shaders:[...Object.values(e)],initialState:i,initialShowStats:localStorage.getItem("sequenza-show-stats")==="true",initialOpenPreviewNodeId:localStorage.getItem("sequenza-open-preview-node")||null,onEditorStateChange:({showStats:a,addShaderPanelOpen:l})=>{localStorage.setItem("sequenza-show-stats",String(a)),localStorage.setItem("sequenza-shader-panel-open",String(l))},onOpenPreviewNodeIdChange:a=>{a?localStorage.setItem("sequenza-open-preview-node",a):localStorage.removeItem("sequenza-open-preview-node")},handleSave:({nodes:a,edges:l,uniforms:u})=>{localStorage.setItem("sequenza-nodes",JSON.stringify(a)),localStorage.setItem("sequenza-edges",JSON.stringify(l)),localStorage.setItem("sequenza-uniforms",JSON.stringify(u))}})})})}zA.createRoot(document.getElementById("root")).render(D.jsx(R.StrictMode,{children:D.jsx(vj,{})}));