@simten/embed 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/circuit-embed.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
var SimtenEmbed=(function(Zf){"use strict";var Kf=typeof document<"u"?document.currentScript:null;function wN(t,e){for(var n=0;n<e.length;n++){const i=e[n];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in t)){const a=Object.getOwnPropertyDescriptor(i,s);a&&Object.defineProperty(t,s,a.get?a:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function Qf(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Wf={exports:{}},Lt={};var C0;function SN(){if(C0)return Lt;C0=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function b(L){return L===null||typeof L!="object"?null:(L=y&&L[y]||L["@@iterator"],typeof L=="function"?L:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,S={};function E(L,G,tt){this.props=L,this.context=G,this.refs=S,this.updater=tt||x}E.prototype.isReactComponent={},E.prototype.setState=function(L,G){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,G,"setState")},E.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function D(){}D.prototype=E.prototype;function T(L,G,tt){this.props=L,this.context=G,this.refs=S,this.updater=tt||x}var C=T.prototype=new D;C.constructor=T,w(C,E.prototype),C.isPureReactComponent=!0;var R=Array.isArray;function A(){}var O={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function H(L,G,tt){var it=tt.ref;return{$$typeof:t,type:L,key:G,ref:it!==void 0?it:null,props:tt}}function $(L,G){return H(L.type,G,L.props)}function q(L){return typeof L=="object"&&L!==null&&L.$$typeof===t}function F(L){var G={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(tt){return G[tt]})}var Q=/\/+/g;function B(L,G){return typeof L=="object"&&L!==null&&L.key!=null?F(""+L.key):G.toString(36)}function P(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(A,A):(L.status="pending",L.then(function(G){L.status==="pending"&&(L.status="fulfilled",L.value=G)},function(G){L.status==="pending"&&(L.status="rejected",L.reason=G)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function j(L,G,tt,it,lt){var ht=typeof L;(ht==="undefined"||ht==="boolean")&&(L=null);var ft=!1;if(L===null)ft=!0;else switch(ht){case"bigint":case"string":case"number":ft=!0;break;case"object":switch(L.$$typeof){case t:case e:ft=!0;break;case p:return ft=L._init,j(ft(L._payload),G,tt,it,lt)}}if(ft)return lt=lt(L),ft=it===""?"."+B(L,0):it,R(lt)?(tt="",ft!=null&&(tt=ft.replace(Q,"$&/")+"/"),j(lt,G,tt,"",function(Mt){return Mt})):lt!=null&&(q(lt)&&(lt=$(lt,tt+(lt.key==null||L&&L.key===lt.key?"":(""+lt.key).replace(Q,"$&/")+"/")+ft)),G.push(lt)),1;ft=0;var ut=it===""?".":it+":";if(R(L))for(var dt=0;dt<L.length;dt++)it=L[dt],ht=ut+B(it,dt),ft+=j(it,G,tt,ht,lt);else if(dt=b(L),typeof dt=="function")for(L=dt.call(L),dt=0;!(it=L.next()).done;)it=it.value,ht=ut+B(it,dt++),ft+=j(it,G,tt,ht,lt);else if(ht==="object"){if(typeof L.then=="function")return j(P(L),G,tt,it,lt);throw G=String(L),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return ft}function I(L,G,tt){if(L==null)return L;var it=[],lt=0;return j(L,it,"","",function(ht){return G.call(tt,ht,lt++)}),it}function z(L){if(L._status===-1){var G=L._result;G=G(),G.then(function(tt){(L._status===0||L._status===-1)&&(L._status=1,L._result=tt)},function(tt){(L._status===0||L._status===-1)&&(L._status=2,L._result=tt)}),L._status===-1&&(L._status=0,L._result=G)}if(L._status===1)return L._result.default;throw L._result}var U=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},Y={map:I,forEach:function(L,G,tt){I(L,function(){G.apply(this,arguments)},tt)},count:function(L){var G=0;return I(L,function(){G++}),G},toArray:function(L){return I(L,function(G){return G})||[]},only:function(L){if(!q(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Lt.Activity=m,Lt.Children=Y,Lt.Component=E,Lt.Fragment=n,Lt.Profiler=s,Lt.PureComponent=T,Lt.StrictMode=i,Lt.Suspense=d,Lt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Lt.__COMPILER_RUNTIME={__proto__:null,c:function(L){return O.H.useMemoCache(L)}},Lt.cache=function(L){return function(){return L.apply(null,arguments)}},Lt.cacheSignal=function(){return null},Lt.cloneElement=function(L,G,tt){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var it=w({},L.props),lt=L.key;if(G!=null)for(ht in G.key!==void 0&&(lt=""+G.key),G)!k.call(G,ht)||ht==="key"||ht==="__self"||ht==="__source"||ht==="ref"&&G.ref===void 0||(it[ht]=G[ht]);var ht=arguments.length-2;if(ht===1)it.children=tt;else if(1<ht){for(var ft=Array(ht),ut=0;ut<ht;ut++)ft[ut]=arguments[ut+2];it.children=ft}return H(L.type,lt,it)},Lt.createContext=function(L){return L={$$typeof:c,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:a,_context:L},L},Lt.createElement=function(L,G,tt){var it,lt={},ht=null;if(G!=null)for(it in G.key!==void 0&&(ht=""+G.key),G)k.call(G,it)&&it!=="key"&&it!=="__self"&&it!=="__source"&&(lt[it]=G[it]);var ft=arguments.length-2;if(ft===1)lt.children=tt;else if(1<ft){for(var ut=Array(ft),dt=0;dt<ft;dt++)ut[dt]=arguments[dt+2];lt.children=ut}if(L&&L.defaultProps)for(it in ft=L.defaultProps,ft)lt[it]===void 0&&(lt[it]=ft[it]);return H(L,ht,lt)},Lt.createRef=function(){return{current:null}},Lt.forwardRef=function(L){return{$$typeof:u,render:L}},Lt.isValidElement=q,Lt.lazy=function(L){return{$$typeof:p,_payload:{_status:-1,_result:L},_init:z}},Lt.memo=function(L,G){return{$$typeof:h,type:L,compare:G===void 0?null:G}},Lt.startTransition=function(L){var G=O.T,tt={};O.T=tt;try{var it=L(),lt=O.S;lt!==null&<(tt,it),typeof it=="object"&&it!==null&&typeof it.then=="function"&&it.then(A,U)}catch(ht){U(ht)}finally{G!==null&&tt.types!==null&&(G.types=tt.types),O.T=G}},Lt.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Lt.use=function(L){return O.H.use(L)},Lt.useActionState=function(L,G,tt){return O.H.useActionState(L,G,tt)},Lt.useCallback=function(L,G){return O.H.useCallback(L,G)},Lt.useContext=function(L){return O.H.useContext(L)},Lt.useDebugValue=function(){},Lt.useDeferredValue=function(L,G){return O.H.useDeferredValue(L,G)},Lt.useEffect=function(L,G){return O.H.useEffect(L,G)},Lt.useEffectEvent=function(L){return O.H.useEffectEvent(L)},Lt.useId=function(){return O.H.useId()},Lt.useImperativeHandle=function(L,G,tt){return O.H.useImperativeHandle(L,G,tt)},Lt.useInsertionEffect=function(L,G){return O.H.useInsertionEffect(L,G)},Lt.useLayoutEffect=function(L,G){return O.H.useLayoutEffect(L,G)},Lt.useMemo=function(L,G){return O.H.useMemo(L,G)},Lt.useOptimistic=function(L,G){return O.H.useOptimistic(L,G)},Lt.useReducer=function(L,G,tt){return O.H.useReducer(L,G,tt)},Lt.useRef=function(L){return O.H.useRef(L)},Lt.useState=function(L){return O.H.useState(L)},Lt.useSyncExternalStore=function(L,G,tt){return O.H.useSyncExternalStore(L,G,tt)},Lt.useTransition=function(){return O.H.useTransition()},Lt.version="19.2.0",Lt}var T0;function ha(){return T0||(T0=1,Wf.exports=SN()),Wf.exports}var N=ha();const dr=Qf(N),_0=wN({__proto__:null,default:dr},[N]);var Jf={exports:{}},pa={},td={exports:{}},ed={};var N0;function EN(){return N0||(N0=1,(function(t){function e(j,I){var z=j.length;j.push(I);t:for(;0<z;){var U=z-1>>>1,Y=j[U];if(0<s(Y,I))j[U]=I,j[z]=Y,z=U;else break t}}function n(j){return j.length===0?null:j[0]}function i(j){if(j.length===0)return null;var I=j[0],z=j.pop();if(z!==I){j[0]=z;t:for(var U=0,Y=j.length,L=Y>>>1;U<L;){var G=2*(U+1)-1,tt=j[G],it=G+1,lt=j[it];if(0>s(tt,z))it<Y&&0>s(lt,tt)?(j[U]=lt,j[it]=z,U=it):(j[U]=tt,j[G]=z,U=G);else if(it<Y&&0>s(lt,z))j[U]=lt,j[it]=z,U=it;else break t}}return I}function s(j,I){var z=j.sortIndex-I.sortIndex;return z!==0?z:j.id-I.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var c=Date,u=c.now();t.unstable_now=function(){return c.now()-u}}var d=[],h=[],p=1,m=null,y=3,b=!1,x=!1,w=!1,S=!1,E=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function C(j){for(var I=n(h);I!==null;){if(I.callback===null)i(h);else if(I.startTime<=j)i(h),I.sortIndex=I.expirationTime,e(d,I);else break;I=n(h)}}function R(j){if(w=!1,C(j),!x)if(n(d)!==null)x=!0,A||(A=!0,F());else{var I=n(h);I!==null&&P(R,I.startTime-j)}}var A=!1,O=-1,k=5,H=-1;function $(){return S?!0:!(t.unstable_now()-H<k)}function q(){if(S=!1,A){var j=t.unstable_now();H=j;var I=!0;try{t:{x=!1,w&&(w=!1,D(O),O=-1),b=!0;var z=y;try{e:{for(C(j),m=n(d);m!==null&&!(m.expirationTime>j&&$());){var U=m.callback;if(typeof U=="function"){m.callback=null,y=m.priorityLevel;var Y=U(m.expirationTime<=j);if(j=t.unstable_now(),typeof Y=="function"){m.callback=Y,C(j),I=!0;break e}m===n(d)&&i(d),C(j)}else i(d);m=n(d)}if(m!==null)I=!0;else{var L=n(h);L!==null&&P(R,L.startTime-j),I=!1}}break t}finally{m=null,y=z,b=!1}I=void 0}}finally{I?F():A=!1}}}var F;if(typeof T=="function")F=function(){T(q)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,B=Q.port2;Q.port1.onmessage=q,F=function(){B.postMessage(null)}}else F=function(){E(q,0)};function P(j,I){O=E(function(){j(t.unstable_now())},I)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(j){j.callback=null},t.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<j?Math.floor(1e3/j):5},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_next=function(j){switch(y){case 1:case 2:case 3:var I=3;break;default:I=y}var z=y;y=I;try{return j()}finally{y=z}},t.unstable_requestPaint=function(){S=!0},t.unstable_runWithPriority=function(j,I){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var z=y;y=j;try{return I()}finally{y=z}},t.unstable_scheduleCallback=function(j,I,z){var U=t.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?U+z:U):z=U,j){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=z+Y,j={id:p++,callback:I,priorityLevel:j,startTime:z,expirationTime:Y,sortIndex:-1},z>U?(j.sortIndex=z,e(h,j),n(d)===null&&j===n(h)&&(w?(D(O),O=-1):w=!0,P(R,z-U))):(j.sortIndex=Y,e(d,j),x||b||(x=!0,A||(A=!0,F()))),j},t.unstable_shouldYield=$,t.unstable_wrapCallback=function(j){var I=y;return function(){var z=y;y=I;try{return j.apply(this,arguments)}finally{y=z}}}})(ed)),ed}var A0;function CN(){return A0||(A0=1,td.exports=EN()),td.exports}var nd={exports:{}},Ge={};var M0;function TN(){if(M0)return Ge;M0=1;var t=ha();function e(d){var h="https://react.dev/errors/"+d;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+d+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(d,h,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:m==null?null:""+m,children:d,containerInfo:h,implementation:p}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(d,h){if(d==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Ge.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Ge.createPortal=function(d,h){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(e(299));return a(d,h,null,p)},Ge.flushSync=function(d){var h=c.T,p=i.p;try{if(c.T=null,i.p=2,d)return d()}finally{c.T=h,i.p=p,i.d.f()}},Ge.preconnect=function(d,h){typeof d=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,i.d.C(d,h))},Ge.prefetchDNS=function(d){typeof d=="string"&&i.d.D(d)},Ge.preinit=function(d,h){if(typeof d=="string"&&h&&typeof h.as=="string"){var p=h.as,m=u(p,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;p==="style"?i.d.S(d,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:m,integrity:y,fetchPriority:b}):p==="script"&&i.d.X(d,{crossOrigin:m,integrity:y,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Ge.preinitModule=function(d,h){if(typeof d=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var p=u(h.as,h.crossOrigin);i.d.M(d,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&i.d.M(d)},Ge.preload=function(d,h){if(typeof d=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var p=h.as,m=u(p,h.crossOrigin);i.d.L(d,p,{crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Ge.preloadModule=function(d,h){if(typeof d=="string")if(h){var p=u(h.as,h.crossOrigin);i.d.m(d,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else i.d.m(d)},Ge.requestFormReset=function(d){i.d.r(d)},Ge.unstable_batchedUpdates=function(d,h){return d(h)},Ge.useFormState=function(d,h,p){return c.H.useFormState(d,h,p)},Ge.useFormStatus=function(){return c.H.useHostTransitionStatus()},Ge.version="19.2.0",Ge}var R0;function k0(){if(R0)return nd.exports;R0=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),nd.exports=TN(),nd.exports}var O0;function _N(){if(O0)return pa;O0=1;var t=CN(),e=ha(),n=k0();function i(o){var r="https://react.dev/errors/"+o;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)r+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+o+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function a(o){var r=o,l=o;if(o.alternate)for(;r.return;)r=r.return;else{o=r;do r=o,(r.flags&4098)!==0&&(l=r.return),o=r.return;while(o)}return r.tag===3?l:null}function c(o){if(o.tag===13){var r=o.memoizedState;if(r===null&&(o=o.alternate,o!==null&&(r=o.memoizedState)),r!==null)return r.dehydrated}return null}function u(o){if(o.tag===31){var r=o.memoizedState;if(r===null&&(o=o.alternate,o!==null&&(r=o.memoizedState)),r!==null)return r.dehydrated}return null}function d(o){if(a(o)!==o)throw Error(i(188))}function h(o){var r=o.alternate;if(!r){if(r=a(o),r===null)throw Error(i(188));return r!==o?null:o}for(var l=o,f=r;;){var g=l.return;if(g===null)break;var v=g.alternate;if(v===null){if(f=g.return,f!==null){l=f;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===l)return d(g),o;if(v===f)return d(g),r;v=v.sibling}throw Error(i(188))}if(l.return!==f.return)l=g,f=v;else{for(var _=!1,V=g.child;V;){if(V===l){_=!0,l=g,f=v;break}if(V===f){_=!0,f=g,l=v;break}V=V.sibling}if(!_){for(V=v.child;V;){if(V===l){_=!0,l=v,f=g;break}if(V===f){_=!0,f=v,l=g;break}V=V.sibling}if(!_)throw Error(i(189))}}if(l.alternate!==f)throw Error(i(190))}if(l.tag!==3)throw Error(i(188));return l.stateNode.current===l?o:r}function p(o){var r=o.tag;if(r===5||r===26||r===27||r===6)return o;for(o=o.child;o!==null;){if(r=p(o),r!==null)return r;o=o.sibling}return null}var m=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),T=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),$=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function F(o){return o===null||typeof o!="object"?null:(o=q&&o[q]||o["@@iterator"],typeof o=="function"?o:null)}var Q=Symbol.for("react.client.reference");function B(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===Q?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case w:return"Fragment";case E:return"Profiler";case S:return"StrictMode";case R:return"Suspense";case A:return"SuspenseList";case H:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case x:return"Portal";case T:return o.displayName||"Context";case D:return(o._context.displayName||"Context")+".Consumer";case C:var r=o.render;return o=o.displayName,o||(o=r.displayName||r.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case O:return r=o.displayName||null,r!==null?r:B(o.type)||"Memo";case k:r=o._payload,o=o._init;try{return B(o(r))}catch{}}return null}var P=Array.isArray,j=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z={pending:!1,data:null,method:null,action:null},U=[],Y=-1;function L(o){return{current:o}}function G(o){0>Y||(o.current=U[Y],U[Y]=null,Y--)}function tt(o,r){Y++,U[Y]=o.current,o.current=r}var it=L(null),lt=L(null),ht=L(null),ft=L(null);function ut(o,r){switch(tt(ht,r),tt(lt,o),tt(it,null),r.nodeType){case 9:case 11:o=(o=r.documentElement)&&(o=o.namespaceURI)?q_(o):0;break;default:if(o=r.tagName,r=r.namespaceURI)r=q_(r),o=Y_(r,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}G(it),tt(it,o)}function dt(){G(it),G(lt),G(ht)}function Mt(o){o.memoizedState!==null&&tt(ft,o);var r=it.current,l=Y_(r,o.type);r!==l&&(tt(lt,o),tt(it,l))}function Nt(o){lt.current===o&&(G(it),G(lt)),ft.current===o&&(G(ft),Zl._currentValue=z)}var bt,Tt;function Dt(o){if(bt===void 0)try{throw Error()}catch(l){var r=l.stack.trim().match(/\n( *(at )?)/);bt=r&&r[1]||"",Tt=-1<l.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<
|
|
3
|
-
`+bt+
|
|
1
|
+
var SimtenEmbed=(function(Hf){"use strict";var Uf=typeof document<"u"?document.currentScript:null;function wN(t,e){for(var n=0;n<e.length;n++){const o=e[n];if(typeof o!="string"&&!Array.isArray(o)){for(const s in o)if(s!=="default"&&!(s in t)){const a=Object.getOwnPropertyDescriptor(o,s);a&&Object.defineProperty(t,s,a.get?a:{enumerable:!0,get:()=>o[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function $f(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Yf={exports:{}},jt={};var E0;function _N(){if(E0)return jt;E0=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),l=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function b(L){return L===null||typeof L!="object"?null:(L=y&&L[y]||L["@@iterator"],typeof L=="function"?L:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,_={};function S(L,F,et){this.props=L,this.context=F,this.refs=_,this.updater=et||x}S.prototype.isReactComponent={},S.prototype.setState=function(L,F){if(typeof L!="object"&&typeof L!="function"&&L!=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,L,F,"setState")},S.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function k(){}k.prototype=S.prototype;function C(L,F,et){this.props=L,this.context=F,this.refs=_,this.updater=et||x}var E=C.prototype=new k;E.constructor=C,w(E,S.prototype),E.isPureReactComponent=!0;var R=Array.isArray;function A(){}var O={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function U(L,F,et){var rt=et.ref;return{$$typeof:t,type:L,key:F,ref:rt!==void 0?rt:null,props:et}}function q(L,F){return U(L.type,F,L.props)}function Y(L){return typeof L=="object"&&L!==null&&L.$$typeof===t}function K(L){var F={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(et){return F[et]})}var W=/\/+/g;function B(L,F){return typeof L=="object"&&L!==null&&L.key!=null?K(""+L.key):F.toString(36)}function H(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(A,A):(L.status="pending",L.then(function(F){L.status==="pending"&&(L.status="fulfilled",L.value=F)},function(F){L.status==="pending"&&(L.status="rejected",L.reason=F)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function j(L,F,et,rt,ct){var ht=typeof L;(ht==="undefined"||ht==="boolean")&&(L=null);var ft=!1;if(L===null)ft=!0;else switch(ht){case"bigint":case"string":case"number":ft=!0;break;case"object":switch(L.$$typeof){case t:case e:ft=!0;break;case p:return ft=L._init,j(ft(L._payload),F,et,rt,ct)}}if(ft)return ct=ct(L),ft=rt===""?"."+B(L,0):rt,R(ct)?(et="",ft!=null&&(et=ft.replace(W,"$&/")+"/"),j(ct,F,et,"",function(Ot){return Ot})):ct!=null&&(Y(ct)&&(ct=q(ct,et+(ct.key==null||L&&L.key===ct.key?"":(""+ct.key).replace(W,"$&/")+"/")+ft)),F.push(ct)),1;ft=0;var ut=rt===""?".":rt+":";if(R(L))for(var dt=0;dt<L.length;dt++)rt=L[dt],ht=ut+B(rt,dt),ft+=j(rt,F,et,ht,ct);else if(dt=b(L),typeof dt=="function")for(L=dt.call(L),dt=0;!(rt=L.next()).done;)rt=rt.value,ht=ut+B(rt,dt++),ft+=j(rt,F,et,ht,ct);else if(ht==="object"){if(typeof L.then=="function")return j(H(L),F,et,rt,ct);throw F=String(L),Error("Objects are not valid as a React child (found: "+(F==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":F)+"). If you meant to render a collection of children, use an array instead.")}return ft}function I(L,F,et){if(L==null)return L;var rt=[],ct=0;return j(L,rt,"","",function(ht){return F.call(et,ht,ct++)}),rt}function z(L){if(L._status===-1){var F=L._result;F=F(),F.then(function(et){(L._status===0||L._status===-1)&&(L._status=1,L._result=et)},function(et){(L._status===0||L._status===-1)&&(L._status=2,L._result=et)}),L._status===-1&&(L._status=0,L._result=F)}if(L._status===1)return L._result.default;throw L._result}var $=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var F=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(F))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},G={map:I,forEach:function(L,F,et){I(L,function(){F.apply(this,arguments)},et)},count:function(L){var F=0;return I(L,function(){F++}),F},toArray:function(L){return I(L,function(F){return F})||[]},only:function(L){if(!Y(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return jt.Activity=m,jt.Children=G,jt.Component=S,jt.Fragment=n,jt.Profiler=s,jt.PureComponent=C,jt.StrictMode=o,jt.Suspense=d,jt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,jt.__COMPILER_RUNTIME={__proto__:null,c:function(L){return O.H.useMemoCache(L)}},jt.cache=function(L){return function(){return L.apply(null,arguments)}},jt.cacheSignal=function(){return null},jt.cloneElement=function(L,F,et){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var rt=w({},L.props),ct=L.key;if(F!=null)for(ht in F.key!==void 0&&(ct=""+F.key),F)!D.call(F,ht)||ht==="key"||ht==="__self"||ht==="__source"||ht==="ref"&&F.ref===void 0||(rt[ht]=F[ht]);var ht=arguments.length-2;if(ht===1)rt.children=et;else if(1<ht){for(var ft=Array(ht),ut=0;ut<ht;ut++)ft[ut]=arguments[ut+2];rt.children=ft}return U(L.type,ct,rt)},jt.createContext=function(L){return L={$$typeof:l,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:a,_context:L},L},jt.createElement=function(L,F,et){var rt,ct={},ht=null;if(F!=null)for(rt in F.key!==void 0&&(ht=""+F.key),F)D.call(F,rt)&&rt!=="key"&&rt!=="__self"&&rt!=="__source"&&(ct[rt]=F[rt]);var ft=arguments.length-2;if(ft===1)ct.children=et;else if(1<ft){for(var ut=Array(ft),dt=0;dt<ft;dt++)ut[dt]=arguments[dt+2];ct.children=ut}if(L&&L.defaultProps)for(rt in ft=L.defaultProps,ft)ct[rt]===void 0&&(ct[rt]=ft[rt]);return U(L,ht,ct)},jt.createRef=function(){return{current:null}},jt.forwardRef=function(L){return{$$typeof:u,render:L}},jt.isValidElement=Y,jt.lazy=function(L){return{$$typeof:p,_payload:{_status:-1,_result:L},_init:z}},jt.memo=function(L,F){return{$$typeof:h,type:L,compare:F===void 0?null:F}},jt.startTransition=function(L){var F=O.T,et={};O.T=et;try{var rt=L(),ct=O.S;ct!==null&&ct(et,rt),typeof rt=="object"&&rt!==null&&typeof rt.then=="function"&&rt.then(A,$)}catch(ht){$(ht)}finally{F!==null&&et.types!==null&&(F.types=et.types),O.T=F}},jt.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},jt.use=function(L){return O.H.use(L)},jt.useActionState=function(L,F,et){return O.H.useActionState(L,F,et)},jt.useCallback=function(L,F){return O.H.useCallback(L,F)},jt.useContext=function(L){return O.H.useContext(L)},jt.useDebugValue=function(){},jt.useDeferredValue=function(L,F){return O.H.useDeferredValue(L,F)},jt.useEffect=function(L,F){return O.H.useEffect(L,F)},jt.useEffectEvent=function(L){return O.H.useEffectEvent(L)},jt.useId=function(){return O.H.useId()},jt.useImperativeHandle=function(L,F,et){return O.H.useImperativeHandle(L,F,et)},jt.useInsertionEffect=function(L,F){return O.H.useInsertionEffect(L,F)},jt.useLayoutEffect=function(L,F){return O.H.useLayoutEffect(L,F)},jt.useMemo=function(L,F){return O.H.useMemo(L,F)},jt.useOptimistic=function(L,F){return O.H.useOptimistic(L,F)},jt.useReducer=function(L,F,et){return O.H.useReducer(L,F,et)},jt.useRef=function(L){return O.H.useRef(L)},jt.useState=function(L){return O.H.useState(L)},jt.useSyncExternalStore=function(L,F,et){return O.H.useSyncExternalStore(L,F,et)},jt.useTransition=function(){return O.H.useTransition()},jt.version="19.2.0",jt}var C0;function Hs(){return C0||(C0=1,Yf.exports=_N()),Yf.exports}var N=Hs();const ko=$f(N),T0=wN({__proto__:null,default:ko},[N]);var qf={exports:{}},Us={},Gf={exports:{}},Ff={};var N0;function SN(){return N0||(N0=1,(function(t){function e(j,I){var z=j.length;j.push(I);t:for(;0<z;){var $=z-1>>>1,G=j[$];if(0<s(G,I))j[$]=I,j[z]=G,z=$;else break t}}function n(j){return j.length===0?null:j[0]}function o(j){if(j.length===0)return null;var I=j[0],z=j.pop();if(z!==I){j[0]=z;t:for(var $=0,G=j.length,L=G>>>1;$<L;){var F=2*($+1)-1,et=j[F],rt=F+1,ct=j[rt];if(0>s(et,z))rt<G&&0>s(ct,et)?(j[$]=ct,j[rt]=z,$=rt):(j[$]=et,j[F]=z,$=F);else if(rt<G&&0>s(ct,z))j[$]=ct,j[rt]=z,$=rt;else break t}}return I}function s(j,I){var z=j.sortIndex-I.sortIndex;return z!==0?z:j.id-I.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var l=Date,u=l.now();t.unstable_now=function(){return l.now()-u}}var d=[],h=[],p=1,m=null,y=3,b=!1,x=!1,w=!1,_=!1,S=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function E(j){for(var I=n(h);I!==null;){if(I.callback===null)o(h);else if(I.startTime<=j)o(h),I.sortIndex=I.expirationTime,e(d,I);else break;I=n(h)}}function R(j){if(w=!1,E(j),!x)if(n(d)!==null)x=!0,A||(A=!0,K());else{var I=n(h);I!==null&&H(R,I.startTime-j)}}var A=!1,O=-1,D=5,U=-1;function q(){return _?!0:!(t.unstable_now()-U<D)}function Y(){if(_=!1,A){var j=t.unstable_now();U=j;var I=!0;try{t:{x=!1,w&&(w=!1,k(O),O=-1),b=!0;var z=y;try{e:{for(E(j),m=n(d);m!==null&&!(m.expirationTime>j&&q());){var $=m.callback;if(typeof $=="function"){m.callback=null,y=m.priorityLevel;var G=$(m.expirationTime<=j);if(j=t.unstable_now(),typeof G=="function"){m.callback=G,E(j),I=!0;break e}m===n(d)&&o(d),E(j)}else o(d);m=n(d)}if(m!==null)I=!0;else{var L=n(h);L!==null&&H(R,L.startTime-j),I=!1}}break t}finally{m=null,y=z,b=!1}I=void 0}}finally{I?K():A=!1}}}var K;if(typeof C=="function")K=function(){C(Y)};else if(typeof MessageChannel<"u"){var W=new MessageChannel,B=W.port2;W.port1.onmessage=Y,K=function(){B.postMessage(null)}}else K=function(){S(Y,0)};function H(j,I){O=S(function(){j(t.unstable_now())},I)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(j){j.callback=null},t.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):D=0<j?Math.floor(1e3/j):5},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_next=function(j){switch(y){case 1:case 2:case 3:var I=3;break;default:I=y}var z=y;y=I;try{return j()}finally{y=z}},t.unstable_requestPaint=function(){_=!0},t.unstable_runWithPriority=function(j,I){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var z=y;y=j;try{return I()}finally{y=z}},t.unstable_scheduleCallback=function(j,I,z){var $=t.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?$+z:$):z=$,j){case 1:var G=-1;break;case 2:G=250;break;case 5:G=1073741823;break;case 4:G=1e4;break;default:G=5e3}return G=z+G,j={id:p++,callback:I,priorityLevel:j,startTime:z,expirationTime:G,sortIndex:-1},z>$?(j.sortIndex=z,e(h,j),n(d)===null&&j===n(h)&&(w?(k(O),O=-1):w=!0,H(R,z-$))):(j.sortIndex=G,e(d,j),x||b||(x=!0,A||(A=!0,K()))),j},t.unstable_shouldYield=q,t.unstable_wrapCallback=function(j){var I=y;return function(){var z=y;y=I;try{return j.apply(this,arguments)}finally{y=z}}}})(Ff)),Ff}var A0;function EN(){return A0||(A0=1,Gf.exports=SN()),Gf.exports}var Xf={exports:{}},Ue={};var M0;function CN(){if(M0)return Ue;M0=1;var t=Hs();function e(d){var h="https://react.dev/errors/"+d;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+d+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var o={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(d,h,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:m==null?null:""+m,children:d,containerInfo:h,implementation:p}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(d,h){if(d==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Ue.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=o,Ue.createPortal=function(d,h){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(e(299));return a(d,h,null,p)},Ue.flushSync=function(d){var h=l.T,p=o.p;try{if(l.T=null,o.p=2,d)return d()}finally{l.T=h,o.p=p,o.d.f()}},Ue.preconnect=function(d,h){typeof d=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,o.d.C(d,h))},Ue.prefetchDNS=function(d){typeof d=="string"&&o.d.D(d)},Ue.preinit=function(d,h){if(typeof d=="string"&&h&&typeof h.as=="string"){var p=h.as,m=u(p,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;p==="style"?o.d.S(d,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:m,integrity:y,fetchPriority:b}):p==="script"&&o.d.X(d,{crossOrigin:m,integrity:y,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Ue.preinitModule=function(d,h){if(typeof d=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var p=u(h.as,h.crossOrigin);o.d.M(d,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&o.d.M(d)},Ue.preload=function(d,h){if(typeof d=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var p=h.as,m=u(p,h.crossOrigin);o.d.L(d,p,{crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Ue.preloadModule=function(d,h){if(typeof d=="string")if(h){var p=u(h.as,h.crossOrigin);o.d.m(d,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else o.d.m(d)},Ue.requestFormReset=function(d){o.d.r(d)},Ue.unstable_batchedUpdates=function(d,h){return d(h)},Ue.useFormState=function(d,h,p){return l.H.useFormState(d,h,p)},Ue.useFormStatus=function(){return l.H.useHostTransitionStatus()},Ue.version="19.2.0",Ue}var R0;function k0(){if(R0)return Xf.exports;R0=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Xf.exports=CN(),Xf.exports}var O0;function TN(){if(O0)return Us;O0=1;var t=EN(),e=Hs(),n=k0();function o(i){var r="https://react.dev/errors/"+i;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var c=2;c<arguments.length;c++)r+="&args[]="+encodeURIComponent(arguments[c])}return"Minified React error #"+i+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(i){return!(!i||i.nodeType!==1&&i.nodeType!==9&&i.nodeType!==11)}function a(i){var r=i,c=i;if(i.alternate)for(;r.return;)r=r.return;else{i=r;do r=i,(r.flags&4098)!==0&&(c=r.return),i=r.return;while(i)}return r.tag===3?c:null}function l(i){if(i.tag===13){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function u(i){if(i.tag===31){var r=i.memoizedState;if(r===null&&(i=i.alternate,i!==null&&(r=i.memoizedState)),r!==null)return r.dehydrated}return null}function d(i){if(a(i)!==i)throw Error(o(188))}function h(i){var r=i.alternate;if(!r){if(r=a(i),r===null)throw Error(o(188));return r!==i?null:i}for(var c=i,f=r;;){var g=c.return;if(g===null)break;var v=g.alternate;if(v===null){if(f=g.return,f!==null){c=f;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===c)return d(g),i;if(v===f)return d(g),r;v=v.sibling}throw Error(o(188))}if(c.return!==f.return)c=g,f=v;else{for(var T=!1,V=g.child;V;){if(V===c){T=!0,c=g,f=v;break}if(V===f){T=!0,f=g,c=v;break}V=V.sibling}if(!T){for(V=v.child;V;){if(V===c){T=!0,c=v,f=g;break}if(V===f){T=!0,f=v,c=g;break}V=V.sibling}if(!T)throw Error(o(189))}}if(c.alternate!==f)throw Error(o(190))}if(c.tag!==3)throw Error(o(188));return c.stateNode.current===c?i:r}function p(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i;for(i=i.child;i!==null;){if(r=p(i),r!==null)return r;i=i.sibling}return null}var m=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),_=Symbol.for("react.strict_mode"),S=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),C=Symbol.for("react.context"),E=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),U=Symbol.for("react.activity"),q=Symbol.for("react.memo_cache_sentinel"),Y=Symbol.iterator;function K(i){return i===null||typeof i!="object"?null:(i=Y&&i[Y]||i["@@iterator"],typeof i=="function"?i:null)}var W=Symbol.for("react.client.reference");function B(i){if(i==null)return null;if(typeof i=="function")return i.$$typeof===W?null:i.displayName||i.name||null;if(typeof i=="string")return i;switch(i){case w:return"Fragment";case S:return"Profiler";case _:return"StrictMode";case R:return"Suspense";case A:return"SuspenseList";case U:return"Activity"}if(typeof i=="object")switch(i.$$typeof){case x:return"Portal";case C:return i.displayName||"Context";case k:return(i._context.displayName||"Context")+".Consumer";case E:var r=i.render;return i=i.displayName,i||(i=r.displayName||r.name||"",i=i!==""?"ForwardRef("+i+")":"ForwardRef"),i;case O:return r=i.displayName||null,r!==null?r:B(i.type)||"Memo";case D:r=i._payload,i=i._init;try{return B(i(r))}catch{}}return null}var H=Array.isArray,j=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z={pending:!1,data:null,method:null,action:null},$=[],G=-1;function L(i){return{current:i}}function F(i){0>G||(i.current=$[G],$[G]=null,G--)}function et(i,r){G++,$[G]=i.current,i.current=r}var rt=L(null),ct=L(null),ht=L(null),ft=L(null);function ut(i,r){switch(et(ht,r),et(ct,i),et(rt,null),r.nodeType){case 9:case 11:i=(i=r.documentElement)&&(i=i.namespaceURI)?YT(i):0;break;default:if(i=r.tagName,r=r.namespaceURI)r=YT(r),i=qT(r,i);else switch(i){case"svg":i=1;break;case"math":i=2;break;default:i=0}}F(rt),et(rt,i)}function dt(){F(rt),F(ct),F(ht)}function Ot(i){i.memoizedState!==null&&et(ft,i);var r=rt.current,c=qT(r,i.type);r!==c&&(et(ct,i),et(rt,c))}function At(i){ct.current===i&&(F(rt),F(ct)),ft.current===i&&(F(ft),Rl._currentValue=z)}var bt,Tt;function Dt(i){if(bt===void 0)try{throw Error()}catch(c){var r=c.stack.trim().match(/\n( *(at )?)/);bt=r&&r[1]||"",Tt=-1<c.stack.indexOf(`
|
|
2
|
+
at`)?" (<anonymous>)":-1<c.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
3
|
+
`+bt+i+Tt}var Xt=!1;function Ft(i,r){if(!i||Xt)return"";Xt=!0;var c=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(r){var lt=function(){throw Error()};if(Object.defineProperty(lt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(lt,[])}catch(ot){var it=ot}Reflect.construct(i,[],lt)}else{try{lt.call()}catch(ot){it=ot}i.call(lt.prototype)}}else{try{throw Error()}catch(ot){it=ot}(lt=i())&&typeof lt.catch=="function"&<.catch(function(){})}}catch(ot){if(ot&&it&&typeof ot.stack=="string")return[ot.stack,it.stack]}return[null,null]}};f.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(f.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(f.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=f.DetermineComponentFrameRoot(),T=v[0],V=v[1];if(T&&V){var Z=T.split(`
|
|
4
4
|
`),nt=V.split(`
|
|
5
|
-
`);for(g=f=0;f<
|
|
6
|
-
`+
|
|
5
|
+
`);for(g=f=0;f<Z.length&&!Z[f].includes("DetermineComponentFrameRoot");)f++;for(;g<nt.length&&!nt[g].includes("DetermineComponentFrameRoot");)g++;if(f===Z.length||g===nt.length)for(f=Z.length-1,g=nt.length-1;1<=f&&0<=g&&Z[f]!==nt[g];)g--;for(;1<=f&&0<=g;f--,g--)if(Z[f]!==nt[g]){if(f!==1||g!==1)do if(f--,g--,0>g||Z[f]!==nt[g]){var st=`
|
|
6
|
+
`+Z[f].replace(" at new "," at ");return i.displayName&&st.includes("<anonymous>")&&(st=st.replace("<anonymous>",i.displayName)),st}while(1<=f&&0<=g);break}}}finally{Xt=!1,Error.prepareStackTrace=c}return(c=i?i.displayName||i.name:"")?Dt(c):""}function pt(i,r){switch(i.tag){case 26:case 27:case 5:return Dt(i.type);case 16:return Dt("Lazy");case 13:return i.child!==r&&r!==null?Dt("Suspense Fallback"):Dt("Suspense");case 19:return Dt("SuspenseList");case 0:case 15:return Ft(i.type,!1);case 11:return Ft(i.type.render,!1);case 1:return Ft(i.type,!0);case 31:return Dt("Activity");default:return""}}function yt(i){try{var r="",c=null;do r+=pt(i,c),c=i,i=i.return;while(i);return r}catch(f){return`
|
|
7
7
|
Error generating stack: `+f.message+`
|
|
8
|
-
`+f.stack}}var yt=Object.prototype.hasOwnProperty,mt=t.unstable_scheduleCallback,Et=t.unstable_cancelCallback,Vt=t.unstable_shouldYield,jt=t.unstable_requestPaint,zt=t.unstable_now,ue=t.unstable_getCurrentPriorityLevel,Xt=t.unstable_ImmediatePriority,xe=t.unstable_UserBlockingPriority,Pe=t.unstable_NormalPriority,Po=t.unstable_LowPriority,Ae=t.unstable_IdlePriority,So=t.log,_i=t.unstable_setDisableYieldValue,pe=null,re=null;function ee(o){if(typeof So=="function"&&_i(o),re&&typeof re.setStrictMode=="function")try{re.setStrictMode(pe,o)}catch{}}var Ee=Math.clz32?Math.clz32:Mi,Ni=Math.log,Ai=Math.LN2;function Mi(o){return o>>>=0,o===0?32:31-(Ni(o)/Ai|0)|0}var Jn=256,to=262144,Eo=4194304;function mn(o){var r=o&42;if(r!==0)return r;switch(o&-o){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 o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ri(o,r,l){var f=o.pendingLanes;if(f===0)return 0;var g=0,v=o.suspendedLanes,_=o.pingedLanes;o=o.warmLanes;var V=f&134217727;return V!==0?(f=V&~v,f!==0?g=mn(f):(_&=V,_!==0?g=mn(_):l||(l=V&~o,l!==0&&(g=mn(l))))):(V=f&~v,V!==0?g=mn(V):_!==0?g=mn(_):l||(l=f&~o,l!==0&&(g=mn(l)))),g===0?0:r!==0&&r!==g&&(r&v)===0&&(v=g&-g,l=r&-r,v>=l||v===32&&(l&4194048)!==0)?r:g}function eo(o,r){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&r)===0}function tn(o,r){switch(o){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 ki(){var o=Eo;return Eo<<=1,(Eo&62914560)===0&&(Eo=4194304),o}function Ke(o){for(var r=[],l=0;31>l;l++)r.push(o);return r}function no(o,r){o.pendingLanes|=r,r!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Oi(o,r,l,f,g,v){var _=o.pendingLanes;o.pendingLanes=l,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=l,o.entangledLanes&=l,o.errorRecoveryDisabledLanes&=l,o.shellSuspendCounter=0;var V=o.entanglements,X=o.expirationTimes,nt=o.hiddenUpdates;for(l=_&~l;0<l;){var st=31-Ee(l),ct=1<<st;V[st]=0,X[st]=-1;var ot=nt[st];if(ot!==null)for(nt[st]=null,st=0;st<ot.length;st++){var rt=ot[st];rt!==null&&(rt.lane&=-536870913)}l&=~ct}f!==0&&Di(o,f,0),v!==0&&g===0&&o.tag!==0&&(o.suspendedLanes|=v&~(_&~r))}function Di(o,r,l){o.pendingLanes|=r,o.suspendedLanes&=~r;var f=31-Ee(r);o.entangledLanes|=r,o.entanglements[f]=o.entanglements[f]|1073741824|l&261930}function ji(o,r){var l=o.entangledLanes|=r;for(o=o.entanglements;l;){var f=31-Ee(l),g=1<<f;g&r|o[f]&r&&(o[f]|=r),l&=~g}}function zi(o,r){var l=r&-r;return l=(l&42)!==0?1:Ho(l),(l&(o.suspendedLanes|r))!==0?0:l}function Ho(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=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:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function Uo(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function $o(){var o=I.p;return o!==0?o:(o=window.event,o===void 0?32:pN(o.type))}function Vi(o,r){var l=I.p;try{return I.p=o,r()}finally{I.p=l}}var en=Math.random().toString(36).slice(2),ve="__reactFiber$"+en,Me="__reactProps$"+en,gn="__reactContainer$"+en,Co="__reactEvents$"+en,Li="__reactListeners$"+en,zr="__reactHandles$"+en,Ii="__reactResources$"+en,oo="__reactMarker$"+en;function qo(o){delete o[ve],delete o[Me],delete o[Co],delete o[Li],delete o[zr]}function Mn(o){var r=o[ve];if(r)return r;for(var l=o.parentNode;l;){if(r=l[gn]||l[ve]){if(l=r.alternate,r.child!==null||l!==null&&l.child!==null)for(o=W_(o);o!==null;){if(l=o[ve])return l;o=W_(o)}return r}o=l,l=o.parentNode}return null}function yn(o){if(o=o[ve]||o[gn]){var r=o.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return o}return null}function Rn(o){var r=o.tag;if(r===5||r===26||r===27||r===6)return o.stateNode;throw Error(i(33))}function kn(o){var r=o[Ii];return r||(r=o[Ii]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function me(o){o[oo]=!0}var Bi=new Set,Pi={};function vn(o,r){On(o,r),On(o+"Capture",r)}function On(o,r){for(Pi[o]=r,o=0;o<r.length;o++)Bi.add(r[o])}var Ds=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]*$"),Yo={},Hi={};function Ui(o){return yt.call(Hi,o)?!0:yt.call(Yo,o)?!1:Ds.test(o)?Hi[o]=!0:(Yo[o]=!0,!1)}function He(o,r,l){if(Ui(r))if(l===null)o.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":o.removeAttribute(r);return;case"boolean":var f=r.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){o.removeAttribute(r);return}}o.setAttribute(r,""+l)}}function Go(o,r,l){if(l===null)o.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(r);return}o.setAttribute(r,""+l)}}function io(o,r,l,f){if(f===null)o.removeAttribute(l);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(l);return}o.setAttributeNS(r,l,""+f)}}function nn(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Vu(o){var r=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function vm(o,r,l){var f=Object.getOwnPropertyDescriptor(o.constructor.prototype,r);if(!o.hasOwnProperty(r)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var g=f.get,v=f.set;return Object.defineProperty(o,r,{configurable:!0,get:function(){return g.call(this)},set:function(_){l=""+_,v.call(this,_)}}),Object.defineProperty(o,r,{enumerable:f.enumerable}),{getValue:function(){return l},setValue:function(_){l=""+_},stopTracking:function(){o._valueTracker=null,delete o[r]}}}}function js(o){if(!o._valueTracker){var r=Vu(o)?"checked":"value";o._valueTracker=vm(o,r,""+o[r])}}function Lu(o){if(!o)return!1;var r=o._valueTracker;if(!r)return!0;var l=r.getValue(),f="";return o&&(f=Vu(o)?o.checked?"true":"false":o.value),o=f,o!==l?(r.setValue(o),!0):!1}function Vr(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var bm=/[\n"\\]/g;function on(o){return o.replace(bm,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Lr(o,r,l,f,g,v,_,V){o.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?o.type=_:o.removeAttribute("type"),r!=null?_==="number"?(r===0&&o.value===""||o.value!=r)&&(o.value=""+nn(r)):o.value!==""+nn(r)&&(o.value=""+nn(r)):_!=="submit"&&_!=="reset"||o.removeAttribute("value"),r!=null?fl(o,_,nn(r)):l!=null?fl(o,_,nn(l)):f!=null&&o.removeAttribute("value"),g==null&&v!=null&&(o.defaultChecked=!!v),g!=null&&(o.checked=g&&typeof g!="function"&&typeof g!="symbol"),V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"?o.name=""+nn(V):o.removeAttribute("name")}function Iu(o,r,l,f,g,v,_,V){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(o.type=v),r!=null||l!=null){if(!(v!=="submit"&&v!=="reset"||r!=null)){js(o);return}l=l!=null?""+nn(l):"",r=r!=null?""+nn(r):l,V||r===o.value||(o.value=r),o.defaultValue=r}f=f??g,f=typeof f!="function"&&typeof f!="symbol"&&!!f,o.checked=V?o.checked:!!f,o.defaultChecked=!!f,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(o.name=_),js(o)}function fl(o,r,l){r==="number"&&Vr(o.ownerDocument)===o||o.defaultValue===""+l||(o.defaultValue=""+l)}function Xo(o,r,l,f){if(o=o.options,r){r={};for(var g=0;g<l.length;g++)r["$"+l[g]]=!0;for(l=0;l<o.length;l++)g=r.hasOwnProperty("$"+o[l].value),o[l].selected!==g&&(o[l].selected=g),g&&f&&(o[l].defaultSelected=!0)}else{for(l=""+nn(l),r=null,g=0;g<o.length;g++){if(o[g].value===l){o[g].selected=!0,f&&(o[g].defaultSelected=!0);return}r!==null||o[g].disabled||(r=o[g])}r!==null&&(r.selected=!0)}}function BC(o,r,l){if(r!=null&&(r=""+nn(r),r!==o.value&&(o.value=r),l==null)){o.defaultValue!==r&&(o.defaultValue=r);return}o.defaultValue=l!=null?""+nn(l):""}function PC(o,r,l,f){if(r==null){if(f!=null){if(l!=null)throw Error(i(92));if(P(f)){if(1<f.length)throw Error(i(93));f=f[0]}l=f}l==null&&(l=""),r=l}l=nn(r),o.defaultValue=l,f=o.textContent,f===l&&f!==""&&f!==null&&(o.value=f),js(o)}function zs(o,r){if(r){var l=o.firstChild;if(l&&l===o.lastChild&&l.nodeType===3){l.nodeValue=r;return}}o.textContent=r}var j9=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 HC(o,r,l){var f=r.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?f?o.setProperty(r,""):r==="float"?o.cssFloat="":o[r]="":f?o.setProperty(r,l):typeof l!="number"||l===0||j9.has(r)?r==="float"?o.cssFloat=l:o[r]=(""+l).trim():o[r]=l+"px"}function UC(o,r,l){if(r!=null&&typeof r!="object")throw Error(i(62));if(o=o.style,l!=null){for(var f in l)!l.hasOwnProperty(f)||r!=null&&r.hasOwnProperty(f)||(f.indexOf("--")===0?o.setProperty(f,""):f==="float"?o.cssFloat="":o[f]="");for(var g in r)f=r[g],r.hasOwnProperty(g)&&l[g]!==f&&HC(o,g,f)}else for(var v in r)r.hasOwnProperty(v)&&HC(o,v,r[v])}function xm(o){if(o.indexOf("-")===-1)return!1;switch(o){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 z9=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"]]),V9=/^[\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 Bu(o){return V9.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Fo(){}var wm=null;function Sm(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Vs=null,Ls=null;function $C(o){var r=yn(o);if(r&&(o=r.stateNode)){var l=o[Me]||null;t:switch(o=r.stateNode,r.type){case"input":if(Lr(o,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),r=l.name,l.type==="radio"&&r!=null){for(l=o;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+on(""+r)+'"][type="radio"]'),r=0;r<l.length;r++){var f=l[r];if(f!==o&&f.form===o.form){var g=f[Me]||null;if(!g)throw Error(i(90));Lr(f,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(r=0;r<l.length;r++)f=l[r],f.form===o.form&&Lu(f)}break t;case"textarea":BC(o,l.value,l.defaultValue);break t;case"select":r=l.value,r!=null&&Xo(o,!!l.multiple,r,!1)}}}var Em=!1;function qC(o,r,l){if(Em)return o(r,l);Em=!0;try{var f=o(r);return f}finally{if(Em=!1,(Vs!==null||Ls!==null)&&(Nf(),Vs&&(r=Vs,o=Ls,Ls=Vs=null,$C(r),o)))for(r=0;r<o.length;r++)$C(o[r])}}function dl(o,r){var l=o.stateNode;if(l===null)return null;var f=l[Me]||null;if(f===null)return null;l=f[r];t:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(o=o.type,f=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!f;break t;default:o=!1}if(o)return null;if(l&&typeof l!="function")throw Error(i(231,r,typeof l));return l}var Zo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cm=!1;if(Zo)try{var hl={};Object.defineProperty(hl,"passive",{get:function(){Cm=!0}}),window.addEventListener("test",hl,hl),window.removeEventListener("test",hl,hl)}catch{Cm=!1}var $i=null,Tm=null,Pu=null;function YC(){if(Pu)return Pu;var o,r=Tm,l=r.length,f,g="value"in $i?$i.value:$i.textContent,v=g.length;for(o=0;o<l&&r[o]===g[o];o++);var _=l-o;for(f=1;f<=_&&r[l-f]===g[v-f];f++);return Pu=g.slice(o,1<f?1-f:void 0)}function Hu(o){var r=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&r===13&&(o=13)):o=r,o===10&&(o=13),32<=o||o===13?o:0}function Uu(){return!0}function GC(){return!1}function rn(o){function r(l,f,g,v,_){this._reactName=l,this._targetInst=g,this.type=f,this.nativeEvent=v,this.target=_,this.currentTarget=null;for(var V in o)o.hasOwnProperty(V)&&(l=o[V],this[V]=l?l(v):v[V]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Uu:GC,this.isPropagationStopped=GC,this}return m(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Uu)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Uu)},persist:function(){},isPersistent:Uu}),r}var Ir={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$u=rn(Ir),pl=m({},Ir,{view:0,detail:0}),L9=rn(pl),_m,Nm,ml,qu=m({},pl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mm,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==ml&&(ml&&o.type==="mousemove"?(_m=o.screenX-ml.screenX,Nm=o.screenY-ml.screenY):Nm=_m=0,ml=o),_m)},movementY:function(o){return"movementY"in o?o.movementY:Nm}}),XC=rn(qu),I9=m({},qu,{dataTransfer:0}),B9=rn(I9),P9=m({},pl,{relatedTarget:0}),Am=rn(P9),H9=m({},Ir,{animationName:0,elapsedTime:0,pseudoElement:0}),U9=rn(H9),$9=m({},Ir,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),q9=rn($9),Y9=m({},Ir,{data:0}),FC=rn(Y9),G9={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},X9={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"},F9={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Z9(o){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(o):(o=F9[o])?!!r[o]:!1}function Mm(){return Z9}var K9=m({},pl,{key:function(o){if(o.key){var r=G9[o.key]||o.key;if(r!=="Unidentified")return r}return o.type==="keypress"?(o=Hu(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?X9[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mm,charCode:function(o){return o.type==="keypress"?Hu(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Hu(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),Q9=rn(K9),W9=m({},qu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ZC=rn(W9),J9=m({},pl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mm}),t$=rn(J9),e$=m({},Ir,{propertyName:0,elapsedTime:0,pseudoElement:0}),n$=rn(e$),o$=m({},qu,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),i$=rn(o$),r$=m({},Ir,{newState:0,oldState:0}),s$=rn(r$),a$=[9,13,27,32],Rm=Zo&&"CompositionEvent"in window,gl=null;Zo&&"documentMode"in document&&(gl=document.documentMode);var l$=Zo&&"TextEvent"in window&&!gl,KC=Zo&&(!Rm||gl&&8<gl&&11>=gl),QC=" ",WC=!1;function JC(o,r){switch(o){case"keyup":return a$.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function t2(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Is=!1;function c$(o,r){switch(o){case"compositionend":return t2(r);case"keypress":return r.which!==32?null:(WC=!0,QC);case"textInput":return o=r.data,o===QC&&WC?null:o;default:return null}}function u$(o,r){if(Is)return o==="compositionend"||!Rm&&JC(o,r)?(o=YC(),Pu=Tm=$i=null,Is=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return KC&&r.locale!=="ko"?null:r.data;default:return null}}var f$={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 e2(o){var r=o&&o.nodeName&&o.nodeName.toLowerCase();return r==="input"?!!f$[o.type]:r==="textarea"}function n2(o,r,l,f){Vs?Ls?Ls.push(f):Ls=[f]:Vs=f,r=jf(r,"onChange"),0<r.length&&(l=new $u("onChange","change",null,l,f),o.push({event:l,listeners:r}))}var yl=null,vl=null;function d$(o){I_(o,0)}function Yu(o){var r=Rn(o);if(Lu(r))return o}function o2(o,r){if(o==="change")return r}var i2=!1;if(Zo){var km;if(Zo){var Om="oninput"in document;if(!Om){var r2=document.createElement("div");r2.setAttribute("oninput","return;"),Om=typeof r2.oninput=="function"}km=Om}else km=!1;i2=km&&(!document.documentMode||9<document.documentMode)}function s2(){yl&&(yl.detachEvent("onpropertychange",a2),vl=yl=null)}function a2(o){if(o.propertyName==="value"&&Yu(vl)){var r=[];n2(r,vl,o,Sm(o)),qC(d$,r)}}function h$(o,r,l){o==="focusin"?(s2(),yl=r,vl=l,yl.attachEvent("onpropertychange",a2)):o==="focusout"&&s2()}function p$(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Yu(vl)}function m$(o,r){if(o==="click")return Yu(r)}function g$(o,r){if(o==="input"||o==="change")return Yu(r)}function y$(o,r){return o===r&&(o!==0||1/o===1/r)||o!==o&&r!==r}var bn=typeof Object.is=="function"?Object.is:y$;function bl(o,r){if(bn(o,r))return!0;if(typeof o!="object"||o===null||typeof r!="object"||r===null)return!1;var l=Object.keys(o),f=Object.keys(r);if(l.length!==f.length)return!1;for(f=0;f<l.length;f++){var g=l[f];if(!yt.call(r,g)||!bn(o[g],r[g]))return!1}return!0}function l2(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function c2(o,r){var l=l2(o);o=0;for(var f;l;){if(l.nodeType===3){if(f=o+l.textContent.length,o<=r&&f>=r)return{node:l,offset:r-o};o=f}t:{for(;l;){if(l.nextSibling){l=l.nextSibling;break t}l=l.parentNode}l=void 0}l=l2(l)}}function u2(o,r){return o&&r?o===r?!0:o&&o.nodeType===3?!1:r&&r.nodeType===3?u2(o,r.parentNode):"contains"in o?o.contains(r):o.compareDocumentPosition?!!(o.compareDocumentPosition(r)&16):!1:!1}function f2(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var r=Vr(o.document);r instanceof o.HTMLIFrameElement;){try{var l=typeof r.contentWindow.location.href=="string"}catch{l=!1}if(l)o=r.contentWindow;else break;r=Vr(o.document)}return r}function Dm(o){var r=o&&o.nodeName&&o.nodeName.toLowerCase();return r&&(r==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||r==="textarea"||o.contentEditable==="true")}var v$=Zo&&"documentMode"in document&&11>=document.documentMode,Bs=null,jm=null,xl=null,zm=!1;function d2(o,r,l){var f=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;zm||Bs==null||Bs!==Vr(f)||(f=Bs,"selectionStart"in f&&Dm(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),xl&&bl(xl,f)||(xl=f,f=jf(jm,"onSelect"),0<f.length&&(r=new $u("onSelect","select",null,r,l),o.push({event:r,listeners:f}),r.target=Bs)))}function Br(o,r){var l={};return l[o.toLowerCase()]=r.toLowerCase(),l["Webkit"+o]="webkit"+r,l["Moz"+o]="moz"+r,l}var Ps={animationend:Br("Animation","AnimationEnd"),animationiteration:Br("Animation","AnimationIteration"),animationstart:Br("Animation","AnimationStart"),transitionrun:Br("Transition","TransitionRun"),transitionstart:Br("Transition","TransitionStart"),transitioncancel:Br("Transition","TransitionCancel"),transitionend:Br("Transition","TransitionEnd")},Vm={},h2={};Zo&&(h2=document.createElement("div").style,"AnimationEvent"in window||(delete Ps.animationend.animation,delete Ps.animationiteration.animation,delete Ps.animationstart.animation),"TransitionEvent"in window||delete Ps.transitionend.transition);function Pr(o){if(Vm[o])return Vm[o];if(!Ps[o])return o;var r=Ps[o],l;for(l in r)if(r.hasOwnProperty(l)&&l in h2)return Vm[o]=r[l];return o}var p2=Pr("animationend"),m2=Pr("animationiteration"),g2=Pr("animationstart"),b$=Pr("transitionrun"),x$=Pr("transitionstart"),w$=Pr("transitioncancel"),y2=Pr("transitionend"),v2=new Map,Lm="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(" ");Lm.push("scrollEnd");function ro(o,r){v2.set(o,r),vn(r,[o])}var Gu=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Dn=[],Hs=0,Im=0;function Xu(){for(var o=Hs,r=Im=Hs=0;r<o;){var l=Dn[r];Dn[r++]=null;var f=Dn[r];Dn[r++]=null;var g=Dn[r];Dn[r++]=null;var v=Dn[r];if(Dn[r++]=null,f!==null&&g!==null){var _=f.pending;_===null?g.next=g:(g.next=_.next,_.next=g),f.pending=g}v!==0&&b2(l,g,v)}}function Fu(o,r,l,f){Dn[Hs++]=o,Dn[Hs++]=r,Dn[Hs++]=l,Dn[Hs++]=f,Im|=f,o.lanes|=f,o=o.alternate,o!==null&&(o.lanes|=f)}function Bm(o,r,l,f){return Fu(o,r,l,f),Zu(o)}function Hr(o,r){return Fu(o,null,null,r),Zu(o)}function b2(o,r,l){o.lanes|=l;var f=o.alternate;f!==null&&(f.lanes|=l);for(var g=!1,v=o.return;v!==null;)v.childLanes|=l,f=v.alternate,f!==null&&(f.childLanes|=l),v.tag===22&&(o=v.stateNode,o===null||o._visibility&1||(g=!0)),o=v,v=v.return;return o.tag===3?(v=o.stateNode,g&&r!==null&&(g=31-Ee(l),o=v.hiddenUpdates,f=o[g],f===null?o[g]=[r]:f.push(r),r.lane=l|536870912),v):null}function Zu(o){if(50<Ul)throw Ul=0,Fg=null,Error(i(185));for(var r=o.return;r!==null;)o=r,r=o.return;return o.tag===3?o.stateNode:null}var Us={};function S$(o,r,l,f){this.tag=o,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xn(o,r,l,f){return new S$(o,r,l,f)}function Pm(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Ko(o,r){var l=o.alternate;return l===null?(l=xn(o.tag,r,o.key,o.mode),l.elementType=o.elementType,l.type=o.type,l.stateNode=o.stateNode,l.alternate=o,o.alternate=l):(l.pendingProps=r,l.type=o.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=o.flags&65011712,l.childLanes=o.childLanes,l.lanes=o.lanes,l.child=o.child,l.memoizedProps=o.memoizedProps,l.memoizedState=o.memoizedState,l.updateQueue=o.updateQueue,r=o.dependencies,l.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},l.sibling=o.sibling,l.index=o.index,l.ref=o.ref,l.refCleanup=o.refCleanup,l}function x2(o,r){o.flags&=65011714;var l=o.alternate;return l===null?(o.childLanes=0,o.lanes=r,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=l.childLanes,o.lanes=l.lanes,o.child=l.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=l.memoizedProps,o.memoizedState=l.memoizedState,o.updateQueue=l.updateQueue,o.type=l.type,r=l.dependencies,o.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),o}function Ku(o,r,l,f,g,v){var _=0;if(f=o,typeof o=="function")Pm(o)&&(_=1);else if(typeof o=="string")_=N7(o,l,it.current)?26:o==="html"||o==="head"||o==="body"?27:5;else t:switch(o){case H:return o=xn(31,l,r,g),o.elementType=H,o.lanes=v,o;case w:return Ur(l.children,g,v,r);case S:_=8,g|=24;break;case E:return o=xn(12,l,r,g|2),o.elementType=E,o.lanes=v,o;case R:return o=xn(13,l,r,g),o.elementType=R,o.lanes=v,o;case A:return o=xn(19,l,r,g),o.elementType=A,o.lanes=v,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case T:_=10;break t;case D:_=9;break t;case C:_=11;break t;case O:_=14;break t;case k:_=16,f=null;break t}_=29,l=Error(i(130,o===null?"null":typeof o,"")),f=null}return r=xn(_,l,r,g),r.elementType=o,r.type=f,r.lanes=v,r}function Ur(o,r,l,f){return o=xn(7,o,f,r),o.lanes=l,o}function Hm(o,r,l){return o=xn(6,o,null,r),o.lanes=l,o}function w2(o){var r=xn(18,null,null,0);return r.stateNode=o,r}function Um(o,r,l){return r=xn(4,o.children!==null?o.children:[],o.key,r),r.lanes=l,r.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},r}var S2=new WeakMap;function jn(o,r){if(typeof o=="object"&&o!==null){var l=S2.get(o);return l!==void 0?l:(r={value:o,source:r,stack:gt(r)},S2.set(o,r),r)}return{value:o,source:r,stack:gt(r)}}var $s=[],qs=0,Qu=null,wl=0,zn=[],Vn=0,qi=null,To=1,_o="";function Qo(o,r){$s[qs++]=wl,$s[qs++]=Qu,Qu=o,wl=r}function E2(o,r,l){zn[Vn++]=To,zn[Vn++]=_o,zn[Vn++]=qi,qi=o;var f=To;o=_o;var g=32-Ee(f)-1;f&=~(1<<g),l+=1;var v=32-Ee(r)+g;if(30<v){var _=g-g%5;v=(f&(1<<_)-1).toString(32),f>>=_,g-=_,To=1<<32-Ee(r)+g|l<<g|f,_o=v+o}else To=1<<v|l<<g|f,_o=o}function $m(o){o.return!==null&&(Qo(o,1),E2(o,1,0))}function qm(o){for(;o===Qu;)Qu=$s[--qs],$s[qs]=null,wl=$s[--qs],$s[qs]=null;for(;o===qi;)qi=zn[--Vn],zn[Vn]=null,_o=zn[--Vn],zn[Vn]=null,To=zn[--Vn],zn[Vn]=null}function C2(o,r){zn[Vn++]=To,zn[Vn++]=_o,zn[Vn++]=qi,To=r.id,_o=r.overflow,qi=o}var Ue=null,fe=null,Ft=!1,Yi=null,Ln=!1,Ym=Error(i(519));function Gi(o){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Sl(jn(r,o)),Ym}function T2(o){var r=o.stateNode,l=o.type,f=o.memoizedProps;switch(r[ve]=o,r[Me]=f,l){case"dialog":$t("cancel",r),$t("close",r);break;case"iframe":case"object":case"embed":$t("load",r);break;case"video":case"audio":for(l=0;l<ql.length;l++)$t(ql[l],r);break;case"source":$t("error",r);break;case"img":case"image":case"link":$t("error",r),$t("load",r);break;case"details":$t("toggle",r);break;case"input":$t("invalid",r),Iu(r,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":$t("invalid",r);break;case"textarea":$t("invalid",r),PC(r,f.value,f.defaultValue,f.children)}l=f.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||r.textContent===""+l||f.suppressHydrationWarning===!0||U_(r.textContent,l)?(f.popover!=null&&($t("beforetoggle",r),$t("toggle",r)),f.onScroll!=null&&$t("scroll",r),f.onScrollEnd!=null&&$t("scrollend",r),f.onClick!=null&&(r.onclick=Fo),r=!0):r=!1,r||Gi(o,!0)}function _2(o){for(Ue=o.return;Ue;)switch(Ue.tag){case 5:case 31:case 13:Ln=!1;return;case 27:case 3:Ln=!0;return;default:Ue=Ue.return}}function Ys(o){if(o!==Ue)return!1;if(!Ft)return _2(o),Ft=!0,!1;var r=o.tag,l;if((l=r!==3&&r!==27)&&((l=r===5)&&(l=o.type,l=!(l!=="form"&&l!=="button")||c0(o.type,o.memoizedProps)),l=!l),l&&fe&&Gi(o),_2(o),r===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(317));fe=Q_(o)}else if(r===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(317));fe=Q_(o)}else r===27?(r=fe,sr(o.type)?(o=p0,p0=null,fe=o):fe=r):fe=Ue?Bn(o.stateNode.nextSibling):null;return!0}function $r(){fe=Ue=null,Ft=!1}function Gm(){var o=Yi;return o!==null&&(cn===null?cn=o:cn.push.apply(cn,o),Yi=null),o}function Sl(o){Yi===null?Yi=[o]:Yi.push(o)}var Xm=L(null),qr=null,Wo=null;function Xi(o,r,l){tt(Xm,r._currentValue),r._currentValue=l}function Jo(o){o._currentValue=Xm.current,G(Xm)}function Fm(o,r,l){for(;o!==null;){var f=o.alternate;if((o.childLanes&r)!==r?(o.childLanes|=r,f!==null&&(f.childLanes|=r)):f!==null&&(f.childLanes&r)!==r&&(f.childLanes|=r),o===l)break;o=o.return}}function Zm(o,r,l,f){var g=o.child;for(g!==null&&(g.return=o);g!==null;){var v=g.dependencies;if(v!==null){var _=g.child;v=v.firstContext;t:for(;v!==null;){var V=v;v=g;for(var X=0;X<r.length;X++)if(V.context===r[X]){v.lanes|=l,V=v.alternate,V!==null&&(V.lanes|=l),Fm(v.return,l,o),f||(_=null);break t}v=V.next}}else if(g.tag===18){if(_=g.return,_===null)throw Error(i(341));_.lanes|=l,v=_.alternate,v!==null&&(v.lanes|=l),Fm(_,l,o),_=null}else _=g.child;if(_!==null)_.return=g;else for(_=g;_!==null;){if(_===o){_=null;break}if(g=_.sibling,g!==null){g.return=_.return,_=g;break}_=_.return}g=_}}function Gs(o,r,l,f){o=null;for(var g=r,v=!1;g!==null;){if(!v){if((g.flags&524288)!==0)v=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var _=g.alternate;if(_===null)throw Error(i(387));if(_=_.memoizedProps,_!==null){var V=g.type;bn(g.pendingProps.value,_.value)||(o!==null?o.push(V):o=[V])}}else if(g===ft.current){if(_=g.alternate,_===null)throw Error(i(387));_.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(o!==null?o.push(Zl):o=[Zl])}g=g.return}o!==null&&Zm(r,o,l,f),r.flags|=262144}function Wu(o){for(o=o.firstContext;o!==null;){if(!bn(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Yr(o){qr=o,Wo=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function $e(o){return N2(qr,o)}function Ju(o,r){return qr===null&&Yr(o),N2(o,r)}function N2(o,r){var l=r._currentValue;if(r={context:r,memoizedValue:l,next:null},Wo===null){if(o===null)throw Error(i(308));Wo=r,o.dependencies={lanes:0,firstContext:r},o.flags|=524288}else Wo=Wo.next=r;return l}var E$=typeof AbortController<"u"?AbortController:function(){var o=[],r=this.signal={aborted:!1,addEventListener:function(l,f){o.push(f)}};this.abort=function(){r.aborted=!0,o.forEach(function(l){return l()})}},C$=t.unstable_scheduleCallback,T$=t.unstable_NormalPriority,Re={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Km(){return{controller:new E$,data:new Map,refCount:0}}function El(o){o.refCount--,o.refCount===0&&C$(T$,function(){o.controller.abort()})}var Cl=null,Qm=0,Xs=0,Fs=null;function _$(o,r){if(Cl===null){var l=Cl=[];Qm=0,Xs=t0(),Fs={status:"pending",value:void 0,then:function(f){l.push(f)}}}return Qm++,r.then(A2,A2),r}function A2(){if(--Qm===0&&Cl!==null){Fs!==null&&(Fs.status="fulfilled");var o=Cl;Cl=null,Xs=0,Fs=null;for(var r=0;r<o.length;r++)(0,o[r])()}}function N$(o,r){var l=[],f={status:"pending",value:null,reason:null,then:function(g){l.push(g)}};return o.then(function(){f.status="fulfilled",f.value=r;for(var g=0;g<l.length;g++)(0,l[g])(r)},function(g){for(f.status="rejected",f.reason=g,g=0;g<l.length;g++)(0,l[g])(void 0)}),f}var M2=j.S;j.S=function(o,r){d_=zt(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&_$(o,r),M2!==null&&M2(o,r)};var Gr=L(null);function Wm(){var o=Gr.current;return o!==null?o:se.pooledCache}function tf(o,r){r===null?tt(Gr,Gr.current):tt(Gr,r.pool)}function R2(){var o=Wm();return o===null?null:{parent:Re._currentValue,pool:o}}var Zs=Error(i(460)),Jm=Error(i(474)),ef=Error(i(542)),nf={then:function(){}};function k2(o){return o=o.status,o==="fulfilled"||o==="rejected"}function O2(o,r,l){switch(l=o[l],l===void 0?o.push(r):l!==r&&(r.then(Fo,Fo),r=l),r.status){case"fulfilled":return r.value;case"rejected":throw o=r.reason,j2(o),o;default:if(typeof r.status=="string")r.then(Fo,Fo);else{if(o=se,o!==null&&100<o.shellSuspendCounter)throw Error(i(482));o=r,o.status="pending",o.then(function(f){if(r.status==="pending"){var g=r;g.status="fulfilled",g.value=f}},function(f){if(r.status==="pending"){var g=r;g.status="rejected",g.reason=f}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw o=r.reason,j2(o),o}throw Fr=r,Zs}}function Xr(o){try{var r=o._init;return r(o._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Fr=l,Zs):l}}var Fr=null;function D2(){if(Fr===null)throw Error(i(459));var o=Fr;return Fr=null,o}function j2(o){if(o===Zs||o===ef)throw Error(i(483))}var Ks=null,Tl=0;function of(o){var r=Tl;return Tl+=1,Ks===null&&(Ks=[]),O2(Ks,o,r)}function _l(o,r){r=r.props.ref,o.ref=r!==void 0?r:null}function rf(o,r){throw r.$$typeof===y?Error(i(525)):(o=Object.prototype.toString.call(r),Error(i(31,o==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":o)))}function z2(o){function r(W,K){if(o){var et=W.deletions;et===null?(W.deletions=[K],W.flags|=16):et.push(K)}}function l(W,K){if(!o)return null;for(;K!==null;)r(W,K),K=K.sibling;return null}function f(W){for(var K=new Map;W!==null;)W.key!==null?K.set(W.key,W):K.set(W.index,W),W=W.sibling;return K}function g(W,K){return W=Ko(W,K),W.index=0,W.sibling=null,W}function v(W,K,et){return W.index=et,o?(et=W.alternate,et!==null?(et=et.index,et<K?(W.flags|=67108866,K):et):(W.flags|=67108866,K)):(W.flags|=1048576,K)}function _(W){return o&&W.alternate===null&&(W.flags|=67108866),W}function V(W,K,et,at){return K===null||K.tag!==6?(K=Hm(et,W.mode,at),K.return=W,K):(K=g(K,et),K.return=W,K)}function X(W,K,et,at){var Rt=et.type;return Rt===w?st(W,K,et.props.children,at,et.key):K!==null&&(K.elementType===Rt||typeof Rt=="object"&&Rt!==null&&Rt.$$typeof===k&&Xr(Rt)===K.type)?(K=g(K,et.props),_l(K,et),K.return=W,K):(K=Ku(et.type,et.key,et.props,null,W.mode,at),_l(K,et),K.return=W,K)}function nt(W,K,et,at){return K===null||K.tag!==4||K.stateNode.containerInfo!==et.containerInfo||K.stateNode.implementation!==et.implementation?(K=Um(et,W.mode,at),K.return=W,K):(K=g(K,et.children||[]),K.return=W,K)}function st(W,K,et,at,Rt){return K===null||K.tag!==7?(K=Ur(et,W.mode,at,Rt),K.return=W,K):(K=g(K,et),K.return=W,K)}function ct(W,K,et){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=Hm(""+K,W.mode,et),K.return=W,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case b:return et=Ku(K.type,K.key,K.props,null,W.mode,et),_l(et,K),et.return=W,et;case x:return K=Um(K,W.mode,et),K.return=W,K;case k:return K=Xr(K),ct(W,K,et)}if(P(K)||F(K))return K=Ur(K,W.mode,et,null),K.return=W,K;if(typeof K.then=="function")return ct(W,of(K),et);if(K.$$typeof===T)return ct(W,Ju(W,K),et);rf(W,K)}return null}function ot(W,K,et,at){var Rt=K!==null?K.key:null;if(typeof et=="string"&&et!==""||typeof et=="number"||typeof et=="bigint")return Rt!==null?null:V(W,K,""+et,at);if(typeof et=="object"&&et!==null){switch(et.$$typeof){case b:return et.key===Rt?X(W,K,et,at):null;case x:return et.key===Rt?nt(W,K,et,at):null;case k:return et=Xr(et),ot(W,K,et,at)}if(P(et)||F(et))return Rt!==null?null:st(W,K,et,at,null);if(typeof et.then=="function")return ot(W,K,of(et),at);if(et.$$typeof===T)return ot(W,K,Ju(W,et),at);rf(W,et)}return null}function rt(W,K,et,at,Rt){if(typeof at=="string"&&at!==""||typeof at=="number"||typeof at=="bigint")return W=W.get(et)||null,V(K,W,""+at,Rt);if(typeof at=="object"&&at!==null){switch(at.$$typeof){case b:return W=W.get(at.key===null?et:at.key)||null,X(K,W,at,Rt);case x:return W=W.get(at.key===null?et:at.key)||null,nt(K,W,at,Rt);case k:return at=Xr(at),rt(W,K,et,at,Rt)}if(P(at)||F(at))return W=W.get(et)||null,st(K,W,at,Rt,null);if(typeof at.then=="function")return rt(W,K,et,of(at),Rt);if(at.$$typeof===T)return rt(W,K,et,Ju(K,at),Rt);rf(K,at)}return null}function xt(W,K,et,at){for(var Rt=null,Kt=null,_t=K,Bt=K=0,Gt=null;_t!==null&&Bt<et.length;Bt++){_t.index>Bt?(Gt=_t,_t=null):Gt=_t.sibling;var Qt=ot(W,_t,et[Bt],at);if(Qt===null){_t===null&&(_t=Gt);break}o&&_t&&Qt.alternate===null&&r(W,_t),K=v(Qt,K,Bt),Kt===null?Rt=Qt:Kt.sibling=Qt,Kt=Qt,_t=Gt}if(Bt===et.length)return l(W,_t),Ft&&Qo(W,Bt),Rt;if(_t===null){for(;Bt<et.length;Bt++)_t=ct(W,et[Bt],at),_t!==null&&(K=v(_t,K,Bt),Kt===null?Rt=_t:Kt.sibling=_t,Kt=_t);return Ft&&Qo(W,Bt),Rt}for(_t=f(_t);Bt<et.length;Bt++)Gt=rt(_t,W,Bt,et[Bt],at),Gt!==null&&(o&&Gt.alternate!==null&&_t.delete(Gt.key===null?Bt:Gt.key),K=v(Gt,K,Bt),Kt===null?Rt=Gt:Kt.sibling=Gt,Kt=Gt);return o&&_t.forEach(function(fr){return r(W,fr)}),Ft&&Qo(W,Bt),Rt}function Ot(W,K,et,at){if(et==null)throw Error(i(151));for(var Rt=null,Kt=null,_t=K,Bt=K=0,Gt=null,Qt=et.next();_t!==null&&!Qt.done;Bt++,Qt=et.next()){_t.index>Bt?(Gt=_t,_t=null):Gt=_t.sibling;var fr=ot(W,_t,Qt.value,at);if(fr===null){_t===null&&(_t=Gt);break}o&&_t&&fr.alternate===null&&r(W,_t),K=v(fr,K,Bt),Kt===null?Rt=fr:Kt.sibling=fr,Kt=fr,_t=Gt}if(Qt.done)return l(W,_t),Ft&&Qo(W,Bt),Rt;if(_t===null){for(;!Qt.done;Bt++,Qt=et.next())Qt=ct(W,Qt.value,at),Qt!==null&&(K=v(Qt,K,Bt),Kt===null?Rt=Qt:Kt.sibling=Qt,Kt=Qt);return Ft&&Qo(W,Bt),Rt}for(_t=f(_t);!Qt.done;Bt++,Qt=et.next())Qt=rt(_t,W,Bt,Qt.value,at),Qt!==null&&(o&&Qt.alternate!==null&&_t.delete(Qt.key===null?Bt:Qt.key),K=v(Qt,K,Bt),Kt===null?Rt=Qt:Kt.sibling=Qt,Kt=Qt);return o&&_t.forEach(function(I7){return r(W,I7)}),Ft&&Qo(W,Bt),Rt}function ie(W,K,et,at){if(typeof et=="object"&&et!==null&&et.type===w&&et.key===null&&(et=et.props.children),typeof et=="object"&&et!==null){switch(et.$$typeof){case b:t:{for(var Rt=et.key;K!==null;){if(K.key===Rt){if(Rt=et.type,Rt===w){if(K.tag===7){l(W,K.sibling),at=g(K,et.props.children),at.return=W,W=at;break t}}else if(K.elementType===Rt||typeof Rt=="object"&&Rt!==null&&Rt.$$typeof===k&&Xr(Rt)===K.type){l(W,K.sibling),at=g(K,et.props),_l(at,et),at.return=W,W=at;break t}l(W,K);break}else r(W,K);K=K.sibling}et.type===w?(at=Ur(et.props.children,W.mode,at,et.key),at.return=W,W=at):(at=Ku(et.type,et.key,et.props,null,W.mode,at),_l(at,et),at.return=W,W=at)}return _(W);case x:t:{for(Rt=et.key;K!==null;){if(K.key===Rt)if(K.tag===4&&K.stateNode.containerInfo===et.containerInfo&&K.stateNode.implementation===et.implementation){l(W,K.sibling),at=g(K,et.children||[]),at.return=W,W=at;break t}else{l(W,K);break}else r(W,K);K=K.sibling}at=Um(et,W.mode,at),at.return=W,W=at}return _(W);case k:return et=Xr(et),ie(W,K,et,at)}if(P(et))return xt(W,K,et,at);if(F(et)){if(Rt=F(et),typeof Rt!="function")throw Error(i(150));return et=Rt.call(et),Ot(W,K,et,at)}if(typeof et.then=="function")return ie(W,K,of(et),at);if(et.$$typeof===T)return ie(W,K,Ju(W,et),at);rf(W,et)}return typeof et=="string"&&et!==""||typeof et=="number"||typeof et=="bigint"?(et=""+et,K!==null&&K.tag===6?(l(W,K.sibling),at=g(K,et),at.return=W,W=at):(l(W,K),at=Hm(et,W.mode,at),at.return=W,W=at),_(W)):l(W,K)}return function(W,K,et,at){try{Tl=0;var Rt=ie(W,K,et,at);return Ks=null,Rt}catch(_t){if(_t===Zs||_t===ef)throw _t;var Kt=xn(29,_t,null,W.mode);return Kt.lanes=at,Kt.return=W,Kt}}}var Zr=z2(!0),V2=z2(!1),Fi=!1;function tg(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eg(o,r){o=o.updateQueue,r.updateQueue===o&&(r.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Zi(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Ki(o,r,l){var f=o.updateQueue;if(f===null)return null;if(f=f.shared,(Wt&2)!==0){var g=f.pending;return g===null?r.next=r:(r.next=g.next,g.next=r),f.pending=r,r=Zu(o),b2(o,null,l),r}return Fu(o,f,r,l),Zu(o)}function Nl(o,r,l){if(r=r.updateQueue,r!==null&&(r=r.shared,(l&4194048)!==0)){var f=r.lanes;f&=o.pendingLanes,l|=f,r.lanes=l,ji(o,l)}}function ng(o,r){var l=o.updateQueue,f=o.alternate;if(f!==null&&(f=f.updateQueue,l===f)){var g=null,v=null;if(l=l.firstBaseUpdate,l!==null){do{var _={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};v===null?g=v=_:v=v.next=_,l=l.next}while(l!==null);v===null?g=v=r:v=v.next=r}else g=v=r;l={baseState:f.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:f.shared,callbacks:f.callbacks},o.updateQueue=l;return}o=l.lastBaseUpdate,o===null?l.firstBaseUpdate=r:o.next=r,l.lastBaseUpdate=r}var og=!1;function Al(){if(og){var o=Fs;if(o!==null)throw o}}function Ml(o,r,l,f){og=!1;var g=o.updateQueue;Fi=!1;var v=g.firstBaseUpdate,_=g.lastBaseUpdate,V=g.shared.pending;if(V!==null){g.shared.pending=null;var X=V,nt=X.next;X.next=null,_===null?v=nt:_.next=nt,_=X;var st=o.alternate;st!==null&&(st=st.updateQueue,V=st.lastBaseUpdate,V!==_&&(V===null?st.firstBaseUpdate=nt:V.next=nt,st.lastBaseUpdate=X))}if(v!==null){var ct=g.baseState;_=0,st=nt=X=null,V=v;do{var ot=V.lane&-536870913,rt=ot!==V.lane;if(rt?(Yt&ot)===ot:(f&ot)===ot){ot!==0&&ot===Xs&&(og=!0),st!==null&&(st=st.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});t:{var xt=o,Ot=V;ot=r;var ie=l;switch(Ot.tag){case 1:if(xt=Ot.payload,typeof xt=="function"){ct=xt.call(ie,ct,ot);break t}ct=xt;break t;case 3:xt.flags=xt.flags&-65537|128;case 0:if(xt=Ot.payload,ot=typeof xt=="function"?xt.call(ie,ct,ot):xt,ot==null)break t;ct=m({},ct,ot);break t;case 2:Fi=!0}}ot=V.callback,ot!==null&&(o.flags|=64,rt&&(o.flags|=8192),rt=g.callbacks,rt===null?g.callbacks=[ot]:rt.push(ot))}else rt={lane:ot,tag:V.tag,payload:V.payload,callback:V.callback,next:null},st===null?(nt=st=rt,X=ct):st=st.next=rt,_|=ot;if(V=V.next,V===null){if(V=g.shared.pending,V===null)break;rt=V,V=rt.next,rt.next=null,g.lastBaseUpdate=rt,g.shared.pending=null}}while(!0);st===null&&(X=ct),g.baseState=X,g.firstBaseUpdate=nt,g.lastBaseUpdate=st,v===null&&(g.shared.lanes=0),er|=_,o.lanes=_,o.memoizedState=ct}}function L2(o,r){if(typeof o!="function")throw Error(i(191,o));o.call(r)}function I2(o,r){var l=o.callbacks;if(l!==null)for(o.callbacks=null,o=0;o<l.length;o++)L2(l[o],r)}var Qs=L(null),sf=L(0);function B2(o,r){o=li,tt(sf,o),tt(Qs,r),li=o|r.baseLanes}function ig(){tt(sf,li),tt(Qs,Qs.current)}function rg(){li=sf.current,G(Qs),G(sf)}var wn=L(null),In=null;function Qi(o){var r=o.alternate;tt(Ce,Ce.current&1),tt(wn,o),In===null&&(r===null||Qs.current!==null||r.memoizedState!==null)&&(In=o)}function sg(o){tt(Ce,Ce.current),tt(wn,o),In===null&&(In=o)}function P2(o){o.tag===22?(tt(Ce,Ce.current),tt(wn,o),In===null&&(In=o)):Wi()}function Wi(){tt(Ce,Ce.current),tt(wn,wn.current)}function Sn(o){G(wn),In===o&&(In=null),G(Ce)}var Ce=L(0);function af(o){for(var r=o;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||d0(l)||h0(l)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break;for(;r.sibling===null;){if(r.return===null||r.return===o)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var ti=0,It=null,ne=null,ke=null,lf=!1,Ws=!1,Kr=!1,cf=0,Rl=0,Js=null,A$=0;function we(){throw Error(i(321))}function ag(o,r){if(r===null)return!1;for(var l=0;l<r.length&&l<o.length;l++)if(!bn(o[l],r[l]))return!1;return!0}function lg(o,r,l,f,g,v){return ti=v,It=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,j.H=o===null||o.memoizedState===null?ET:Eg,Kr=!1,v=l(f,g),Kr=!1,Ws&&(v=U2(r,l,f,g)),H2(o),v}function H2(o){j.H=Dl;var r=ne!==null&&ne.next!==null;if(ti=0,ke=ne=It=null,lf=!1,Rl=0,Js=null,r)throw Error(i(300));o===null||Oe||(o=o.dependencies,o!==null&&Wu(o)&&(Oe=!0))}function U2(o,r,l,f){It=o;var g=0;do{if(Ws&&(Js=null),Rl=0,Ws=!1,25<=g)throw Error(i(301));if(g+=1,ke=ne=null,o.updateQueue!=null){var v=o.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}j.H=CT,v=r(l,f)}while(Ws);return v}function M$(){var o=j.H,r=o.useState()[0];return r=typeof r.then=="function"?kl(r):r,o=o.useState()[0],(ne!==null?ne.memoizedState:null)!==o&&(It.flags|=1024),r}function cg(){var o=cf!==0;return cf=0,o}function ug(o,r,l){r.updateQueue=o.updateQueue,r.flags&=-2053,o.lanes&=~l}function fg(o){if(lf){for(o=o.memoizedState;o!==null;){var r=o.queue;r!==null&&(r.pending=null),o=o.next}lf=!1}ti=0,ke=ne=It=null,Ws=!1,Rl=cf=0,Js=null}function Qe(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ke===null?It.memoizedState=ke=o:ke=ke.next=o,ke}function Te(){if(ne===null){var o=It.alternate;o=o!==null?o.memoizedState:null}else o=ne.next;var r=ke===null?It.memoizedState:ke.next;if(r!==null)ke=r,ne=o;else{if(o===null)throw It.alternate===null?Error(i(467)):Error(i(310));ne=o,o={memoizedState:ne.memoizedState,baseState:ne.baseState,baseQueue:ne.baseQueue,queue:ne.queue,next:null},ke===null?It.memoizedState=ke=o:ke=ke.next=o}return ke}function uf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function kl(o){var r=Rl;return Rl+=1,Js===null&&(Js=[]),o=O2(Js,o,r),r=It,(ke===null?r.memoizedState:ke.next)===null&&(r=r.alternate,j.H=r===null||r.memoizedState===null?ET:Eg),o}function ff(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return kl(o);if(o.$$typeof===T)return $e(o)}throw Error(i(438,String(o)))}function dg(o){var r=null,l=It.updateQueue;if(l!==null&&(r=l.memoCache),r==null){var f=It.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(r={data:f.data.map(function(g){return g.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),l===null&&(l=uf(),It.updateQueue=l),l.memoCache=r,l=r.data[r.index],l===void 0)for(l=r.data[r.index]=Array(o),f=0;f<o;f++)l[f]=$;return r.index++,l}function ei(o,r){return typeof r=="function"?r(o):r}function df(o){var r=Te();return hg(r,ne,o)}function hg(o,r,l){var f=o.queue;if(f===null)throw Error(i(311));f.lastRenderedReducer=l;var g=o.baseQueue,v=f.pending;if(v!==null){if(g!==null){var _=g.next;g.next=v.next,v.next=_}r.baseQueue=g=v,f.pending=null}if(v=o.baseState,g===null)o.memoizedState=v;else{r=g.next;var V=_=null,X=null,nt=r,st=!1;do{var ct=nt.lane&-536870913;if(ct!==nt.lane?(Yt&ct)===ct:(ti&ct)===ct){var ot=nt.revertLane;if(ot===0)X!==null&&(X=X.next={lane:0,revertLane:0,gesture:null,action:nt.action,hasEagerState:nt.hasEagerState,eagerState:nt.eagerState,next:null}),ct===Xs&&(st=!0);else if((ti&ot)===ot){nt=nt.next,ot===Xs&&(st=!0);continue}else ct={lane:0,revertLane:nt.revertLane,gesture:null,action:nt.action,hasEagerState:nt.hasEagerState,eagerState:nt.eagerState,next:null},X===null?(V=X=ct,_=v):X=X.next=ct,It.lanes|=ot,er|=ot;ct=nt.action,Kr&&l(v,ct),v=nt.hasEagerState?nt.eagerState:l(v,ct)}else ot={lane:ct,revertLane:nt.revertLane,gesture:nt.gesture,action:nt.action,hasEagerState:nt.hasEagerState,eagerState:nt.eagerState,next:null},X===null?(V=X=ot,_=v):X=X.next=ot,It.lanes|=ct,er|=ct;nt=nt.next}while(nt!==null&&nt!==r);if(X===null?_=v:X.next=V,!bn(v,o.memoizedState)&&(Oe=!0,st&&(l=Fs,l!==null)))throw l;o.memoizedState=v,o.baseState=_,o.baseQueue=X,f.lastRenderedState=v}return g===null&&(f.lanes=0),[o.memoizedState,f.dispatch]}function pg(o){var r=Te(),l=r.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=o;var f=l.dispatch,g=l.pending,v=r.memoizedState;if(g!==null){l.pending=null;var _=g=g.next;do v=o(v,_.action),_=_.next;while(_!==g);bn(v,r.memoizedState)||(Oe=!0),r.memoizedState=v,r.baseQueue===null&&(r.baseState=v),l.lastRenderedState=v}return[v,f]}function $2(o,r,l){var f=It,g=Te(),v=Ft;if(v){if(l===void 0)throw Error(i(407));l=l()}else l=r();var _=!bn((ne||g).memoizedState,l);if(_&&(g.memoizedState=l,Oe=!0),g=g.queue,yg(G2.bind(null,f,g,o),[o]),g.getSnapshot!==r||_||ke!==null&&ke.memoizedState.tag&1){if(f.flags|=2048,ta(9,{destroy:void 0},Y2.bind(null,f,g,l,r),null),se===null)throw Error(i(349));v||(ti&127)!==0||q2(f,r,l)}return l}function q2(o,r,l){o.flags|=16384,o={getSnapshot:r,value:l},r=It.updateQueue,r===null?(r=uf(),It.updateQueue=r,r.stores=[o]):(l=r.stores,l===null?r.stores=[o]:l.push(o))}function Y2(o,r,l,f){r.value=l,r.getSnapshot=f,X2(r)&&F2(o)}function G2(o,r,l){return l(function(){X2(r)&&F2(o)})}function X2(o){var r=o.getSnapshot;o=o.value;try{var l=r();return!bn(o,l)}catch{return!0}}function F2(o){var r=Hr(o,2);r!==null&&un(r,o,2)}function mg(o){var r=Qe();if(typeof o=="function"){var l=o;if(o=l(),Kr){ee(!0);try{l()}finally{ee(!1)}}}return r.memoizedState=r.baseState=o,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:o},r}function Z2(o,r,l,f){return o.baseState=l,hg(o,ne,typeof f=="function"?f:ei)}function R$(o,r,l,f,g){if(mf(o))throw Error(i(485));if(o=r.action,o!==null){var v={payload:g,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){v.listeners.push(_)}};j.T!==null?l(!0):v.isTransition=!1,f(v),l=r.pending,l===null?(v.next=r.pending=v,K2(r,v)):(v.next=l.next,r.pending=l.next=v)}}function K2(o,r){var l=r.action,f=r.payload,g=o.state;if(r.isTransition){var v=j.T,_={};j.T=_;try{var V=l(g,f),X=j.S;X!==null&&X(_,V),Q2(o,r,V)}catch(nt){gg(o,r,nt)}finally{v!==null&&_.types!==null&&(v.types=_.types),j.T=v}}else try{v=l(g,f),Q2(o,r,v)}catch(nt){gg(o,r,nt)}}function Q2(o,r,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(f){W2(o,r,f)},function(f){return gg(o,r,f)}):W2(o,r,l)}function W2(o,r,l){r.status="fulfilled",r.value=l,J2(r),o.state=l,r=o.pending,r!==null&&(l=r.next,l===r?o.pending=null:(l=l.next,r.next=l,K2(o,l)))}function gg(o,r,l){var f=o.pending;if(o.pending=null,f!==null){f=f.next;do r.status="rejected",r.reason=l,J2(r),r=r.next;while(r!==f)}o.action=null}function J2(o){o=o.listeners;for(var r=0;r<o.length;r++)(0,o[r])()}function tT(o,r){return r}function eT(o,r){if(Ft){var l=se.formState;if(l!==null){t:{var f=It;if(Ft){if(fe){e:{for(var g=fe,v=Ln;g.nodeType!==8;){if(!v){g=null;break e}if(g=Bn(g.nextSibling),g===null){g=null;break e}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){fe=Bn(g.nextSibling),f=g.data==="F!";break t}}Gi(f)}f=!1}f&&(r=l[0])}}return l=Qe(),l.memoizedState=l.baseState=r,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tT,lastRenderedState:r},l.queue=f,l=xT.bind(null,It,f),f.dispatch=l,f=mg(!1),v=Sg.bind(null,It,!1,f.queue),f=Qe(),g={state:r,dispatch:null,action:o,pending:null},f.queue=g,l=R$.bind(null,It,g,v,l),g.dispatch=l,f.memoizedState=o,[r,l,!1]}function nT(o){var r=Te();return oT(r,ne,o)}function oT(o,r,l){if(r=hg(o,r,tT)[0],o=df(ei)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var f=kl(r)}catch(_){throw _===Zs?ef:_}else f=r;r=Te();var g=r.queue,v=g.dispatch;return l!==r.memoizedState&&(It.flags|=2048,ta(9,{destroy:void 0},k$.bind(null,g,l),null)),[f,v,o]}function k$(o,r){o.action=r}function iT(o){var r=Te(),l=ne;if(l!==null)return oT(r,l,o);Te(),r=r.memoizedState,l=Te();var f=l.queue.dispatch;return l.memoizedState=o,[r,f,!1]}function ta(o,r,l,f){return o={tag:o,create:l,deps:f,inst:r,next:null},r=It.updateQueue,r===null&&(r=uf(),It.updateQueue=r),l=r.lastEffect,l===null?r.lastEffect=o.next=o:(f=l.next,l.next=o,o.next=f,r.lastEffect=o),o}function rT(){return Te().memoizedState}function hf(o,r,l,f){var g=Qe();It.flags|=o,g.memoizedState=ta(1|r,{destroy:void 0},l,f===void 0?null:f)}function pf(o,r,l,f){var g=Te();f=f===void 0?null:f;var v=g.memoizedState.inst;ne!==null&&f!==null&&ag(f,ne.memoizedState.deps)?g.memoizedState=ta(r,v,l,f):(It.flags|=o,g.memoizedState=ta(1|r,v,l,f))}function sT(o,r){hf(8390656,8,o,r)}function yg(o,r){pf(2048,8,o,r)}function O$(o){It.flags|=4;var r=It.updateQueue;if(r===null)r=uf(),It.updateQueue=r,r.events=[o];else{var l=r.events;l===null?r.events=[o]:l.push(o)}}function aT(o){var r=Te().memoizedState;return O$({ref:r,nextImpl:o}),function(){if((Wt&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function lT(o,r){return pf(4,2,o,r)}function cT(o,r){return pf(4,4,o,r)}function uT(o,r){if(typeof r=="function"){o=o();var l=r(o);return function(){typeof l=="function"?l():r(null)}}if(r!=null)return o=o(),r.current=o,function(){r.current=null}}function fT(o,r,l){l=l!=null?l.concat([o]):null,pf(4,4,uT.bind(null,r,o),l)}function vg(){}function dT(o,r){var l=Te();r=r===void 0?null:r;var f=l.memoizedState;return r!==null&&ag(r,f[1])?f[0]:(l.memoizedState=[o,r],o)}function hT(o,r){var l=Te();r=r===void 0?null:r;var f=l.memoizedState;if(r!==null&&ag(r,f[1]))return f[0];if(f=o(),Kr){ee(!0);try{o()}finally{ee(!1)}}return l.memoizedState=[f,r],f}function bg(o,r,l){return l===void 0||(ti&1073741824)!==0&&(Yt&261930)===0?o.memoizedState=r:(o.memoizedState=l,o=p_(),It.lanes|=o,er|=o,l)}function pT(o,r,l,f){return bn(l,r)?l:Qs.current!==null?(o=bg(o,l,f),bn(o,r)||(Oe=!0),o):(ti&42)===0||(ti&1073741824)!==0&&(Yt&261930)===0?(Oe=!0,o.memoizedState=l):(o=p_(),It.lanes|=o,er|=o,r)}function mT(o,r,l,f,g){var v=I.p;I.p=v!==0&&8>v?v:8;var _=j.T,V={};j.T=V,Sg(o,!1,r,l);try{var X=g(),nt=j.S;if(nt!==null&&nt(V,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var st=N$(X,f);Ol(o,r,st,Tn(o))}else Ol(o,r,f,Tn(o))}catch(ct){Ol(o,r,{then:function(){},status:"rejected",reason:ct},Tn())}finally{I.p=v,_!==null&&V.types!==null&&(_.types=V.types),j.T=_}}function D$(){}function xg(o,r,l,f){if(o.tag!==5)throw Error(i(476));var g=gT(o).queue;mT(o,g,r,z,l===null?D$:function(){return yT(o),l(f)})}function gT(o){var r=o.memoizedState;if(r!==null)return r;r={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:z},next:null};var l={};return r.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:l},next:null},o.memoizedState=r,o=o.alternate,o!==null&&(o.memoizedState=r),r}function yT(o){var r=gT(o);r.next===null&&(r=o.alternate.memoizedState),Ol(o,r.next.queue,{},Tn())}function wg(){return $e(Zl)}function vT(){return Te().memoizedState}function bT(){return Te().memoizedState}function j$(o){for(var r=o.return;r!==null;){switch(r.tag){case 24:case 3:var l=Tn();o=Zi(l);var f=Ki(r,o,l);f!==null&&(un(f,r,l),Nl(f,r,l)),r={cache:Km()},o.payload=r;return}r=r.return}}function z$(o,r,l){var f=Tn();l={lane:f,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},mf(o)?wT(r,l):(l=Bm(o,r,l,f),l!==null&&(un(l,o,f),ST(l,r,f)))}function xT(o,r,l){var f=Tn();Ol(o,r,l,f)}function Ol(o,r,l,f){var g={lane:f,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(mf(o))wT(r,g);else{var v=o.alternate;if(o.lanes===0&&(v===null||v.lanes===0)&&(v=r.lastRenderedReducer,v!==null))try{var _=r.lastRenderedState,V=v(_,l);if(g.hasEagerState=!0,g.eagerState=V,bn(V,_))return Fu(o,r,g,0),se===null&&Xu(),!1}catch{}if(l=Bm(o,r,g,f),l!==null)return un(l,o,f),ST(l,r,f),!0}return!1}function Sg(o,r,l,f){if(f={lane:2,revertLane:t0(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},mf(o)){if(r)throw Error(i(479))}else r=Bm(o,l,f,2),r!==null&&un(r,o,2)}function mf(o){var r=o.alternate;return o===It||r!==null&&r===It}function wT(o,r){Ws=lf=!0;var l=o.pending;l===null?r.next=r:(r.next=l.next,l.next=r),o.pending=r}function ST(o,r,l){if((l&4194048)!==0){var f=r.lanes;f&=o.pendingLanes,l|=f,r.lanes=l,ji(o,l)}}var Dl={readContext:$e,use:ff,useCallback:we,useContext:we,useEffect:we,useImperativeHandle:we,useLayoutEffect:we,useInsertionEffect:we,useMemo:we,useReducer:we,useRef:we,useState:we,useDebugValue:we,useDeferredValue:we,useTransition:we,useSyncExternalStore:we,useId:we,useHostTransitionStatus:we,useFormState:we,useActionState:we,useOptimistic:we,useMemoCache:we,useCacheRefresh:we};Dl.useEffectEvent=we;var ET={readContext:$e,use:ff,useCallback:function(o,r){return Qe().memoizedState=[o,r===void 0?null:r],o},useContext:$e,useEffect:sT,useImperativeHandle:function(o,r,l){l=l!=null?l.concat([o]):null,hf(4194308,4,uT.bind(null,r,o),l)},useLayoutEffect:function(o,r){return hf(4194308,4,o,r)},useInsertionEffect:function(o,r){hf(4,2,o,r)},useMemo:function(o,r){var l=Qe();r=r===void 0?null:r;var f=o();if(Kr){ee(!0);try{o()}finally{ee(!1)}}return l.memoizedState=[f,r],f},useReducer:function(o,r,l){var f=Qe();if(l!==void 0){var g=l(r);if(Kr){ee(!0);try{l(r)}finally{ee(!1)}}}else g=r;return f.memoizedState=f.baseState=g,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:g},f.queue=o,o=o.dispatch=z$.bind(null,It,o),[f.memoizedState,o]},useRef:function(o){var r=Qe();return o={current:o},r.memoizedState=o},useState:function(o){o=mg(o);var r=o.queue,l=xT.bind(null,It,r);return r.dispatch=l,[o.memoizedState,l]},useDebugValue:vg,useDeferredValue:function(o,r){var l=Qe();return bg(l,o,r)},useTransition:function(){var o=mg(!1);return o=mT.bind(null,It,o.queue,!0,!1),Qe().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,r,l){var f=It,g=Qe();if(Ft){if(l===void 0)throw Error(i(407));l=l()}else{if(l=r(),se===null)throw Error(i(349));(Yt&127)!==0||q2(f,r,l)}g.memoizedState=l;var v={value:l,getSnapshot:r};return g.queue=v,sT(G2.bind(null,f,v,o),[o]),f.flags|=2048,ta(9,{destroy:void 0},Y2.bind(null,f,v,l,r),null),l},useId:function(){var o=Qe(),r=se.identifierPrefix;if(Ft){var l=_o,f=To;l=(f&~(1<<32-Ee(f)-1)).toString(32)+l,r="_"+r+"R_"+l,l=cf++,0<l&&(r+="H"+l.toString(32)),r+="_"}else l=A$++,r="_"+r+"r_"+l.toString(32)+"_";return o.memoizedState=r},useHostTransitionStatus:wg,useFormState:eT,useActionState:eT,useOptimistic:function(o){var r=Qe();r.memoizedState=r.baseState=o;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=l,r=Sg.bind(null,It,!0,l),l.dispatch=r,[o,r]},useMemoCache:dg,useCacheRefresh:function(){return Qe().memoizedState=j$.bind(null,It)},useEffectEvent:function(o){var r=Qe(),l={impl:o};return r.memoizedState=l,function(){if((Wt&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},Eg={readContext:$e,use:ff,useCallback:dT,useContext:$e,useEffect:yg,useImperativeHandle:fT,useInsertionEffect:lT,useLayoutEffect:cT,useMemo:hT,useReducer:df,useRef:rT,useState:function(){return df(ei)},useDebugValue:vg,useDeferredValue:function(o,r){var l=Te();return pT(l,ne.memoizedState,o,r)},useTransition:function(){var o=df(ei)[0],r=Te().memoizedState;return[typeof o=="boolean"?o:kl(o),r]},useSyncExternalStore:$2,useId:vT,useHostTransitionStatus:wg,useFormState:nT,useActionState:nT,useOptimistic:function(o,r){var l=Te();return Z2(l,ne,o,r)},useMemoCache:dg,useCacheRefresh:bT};Eg.useEffectEvent=aT;var CT={readContext:$e,use:ff,useCallback:dT,useContext:$e,useEffect:yg,useImperativeHandle:fT,useInsertionEffect:lT,useLayoutEffect:cT,useMemo:hT,useReducer:pg,useRef:rT,useState:function(){return pg(ei)},useDebugValue:vg,useDeferredValue:function(o,r){var l=Te();return ne===null?bg(l,o,r):pT(l,ne.memoizedState,o,r)},useTransition:function(){var o=pg(ei)[0],r=Te().memoizedState;return[typeof o=="boolean"?o:kl(o),r]},useSyncExternalStore:$2,useId:vT,useHostTransitionStatus:wg,useFormState:iT,useActionState:iT,useOptimistic:function(o,r){var l=Te();return ne!==null?Z2(l,ne,o,r):(l.baseState=o,[o,l.queue.dispatch])},useMemoCache:dg,useCacheRefresh:bT};CT.useEffectEvent=aT;function Cg(o,r,l,f){r=o.memoizedState,l=l(f,r),l=l==null?r:m({},r,l),o.memoizedState=l,o.lanes===0&&(o.updateQueue.baseState=l)}var Tg={enqueueSetState:function(o,r,l){o=o._reactInternals;var f=Tn(),g=Zi(f);g.payload=r,l!=null&&(g.callback=l),r=Ki(o,g,f),r!==null&&(un(r,o,f),Nl(r,o,f))},enqueueReplaceState:function(o,r,l){o=o._reactInternals;var f=Tn(),g=Zi(f);g.tag=1,g.payload=r,l!=null&&(g.callback=l),r=Ki(o,g,f),r!==null&&(un(r,o,f),Nl(r,o,f))},enqueueForceUpdate:function(o,r){o=o._reactInternals;var l=Tn(),f=Zi(l);f.tag=2,r!=null&&(f.callback=r),r=Ki(o,f,l),r!==null&&(un(r,o,l),Nl(r,o,l))}};function TT(o,r,l,f,g,v,_){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(f,v,_):r.prototype&&r.prototype.isPureReactComponent?!bl(l,f)||!bl(g,v):!0}function _T(o,r,l,f){o=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(l,f),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(l,f),r.state!==o&&Tg.enqueueReplaceState(r,r.state,null)}function Qr(o,r){var l=r;if("ref"in r){l={};for(var f in r)f!=="ref"&&(l[f]=r[f])}if(o=o.defaultProps){l===r&&(l=m({},l));for(var g in o)l[g]===void 0&&(l[g]=o[g])}return l}function NT(o){Gu(o)}function AT(o){console.error(o)}function MT(o){Gu(o)}function gf(o,r){try{var l=o.onUncaughtError;l(r.value,{componentStack:r.stack})}catch(f){setTimeout(function(){throw f})}}function RT(o,r,l){try{var f=o.onCaughtError;f(l.value,{componentStack:l.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function _g(o,r,l){return l=Zi(l),l.tag=3,l.payload={element:null},l.callback=function(){gf(o,r)},l}function kT(o){return o=Zi(o),o.tag=3,o}function OT(o,r,l,f){var g=l.type.getDerivedStateFromError;if(typeof g=="function"){var v=f.value;o.payload=function(){return g(v)},o.callback=function(){RT(r,l,f)}}var _=l.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(o.callback=function(){RT(r,l,f),typeof g!="function"&&(nr===null?nr=new Set([this]):nr.add(this));var V=f.stack;this.componentDidCatch(f.value,{componentStack:V!==null?V:""})})}function V$(o,r,l,f,g){if(l.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(r=l.alternate,r!==null&&Gs(r,l,g,!0),l=wn.current,l!==null){switch(l.tag){case 31:case 13:return In===null?Af():l.alternate===null&&Se===0&&(Se=3),l.flags&=-257,l.flags|=65536,l.lanes=g,f===nf?l.flags|=16384:(r=l.updateQueue,r===null?l.updateQueue=new Set([f]):r.add(f),Qg(o,f,g)),!1;case 22:return l.flags|=65536,f===nf?l.flags|=16384:(r=l.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([f])},l.updateQueue=r):(l=r.retryQueue,l===null?r.retryQueue=new Set([f]):l.add(f)),Qg(o,f,g)),!1}throw Error(i(435,l.tag))}return Qg(o,f,g),Af(),!1}if(Ft)return r=wn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=g,f!==Ym&&(o=Error(i(422),{cause:f}),Sl(jn(o,l)))):(f!==Ym&&(r=Error(i(423),{cause:f}),Sl(jn(r,l))),o=o.current.alternate,o.flags|=65536,g&=-g,o.lanes|=g,f=jn(f,l),g=_g(o.stateNode,f,g),ng(o,g),Se!==4&&(Se=2)),!1;var v=Error(i(520),{cause:f});if(v=jn(v,l),Hl===null?Hl=[v]:Hl.push(v),Se!==4&&(Se=2),r===null)return!0;f=jn(f,l),l=r;do{switch(l.tag){case 3:return l.flags|=65536,o=g&-g,l.lanes|=o,o=_g(l.stateNode,f,o),ng(l,o),!1;case 1:if(r=l.type,v=l.stateNode,(l.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(nr===null||!nr.has(v))))return l.flags|=65536,g&=-g,l.lanes|=g,g=kT(g),OT(g,o,l,f),ng(l,g),!1}l=l.return}while(l!==null);return!1}var Ng=Error(i(461)),Oe=!1;function qe(o,r,l,f){r.child=o===null?V2(r,null,l,f):Zr(r,o.child,l,f)}function DT(o,r,l,f,g){l=l.render;var v=r.ref;if("ref"in f){var _={};for(var V in f)V!=="ref"&&(_[V]=f[V])}else _=f;return Yr(r),f=lg(o,r,l,_,v,g),V=cg(),o!==null&&!Oe?(ug(o,r,g),ni(o,r,g)):(Ft&&V&&$m(r),r.flags|=1,qe(o,r,f,g),r.child)}function jT(o,r,l,f,g){if(o===null){var v=l.type;return typeof v=="function"&&!Pm(v)&&v.defaultProps===void 0&&l.compare===null?(r.tag=15,r.type=v,zT(o,r,v,f,g)):(o=Ku(l.type,null,f,r,r.mode,g),o.ref=r.ref,o.return=r,r.child=o)}if(v=o.child,!zg(o,g)){var _=v.memoizedProps;if(l=l.compare,l=l!==null?l:bl,l(_,f)&&o.ref===r.ref)return ni(o,r,g)}return r.flags|=1,o=Ko(v,f),o.ref=r.ref,o.return=r,r.child=o}function zT(o,r,l,f,g){if(o!==null){var v=o.memoizedProps;if(bl(v,f)&&o.ref===r.ref)if(Oe=!1,r.pendingProps=f=v,zg(o,g))(o.flags&131072)!==0&&(Oe=!0);else return r.lanes=o.lanes,ni(o,r,g)}return Ag(o,r,l,f,g)}function VT(o,r,l,f){var g=f.children,v=o!==null?o.memoizedState:null;if(o===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((r.flags&128)!==0){if(v=v!==null?v.baseLanes|l:l,o!==null){for(f=r.child=o.child,g=0;f!==null;)g=g|f.lanes|f.childLanes,f=f.sibling;f=g&~v}else f=0,r.child=null;return LT(o,r,v,l,f)}if((l&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},o!==null&&tf(r,v!==null?v.cachePool:null),v!==null?B2(r,v):ig(),P2(r);else return f=r.lanes=536870912,LT(o,r,v!==null?v.baseLanes|l:l,l,f)}else v!==null?(tf(r,v.cachePool),B2(r,v),Wi(),r.memoizedState=null):(o!==null&&tf(r,null),ig(),Wi());return qe(o,r,g,l),r.child}function jl(o,r){return o!==null&&o.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function LT(o,r,l,f,g){var v=Wm();return v=v===null?null:{parent:Re._currentValue,pool:v},r.memoizedState={baseLanes:l,cachePool:v},o!==null&&tf(r,null),ig(),P2(r),o!==null&&Gs(o,r,f,!0),r.childLanes=g,null}function yf(o,r){return r=bf({mode:r.mode,children:r.children},o.mode),r.ref=o.ref,o.child=r,r.return=o,r}function IT(o,r,l){return Zr(r,o.child,null,l),o=yf(r,r.pendingProps),o.flags|=2,Sn(r),r.memoizedState=null,o}function L$(o,r,l){var f=r.pendingProps,g=(r.flags&128)!==0;if(r.flags&=-129,o===null){if(Ft){if(f.mode==="hidden")return o=yf(r,f),r.lanes=536870912,jl(null,o);if(sg(r),(o=fe)?(o=K_(o,Ln),o=o!==null&&o.data==="&"?o:null,o!==null&&(r.memoizedState={dehydrated:o,treeContext:qi!==null?{id:To,overflow:_o}:null,retryLane:536870912,hydrationErrors:null},l=w2(o),l.return=r,r.child=l,Ue=r,fe=null)):o=null,o===null)throw Gi(r);return r.lanes=536870912,null}return yf(r,f)}var v=o.memoizedState;if(v!==null){var _=v.dehydrated;if(sg(r),g)if(r.flags&256)r.flags&=-257,r=IT(o,r,l);else if(r.memoizedState!==null)r.child=o.child,r.flags|=128,r=null;else throw Error(i(558));else if(Oe||Gs(o,r,l,!1),g=(l&o.childLanes)!==0,Oe||g){if(f=se,f!==null&&(_=zi(f,l),_!==0&&_!==v.retryLane))throw v.retryLane=_,Hr(o,_),un(f,o,_),Ng;Af(),r=IT(o,r,l)}else o=v.treeContext,fe=Bn(_.nextSibling),Ue=r,Ft=!0,Yi=null,Ln=!1,o!==null&&C2(r,o),r=yf(r,f),r.flags|=4096;return r}return o=Ko(o.child,{mode:f.mode,children:f.children}),o.ref=r.ref,r.child=o,o.return=r,o}function vf(o,r){var l=r.ref;if(l===null)o!==null&&o.ref!==null&&(r.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(i(284));(o===null||o.ref!==l)&&(r.flags|=4194816)}}function Ag(o,r,l,f,g){return Yr(r),l=lg(o,r,l,f,void 0,g),f=cg(),o!==null&&!Oe?(ug(o,r,g),ni(o,r,g)):(Ft&&f&&$m(r),r.flags|=1,qe(o,r,l,g),r.child)}function BT(o,r,l,f,g,v){return Yr(r),r.updateQueue=null,l=U2(r,f,l,g),H2(o),f=cg(),o!==null&&!Oe?(ug(o,r,v),ni(o,r,v)):(Ft&&f&&$m(r),r.flags|=1,qe(o,r,l,v),r.child)}function PT(o,r,l,f,g){if(Yr(r),r.stateNode===null){var v=Us,_=l.contextType;typeof _=="object"&&_!==null&&(v=$e(_)),v=new l(f,v),r.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Tg,r.stateNode=v,v._reactInternals=r,v=r.stateNode,v.props=f,v.state=r.memoizedState,v.refs={},tg(r),_=l.contextType,v.context=typeof _=="object"&&_!==null?$e(_):Us,v.state=r.memoizedState,_=l.getDerivedStateFromProps,typeof _=="function"&&(Cg(r,l,_,f),v.state=r.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(_=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),_!==v.state&&Tg.enqueueReplaceState(v,v.state,null),Ml(r,f,v,g),Al(),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308),f=!0}else if(o===null){v=r.stateNode;var V=r.memoizedProps,X=Qr(l,V);v.props=X;var nt=v.context,st=l.contextType;_=Us,typeof st=="object"&&st!==null&&(_=$e(st));var ct=l.getDerivedStateFromProps;st=typeof ct=="function"||typeof v.getSnapshotBeforeUpdate=="function",V=r.pendingProps!==V,st||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(V||nt!==_)&&_T(r,v,f,_),Fi=!1;var ot=r.memoizedState;v.state=ot,Ml(r,f,v,g),Al(),nt=r.memoizedState,V||ot!==nt||Fi?(typeof ct=="function"&&(Cg(r,l,ct,f),nt=r.memoizedState),(X=Fi||TT(r,l,X,f,ot,nt,_))?(st||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(r.flags|=4194308)):(typeof v.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=f,r.memoizedState=nt),v.props=f,v.state=nt,v.context=_,f=X):(typeof v.componentDidMount=="function"&&(r.flags|=4194308),f=!1)}else{v=r.stateNode,eg(o,r),_=r.memoizedProps,st=Qr(l,_),v.props=st,ct=r.pendingProps,ot=v.context,nt=l.contextType,X=Us,typeof nt=="object"&&nt!==null&&(X=$e(nt)),V=l.getDerivedStateFromProps,(nt=typeof V=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(_!==ct||ot!==X)&&_T(r,v,f,X),Fi=!1,ot=r.memoizedState,v.state=ot,Ml(r,f,v,g),Al();var rt=r.memoizedState;_!==ct||ot!==rt||Fi||o!==null&&o.dependencies!==null&&Wu(o.dependencies)?(typeof V=="function"&&(Cg(r,l,V,f),rt=r.memoizedState),(st=Fi||TT(r,l,st,f,ot,rt,X)||o!==null&&o.dependencies!==null&&Wu(o.dependencies))?(nt||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(f,rt,X),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(f,rt,X)),typeof v.componentDidUpdate=="function"&&(r.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof v.componentDidUpdate!="function"||_===o.memoizedProps&&ot===o.memoizedState||(r.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||_===o.memoizedProps&&ot===o.memoizedState||(r.flags|=1024),r.memoizedProps=f,r.memoizedState=rt),v.props=f,v.state=rt,v.context=X,f=st):(typeof v.componentDidUpdate!="function"||_===o.memoizedProps&&ot===o.memoizedState||(r.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||_===o.memoizedProps&&ot===o.memoizedState||(r.flags|=1024),f=!1)}return v=f,vf(o,r),f=(r.flags&128)!==0,v||f?(v=r.stateNode,l=f&&typeof l.getDerivedStateFromError!="function"?null:v.render(),r.flags|=1,o!==null&&f?(r.child=Zr(r,o.child,null,g),r.child=Zr(r,null,l,g)):qe(o,r,l,g),r.memoizedState=v.state,o=r.child):o=ni(o,r,g),o}function HT(o,r,l,f){return $r(),r.flags|=256,qe(o,r,l,f),r.child}var Mg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Rg(o){return{baseLanes:o,cachePool:R2()}}function kg(o,r,l){return o=o!==null?o.childLanes&~l:0,r&&(o|=Cn),o}function UT(o,r,l){var f=r.pendingProps,g=!1,v=(r.flags&128)!==0,_;if((_=v)||(_=o!==null&&o.memoizedState===null?!1:(Ce.current&2)!==0),_&&(g=!0,r.flags&=-129),_=(r.flags&32)!==0,r.flags&=-33,o===null){if(Ft){if(g?Qi(r):Wi(),(o=fe)?(o=K_(o,Ln),o=o!==null&&o.data!=="&"?o:null,o!==null&&(r.memoizedState={dehydrated:o,treeContext:qi!==null?{id:To,overflow:_o}:null,retryLane:536870912,hydrationErrors:null},l=w2(o),l.return=r,r.child=l,Ue=r,fe=null)):o=null,o===null)throw Gi(r);return h0(o)?r.lanes=32:r.lanes=536870912,null}var V=f.children;return f=f.fallback,g?(Wi(),g=r.mode,V=bf({mode:"hidden",children:V},g),f=Ur(f,g,l,null),V.return=r,f.return=r,V.sibling=f,r.child=V,f=r.child,f.memoizedState=Rg(l),f.childLanes=kg(o,_,l),r.memoizedState=Mg,jl(null,f)):(Qi(r),Og(r,V))}var X=o.memoizedState;if(X!==null&&(V=X.dehydrated,V!==null)){if(v)r.flags&256?(Qi(r),r.flags&=-257,r=Dg(o,r,l)):r.memoizedState!==null?(Wi(),r.child=o.child,r.flags|=128,r=null):(Wi(),V=f.fallback,g=r.mode,f=bf({mode:"visible",children:f.children},g),V=Ur(V,g,l,null),V.flags|=2,f.return=r,V.return=r,f.sibling=V,r.child=f,Zr(r,o.child,null,l),f=r.child,f.memoizedState=Rg(l),f.childLanes=kg(o,_,l),r.memoizedState=Mg,r=jl(null,f));else if(Qi(r),h0(V)){if(_=V.nextSibling&&V.nextSibling.dataset,_)var nt=_.dgst;_=nt,f=Error(i(419)),f.stack="",f.digest=_,Sl({value:f,source:null,stack:null}),r=Dg(o,r,l)}else if(Oe||Gs(o,r,l,!1),_=(l&o.childLanes)!==0,Oe||_){if(_=se,_!==null&&(f=zi(_,l),f!==0&&f!==X.retryLane))throw X.retryLane=f,Hr(o,f),un(_,o,f),Ng;d0(V)||Af(),r=Dg(o,r,l)}else d0(V)?(r.flags|=192,r.child=o.child,r=null):(o=X.treeContext,fe=Bn(V.nextSibling),Ue=r,Ft=!0,Yi=null,Ln=!1,o!==null&&C2(r,o),r=Og(r,f.children),r.flags|=4096);return r}return g?(Wi(),V=f.fallback,g=r.mode,X=o.child,nt=X.sibling,f=Ko(X,{mode:"hidden",children:f.children}),f.subtreeFlags=X.subtreeFlags&65011712,nt!==null?V=Ko(nt,V):(V=Ur(V,g,l,null),V.flags|=2),V.return=r,f.return=r,f.sibling=V,r.child=f,jl(null,f),f=r.child,V=o.child.memoizedState,V===null?V=Rg(l):(g=V.cachePool,g!==null?(X=Re._currentValue,g=g.parent!==X?{parent:X,pool:X}:g):g=R2(),V={baseLanes:V.baseLanes|l,cachePool:g}),f.memoizedState=V,f.childLanes=kg(o,_,l),r.memoizedState=Mg,jl(o.child,f)):(Qi(r),l=o.child,o=l.sibling,l=Ko(l,{mode:"visible",children:f.children}),l.return=r,l.sibling=null,o!==null&&(_=r.deletions,_===null?(r.deletions=[o],r.flags|=16):_.push(o)),r.child=l,r.memoizedState=null,l)}function Og(o,r){return r=bf({mode:"visible",children:r},o.mode),r.return=o,o.child=r}function bf(o,r){return o=xn(22,o,null,r),o.lanes=0,o}function Dg(o,r,l){return Zr(r,o.child,null,l),o=Og(r,r.pendingProps.children),o.flags|=2,r.memoizedState=null,o}function $T(o,r,l){o.lanes|=r;var f=o.alternate;f!==null&&(f.lanes|=r),Fm(o.return,r,l)}function jg(o,r,l,f,g,v){var _=o.memoizedState;_===null?o.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:f,tail:l,tailMode:g,treeForkCount:v}:(_.isBackwards=r,_.rendering=null,_.renderingStartTime=0,_.last=f,_.tail=l,_.tailMode=g,_.treeForkCount=v)}function qT(o,r,l){var f=r.pendingProps,g=f.revealOrder,v=f.tail;f=f.children;var _=Ce.current,V=(_&2)!==0;if(V?(_=_&1|2,r.flags|=128):_&=1,tt(Ce,_),qe(o,r,f,l),f=Ft?wl:0,!V&&o!==null&&(o.flags&128)!==0)t:for(o=r.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&$T(o,l,r);else if(o.tag===19)$T(o,l,r);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break t;for(;o.sibling===null;){if(o.return===null||o.return===r)break t;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(g){case"forwards":for(l=r.child,g=null;l!==null;)o=l.alternate,o!==null&&af(o)===null&&(g=l),l=l.sibling;l=g,l===null?(g=r.child,r.child=null):(g=l.sibling,l.sibling=null),jg(r,!1,g,l,v,f);break;case"backwards":case"unstable_legacy-backwards":for(l=null,g=r.child,r.child=null;g!==null;){if(o=g.alternate,o!==null&&af(o)===null){r.child=g;break}o=g.sibling,g.sibling=l,l=g,g=o}jg(r,!0,l,null,v,f);break;case"together":jg(r,!1,null,null,void 0,f);break;default:r.memoizedState=null}return r.child}function ni(o,r,l){if(o!==null&&(r.dependencies=o.dependencies),er|=r.lanes,(l&r.childLanes)===0)if(o!==null){if(Gs(o,r,l,!1),(l&r.childLanes)===0)return null}else return null;if(o!==null&&r.child!==o.child)throw Error(i(153));if(r.child!==null){for(o=r.child,l=Ko(o,o.pendingProps),r.child=l,l.return=r;o.sibling!==null;)o=o.sibling,l=l.sibling=Ko(o,o.pendingProps),l.return=r;l.sibling=null}return r.child}function zg(o,r){return(o.lanes&r)!==0?!0:(o=o.dependencies,!!(o!==null&&Wu(o)))}function I$(o,r,l){switch(r.tag){case 3:ut(r,r.stateNode.containerInfo),Xi(r,Re,o.memoizedState.cache),$r();break;case 27:case 5:Mt(r);break;case 4:ut(r,r.stateNode.containerInfo);break;case 10:Xi(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,sg(r),null;break;case 13:var f=r.memoizedState;if(f!==null)return f.dehydrated!==null?(Qi(r),r.flags|=128,null):(l&r.child.childLanes)!==0?UT(o,r,l):(Qi(r),o=ni(o,r,l),o!==null?o.sibling:null);Qi(r);break;case 19:var g=(o.flags&128)!==0;if(f=(l&r.childLanes)!==0,f||(Gs(o,r,l,!1),f=(l&r.childLanes)!==0),g){if(f)return qT(o,r,l);r.flags|=128}if(g=r.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),tt(Ce,Ce.current),f)break;return null;case 22:return r.lanes=0,VT(o,r,l,r.pendingProps);case 24:Xi(r,Re,o.memoizedState.cache)}return ni(o,r,l)}function YT(o,r,l){if(o!==null)if(o.memoizedProps!==r.pendingProps)Oe=!0;else{if(!zg(o,l)&&(r.flags&128)===0)return Oe=!1,I$(o,r,l);Oe=(o.flags&131072)!==0}else Oe=!1,Ft&&(r.flags&1048576)!==0&&E2(r,wl,r.index);switch(r.lanes=0,r.tag){case 16:t:{var f=r.pendingProps;if(o=Xr(r.elementType),r.type=o,typeof o=="function")Pm(o)?(f=Qr(o,f),r.tag=1,r=PT(null,r,o,f,l)):(r.tag=0,r=Ag(null,r,o,f,l));else{if(o!=null){var g=o.$$typeof;if(g===C){r.tag=11,r=DT(null,r,o,f,l);break t}else if(g===O){r.tag=14,r=jT(null,r,o,f,l);break t}}throw r=B(o)||o,Error(i(306,r,""))}}return r;case 0:return Ag(o,r,r.type,r.pendingProps,l);case 1:return f=r.type,g=Qr(f,r.pendingProps),PT(o,r,f,g,l);case 3:t:{if(ut(r,r.stateNode.containerInfo),o===null)throw Error(i(387));f=r.pendingProps;var v=r.memoizedState;g=v.element,eg(o,r),Ml(r,f,null,l);var _=r.memoizedState;if(f=_.cache,Xi(r,Re,f),f!==v.cache&&Zm(r,[Re],l,!0),Al(),f=_.element,v.isDehydrated)if(v={element:f,isDehydrated:!1,cache:_.cache},r.updateQueue.baseState=v,r.memoizedState=v,r.flags&256){r=HT(o,r,f,l);break t}else if(f!==g){g=jn(Error(i(424)),r),Sl(g),r=HT(o,r,f,l);break t}else for(o=r.stateNode.containerInfo,o.nodeType===9?o=o.body:o=o.nodeName==="HTML"?o.ownerDocument.body:o,fe=Bn(o.firstChild),Ue=r,Ft=!0,Yi=null,Ln=!0,l=V2(r,null,f,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if($r(),f===g){r=ni(o,r,l);break t}qe(o,r,f,l)}r=r.child}return r;case 26:return vf(o,r),o===null?(l=nN(r.type,null,r.pendingProps,null))?r.memoizedState=l:Ft||(l=r.type,o=r.pendingProps,f=zf(ht.current).createElement(l),f[ve]=r,f[Me]=o,Ye(f,l,o),me(f),r.stateNode=f):r.memoizedState=nN(r.type,o.memoizedProps,r.pendingProps,o.memoizedState),null;case 27:return Mt(r),o===null&&Ft&&(f=r.stateNode=J_(r.type,r.pendingProps,ht.current),Ue=r,Ln=!0,g=fe,sr(r.type)?(p0=g,fe=Bn(f.firstChild)):fe=g),qe(o,r,r.pendingProps.children,l),vf(o,r),o===null&&(r.flags|=4194304),r.child;case 5:return o===null&&Ft&&((g=f=fe)&&(f=p7(f,r.type,r.pendingProps,Ln),f!==null?(r.stateNode=f,Ue=r,fe=Bn(f.firstChild),Ln=!1,g=!0):g=!1),g||Gi(r)),Mt(r),g=r.type,v=r.pendingProps,_=o!==null?o.memoizedProps:null,f=v.children,c0(g,v)?f=null:_!==null&&c0(g,_)&&(r.flags|=32),r.memoizedState!==null&&(g=lg(o,r,M$,null,null,l),Zl._currentValue=g),vf(o,r),qe(o,r,f,l),r.child;case 6:return o===null&&Ft&&((o=l=fe)&&(l=m7(l,r.pendingProps,Ln),l!==null?(r.stateNode=l,Ue=r,fe=null,o=!0):o=!1),o||Gi(r)),null;case 13:return UT(o,r,l);case 4:return ut(r,r.stateNode.containerInfo),f=r.pendingProps,o===null?r.child=Zr(r,null,f,l):qe(o,r,f,l),r.child;case 11:return DT(o,r,r.type,r.pendingProps,l);case 7:return qe(o,r,r.pendingProps,l),r.child;case 8:return qe(o,r,r.pendingProps.children,l),r.child;case 12:return qe(o,r,r.pendingProps.children,l),r.child;case 10:return f=r.pendingProps,Xi(r,r.type,f.value),qe(o,r,f.children,l),r.child;case 9:return g=r.type._context,f=r.pendingProps.children,Yr(r),g=$e(g),f=f(g),r.flags|=1,qe(o,r,f,l),r.child;case 14:return jT(o,r,r.type,r.pendingProps,l);case 15:return zT(o,r,r.type,r.pendingProps,l);case 19:return qT(o,r,l);case 31:return L$(o,r,l);case 22:return VT(o,r,l,r.pendingProps);case 24:return Yr(r),f=$e(Re),o===null?(g=Wm(),g===null&&(g=se,v=Km(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=l),g=v),r.memoizedState={parent:f,cache:g},tg(r),Xi(r,Re,g)):((o.lanes&l)!==0&&(eg(o,r),Ml(r,null,null,l),Al()),g=o.memoizedState,v=r.memoizedState,g.parent!==f?(g={parent:f,cache:f},r.memoizedState=g,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=g),Xi(r,Re,f)):(f=v.cache,Xi(r,Re,f),f!==g.cache&&Zm(r,[Re],l,!0))),qe(o,r,r.pendingProps.children,l),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function oi(o){o.flags|=4}function Vg(o,r,l,f,g){if((r=(o.mode&32)!==0)&&(r=!1),r){if(o.flags|=16777216,(g&335544128)===g)if(o.stateNode.complete)o.flags|=8192;else if(v_())o.flags|=8192;else throw Fr=nf,Jm}else o.flags&=-16777217}function GT(o,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!aN(r))if(v_())o.flags|=8192;else throw Fr=nf,Jm}function xf(o,r){r!==null&&(o.flags|=4),o.flags&16384&&(r=o.tag!==22?ki():536870912,o.lanes|=r,ia|=r)}function zl(o,r){if(!Ft)switch(o.tailMode){case"hidden":r=o.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?o.tail=null:l.sibling=null;break;case"collapsed":l=o.tail;for(var f=null;l!==null;)l.alternate!==null&&(f=l),l=l.sibling;f===null?r||o.tail===null?o.tail=null:o.tail.sibling=null:f.sibling=null}}function de(o){var r=o.alternate!==null&&o.alternate.child===o.child,l=0,f=0;if(r)for(var g=o.child;g!==null;)l|=g.lanes|g.childLanes,f|=g.subtreeFlags&65011712,f|=g.flags&65011712,g.return=o,g=g.sibling;else for(g=o.child;g!==null;)l|=g.lanes|g.childLanes,f|=g.subtreeFlags,f|=g.flags,g.return=o,g=g.sibling;return o.subtreeFlags|=f,o.childLanes=l,r}function B$(o,r,l){var f=r.pendingProps;switch(qm(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return de(r),null;case 1:return de(r),null;case 3:return l=r.stateNode,f=null,o!==null&&(f=o.memoizedState.cache),r.memoizedState.cache!==f&&(r.flags|=2048),Jo(Re),dt(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(o===null||o.child===null)&&(Ys(r)?oi(r):o===null||o.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Gm())),de(r),null;case 26:var g=r.type,v=r.memoizedState;return o===null?(oi(r),v!==null?(de(r),GT(r,v)):(de(r),Vg(r,g,null,f,l))):v?v!==o.memoizedState?(oi(r),de(r),GT(r,v)):(de(r),r.flags&=-16777217):(o=o.memoizedProps,o!==f&&oi(r),de(r),Vg(r,g,o,f,l)),null;case 27:if(Nt(r),l=ht.current,g=r.type,o!==null&&r.stateNode!=null)o.memoizedProps!==f&&oi(r);else{if(!f){if(r.stateNode===null)throw Error(i(166));return de(r),null}o=it.current,Ys(r)?T2(r):(o=J_(g,f,l),r.stateNode=o,oi(r))}return de(r),null;case 5:if(Nt(r),g=r.type,o!==null&&r.stateNode!=null)o.memoizedProps!==f&&oi(r);else{if(!f){if(r.stateNode===null)throw Error(i(166));return de(r),null}if(v=it.current,Ys(r))T2(r);else{var _=zf(ht.current);switch(v){case 1:v=_.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=_.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=_.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=_.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=_.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof f.is=="string"?_.createElement("select",{is:f.is}):_.createElement("select"),f.multiple?v.multiple=!0:f.size&&(v.size=f.size);break;default:v=typeof f.is=="string"?_.createElement(g,{is:f.is}):_.createElement(g)}}v[ve]=r,v[Me]=f;t:for(_=r.child;_!==null;){if(_.tag===5||_.tag===6)v.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===r)break t;for(;_.sibling===null;){if(_.return===null||_.return===r)break t;_=_.return}_.sibling.return=_.return,_=_.sibling}r.stateNode=v;t:switch(Ye(v,g,f),g){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break t;case"img":f=!0;break t;default:f=!1}f&&oi(r)}}return de(r),Vg(r,r.type,o===null?null:o.memoizedProps,r.pendingProps,l),null;case 6:if(o&&r.stateNode!=null)o.memoizedProps!==f&&oi(r);else{if(typeof f!="string"&&r.stateNode===null)throw Error(i(166));if(o=ht.current,Ys(r)){if(o=r.stateNode,l=r.memoizedProps,f=null,g=Ue,g!==null)switch(g.tag){case 27:case 5:f=g.memoizedProps}o[ve]=r,o=!!(o.nodeValue===l||f!==null&&f.suppressHydrationWarning===!0||U_(o.nodeValue,l)),o||Gi(r,!0)}else o=zf(o).createTextNode(f),o[ve]=r,r.stateNode=o}return de(r),null;case 31:if(l=r.memoizedState,o===null||o.memoizedState!==null){if(f=Ys(r),l!==null){if(o===null){if(!f)throw Error(i(318));if(o=r.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(557));o[ve]=r}else $r(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;de(r),o=!1}else l=Gm(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=l),o=!0;if(!o)return r.flags&256?(Sn(r),r):(Sn(r),null);if((r.flags&128)!==0)throw Error(i(558))}return de(r),null;case 13:if(f=r.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(g=Ys(r),f!==null&&f.dehydrated!==null){if(o===null){if(!g)throw Error(i(318));if(g=r.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(317));g[ve]=r}else $r(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;de(r),g=!1}else g=Gm(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=g),g=!0;if(!g)return r.flags&256?(Sn(r),r):(Sn(r),null)}return Sn(r),(r.flags&128)!==0?(r.lanes=l,r):(l=f!==null,o=o!==null&&o.memoizedState!==null,l&&(f=r.child,g=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(g=f.alternate.memoizedState.cachePool.pool),v=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(v=f.memoizedState.cachePool.pool),v!==g&&(f.flags|=2048)),l!==o&&l&&(r.child.flags|=8192),xf(r,r.updateQueue),de(r),null);case 4:return dt(),o===null&&i0(r.stateNode.containerInfo),de(r),null;case 10:return Jo(r.type),de(r),null;case 19:if(G(Ce),f=r.memoizedState,f===null)return de(r),null;if(g=(r.flags&128)!==0,v=f.rendering,v===null)if(g)zl(f,!1);else{if(Se!==0||o!==null&&(o.flags&128)!==0)for(o=r.child;o!==null;){if(v=af(o),v!==null){for(r.flags|=128,zl(f,!1),o=v.updateQueue,r.updateQueue=o,xf(r,o),r.subtreeFlags=0,o=l,l=r.child;l!==null;)x2(l,o),l=l.sibling;return tt(Ce,Ce.current&1|2),Ft&&Qo(r,f.treeForkCount),r.child}o=o.sibling}f.tail!==null&&zt()>Tf&&(r.flags|=128,g=!0,zl(f,!1),r.lanes=4194304)}else{if(!g)if(o=af(v),o!==null){if(r.flags|=128,g=!0,o=o.updateQueue,r.updateQueue=o,xf(r,o),zl(f,!0),f.tail===null&&f.tailMode==="hidden"&&!v.alternate&&!Ft)return de(r),null}else 2*zt()-f.renderingStartTime>Tf&&l!==536870912&&(r.flags|=128,g=!0,zl(f,!1),r.lanes=4194304);f.isBackwards?(v.sibling=r.child,r.child=v):(o=f.last,o!==null?o.sibling=v:r.child=v,f.last=v)}return f.tail!==null?(o=f.tail,f.rendering=o,f.tail=o.sibling,f.renderingStartTime=zt(),o.sibling=null,l=Ce.current,tt(Ce,g?l&1|2:l&1),Ft&&Qo(r,f.treeForkCount),o):(de(r),null);case 22:case 23:return Sn(r),rg(),f=r.memoizedState!==null,o!==null?o.memoizedState!==null!==f&&(r.flags|=8192):f&&(r.flags|=8192),f?(l&536870912)!==0&&(r.flags&128)===0&&(de(r),r.subtreeFlags&6&&(r.flags|=8192)):de(r),l=r.updateQueue,l!==null&&xf(r,l.retryQueue),l=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(l=o.memoizedState.cachePool.pool),f=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),f!==l&&(r.flags|=2048),o!==null&&G(Gr),null;case 24:return l=null,o!==null&&(l=o.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),Jo(Re),de(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function P$(o,r){switch(qm(r),r.tag){case 1:return o=r.flags,o&65536?(r.flags=o&-65537|128,r):null;case 3:return Jo(Re),dt(),o=r.flags,(o&65536)!==0&&(o&128)===0?(r.flags=o&-65537|128,r):null;case 26:case 27:case 5:return Nt(r),null;case 31:if(r.memoizedState!==null){if(Sn(r),r.alternate===null)throw Error(i(340));$r()}return o=r.flags,o&65536?(r.flags=o&-65537|128,r):null;case 13:if(Sn(r),o=r.memoizedState,o!==null&&o.dehydrated!==null){if(r.alternate===null)throw Error(i(340));$r()}return o=r.flags,o&65536?(r.flags=o&-65537|128,r):null;case 19:return G(Ce),null;case 4:return dt(),null;case 10:return Jo(r.type),null;case 22:case 23:return Sn(r),rg(),o!==null&&G(Gr),o=r.flags,o&65536?(r.flags=o&-65537|128,r):null;case 24:return Jo(Re),null;case 25:return null;default:return null}}function XT(o,r){switch(qm(r),r.tag){case 3:Jo(Re),dt();break;case 26:case 27:case 5:Nt(r);break;case 4:dt();break;case 31:r.memoizedState!==null&&Sn(r);break;case 13:Sn(r);break;case 19:G(Ce);break;case 10:Jo(r.type);break;case 22:case 23:Sn(r),rg(),o!==null&&G(Gr);break;case 24:Jo(Re)}}function Vl(o,r){try{var l=r.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var g=f.next;l=g;do{if((l.tag&o)===o){f=void 0;var v=l.create,_=l.inst;f=v(),_.destroy=f}l=l.next}while(l!==g)}}catch(V){te(r,r.return,V)}}function Ji(o,r,l){try{var f=r.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var v=g.next;f=v;do{if((f.tag&o)===o){var _=f.inst,V=_.destroy;if(V!==void 0){_.destroy=void 0,g=r;var X=l,nt=V;try{nt()}catch(st){te(g,X,st)}}}f=f.next}while(f!==v)}}catch(st){te(r,r.return,st)}}function FT(o){var r=o.updateQueue;if(r!==null){var l=o.stateNode;try{I2(r,l)}catch(f){te(o,o.return,f)}}}function ZT(o,r,l){l.props=Qr(o.type,o.memoizedProps),l.state=o.memoizedState;try{l.componentWillUnmount()}catch(f){te(o,r,f)}}function Ll(o,r){try{var l=o.ref;if(l!==null){switch(o.tag){case 26:case 27:case 5:var f=o.stateNode;break;case 30:f=o.stateNode;break;default:f=o.stateNode}typeof l=="function"?o.refCleanup=l(f):l.current=f}}catch(g){te(o,r,g)}}function No(o,r){var l=o.ref,f=o.refCleanup;if(l!==null)if(typeof f=="function")try{f()}catch(g){te(o,r,g)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(g){te(o,r,g)}else l.current=null}function KT(o){var r=o.type,l=o.memoizedProps,f=o.stateNode;try{t:switch(r){case"button":case"input":case"select":case"textarea":l.autoFocus&&f.focus();break t;case"img":l.src?f.src=l.src:l.srcSet&&(f.srcset=l.srcSet)}}catch(g){te(o,o.return,g)}}function Lg(o,r,l){try{var f=o.stateNode;l7(f,o.type,l,r),f[Me]=r}catch(g){te(o,o.return,g)}}function QT(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&sr(o.type)||o.tag===4}function Ig(o){t:for(;;){for(;o.sibling===null;){if(o.return===null||QT(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&sr(o.type)||o.flags&2||o.child===null||o.tag===4)continue t;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Bg(o,r,l){var f=o.tag;if(f===5||f===6)o=o.stateNode,r?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(o,r):(r=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,r.appendChild(o),l=l._reactRootContainer,l!=null||r.onclick!==null||(r.onclick=Fo));else if(f!==4&&(f===27&&sr(o.type)&&(l=o.stateNode,r=null),o=o.child,o!==null))for(Bg(o,r,l),o=o.sibling;o!==null;)Bg(o,r,l),o=o.sibling}function wf(o,r,l){var f=o.tag;if(f===5||f===6)o=o.stateNode,r?l.insertBefore(o,r):l.appendChild(o);else if(f!==4&&(f===27&&sr(o.type)&&(l=o.stateNode),o=o.child,o!==null))for(wf(o,r,l),o=o.sibling;o!==null;)wf(o,r,l),o=o.sibling}function WT(o){var r=o.stateNode,l=o.memoizedProps;try{for(var f=o.type,g=r.attributes;g.length;)r.removeAttributeNode(g[0]);Ye(r,f,l),r[ve]=o,r[Me]=l}catch(v){te(o,o.return,v)}}var ii=!1,De=!1,Pg=!1,JT=typeof WeakSet=="function"?WeakSet:Set,Ie=null;function H$(o,r){if(o=o.containerInfo,a0=Uf,o=f2(o),Dm(o)){if("selectionStart"in o)var l={start:o.selectionStart,end:o.selectionEnd};else t:{l=(l=o.ownerDocument)&&l.defaultView||window;var f=l.getSelection&&l.getSelection();if(f&&f.rangeCount!==0){l=f.anchorNode;var g=f.anchorOffset,v=f.focusNode;f=f.focusOffset;try{l.nodeType,v.nodeType}catch{l=null;break t}var _=0,V=-1,X=-1,nt=0,st=0,ct=o,ot=null;e:for(;;){for(var rt;ct!==l||g!==0&&ct.nodeType!==3||(V=_+g),ct!==v||f!==0&&ct.nodeType!==3||(X=_+f),ct.nodeType===3&&(_+=ct.nodeValue.length),(rt=ct.firstChild)!==null;)ot=ct,ct=rt;for(;;){if(ct===o)break e;if(ot===l&&++nt===g&&(V=_),ot===v&&++st===f&&(X=_),(rt=ct.nextSibling)!==null)break;ct=ot,ot=ct.parentNode}ct=rt}l=V===-1||X===-1?null:{start:V,end:X}}else l=null}l=l||{start:0,end:0}}else l=null;for(l0={focusedElem:o,selectionRange:l},Uf=!1,Ie=r;Ie!==null;)if(r=Ie,o=r.child,(r.subtreeFlags&1028)!==0&&o!==null)o.return=r,Ie=o;else for(;Ie!==null;){switch(r=Ie,v=r.alternate,o=r.flags,r.tag){case 0:if((o&4)!==0&&(o=r.updateQueue,o=o!==null?o.events:null,o!==null))for(l=0;l<o.length;l++)g=o[l],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&v!==null){o=void 0,l=r,g=v.memoizedProps,v=v.memoizedState,f=l.stateNode;try{var xt=Qr(l.type,g);o=f.getSnapshotBeforeUpdate(xt,v),f.__reactInternalSnapshotBeforeUpdate=o}catch(Ot){te(l,l.return,Ot)}}break;case 3:if((o&1024)!==0){if(o=r.stateNode.containerInfo,l=o.nodeType,l===9)f0(o);else if(l===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":f0(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(i(163))}if(o=r.sibling,o!==null){o.return=r.return,Ie=o;break}Ie=r.return}}function t_(o,r,l){var f=l.flags;switch(l.tag){case 0:case 11:case 15:si(o,l),f&4&&Vl(5,l);break;case 1:if(si(o,l),f&4)if(o=l.stateNode,r===null)try{o.componentDidMount()}catch(_){te(l,l.return,_)}else{var g=Qr(l.type,r.memoizedProps);r=r.memoizedState;try{o.componentDidUpdate(g,r,o.__reactInternalSnapshotBeforeUpdate)}catch(_){te(l,l.return,_)}}f&64&&FT(l),f&512&&Ll(l,l.return);break;case 3:if(si(o,l),f&64&&(o=l.updateQueue,o!==null)){if(r=null,l.child!==null)switch(l.child.tag){case 27:case 5:r=l.child.stateNode;break;case 1:r=l.child.stateNode}try{I2(o,r)}catch(_){te(l,l.return,_)}}break;case 27:r===null&&f&4&&WT(l);case 26:case 5:si(o,l),r===null&&f&4&&KT(l),f&512&&Ll(l,l.return);break;case 12:si(o,l);break;case 31:si(o,l),f&4&&o_(o,l);break;case 13:si(o,l),f&4&&i_(o,l),f&64&&(o=l.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(l=K$.bind(null,l),g7(o,l))));break;case 22:if(f=l.memoizedState!==null||ii,!f){r=r!==null&&r.memoizedState!==null||De,g=ii;var v=De;ii=f,(De=r)&&!v?ai(o,l,(l.subtreeFlags&8772)!==0):si(o,l),ii=g,De=v}break;case 30:break;default:si(o,l)}}function e_(o){var r=o.alternate;r!==null&&(o.alternate=null,e_(r)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(r=o.stateNode,r!==null&&qo(r)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var ge=null,sn=!1;function ri(o,r,l){for(l=l.child;l!==null;)n_(o,r,l),l=l.sibling}function n_(o,r,l){if(re&&typeof re.onCommitFiberUnmount=="function")try{re.onCommitFiberUnmount(pe,l)}catch{}switch(l.tag){case 26:De||No(l,r),ri(o,r,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:De||No(l,r);var f=ge,g=sn;sr(l.type)&&(ge=l.stateNode,sn=!1),ri(o,r,l),Gl(l.stateNode),ge=f,sn=g;break;case 5:De||No(l,r);case 6:if(f=ge,g=sn,ge=null,ri(o,r,l),ge=f,sn=g,ge!==null)if(sn)try{(ge.nodeType===9?ge.body:ge.nodeName==="HTML"?ge.ownerDocument.body:ge).removeChild(l.stateNode)}catch(v){te(l,r,v)}else try{ge.removeChild(l.stateNode)}catch(v){te(l,r,v)}break;case 18:ge!==null&&(sn?(o=ge,F_(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,l.stateNode),da(o)):F_(ge,l.stateNode));break;case 4:f=ge,g=sn,ge=l.stateNode.containerInfo,sn=!0,ri(o,r,l),ge=f,sn=g;break;case 0:case 11:case 14:case 15:Ji(2,l,r),De||Ji(4,l,r),ri(o,r,l);break;case 1:De||(No(l,r),f=l.stateNode,typeof f.componentWillUnmount=="function"&&ZT(l,r,f)),ri(o,r,l);break;case 21:ri(o,r,l);break;case 22:De=(f=De)||l.memoizedState!==null,ri(o,r,l),De=f;break;default:ri(o,r,l)}}function o_(o,r){if(r.memoizedState===null&&(o=r.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{da(o)}catch(l){te(r,r.return,l)}}}function i_(o,r){if(r.memoizedState===null&&(o=r.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{da(o)}catch(l){te(r,r.return,l)}}function U$(o){switch(o.tag){case 31:case 13:case 19:var r=o.stateNode;return r===null&&(r=o.stateNode=new JT),r;case 22:return o=o.stateNode,r=o._retryCache,r===null&&(r=o._retryCache=new JT),r;default:throw Error(i(435,o.tag))}}function Sf(o,r){var l=U$(o);r.forEach(function(f){if(!l.has(f)){l.add(f);var g=Q$.bind(null,o,f);f.then(g,g)}})}function an(o,r){var l=r.deletions;if(l!==null)for(var f=0;f<l.length;f++){var g=l[f],v=o,_=r,V=_;t:for(;V!==null;){switch(V.tag){case 27:if(sr(V.type)){ge=V.stateNode,sn=!1;break t}break;case 5:ge=V.stateNode,sn=!1;break t;case 3:case 4:ge=V.stateNode.containerInfo,sn=!0;break t}V=V.return}if(ge===null)throw Error(i(160));n_(v,_,g),ge=null,sn=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)r_(r,o),r=r.sibling}var so=null;function r_(o,r){var l=o.alternate,f=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:an(r,o),ln(o),f&4&&(Ji(3,o,o.return),Vl(3,o),Ji(5,o,o.return));break;case 1:an(r,o),ln(o),f&512&&(De||l===null||No(l,l.return)),f&64&&ii&&(o=o.updateQueue,o!==null&&(f=o.callbacks,f!==null&&(l=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=l===null?f:l.concat(f))));break;case 26:var g=so;if(an(r,o),ln(o),f&512&&(De||l===null||No(l,l.return)),f&4){var v=l!==null?l.memoizedState:null;if(f=o.memoizedState,l===null)if(f===null)if(o.stateNode===null){t:{f=o.type,l=o.memoizedProps,g=g.ownerDocument||g;e:switch(f){case"title":v=g.getElementsByTagName("title")[0],(!v||v[oo]||v[ve]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(f),g.head.insertBefore(v,g.querySelector("head > title"))),Ye(v,f,l),v[ve]=o,me(v),f=v;break t;case"link":var _=rN("link","href",g).get(f+(l.href||""));if(_){for(var V=0;V<_.length;V++)if(v=_[V],v.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&v.getAttribute("rel")===(l.rel==null?null:l.rel)&&v.getAttribute("title")===(l.title==null?null:l.title)&&v.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){_.splice(V,1);break e}}v=g.createElement(f),Ye(v,f,l),g.head.appendChild(v);break;case"meta":if(_=rN("meta","content",g).get(f+(l.content||""))){for(V=0;V<_.length;V++)if(v=_[V],v.getAttribute("content")===(l.content==null?null:""+l.content)&&v.getAttribute("name")===(l.name==null?null:l.name)&&v.getAttribute("property")===(l.property==null?null:l.property)&&v.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&v.getAttribute("charset")===(l.charSet==null?null:l.charSet)){_.splice(V,1);break e}}v=g.createElement(f),Ye(v,f,l),g.head.appendChild(v);break;default:throw Error(i(468,f))}v[ve]=o,me(v),f=v}o.stateNode=f}else sN(g,o.type,o.stateNode);else o.stateNode=iN(g,f,o.memoizedProps);else v!==f?(v===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):v.count--,f===null?sN(g,o.type,o.stateNode):iN(g,f,o.memoizedProps)):f===null&&o.stateNode!==null&&Lg(o,o.memoizedProps,l.memoizedProps)}break;case 27:an(r,o),ln(o),f&512&&(De||l===null||No(l,l.return)),l!==null&&f&4&&Lg(o,o.memoizedProps,l.memoizedProps);break;case 5:if(an(r,o),ln(o),f&512&&(De||l===null||No(l,l.return)),o.flags&32){g=o.stateNode;try{zs(g,"")}catch(xt){te(o,o.return,xt)}}f&4&&o.stateNode!=null&&(g=o.memoizedProps,Lg(o,g,l!==null?l.memoizedProps:g)),f&1024&&(Pg=!0);break;case 6:if(an(r,o),ln(o),f&4){if(o.stateNode===null)throw Error(i(162));f=o.memoizedProps,l=o.stateNode;try{l.nodeValue=f}catch(xt){te(o,o.return,xt)}}break;case 3:if(If=null,g=so,so=Vf(r.containerInfo),an(r,o),so=g,ln(o),f&4&&l!==null&&l.memoizedState.isDehydrated)try{da(r.containerInfo)}catch(xt){te(o,o.return,xt)}Pg&&(Pg=!1,s_(o));break;case 4:f=so,so=Vf(o.stateNode.containerInfo),an(r,o),ln(o),so=f;break;case 12:an(r,o),ln(o);break;case 31:an(r,o),ln(o),f&4&&(f=o.updateQueue,f!==null&&(o.updateQueue=null,Sf(o,f)));break;case 13:an(r,o),ln(o),o.child.flags&8192&&o.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Cf=zt()),f&4&&(f=o.updateQueue,f!==null&&(o.updateQueue=null,Sf(o,f)));break;case 22:g=o.memoizedState!==null;var X=l!==null&&l.memoizedState!==null,nt=ii,st=De;if(ii=nt||g,De=st||X,an(r,o),De=st,ii=nt,ln(o),f&8192)t:for(r=o.stateNode,r._visibility=g?r._visibility&-2:r._visibility|1,g&&(l===null||X||ii||De||Wr(o)),l=null,r=o;;){if(r.tag===5||r.tag===26){if(l===null){X=l=r;try{if(v=X.stateNode,g)_=v.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{V=X.stateNode;var ct=X.memoizedProps.style,ot=ct!=null&&ct.hasOwnProperty("display")?ct.display:null;V.style.display=ot==null||typeof ot=="boolean"?"":(""+ot).trim()}}catch(xt){te(X,X.return,xt)}}}else if(r.tag===6){if(l===null){X=r;try{X.stateNode.nodeValue=g?"":X.memoizedProps}catch(xt){te(X,X.return,xt)}}}else if(r.tag===18){if(l===null){X=r;try{var rt=X.stateNode;g?Z_(rt,!0):Z_(X.stateNode,!1)}catch(xt){te(X,X.return,xt)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===o)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break t;for(;r.sibling===null;){if(r.return===null||r.return===o)break t;l===r&&(l=null),r=r.return}l===r&&(l=null),r.sibling.return=r.return,r=r.sibling}f&4&&(f=o.updateQueue,f!==null&&(l=f.retryQueue,l!==null&&(f.retryQueue=null,Sf(o,l))));break;case 19:an(r,o),ln(o),f&4&&(f=o.updateQueue,f!==null&&(o.updateQueue=null,Sf(o,f)));break;case 30:break;case 21:break;default:an(r,o),ln(o)}}function ln(o){var r=o.flags;if(r&2){try{for(var l,f=o.return;f!==null;){if(QT(f)){l=f;break}f=f.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var g=l.stateNode,v=Ig(o);wf(o,v,g);break;case 5:var _=l.stateNode;l.flags&32&&(zs(_,""),l.flags&=-33);var V=Ig(o);wf(o,V,_);break;case 3:case 4:var X=l.stateNode.containerInfo,nt=Ig(o);Bg(o,nt,X);break;default:throw Error(i(161))}}catch(st){te(o,o.return,st)}o.flags&=-3}r&4096&&(o.flags&=-4097)}function s_(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var r=o;s_(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),o=o.sibling}}function si(o,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)t_(o,r.alternate,r),r=r.sibling}function Wr(o){for(o=o.child;o!==null;){var r=o;switch(r.tag){case 0:case 11:case 14:case 15:Ji(4,r,r.return),Wr(r);break;case 1:No(r,r.return);var l=r.stateNode;typeof l.componentWillUnmount=="function"&&ZT(r,r.return,l),Wr(r);break;case 27:Gl(r.stateNode);case 26:case 5:No(r,r.return),Wr(r);break;case 22:r.memoizedState===null&&Wr(r);break;case 30:Wr(r);break;default:Wr(r)}o=o.sibling}}function ai(o,r,l){for(l=l&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var f=r.alternate,g=o,v=r,_=v.flags;switch(v.tag){case 0:case 11:case 15:ai(g,v,l),Vl(4,v);break;case 1:if(ai(g,v,l),f=v,g=f.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(nt){te(f,f.return,nt)}if(f=v,g=f.updateQueue,g!==null){var V=f.stateNode;try{var X=g.shared.hiddenCallbacks;if(X!==null)for(g.shared.hiddenCallbacks=null,g=0;g<X.length;g++)L2(X[g],V)}catch(nt){te(f,f.return,nt)}}l&&_&64&&FT(v),Ll(v,v.return);break;case 27:WT(v);case 26:case 5:ai(g,v,l),l&&f===null&&_&4&&KT(v),Ll(v,v.return);break;case 12:ai(g,v,l);break;case 31:ai(g,v,l),l&&_&4&&o_(g,v);break;case 13:ai(g,v,l),l&&_&4&&i_(g,v);break;case 22:v.memoizedState===null&&ai(g,v,l),Ll(v,v.return);break;case 30:break;default:ai(g,v,l)}r=r.sibling}}function Hg(o,r){var l=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(l=o.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==l&&(o!=null&&o.refCount++,l!=null&&El(l))}function Ug(o,r){o=null,r.alternate!==null&&(o=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==o&&(r.refCount++,o!=null&&El(o))}function ao(o,r,l,f){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)a_(o,r,l,f),r=r.sibling}function a_(o,r,l,f){var g=r.flags;switch(r.tag){case 0:case 11:case 15:ao(o,r,l,f),g&2048&&Vl(9,r);break;case 1:ao(o,r,l,f);break;case 3:ao(o,r,l,f),g&2048&&(o=null,r.alternate!==null&&(o=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==o&&(r.refCount++,o!=null&&El(o)));break;case 12:if(g&2048){ao(o,r,l,f),o=r.stateNode;try{var v=r.memoizedProps,_=v.id,V=v.onPostCommit;typeof V=="function"&&V(_,r.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(X){te(r,r.return,X)}}else ao(o,r,l,f);break;case 31:ao(o,r,l,f);break;case 13:ao(o,r,l,f);break;case 23:break;case 22:v=r.stateNode,_=r.alternate,r.memoizedState!==null?v._visibility&2?ao(o,r,l,f):Il(o,r):v._visibility&2?ao(o,r,l,f):(v._visibility|=2,ea(o,r,l,f,(r.subtreeFlags&10256)!==0||!1)),g&2048&&Hg(_,r);break;case 24:ao(o,r,l,f),g&2048&&Ug(r.alternate,r);break;default:ao(o,r,l,f)}}function ea(o,r,l,f,g){for(g=g&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var v=o,_=r,V=l,X=f,nt=_.flags;switch(_.tag){case 0:case 11:case 15:ea(v,_,V,X,g),Vl(8,_);break;case 23:break;case 22:var st=_.stateNode;_.memoizedState!==null?st._visibility&2?ea(v,_,V,X,g):Il(v,_):(st._visibility|=2,ea(v,_,V,X,g)),g&&nt&2048&&Hg(_.alternate,_);break;case 24:ea(v,_,V,X,g),g&&nt&2048&&Ug(_.alternate,_);break;default:ea(v,_,V,X,g)}r=r.sibling}}function Il(o,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var l=o,f=r,g=f.flags;switch(f.tag){case 22:Il(l,f),g&2048&&Hg(f.alternate,f);break;case 24:Il(l,f),g&2048&&Ug(f.alternate,f);break;default:Il(l,f)}r=r.sibling}}var Bl=8192;function na(o,r,l){if(o.subtreeFlags&Bl)for(o=o.child;o!==null;)l_(o,r,l),o=o.sibling}function l_(o,r,l){switch(o.tag){case 26:na(o,r,l),o.flags&Bl&&o.memoizedState!==null&&A7(l,so,o.memoizedState,o.memoizedProps);break;case 5:na(o,r,l);break;case 3:case 4:var f=so;so=Vf(o.stateNode.containerInfo),na(o,r,l),so=f;break;case 22:o.memoizedState===null&&(f=o.alternate,f!==null&&f.memoizedState!==null?(f=Bl,Bl=16777216,na(o,r,l),Bl=f):na(o,r,l));break;default:na(o,r,l)}}function c_(o){var r=o.alternate;if(r!==null&&(o=r.child,o!==null)){r.child=null;do r=o.sibling,o.sibling=null,o=r;while(o!==null)}}function Pl(o){var r=o.deletions;if((o.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var f=r[l];Ie=f,f_(f,o)}c_(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)u_(o),o=o.sibling}function u_(o){switch(o.tag){case 0:case 11:case 15:Pl(o),o.flags&2048&&Ji(9,o,o.return);break;case 3:Pl(o);break;case 12:Pl(o);break;case 22:var r=o.stateNode;o.memoizedState!==null&&r._visibility&2&&(o.return===null||o.return.tag!==13)?(r._visibility&=-3,Ef(o)):Pl(o);break;default:Pl(o)}}function Ef(o){var r=o.deletions;if((o.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var f=r[l];Ie=f,f_(f,o)}c_(o)}for(o=o.child;o!==null;){switch(r=o,r.tag){case 0:case 11:case 15:Ji(8,r,r.return),Ef(r);break;case 22:l=r.stateNode,l._visibility&2&&(l._visibility&=-3,Ef(r));break;default:Ef(r)}o=o.sibling}}function f_(o,r){for(;Ie!==null;){var l=Ie;switch(l.tag){case 0:case 11:case 15:Ji(8,l,r);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var f=l.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:El(l.memoizedState.cache)}if(f=l.child,f!==null)f.return=l,Ie=f;else t:for(l=o;Ie!==null;){f=Ie;var g=f.sibling,v=f.return;if(e_(f),f===l){Ie=null;break t}if(g!==null){g.return=v,Ie=g;break t}Ie=v}}}var $$={getCacheForType:function(o){var r=$e(Re),l=r.data.get(o);return l===void 0&&(l=o(),r.data.set(o,l)),l},cacheSignal:function(){return $e(Re).controller.signal}},q$=typeof WeakMap=="function"?WeakMap:Map,Wt=0,se=null,Ut=null,Yt=0,Jt=0,En=null,tr=!1,oa=!1,$g=!1,li=0,Se=0,er=0,Jr=0,qg=0,Cn=0,ia=0,Hl=null,cn=null,Yg=!1,Cf=0,d_=0,Tf=1/0,_f=null,nr=null,Ve=0,or=null,ra=null,ci=0,Gg=0,Xg=null,h_=null,Ul=0,Fg=null;function Tn(){return(Wt&2)!==0&&Yt!==0?Yt&-Yt:j.T!==null?t0():$o()}function p_(){if(Cn===0)if((Yt&536870912)===0||Ft){var o=to;to<<=1,(to&3932160)===0&&(to=262144),Cn=o}else Cn=536870912;return o=wn.current,o!==null&&(o.flags|=32),Cn}function un(o,r,l){(o===se&&(Jt===2||Jt===9)||o.cancelPendingCommit!==null)&&(sa(o,0),ir(o,Yt,Cn,!1)),no(o,l),((Wt&2)===0||o!==se)&&(o===se&&((Wt&2)===0&&(Jr|=l),Se===4&&ir(o,Yt,Cn,!1)),Ao(o))}function m_(o,r,l){if((Wt&6)!==0)throw Error(i(327));var f=!l&&(r&127)===0&&(r&o.expiredLanes)===0||eo(o,r),g=f?X$(o,r):Kg(o,r,!0),v=f;do{if(g===0){oa&&!f&&ir(o,r,0,!1);break}else{if(l=o.current.alternate,v&&!Y$(l)){g=Kg(o,r,!1),v=!1;continue}if(g===2){if(v=r,o.errorRecoveryDisabledLanes&v)var _=0;else _=o.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){r=_;t:{var V=o;g=Hl;var X=V.current.memoizedState.isDehydrated;if(X&&(sa(V,_).flags|=256),_=Kg(V,_,!1),_!==2){if($g&&!X){V.errorRecoveryDisabledLanes|=v,Jr|=v,g=4;break t}v=cn,cn=g,v!==null&&(cn===null?cn=v:cn.push.apply(cn,v))}g=_}if(v=!1,g!==2)continue}}if(g===1){sa(o,0),ir(o,r,0,!0);break}t:{switch(f=o,v=g,v){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:ir(f,r,Cn,!tr);break t;case 2:cn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(g=Cf+300-zt(),10<g)){if(ir(f,r,Cn,!tr),Ri(f,0,!0)!==0)break t;ci=r,f.timeoutHandle=G_(g_.bind(null,f,l,cn,_f,Yg,r,Cn,Jr,ia,tr,v,"Throttled",-0,0),g);break t}g_(f,l,cn,_f,Yg,r,Cn,Jr,ia,tr,v,null,-0,0)}}break}while(!0);Ao(o)}function g_(o,r,l,f,g,v,_,V,X,nt,st,ct,ot,rt){if(o.timeoutHandle=-1,ct=r.subtreeFlags,ct&8192||(ct&16785408)===16785408){ct={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fo},l_(r,v,ct);var xt=(v&62914560)===v?Cf-zt():(v&4194048)===v?d_-zt():0;if(xt=M7(ct,xt),xt!==null){ci=v,o.cancelPendingCommit=xt(C_.bind(null,o,r,v,l,f,g,_,V,X,st,ct,null,ot,rt)),ir(o,v,_,!nt);return}}C_(o,r,v,l,f,g,_,V,X)}function Y$(o){for(var r=o;;){var l=r.tag;if((l===0||l===11||l===15)&&r.flags&16384&&(l=r.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var f=0;f<l.length;f++){var g=l[f],v=g.getSnapshot;g=g.value;try{if(!bn(v(),g))return!1}catch{return!1}}if(l=r.child,r.subtreeFlags&16384&&l!==null)l.return=r,r=l;else{if(r===o)break;for(;r.sibling===null;){if(r.return===null||r.return===o)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function ir(o,r,l,f){r&=~qg,r&=~Jr,o.suspendedLanes|=r,o.pingedLanes&=~r,f&&(o.warmLanes|=r),f=o.expirationTimes;for(var g=r;0<g;){var v=31-Ee(g),_=1<<v;f[v]=-1,g&=~_}l!==0&&Di(o,l,r)}function Nf(){return(Wt&6)===0?($l(0),!1):!0}function Zg(){if(Ut!==null){if(Jt===0)var o=Ut.return;else o=Ut,Wo=qr=null,fg(o),Ks=null,Tl=0,o=Ut;for(;o!==null;)XT(o.alternate,o),o=o.return;Ut=null}}function sa(o,r){var l=o.timeoutHandle;l!==-1&&(o.timeoutHandle=-1,f7(l)),l=o.cancelPendingCommit,l!==null&&(o.cancelPendingCommit=null,l()),ci=0,Zg(),se=o,Ut=l=Ko(o.current,null),Yt=r,Jt=0,En=null,tr=!1,oa=eo(o,r),$g=!1,ia=Cn=qg=Jr=er=Se=0,cn=Hl=null,Yg=!1,(r&8)!==0&&(r|=r&32);var f=o.entangledLanes;if(f!==0)for(o=o.entanglements,f&=r;0<f;){var g=31-Ee(f),v=1<<g;r|=o[g],f&=~v}return li=r,Xu(),l}function y_(o,r){It=null,j.H=Dl,r===Zs||r===ef?(r=D2(),Jt=3):r===Jm?(r=D2(),Jt=4):Jt=r===Ng?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,En=r,Ut===null&&(Se=1,gf(o,jn(r,o.current)))}function v_(){var o=wn.current;return o===null?!0:(Yt&4194048)===Yt?In===null:(Yt&62914560)===Yt||(Yt&536870912)!==0?o===In:!1}function b_(){var o=j.H;return j.H=Dl,o===null?Dl:o}function x_(){var o=j.A;return j.A=$$,o}function Af(){Se=4,tr||(Yt&4194048)!==Yt&&wn.current!==null||(oa=!0),(er&134217727)===0&&(Jr&134217727)===0||se===null||ir(se,Yt,Cn,!1)}function Kg(o,r,l){var f=Wt;Wt|=2;var g=b_(),v=x_();(se!==o||Yt!==r)&&(_f=null,sa(o,r)),r=!1;var _=Se;t:do try{if(Jt!==0&&Ut!==null){var V=Ut,X=En;switch(Jt){case 8:Zg(),_=6;break t;case 3:case 2:case 9:case 6:wn.current===null&&(r=!0);var nt=Jt;if(Jt=0,En=null,aa(o,V,X,nt),l&&oa){_=0;break t}break;default:nt=Jt,Jt=0,En=null,aa(o,V,X,nt)}}G$(),_=Se;break}catch(st){y_(o,st)}while(!0);return r&&o.shellSuspendCounter++,Wo=qr=null,Wt=f,j.H=g,j.A=v,Ut===null&&(se=null,Yt=0,Xu()),_}function G$(){for(;Ut!==null;)w_(Ut)}function X$(o,r){var l=Wt;Wt|=2;var f=b_(),g=x_();se!==o||Yt!==r?(_f=null,Tf=zt()+500,sa(o,r)):oa=eo(o,r);t:do try{if(Jt!==0&&Ut!==null){r=Ut;var v=En;e:switch(Jt){case 1:Jt=0,En=null,aa(o,r,v,1);break;case 2:case 9:if(k2(v)){Jt=0,En=null,S_(r);break}r=function(){Jt!==2&&Jt!==9||se!==o||(Jt=7),Ao(o)},v.then(r,r);break t;case 3:Jt=7;break t;case 4:Jt=5;break t;case 7:k2(v)?(Jt=0,En=null,S_(r)):(Jt=0,En=null,aa(o,r,v,7));break;case 5:var _=null;switch(Ut.tag){case 26:_=Ut.memoizedState;case 5:case 27:var V=Ut;if(_?aN(_):V.stateNode.complete){Jt=0,En=null;var X=V.sibling;if(X!==null)Ut=X;else{var nt=V.return;nt!==null?(Ut=nt,Mf(nt)):Ut=null}break e}}Jt=0,En=null,aa(o,r,v,5);break;case 6:Jt=0,En=null,aa(o,r,v,6);break;case 8:Zg(),Se=6;break t;default:throw Error(i(462))}}F$();break}catch(st){y_(o,st)}while(!0);return Wo=qr=null,j.H=f,j.A=g,Wt=l,Ut!==null?0:(se=null,Yt=0,Xu(),Se)}function F$(){for(;Ut!==null&&!Vt();)w_(Ut)}function w_(o){var r=YT(o.alternate,o,li);o.memoizedProps=o.pendingProps,r===null?Mf(o):Ut=r}function S_(o){var r=o,l=r.alternate;switch(r.tag){case 15:case 0:r=BT(l,r,r.pendingProps,r.type,void 0,Yt);break;case 11:r=BT(l,r,r.pendingProps,r.type.render,r.ref,Yt);break;case 5:fg(r);default:XT(l,r),r=Ut=x2(r,li),r=YT(l,r,li)}o.memoizedProps=o.pendingProps,r===null?Mf(o):Ut=r}function aa(o,r,l,f){Wo=qr=null,fg(r),Ks=null,Tl=0;var g=r.return;try{if(V$(o,g,r,l,Yt)){Se=1,gf(o,jn(l,o.current)),Ut=null;return}}catch(v){if(g!==null)throw Ut=g,v;Se=1,gf(o,jn(l,o.current)),Ut=null;return}r.flags&32768?(Ft||f===1?o=!0:oa||(Yt&536870912)!==0?o=!1:(tr=o=!0,(f===2||f===9||f===3||f===6)&&(f=wn.current,f!==null&&f.tag===13&&(f.flags|=16384))),E_(r,o)):Mf(r)}function Mf(o){var r=o;do{if((r.flags&32768)!==0){E_(r,tr);return}o=r.return;var l=B$(r.alternate,r,li);if(l!==null){Ut=l;return}if(r=r.sibling,r!==null){Ut=r;return}Ut=r=o}while(r!==null);Se===0&&(Se=5)}function E_(o,r){do{var l=P$(o.alternate,o);if(l!==null){l.flags&=32767,Ut=l;return}if(l=o.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!r&&(o=o.sibling,o!==null)){Ut=o;return}Ut=o=l}while(o!==null);Se=6,Ut=null}function C_(o,r,l,f,g,v,_,V,X){o.cancelPendingCommit=null;do Rf();while(Ve!==0);if((Wt&6)!==0)throw Error(i(327));if(r!==null){if(r===o.current)throw Error(i(177));if(v=r.lanes|r.childLanes,v|=Im,Oi(o,l,v,_,V,X),o===se&&(Ut=se=null,Yt=0),ra=r,or=o,ci=l,Gg=v,Xg=g,h_=f,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,W$(Pe,function(){return M_(),null})):(o.callbackNode=null,o.callbackPriority=0),f=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||f){f=j.T,j.T=null,g=I.p,I.p=2,_=Wt,Wt|=4;try{H$(o,r,l)}finally{Wt=_,I.p=g,j.T=f}}Ve=1,T_(),__(),N_()}}function T_(){if(Ve===1){Ve=0;var o=or,r=ra,l=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||l){l=j.T,j.T=null;var f=I.p;I.p=2;var g=Wt;Wt|=4;try{r_(r,o);var v=l0,_=f2(o.containerInfo),V=v.focusedElem,X=v.selectionRange;if(_!==V&&V&&V.ownerDocument&&u2(V.ownerDocument.documentElement,V)){if(X!==null&&Dm(V)){var nt=X.start,st=X.end;if(st===void 0&&(st=nt),"selectionStart"in V)V.selectionStart=nt,V.selectionEnd=Math.min(st,V.value.length);else{var ct=V.ownerDocument||document,ot=ct&&ct.defaultView||window;if(ot.getSelection){var rt=ot.getSelection(),xt=V.textContent.length,Ot=Math.min(X.start,xt),ie=X.end===void 0?Ot:Math.min(X.end,xt);!rt.extend&&Ot>ie&&(_=ie,ie=Ot,Ot=_);var W=c2(V,Ot),K=c2(V,ie);if(W&&K&&(rt.rangeCount!==1||rt.anchorNode!==W.node||rt.anchorOffset!==W.offset||rt.focusNode!==K.node||rt.focusOffset!==K.offset)){var et=ct.createRange();et.setStart(W.node,W.offset),rt.removeAllRanges(),Ot>ie?(rt.addRange(et),rt.extend(K.node,K.offset)):(et.setEnd(K.node,K.offset),rt.addRange(et))}}}}for(ct=[],rt=V;rt=rt.parentNode;)rt.nodeType===1&&ct.push({element:rt,left:rt.scrollLeft,top:rt.scrollTop});for(typeof V.focus=="function"&&V.focus(),V=0;V<ct.length;V++){var at=ct[V];at.element.scrollLeft=at.left,at.element.scrollTop=at.top}}Uf=!!a0,l0=a0=null}finally{Wt=g,I.p=f,j.T=l}}o.current=r,Ve=2}}function __(){if(Ve===2){Ve=0;var o=or,r=ra,l=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||l){l=j.T,j.T=null;var f=I.p;I.p=2;var g=Wt;Wt|=4;try{t_(o,r.alternate,r)}finally{Wt=g,I.p=f,j.T=l}}Ve=3}}function N_(){if(Ve===4||Ve===3){Ve=0,jt();var o=or,r=ra,l=ci,f=h_;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Ve=5:(Ve=0,ra=or=null,A_(o,o.pendingLanes));var g=o.pendingLanes;if(g===0&&(nr=null),Uo(l),r=r.stateNode,re&&typeof re.onCommitFiberRoot=="function")try{re.onCommitFiberRoot(pe,r,void 0,(r.current.flags&128)===128)}catch{}if(f!==null){r=j.T,g=I.p,I.p=2,j.T=null;try{for(var v=o.onRecoverableError,_=0;_<f.length;_++){var V=f[_];v(V.value,{componentStack:V.stack})}}finally{j.T=r,I.p=g}}(ci&3)!==0&&Rf(),Ao(o),g=o.pendingLanes,(l&261930)!==0&&(g&42)!==0?o===Fg?Ul++:(Ul=0,Fg=o):Ul=0,$l(0)}}function A_(o,r){(o.pooledCacheLanes&=r)===0&&(r=o.pooledCache,r!=null&&(o.pooledCache=null,El(r)))}function Rf(){return T_(),__(),N_(),M_()}function M_(){if(Ve!==5)return!1;var o=or,r=Gg;Gg=0;var l=Uo(ci),f=j.T,g=I.p;try{I.p=32>l?32:l,j.T=null,l=Xg,Xg=null;var v=or,_=ci;if(Ve=0,ra=or=null,ci=0,(Wt&6)!==0)throw Error(i(331));var V=Wt;if(Wt|=4,u_(v.current),a_(v,v.current,_,l),Wt=V,$l(0,!1),re&&typeof re.onPostCommitFiberRoot=="function")try{re.onPostCommitFiberRoot(pe,v)}catch{}return!0}finally{I.p=g,j.T=f,A_(o,r)}}function R_(o,r,l){r=jn(l,r),r=_g(o.stateNode,r,2),o=Ki(o,r,2),o!==null&&(no(o,2),Ao(o))}function te(o,r,l){if(o.tag===3)R_(o,o,l);else for(;r!==null;){if(r.tag===3){R_(r,o,l);break}else if(r.tag===1){var f=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(nr===null||!nr.has(f))){o=jn(l,o),l=kT(2),f=Ki(r,l,2),f!==null&&(OT(l,f,r,o),no(f,2),Ao(f));break}}r=r.return}}function Qg(o,r,l){var f=o.pingCache;if(f===null){f=o.pingCache=new q$;var g=new Set;f.set(r,g)}else g=f.get(r),g===void 0&&(g=new Set,f.set(r,g));g.has(l)||($g=!0,g.add(l),o=Z$.bind(null,o,r,l),r.then(o,o))}function Z$(o,r,l){var f=o.pingCache;f!==null&&f.delete(r),o.pingedLanes|=o.suspendedLanes&l,o.warmLanes&=~l,se===o&&(Yt&l)===l&&(Se===4||Se===3&&(Yt&62914560)===Yt&&300>zt()-Cf?(Wt&2)===0&&sa(o,0):qg|=l,ia===Yt&&(ia=0)),Ao(o)}function k_(o,r){r===0&&(r=ki()),o=Hr(o,r),o!==null&&(no(o,r),Ao(o))}function K$(o){var r=o.memoizedState,l=0;r!==null&&(l=r.retryLane),k_(o,l)}function Q$(o,r){var l=0;switch(o.tag){case 31:case 13:var f=o.stateNode,g=o.memoizedState;g!==null&&(l=g.retryLane);break;case 19:f=o.stateNode;break;case 22:f=o.stateNode._retryCache;break;default:throw Error(i(314))}f!==null&&f.delete(r),k_(o,l)}function W$(o,r){return mt(o,r)}var kf=null,la=null,Wg=!1,Of=!1,Jg=!1,rr=0;function Ao(o){o!==la&&o.next===null&&(la===null?kf=la=o:la=la.next=o),Of=!0,Wg||(Wg=!0,t7())}function $l(o,r){if(!Jg&&Of){Jg=!0;do for(var l=!1,f=kf;f!==null;){if(o!==0){var g=f.pendingLanes;if(g===0)var v=0;else{var _=f.suspendedLanes,V=f.pingedLanes;v=(1<<31-Ee(42|o)+1)-1,v&=g&~(_&~V),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(l=!0,z_(f,v))}else v=Yt,v=Ri(f,f===se?v:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(v&3)===0||eo(f,v)||(l=!0,z_(f,v));f=f.next}while(l);Jg=!1}}function J$(){O_()}function O_(){Of=Wg=!1;var o=0;rr!==0&&u7()&&(o=rr);for(var r=zt(),l=null,f=kf;f!==null;){var g=f.next,v=D_(f,r);v===0?(f.next=null,l===null?kf=g:l.next=g,g===null&&(la=l)):(l=f,(o!==0||(v&3)!==0)&&(Of=!0)),f=g}Ve!==0&&Ve!==5||$l(o),rr!==0&&(rr=0)}function D_(o,r){for(var l=o.suspendedLanes,f=o.pingedLanes,g=o.expirationTimes,v=o.pendingLanes&-62914561;0<v;){var _=31-Ee(v),V=1<<_,X=g[_];X===-1?((V&l)===0||(V&f)!==0)&&(g[_]=tn(V,r)):X<=r&&(o.expiredLanes|=V),v&=~V}if(r=se,l=Yt,l=Ri(o,o===r?l:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),f=o.callbackNode,l===0||o===r&&(Jt===2||Jt===9)||o.cancelPendingCommit!==null)return f!==null&&f!==null&&Et(f),o.callbackNode=null,o.callbackPriority=0;if((l&3)===0||eo(o,l)){if(r=l&-l,r===o.callbackPriority)return r;switch(f!==null&&Et(f),Uo(l)){case 2:case 8:l=xe;break;case 32:l=Pe;break;case 268435456:l=Ae;break;default:l=Pe}return f=j_.bind(null,o),l=mt(l,f),o.callbackPriority=r,o.callbackNode=l,r}return f!==null&&f!==null&&Et(f),o.callbackPriority=2,o.callbackNode=null,2}function j_(o,r){if(Ve!==0&&Ve!==5)return o.callbackNode=null,o.callbackPriority=0,null;var l=o.callbackNode;if(Rf()&&o.callbackNode!==l)return null;var f=Yt;return f=Ri(o,o===se?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),f===0?null:(m_(o,f,r),D_(o,zt()),o.callbackNode!=null&&o.callbackNode===l?j_.bind(null,o):null)}function z_(o,r){if(Rf())return null;m_(o,r,!0)}function t7(){d7(function(){(Wt&6)!==0?mt(Xt,J$):O_()})}function t0(){if(rr===0){var o=Xs;o===0&&(o=Jn,Jn<<=1,(Jn&261888)===0&&(Jn=256)),rr=o}return rr}function V_(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Bu(""+o)}function L_(o,r){var l=r.ownerDocument.createElement("input");return l.name=r.name,l.value=r.value,o.id&&l.setAttribute("form",o.id),r.parentNode.insertBefore(l,r),o=new FormData(o),l.parentNode.removeChild(l),o}function e7(o,r,l,f,g){if(r==="submit"&&l&&l.stateNode===g){var v=V_((g[Me]||null).action),_=f.submitter;_&&(r=(r=_[Me]||null)?V_(r.formAction):_.getAttribute("formAction"),r!==null&&(v=r,_=null));var V=new $u("action","action",null,f,g);o.push({event:V,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(rr!==0){var X=_?L_(g,_):new FormData(g);xg(l,{pending:!0,data:X,method:g.method,action:v},null,X)}}else typeof v=="function"&&(V.preventDefault(),X=_?L_(g,_):new FormData(g),xg(l,{pending:!0,data:X,method:g.method,action:v},v,X))},currentTarget:g}]})}}for(var e0=0;e0<Lm.length;e0++){var n0=Lm[e0],n7=n0.toLowerCase(),o7=n0[0].toUpperCase()+n0.slice(1);ro(n7,"on"+o7)}ro(p2,"onAnimationEnd"),ro(m2,"onAnimationIteration"),ro(g2,"onAnimationStart"),ro("dblclick","onDoubleClick"),ro("focusin","onFocus"),ro("focusout","onBlur"),ro(b$,"onTransitionRun"),ro(x$,"onTransitionStart"),ro(w$,"onTransitionCancel"),ro(y2,"onTransitionEnd"),On("onMouseEnter",["mouseout","mouseover"]),On("onMouseLeave",["mouseout","mouseover"]),On("onPointerEnter",["pointerout","pointerover"]),On("onPointerLeave",["pointerout","pointerover"]),vn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),vn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),vn("onBeforeInput",["compositionend","keypress","textInput","paste"]),vn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),vn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),vn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ql="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(" "),i7=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ql));function I_(o,r){r=(r&4)!==0;for(var l=0;l<o.length;l++){var f=o[l],g=f.event;f=f.listeners;t:{var v=void 0;if(r)for(var _=f.length-1;0<=_;_--){var V=f[_],X=V.instance,nt=V.currentTarget;if(V=V.listener,X!==v&&g.isPropagationStopped())break t;v=V,g.currentTarget=nt;try{v(g)}catch(st){Gu(st)}g.currentTarget=null,v=X}else for(_=0;_<f.length;_++){if(V=f[_],X=V.instance,nt=V.currentTarget,V=V.listener,X!==v&&g.isPropagationStopped())break t;v=V,g.currentTarget=nt;try{v(g)}catch(st){Gu(st)}g.currentTarget=null,v=X}}}}function $t(o,r){var l=r[Co];l===void 0&&(l=r[Co]=new Set);var f=o+"__bubble";l.has(f)||(B_(r,o,2,!1),l.add(f))}function o0(o,r,l){var f=0;r&&(f|=4),B_(l,o,f,r)}var Df="_reactListening"+Math.random().toString(36).slice(2);function i0(o){if(!o[Df]){o[Df]=!0,Bi.forEach(function(l){l!=="selectionchange"&&(i7.has(l)||o0(l,!1,o),o0(l,!0,o))});var r=o.nodeType===9?o:o.ownerDocument;r===null||r[Df]||(r[Df]=!0,o0("selectionchange",!1,r))}}function B_(o,r,l,f){switch(pN(r)){case 2:var g=O7;break;case 8:g=D7;break;default:g=b0}l=g.bind(null,r,l,o),g=void 0,!Cm||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(g=!0),f?g!==void 0?o.addEventListener(r,l,{capture:!0,passive:g}):o.addEventListener(r,l,!0):g!==void 0?o.addEventListener(r,l,{passive:g}):o.addEventListener(r,l,!1)}function r0(o,r,l,f,g){var v=f;if((r&1)===0&&(r&2)===0&&f!==null)t:for(;;){if(f===null)return;var _=f.tag;if(_===3||_===4){var V=f.stateNode.containerInfo;if(V===g)break;if(_===4)for(_=f.return;_!==null;){var X=_.tag;if((X===3||X===4)&&_.stateNode.containerInfo===g)return;_=_.return}for(;V!==null;){if(_=Mn(V),_===null)return;if(X=_.tag,X===5||X===6||X===26||X===27){f=v=_;continue t}V=V.parentNode}}f=f.return}qC(function(){var nt=v,st=Sm(l),ct=[];t:{var ot=v2.get(o);if(ot!==void 0){var rt=$u,xt=o;switch(o){case"keypress":if(Hu(l)===0)break t;case"keydown":case"keyup":rt=Q9;break;case"focusin":xt="focus",rt=Am;break;case"focusout":xt="blur",rt=Am;break;case"beforeblur":case"afterblur":rt=Am;break;case"click":if(l.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":rt=XC;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":rt=B9;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":rt=t$;break;case p2:case m2:case g2:rt=U9;break;case y2:rt=n$;break;case"scroll":case"scrollend":rt=L9;break;case"wheel":rt=i$;break;case"copy":case"cut":case"paste":rt=q9;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":rt=ZC;break;case"toggle":case"beforetoggle":rt=s$}var Ot=(r&4)!==0,ie=!Ot&&(o==="scroll"||o==="scrollend"),W=Ot?ot!==null?ot+"Capture":null:ot;Ot=[];for(var K=nt,et;K!==null;){var at=K;if(et=at.stateNode,at=at.tag,at!==5&&at!==26&&at!==27||et===null||W===null||(at=dl(K,W),at!=null&&Ot.push(Yl(K,at,et))),ie)break;K=K.return}0<Ot.length&&(ot=new rt(ot,xt,null,l,st),ct.push({event:ot,listeners:Ot}))}}if((r&7)===0){t:{if(ot=o==="mouseover"||o==="pointerover",rt=o==="mouseout"||o==="pointerout",ot&&l!==wm&&(xt=l.relatedTarget||l.fromElement)&&(Mn(xt)||xt[gn]))break t;if((rt||ot)&&(ot=st.window===st?st:(ot=st.ownerDocument)?ot.defaultView||ot.parentWindow:window,rt?(xt=l.relatedTarget||l.toElement,rt=nt,xt=xt?Mn(xt):null,xt!==null&&(ie=a(xt),Ot=xt.tag,xt!==ie||Ot!==5&&Ot!==27&&Ot!==6)&&(xt=null)):(rt=null,xt=nt),rt!==xt)){if(Ot=XC,at="onMouseLeave",W="onMouseEnter",K="mouse",(o==="pointerout"||o==="pointerover")&&(Ot=ZC,at="onPointerLeave",W="onPointerEnter",K="pointer"),ie=rt==null?ot:Rn(rt),et=xt==null?ot:Rn(xt),ot=new Ot(at,K+"leave",rt,l,st),ot.target=ie,ot.relatedTarget=et,at=null,Mn(st)===nt&&(Ot=new Ot(W,K+"enter",xt,l,st),Ot.target=et,Ot.relatedTarget=ie,at=Ot),ie=at,rt&&xt)e:{for(Ot=r7,W=rt,K=xt,et=0,at=W;at;at=Ot(at))et++;at=0;for(var Rt=K;Rt;Rt=Ot(Rt))at++;for(;0<et-at;)W=Ot(W),et--;for(;0<at-et;)K=Ot(K),at--;for(;et--;){if(W===K||K!==null&&W===K.alternate){Ot=W;break e}W=Ot(W),K=Ot(K)}Ot=null}else Ot=null;rt!==null&&P_(ct,ot,rt,Ot,!1),xt!==null&&ie!==null&&P_(ct,ie,xt,Ot,!0)}}t:{if(ot=nt?Rn(nt):window,rt=ot.nodeName&&ot.nodeName.toLowerCase(),rt==="select"||rt==="input"&&ot.type==="file")var Kt=o2;else if(e2(ot))if(i2)Kt=g$;else{Kt=p$;var _t=h$}else rt=ot.nodeName,!rt||rt.toLowerCase()!=="input"||ot.type!=="checkbox"&&ot.type!=="radio"?nt&&xm(nt.elementType)&&(Kt=o2):Kt=m$;if(Kt&&(Kt=Kt(o,nt))){n2(ct,Kt,l,st);break t}_t&&_t(o,ot,nt),o==="focusout"&&nt&&ot.type==="number"&&nt.memoizedProps.value!=null&&fl(ot,"number",ot.value)}switch(_t=nt?Rn(nt):window,o){case"focusin":(e2(_t)||_t.contentEditable==="true")&&(Bs=_t,jm=nt,xl=null);break;case"focusout":xl=jm=Bs=null;break;case"mousedown":zm=!0;break;case"contextmenu":case"mouseup":case"dragend":zm=!1,d2(ct,l,st);break;case"selectionchange":if(v$)break;case"keydown":case"keyup":d2(ct,l,st)}var Bt;if(Rm)t:{switch(o){case"compositionstart":var Gt="onCompositionStart";break t;case"compositionend":Gt="onCompositionEnd";break t;case"compositionupdate":Gt="onCompositionUpdate";break t}Gt=void 0}else Is?JC(o,l)&&(Gt="onCompositionEnd"):o==="keydown"&&l.keyCode===229&&(Gt="onCompositionStart");Gt&&(KC&&l.locale!=="ko"&&(Is||Gt!=="onCompositionStart"?Gt==="onCompositionEnd"&&Is&&(Bt=YC()):($i=st,Tm="value"in $i?$i.value:$i.textContent,Is=!0)),_t=jf(nt,Gt),0<_t.length&&(Gt=new FC(Gt,o,null,l,st),ct.push({event:Gt,listeners:_t}),Bt?Gt.data=Bt:(Bt=t2(l),Bt!==null&&(Gt.data=Bt)))),(Bt=l$?c$(o,l):u$(o,l))&&(Gt=jf(nt,"onBeforeInput"),0<Gt.length&&(_t=new FC("onBeforeInput","beforeinput",null,l,st),ct.push({event:_t,listeners:Gt}),_t.data=Bt)),e7(ct,o,nt,l,st)}I_(ct,r)})}function Yl(o,r,l){return{instance:o,listener:r,currentTarget:l}}function jf(o,r){for(var l=r+"Capture",f=[];o!==null;){var g=o,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=dl(o,l),g!=null&&f.unshift(Yl(o,g,v)),g=dl(o,r),g!=null&&f.push(Yl(o,g,v))),o.tag===3)return f;o=o.return}return[]}function r7(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function P_(o,r,l,f,g){for(var v=r._reactName,_=[];l!==null&&l!==f;){var V=l,X=V.alternate,nt=V.stateNode;if(V=V.tag,X!==null&&X===f)break;V!==5&&V!==26&&V!==27||nt===null||(X=nt,g?(nt=dl(l,v),nt!=null&&_.unshift(Yl(l,nt,X))):g||(nt=dl(l,v),nt!=null&&_.push(Yl(l,nt,X)))),l=l.return}_.length!==0&&o.push({event:r,listeners:_})}var s7=/\r\n?/g,a7=/\u0000|\uFFFD/g;function H_(o){return(typeof o=="string"?o:""+o).replace(s7,`
|
|
9
|
-
`).replace(a7,"")}function U_(o,r){return r=H_(r),H_(o)===r}function oe(o,r,l,f,g,v){switch(l){case"children":typeof f=="string"?r==="body"||r==="textarea"&&f===""||zs(o,f):(typeof f=="number"||typeof f=="bigint")&&r!=="body"&&zs(o,""+f);break;case"className":Go(o,"class",f);break;case"tabIndex":Go(o,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Go(o,l,f);break;case"style":UC(o,f,v);break;case"data":if(r!=="object"){Go(o,"data",f);break}case"src":case"href":if(f===""&&(r!=="a"||l!=="href")){o.removeAttribute(l);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){o.removeAttribute(l);break}f=Bu(""+f),o.setAttribute(l,f);break;case"action":case"formAction":if(typeof f=="function"){o.setAttribute(l,"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 v=="function"&&(l==="formAction"?(r!=="input"&&oe(o,r,"name",g.name,g,null),oe(o,r,"formEncType",g.formEncType,g,null),oe(o,r,"formMethod",g.formMethod,g,null),oe(o,r,"formTarget",g.formTarget,g,null)):(oe(o,r,"encType",g.encType,g,null),oe(o,r,"method",g.method,g,null),oe(o,r,"target",g.target,g,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){o.removeAttribute(l);break}f=Bu(""+f),o.setAttribute(l,f);break;case"onClick":f!=null&&(o.onclick=Fo);break;case"onScroll":f!=null&&$t("scroll",o);break;case"onScrollEnd":f!=null&&$t("scrollend",o);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(l=f.__html,l!=null){if(g.children!=null)throw Error(i(60));o.innerHTML=l}}break;case"multiple":o.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":o.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){o.removeAttribute("xlink:href");break}l=Bu(""+f),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?o.setAttribute(l,""+f):o.removeAttribute(l);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":f&&typeof f!="function"&&typeof f!="symbol"?o.setAttribute(l,""):o.removeAttribute(l);break;case"capture":case"download":f===!0?o.setAttribute(l,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?o.setAttribute(l,f):o.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?o.setAttribute(l,f):o.removeAttribute(l);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?o.removeAttribute(l):o.setAttribute(l,f);break;case"popover":$t("beforetoggle",o),$t("toggle",o),He(o,"popover",f);break;case"xlinkActuate":io(o,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":io(o,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":io(o,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":io(o,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":io(o,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":io(o,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":io(o,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":io(o,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":io(o,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":He(o,"is",f);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=z9.get(l)||l,He(o,l,f))}}function s0(o,r,l,f,g,v){switch(l){case"style":UC(o,f,v);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(l=f.__html,l!=null){if(g.children!=null)throw Error(i(60));o.innerHTML=l}}break;case"children":typeof f=="string"?zs(o,f):(typeof f=="number"||typeof f=="bigint")&&zs(o,""+f);break;case"onScroll":f!=null&&$t("scroll",o);break;case"onScrollEnd":f!=null&&$t("scrollend",o);break;case"onClick":f!=null&&(o.onclick=Fo);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pi.hasOwnProperty(l))t:{if(l[0]==="o"&&l[1]==="n"&&(g=l.endsWith("Capture"),r=l.slice(2,g?l.length-7:void 0),v=o[Me]||null,v=v!=null?v[l]:null,typeof v=="function"&&o.removeEventListener(r,v,g),typeof f=="function")){typeof v!="function"&&v!==null&&(l in o?o[l]=null:o.hasAttribute(l)&&o.removeAttribute(l)),o.addEventListener(r,f,g);break t}l in o?o[l]=f:f===!0?o.setAttribute(l,""):He(o,l,f)}}}function Ye(o,r,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":$t("error",o),$t("load",o);var f=!1,g=!1,v;for(v in l)if(l.hasOwnProperty(v)){var _=l[v];if(_!=null)switch(v){case"src":f=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:oe(o,r,v,_,l,null)}}g&&oe(o,r,"srcSet",l.srcSet,l,null),f&&oe(o,r,"src",l.src,l,null);return;case"input":$t("invalid",o);var V=v=_=g=null,X=null,nt=null;for(f in l)if(l.hasOwnProperty(f)){var st=l[f];if(st!=null)switch(f){case"name":g=st;break;case"type":_=st;break;case"checked":X=st;break;case"defaultChecked":nt=st;break;case"value":v=st;break;case"defaultValue":V=st;break;case"children":case"dangerouslySetInnerHTML":if(st!=null)throw Error(i(137,r));break;default:oe(o,r,f,st,l,null)}}Iu(o,v,V,X,nt,_,g,!1);return;case"select":$t("invalid",o),f=_=v=null;for(g in l)if(l.hasOwnProperty(g)&&(V=l[g],V!=null))switch(g){case"value":v=V;break;case"defaultValue":_=V;break;case"multiple":f=V;default:oe(o,r,g,V,l,null)}r=v,l=_,o.multiple=!!f,r!=null?Xo(o,!!f,r,!1):l!=null&&Xo(o,!!f,l,!0);return;case"textarea":$t("invalid",o),v=g=f=null;for(_ in l)if(l.hasOwnProperty(_)&&(V=l[_],V!=null))switch(_){case"value":f=V;break;case"defaultValue":g=V;break;case"children":v=V;break;case"dangerouslySetInnerHTML":if(V!=null)throw Error(i(91));break;default:oe(o,r,_,V,l,null)}PC(o,f,g,v);return;case"option":for(X in l)l.hasOwnProperty(X)&&(f=l[X],f!=null)&&(X==="selected"?o.selected=f&&typeof f!="function"&&typeof f!="symbol":oe(o,r,X,f,l,null));return;case"dialog":$t("beforetoggle",o),$t("toggle",o),$t("cancel",o),$t("close",o);break;case"iframe":case"object":$t("load",o);break;case"video":case"audio":for(f=0;f<ql.length;f++)$t(ql[f],o);break;case"image":$t("error",o),$t("load",o);break;case"details":$t("toggle",o);break;case"embed":case"source":case"link":$t("error",o),$t("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(nt in l)if(l.hasOwnProperty(nt)&&(f=l[nt],f!=null))switch(nt){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:oe(o,r,nt,f,l,null)}return;default:if(xm(r)){for(st in l)l.hasOwnProperty(st)&&(f=l[st],f!==void 0&&s0(o,r,st,f,l,void 0));return}}for(V in l)l.hasOwnProperty(V)&&(f=l[V],f!=null&&oe(o,r,V,f,l,null))}function l7(o,r,l,f){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,v=null,_=null,V=null,X=null,nt=null,st=null;for(rt in l){var ct=l[rt];if(l.hasOwnProperty(rt)&&ct!=null)switch(rt){case"checked":break;case"value":break;case"defaultValue":X=ct;default:f.hasOwnProperty(rt)||oe(o,r,rt,null,f,ct)}}for(var ot in f){var rt=f[ot];if(ct=l[ot],f.hasOwnProperty(ot)&&(rt!=null||ct!=null))switch(ot){case"type":v=rt;break;case"name":g=rt;break;case"checked":nt=rt;break;case"defaultChecked":st=rt;break;case"value":_=rt;break;case"defaultValue":V=rt;break;case"children":case"dangerouslySetInnerHTML":if(rt!=null)throw Error(i(137,r));break;default:rt!==ct&&oe(o,r,ot,rt,f,ct)}}Lr(o,_,V,X,nt,st,v,g);return;case"select":rt=_=V=ot=null;for(v in l)if(X=l[v],l.hasOwnProperty(v)&&X!=null)switch(v){case"value":break;case"multiple":rt=X;default:f.hasOwnProperty(v)||oe(o,r,v,null,f,X)}for(g in f)if(v=f[g],X=l[g],f.hasOwnProperty(g)&&(v!=null||X!=null))switch(g){case"value":ot=v;break;case"defaultValue":V=v;break;case"multiple":_=v;default:v!==X&&oe(o,r,g,v,f,X)}r=V,l=_,f=rt,ot!=null?Xo(o,!!l,ot,!1):!!f!=!!l&&(r!=null?Xo(o,!!l,r,!0):Xo(o,!!l,l?[]:"",!1));return;case"textarea":rt=ot=null;for(V in l)if(g=l[V],l.hasOwnProperty(V)&&g!=null&&!f.hasOwnProperty(V))switch(V){case"value":break;case"children":break;default:oe(o,r,V,null,f,g)}for(_ in f)if(g=f[_],v=l[_],f.hasOwnProperty(_)&&(g!=null||v!=null))switch(_){case"value":ot=g;break;case"defaultValue":rt=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(i(91));break;default:g!==v&&oe(o,r,_,g,f,v)}BC(o,ot,rt);return;case"option":for(var xt in l)ot=l[xt],l.hasOwnProperty(xt)&&ot!=null&&!f.hasOwnProperty(xt)&&(xt==="selected"?o.selected=!1:oe(o,r,xt,null,f,ot));for(X in f)ot=f[X],rt=l[X],f.hasOwnProperty(X)&&ot!==rt&&(ot!=null||rt!=null)&&(X==="selected"?o.selected=ot&&typeof ot!="function"&&typeof ot!="symbol":oe(o,r,X,ot,f,rt));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 Ot in l)ot=l[Ot],l.hasOwnProperty(Ot)&&ot!=null&&!f.hasOwnProperty(Ot)&&oe(o,r,Ot,null,f,ot);for(nt in f)if(ot=f[nt],rt=l[nt],f.hasOwnProperty(nt)&&ot!==rt&&(ot!=null||rt!=null))switch(nt){case"children":case"dangerouslySetInnerHTML":if(ot!=null)throw Error(i(137,r));break;default:oe(o,r,nt,ot,f,rt)}return;default:if(xm(r)){for(var ie in l)ot=l[ie],l.hasOwnProperty(ie)&&ot!==void 0&&!f.hasOwnProperty(ie)&&s0(o,r,ie,void 0,f,ot);for(st in f)ot=f[st],rt=l[st],!f.hasOwnProperty(st)||ot===rt||ot===void 0&&rt===void 0||s0(o,r,st,ot,f,rt);return}}for(var W in l)ot=l[W],l.hasOwnProperty(W)&&ot!=null&&!f.hasOwnProperty(W)&&oe(o,r,W,null,f,ot);for(ct in f)ot=f[ct],rt=l[ct],!f.hasOwnProperty(ct)||ot===rt||ot==null&&rt==null||oe(o,r,ct,ot,f,rt)}function $_(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function c7(){if(typeof performance.getEntriesByType=="function"){for(var o=0,r=0,l=performance.getEntriesByType("resource"),f=0;f<l.length;f++){var g=l[f],v=g.transferSize,_=g.initiatorType,V=g.duration;if(v&&V&&$_(_)){for(_=0,V=g.responseEnd,f+=1;f<l.length;f++){var X=l[f],nt=X.startTime;if(nt>V)break;var st=X.transferSize,ct=X.initiatorType;st&&$_(ct)&&(X=X.responseEnd,_+=st*(X<V?1:(V-nt)/(X-nt)))}if(--f,r+=8*(v+_)/(g.duration/1e3),o++,10<o)break}}if(0<o)return r/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var a0=null,l0=null;function zf(o){return o.nodeType===9?o:o.ownerDocument}function q_(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Y_(o,r){if(o===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&r==="foreignObject"?0:o}function c0(o,r){return o==="textarea"||o==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var u0=null;function u7(){var o=window.event;return o&&o.type==="popstate"?o===u0?!1:(u0=o,!0):(u0=null,!1)}var G_=typeof setTimeout=="function"?setTimeout:void 0,f7=typeof clearTimeout=="function"?clearTimeout:void 0,X_=typeof Promise=="function"?Promise:void 0,d7=typeof queueMicrotask=="function"?queueMicrotask:typeof X_<"u"?function(o){return X_.resolve(null).then(o).catch(h7)}:G_;function h7(o){setTimeout(function(){throw o})}function sr(o){return o==="head"}function F_(o,r){var l=r,f=0;do{var g=l.nextSibling;if(o.removeChild(l),g&&g.nodeType===8)if(l=g.data,l==="/$"||l==="/&"){if(f===0){o.removeChild(g),da(r);return}f--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")f++;else if(l==="html")Gl(o.ownerDocument.documentElement);else if(l==="head"){l=o.ownerDocument.head,Gl(l);for(var v=l.firstChild;v;){var _=v.nextSibling,V=v.nodeName;v[oo]||V==="SCRIPT"||V==="STYLE"||V==="LINK"&&v.rel.toLowerCase()==="stylesheet"||l.removeChild(v),v=_}}else l==="body"&&Gl(o.ownerDocument.body);l=g}while(l);da(r)}function Z_(o,r){var l=o;o=0;do{var f=l.nextSibling;if(l.nodeType===1?r?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(r?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),f&&f.nodeType===8)if(l=f.data,l==="/$"){if(o===0)break;o--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||o++;l=f}while(l)}function f0(o){var r=o.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var l=r;switch(r=r.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":f0(l),qo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}o.removeChild(l)}}function p7(o,r,l,f){for(;o.nodeType===1;){var g=l;if(o.nodeName.toLowerCase()!==r.toLowerCase()){if(!f&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(f){if(!o[oo])switch(r){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(v=o.getAttribute("rel"),v==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(v!==g.rel||o.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||o.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||o.getAttribute("title")!==(g.title==null?null:g.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(v=o.getAttribute("src"),(v!==(g.src==null?null:g.src)||o.getAttribute("type")!==(g.type==null?null:g.type)||o.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(r==="input"&&o.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&o.getAttribute("name")===v)return o}else return o;if(o=Bn(o.nextSibling),o===null)break}return null}function m7(o,r,l){if(r==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!l||(o=Bn(o.nextSibling),o===null))return null;return o}function K_(o,r){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!r||(o=Bn(o.nextSibling),o===null))return null;return o}function d0(o){return o.data==="$?"||o.data==="$~"}function h0(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function g7(o,r){var l=o.ownerDocument;if(o.data==="$~")o._reactRetry=r;else if(o.data!=="$?"||l.readyState!=="loading")r();else{var f=function(){r(),l.removeEventListener("DOMContentLoaded",f)};l.addEventListener("DOMContentLoaded",f),o._reactRetry=f}}function Bn(o){for(;o!=null;o=o.nextSibling){var r=o.nodeType;if(r===1||r===3)break;if(r===8){if(r=o.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return o}var p0=null;function Q_(o){o=o.nextSibling;for(var r=0;o;){if(o.nodeType===8){var l=o.data;if(l==="/$"||l==="/&"){if(r===0)return Bn(o.nextSibling);r--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||r++}o=o.nextSibling}return null}function W_(o){o=o.previousSibling;for(var r=0;o;){if(o.nodeType===8){var l=o.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(r===0)return o;r--}else l!=="/$"&&l!=="/&"||r++}o=o.previousSibling}return null}function J_(o,r,l){switch(r=zf(l),o){case"html":if(o=r.documentElement,!o)throw Error(i(452));return o;case"head":if(o=r.head,!o)throw Error(i(453));return o;case"body":if(o=r.body,!o)throw Error(i(454));return o;default:throw Error(i(451))}}function Gl(o){for(var r=o.attributes;r.length;)o.removeAttributeNode(r[0]);qo(o)}var Pn=new Map,tN=new Set;function Vf(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var ui=I.d;I.d={f:y7,r:v7,D:b7,C:x7,L:w7,m:S7,X:C7,S:E7,M:T7};function y7(){var o=ui.f(),r=Nf();return o||r}function v7(o){var r=yn(o);r!==null&&r.tag===5&&r.type==="form"?yT(r):ui.r(o)}var ca=typeof document>"u"?null:document;function eN(o,r,l){var f=ca;if(f&&typeof r=="string"&&r){var g=on(r);g='link[rel="'+o+'"][href="'+g+'"]',typeof l=="string"&&(g+='[crossorigin="'+l+'"]'),tN.has(g)||(tN.add(g),o={rel:o,crossOrigin:l,href:r},f.querySelector(g)===null&&(r=f.createElement("link"),Ye(r,"link",o),me(r),f.head.appendChild(r)))}}function b7(o){ui.D(o),eN("dns-prefetch",o,null)}function x7(o,r){ui.C(o,r),eN("preconnect",o,r)}function w7(o,r,l){ui.L(o,r,l);var f=ca;if(f&&o&&r){var g='link[rel="preload"][as="'+on(r)+'"]';r==="image"&&l&&l.imageSrcSet?(g+='[imagesrcset="'+on(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(g+='[imagesizes="'+on(l.imageSizes)+'"]')):g+='[href="'+on(o)+'"]';var v=g;switch(r){case"style":v=ua(o);break;case"script":v=fa(o)}Pn.has(v)||(o=m({rel:"preload",href:r==="image"&&l&&l.imageSrcSet?void 0:o,as:r},l),Pn.set(v,o),f.querySelector(g)!==null||r==="style"&&f.querySelector(Xl(v))||r==="script"&&f.querySelector(Fl(v))||(r=f.createElement("link"),Ye(r,"link",o),me(r),f.head.appendChild(r)))}}function S7(o,r){ui.m(o,r);var l=ca;if(l&&o){var f=r&&typeof r.as=="string"?r.as:"script",g='link[rel="modulepreload"][as="'+on(f)+'"][href="'+on(o)+'"]',v=g;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=fa(o)}if(!Pn.has(v)&&(o=m({rel:"modulepreload",href:o},r),Pn.set(v,o),l.querySelector(g)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Fl(v)))return}f=l.createElement("link"),Ye(f,"link",o),me(f),l.head.appendChild(f)}}}function E7(o,r,l){ui.S(o,r,l);var f=ca;if(f&&o){var g=kn(f).hoistableStyles,v=ua(o);r=r||"default";var _=g.get(v);if(!_){var V={loading:0,preload:null};if(_=f.querySelector(Xl(v)))V.loading=5;else{o=m({rel:"stylesheet",href:o,"data-precedence":r},l),(l=Pn.get(v))&&m0(o,l);var X=_=f.createElement("link");me(X),Ye(X,"link",o),X._p=new Promise(function(nt,st){X.onload=nt,X.onerror=st}),X.addEventListener("load",function(){V.loading|=1}),X.addEventListener("error",function(){V.loading|=2}),V.loading|=4,Lf(_,r,f)}_={type:"stylesheet",instance:_,count:1,state:V},g.set(v,_)}}}function C7(o,r){ui.X(o,r);var l=ca;if(l&&o){var f=kn(l).hoistableScripts,g=fa(o),v=f.get(g);v||(v=l.querySelector(Fl(g)),v||(o=m({src:o,async:!0},r),(r=Pn.get(g))&&g0(o,r),v=l.createElement("script"),me(v),Ye(v,"link",o),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(g,v))}}function T7(o,r){ui.M(o,r);var l=ca;if(l&&o){var f=kn(l).hoistableScripts,g=fa(o),v=f.get(g);v||(v=l.querySelector(Fl(g)),v||(o=m({src:o,async:!0,type:"module"},r),(r=Pn.get(g))&&g0(o,r),v=l.createElement("script"),me(v),Ye(v,"link",o),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(g,v))}}function nN(o,r,l,f){var g=(g=ht.current)?Vf(g):null;if(!g)throw Error(i(446));switch(o){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(r=ua(l.href),l=kn(g).hoistableStyles,f=l.get(r),f||(f={type:"style",instance:null,count:0,state:null},l.set(r,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){o=ua(l.href);var v=kn(g).hoistableStyles,_=v.get(o);if(_||(g=g.ownerDocument||g,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(o,_),(v=g.querySelector(Xl(o)))&&!v._p&&(_.instance=v,_.state.loading=5),Pn.has(o)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Pn.set(o,l),v||_7(g,o,l,_.state))),r&&f===null)throw Error(i(528,""));return _}if(r&&f!==null)throw Error(i(529,""));return null;case"script":return r=l.async,l=l.src,typeof l=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=fa(l),l=kn(g).hoistableScripts,f=l.get(r),f||(f={type:"script",instance:null,count:0,state:null},l.set(r,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,o))}}function ua(o){return'href="'+on(o)+'"'}function Xl(o){return'link[rel="stylesheet"]['+o+"]"}function oN(o){return m({},o,{"data-precedence":o.precedence,precedence:null})}function _7(o,r,l,f){o.querySelector('link[rel="preload"][as="style"]['+r+"]")?f.loading=1:(r=o.createElement("link"),f.preload=r,r.addEventListener("load",function(){return f.loading|=1}),r.addEventListener("error",function(){return f.loading|=2}),Ye(r,"link",l),me(r),o.head.appendChild(r))}function fa(o){return'[src="'+on(o)+'"]'}function Fl(o){return"script[async]"+o}function iN(o,r,l){if(r.count++,r.instance===null)switch(r.type){case"style":var f=o.querySelector('style[data-href~="'+on(l.href)+'"]');if(f)return r.instance=f,me(f),f;var g=m({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return f=(o.ownerDocument||o).createElement("style"),me(f),Ye(f,"style",g),Lf(f,l.precedence,o),r.instance=f;case"stylesheet":g=ua(l.href);var v=o.querySelector(Xl(g));if(v)return r.state.loading|=4,r.instance=v,me(v),v;f=oN(l),(g=Pn.get(g))&&m0(f,g),v=(o.ownerDocument||o).createElement("link"),me(v);var _=v;return _._p=new Promise(function(V,X){_.onload=V,_.onerror=X}),Ye(v,"link",f),r.state.loading|=4,Lf(v,l.precedence,o),r.instance=v;case"script":return v=fa(l.src),(g=o.querySelector(Fl(v)))?(r.instance=g,me(g),g):(f=l,(g=Pn.get(v))&&(f=m({},l),g0(f,g)),o=o.ownerDocument||o,g=o.createElement("script"),me(g),Ye(g,"link",f),o.head.appendChild(g),r.instance=g);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(f=r.instance,r.state.loading|=4,Lf(f,l.precedence,o));return r.instance}function Lf(o,r,l){for(var f=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=f.length?f[f.length-1]:null,v=g,_=0;_<f.length;_++){var V=f[_];if(V.dataset.precedence===r)v=V;else if(v!==g)break}v?v.parentNode.insertBefore(o,v.nextSibling):(r=l.nodeType===9?l.head:l,r.insertBefore(o,r.firstChild))}function m0(o,r){o.crossOrigin==null&&(o.crossOrigin=r.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=r.referrerPolicy),o.title==null&&(o.title=r.title)}function g0(o,r){o.crossOrigin==null&&(o.crossOrigin=r.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=r.referrerPolicy),o.integrity==null&&(o.integrity=r.integrity)}var If=null;function rN(o,r,l){if(If===null){var f=new Map,g=If=new Map;g.set(l,f)}else g=If,f=g.get(l),f||(f=new Map,g.set(l,f));if(f.has(o))return f;for(f.set(o,null),l=l.getElementsByTagName(o),g=0;g<l.length;g++){var v=l[g];if(!(v[oo]||v[ve]||o==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var _=v.getAttribute(r)||"";_=o+_;var V=f.get(_);V?V.push(v):f.set(_,[v])}}return f}function sN(o,r,l){o=o.ownerDocument||o,o.head.insertBefore(l,r==="title"?o.querySelector("head > title"):null)}function N7(o,r,l){if(l===1||r.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;return r.rel==="stylesheet"?(o=r.disabled,typeof r.precedence=="string"&&o==null):!0;case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function aN(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function A7(o,r,l,f){if(l.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var g=ua(f.href),v=r.querySelector(Xl(g));if(v){r=v._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(o.count++,o=Bf.bind(o),r.then(o,o)),l.state.loading|=4,l.instance=v,me(v);return}v=r.ownerDocument||r,f=oN(f),(g=Pn.get(g))&&m0(f,g),v=v.createElement("link"),me(v);var _=v;_._p=new Promise(function(V,X){_.onload=V,_.onerror=X}),Ye(v,"link",f),l.instance=v}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(l,r),(r=l.state.preload)&&(l.state.loading&3)===0&&(o.count++,l=Bf.bind(o),r.addEventListener("load",l),r.addEventListener("error",l))}}var y0=0;function M7(o,r){return o.stylesheets&&o.count===0&&Hf(o,o.stylesheets),0<o.count||0<o.imgCount?function(l){var f=setTimeout(function(){if(o.stylesheets&&Hf(o,o.stylesheets),o.unsuspend){var v=o.unsuspend;o.unsuspend=null,v()}},6e4+r);0<o.imgBytes&&y0===0&&(y0=62500*c7());var g=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Hf(o,o.stylesheets),o.unsuspend)){var v=o.unsuspend;o.unsuspend=null,v()}},(o.imgBytes>y0?50:800)+r);return o.unsuspend=l,function(){o.unsuspend=null,clearTimeout(f),clearTimeout(g)}}:null}function Bf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hf(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Pf=null;function Hf(o,r){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Pf=new Map,r.forEach(R7,o),Pf=null,Bf.call(o))}function R7(o,r){if(!(r.state.loading&4)){var l=Pf.get(o);if(l)var f=l.get(null);else{l=new Map,Pf.set(o,l);for(var g=o.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var _=g[v];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(l.set(_.dataset.precedence,_),f=_)}f&&l.set(null,f)}g=r.instance,_=g.getAttribute("data-precedence"),v=l.get(_)||f,v===f&&l.set(null,g),l.set(_,g),this.count++,f=Bf.bind(this),g.addEventListener("load",f),g.addEventListener("error",f),v?v.parentNode.insertBefore(g,v.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(g,o.firstChild)),r.state.loading|=4}}var Zl={$$typeof:T,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function k7(o,r,l,f,g,v,_,V,X){this.tag=1,this.containerInfo=o,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=Ke(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ke(0),this.hiddenUpdates=Ke(null),this.identifierPrefix=f,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=X,this.incompleteTransitions=new Map}function lN(o,r,l,f,g,v,_,V,X,nt,st,ct){return o=new k7(o,r,l,_,X,nt,st,ct,V),r=1,v===!0&&(r|=24),v=xn(3,null,null,r),o.current=v,v.stateNode=o,r=Km(),r.refCount++,o.pooledCache=r,r.refCount++,v.memoizedState={element:f,isDehydrated:l,cache:r},tg(v),o}function cN(o){return o?(o=Us,o):Us}function uN(o,r,l,f,g,v){g=cN(g),f.context===null?f.context=g:f.pendingContext=g,f=Zi(r),f.payload={element:l},v=v===void 0?null:v,v!==null&&(f.callback=v),l=Ki(o,f,r),l!==null&&(un(l,o,r),Nl(l,o,r))}function fN(o,r){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var l=o.retryLane;o.retryLane=l!==0&&l<r?l:r}}function v0(o,r){fN(o,r),(o=o.alternate)&&fN(o,r)}function dN(o){if(o.tag===13||o.tag===31){var r=Hr(o,67108864);r!==null&&un(r,o,67108864),v0(o,67108864)}}function hN(o){if(o.tag===13||o.tag===31){var r=Tn();r=Ho(r);var l=Hr(o,r);l!==null&&un(l,o,r),v0(o,r)}}var Uf=!0;function O7(o,r,l,f){var g=j.T;j.T=null;var v=I.p;try{I.p=2,b0(o,r,l,f)}finally{I.p=v,j.T=g}}function D7(o,r,l,f){var g=j.T;j.T=null;var v=I.p;try{I.p=8,b0(o,r,l,f)}finally{I.p=v,j.T=g}}function b0(o,r,l,f){if(Uf){var g=x0(f);if(g===null)r0(o,r,f,$f,l),mN(o,f);else if(z7(g,o,r,l,f))f.stopPropagation();else if(mN(o,f),r&4&&-1<j7.indexOf(o)){for(;g!==null;){var v=yn(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var _=mn(v.pendingLanes);if(_!==0){var V=v;for(V.pendingLanes|=2,V.entangledLanes|=2;_;){var X=1<<31-Ee(_);V.entanglements[1]|=X,_&=~X}Ao(v),(Wt&6)===0&&(Tf=zt()+500,$l(0))}}break;case 31:case 13:V=Hr(v,2),V!==null&&un(V,v,2),Nf(),v0(v,2)}if(v=x0(f),v===null&&r0(o,r,f,$f,l),v===g)break;g=v}g!==null&&f.stopPropagation()}else r0(o,r,f,null,l)}}function x0(o){return o=Sm(o),w0(o)}var $f=null;function w0(o){if($f=null,o=Mn(o),o!==null){var r=a(o);if(r===null)o=null;else{var l=r.tag;if(l===13){if(o=c(r),o!==null)return o;o=null}else if(l===31){if(o=u(r),o!==null)return o;o=null}else if(l===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;o=null}else r!==o&&(o=null)}}return $f=o,null}function pN(o){switch(o){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(ue()){case Xt:return 2;case xe:return 8;case Pe:case Po:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var S0=!1,ar=null,lr=null,cr=null,Kl=new Map,Ql=new Map,ur=[],j7="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 mN(o,r){switch(o){case"focusin":case"focusout":ar=null;break;case"dragenter":case"dragleave":lr=null;break;case"mouseover":case"mouseout":cr=null;break;case"pointerover":case"pointerout":Kl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ql.delete(r.pointerId)}}function Wl(o,r,l,f,g,v){return o===null||o.nativeEvent!==v?(o={blockedOn:r,domEventName:l,eventSystemFlags:f,nativeEvent:v,targetContainers:[g]},r!==null&&(r=yn(r),r!==null&&dN(r)),o):(o.eventSystemFlags|=f,r=o.targetContainers,g!==null&&r.indexOf(g)===-1&&r.push(g),o)}function z7(o,r,l,f,g){switch(r){case"focusin":return ar=Wl(ar,o,r,l,f,g),!0;case"dragenter":return lr=Wl(lr,o,r,l,f,g),!0;case"mouseover":return cr=Wl(cr,o,r,l,f,g),!0;case"pointerover":var v=g.pointerId;return Kl.set(v,Wl(Kl.get(v)||null,o,r,l,f,g)),!0;case"gotpointercapture":return v=g.pointerId,Ql.set(v,Wl(Ql.get(v)||null,o,r,l,f,g)),!0}return!1}function gN(o){var r=Mn(o.target);if(r!==null){var l=a(r);if(l!==null){if(r=l.tag,r===13){if(r=c(l),r!==null){o.blockedOn=r,Vi(o.priority,function(){hN(l)});return}}else if(r===31){if(r=u(l),r!==null){o.blockedOn=r,Vi(o.priority,function(){hN(l)});return}}else if(r===3&&l.stateNode.current.memoizedState.isDehydrated){o.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}o.blockedOn=null}function qf(o){if(o.blockedOn!==null)return!1;for(var r=o.targetContainers;0<r.length;){var l=x0(o.nativeEvent);if(l===null){l=o.nativeEvent;var f=new l.constructor(l.type,l);wm=f,l.target.dispatchEvent(f),wm=null}else return r=yn(l),r!==null&&dN(r),o.blockedOn=l,!1;r.shift()}return!0}function yN(o,r,l){qf(o)&&l.delete(r)}function V7(){S0=!1,ar!==null&&qf(ar)&&(ar=null),lr!==null&&qf(lr)&&(lr=null),cr!==null&&qf(cr)&&(cr=null),Kl.forEach(yN),Ql.forEach(yN)}function Yf(o,r){o.blockedOn===r&&(o.blockedOn=null,S0||(S0=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,V7)))}var Gf=null;function vN(o){Gf!==o&&(Gf=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Gf===o&&(Gf=null);for(var r=0;r<o.length;r+=3){var l=o[r],f=o[r+1],g=o[r+2];if(typeof f!="function"){if(w0(f||l)===null)continue;break}var v=yn(l);v!==null&&(o.splice(r,3),r-=3,xg(v,{pending:!0,data:g,method:l.method,action:f},f,g))}}))}function da(o){function r(X){return Yf(X,o)}ar!==null&&Yf(ar,o),lr!==null&&Yf(lr,o),cr!==null&&Yf(cr,o),Kl.forEach(r),Ql.forEach(r);for(var l=0;l<ur.length;l++){var f=ur[l];f.blockedOn===o&&(f.blockedOn=null)}for(;0<ur.length&&(l=ur[0],l.blockedOn===null);)gN(l),l.blockedOn===null&&ur.shift();if(l=(o.ownerDocument||o).$$reactFormReplay,l!=null)for(f=0;f<l.length;f+=3){var g=l[f],v=l[f+1],_=g[Me]||null;if(typeof v=="function")_||vN(l);else if(_){var V=null;if(v&&v.hasAttribute("formAction")){if(g=v,_=v[Me]||null)V=_.formAction;else if(w0(g)!==null)continue}else V=_.action;typeof V=="function"?l[f+1]=V:(l.splice(f,3),f-=3),vN(l)}}}function bN(){function o(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(_){return g=_})},focusReset:"manual",scroll:"manual"})}function r(){g!==null&&(g(),g=null),f||setTimeout(l,20)}function l(){if(!f&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,g=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(l,100),function(){f=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),g!==null&&(g(),g=null)}}}function E0(o){this._internalRoot=o}Xf.prototype.render=E0.prototype.render=function(o){var r=this._internalRoot;if(r===null)throw Error(i(409));var l=r.current,f=Tn();uN(l,f,o,r,null,null)},Xf.prototype.unmount=E0.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var r=o.containerInfo;uN(o.current,2,null,o,null,null),Nf(),r[gn]=null}};function Xf(o){this._internalRoot=o}Xf.prototype.unstable_scheduleHydration=function(o){if(o){var r=$o();o={blockedOn:null,target:o,priority:r};for(var l=0;l<ur.length&&r!==0&&r<ur[l].priority;l++);ur.splice(l,0,o),l===0&&gN(o)}};var xN=e.version;if(xN!=="19.2.0")throw Error(i(527,xN,"19.2.0"));I.findDOMNode=function(o){var r=o._reactInternals;if(r===void 0)throw typeof o.render=="function"?Error(i(188)):(o=Object.keys(o).join(","),Error(i(268,o)));return o=h(r),o=o!==null?p(o):null,o=o===null?null:o.stateNode,o};var L7={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:j,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ff=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ff.isDisabled&&Ff.supportsFiber)try{pe=Ff.inject(L7),re=Ff}catch{}}return pa.createRoot=function(o,r){if(!s(o))throw Error(i(299));var l=!1,f="",g=NT,v=AT,_=MT;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(f=r.identifierPrefix),r.onUncaughtError!==void 0&&(g=r.onUncaughtError),r.onCaughtError!==void 0&&(v=r.onCaughtError),r.onRecoverableError!==void 0&&(_=r.onRecoverableError)),r=lN(o,1,!1,null,null,l,f,null,g,v,_,bN),o[gn]=r.current,i0(o),new E0(r)},pa.hydrateRoot=function(o,r,l){if(!s(o))throw Error(i(299));var f=!1,g="",v=NT,_=AT,V=MT,X=null;return l!=null&&(l.unstable_strictMode===!0&&(f=!0),l.identifierPrefix!==void 0&&(g=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(_=l.onCaughtError),l.onRecoverableError!==void 0&&(V=l.onRecoverableError),l.formState!==void 0&&(X=l.formState)),r=lN(o,1,!0,r,l??null,f,g,X,v,_,V,bN),r.context=cN(null),l=r.current,f=Tn(),f=Ho(f),g=Zi(f),g.callback=null,Ki(l,g,f),l=f,r.current.lanes=l,no(r,l),Ao(r),o[gn]=r.current,i0(o),new Xf(r)},pa.version="19.2.0",pa}var D0;function NN(){if(D0)return Jf.exports;D0=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Jf.exports=_N(),Jf.exports}var AN=NN();const MN={stringify:t=>t?"true":"false",parse:t=>/^[ty1-9]/i.test(t)},RN={stringify:t=>t.name,parse:(t,e,n)=>{const i=(()=>{if(typeof window<"u"&&t in window)return window[t];if(typeof global<"u"&&t in global)return global[t]})();return typeof i=="function"?i.bind(n):void 0}},kN={stringify:t=>JSON.stringify(t),parse:t=>JSON.parse(t)};function ON(t){return t.replace(/([a-z0-9])([A-Z])/g,(e,n,i)=>`${n}-${i.toLowerCase()}`)}function DN(t){return t.replace(/[-:]([a-z])/g,(e,n)=>`${n.toUpperCase()}`)}const j0=Symbol.for("r2wc.bound"),jN={parse:(t,e,n)=>{const i=DN(e),s=n;if(typeof s<"u"&&i in s&&typeof s[i]<"u"){let a=s[i];return j0 in s[i]||(a=a.bind(s),Object.defineProperty(a,j0,{value:!0})),a}else return}},zN={stringify:t=>`${t}`,parse:t=>parseFloat(t)},VN={stringify:t=>t,parse:t=>t},od={string:VN,number:zN,boolean:MN,function:RN,method:jN,json:kN},Jl=Symbol.for("r2wc.render"),tc=Symbol.for("r2wc.connected"),hr=Symbol.for("r2wc.context"),lo=Symbol.for("r2wc.props");function LN(t,e,n){e.props||(e.props=t.propTypes?Object.keys(t.propTypes):[]),e.events||(e.events=[]);const i=Array.isArray(e.props)?e.props.slice():Object.keys(e.props),s=Array.isArray(e.events)?e.events.slice():Object.keys(e.events),a={},c={},u={},d={};for(const p of i){a[p]=Array.isArray(e.props)?"string":e.props[p];const m=ON(p);u[p]=m,d[m]=p}for(const p of s)c[p]=Array.isArray(e.events)?{}:e.events[p];class h extends HTMLElement{static get observedAttributes(){return Object.keys(d)}[tc]=!0;[hr];[lo]={};container;constructor(){super(),e.shadow?this.container=this.attachShadow({mode:e.shadow}):this.container=this,this[lo].container=this.container;for(const m of i){const y=u[m],b=this.getAttribute(y),x=a[m],w=x?od[x]:null;w?.parse&&(b||x==="method")&&(this[lo][m]=w.parse(b,y,this))}for(const m of s)this[lo][m]=y=>{const b=m.replace(/^on/,"").toLowerCase();this.dispatchEvent(new CustomEvent(b,{detail:y,...c[m]}))}}connectedCallback(){this[tc]=!0,this[Jl]()}disconnectedCallback(){this[tc]=!1,this[hr]&&n.unmount(this[hr]),delete this[hr]}attributeChangedCallback(m,y,b){const x=d[m],w=a[x],S=w?od[w]:null;x in a&&S?.parse&&(b||w==="method")&&(this[lo][x]=S.parse(b,m,this),this[Jl]())}[Jl](){this[tc]&&(this[hr]?n.update(this[hr],this[lo]):this[hr]=n.mount(this.container,t,this[lo]))}}for(const p of i){const m=u[p],y=a[p];Object.defineProperty(h.prototype,p,{enumerable:!0,configurable:!0,get(){return this[lo][p]},set(b){this[lo][p]=b;const x=y?od[y]:null;if(x?.stringify){const w=x.stringify(b,m,this);this.getAttribute(m)!==w&&(w==null?this.removeAttribute(m):this.setAttribute(m,w))}else p in a&&x?.parse&&(b||y==="method")&&(this[lo][p]=x.parse(b,m,this)),this[Jl]()}})}return h}function IN(t,e,n){const i=AN.createRoot(t),s=dr.createElement(e,n);return i.render(s),{root:i,ReactComponent:e}}function BN({root:t,ReactComponent:e},n){const i=dr.createElement(e,n);t.render(i)}function PN({root:t}){t.unmount()}function HN(t,e={}){return LN(t,e,{mount:IN,update:BN,unmount:PN})}var id={exports:{}},ma={};var z0;function UN(){if(z0)return ma;z0=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(i,s,a){var c=null;if(a!==void 0&&(c=""+a),s.key!==void 0&&(c=""+s.key),"key"in s){a={};for(var u in s)u!=="key"&&(a[u]=s[u])}else a=s;return s=a.ref,{$$typeof:t,type:i,key:c,ref:s!==void 0?s:null,props:a}}return ma.Fragment=e,ma.jsx=n,ma.jsxs=n,ma}var V0;function $N(){return V0||(V0=1,id.exports=UN()),id.exports}var M=$N();const qN={PROD:!0},L0=typeof{url:Kf&&Kf.tagName.toUpperCase()==="SCRIPT"&&Kf.src||new URL("circuit-embed.js",document.baseURI).href}<"u"?qN:void 0,rd=L0?.VITE_SANDBOX_ORIGIN||(L0?.PROD?"https://sandbox.simten.dev":"http://localhost:3002");function I0(t,e,n,i){t.iframe&&(t.iframe.remove(),t.iframe=null,t.ready=!1);const s=document.createElement("iframe");return s.src=rd,s.setAttribute("sandbox","allow-scripts allow-same-origin"),s.style.cssText="display:none;width:0;height:0;position:absolute;",s.setAttribute("aria-hidden","true"),s.onerror=i,e.appendChild(s),t.iframe=s,t.ready=!1,window.addEventListener("message",n),s}function YN(t){return`sb-${++t.idCounter}`}function GN(){const t=N.useRef({iframe:null,ready:!1,pending:new Map,readyQueue:[],idCounter:0}),e=N.useRef(null),n=N.useRef(()=>{}),i=N.useCallback(()=>{const C=t.current,R=e.current;if(R){for(const[,A]of C.pending)A({type:"error",error:"Sandbox restarted (crash)"});C.pending.clear(),C.readyQueue=[],window.removeEventListener("message",n.current),I0(C,R,n.current,a.current)}},[]),s=N.useCallback(C=>{if(C.origin!==rd)return;const R=t.current,A=C.data;if(A.type==="ready"){R.ready=!0;for(const k of R.readyQueue)k();R.readyQueue=[];return}if(!A.id)return;const O=R.pending.get(A.id);O&&(R.pending.delete(A.id),O(A))},[]);n.current=s;const a=N.useRef(i);a.current=i,N.useEffect(()=>{const C=document.createElement("div");C.style.cssText="position:absolute;left:-9999px;top:-9999px;",document.body.appendChild(C),e.current=C;const R=t.current;return I0(R,C,s,i),()=>{window.removeEventListener("message",s),C.remove(),e.current=null}},[s]);const c=N.useCallback(C=>new Promise(R=>{const A=t.current,O=YN(A),k={...C,id:O};A.pending.set(O,R);const H=()=>{const $=A.iframe;if(!$?.contentWindow){A.pending.delete(O),R({type:"error",error:"Sandbox iframe not available"});return}$.contentWindow.postMessage(k,rd)};A.ready?H():A.readyQueue.push(H)}),[]),u=N.useCallback(async(C,R="default")=>{const A=await c({type:"compile",source:C,slot:R});if("error"in A)return A;const O=A;return{circuits:O.circuits,libraryCircuits:O.libraryCircuits,portValues:O.portValues,peripheralState:O.peripheralState}},[c]),d=N.useCallback(async(C,R,A,O)=>{const k=await c({type:"compile-ir",circuit:C,libraryCircuits:R,slot:A,evalSources:O?.evalSources,snapshot:O?.snapshot});if("error"in k)return k;const H=k;return{portValues:H.portValues,peripheralState:H.peripheralState,snapshotId:H.snapshotId}},[c]),h=N.useCallback(async(C,R="default",A)=>{const O=await c({type:"tick",inputs:C,slot:R,snapshot:A?.snapshot});if("error"in O)return O;const k=O;return{portValues:k.portValues,cycle:k.cycle,peripheralState:k.peripheralState,snapshotId:k.snapshotId}},[c]),p=N.useCallback(async(C,R,A="default",O)=>{const k=await c({type:"tick-n",n:C,inputs:R,slot:A,snapshot:O?.snapshot});if("error"in k)return k;const H=k;return{portValues:H.portValues,cycle:H.cycle,peripheralState:H.peripheralState,snapshotId:H.snapshotId}},[c]),m=N.useCallback(async(C,R,A,O="default")=>{const k=await c({type:"scan-port",addrNodeId:C,valuePortKey:R,count:A,slot:O});return"error"in k?k:{values:k.values}},[c]),y=N.useCallback(async C=>{const R=await c({type:"simulate",...C});if("error"in R)return R;const A=R;return{circuitName:A.circuitName,signals:A.signals,vcd:A.vcd,ticks:A.ticks,steadyStateAt:A.steadyStateAt}},[c]),b=N.useCallback(async(C="default")=>{const R=await c({type:"reset",slot:C});if("error"in R)return R;const A=R;return{portValues:A.portValues,peripheralState:A.peripheralState}},[c]),x=N.useCallback(async(C,R,A="default",O)=>{const k=await c({type:"set-node",nodeId:C,value:R,slot:A,snapshot:O?.snapshot});if("error"in k)return k;const H=k;return{portValues:H.portValues,peripheralState:H.peripheralState,snapshotId:H.snapshotId}},[c]),w=N.useCallback(async(C="default")=>{const R=await c({type:"snapshot",slot:C});return"error"in R?R:{snapshotId:R.snapshotId}},[c]),S=N.useCallback(async(C,R="default")=>{const A=await c({type:"restore",snapshotId:C,slot:R});if("error"in A)return A;const O=A;return{portValues:O.portValues,cycle:O.cycle,peripheralState:O.peripheralState}},[c]),E=N.useCallback(async(C,R="default")=>{const A=await c({type:"prune-snapshots",keepAfterId:C,slot:R});return"error"in A,A},[c]),D=N.useCallback(async C=>{await c({type:"dispose",slot:C})},[c]),T=N.useCallback(()=>t.current.ready,[]);return{compile:u,compileIR:d,tick:h,tickN:p,scanPort:m,simulate:y,reset:b,setNode:x,snapshot:w,restore:S,pruneSnapshots:E,dispose:D,isReady:T}}const B0=N.createContext(null);function XN({children:t}){const e=GN();return M.jsx(B0.Provider,{value:e,children:t})}const FN={compile:async()=>({type:"error",error:"Sandbox not ready"}),compileIR:async()=>({type:"error",error:"Sandbox not ready"}),tick:async()=>({type:"error",error:"Sandbox not ready"}),tickN:async()=>({type:"error",error:"Sandbox not ready"}),scanPort:async()=>({type:"error",error:"Sandbox not ready"}),simulate:async()=>({type:"error",error:"Sandbox not ready"}),reset:async()=>({type:"error",error:"Sandbox not ready"}),setNode:async()=>({type:"error",error:"Sandbox not ready"}),snapshot:async()=>({type:"error",error:"Sandbox not ready"}),restore:async()=>({type:"error",error:"Sandbox not ready"}),pruneSnapshots:async()=>({type:"error",error:"Sandbox not ready"}),dispose:async()=>{},isReady:()=>!1};function sd(){return N.useContext(B0)??FN}function pr(t,e,n){if(t<1||!Number.isInteger(t))throw new Error(`Memory depth must be a positive integer, got ${t}`);if(e<1||!Number.isInteger(e))throw new Error(`Memory width must be a positive integer, got ${e}`);return{__stateKind:"mem",depth:t,width:e,initial:n??new Map}}function ZN(t){return t!=null&&typeof t=="object"&&t.__stateKind==="reg"}function KN(t){return t!=null&&typeof t=="object"&&t.__stateKind==="mem"}const J={kind:"bit"};function Z(t){if(t<1||!Number.isInteger(t))throw new Error(`Bus width must be a positive integer, got ${t}`);return{kind:"bus",width:t}}function P0(t){return typeof t=="number"?t===1?J:Z(t):t}const ec=new Map;function QN(t,e){ec.has(t)||ec.set(t,e)}function nc(t){return ec.get(t)}function WN(){return ec}function JN(t,e,n){return{_path:{nodeId:t,portName:e},_type:n,to(...i){return{source:{nodeId:t,portName:e},targets:i.map(s=>({nodeId:s._path.nodeId,portName:s._path.portName})),portType:n}}}}function ad(t,e,n){const i={};for(const[s,a]of e)i[s]=JN(t,s,a);return new Proxy(i,{get(s,a){if(a in s)return s[a];if(typeof a=="symbol"||a.startsWith("_"))return;const c=t===""?"circuit":`node '${t}'${n?` (${n})`:""}`,u=Object.keys(s).join(", ");throw new Error(`Port '${a}' does not exist on ${c}. Available ports: ${u||"none"}`)}})}function vt(t,e={}){if(typeof t!="string"){const z=t===null?"null":Array.isArray(t)?"array":typeof t;throw new Error(`circuit() expects a string name as the first argument, got ${z}. Usage: circuit('MyCircuit', { inputs, outputs, nodes, connect }). (A common cause is a stray import / variable being passed by mistake, e.g. circuit(React, {...}) — the first argument must be a literal string name.)`)}if(typeof e=="function"){const z=e;return U=>{const Y=z(U),L=vt(t,Y);L._args=U??{};for(const G of L.circuit.state)if(G.stateType.kind==="bit")G.initialValue=!1;else if(G.stateType.kind==="bus")typeof G.initialValue=="number"&&(G.initialValue=0);else if(G.stateType.kind==="memory"){const tt=G.initialValue;G.initialValue={data:new Map,addressWidth:tt?.addressWidth??G.stateType.addressWidth,dataWidth:tt?.dataWidth??G.stateType.dataWidth}}return L}}const n=e,i=new Map;if(n.inputs)for(const[z,U]of Object.entries(n.inputs))i.set(z,P0(U));const s=new Map;if(n.outputs)for(const[z,U]of Object.entries(n.outputs))s.set(z,P0(U));const a=n.nodes??{},c=[],u=new Set;for(const z of i.keys())u.has(z)&&c.push(`Duplicate port name: '${z}'`),u.add(z);for(const z of s.keys())u.has(z)&&c.push(`Port name '${z}' used for both input and output`),u.add(z);if(n.state)for(const z of Object.keys(n.state))i.has(z)&&c.push(`State name '${z}' collides with input port name`),s.has(z)&&c.push(`State name '${z}' collides with output port name`);for(const z of Object.keys(a))(z==="inputs"||z==="outputs"||z==="nodes")&&c.push(`Node name '${z}' is reserved`);n.onTick&&!n.state&&c.push(".onTick() requires state to be defined");let d=[];if(n.connect){const z={};for(const[Y,L]of Object.entries(a)){const G=new Map;for(const tt of L.circuit.inputs)G.set(tt.name,tt.portType);for(const tt of L.circuit.outputs)G.set(tt.name,tt.portType);z[Y]=ad(Y,G,L.circuit.name)}const U={inputs:ad("",i),outputs:ad("",s),nodes:z};try{d=n.connect(U)}catch(Y){c.push(Y instanceof Error?Y.message:String(Y))}}for(const z of d){H0(z.source,i,s,a,c);for(const U of z.targets)H0(U,i,s,a,c)}const h=z=>z.nodeId===""?z.portName:`${z.nodeId}.${z.portName}`,p=new Map,m=new Map,y=[];for(const z of d){const U=[];for(const Y of z.targets){const L=h(Y),G=p.get(L);if(G){if(G.nodeId===z.source.nodeId&&G.portName===z.source.portName)continue;let tt=m.get(L);tt||(tt=new Set([h(G)]),m.set(L,tt)),tt.add(h(z.source));continue}p.set(L,{nodeId:z.source.nodeId,portName:z.source.portName}),U.push(Y)}U.length>0&&y.push({...z,targets:U})}d=y;const b=[...m.keys()].sort();for(const z of b){const U=[...m.get(z)].join(", ");c.push(`${z} has multiple drivers: ${U}`)}if(c.length>0)throw new Error(`Circuit '${t}' validation failed:
|
|
10
|
-
- ${
|
|
11
|
-
- `)}`);const x=n.eval!=null,w=Object.keys(a).length>0;let S,E;x&&!w?(S={kind:"primitive"},E=n.state!=null?"sequential":"combinational"):w?(S={kind:"composite"},E=tA(a,n.state)?"sequential":"combinational"):(S={kind:"primitive"},E="combinational");const D=Array.from(i,([z,U])=>({name:z,portType:U})),T=Array.from(s,([z,U])=>({name:z,portType:U})),C=[];(n.state!=null||n.onTick!=null)&&C.push({name:"clk"});const R=[];if(n.state!=null)for(const[z,U]of Object.entries(n.state))if(KN(U)){const Y=Math.ceil(Math.log2(U.depth))||1;R.push({id:`${t}-${z}`,name:z,stateType:{kind:"memory",addressWidth:Y,dataWidth:U.width},initialValue:{data:new Map(U.initial),addressWidth:Y,dataWidth:U.width},clockRef:"clk",edge:"rising"})}else ZN(U)?R.push({id:`${t}-${z}`,name:z,stateType:U.width===1?{kind:"bit"}:{kind:"bus",width:U.width},initialValue:U.initial,clockRef:"clk",edge:"rising"}):U instanceof Map?R.push({id:`${t}-${z}`,name:z,stateType:{kind:"memory",addressWidth:16,dataWidth:8},initialValue:{data:new Map(U),addressWidth:16,dataWidth:8},clockRef:"clk",edge:"rising"}):typeof U=="boolean"?R.push({id:`${t}-${z}`,name:z,stateType:{kind:"bit"},initialValue:U,clockRef:"clk",edge:"rising"}):R.push({id:`${t}-${z}`,name:z,stateType:{kind:"bus",width:32},initialValue:U,clockRef:"clk",edge:"rising"});const A=[];for(const[z,U]of Object.entries(a)){const Y=U._args??{};A.push({id:z,componentRef:U.circuit.name,arguments:Y,inputs:U.circuit.inputs.map(L=>({id:`${z}.${L.name}`,name:L.name,portType:L.portType})),outputs:U.circuit.outputs.map(L=>({id:`${z}.${L.name}`,name:L.name,portType:L.portType})),clocks:U.circuit.clocks.map(L=>({id:`${z}.${L.name}`,name:L.name}))})}const O=[];let k=0;for(const z of d)for(const U of z.targets)O.push({id:`conn_${k++}`,source:{nodeId:z.source.nodeId,portName:z.source.portName},target:{nodeId:U.nodeId,portName:U.portName},portType:z.portType});const H={timing:E},$=n.meta;$&&($.description!==void 0&&(H.description=$.description),$.category!==void 0&&(H.category=$.category),$.icon!==void 0&&(H.icon=$.icon),$.tags!==void 0&&(H.tags=$.tags),$.author!==void 0&&(H.author=$.author),$.version!==void 0&&(H.version=$.version),$.synthesizable!==void 0&&(H.synthesizable=$.synthesizable),$.interactiveArg!==void 0&&(H.interactiveArg=$.interactiveArg));const q={version:1,name:t,inputs:D,outputs:T,clocks:C,state:R,nodes:A,connections:O,implementation:S,metadata:H};for(const[z,U]of i);for(const[z,U]of s);const F=new Map;for(const[,z]of Object.entries(a))if(F.has(z.circuit.name)||F.set(z.circuit.name,z),z._dependencies)for(const[U,Y]of z._dependencies)F.has(U)||F.set(U,Y);const Q={};for(const z of D)Q[z.name]=z;const B={};for(const z of T)B[z.name]=z;const P={};for(const z of A)P[z.id]=z;const j={circuit:q,inputs:Q,outputs:B,nodes:P,_dependencies:F};Object.defineProperty(j,"toJSON",{value:function(){const z={};for(const[U,Y]of this._dependencies)z[U]=Y;return{circuit:this.circuit,_dependencies:z}},enumerable:!1});const I=n.state?Object.keys(n.state):void 0;return QN(t,{inputNames:q.inputs.map(z=>z.name),outputNames:q.outputs.map(z=>z.name),evalFn:n.eval??(()=>({})),stateKeys:I,onTickFn:n.onTick}),j}function H0(t,e,n,i,s){if(t.nodeId==="")!e.has(t.portName)&&!n.has(t.portName)&&s.push(`Circuit port '${t.portName}' does not exist`);else{const a=i[t.nodeId];if(!a){s.push(`Node '${t.nodeId}' does not exist`);return}a.circuit.inputs.some(u=>u.name===t.portName)||a.circuit.outputs.some(u=>u.name===t.portName)||s.push(`Port '${t.portName}' does not exist on node '${t.nodeId}' (${a.circuit.name})`)}}function tA(t,e){if(e!=null)return!0;for(const n of Object.values(t))if(n.circuit.clocks.length>0||n.circuit.state.length>0)return!0;return!1}const U0=vt("And",{inputs:{a:J,b:J},outputs:{out:J},meta:{category:"logic-gates",icon:"&",description:"Logical AND gate"},eval:({a:t,b:e})=>({out:t&&e?1:0})}),ld=vt("Or",{inputs:{a:J,b:J},outputs:{out:J},meta:{category:"logic-gates",icon:"≥1",description:"Logical OR gate"},eval:({a:t,b:e})=>({out:t||e?1:0})}),$0=vt("Not",{inputs:{in:J},outputs:{out:J},meta:{category:"logic-gates",icon:"¬",description:"Logical NOT gate"},eval:({in:t})=>({out:t?0:1})}),eA=vt("Nand",{inputs:{a:J,b:J},outputs:{out:J},meta:{category:"logic-gates",icon:"⊼",description:"Logical NAND gate"},eval:({a:t,b:e})=>({out:t&&e?0:1})}),nA=vt("Nor",{inputs:{a:J,b:J},outputs:{out:J},meta:{category:"logic-gates",icon:"⊽",description:"Logical NOR gate"},eval:({a:t,b:e})=>({out:t||e?0:1})}),oA=vt("Xor",{inputs:{a:J,b:J},outputs:{out:J},meta:{category:"logic-gates",icon:"⊕",description:"Logical XOR gate"},eval:({a:t,b:e})=>({out:t!==e?1:0})}),iA=vt("Xnor",{inputs:{a:J,b:J},outputs:{out:J},meta:{category:"logic-gates",icon:"⊙",description:"Logical XNOR gate"},eval:({a:t,b:e})=>({out:t===e?1:0})}),rA=vt("Buffer",{inputs:{in:J},outputs:{out:J},meta:{category:"logic-gates",icon:"▷",description:"Buffer — passes input through unchanged"},eval:({in:t})=>({out:t})}),sA=Object.freeze(Object.defineProperty({__proto__:null,And:U0,Buffer:rA,Nand:eA,Nor:nA,Not:$0,Or:ld,Xnor:iA,Xor:oA},Symbol.toStringTag,{value:"Module"})),aA=vt("Incrementer",{inputs:{in:Z(8)},outputs:{out:Z(8)},meta:{category:"arithmetic",icon:"+1",description:"Adds 1 to the input"},eval:({in:t})=>({out:t+1&255})}),oc=vt("Adder",({width:t=8}={})=>({inputs:{a:Z(t),b:Z(t),carry_in:J},outputs:{sum:Z(t),carry_out:J},meta:{category:"arithmetic",icon:"+",description:"N-bit adder with carry"},eval:({a:e,b:n,carry_in:i,width:s=t})=>{const a=s,c=a>=32?4294967295:(1<<a)-1,u=(e>>>0)+(n>>>0)+i;return{sum:u&c,carry_out:u>c?1:0}}})),lA=vt("Subtractor",({width:t=8}={})=>({inputs:{a:Z(t),b:Z(t),borrow_in:J},outputs:{difference:Z(t),borrow_out:J},meta:{category:"arithmetic",icon:"−",description:"N-bit subtractor with borrow"},eval:({a:e,b:n,borrow_in:i,width:s=t})=>{const a=s,c=a>=32?4294967295:(1<<a)-1,u=(e>>>0)-(n>>>0)-i;return{difference:u&c,borrow_out:u<0?1:0}}})),cA=vt("Multiplier",{inputs:{a:Z(8),b:Z(8)},outputs:{product:Z(16)},meta:{category:"arithmetic",icon:"×",description:"N-bit multiplier"},eval:({a:t,b:e})=>({product:t*e&65535})}),uA=vt("Comparator",({width:t=8}={})=>({inputs:{a:Z(t),b:Z(t)},outputs:{eq:J,lt:J,gt:J},meta:{category:"arithmetic",icon:"⋚",description:"Unsigned comparator"},eval:({a:e,b:n})=>{const i=e>>>0,s=n>>>0;return{eq:i===s?1:0,lt:i<s?1:0,gt:i>s?1:0}}})),fA=vt("LeftShifter",({width:t=8}={})=>({inputs:{value:Z(t),shift:Z(t)},outputs:{result:Z(t)},meta:{category:"arithmetic",icon:"≪",description:"Left bit shifter"},eval:({value:e,shift:n,width:i=t})=>{const s=i,a=n,c=s>=32?4294967295:(1<<s)-1;return{result:a>=s?0:e<<a&c}}})),dA=vt("RightShifter",({width:t=8}={})=>({inputs:{value:Z(t),shift:Z(t)},outputs:{result:Z(t)},meta:{category:"arithmetic",icon:"≫",description:"Right bit shifter"},eval:({value:e,shift:n,width:i=t})=>{const s=i,a=n;return{result:a>=s?0:e>>>a}}})),hA=vt("SignedAdder",{inputs:{a:Z(8),b:Z(8),carry_in:J},outputs:{sum:Z(8),overflow:J,carry_out:J},meta:{category:"arithmetic",icon:"±+",description:"Signed adder with overflow detection"},eval:({a:t,b:e,carry_in:n})=>{const a=t>>>0,c=e>>>0,u=a+c+n,d=u&255,h=(a&128)!==0,p=(c&128)!==0,m=(d&128)!==0;return{sum:d,overflow:h===p&&h!==m?1:0,carry_out:u>255?1:0}}}),pA=vt("SignedComparator",{inputs:{a:Z(8),b:Z(8)},outputs:{eq:J,lt:J,gt:J,lte:J,gte:J},meta:{category:"arithmetic",icon:"±⋚",description:"Signed comparator"},eval:({a:t,b:e})=>{const s=t&255,a=e&255,c=s&128?s-256:s,u=a&128?a-256:a;return{eq:c===u?1:0,lt:c<u?1:0,gt:c>u?1:0,lte:c<=u?1:0,gte:c>=u?1:0}}}),mA=vt("SignedMultiplier",{inputs:{a:Z(8),b:Z(8)},outputs:{product:Z(16)},meta:{category:"arithmetic",icon:"±×",description:"Signed multiplier"},eval:({a:t,b:e})=>{const s=t&255,a=e&255,c=s&128?s-256:s,u=a&128?a-256:a,d=c*u;return{product:d>=0?d:d+65536}}}),q0=vt("BusAnd",({width:t=8}={})=>({inputs:{a:Z(t),b:Z(t)},outputs:{out:Z(t)},meta:{category:"bus-operations",icon:"&8",description:"Bitwise AND on buses"},eval:({a:e,b:n})=>({out:e&n})})),gA=vt("BusOr",({width:t=8}={})=>({inputs:{a:Z(t),b:Z(t)},outputs:{out:Z(t)},meta:{category:"bus-operations",icon:"|8",description:"Bitwise OR on buses"},eval:({a:e,b:n})=>({out:(e|n)>>>0})})),yA=vt("BusNot",{inputs:{in:Z(8)},outputs:{out:Z(8)},meta:{category:"bus-operations",icon:"¬8",description:"Bitwise NOT on bus"},eval:({in:t})=>({out:~t&255})}),vA=vt("BusXor",({width:t=8}={})=>({inputs:{a:Z(t),b:Z(t)},outputs:{out:Z(t)},meta:{category:"bus-operations",icon:"⊕8",description:"Bitwise XOR on buses"},eval:({a:e,b:n})=>({out:(e^n)>>>0})})),bA=Object.freeze(Object.defineProperty({__proto__:null,Adder:oc,BusAnd:q0,BusNot:yA,BusOr:gA,BusXor:vA,Comparator:uA,Incrementer:aA,LeftShifter:fA,Multiplier:cA,RightShifter:dA,SignedAdder:hA,SignedComparator:pA,SignedMultiplier:mA,Subtractor:lA},Symbol.toStringTag,{value:"Module"})),le=vt("Mux",({width:t=1}={})=>({inputs:{in0:t===1?J:Z(t),in1:t===1?J:Z(t),sel:J},outputs:{out:t===1?J:Z(t)},meta:{category:"plexers",icon:"MUX",description:"Multiplexer — sel=0 picks in0, sel=1 picks in1"},eval:({in0:e,in1:n,sel:i})=>({out:i?n:e})})),xA=vt("Decoder",{inputs:{in:Z(2)},outputs:{out0:J,out1:J,out2:J,out3:J},meta:{category:"plexers",icon:"DEC",description:"2-to-4 decoder"},eval:({in:t})=>({out0:t===0?1:0,out1:t===1?1:0,out2:t===2?1:0,out3:t===3?1:0})}),wA=vt("Splitter",{inputs:{in:Z(8)},outputs:{out0:Z(4),out1:Z(4)},meta:{category:"utilities",icon:"⊢",description:"Bus splitter"},eval:({in:t})=>({out0:t&15,out1:t>>4&15})}),SA=vt("Splitter8to8",{inputs:{in:Z(8)},outputs:{bit0:J,bit1:J,bit2:J,bit3:J,bit4:J,bit5:J,bit6:J,bit7:J},meta:{category:"utilities",icon:"⊢8",description:"Splits 8-bit bus into 8 individual bits"},eval:({in:t})=>({bit0:t>>0&1,bit1:t>>1&1,bit2:t>>2&1,bit3:t>>3&1,bit4:t>>4&1,bit5:t>>5&1,bit6:t>>6&1,bit7:t>>7&1})}),EA=vt("Combiner8to8",{inputs:{bit0:J,bit1:J,bit2:J,bit3:J,bit4:J,bit5:J,bit6:J,bit7:J},outputs:{out:Z(8)},meta:{category:"utilities",icon:"⊣8",description:"Combines 8 bits into an 8-bit bus"},eval:({bit0:t,bit1:e,bit2:n,bit3:i,bit4:s,bit5:a,bit6:c,bit7:u})=>({out:t&1|(e&1)<<1|(n&1)<<2|(i&1)<<3|(s&1)<<4|(a&1)<<5|(c&1)<<6|(u&1)<<7})}),CA=vt("Concat",{inputs:{high:Z(4),low:Z(4)},outputs:{out:Z(8)},meta:{category:"utilities",icon:"||",description:"Concatenate two buses"},eval:({high:t,low:e})=>({out:t<<4|e})}),mr=vt("BitSlice",t=>({inputs:{in:Z(8)},outputs:{out:Z(8)},meta:{category:"utilities",icon:"[]",description:"Extract bits [low..high] from input"},eval:({in:e,low:n=0,high:i=7})=>{const s=n,c=i-s+1,u=c>=32?4294967295:(1<<c)-1;return{out:e>>s&u}}})),TA=vt("AddressCombiner",{inputs:{lo:Z(8),hi:Z(8)},outputs:{out:Z(16)},meta:{category:"utilities",icon:"⊕16",description:"Combines two 8-bit buses into 16-bit"},eval:({lo:t,hi:e})=>({out:(e&255)<<8|t&255})}),_A=vt("Probe",{inputs:{in:J},outputs:{out:J},meta:{category:"utilities",icon:"🔍",description:"Debug observation point"},eval:({in:t})=>({out:t})}),NA=Object.freeze(Object.defineProperty({__proto__:null,AddressCombiner:TA,BitSlice:mr,Combiner8to8:EA,Concat:CA,Decoder:xA,Mux:le,Probe:_A,Splitter:wA,Splitter8to8:SA},Symbol.toStringTag,{value:"Module"})),AA=vt("DFlipFlop",({value:t=!1}={})=>({inputs:{d:J},outputs:{q:J,q_bar:J},state:{value:t},meta:{category:"sequential",icon:"D",description:"D Flip-Flop — stores 1 bit on rising clock edge"},eval:({value:e})=>({q:e?1:0,q_bar:e?0:1}),onTick:({d:e})=>({value:!!e})})),kt=vt("Register",({width:t=8,value:e=0}={})=>({inputs:{data:Z(t),we:J},outputs:{q:Z(t)},state:{value:e},meta:{category:"sequential",icon:"REG",description:"N-bit register — stores data on rising clock edge when write-enable is high"},eval:({value:n})=>({q:n}),onTick:({data:n,we:i,value:s})=>({value:i?n:s})})),MA=Object.freeze(Object.defineProperty({__proto__:null,DFlipFlop:AA,Register:kt},Symbol.toStringTag,{value:"Module"})),RA=vt("ROM",t=>({inputs:{addr:Z(16)},outputs:{data_out:Z(8)},state:{memory:pr(65536,8)},meta:{category:"memory",icon:"📀",description:"Read-only memory with address decoding"},eval:({addr:e,memory:n})=>({data_out:n[e]}),onTick:({memory:e})=>({memory:e})})),kA=vt("RAM",t=>({inputs:{addr:Z(8),data_in:Z(8),we:J},outputs:{data_out:Z(8)},state:{memory:pr(256,8)},meta:{category:"memory",icon:"📝",description:"Random access memory"},eval:({addr:e,memory:n})=>({data_out:n[e]}),onTick:({addr:e,data_in:n,we:i,memory:s})=>(i&&(s[e]=n),{memory:s})})),OA=vt("DualPortRAM",t=>({inputs:{addrA:Z(8),dataA:Z(8),weA:J,addrB:Z(8)},outputs:{outA:Z(8),outB:Z(8)},state:{memory:pr(256,8)},meta:{category:"memory",icon:"📝×2",description:"Dual-port RAM"},eval:({addrA:e,addrB:n,memory:i})=>({outA:i[e],outB:i[n]}),onTick:({addrA:e,dataA:n,weA:i,memory:s})=>(i&&(s[e]=n),{memory:s})}));function DA(t){const e={};for(let n=0;n<t.length;n++){const i=t[n]&255;i!==0&&(e[n]=i)}return e}function jA(t,e){if(!Number.isInteger(e)||e<1||e>32)throw new Error(`ROM word width must be an integer in 1..32, got ${e}`);const n=e===32?4294967295:(1<<e)-1>>>0,i={};for(let s=0;s<t.length;s++){const a=(t[s]>>>0&n)>>>0;a!==0&&(i[s]=a)}return i}function zA(t){const e={};for(const[n,i]of t){if(!Number.isInteger(n)||n<0)throw new Error(`ROM address must be a non-negative integer, got ${n}`);i!==0&&(e[n]=i)}return e}const VA=Object.freeze(Object.defineProperty({__proto__:null,DualPortRAM:OA,RAM:kA,ROM:RA,romFromBytes:DA,romFromEntries:zA,romFromWords:jA},Symbol.toStringTag,{value:"Module"})),cd=vt("Switch",t=>({outputs:{out:J},eval:({value:e})=>({out:e?1:0}),meta:{category:"input-output",icon:"⚡",description:"User-controllable 1-bit toggle",interactiveArg:"value"}})),ud=vt("Button",t=>({outputs:{out:J},eval:({value:e})=>({out:e?1:0}),meta:{category:"input-output",icon:"🔘",description:"Push button input (momentary)",interactiveArg:"value"}})),fd=vt("Led",{inputs:{in:J},eval:()=>({}),meta:{category:"input-output",icon:"💡",description:"Visual output LED indicator"}}),dd=vt("Input",t=>({outputs:{out:Z(8)},eval:({value:e})=>({out:typeof e=="number"?e:0}),meta:{category:"input-output",icon:"🔢",description:"Multi-bit numeric input",interactiveArg:"value"}})),hd=vt("Output",{inputs:{in:Z(8)},eval:()=>({}),meta:{category:"input-output",icon:"📤",description:"Multi-bit output sink"}}),Mo=vt("Constant",({width:t=1}={})=>({outputs:{out:t===1?J:Z(t)},eval:({value:e})=>({out:typeof e=="number"?e:0}),meta:{category:"utilities",icon:"K",description:"Fixed value source",interactiveArg:"value"}})),LA=Object.freeze(Object.defineProperty({__proto__:null,Button:ud,Constant:Mo,Input:dd,Led:fd,Output:hd,Switch:cd},Symbol.toStringTag,{value:"Module"})),IA=vt("SevenSegment",{inputs:{in:Z(4)},meta:{category:"display",icon:"7",description:"4-bit seven-segment display",synthesizable:!1}}),pd=vt("HexDisplay",{inputs:{in:Z(8)},meta:{category:"display",icon:"0xFF",description:"Hexadecimal display",synthesizable:!1}}),BA=vt("Screen",t=>({inputs:{dataIn:Z(8)},outputs:{addrB:Z(16)},state:{memory:new Map},meta:{category:"display",icon:"🖥️",description:"Pixel display",synthesizable:!1},eval:()=>({addrB:0})})),PA=vt("RasterDisplay",t=>({inputs:{dataIn:Z(8)},outputs:{addrB:Z(16),scanX:Z(8),scanY:Z(8),hblank:J,vblank:J},state:{memory:new Map},meta:{category:"display",icon:"📺",description:"Hardware-accurate raster display with scan counters",synthesizable:!1},eval:()=>({addrB:0,scanX:0,scanY:0,hblank:0,vblank:0})})),HA=vt("Console",{inputs:{data:Z(8),we:J},state:{text:""},onTick:({data:t,we:e,text:n})=>{if(!e)return{text:n};const i=t&255;if(i===0)return{text:n};if(i===12)return{text:""};const s=(n??"")+String.fromCharCode(i);return{text:s.length>4096?s.slice(-4096):s}},meta:{category:"display",icon:"📟",description:"Text console output",synthesizable:!1}}),UA=Object.freeze(Object.defineProperty({__proto__:null,Console:HA,HexDisplay:pd,RasterDisplay:PA,Screen:BA,SevenSegment:IA},Symbol.toStringTag,{value:"Module"})),md=vt("RV32I_Decode",{inputs:{instruction:Z(32)},outputs:{opcode:Z(7),rd:Z(5),funct3:Z(3),rs1:Z(5),rs2:Z(5),funct7:Z(7)},eval:({instruction:t})=>{const e=t>>>0;return{opcode:e&127,rd:e>>>7&31,funct3:e>>>12&7,rs1:e>>>15&31,rs2:e>>>20&31,funct7:e>>>25&127}},meta:{category:"rv32i",icon:"DEC",description:"RISC-V instruction decoder"}}),Y0=vt("RV32I_ALU",{inputs:{a:Z(32),b:Z(32),alu_op:Z(4)},outputs:{result:Z(32),zero:J},eval:({a:t,b:e,alu_op:n})=>{const i=t>>>0,s=e>>>0,a=n&15;let c;switch(a){case 0:c=i+s>>>0;break;case 1:c=i-s>>>0;break;case 2:c=(i&s)>>>0;break;case 3:c=(i|s)>>>0;break;case 4:c=(i^s)>>>0;break;case 5:c=i<<(s&31)>>>0;break;case 6:c=i>>>(s&31);break;case 7:c=(i|0)>>(s&31)>>>0;break;case 8:c=(i|0)<(s|0)?1:0;break;case 9:c=i<s?1:0;break;default:c=0}return{result:c,zero:c===0?1:0}},meta:{category:"rv32i",icon:"ALU",description:"RISC-V ALU"}}),G0=vt("RV32I_ImmGen",{inputs:{instruction:Z(32)},outputs:{immediate:Z(32)},eval:({instruction:t})=>{const e=t>>>0,n=e&127;let i;switch(n){case 19:case 3:case 103:i=e>>20|0;break;case 35:i=e>>25<<5|e>>>7&31|0,i=i<<20>>20;break;case 99:{const s=e>>>31&1,a=e>>>7&1,c=e>>>25&63,u=e>>>8&15;i=s<<12|a<<11|c<<5|u<<1,i=i<<19>>19;break}case 55:case 23:i=e&4294963200|0;break;case 111:{const s=e>>>31&1,a=e>>>12&255,c=e>>>20&1,u=e>>>21&1023;i=s<<20|a<<12|c<<11|u<<1,i=i<<11>>11;break}default:i=0}return{immediate:i>>>0}},meta:{category:"rv32i",icon:"IMM",description:"RISC-V immediate generator"}}),X0=vt("RV32I_Control",{inputs:{opcode:Z(7),funct3:Z(3),funct7_bit:J},outputs:{alu_op:Z(4),alu_src:J,mem_read:J,mem_write:J,reg_write:J,mem_to_reg:J,branch:J,jump:J,lui:J,auipc:J,is_jalr:J},eval:({opcode:t,funct3:e,funct7_bit:n})=>{const i=t&127,s=e&7,a=n?1:0;let c=0,u=0,d=0,h=0,p=0,m=0,y=0,b=0,x=0,w=0,S=0;switch(i){case 51:switch(p=1,s){case 0:c=a?1:0;break;case 1:c=5;break;case 2:c=8;break;case 3:c=9;break;case 4:c=4;break;case 5:c=a?7:6;break;case 6:c=3;break;case 7:c=2;break}break;case 19:switch(p=1,u=1,s){case 0:c=0;break;case 1:c=5;break;case 2:c=8;break;case 3:c=9;break;case 4:c=4;break;case 5:c=a?7:6;break;case 6:c=3;break;case 7:c=2;break}break;case 3:p=1,u=1,d=1,m=1,c=0;break;case 35:u=1,h=1,c=0;break;case 99:y=1,c=1;break;case 111:p=1,b=1;break;case 103:p=1,b=1,u=1,S=1,c=0;break;case 55:p=1,x=1;break;case 23:p=1,w=1;break}return{alu_op:c,alu_src:u,mem_read:d,mem_write:h,reg_write:p,mem_to_reg:m,branch:y,jump:b,lui:x,auipc:w,is_jalr:S}},meta:{category:"rv32i",icon:"CTL",description:"RISC-V control unit"}}),F0=vt("RV32I_BranchComp",{inputs:{a:Z(32),b:Z(32),funct3:Z(3)},outputs:{take_branch:J},eval:({a:t,b:e,funct3:n})=>{const i=t>>>0,s=e>>>0,a=i|0,c=s|0,u=n&7;let d=0;switch(u){case 0:d=i===s?1:0;break;case 1:d=i!==s?1:0;break;case 4:d=a<c?1:0;break;case 5:d=a>=c?1:0;break;case 6:d=i<s?1:0;break;case 7:d=i>=s?1:0;break}return{take_branch:d}},meta:{category:"rv32i",icon:"CMP",description:"RISC-V branch comparator"}}),Z0=vt("RV32I_RegisterFile",{inputs:{rs1:Z(5),rs2:Z(5),rd:Z(5),write_data:Z(32),we:J,debug_rs:Z(5)},outputs:{read1:Z(32),read2:Z(32),debug_read:Z(32)},state:{memory:pr(32,32)},eval:({rs1:t,rs2:e,debug_rs:n,memory:i})=>{const s=t&31,a=e&31,c=n&31;return{read1:s===0?0:i[s]>>>0,read2:a===0?0:i[a]>>>0,debug_read:c===0?0:i[c]>>>0}},onTick:({rd:t,write_data:e,we:n,memory:i})=>{const s=t&31;return n&&s!==0&&(i[s]=e>>>0),{memory:i}},meta:{category:"rv32i",icon:"RF",description:"RISC-V 32-register file"}}),$A=vt("RV32I_InstrMem",{inputs:{addr:Z(32)},outputs:{instruction:Z(32)},state:{memory:pr(65536,8)},eval:({addr:t,memory:e})=>{const n=t>>>0,i=e[n],s=e[n+1],a=e[n+2];return{instruction:(e[n+3]<<24|a<<16|s<<8|i)>>>0}},onTick:({memory:t})=>({memory:t}),meta:{category:"rv32i",icon:"IM",description:"RISC-V instruction memory"}}),qA=vt("RV32I_DataMem",{inputs:{addr:Z(32),write_data:Z(32),mem_read:J,mem_write:J,funct3:Z(3)},outputs:{read_data:Z(32),misalign:J},state:{memory:pr(65536,8)},eval:({addr:t,mem_read:e,mem_write:n,funct3:i,memory:s})=>{if(!e&&!n)return{read_data:0,misalign:0};const a=t>>>0,c=i&7;let u=0;if(((c===1||c===5)&&(a&1)!==0||c===2&&(a&3)!==0)&&(u=1),!e)return{read_data:0,misalign:u};let d;switch(c){case 0:{d=s[a]<<24>>24>>>0;break}case 1:{const h=s[a];d=(s[a+1]<<8|h)<<16>>16>>>0;break}case 2:{const h=s[a],p=s[a+1],m=s[a+2];d=(s[a+3]<<24|m<<16|p<<8|h)>>>0;break}case 4:d=s[a];break;case 5:{const h=s[a];d=(s[a+1]<<8|h)>>>0;break}default:d=0}return{read_data:d,misalign:u}},onTick:({addr:t,write_data:e,mem_write:n,funct3:i,memory:s})=>{if(!n)return{memory:s};const a=t>>>0,c=e>>>0;switch(i&7){case 0:s[a]=c&255;break;case 1:s[a]=c&255,s[a+1]=c>>>8&255;break;case 2:s[a]=c&255,s[a+1]=c>>>8&255,s[a+2]=c>>>16&255,s[a+3]=c>>>24&255;break}return{memory:s}},meta:{category:"rv32i",icon:"DM",description:"RISC-V data memory with byte/half/word access"}}),gd=vt("RV32I_WritebackMux",{inputs:{alu_result:Z(32),load_data:Z(32),pc_plus4:Z(32),immediate:Z(32),pc_plus_imm:Z(32),mem_to_reg:J,lui:J,auipc:J,jump:J},outputs:{write_data:Z(32)},eval:({alu_result:t,load_data:e,pc_plus4:n,immediate:i,pc_plus_imm:s,mem_to_reg:a,lui:c,auipc:u,jump:d})=>{let h;return d?h=n:u?h=s:c?h=i:a?h=e:h=t,{write_data:(h??0)>>>0}},meta:{category:"rv32i",icon:"WB",description:"RISC-V writeback mux"}}),K0=vt("RV32I_NextPCMux",{inputs:{pc_plus4:Z(32),branch_target:Z(32),jal_target:Z(32),jalr_target:Z(32),branch:J,take_branch:J,jump:J,is_jalr:J},outputs:{next_pc:Z(32)},eval:({pc_plus4:t,branch_target:e,jal_target:n,jalr_target:i,branch:s,take_branch:a,jump:c,is_jalr:u})=>{let d;return c?d=u?i&-2:n:s&&a?d=e:d=t,{next_pc:(d??0)>>>0}},meta:{category:"rv32i",icon:"PC",description:"RISC-V next PC mux"}}),Q0=vt("RV32I_ForwardingUnit",{inputs:{id_rs1:Z(5),id_rs2:Z(5),ex_rd:Z(5),ex_reg_write:J,mem_rd:Z(5),mem_reg_write:J},outputs:{forward_a:Z(2),forward_b:Z(2)},eval:({id_rs1:t,id_rs2:e,ex_rd:n,ex_reg_write:i,mem_rd:s,mem_reg_write:a})=>{const c=t&31,u=e&31,d=n&31,h=s&31;let p=0,m=0;return i&&d!==0&&d===c?p=1:a&&h!==0&&h===c&&(p=2),i&&d!==0&&d===u?m=1:a&&h!==0&&h===u&&(m=2),{forward_a:p,forward_b:m}},meta:{category:"rv32i",icon:"FWD",description:"RISC-V data forwarding unit"}}),yd=vt("RV32I_WBBypass",{inputs:{rs_val:Z(32),rs_addr:Z(5),wb_val:Z(32),wb_rd:Z(5),wb_we:J},outputs:{out:Z(32)},eval:({rs_val:t,rs_addr:e,wb_val:n,wb_rd:i,wb_we:s})=>{const a=e&31,c=i&31;return{out:(s&&c!==0&&c===a?n:t)>>>0}},meta:{category:"rv32i",icon:"BYP",description:"RISC-V writeback bypass"}}),YA=vt("RV32I_LoadAlign",{inputs:{data:Z(32),funct3:Z(3)},outputs:{out:Z(32)},eval:({data:t,funct3:e})=>{const n=t>>>0,i=e&7;let s;switch(i){case 0:{s=(n&255)<<24>>24>>>0;break}case 1:{s=(n&65535)<<16>>16>>>0;break}case 4:s=n&255;break;case 5:s=n&65535;break;default:s=n}return{out:s}},meta:{category:"rv32i",icon:"LA",description:"RISC-V load alignment (byte/half/word)"}}),W0=vt("RV32I_LoadAlignFull",{inputs:{data:Z(32),byte_offset:Z(2),funct3:Z(3)},outputs:{out:Z(32)},eval:({data:t,byte_offset:e,funct3:n})=>{const i=t>>>0,s=e&3,a=n&7,c=i>>>s*8&255,u=i>>>(s&2)*8&65535;let d;switch(a){case 0:d=c<<24>>24>>>0;break;case 1:d=u<<16>>16>>>0;break;case 4:d=c;break;case 5:d=u;break;default:d=i;break}return{out:d}},meta:{category:"rv32i",icon:"LA2",description:"RISC-V full load aligner (raw word + byte offset + funct3)"}}),J0=vt("RV32I_HazardUnit",{inputs:{if_rs1:Z(5),if_rs2:Z(5),id_rd:Z(5),id_mem_read:J,branch_taken:J,jump:J},outputs:{stall:J,flush:J},eval:({if_rs1:t,if_rs2:e,id_rd:n,id_mem_read:i,branch_taken:s,jump:a})=>{const c=t&31,u=e&31,d=n&31;return{stall:i&&d!==0&&(d===c||d===u)?1:0,flush:s||a?1:0}},meta:{category:"rv32i",icon:"HAZ",description:"RISC-V hazard detection unit"}}),GA=vt("DualPortROM",t=>({inputs:{addrA:Z(32),addrB:Z(32)},outputs:{dataA:Z(32),dataB:Z(32)},state:{memory:pr(65536,8)},eval:({addrA:e,addrB:n,memory:i})=>{const s=e>>>0,a=n>>>0;return{dataA:(i[s+3]<<24|i[s+2]<<16|i[s+1]<<8|i[s])>>>0,dataB:(i[a+3]<<24|i[a+2]<<16|i[a+1]<<8|i[a])>>>0}},onTick:({memory:e})=>({memory:e}),meta:{category:"memory",description:"Dual-port read-only memory"}})),XA=Object.freeze(Object.defineProperty({__proto__:null,DualPortROM:GA,RV32I_ALU:Y0,RV32I_BranchComp:F0,RV32I_Control:X0,RV32I_DataMem:qA,RV32I_Decode:md,RV32I_ForwardingUnit:Q0,RV32I_HazardUnit:J0,RV32I_ImmGen:G0,RV32I_InstrMem:$A,RV32I_LoadAlign:YA,RV32I_LoadAlignFull:W0,RV32I_NextPCMux:K0,RV32I_RegisterFile:Z0,RV32I_WBBypass:yd,RV32I_WritebackMux:gd},Symbol.toStringTag,{value:"Module"})),FA=vt("RV32I_Core",({debug:t=!1}={})=>{const e={instruction:Z(32),data_read:Z(32),net_rx_data:Z(32),net_rx_valid:J,net_rx_frame:J,...t?{debug_addr:Z(5)}:{}},n={instr_addr:Z(32),data_addr:Z(32),data_write:Z(32),data_mem_read:J,data_mem_write:J,data_funct3:Z(3),net_tx_data:Z(32),net_tx_valid:J,net_tx_frame:J,pc_out:Z(32),...t?{debug_value:Z(32),if_pc:Z(32),id_pc:Z(32),ex_pc:Z(32),mem_pc4:Z(32),wb_pc4:Z(32)}:{}};return{inputs:e,outputs:n,nodes:{four:Mo({value:4,width:32}),zero32:Mo({value:0,width:32}),zero5:Mo({value:0,width:5}),zero4:Mo({value:0,width:4}),zero3:Mo({value:0,width:3}),zero1:Mo({value:0,width:1}),one1:Mo({value:1,width:1}),hazard:J0,stall_inv:$0,pc:kt({width:32}),pc_plus4:oc({width:32}),ifid_instr_mux:le({width:32}),ifid_instr:kt({width:32}),ifid_pc_mux:le({width:32}),ifid_pc:kt({width:32}),ifid_pc4_mux:le({width:32}),ifid_pc4:kt({width:32}),decode:md,immgen:G0,control:X0,funct7_splitter:mr({low:5,high:5}),regfile:Z0,ifid_decode_for_hazard:md,idex_flush:ld,idex_pc:kt({width:32}),idex_pc4:kt({width:32}),wb_bypass1:yd,wb_bypass2:yd,idex_read1:kt({width:32}),idex_read2:kt({width:32}),idex_imm:kt({width:32}),idex_rs1_mux:le({width:5}),idex_rs1:kt({width:5}),idex_rs2_mux:le({width:5}),idex_rs2:kt({width:5}),idex_rd_mux:le({width:5}),idex_rd:kt({width:5}),idex_funct3_mux:le({width:3}),idex_funct3:kt({width:3}),idex_alu_op_mux:le({width:4}),idex_alu_op:kt({width:4}),idex_alu_src_mux:le({width:1}),idex_alu_src:kt({width:1}),idex_mem_read_mux:le({width:1}),idex_mem_read:kt({width:1}),idex_mem_write_mux:le({width:1}),idex_mem_write:kt({width:1}),idex_reg_write_mux:le({width:1}),idex_reg_write:kt({width:1}),idex_mem_to_reg_mux:le({width:1}),idex_mem_to_reg:kt({width:1}),idex_branch_mux:le({width:1}),idex_branch:kt({width:1}),idex_jump_mux:le({width:1}),idex_jump:kt({width:1}),idex_lui_mux:le({width:1}),idex_lui:kt({width:1}),idex_auipc_mux:le({width:1}),idex_auipc:kt({width:1}),idex_is_jalr_mux:le({width:1}),idex_is_jalr:kt({width:1}),forward:Q0,fwd_a_bit0:mr({low:0,high:0}),fwd_a_bit1:mr({low:1,high:1}),fwd_a_mux1:le({width:32}),fwd_a_mux2:le({width:32}),fwd_b_bit0:mr({low:0,high:0}),fwd_b_bit1:mr({low:1,high:1}),fwd_b_mux1:le({width:32}),fwd_b_mux2:le({width:32}),alu_src_mux:le({width:32}),alu:Y0,branch_comp:F0,branch_target:oc({width:32}),jalr_target:q0({width:32}),jalr_mask:Mo({value:4294967294,width:32}),pc_plus_imm:oc({width:32}),ex_result:gd,branch_and:U0,next_pc:K0,pc_src_taken:ld,pc_next_mux:le({width:32}),exmem_alu_result:kt({width:32}),exmem_result:kt({width:32}),exmem_read2:kt({width:32}),exmem_rd:kt({width:5}),exmem_funct3:kt({width:3}),exmem_pc4:kt({width:32}),exmem_imm:kt({width:32}),exmem_pc_plus_imm:kt({width:32}),exmem_mem_read:kt({width:1}),exmem_mem_write:kt({width:1}),exmem_reg_write:kt({width:1}),exmem_mem_to_reg:kt({width:1}),exmem_lui:kt({width:1}),exmem_auipc:kt({width:1}),exmem_jump:kt({width:1}),memwb_alu_result:kt({width:32}),memwb_load_data:kt({width:32}),memwb_rd:kt({width:5}),memwb_pc4:kt({width:32}),memwb_imm:kt({width:32}),memwb_pc_plus_imm:kt({width:32}),memwb_reg_write:kt({width:1}),memwb_mem_to_reg:kt({width:1}),memwb_lui:kt({width:1}),memwb_auipc:kt({width:1}),memwb_jump:kt({width:1}),exmem_lo2:mr({low:0,high:1}),memwb_byte_offset:kt({width:2}),memwb_funct3:kt({width:3}),load_align:W0,wb_mux:gd},connect:({inputs:i,outputs:s,nodes:{four:a,zero32:c,zero5:u,zero4:d,zero3:h,zero1:p,one1:m,hazard:y,stall_inv:b,pc:x,pc_plus4:w,ifid_instr_mux:S,ifid_instr:E,ifid_pc_mux:D,ifid_pc:T,ifid_pc4_mux:C,ifid_pc4:R,decode:A,immgen:O,control:k,funct7_splitter:H,regfile:$,ifid_decode_for_hazard:q,idex_flush:F,idex_pc:Q,idex_pc4:B,wb_bypass1:P,wb_bypass2:j,idex_read1:I,idex_read2:z,idex_imm:U,idex_rs1_mux:Y,idex_rs1:L,idex_rs2_mux:G,idex_rs2:tt,idex_rd_mux:it,idex_rd:lt,idex_funct3_mux:ht,idex_funct3:ft,idex_alu_op_mux:ut,idex_alu_op:dt,idex_alu_src_mux:Mt,idex_alu_src:Nt,idex_mem_read_mux:bt,idex_mem_read:Tt,idex_mem_write_mux:Dt,idex_mem_write:qt,idex_reg_write_mux:Ht,idex_reg_write:pt,idex_mem_to_reg_mux:gt,idex_mem_to_reg:yt,idex_branch_mux:mt,idex_branch:Et,idex_jump_mux:Vt,idex_jump:jt,idex_lui_mux:zt,idex_lui:ue,idex_auipc_mux:Xt,idex_auipc:xe,idex_is_jalr_mux:Pe,idex_is_jalr:Po,forward:Ae,fwd_a_bit0:So,fwd_a_bit1:_i,fwd_a_mux1:pe,fwd_a_mux2:re,fwd_b_bit0:ee,fwd_b_bit1:Ee,fwd_b_mux1:Ni,fwd_b_mux2:Ai,alu_src_mux:Mi,alu:Jn,branch_comp:to,branch_target:Eo,jalr_target:mn,jalr_mask:Ri,pc_plus_imm:eo,ex_result:tn,branch_and:ki,next_pc:Ke,pc_src_taken:no,pc_next_mux:Oi,exmem_alu_result:Di,exmem_result:ji,exmem_read2:zi,exmem_rd:Ho,exmem_funct3:Uo,exmem_pc4:$o,exmem_imm:Vi,exmem_pc_plus_imm:en,exmem_mem_read:ve,exmem_mem_write:Me,exmem_reg_write:gn,exmem_mem_to_reg:Co,exmem_lui:Li,exmem_auipc:zr,exmem_jump:Ii,memwb_alu_result:oo,memwb_load_data:qo,memwb_rd:Mn,memwb_pc4:yn,memwb_imm:Rn,memwb_pc_plus_imm:kn,memwb_reg_write:me,memwb_mem_to_reg:Bi,memwb_lui:Pi,memwb_auipc:vn,memwb_jump:On,exmem_lo2:Ds,memwb_byte_offset:Yo,memwb_funct3:Hi,load_align:Ui,wb_mux:He}})=>{const Go=[y.stall.to(b.in,F.b),x.q.to(w.a,s.instr_addr,D.in0,s.pc_out),a.out.to(w.b),b.out.to(x.we,E.we,T.we,R.we),i.instruction.to(S.in0),c.out.to(S.in1,D.in1,C.in1,tn.load_data),y.flush.to(S.sel,D.sel,C.sel,F.a),S.out.to(E.data),D.out.to(T.data),w.sum.to(C.in0,Oi.in0),C.out.to(R.data),E.q.to(A.instruction,O.instruction,q.instruction),A.opcode.to(k.opcode),A.funct3.to(k.funct3,ht.in0),A.funct7.to(H.in),H.out.to(k.funct7_bit),A.rs1.to($.rs1,P.rs_addr,Y.in0),A.rs2.to($.rs2,j.rs_addr,G.in0),q.rs1.to(y.if_rs1),q.rs2.to(y.if_rs2),T.q.to(Q.data),m.out.to(Q.we,B.we,I.we,z.we,U.we,L.we,tt.we,lt.we,ft.we,dt.we,Nt.we,Tt.we,qt.we,pt.we,yt.we,Et.we,jt.we,ue.we,xe.we,Po.we,Di.we,ji.we,zi.we,Ho.we,Uo.we,$o.we,Vi.we,en.we,ve.we,Me.we,gn.we,Co.we,Li.we,zr.we,Ii.we,oo.we,qo.we,Mn.we,yn.we,Rn.we,kn.we,me.we,Bi.we,Pi.we,vn.we,On.we,Yo.we,Hi.we),R.q.to(B.data),$.read1.to(P.rs_val),He.write_data.to(P.wb_val,j.wb_val,$.write_data,re.in1,Ai.in1),Mn.q.to(P.wb_rd,j.wb_rd,Ae.mem_rd,$.rd),me.q.to(P.wb_we,j.wb_we,Ae.mem_reg_write,$.we),$.read2.to(j.rs_val),P.out.to(I.data),j.out.to(z.data),O.immediate.to(U.data),u.out.to(Y.in1,G.in1,it.in1),F.out.to(Y.sel,G.sel,it.sel,ht.sel,ut.sel,Mt.sel,bt.sel,Dt.sel,Ht.sel,gt.sel,mt.sel,Vt.sel,zt.sel,Xt.sel,Pe.sel),Y.out.to(L.data),G.out.to(tt.data),A.rd.to(it.in0),it.out.to(lt.data),h.out.to(ht.in1),ht.out.to(ft.data),k.alu_op.to(ut.in0),d.out.to(ut.in1),ut.out.to(dt.data),k.alu_src.to(Mt.in0),p.out.to(Mt.in1,bt.in1,Dt.in1,Ht.in1,gt.in1,mt.in1,Vt.in1,zt.in1,Xt.in1,Pe.in1),Mt.out.to(Nt.data),k.mem_read.to(bt.in0),bt.out.to(Tt.data),k.mem_write.to(Dt.in0),Dt.out.to(qt.data),k.reg_write.to(Ht.in0),Ht.out.to(pt.data),k.mem_to_reg.to(gt.in0),gt.out.to(yt.data),k.branch.to(mt.in0),mt.out.to(Et.data),k.jump.to(Vt.in0),Vt.out.to(jt.data),k.lui.to(zt.in0),zt.out.to(ue.data),k.auipc.to(Xt.in0),Xt.out.to(xe.data),k.is_jalr.to(Pe.in0),Pe.out.to(Po.data),L.q.to(Ae.id_rs1),tt.q.to(Ae.id_rs2),Ae.forward_a.to(So.in,_i.in),I.q.to(pe.in0),So.out.to(pe.sel),pe.out.to(re.in0),_i.out.to(re.sel),Ae.forward_b.to(ee.in,Ee.in),z.q.to(Ni.in0),ee.out.to(Ni.sel),Ni.out.to(Ai.in0),Ee.out.to(Ai.sel),Ai.out.to(Mi.in0,to.b,zi.data),U.q.to(Mi.in1,Eo.b,eo.b,tn.immediate,Vi.data),Nt.q.to(Mi.sel),re.out.to(Jn.a,to.a),Mi.out.to(Jn.b),dt.q.to(Jn.alu_op),ft.q.to(to.funct3,Uo.data),Q.q.to(Eo.a,eo.a),Jn.result.to(mn.a,tn.alu_result,Di.data),Ri.out.to(mn.b),B.q.to(tn.pc_plus4,Ke.pc_plus4,$o.data),eo.sum.to(tn.pc_plus_imm,en.data),yt.q.to(tn.mem_to_reg,Co.data),ue.q.to(tn.lui,Li.data),xe.q.to(tn.auipc,zr.data),jt.q.to(tn.jump,Ke.jump,no.b,y.jump,Ii.data),Et.q.to(ki.a,Ke.branch),to.take_branch.to(ki.b,Ke.take_branch),Eo.sum.to(Ke.branch_target,Ke.jal_target),mn.out.to(Ke.jalr_target),Po.q.to(Ke.is_jalr),ki.out.to(no.a,y.branch_taken),Ke.next_pc.to(Oi.in1),no.out.to(Oi.sel),Oi.out.to(x.data),lt.q.to(y.id_rd,Ho.data),Tt.q.to(y.id_mem_read,ve.data),tn.write_data.to(ji.data),qt.q.to(Me.data),pt.q.to(gn.data),Ho.q.to(Ae.ex_rd,Mn.data),gn.q.to(Ae.ex_reg_write,me.data),ji.q.to(pe.in1,Ni.in1),Di.q.to(s.data_addr,oo.data,Ds.in),Ds.out.to(Yo.data),zi.q.to(s.data_write),ve.q.to(s.data_mem_read),Me.q.to(s.data_mem_write),Uo.q.to(s.data_funct3,Hi.data),i.data_read.to(qo.data),$o.q.to(yn.data),Vi.q.to(Rn.data),en.q.to(kn.data),Co.q.to(Bi.data),Li.q.to(Pi.data),zr.q.to(vn.data),Ii.q.to(On.data),oo.q.to(He.alu_result),qo.q.to(Ui.data),Yo.q.to(Ui.byte_offset),Hi.q.to(Ui.funct3),Ui.out.to(He.load_data),yn.q.to(He.pc_plus4),Rn.q.to(He.immediate),kn.q.to(He.pc_plus_imm),Bi.q.to(He.mem_to_reg),Pi.q.to(He.lui),vn.q.to(He.auipc),On.q.to(He.jump)];return t&&Go.push(i.debug_addr.to($.debug_rs),$.debug_read.to(s.debug_value),x.q.to(s.if_pc),T.q.to(s.id_pc),Q.q.to(s.ex_pc),$o.q.to(s.mem_pc4),yn.q.to(s.wb_pc4)),Go}}}),ZA=Object.freeze(Object.defineProperty({__proto__:null,RV32I_Core:FA},Symbol.toStringTag,{value:"Module"})),KA=(()=>{const t=new Array(256);for(let e=0;e<256;e++){let n=e;for(let i=0;i<8;i++)n=n&1?(n>>>1^3988292384)>>>0:n>>>1>>>0;t[e]=n>>>0}return t})(),QA=vt("Eth_ProtocolDecoder",{inputs:{ethertype:Z(16)},outputs:{is_ipv4:J,is_ipv6:J,is_arp:J,is_vlan:J,is_mpls:J},eval:({ethertype:t})=>{const e=t&65535;return{is_ipv4:e===2048?1:0,is_ipv6:e===34525?1:0,is_arp:e===2054?1:0,is_vlan:e===33024?1:0,is_mpls:e===34887?1:0}},meta:{category:"networking",icon:"EP",description:"EtherType → protocol flags"}}),WA=vt("Eth_AddrClassifier",{inputs:{dst_mac_hi:Z(16),dst_mac_lo:Z(32)},outputs:{is_broadcast:J,is_multicast:J,is_unicast:J},eval:({dst_mac_hi:t,dst_mac_lo:e})=>{const n=t&65535,i=(e&4294967295)>>>0,s=n===65535&&i===4294967295?1:0,a=!s&&(i>>>24&1)===1?1:0;return{is_broadcast:s,is_multicast:a,is_unicast:!s&&!a?1:0}},meta:{category:"networking",icon:"EA",description:"MAC address classifier"}}),JA=vt("Eth_FrameInput",{inputs:{enable:J,reset:J},outputs:{tdata:Z(32),tkeep:Z(4),tvalid:J,tlast:J,byte_offset:Z(16)},state:{memory:new Map},eval:({memory:t})=>{const e=t??new Map,n=(e.get(65539)??0)>>>0,i=(e.get(65540)??0)&15,s=(e.get(65541)??0)!==0?1:0,a=(e.get(65542)??0)!==0?1:0,c=(e.get(65543)??0)&65535;return{tdata:n,tkeep:i,tvalid:s,tlast:a,byte_offset:c}},onTick:({enable:t,reset:e,memory:n})=>{const i=n??new Map,s=65536,a=65537,c=65538,u=65539,d=65540,h=65541,p=65542,m=65543;if(e){const C=new Map(i);return C.set(s,0),C.set(c,0),C.set(h,0),C.set(p,0),{memory:C}}if(!t){const C=new Map(i);return C.set(h,0),{memory:C}}const y=new Map(i);if(!(i.get(c)??0)){let C=-1;for(const R of i.keys())R<65536&&R>C&&(C=R);y.set(a,C+1),y.set(c,1)}const b=y.get(a)??0,x=i.get(s)??0;if(x>=b||b===0)return y.set(u,0),y.set(d,0),y.set(h,0),y.set(p,0),y.set(m,x&65535),{memory:y};const w=b-x,S=Math.min(4,w);let E=0,D=0;for(let C=0;C<S;C++)E=(E|((i.get(x+C)??0)&255)<<24-C*8)>>>0,D|=1<<3-C;const T=x+S>=b;return y.set(u,E),y.set(d,D),y.set(h,1),y.set(p,T?1:0),y.set(m,x&65535),y.set(s,x+S),{memory:y}},meta:{category:"networking",icon:"EI",description:"Ethernet frame input (AXI-Stream)"}}),tM=vt("Eth_FrameParser",{inputs:{tdata:Z(32),tkeep:Z(4),tvalid:J,tlast:J},outputs:{dst_mac_hi:Z(16),dst_mac_lo:Z(32),dst_mac_valid:J,src_mac_hi:Z(16),src_mac_lo:Z(32),src_mac_valid:J,ethertype:Z(16),ethertype_valid:J,has_vlan:J,vlan_tci:Z(16),vlan_valid:J,payload_valid:J,frame_done:J,frame_length:Z(16),parse_state:Z(4)},state:{memory:new Map},eval:({memory:t})=>{const e=t??new Map,n=e.get(0)??0,i=(e.get(1)??0)>>>0,s=(e.get(2)??0)&65535,a=(e.get(3)??0)>>>0,c=(e.get(4)??0)&65535,u=(e.get(5)??0)&65535,d=(e.get(6)??0)&65535,h=(e.get(7)??0)!==0,p=(e.get(8)??0)&65535;return{dst_mac_hi:s,dst_mac_lo:i,dst_mac_valid:n>=2?1:0,src_mac_hi:c,src_mac_lo:a,src_mac_valid:n>=4?1:0,ethertype:u,ethertype_valid:n>=6?1:0,has_vlan:h?1:0,vlan_tci:d,vlan_valid:h&&n>=6?1:0,payload_valid:n===6||n===7?1:0,frame_done:n===7?1:0,frame_length:p,parse_state:n}},onTick:({tdata:t,tkeep:e,tvalid:n,tlast:i,memory:s})=>{const a=s??new Map;if(!n)return{memory:a};const c=t>>>0,u=e&15,d=!!i,h=0,p=1,m=2,y=3,b=4,x=5,w=6,S=7,E=8,D=0,T=2,C=3,R=4,A=5,O=6,k=7,H=new Map(a);let $=a.get(h)??D;const q=(u>>3&1)+(u>>2&1)+(u>>1&1)+(u&1),F=a.get(E)??0;H.set(E,F+q);const Q=c>>>24&255,B=c>>>16&255,P=c>>>8&255,j=c&255;switch($){case D:H.set(p,c),H.set(h,T);break;case T:H.set(m,Q<<8|B),H.set(y,P<<8|j),H.set(h,C);break;case C:H.set(b,a.get(y)??0),H.set(y,c),H.set(h,R);break;case R:{const I=(Q<<8|B)&65535;I===33024?(H.set(w,(P<<8|j)&65535),H.set(S,1),H.set(x,I),H.set(h,A)):(H.set(x,I),H.set(h,d?k:O));break}case A:H.set(x,(Q<<8|B)&65535),H.set(h,d?k:O);break;case O:d&&H.set(h,k);break}return d&&$!==k&&H.set(E,F+q),{memory:H}},meta:{category:"networking",icon:"EF",description:"Ethernet frame parser FSM"}}),eM=vt("Eth_CRC32",{inputs:{data:Z(32),data_valid:J,tkeep:Z(4),tlast:J,reset:J},outputs:{crc:Z(32),crc_ok:J},state:{memory:new Map},eval:({memory:t})=>{const e=t??new Map,n=(e.get(0)??4294967295)>>>0,i=(e.get(1)??0)!==0;return{crc:~n>>>0,crc_ok:i&&n===3736805603?1:0}},onTick:({data:t,data_valid:e,tkeep:n,tlast:i,reset:s,memory:a})=>{const c=a??new Map;if(s){const m=new Map(c);return m.set(0,4294967295),m.set(1,0),{memory:m}}if(!e)return{memory:c};const u=t>>>0,d=n&15;let h=(c.get(0)??4294967295)>>>0;for(let m=3;m>=0;m--)if(d>>m&1){const y=u>>>m*8&255;h=(KA[(h^y)&255]^h>>>8)>>>0}const p=new Map(c);return p.set(0,h),i&&p.set(1,1),{memory:p}},meta:{category:"networking",icon:"EC",description:"IEEE 802.3 CRC-32 checker"}}),nM=vt("MemBusMux",{inputs:{addr:Z(32),write_data:Z(32),mem_read:J,mem_write:J,funct3:Z(3),read_data_0:Z(32),read_data_1:Z(32),read_data_2:Z(32),read_data_3:Z(32),read_data_4:Z(32)},outputs:{local_addr:Z(32),write_data_out:Z(32),funct3_out:Z(3),read_data:Z(32),p0_read:J,p0_write:J,p1_read:J,p1_write:J,p2_read:J,p2_write:J,p3_read:J,p3_write:J,p4_read:J,p4_write:J},eval:({addr:t,write_data:e,mem_read:n,mem_write:i,funct3:s,read_data_0:a,read_data_1:c,read_data_2:u,read_data_3:d,read_data_4:h,base0:p,base1:m,base2:y,base3:b,base4:x,end0:w,end1:S,end2:E,end3:D,end4:T})=>{const C=(t??0)>>>0,R=(e??0)>>>0,A=(s??0)&7,O=[{base:(p??65536)>>>0,end:(w??131071)>>>0},{base:(m??2147483648)>>>0,end:(S??2147487743)>>>0},{base:(y??2147487744)>>>0,end:(E??2147491839)>>>0},{base:(b??2147491840)>>>0,end:(D??2147495935)>>>0},{base:(x??0)>>>0,end:(T??65535)>>>0}];let k=-1;for(let B=0;B<5;B++)if(C>=O[B].base&&C<=O[B].end){k=B;break}const H=k>=0?C-O[k].base>>>0:0,$=[a,c,u,d,h].map(B=>(B??0)>>>0),q=k>=0?$[k]:0,F=!!n,Q=!!i;return{local_addr:H,write_data_out:R,funct3_out:A,read_data:q,p0_read:k===0&&F?1:0,p0_write:k===0&&Q?1:0,p1_read:k===1&&F?1:0,p1_write:k===1&&Q?1:0,p2_read:k===2&&F?1:0,p2_write:k===2&&Q?1:0,p3_read:k===3&&F?1:0,p3_write:k===3&&Q?1:0,p4_read:k===4&&F?1:0,p4_write:k===4&&Q?1:0}},meta:{category:"rv32i",icon:"BUS",description:"Memory bus multiplexer"}}),oM=vt("UART_TX",{inputs:{addr:Z(32),write_data:Z(32),mem_read:J,mem_write:J},outputs:{read_data:Z(32)},state:{text:""},eval:({mem_read:t})=>({read_data:t?1:0}),onTick:({addr:t,write_data:e,mem_write:n,text:i})=>{if(!n)return{text:i};if(t>>>0!==0)return{text:i};const a=String.fromCharCode(e&255),c=(i??"")+a;return{text:c.length>4096?c.slice(-4096):c}},meta:{category:"io",icon:"TX",description:"UART transmitter",synthesizable:!1}}),iM=vt("NIC_FIFO",{inputs:{tx_addr:Z(32),tx_write_data:Z(32),tx_mem_read:J,tx_mem_write:J,rx_addr:Z(32),rx_mem_read:J,rx_mem_write:J,net_rx_data:Z(32),net_rx_valid:J,net_rx_frame:J},outputs:{tx_read_data:Z(32),rx_read_data:Z(32),net_tx_data:Z(32),net_tx_valid:J,net_tx_frame:J},state:{memory:new Map},eval:({tx_mem_read:t,rx_mem_read:e,tx_addr:n,rx_addr:i,memory:s})=>{const a=s??new Map;let c=0;t&&(n??0)>>>0===8&&(c=(a.get(8192)??0)-(a.get(8193)??0));let u=0;if(e){const x=(i??0)>>>0;x===0?u=(a.get(4096+(a.get(8209)??0))??0)>>>0:x===8&&(u=a.get(8210)??0)}const d=a.get(8196)??0,h=a.get(8195)??0,p=a.get(8192)??0;let m=0,y=0,b=0;return d&&h<p&&(m=(a.get(0+h)??0)>>>0,y=1,b=h+1>=p?1:0),{tx_read_data:c,rx_read_data:u,net_tx_data:m,net_tx_valid:y,net_tx_frame:b}},onTick:({tx_addr:t,tx_write_data:e,tx_mem_write:n,rx_addr:i,rx_mem_write:s,net_rx_data:a,net_rx_valid:c,memory:u})=>{const d=u??new Map,h=new Map(d);if(n){const m=(t??0)>>>0,y=(e??0)>>>0;if(m===0){const b=h.get(8192)??0;h.set(0+b,y),h.set(8192,b+1)}else m===12&&(h.set(8194,1),h.set(8195,0),h.set(8196,1))}if(d.get(8196)??0){const m=h.get(8195)??0,y=h.get(8192)??0;m<y&&(h.set(8195,m+1),m+1>=y&&(h.set(8196,0),h.set(8192,0),h.set(8193,0),h.set(8194,0)))}if(c){const m=(a??0)>>>0,y=h.get(8208)??0;h.set(4096+y,m),h.set(8208,y+1),h.set(8210,(h.get(8210)??0)+1)}if(s&&(i??0)>>>0===4){const y=h.get(8209)??0,b=h.get(8210)??0;b>0&&(h.set(8209,y+1),h.set(8210,b-1))}return{memory:h}},meta:{category:"networking",icon:"NIC",description:"Network interface FIFO",synthesizable:!1}}),rM=Object.freeze(Object.defineProperty({__proto__:null,Eth_AddrClassifier:WA,Eth_CRC32:eM,Eth_FrameInput:JA,Eth_FrameParser:tM,Eth_ProtocolDecoder:QA,MemBusMux:nM,NIC_FIFO:iM,UART_TX:oM},Symbol.toStringTag,{value:"Module"})),ty=t=>!!t&&typeof t=="object"&&"circuit"in t,sM=[...Object.values(sA),...Object.values(bA),...Object.values(NA),...Object.values(MA),...Object.values(VA),...Object.values(LA),...Object.values(UA),...Object.values(XA),...Object.values(ZA),...Object.values(rM)],aM=t=>{if(ty(t))return t;if(typeof t=="function")try{const e=t();return ty(e)?e:null}catch{return null}return null},lM=Object.freeze(sM.map(aM).filter(t=>t!==null));function cM(t,e){const n=new Map;for(const i of e)n.set(i.name,ny(ey(i,new Map)));return ny(ey(t,n))}function ey(t,e){const n={};for(const a of t.inputs)n[a.name]=a;const i={};for(const a of t.outputs)i[a.name]=a;const s={};for(const a of t.nodes)s[a.id]=a;return{circuit:t,inputs:n,outputs:i,nodes:s,_dependencies:e}}function ny(t){return Object.defineProperty(t,"toJSON",{value:function(){const e={};for(const[n,i]of this._dependencies)e[n]=i;return{circuit:this.circuit,_dependencies:e}},enumerable:!1}),t}function uM(t,e,n){if(t.inputs.length===0&&t.outputs.length===0)return t;e.resolveCircuit(t.name)||e.addCircuit(t);const i=`${t.name}Demo`,s=[],a=[];let c=0;s.push({id:"dut",componentRef:t.name,arguments:{},inputs:t.inputs.map(u=>({id:`dut.${u.name}`,name:u.name,portType:u.portType})),outputs:t.outputs.map(u=>({id:`dut.${u.name}`,name:u.name,portType:u.portType})),clocks:t.clocks.map(u=>({id:`dut.${u.name}`,name:u.name}))});for(const u of t.inputs){const d=u.portType.kind==="bit",h={};!d&&u.portType.kind==="bus"&&(h.width=u.portType.width),n&&u.name in n&&(h.value=n[u.name]),s.push({id:u.name,label:u.name,componentRef:d?"Switch":"Input",arguments:h,inputs:[],outputs:[{id:`${u.name}.out`,name:"out",portType:u.portType}],clocks:[]}),a.push({id:`c${c++}`,source:{nodeId:u.name,portName:"out"},target:{nodeId:"dut",portName:u.name},portType:u.portType})}for(const u of t.outputs){const d=u.portType.kind==="bit",h={};!d&&u.portType.kind==="bus"&&(h.width=u.portType.width),s.push({id:u.name,label:u.name,componentRef:d?"Led":"HexDisplay",arguments:h,inputs:[{id:`${u.name}.in`,name:"in",portType:u.portType}],outputs:[],clocks:[]}),a.push({id:`c${c++}`,source:{nodeId:"dut",portName:u.name},target:{nodeId:u.name,portName:"in"},portType:u.portType})}return{version:1,name:i,inputs:[],outputs:[],clocks:[],state:[],nodes:s,connections:a,implementation:{kind:"composite"},metadata:{description:`Auto-generated harness for ${t.name}`}}}function vd(t,e,n=new Set){if(!t||n.has(t.name))return!1;if(n.add(t.name),t.clocks?.length>0||t.state?.length>0)return!0;for(const i of t.nodes){const s=e(i.componentRef);if(s&&vd(s,e,n))return!0}return!1}const oy=new Set(lM.map(t=>t.circuit.name));class ic extends Error{constructor(e){super(e),this.name="CircuitToSourceError"}}function fM(t){const e=new Map;for(const[s,a]of t._dependencies)oy.has(s)||e.set(s,a.circuit);for(const s of t.circuit.nodes)if(!oy.has(s.componentRef)&&!e.has(s.componentRef)){const a=t._dependencies.get(s.componentRef);a&&e.set(s.componentRef,a.circuit)}const n=[],i=dM(e);for(const s of i)n.push(iy(s)),n.push("");return n.push(iy(t.circuit)),n.join(`
|
|
12
|
-
`)}function
|
|
8
|
+
`+f.stack}}var vt=Object.prototype.hasOwnProperty,mt=t.unstable_scheduleCallback,Ct=t.unstable_cancelCallback,It=t.unstable_shouldYield,zt=t.unstable_requestPaint,Vt=t.unstable_now,ve=t.unstable_getCurrentPriorityLevel,Wt=t.unstable_ImmediatePriority,je=t.unstable_UserBlockingPriority,xn=t.unstable_NormalPriority,Pa=t.unstable_LowPriority,Hn=t.unstable_IdlePriority,tr=t.log,Ba=t.unstable_setDisableYieldValue,Re=null,me=null;function le(i){if(typeof tr=="function"&&Ba(i),me&&typeof me.setStrictMode=="function")try{me.setStrictMode(Re,i)}catch{}}var ze=Math.clz32?Math.clz32:dm,um=Math.log,fm=Math.LN2;function dm(i){return i>>>=0,i===0?32:31-(um(i)/fm|0)|0}var es=256,ns=262144,is=4194304;function xi(i){var r=i&42;if(r!==0)return r;switch(i&-i){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 i&261888;case 262144:case 524288:case 1048576:case 2097152:return i&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return i&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return i}}function os(i,r,c){var f=i.pendingLanes;if(f===0)return 0;var g=0,v=i.suspendedLanes,T=i.pingedLanes;i=i.warmLanes;var V=f&134217727;return V!==0?(f=V&~v,f!==0?g=xi(f):(T&=V,T!==0?g=xi(T):c||(c=V&~i,c!==0&&(g=xi(c))))):(V=f&~v,V!==0?g=xi(V):T!==0?g=xi(T):c||(c=f&~i,c!==0&&(g=xi(c)))),g===0?0:r!==0&&r!==g&&(r&v)===0&&(v=g&-g,c=r&-r,v>=c||v===32&&(c&4194048)!==0)?r:g}function er(i,r){return(i.pendingLanes&~(i.suspendedLanes&~i.pingedLanes)&r)===0}function hm(i,r){switch(i){case 1:case 2:case 4:case 8:case 64:return r+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 r+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 yu(){var i=is;return is<<=1,(is&62914560)===0&&(is=4194304),i}function Ha(i){for(var r=[],c=0;31>c;c++)r.push(i);return r}function nr(i,r){i.pendingLanes|=r,r!==268435456&&(i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0)}function pm(i,r,c,f,g,v){var T=i.pendingLanes;i.pendingLanes=c,i.suspendedLanes=0,i.pingedLanes=0,i.warmLanes=0,i.expiredLanes&=c,i.entangledLanes&=c,i.errorRecoveryDisabledLanes&=c,i.shellSuspendCounter=0;var V=i.entanglements,Z=i.expirationTimes,nt=i.hiddenUpdates;for(c=T&~c;0<c;){var st=31-ze(c),lt=1<<st;V[st]=0,Z[st]=-1;var it=nt[st];if(it!==null)for(nt[st]=null,st=0;st<it.length;st++){var ot=it[st];ot!==null&&(ot.lane&=-536870913)}c&=~lt}f!==0&&vu(i,f,0),v!==0&&g===0&&i.tag!==0&&(i.suspendedLanes|=v&~(T&~r))}function vu(i,r,c){i.pendingLanes|=r,i.suspendedLanes&=~r;var f=31-ze(r);i.entangledLanes|=r,i.entanglements[f]=i.entanglements[f]|1073741824|c&261930}function bu(i,r){var c=i.entangledLanes|=r;for(i=i.entanglements;c;){var f=31-ze(c),g=1<<f;g&r|i[f]&r&&(i[f]|=r),c&=~g}}function xu(i,r){var c=r&-r;return c=(c&42)!==0?1:Ua(c),(c&(i.suspendedLanes|r))!==0?0:c}function Ua(i){switch(i){case 2:i=1;break;case 8:i=4;break;case 32:i=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:i=128;break;case 268435456:i=134217728;break;default:i=0}return i}function $a(i){return i&=-i,2<i?8<i?(i&134217727)!==0?32:268435456:8:2}function wu(){var i=I.p;return i!==0?i:(i=window.event,i===void 0?32:pN(i.type))}function _u(i,r){var c=I.p;try{return I.p=i,r()}finally{I.p=c}}var ri=Math.random().toString(36).slice(2),ke="__reactFiber$"+ri,Ye="__reactProps$"+ri,wi="__reactContainer$"+ri,rs="__reactEvents$"+ri,Su="__reactListeners$"+ri,mm="__reactHandles$"+ri,Eu="__reactResources$"+ri,ir="__reactMarker$"+ri;function Ya(i){delete i[ke],delete i[Ye],delete i[rs],delete i[Su],delete i[mm]}function no(i){var r=i[ke];if(r)return r;for(var c=i.parentNode;c;){if(r=c[wi]||c[ke]){if(c=r.alternate,r.child!==null||c!==null&&c.child!==null)for(i=WT(i);i!==null;){if(c=i[ke])return c;i=WT(i)}return r}i=c,c=i.parentNode}return null}function io(i){if(i=i[ke]||i[wi]){var r=i.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return i}return null}function oo(i){var r=i.tag;if(r===5||r===26||r===27||r===6)return i.stateNode;throw Error(o(33))}function ro(i){var r=i[Eu];return r||(r=i[Eu]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function Se(i){i[ir]=!0}var Cu=new Set,Tu={};function _i(i,r){so(i,r),so(i+"Capture",r)}function so(i,r){for(Tu[i]=r,i=0;i<r.length;i++)Cu.add(r[i])}var gm=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]*$"),qa={},Nu={};function ym(i){return vt.call(Nu,i)?!0:vt.call(qa,i)?!1:gm.test(i)?Nu[i]=!0:(qa[i]=!0,!1)}function ss(i,r,c){if(ym(r))if(c===null)i.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":i.removeAttribute(r);return;case"boolean":var f=r.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){i.removeAttribute(r);return}}i.setAttribute(r,""+c)}}function as(i,r,c){if(c===null)i.removeAttribute(r);else{switch(typeof c){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(r);return}i.setAttribute(r,""+c)}}function Un(i,r,c,f){if(f===null)i.removeAttribute(c);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":i.removeAttribute(c);return}i.setAttributeNS(r,c,""+f)}}function Ke(i){switch(typeof i){case"bigint":case"boolean":case"number":case"string":case"undefined":return i;case"object":return i;default:return""}}function Au(i){var r=i.type;return(i=i.nodeName)&&i.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function vm(i,r,c){var f=Object.getOwnPropertyDescriptor(i.constructor.prototype,r);if(!i.hasOwnProperty(r)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var g=f.get,v=f.set;return Object.defineProperty(i,r,{configurable:!0,get:function(){return g.call(this)},set:function(T){c=""+T,v.call(this,T)}}),Object.defineProperty(i,r,{enumerable:f.enumerable}),{getValue:function(){return c},setValue:function(T){c=""+T},stopTracking:function(){i._valueTracker=null,delete i[r]}}}}function ls(i){if(!i._valueTracker){var r=Au(i)?"checked":"value";i._valueTracker=vm(i,r,""+i[r])}}function Mu(i){if(!i)return!1;var r=i._valueTracker;if(!r)return!0;var c=r.getValue(),f="";return i&&(f=Au(i)?i.checked?"true":"false":i.value),i=f,i!==c?(r.setValue(i),!0):!1}function or(i){if(i=i||(typeof document<"u"?document:void 0),typeof i>"u")return null;try{return i.activeElement||i.body}catch{return i.body}}var bm=/[\n"\\]/g;function Qe(i){return i.replace(bm,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function rr(i,r,c,f,g,v,T,V){i.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?i.type=T:i.removeAttribute("type"),r!=null?T==="number"?(r===0&&i.value===""||i.value!=r)&&(i.value=""+Ke(r)):i.value!==""+Ke(r)&&(i.value=""+Ke(r)):T!=="submit"&&T!=="reset"||i.removeAttribute("value"),r!=null?Ga(i,T,Ke(r)):c!=null?Ga(i,T,Ke(c)):f!=null&&i.removeAttribute("value"),g==null&&v!=null&&(i.defaultChecked=!!v),g!=null&&(i.checked=g&&typeof g!="function"&&typeof g!="symbol"),V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"?i.name=""+Ke(V):i.removeAttribute("name")}function Ru(i,r,c,f,g,v,T,V){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(i.type=v),r!=null||c!=null){if(!(v!=="submit"&&v!=="reset"||r!=null)){ls(i);return}c=c!=null?""+Ke(c):"",r=r!=null?""+Ke(r):c,V||r===i.value||(i.value=r),i.defaultValue=r}f=f??g,f=typeof f!="function"&&typeof f!="symbol"&&!!f,i.checked=V?i.checked:!!f,i.defaultChecked=!!f,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(i.name=T),ls(i)}function Ga(i,r,c){r==="number"&&or(i.ownerDocument)===i||i.defaultValue===""+c||(i.defaultValue=""+c)}function Si(i,r,c,f){if(i=i.options,r){r={};for(var g=0;g<c.length;g++)r["$"+c[g]]=!0;for(c=0;c<i.length;c++)g=r.hasOwnProperty("$"+i[c].value),i[c].selected!==g&&(i[c].selected=g),g&&f&&(i[c].defaultSelected=!0)}else{for(c=""+Ke(c),r=null,g=0;g<i.length;g++){if(i[g].value===c){i[g].selected=!0,f&&(i[g].defaultSelected=!0);return}r!==null||i[g].disabled||(r=i[g])}r!==null&&(r.selected=!0)}}function P2(i,r,c){if(r!=null&&(r=""+Ke(r),r!==i.value&&(i.value=r),c==null)){i.defaultValue!==r&&(i.defaultValue=r);return}i.defaultValue=c!=null?""+Ke(c):""}function B2(i,r,c,f){if(r==null){if(f!=null){if(c!=null)throw Error(o(92));if(H(f)){if(1<f.length)throw Error(o(93));f=f[0]}c=f}c==null&&(c=""),r=c}c=Ke(r),i.defaultValue=c,f=i.textContent,f===c&&f!==""&&f!==null&&(i.value=f),ls(i)}function cs(i,r){if(r){var c=i.firstChild;if(c&&c===i.lastChild&&c.nodeType===3){c.nodeValue=r;return}}i.textContent=r}var U9=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 H2(i,r,c){var f=r.indexOf("--")===0;c==null||typeof c=="boolean"||c===""?f?i.setProperty(r,""):r==="float"?i.cssFloat="":i[r]="":f?i.setProperty(r,c):typeof c!="number"||c===0||U9.has(r)?r==="float"?i.cssFloat=c:i[r]=(""+c).trim():i[r]=c+"px"}function U2(i,r,c){if(r!=null&&typeof r!="object")throw Error(o(62));if(i=i.style,c!=null){for(var f in c)!c.hasOwnProperty(f)||r!=null&&r.hasOwnProperty(f)||(f.indexOf("--")===0?i.setProperty(f,""):f==="float"?i.cssFloat="":i[f]="");for(var g in r)f=r[g],r.hasOwnProperty(g)&&c[g]!==f&&H2(i,g,f)}else for(var v in r)r.hasOwnProperty(v)&&H2(i,v,r[v])}function xm(i){if(i.indexOf("-")===-1)return!1;switch(i){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 $9=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"]]),Y9=/^[\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 ku(i){return Y9.test(""+i)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":i}function Ei(){}var wm=null;function _m(i){return i=i.target||i.srcElement||window,i.correspondingUseElement&&(i=i.correspondingUseElement),i.nodeType===3?i.parentNode:i}var us=null,fs=null;function $2(i){var r=io(i);if(r&&(i=r.stateNode)){var c=i[Ye]||null;t:switch(i=r.stateNode,r.type){case"input":if(rr(i,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name),r=c.name,c.type==="radio"&&r!=null){for(c=i;c.parentNode;)c=c.parentNode;for(c=c.querySelectorAll('input[name="'+Qe(""+r)+'"][type="radio"]'),r=0;r<c.length;r++){var f=c[r];if(f!==i&&f.form===i.form){var g=f[Ye]||null;if(!g)throw Error(o(90));rr(f,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(r=0;r<c.length;r++)f=c[r],f.form===i.form&&Mu(f)}break t;case"textarea":P2(i,c.value,c.defaultValue);break t;case"select":r=c.value,r!=null&&Si(i,!!c.multiple,r,!1)}}}var Sm=!1;function Y2(i,r,c){if(Sm)return i(r,c);Sm=!0;try{var f=i(r);return f}finally{if(Sm=!1,(us!==null||fs!==null)&&(bf(),us&&(r=us,i=fs,fs=us=null,$2(r),i)))for(r=0;r<i.length;r++)$2(i[r])}}function Fa(i,r){var c=i.stateNode;if(c===null)return null;var f=c[Ye]||null;if(f===null)return null;c=f[r];t:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(i=i.type,f=!(i==="button"||i==="input"||i==="select"||i==="textarea")),i=!f;break t;default:i=!1}if(i)return null;if(c&&typeof c!="function")throw Error(o(231,r,typeof c));return c}var Ci=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Em=!1;if(Ci)try{var Xa={};Object.defineProperty(Xa,"passive",{get:function(){Em=!0}}),window.addEventListener("test",Xa,Xa),window.removeEventListener("test",Xa,Xa)}catch{Em=!1}var ao=null,Cm=null,Ou=null;function q2(){if(Ou)return Ou;var i,r=Cm,c=r.length,f,g="value"in ao?ao.value:ao.textContent,v=g.length;for(i=0;i<c&&r[i]===g[i];i++);var T=c-i;for(f=1;f<=T&&r[c-f]===g[v-f];f++);return Ou=g.slice(i,1<f?1-f:void 0)}function Du(i){var r=i.keyCode;return"charCode"in i?(i=i.charCode,i===0&&r===13&&(i=13)):i=r,i===10&&(i=13),32<=i||i===13?i:0}function ju(){return!0}function G2(){return!1}function We(i){function r(c,f,g,v,T){this._reactName=c,this._targetInst=g,this.type=f,this.nativeEvent=v,this.target=T,this.currentTarget=null;for(var V in i)i.hasOwnProperty(V)&&(c=i[V],this[V]=c?c(v):v[V]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?ju:G2,this.isPropagationStopped=G2,this}return m(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var c=this.nativeEvent;c&&(c.preventDefault?c.preventDefault():typeof c.returnValue!="unknown"&&(c.returnValue=!1),this.isDefaultPrevented=ju)},stopPropagation:function(){var c=this.nativeEvent;c&&(c.stopPropagation?c.stopPropagation():typeof c.cancelBubble!="unknown"&&(c.cancelBubble=!0),this.isPropagationStopped=ju)},persist:function(){},isPersistent:ju}),r}var sr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(i){return i.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},zu=We(sr),Za=m({},sr,{view:0,detail:0}),q9=We(Za),Tm,Nm,Ka,Vu=m({},Za,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mm,button:0,buttons:0,relatedTarget:function(i){return i.relatedTarget===void 0?i.fromElement===i.srcElement?i.toElement:i.fromElement:i.relatedTarget},movementX:function(i){return"movementX"in i?i.movementX:(i!==Ka&&(Ka&&i.type==="mousemove"?(Tm=i.screenX-Ka.screenX,Nm=i.screenY-Ka.screenY):Nm=Tm=0,Ka=i),Tm)},movementY:function(i){return"movementY"in i?i.movementY:Nm}}),F2=We(Vu),G9=m({},Vu,{dataTransfer:0}),F9=We(G9),X9=m({},Za,{relatedTarget:0}),Am=We(X9),Z9=m({},sr,{animationName:0,elapsedTime:0,pseudoElement:0}),K9=We(Z9),Q9=m({},sr,{clipboardData:function(i){return"clipboardData"in i?i.clipboardData:window.clipboardData}}),W9=We(Q9),J9=m({},sr,{data:0}),X2=We(J9),t$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},e$={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"},n$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function i$(i){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(i):(i=n$[i])?!!r[i]:!1}function Mm(){return i$}var o$=m({},Za,{key:function(i){if(i.key){var r=t$[i.key]||i.key;if(r!=="Unidentified")return r}return i.type==="keypress"?(i=Du(i),i===13?"Enter":String.fromCharCode(i)):i.type==="keydown"||i.type==="keyup"?e$[i.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mm,charCode:function(i){return i.type==="keypress"?Du(i):0},keyCode:function(i){return i.type==="keydown"||i.type==="keyup"?i.keyCode:0},which:function(i){return i.type==="keypress"?Du(i):i.type==="keydown"||i.type==="keyup"?i.keyCode:0}}),r$=We(o$),s$=m({},Vu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),Z2=We(s$),a$=m({},Za,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mm}),l$=We(a$),c$=m({},sr,{propertyName:0,elapsedTime:0,pseudoElement:0}),u$=We(c$),f$=m({},Vu,{deltaX:function(i){return"deltaX"in i?i.deltaX:"wheelDeltaX"in i?-i.wheelDeltaX:0},deltaY:function(i){return"deltaY"in i?i.deltaY:"wheelDeltaY"in i?-i.wheelDeltaY:"wheelDelta"in i?-i.wheelDelta:0},deltaZ:0,deltaMode:0}),d$=We(f$),h$=m({},sr,{newState:0,oldState:0}),p$=We(h$),m$=[9,13,27,32],Rm=Ci&&"CompositionEvent"in window,Qa=null;Ci&&"documentMode"in document&&(Qa=document.documentMode);var g$=Ci&&"TextEvent"in window&&!Qa,K2=Ci&&(!Rm||Qa&&8<Qa&&11>=Qa),Q2=" ",W2=!1;function J2(i,r){switch(i){case"keyup":return m$.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function tE(i){return i=i.detail,typeof i=="object"&&"data"in i?i.data:null}var ds=!1;function y$(i,r){switch(i){case"compositionend":return tE(r);case"keypress":return r.which!==32?null:(W2=!0,Q2);case"textInput":return i=r.data,i===Q2&&W2?null:i;default:return null}}function v$(i,r){if(ds)return i==="compositionend"||!Rm&&J2(i,r)?(i=q2(),Ou=Cm=ao=null,ds=!1,i):null;switch(i){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return K2&&r.locale!=="ko"?null:r.data;default:return null}}var b$={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 eE(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r==="input"?!!b$[i.type]:r==="textarea"}function nE(i,r,c,f){us?fs?fs.push(f):fs=[f]:us=f,r=Tf(r,"onChange"),0<r.length&&(c=new zu("onChange","change",null,c,f),i.push({event:c,listeners:r}))}var Wa=null,Ja=null;function x$(i){IT(i,0)}function Lu(i){var r=oo(i);if(Mu(r))return i}function iE(i,r){if(i==="change")return r}var oE=!1;if(Ci){var km;if(Ci){var Om="oninput"in document;if(!Om){var rE=document.createElement("div");rE.setAttribute("oninput","return;"),Om=typeof rE.oninput=="function"}km=Om}else km=!1;oE=km&&(!document.documentMode||9<document.documentMode)}function sE(){Wa&&(Wa.detachEvent("onpropertychange",aE),Ja=Wa=null)}function aE(i){if(i.propertyName==="value"&&Lu(Ja)){var r=[];nE(r,Ja,i,_m(i)),Y2(x$,r)}}function w$(i,r,c){i==="focusin"?(sE(),Wa=r,Ja=c,Wa.attachEvent("onpropertychange",aE)):i==="focusout"&&sE()}function _$(i){if(i==="selectionchange"||i==="keyup"||i==="keydown")return Lu(Ja)}function S$(i,r){if(i==="click")return Lu(r)}function E$(i,r){if(i==="input"||i==="change")return Lu(r)}function C$(i,r){return i===r&&(i!==0||1/i===1/r)||i!==i&&r!==r}var cn=typeof Object.is=="function"?Object.is:C$;function tl(i,r){if(cn(i,r))return!0;if(typeof i!="object"||i===null||typeof r!="object"||r===null)return!1;var c=Object.keys(i),f=Object.keys(r);if(c.length!==f.length)return!1;for(f=0;f<c.length;f++){var g=c[f];if(!vt.call(r,g)||!cn(i[g],r[g]))return!1}return!0}function lE(i){for(;i&&i.firstChild;)i=i.firstChild;return i}function cE(i,r){var c=lE(i);i=0;for(var f;c;){if(c.nodeType===3){if(f=i+c.textContent.length,i<=r&&f>=r)return{node:c,offset:r-i};i=f}t:{for(;c;){if(c.nextSibling){c=c.nextSibling;break t}c=c.parentNode}c=void 0}c=lE(c)}}function uE(i,r){return i&&r?i===r?!0:i&&i.nodeType===3?!1:r&&r.nodeType===3?uE(i,r.parentNode):"contains"in i?i.contains(r):i.compareDocumentPosition?!!(i.compareDocumentPosition(r)&16):!1:!1}function fE(i){i=i!=null&&i.ownerDocument!=null&&i.ownerDocument.defaultView!=null?i.ownerDocument.defaultView:window;for(var r=or(i.document);r instanceof i.HTMLIFrameElement;){try{var c=typeof r.contentWindow.location.href=="string"}catch{c=!1}if(c)i=r.contentWindow;else break;r=or(i.document)}return r}function Dm(i){var r=i&&i.nodeName&&i.nodeName.toLowerCase();return r&&(r==="input"&&(i.type==="text"||i.type==="search"||i.type==="tel"||i.type==="url"||i.type==="password")||r==="textarea"||i.contentEditable==="true")}var T$=Ci&&"documentMode"in document&&11>=document.documentMode,hs=null,jm=null,el=null,zm=!1;function dE(i,r,c){var f=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;zm||hs==null||hs!==or(f)||(f=hs,"selectionStart"in f&&Dm(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),el&&tl(el,f)||(el=f,f=Tf(jm,"onSelect"),0<f.length&&(r=new zu("onSelect","select",null,r,c),i.push({event:r,listeners:f}),r.target=hs)))}function ar(i,r){var c={};return c[i.toLowerCase()]=r.toLowerCase(),c["Webkit"+i]="webkit"+r,c["Moz"+i]="moz"+r,c}var ps={animationend:ar("Animation","AnimationEnd"),animationiteration:ar("Animation","AnimationIteration"),animationstart:ar("Animation","AnimationStart"),transitionrun:ar("Transition","TransitionRun"),transitionstart:ar("Transition","TransitionStart"),transitioncancel:ar("Transition","TransitionCancel"),transitionend:ar("Transition","TransitionEnd")},Vm={},hE={};Ci&&(hE=document.createElement("div").style,"AnimationEvent"in window||(delete ps.animationend.animation,delete ps.animationiteration.animation,delete ps.animationstart.animation),"TransitionEvent"in window||delete ps.transitionend.transition);function lr(i){if(Vm[i])return Vm[i];if(!ps[i])return i;var r=ps[i],c;for(c in r)if(r.hasOwnProperty(c)&&c in hE)return Vm[i]=r[c];return i}var pE=lr("animationend"),mE=lr("animationiteration"),gE=lr("animationstart"),N$=lr("transitionrun"),A$=lr("transitionstart"),M$=lr("transitioncancel"),yE=lr("transitionend"),vE=new Map,Lm="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(" ");Lm.push("scrollEnd");function $n(i,r){vE.set(i,r),_i(r,[i])}var Iu=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},wn=[],ms=0,Im=0;function Pu(){for(var i=ms,r=Im=ms=0;r<i;){var c=wn[r];wn[r++]=null;var f=wn[r];wn[r++]=null;var g=wn[r];wn[r++]=null;var v=wn[r];if(wn[r++]=null,f!==null&&g!==null){var T=f.pending;T===null?g.next=g:(g.next=T.next,T.next=g),f.pending=g}v!==0&&bE(c,g,v)}}function Bu(i,r,c,f){wn[ms++]=i,wn[ms++]=r,wn[ms++]=c,wn[ms++]=f,Im|=f,i.lanes|=f,i=i.alternate,i!==null&&(i.lanes|=f)}function Pm(i,r,c,f){return Bu(i,r,c,f),Hu(i)}function cr(i,r){return Bu(i,null,null,r),Hu(i)}function bE(i,r,c){i.lanes|=c;var f=i.alternate;f!==null&&(f.lanes|=c);for(var g=!1,v=i.return;v!==null;)v.childLanes|=c,f=v.alternate,f!==null&&(f.childLanes|=c),v.tag===22&&(i=v.stateNode,i===null||i._visibility&1||(g=!0)),i=v,v=v.return;return i.tag===3?(v=i.stateNode,g&&r!==null&&(g=31-ze(c),i=v.hiddenUpdates,f=i[g],f===null?i[g]=[r]:f.push(r),r.lane=c|536870912),v):null}function Hu(i){if(50<Sl)throw Sl=0,Xg=null,Error(o(185));for(var r=i.return;r!==null;)i=r,r=i.return;return i.tag===3?i.stateNode:null}var gs={};function R$(i,r,c,f){this.tag=i,this.key=c,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function un(i,r,c,f){return new R$(i,r,c,f)}function Bm(i){return i=i.prototype,!(!i||!i.isReactComponent)}function Ti(i,r){var c=i.alternate;return c===null?(c=un(i.tag,r,i.key,i.mode),c.elementType=i.elementType,c.type=i.type,c.stateNode=i.stateNode,c.alternate=i,i.alternate=c):(c.pendingProps=r,c.type=i.type,c.flags=0,c.subtreeFlags=0,c.deletions=null),c.flags=i.flags&65011712,c.childLanes=i.childLanes,c.lanes=i.lanes,c.child=i.child,c.memoizedProps=i.memoizedProps,c.memoizedState=i.memoizedState,c.updateQueue=i.updateQueue,r=i.dependencies,c.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},c.sibling=i.sibling,c.index=i.index,c.ref=i.ref,c.refCleanup=i.refCleanup,c}function xE(i,r){i.flags&=65011714;var c=i.alternate;return c===null?(i.childLanes=0,i.lanes=r,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=c.childLanes,i.lanes=c.lanes,i.child=c.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=c.memoizedProps,i.memoizedState=c.memoizedState,i.updateQueue=c.updateQueue,i.type=c.type,r=c.dependencies,i.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),i}function Uu(i,r,c,f,g,v){var T=0;if(f=i,typeof i=="function")Bm(i)&&(T=1);else if(typeof i=="string")T=z7(i,c,rt.current)?26:i==="html"||i==="head"||i==="body"?27:5;else t:switch(i){case U:return i=un(31,c,r,g),i.elementType=U,i.lanes=v,i;case w:return ur(c.children,g,v,r);case _:T=8,g|=24;break;case S:return i=un(12,c,r,g|2),i.elementType=S,i.lanes=v,i;case R:return i=un(13,c,r,g),i.elementType=R,i.lanes=v,i;case A:return i=un(19,c,r,g),i.elementType=A,i.lanes=v,i;default:if(typeof i=="object"&&i!==null)switch(i.$$typeof){case C:T=10;break t;case k:T=9;break t;case E:T=11;break t;case O:T=14;break t;case D:T=16,f=null;break t}T=29,c=Error(o(130,i===null?"null":typeof i,"")),f=null}return r=un(T,c,r,g),r.elementType=i,r.type=f,r.lanes=v,r}function ur(i,r,c,f){return i=un(7,i,f,r),i.lanes=c,i}function Hm(i,r,c){return i=un(6,i,null,r),i.lanes=c,i}function wE(i){var r=un(18,null,null,0);return r.stateNode=i,r}function Um(i,r,c){return r=un(4,i.children!==null?i.children:[],i.key,r),r.lanes=c,r.stateNode={containerInfo:i.containerInfo,pendingChildren:null,implementation:i.implementation},r}var _E=new WeakMap;function _n(i,r){if(typeof i=="object"&&i!==null){var c=_E.get(i);return c!==void 0?c:(r={value:i,source:r,stack:yt(r)},_E.set(i,r),r)}return{value:i,source:r,stack:yt(r)}}var ys=[],vs=0,$u=null,nl=0,Sn=[],En=0,lo=null,si=1,ai="";function Ni(i,r){ys[vs++]=nl,ys[vs++]=$u,$u=i,nl=r}function SE(i,r,c){Sn[En++]=si,Sn[En++]=ai,Sn[En++]=lo,lo=i;var f=si;i=ai;var g=32-ze(f)-1;f&=~(1<<g),c+=1;var v=32-ze(r)+g;if(30<v){var T=g-g%5;v=(f&(1<<T)-1).toString(32),f>>=T,g-=T,si=1<<32-ze(r)+g|c<<g|f,ai=v+i}else si=1<<v|c<<g|f,ai=i}function $m(i){i.return!==null&&(Ni(i,1),SE(i,1,0))}function Ym(i){for(;i===$u;)$u=ys[--vs],ys[vs]=null,nl=ys[--vs],ys[vs]=null;for(;i===lo;)lo=Sn[--En],Sn[En]=null,ai=Sn[--En],Sn[En]=null,si=Sn[--En],Sn[En]=null}function EE(i,r){Sn[En++]=si,Sn[En++]=ai,Sn[En++]=lo,si=r.id,ai=r.overflow,lo=i}var Ie=null,ce=null,qt=!1,co=null,Cn=!1,qm=Error(o(519));function uo(i){var r=Error(o(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw il(_n(r,i)),qm}function CE(i){var r=i.stateNode,c=i.type,f=i.memoizedProps;switch(r[ke]=i,r[Ye]=f,c){case"dialog":Ut("cancel",r),Ut("close",r);break;case"iframe":case"object":case"embed":Ut("load",r);break;case"video":case"audio":for(c=0;c<Cl.length;c++)Ut(Cl[c],r);break;case"source":Ut("error",r);break;case"img":case"image":case"link":Ut("error",r),Ut("load",r);break;case"details":Ut("toggle",r);break;case"input":Ut("invalid",r),Ru(r,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Ut("invalid",r);break;case"textarea":Ut("invalid",r),B2(r,f.value,f.defaultValue,f.children)}c=f.children,typeof c!="string"&&typeof c!="number"&&typeof c!="bigint"||r.textContent===""+c||f.suppressHydrationWarning===!0||UT(r.textContent,c)?(f.popover!=null&&(Ut("beforetoggle",r),Ut("toggle",r)),f.onScroll!=null&&Ut("scroll",r),f.onScrollEnd!=null&&Ut("scrollend",r),f.onClick!=null&&(r.onclick=Ei),r=!0):r=!1,r||uo(i,!0)}function TE(i){for(Ie=i.return;Ie;)switch(Ie.tag){case 5:case 31:case 13:Cn=!1;return;case 27:case 3:Cn=!0;return;default:Ie=Ie.return}}function bs(i){if(i!==Ie)return!1;if(!qt)return TE(i),qt=!0,!1;var r=i.tag,c;if((c=r!==3&&r!==27)&&((c=r===5)&&(c=i.type,c=!(c!=="form"&&c!=="button")||c0(i.type,i.memoizedProps)),c=!c),c&&ce&&uo(i),TE(i),r===13){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(o(317));ce=QT(i)}else if(r===31){if(i=i.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(o(317));ce=QT(i)}else r===27?(r=ce,Co(i.type)?(i=p0,p0=null,ce=i):ce=r):ce=Ie?Nn(i.stateNode.nextSibling):null;return!0}function fr(){ce=Ie=null,qt=!1}function Gm(){var i=co;return i!==null&&(nn===null?nn=i:nn.push.apply(nn,i),co=null),i}function il(i){co===null?co=[i]:co.push(i)}var Fm=L(null),dr=null,Ai=null;function fo(i,r,c){et(Fm,r._currentValue),r._currentValue=c}function Mi(i){i._currentValue=Fm.current,F(Fm)}function Xm(i,r,c){for(;i!==null;){var f=i.alternate;if((i.childLanes&r)!==r?(i.childLanes|=r,f!==null&&(f.childLanes|=r)):f!==null&&(f.childLanes&r)!==r&&(f.childLanes|=r),i===c)break;i=i.return}}function Zm(i,r,c,f){var g=i.child;for(g!==null&&(g.return=i);g!==null;){var v=g.dependencies;if(v!==null){var T=g.child;v=v.firstContext;t:for(;v!==null;){var V=v;v=g;for(var Z=0;Z<r.length;Z++)if(V.context===r[Z]){v.lanes|=c,V=v.alternate,V!==null&&(V.lanes|=c),Xm(v.return,c,i),f||(T=null);break t}v=V.next}}else if(g.tag===18){if(T=g.return,T===null)throw Error(o(341));T.lanes|=c,v=T.alternate,v!==null&&(v.lanes|=c),Xm(T,c,i),T=null}else T=g.child;if(T!==null)T.return=g;else for(T=g;T!==null;){if(T===i){T=null;break}if(g=T.sibling,g!==null){g.return=T.return,T=g;break}T=T.return}g=T}}function xs(i,r,c,f){i=null;for(var g=r,v=!1;g!==null;){if(!v){if((g.flags&524288)!==0)v=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var T=g.alternate;if(T===null)throw Error(o(387));if(T=T.memoizedProps,T!==null){var V=g.type;cn(g.pendingProps.value,T.value)||(i!==null?i.push(V):i=[V])}}else if(g===ft.current){if(T=g.alternate,T===null)throw Error(o(387));T.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(i!==null?i.push(Rl):i=[Rl])}g=g.return}i!==null&&Zm(r,i,c,f),r.flags|=262144}function Yu(i){for(i=i.firstContext;i!==null;){if(!cn(i.context._currentValue,i.memoizedValue))return!0;i=i.next}return!1}function hr(i){dr=i,Ai=null,i=i.dependencies,i!==null&&(i.firstContext=null)}function Pe(i){return NE(dr,i)}function qu(i,r){return dr===null&&hr(i),NE(i,r)}function NE(i,r){var c=r._currentValue;if(r={context:r,memoizedValue:c,next:null},Ai===null){if(i===null)throw Error(o(308));Ai=r,i.dependencies={lanes:0,firstContext:r},i.flags|=524288}else Ai=Ai.next=r;return c}var k$=typeof AbortController<"u"?AbortController:function(){var i=[],r=this.signal={aborted:!1,addEventListener:function(c,f){i.push(f)}};this.abort=function(){r.aborted=!0,i.forEach(function(c){return c()})}},O$=t.unstable_scheduleCallback,D$=t.unstable_NormalPriority,Ee={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Km(){return{controller:new k$,data:new Map,refCount:0}}function ol(i){i.refCount--,i.refCount===0&&O$(D$,function(){i.controller.abort()})}var rl=null,Qm=0,ws=0,_s=null;function j$(i,r){if(rl===null){var c=rl=[];Qm=0,ws=t0(),_s={status:"pending",value:void 0,then:function(f){c.push(f)}}}return Qm++,r.then(AE,AE),r}function AE(){if(--Qm===0&&rl!==null){_s!==null&&(_s.status="fulfilled");var i=rl;rl=null,ws=0,_s=null;for(var r=0;r<i.length;r++)(0,i[r])()}}function z$(i,r){var c=[],f={status:"pending",value:null,reason:null,then:function(g){c.push(g)}};return i.then(function(){f.status="fulfilled",f.value=r;for(var g=0;g<c.length;g++)(0,c[g])(r)},function(g){for(f.status="rejected",f.reason=g,g=0;g<c.length;g++)(0,c[g])(void 0)}),f}var ME=j.S;j.S=function(i,r){dT=Vt(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&j$(i,r),ME!==null&&ME(i,r)};var pr=L(null);function Wm(){var i=pr.current;return i!==null?i:oe.pooledCache}function Gu(i,r){r===null?et(pr,pr.current):et(pr,r.pool)}function RE(){var i=Wm();return i===null?null:{parent:Ee._currentValue,pool:i}}var Ss=Error(o(460)),Jm=Error(o(474)),Fu=Error(o(542)),Xu={then:function(){}};function kE(i){return i=i.status,i==="fulfilled"||i==="rejected"}function OE(i,r,c){switch(c=i[c],c===void 0?i.push(r):c!==r&&(r.then(Ei,Ei),r=c),r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,jE(i),i;default:if(typeof r.status=="string")r.then(Ei,Ei);else{if(i=oe,i!==null&&100<i.shellSuspendCounter)throw Error(o(482));i=r,i.status="pending",i.then(function(f){if(r.status==="pending"){var g=r;g.status="fulfilled",g.value=f}},function(f){if(r.status==="pending"){var g=r;g.status="rejected",g.reason=f}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw i=r.reason,jE(i),i}throw gr=r,Ss}}function mr(i){try{var r=i._init;return r(i._payload)}catch(c){throw c!==null&&typeof c=="object"&&typeof c.then=="function"?(gr=c,Ss):c}}var gr=null;function DE(){if(gr===null)throw Error(o(459));var i=gr;return gr=null,i}function jE(i){if(i===Ss||i===Fu)throw Error(o(483))}var Es=null,sl=0;function Zu(i){var r=sl;return sl+=1,Es===null&&(Es=[]),OE(Es,i,r)}function al(i,r){r=r.props.ref,i.ref=r!==void 0?r:null}function Ku(i,r){throw r.$$typeof===y?Error(o(525)):(i=Object.prototype.toString.call(r),Error(o(31,i==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":i)))}function zE(i){function r(J,Q){if(i){var tt=J.deletions;tt===null?(J.deletions=[Q],J.flags|=16):tt.push(Q)}}function c(J,Q){if(!i)return null;for(;Q!==null;)r(J,Q),Q=Q.sibling;return null}function f(J){for(var Q=new Map;J!==null;)J.key!==null?Q.set(J.key,J):Q.set(J.index,J),J=J.sibling;return Q}function g(J,Q){return J=Ti(J,Q),J.index=0,J.sibling=null,J}function v(J,Q,tt){return J.index=tt,i?(tt=J.alternate,tt!==null?(tt=tt.index,tt<Q?(J.flags|=67108866,Q):tt):(J.flags|=67108866,Q)):(J.flags|=1048576,Q)}function T(J){return i&&J.alternate===null&&(J.flags|=67108866),J}function V(J,Q,tt,at){return Q===null||Q.tag!==6?(Q=Hm(tt,J.mode,at),Q.return=J,Q):(Q=g(Q,tt),Q.return=J,Q)}function Z(J,Q,tt,at){var Mt=tt.type;return Mt===w?st(J,Q,tt.props.children,at,tt.key):Q!==null&&(Q.elementType===Mt||typeof Mt=="object"&&Mt!==null&&Mt.$$typeof===D&&mr(Mt)===Q.type)?(Q=g(Q,tt.props),al(Q,tt),Q.return=J,Q):(Q=Uu(tt.type,tt.key,tt.props,null,J.mode,at),al(Q,tt),Q.return=J,Q)}function nt(J,Q,tt,at){return Q===null||Q.tag!==4||Q.stateNode.containerInfo!==tt.containerInfo||Q.stateNode.implementation!==tt.implementation?(Q=Um(tt,J.mode,at),Q.return=J,Q):(Q=g(Q,tt.children||[]),Q.return=J,Q)}function st(J,Q,tt,at,Mt){return Q===null||Q.tag!==7?(Q=ur(tt,J.mode,at,Mt),Q.return=J,Q):(Q=g(Q,tt),Q.return=J,Q)}function lt(J,Q,tt){if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return Q=Hm(""+Q,J.mode,tt),Q.return=J,Q;if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case b:return tt=Uu(Q.type,Q.key,Q.props,null,J.mode,tt),al(tt,Q),tt.return=J,tt;case x:return Q=Um(Q,J.mode,tt),Q.return=J,Q;case D:return Q=mr(Q),lt(J,Q,tt)}if(H(Q)||K(Q))return Q=ur(Q,J.mode,tt,null),Q.return=J,Q;if(typeof Q.then=="function")return lt(J,Zu(Q),tt);if(Q.$$typeof===C)return lt(J,qu(J,Q),tt);Ku(J,Q)}return null}function it(J,Q,tt,at){var Mt=Q!==null?Q.key:null;if(typeof tt=="string"&&tt!==""||typeof tt=="number"||typeof tt=="bigint")return Mt!==null?null:V(J,Q,""+tt,at);if(typeof tt=="object"&&tt!==null){switch(tt.$$typeof){case b:return tt.key===Mt?Z(J,Q,tt,at):null;case x:return tt.key===Mt?nt(J,Q,tt,at):null;case D:return tt=mr(tt),it(J,Q,tt,at)}if(H(tt)||K(tt))return Mt!==null?null:st(J,Q,tt,at,null);if(typeof tt.then=="function")return it(J,Q,Zu(tt),at);if(tt.$$typeof===C)return it(J,Q,qu(J,tt),at);Ku(J,tt)}return null}function ot(J,Q,tt,at,Mt){if(typeof at=="string"&&at!==""||typeof at=="number"||typeof at=="bigint")return J=J.get(tt)||null,V(Q,J,""+at,Mt);if(typeof at=="object"&&at!==null){switch(at.$$typeof){case b:return J=J.get(at.key===null?tt:at.key)||null,Z(Q,J,at,Mt);case x:return J=J.get(at.key===null?tt:at.key)||null,nt(Q,J,at,Mt);case D:return at=mr(at),ot(J,Q,tt,at,Mt)}if(H(at)||K(at))return J=J.get(tt)||null,st(Q,J,at,Mt,null);if(typeof at.then=="function")return ot(J,Q,tt,Zu(at),Mt);if(at.$$typeof===C)return ot(J,Q,tt,qu(Q,at),Mt);Ku(Q,at)}return null}function xt(J,Q,tt,at){for(var Mt=null,Zt=null,Et=Q,Pt=Q=0,Yt=null;Et!==null&&Pt<tt.length;Pt++){Et.index>Pt?(Yt=Et,Et=null):Yt=Et.sibling;var Kt=it(J,Et,tt[Pt],at);if(Kt===null){Et===null&&(Et=Yt);break}i&&Et&&Kt.alternate===null&&r(J,Et),Q=v(Kt,Q,Pt),Zt===null?Mt=Kt:Zt.sibling=Kt,Zt=Kt,Et=Yt}if(Pt===tt.length)return c(J,Et),qt&&Ni(J,Pt),Mt;if(Et===null){for(;Pt<tt.length;Pt++)Et=lt(J,tt[Pt],at),Et!==null&&(Q=v(Et,Q,Pt),Zt===null?Mt=Et:Zt.sibling=Et,Zt=Et);return qt&&Ni(J,Pt),Mt}for(Et=f(Et);Pt<tt.length;Pt++)Yt=ot(Et,J,Pt,tt[Pt],at),Yt!==null&&(i&&Yt.alternate!==null&&Et.delete(Yt.key===null?Pt:Yt.key),Q=v(Yt,Q,Pt),Zt===null?Mt=Yt:Zt.sibling=Yt,Zt=Yt);return i&&Et.forEach(function(Ro){return r(J,Ro)}),qt&&Ni(J,Pt),Mt}function kt(J,Q,tt,at){if(tt==null)throw Error(o(151));for(var Mt=null,Zt=null,Et=Q,Pt=Q=0,Yt=null,Kt=tt.next();Et!==null&&!Kt.done;Pt++,Kt=tt.next()){Et.index>Pt?(Yt=Et,Et=null):Yt=Et.sibling;var Ro=it(J,Et,Kt.value,at);if(Ro===null){Et===null&&(Et=Yt);break}i&&Et&&Ro.alternate===null&&r(J,Et),Q=v(Ro,Q,Pt),Zt===null?Mt=Ro:Zt.sibling=Ro,Zt=Ro,Et=Yt}if(Kt.done)return c(J,Et),qt&&Ni(J,Pt),Mt;if(Et===null){for(;!Kt.done;Pt++,Kt=tt.next())Kt=lt(J,Kt.value,at),Kt!==null&&(Q=v(Kt,Q,Pt),Zt===null?Mt=Kt:Zt.sibling=Kt,Zt=Kt);return qt&&Ni(J,Pt),Mt}for(Et=f(Et);!Kt.done;Pt++,Kt=tt.next())Kt=ot(Et,J,Pt,Kt.value,at),Kt!==null&&(i&&Kt.alternate!==null&&Et.delete(Kt.key===null?Pt:Kt.key),Q=v(Kt,Q,Pt),Zt===null?Mt=Kt:Zt.sibling=Kt,Zt=Kt);return i&&Et.forEach(function(G7){return r(J,G7)}),qt&&Ni(J,Pt),Mt}function ie(J,Q,tt,at){if(typeof tt=="object"&&tt!==null&&tt.type===w&&tt.key===null&&(tt=tt.props.children),typeof tt=="object"&&tt!==null){switch(tt.$$typeof){case b:t:{for(var Mt=tt.key;Q!==null;){if(Q.key===Mt){if(Mt=tt.type,Mt===w){if(Q.tag===7){c(J,Q.sibling),at=g(Q,tt.props.children),at.return=J,J=at;break t}}else if(Q.elementType===Mt||typeof Mt=="object"&&Mt!==null&&Mt.$$typeof===D&&mr(Mt)===Q.type){c(J,Q.sibling),at=g(Q,tt.props),al(at,tt),at.return=J,J=at;break t}c(J,Q);break}else r(J,Q);Q=Q.sibling}tt.type===w?(at=ur(tt.props.children,J.mode,at,tt.key),at.return=J,J=at):(at=Uu(tt.type,tt.key,tt.props,null,J.mode,at),al(at,tt),at.return=J,J=at)}return T(J);case x:t:{for(Mt=tt.key;Q!==null;){if(Q.key===Mt)if(Q.tag===4&&Q.stateNode.containerInfo===tt.containerInfo&&Q.stateNode.implementation===tt.implementation){c(J,Q.sibling),at=g(Q,tt.children||[]),at.return=J,J=at;break t}else{c(J,Q);break}else r(J,Q);Q=Q.sibling}at=Um(tt,J.mode,at),at.return=J,J=at}return T(J);case D:return tt=mr(tt),ie(J,Q,tt,at)}if(H(tt))return xt(J,Q,tt,at);if(K(tt)){if(Mt=K(tt),typeof Mt!="function")throw Error(o(150));return tt=Mt.call(tt),kt(J,Q,tt,at)}if(typeof tt.then=="function")return ie(J,Q,Zu(tt),at);if(tt.$$typeof===C)return ie(J,Q,qu(J,tt),at);Ku(J,tt)}return typeof tt=="string"&&tt!==""||typeof tt=="number"||typeof tt=="bigint"?(tt=""+tt,Q!==null&&Q.tag===6?(c(J,Q.sibling),at=g(Q,tt),at.return=J,J=at):(c(J,Q),at=Hm(tt,J.mode,at),at.return=J,J=at),T(J)):c(J,Q)}return function(J,Q,tt,at){try{sl=0;var Mt=ie(J,Q,tt,at);return Es=null,Mt}catch(Et){if(Et===Ss||Et===Fu)throw Et;var Zt=un(29,Et,null,J.mode);return Zt.lanes=at,Zt.return=J,Zt}}}var yr=zE(!0),VE=zE(!1),ho=!1;function tg(i){i.updateQueue={baseState:i.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eg(i,r){i=i.updateQueue,r.updateQueue===i&&(r.updateQueue={baseState:i.baseState,firstBaseUpdate:i.firstBaseUpdate,lastBaseUpdate:i.lastBaseUpdate,shared:i.shared,callbacks:null})}function po(i){return{lane:i,tag:0,payload:null,callback:null,next:null}}function mo(i,r,c){var f=i.updateQueue;if(f===null)return null;if(f=f.shared,(Qt&2)!==0){var g=f.pending;return g===null?r.next=r:(r.next=g.next,g.next=r),f.pending=r,r=Hu(i),bE(i,null,c),r}return Bu(i,f,r,c),Hu(i)}function ll(i,r,c){if(r=r.updateQueue,r!==null&&(r=r.shared,(c&4194048)!==0)){var f=r.lanes;f&=i.pendingLanes,c|=f,r.lanes=c,bu(i,c)}}function ng(i,r){var c=i.updateQueue,f=i.alternate;if(f!==null&&(f=f.updateQueue,c===f)){var g=null,v=null;if(c=c.firstBaseUpdate,c!==null){do{var T={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};v===null?g=v=T:v=v.next=T,c=c.next}while(c!==null);v===null?g=v=r:v=v.next=r}else g=v=r;c={baseState:f.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:f.shared,callbacks:f.callbacks},i.updateQueue=c;return}i=c.lastBaseUpdate,i===null?c.firstBaseUpdate=r:i.next=r,c.lastBaseUpdate=r}var ig=!1;function cl(){if(ig){var i=_s;if(i!==null)throw i}}function ul(i,r,c,f){ig=!1;var g=i.updateQueue;ho=!1;var v=g.firstBaseUpdate,T=g.lastBaseUpdate,V=g.shared.pending;if(V!==null){g.shared.pending=null;var Z=V,nt=Z.next;Z.next=null,T===null?v=nt:T.next=nt,T=Z;var st=i.alternate;st!==null&&(st=st.updateQueue,V=st.lastBaseUpdate,V!==T&&(V===null?st.firstBaseUpdate=nt:V.next=nt,st.lastBaseUpdate=Z))}if(v!==null){var lt=g.baseState;T=0,st=nt=Z=null,V=v;do{var it=V.lane&-536870913,ot=it!==V.lane;if(ot?($t&it)===it:(f&it)===it){it!==0&&it===ws&&(ig=!0),st!==null&&(st=st.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});t:{var xt=i,kt=V;it=r;var ie=c;switch(kt.tag){case 1:if(xt=kt.payload,typeof xt=="function"){lt=xt.call(ie,lt,it);break t}lt=xt;break t;case 3:xt.flags=xt.flags&-65537|128;case 0:if(xt=kt.payload,it=typeof xt=="function"?xt.call(ie,lt,it):xt,it==null)break t;lt=m({},lt,it);break t;case 2:ho=!0}}it=V.callback,it!==null&&(i.flags|=64,ot&&(i.flags|=8192),ot=g.callbacks,ot===null?g.callbacks=[it]:ot.push(it))}else ot={lane:it,tag:V.tag,payload:V.payload,callback:V.callback,next:null},st===null?(nt=st=ot,Z=lt):st=st.next=ot,T|=it;if(V=V.next,V===null){if(V=g.shared.pending,V===null)break;ot=V,V=ot.next,ot.next=null,g.lastBaseUpdate=ot,g.shared.pending=null}}while(!0);st===null&&(Z=lt),g.baseState=Z,g.firstBaseUpdate=nt,g.lastBaseUpdate=st,v===null&&(g.shared.lanes=0),xo|=T,i.lanes=T,i.memoizedState=lt}}function LE(i,r){if(typeof i!="function")throw Error(o(191,i));i.call(r)}function IE(i,r){var c=i.callbacks;if(c!==null)for(i.callbacks=null,i=0;i<c.length;i++)LE(c[i],r)}var Cs=L(null),Qu=L(0);function PE(i,r){i=Ii,et(Qu,i),et(Cs,r),Ii=i|r.baseLanes}function og(){et(Qu,Ii),et(Cs,Cs.current)}function rg(){Ii=Qu.current,F(Cs),F(Qu)}var fn=L(null),Tn=null;function go(i){var r=i.alternate;et(be,be.current&1),et(fn,i),Tn===null&&(r===null||Cs.current!==null||r.memoizedState!==null)&&(Tn=i)}function sg(i){et(be,be.current),et(fn,i),Tn===null&&(Tn=i)}function BE(i){i.tag===22?(et(be,be.current),et(fn,i),Tn===null&&(Tn=i)):yo()}function yo(){et(be,be.current),et(fn,fn.current)}function dn(i){F(fn),Tn===i&&(Tn=null),F(be)}var be=L(0);function Wu(i){for(var r=i;r!==null;){if(r.tag===13){var c=r.memoizedState;if(c!==null&&(c=c.dehydrated,c===null||d0(c)||h0(c)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var Ri=0,Lt=null,ee=null,Ce=null,Ju=!1,Ts=!1,vr=!1,tf=0,fl=0,Ns=null,V$=0;function ge(){throw Error(o(321))}function ag(i,r){if(r===null)return!1;for(var c=0;c<r.length&&c<i.length;c++)if(!cn(i[c],r[c]))return!1;return!0}function lg(i,r,c,f,g,v){return Ri=v,Lt=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,j.H=i===null||i.memoizedState===null?SC:Sg,vr=!1,v=c(f,g),vr=!1,Ts&&(v=UE(r,c,f,g)),HE(i),v}function HE(i){j.H=pl;var r=ee!==null&&ee.next!==null;if(Ri=0,Ce=ee=Lt=null,Ju=!1,fl=0,Ns=null,r)throw Error(o(300));i===null||Te||(i=i.dependencies,i!==null&&Yu(i)&&(Te=!0))}function UE(i,r,c,f){Lt=i;var g=0;do{if(Ts&&(Ns=null),fl=0,Ts=!1,25<=g)throw Error(o(301));if(g+=1,Ce=ee=null,i.updateQueue!=null){var v=i.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}j.H=EC,v=r(c,f)}while(Ts);return v}function L$(){var i=j.H,r=i.useState()[0];return r=typeof r.then=="function"?dl(r):r,i=i.useState()[0],(ee!==null?ee.memoizedState:null)!==i&&(Lt.flags|=1024),r}function cg(){var i=tf!==0;return tf=0,i}function ug(i,r,c){r.updateQueue=i.updateQueue,r.flags&=-2053,i.lanes&=~c}function fg(i){if(Ju){for(i=i.memoizedState;i!==null;){var r=i.queue;r!==null&&(r.pending=null),i=i.next}Ju=!1}Ri=0,Ce=ee=Lt=null,Ts=!1,fl=tf=0,Ns=null}function Fe(){var i={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ce===null?Lt.memoizedState=Ce=i:Ce=Ce.next=i,Ce}function xe(){if(ee===null){var i=Lt.alternate;i=i!==null?i.memoizedState:null}else i=ee.next;var r=Ce===null?Lt.memoizedState:Ce.next;if(r!==null)Ce=r,ee=i;else{if(i===null)throw Lt.alternate===null?Error(o(467)):Error(o(310));ee=i,i={memoizedState:ee.memoizedState,baseState:ee.baseState,baseQueue:ee.baseQueue,queue:ee.queue,next:null},Ce===null?Lt.memoizedState=Ce=i:Ce=Ce.next=i}return Ce}function ef(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function dl(i){var r=fl;return fl+=1,Ns===null&&(Ns=[]),i=OE(Ns,i,r),r=Lt,(Ce===null?r.memoizedState:Ce.next)===null&&(r=r.alternate,j.H=r===null||r.memoizedState===null?SC:Sg),i}function nf(i){if(i!==null&&typeof i=="object"){if(typeof i.then=="function")return dl(i);if(i.$$typeof===C)return Pe(i)}throw Error(o(438,String(i)))}function dg(i){var r=null,c=Lt.updateQueue;if(c!==null&&(r=c.memoCache),r==null){var f=Lt.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(r={data:f.data.map(function(g){return g.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),c===null&&(c=ef(),Lt.updateQueue=c),c.memoCache=r,c=r.data[r.index],c===void 0)for(c=r.data[r.index]=Array(i),f=0;f<i;f++)c[f]=q;return r.index++,c}function ki(i,r){return typeof r=="function"?r(i):r}function of(i){var r=xe();return hg(r,ee,i)}function hg(i,r,c){var f=i.queue;if(f===null)throw Error(o(311));f.lastRenderedReducer=c;var g=i.baseQueue,v=f.pending;if(v!==null){if(g!==null){var T=g.next;g.next=v.next,v.next=T}r.baseQueue=g=v,f.pending=null}if(v=i.baseState,g===null)i.memoizedState=v;else{r=g.next;var V=T=null,Z=null,nt=r,st=!1;do{var lt=nt.lane&-536870913;if(lt!==nt.lane?($t<)===lt:(Ri<)===lt){var it=nt.revertLane;if(it===0)Z!==null&&(Z=Z.next={lane:0,revertLane:0,gesture:null,action:nt.action,hasEagerState:nt.hasEagerState,eagerState:nt.eagerState,next:null}),lt===ws&&(st=!0);else if((Ri&it)===it){nt=nt.next,it===ws&&(st=!0);continue}else lt={lane:0,revertLane:nt.revertLane,gesture:null,action:nt.action,hasEagerState:nt.hasEagerState,eagerState:nt.eagerState,next:null},Z===null?(V=Z=lt,T=v):Z=Z.next=lt,Lt.lanes|=it,xo|=it;lt=nt.action,vr&&c(v,lt),v=nt.hasEagerState?nt.eagerState:c(v,lt)}else it={lane:lt,revertLane:nt.revertLane,gesture:nt.gesture,action:nt.action,hasEagerState:nt.hasEagerState,eagerState:nt.eagerState,next:null},Z===null?(V=Z=it,T=v):Z=Z.next=it,Lt.lanes|=lt,xo|=lt;nt=nt.next}while(nt!==null&&nt!==r);if(Z===null?T=v:Z.next=V,!cn(v,i.memoizedState)&&(Te=!0,st&&(c=_s,c!==null)))throw c;i.memoizedState=v,i.baseState=T,i.baseQueue=Z,f.lastRenderedState=v}return g===null&&(f.lanes=0),[i.memoizedState,f.dispatch]}function pg(i){var r=xe(),c=r.queue;if(c===null)throw Error(o(311));c.lastRenderedReducer=i;var f=c.dispatch,g=c.pending,v=r.memoizedState;if(g!==null){c.pending=null;var T=g=g.next;do v=i(v,T.action),T=T.next;while(T!==g);cn(v,r.memoizedState)||(Te=!0),r.memoizedState=v,r.baseQueue===null&&(r.baseState=v),c.lastRenderedState=v}return[v,f]}function $E(i,r,c){var f=Lt,g=xe(),v=qt;if(v){if(c===void 0)throw Error(o(407));c=c()}else c=r();var T=!cn((ee||g).memoizedState,c);if(T&&(g.memoizedState=c,Te=!0),g=g.queue,yg(GE.bind(null,f,g,i),[i]),g.getSnapshot!==r||T||Ce!==null&&Ce.memoizedState.tag&1){if(f.flags|=2048,As(9,{destroy:void 0},qE.bind(null,f,g,c,r),null),oe===null)throw Error(o(349));v||(Ri&127)!==0||YE(f,r,c)}return c}function YE(i,r,c){i.flags|=16384,i={getSnapshot:r,value:c},r=Lt.updateQueue,r===null?(r=ef(),Lt.updateQueue=r,r.stores=[i]):(c=r.stores,c===null?r.stores=[i]:c.push(i))}function qE(i,r,c,f){r.value=c,r.getSnapshot=f,FE(r)&&XE(i)}function GE(i,r,c){return c(function(){FE(r)&&XE(i)})}function FE(i){var r=i.getSnapshot;i=i.value;try{var c=r();return!cn(i,c)}catch{return!0}}function XE(i){var r=cr(i,2);r!==null&&on(r,i,2)}function mg(i){var r=Fe();if(typeof i=="function"){var c=i;if(i=c(),vr){le(!0);try{c()}finally{le(!1)}}}return r.memoizedState=r.baseState=i,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ki,lastRenderedState:i},r}function ZE(i,r,c,f){return i.baseState=c,hg(i,ee,typeof f=="function"?f:ki)}function I$(i,r,c,f,g){if(af(i))throw Error(o(485));if(i=r.action,i!==null){var v={payload:g,action:i,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(T){v.listeners.push(T)}};j.T!==null?c(!0):v.isTransition=!1,f(v),c=r.pending,c===null?(v.next=r.pending=v,KE(r,v)):(v.next=c.next,r.pending=c.next=v)}}function KE(i,r){var c=r.action,f=r.payload,g=i.state;if(r.isTransition){var v=j.T,T={};j.T=T;try{var V=c(g,f),Z=j.S;Z!==null&&Z(T,V),QE(i,r,V)}catch(nt){gg(i,r,nt)}finally{v!==null&&T.types!==null&&(v.types=T.types),j.T=v}}else try{v=c(g,f),QE(i,r,v)}catch(nt){gg(i,r,nt)}}function QE(i,r,c){c!==null&&typeof c=="object"&&typeof c.then=="function"?c.then(function(f){WE(i,r,f)},function(f){return gg(i,r,f)}):WE(i,r,c)}function WE(i,r,c){r.status="fulfilled",r.value=c,JE(r),i.state=c,r=i.pending,r!==null&&(c=r.next,c===r?i.pending=null:(c=c.next,r.next=c,KE(i,c)))}function gg(i,r,c){var f=i.pending;if(i.pending=null,f!==null){f=f.next;do r.status="rejected",r.reason=c,JE(r),r=r.next;while(r!==f)}i.action=null}function JE(i){i=i.listeners;for(var r=0;r<i.length;r++)(0,i[r])()}function tC(i,r){return r}function eC(i,r){if(qt){var c=oe.formState;if(c!==null){t:{var f=Lt;if(qt){if(ce){e:{for(var g=ce,v=Cn;g.nodeType!==8;){if(!v){g=null;break e}if(g=Nn(g.nextSibling),g===null){g=null;break e}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){ce=Nn(g.nextSibling),f=g.data==="F!";break t}}uo(f)}f=!1}f&&(r=c[0])}}return c=Fe(),c.memoizedState=c.baseState=r,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tC,lastRenderedState:r},c.queue=f,c=xC.bind(null,Lt,f),f.dispatch=c,f=mg(!1),v=_g.bind(null,Lt,!1,f.queue),f=Fe(),g={state:r,dispatch:null,action:i,pending:null},f.queue=g,c=I$.bind(null,Lt,g,v,c),g.dispatch=c,f.memoizedState=i,[r,c,!1]}function nC(i){var r=xe();return iC(r,ee,i)}function iC(i,r,c){if(r=hg(i,r,tC)[0],i=of(ki)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var f=dl(r)}catch(T){throw T===Ss?Fu:T}else f=r;r=xe();var g=r.queue,v=g.dispatch;return c!==r.memoizedState&&(Lt.flags|=2048,As(9,{destroy:void 0},P$.bind(null,g,c),null)),[f,v,i]}function P$(i,r){i.action=r}function oC(i){var r=xe(),c=ee;if(c!==null)return iC(r,c,i);xe(),r=r.memoizedState,c=xe();var f=c.queue.dispatch;return c.memoizedState=i,[r,f,!1]}function As(i,r,c,f){return i={tag:i,create:c,deps:f,inst:r,next:null},r=Lt.updateQueue,r===null&&(r=ef(),Lt.updateQueue=r),c=r.lastEffect,c===null?r.lastEffect=i.next=i:(f=c.next,c.next=i,i.next=f,r.lastEffect=i),i}function rC(){return xe().memoizedState}function rf(i,r,c,f){var g=Fe();Lt.flags|=i,g.memoizedState=As(1|r,{destroy:void 0},c,f===void 0?null:f)}function sf(i,r,c,f){var g=xe();f=f===void 0?null:f;var v=g.memoizedState.inst;ee!==null&&f!==null&&ag(f,ee.memoizedState.deps)?g.memoizedState=As(r,v,c,f):(Lt.flags|=i,g.memoizedState=As(1|r,v,c,f))}function sC(i,r){rf(8390656,8,i,r)}function yg(i,r){sf(2048,8,i,r)}function B$(i){Lt.flags|=4;var r=Lt.updateQueue;if(r===null)r=ef(),Lt.updateQueue=r,r.events=[i];else{var c=r.events;c===null?r.events=[i]:c.push(i)}}function aC(i){var r=xe().memoizedState;return B$({ref:r,nextImpl:i}),function(){if((Qt&2)!==0)throw Error(o(440));return r.impl.apply(void 0,arguments)}}function lC(i,r){return sf(4,2,i,r)}function cC(i,r){return sf(4,4,i,r)}function uC(i,r){if(typeof r=="function"){i=i();var c=r(i);return function(){typeof c=="function"?c():r(null)}}if(r!=null)return i=i(),r.current=i,function(){r.current=null}}function fC(i,r,c){c=c!=null?c.concat([i]):null,sf(4,4,uC.bind(null,r,i),c)}function vg(){}function dC(i,r){var c=xe();r=r===void 0?null:r;var f=c.memoizedState;return r!==null&&ag(r,f[1])?f[0]:(c.memoizedState=[i,r],i)}function hC(i,r){var c=xe();r=r===void 0?null:r;var f=c.memoizedState;if(r!==null&&ag(r,f[1]))return f[0];if(f=i(),vr){le(!0);try{i()}finally{le(!1)}}return c.memoizedState=[f,r],f}function bg(i,r,c){return c===void 0||(Ri&1073741824)!==0&&($t&261930)===0?i.memoizedState=r:(i.memoizedState=c,i=pT(),Lt.lanes|=i,xo|=i,c)}function pC(i,r,c,f){return cn(c,r)?c:Cs.current!==null?(i=bg(i,c,f),cn(i,r)||(Te=!0),i):(Ri&42)===0||(Ri&1073741824)!==0&&($t&261930)===0?(Te=!0,i.memoizedState=c):(i=pT(),Lt.lanes|=i,xo|=i,r)}function mC(i,r,c,f,g){var v=I.p;I.p=v!==0&&8>v?v:8;var T=j.T,V={};j.T=V,_g(i,!1,r,c);try{var Z=g(),nt=j.S;if(nt!==null&&nt(V,Z),Z!==null&&typeof Z=="object"&&typeof Z.then=="function"){var st=z$(Z,f);hl(i,r,st,mn(i))}else hl(i,r,f,mn(i))}catch(lt){hl(i,r,{then:function(){},status:"rejected",reason:lt},mn())}finally{I.p=v,T!==null&&V.types!==null&&(T.types=V.types),j.T=T}}function H$(){}function xg(i,r,c,f){if(i.tag!==5)throw Error(o(476));var g=gC(i).queue;mC(i,g,r,z,c===null?H$:function(){return yC(i),c(f)})}function gC(i){var r=i.memoizedState;if(r!==null)return r;r={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ki,lastRenderedState:z},next:null};var c={};return r.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ki,lastRenderedState:c},next:null},i.memoizedState=r,i=i.alternate,i!==null&&(i.memoizedState=r),r}function yC(i){var r=gC(i);r.next===null&&(r=i.alternate.memoizedState),hl(i,r.next.queue,{},mn())}function wg(){return Pe(Rl)}function vC(){return xe().memoizedState}function bC(){return xe().memoizedState}function U$(i){for(var r=i.return;r!==null;){switch(r.tag){case 24:case 3:var c=mn();i=po(c);var f=mo(r,i,c);f!==null&&(on(f,r,c),ll(f,r,c)),r={cache:Km()},i.payload=r;return}r=r.return}}function $$(i,r,c){var f=mn();c={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},af(i)?wC(r,c):(c=Pm(i,r,c,f),c!==null&&(on(c,i,f),_C(c,r,f)))}function xC(i,r,c){var f=mn();hl(i,r,c,f)}function hl(i,r,c,f){var g={lane:f,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(af(i))wC(r,g);else{var v=i.alternate;if(i.lanes===0&&(v===null||v.lanes===0)&&(v=r.lastRenderedReducer,v!==null))try{var T=r.lastRenderedState,V=v(T,c);if(g.hasEagerState=!0,g.eagerState=V,cn(V,T))return Bu(i,r,g,0),oe===null&&Pu(),!1}catch{}if(c=Pm(i,r,g,f),c!==null)return on(c,i,f),_C(c,r,f),!0}return!1}function _g(i,r,c,f){if(f={lane:2,revertLane:t0(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},af(i)){if(r)throw Error(o(479))}else r=Pm(i,c,f,2),r!==null&&on(r,i,2)}function af(i){var r=i.alternate;return i===Lt||r!==null&&r===Lt}function wC(i,r){Ts=Ju=!0;var c=i.pending;c===null?r.next=r:(r.next=c.next,c.next=r),i.pending=r}function _C(i,r,c){if((c&4194048)!==0){var f=r.lanes;f&=i.pendingLanes,c|=f,r.lanes=c,bu(i,c)}}var pl={readContext:Pe,use:nf,useCallback:ge,useContext:ge,useEffect:ge,useImperativeHandle:ge,useLayoutEffect:ge,useInsertionEffect:ge,useMemo:ge,useReducer:ge,useRef:ge,useState:ge,useDebugValue:ge,useDeferredValue:ge,useTransition:ge,useSyncExternalStore:ge,useId:ge,useHostTransitionStatus:ge,useFormState:ge,useActionState:ge,useOptimistic:ge,useMemoCache:ge,useCacheRefresh:ge};pl.useEffectEvent=ge;var SC={readContext:Pe,use:nf,useCallback:function(i,r){return Fe().memoizedState=[i,r===void 0?null:r],i},useContext:Pe,useEffect:sC,useImperativeHandle:function(i,r,c){c=c!=null?c.concat([i]):null,rf(4194308,4,uC.bind(null,r,i),c)},useLayoutEffect:function(i,r){return rf(4194308,4,i,r)},useInsertionEffect:function(i,r){rf(4,2,i,r)},useMemo:function(i,r){var c=Fe();r=r===void 0?null:r;var f=i();if(vr){le(!0);try{i()}finally{le(!1)}}return c.memoizedState=[f,r],f},useReducer:function(i,r,c){var f=Fe();if(c!==void 0){var g=c(r);if(vr){le(!0);try{c(r)}finally{le(!1)}}}else g=r;return f.memoizedState=f.baseState=g,i={pending:null,lanes:0,dispatch:null,lastRenderedReducer:i,lastRenderedState:g},f.queue=i,i=i.dispatch=$$.bind(null,Lt,i),[f.memoizedState,i]},useRef:function(i){var r=Fe();return i={current:i},r.memoizedState=i},useState:function(i){i=mg(i);var r=i.queue,c=xC.bind(null,Lt,r);return r.dispatch=c,[i.memoizedState,c]},useDebugValue:vg,useDeferredValue:function(i,r){var c=Fe();return bg(c,i,r)},useTransition:function(){var i=mg(!1);return i=mC.bind(null,Lt,i.queue,!0,!1),Fe().memoizedState=i,[!1,i]},useSyncExternalStore:function(i,r,c){var f=Lt,g=Fe();if(qt){if(c===void 0)throw Error(o(407));c=c()}else{if(c=r(),oe===null)throw Error(o(349));($t&127)!==0||YE(f,r,c)}g.memoizedState=c;var v={value:c,getSnapshot:r};return g.queue=v,sC(GE.bind(null,f,v,i),[i]),f.flags|=2048,As(9,{destroy:void 0},qE.bind(null,f,v,c,r),null),c},useId:function(){var i=Fe(),r=oe.identifierPrefix;if(qt){var c=ai,f=si;c=(f&~(1<<32-ze(f)-1)).toString(32)+c,r="_"+r+"R_"+c,c=tf++,0<c&&(r+="H"+c.toString(32)),r+="_"}else c=V$++,r="_"+r+"r_"+c.toString(32)+"_";return i.memoizedState=r},useHostTransitionStatus:wg,useFormState:eC,useActionState:eC,useOptimistic:function(i){var r=Fe();r.memoizedState=r.baseState=i;var c={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=c,r=_g.bind(null,Lt,!0,c),c.dispatch=r,[i,r]},useMemoCache:dg,useCacheRefresh:function(){return Fe().memoizedState=U$.bind(null,Lt)},useEffectEvent:function(i){var r=Fe(),c={impl:i};return r.memoizedState=c,function(){if((Qt&2)!==0)throw Error(o(440));return c.impl.apply(void 0,arguments)}}},Sg={readContext:Pe,use:nf,useCallback:dC,useContext:Pe,useEffect:yg,useImperativeHandle:fC,useInsertionEffect:lC,useLayoutEffect:cC,useMemo:hC,useReducer:of,useRef:rC,useState:function(){return of(ki)},useDebugValue:vg,useDeferredValue:function(i,r){var c=xe();return pC(c,ee.memoizedState,i,r)},useTransition:function(){var i=of(ki)[0],r=xe().memoizedState;return[typeof i=="boolean"?i:dl(i),r]},useSyncExternalStore:$E,useId:vC,useHostTransitionStatus:wg,useFormState:nC,useActionState:nC,useOptimistic:function(i,r){var c=xe();return ZE(c,ee,i,r)},useMemoCache:dg,useCacheRefresh:bC};Sg.useEffectEvent=aC;var EC={readContext:Pe,use:nf,useCallback:dC,useContext:Pe,useEffect:yg,useImperativeHandle:fC,useInsertionEffect:lC,useLayoutEffect:cC,useMemo:hC,useReducer:pg,useRef:rC,useState:function(){return pg(ki)},useDebugValue:vg,useDeferredValue:function(i,r){var c=xe();return ee===null?bg(c,i,r):pC(c,ee.memoizedState,i,r)},useTransition:function(){var i=pg(ki)[0],r=xe().memoizedState;return[typeof i=="boolean"?i:dl(i),r]},useSyncExternalStore:$E,useId:vC,useHostTransitionStatus:wg,useFormState:oC,useActionState:oC,useOptimistic:function(i,r){var c=xe();return ee!==null?ZE(c,ee,i,r):(c.baseState=i,[i,c.queue.dispatch])},useMemoCache:dg,useCacheRefresh:bC};EC.useEffectEvent=aC;function Eg(i,r,c,f){r=i.memoizedState,c=c(f,r),c=c==null?r:m({},r,c),i.memoizedState=c,i.lanes===0&&(i.updateQueue.baseState=c)}var Cg={enqueueSetState:function(i,r,c){i=i._reactInternals;var f=mn(),g=po(f);g.payload=r,c!=null&&(g.callback=c),r=mo(i,g,f),r!==null&&(on(r,i,f),ll(r,i,f))},enqueueReplaceState:function(i,r,c){i=i._reactInternals;var f=mn(),g=po(f);g.tag=1,g.payload=r,c!=null&&(g.callback=c),r=mo(i,g,f),r!==null&&(on(r,i,f),ll(r,i,f))},enqueueForceUpdate:function(i,r){i=i._reactInternals;var c=mn(),f=po(c);f.tag=2,r!=null&&(f.callback=r),r=mo(i,f,c),r!==null&&(on(r,i,c),ll(r,i,c))}};function CC(i,r,c,f,g,v,T){return i=i.stateNode,typeof i.shouldComponentUpdate=="function"?i.shouldComponentUpdate(f,v,T):r.prototype&&r.prototype.isPureReactComponent?!tl(c,f)||!tl(g,v):!0}function TC(i,r,c,f){i=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(c,f),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(c,f),r.state!==i&&Cg.enqueueReplaceState(r,r.state,null)}function br(i,r){var c=r;if("ref"in r){c={};for(var f in r)f!=="ref"&&(c[f]=r[f])}if(i=i.defaultProps){c===r&&(c=m({},c));for(var g in i)c[g]===void 0&&(c[g]=i[g])}return c}function NC(i){Iu(i)}function AC(i){console.error(i)}function MC(i){Iu(i)}function lf(i,r){try{var c=i.onUncaughtError;c(r.value,{componentStack:r.stack})}catch(f){setTimeout(function(){throw f})}}function RC(i,r,c){try{var f=i.onCaughtError;f(c.value,{componentStack:c.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function Tg(i,r,c){return c=po(c),c.tag=3,c.payload={element:null},c.callback=function(){lf(i,r)},c}function kC(i){return i=po(i),i.tag=3,i}function OC(i,r,c,f){var g=c.type.getDerivedStateFromError;if(typeof g=="function"){var v=f.value;i.payload=function(){return g(v)},i.callback=function(){RC(r,c,f)}}var T=c.stateNode;T!==null&&typeof T.componentDidCatch=="function"&&(i.callback=function(){RC(r,c,f),typeof g!="function"&&(wo===null?wo=new Set([this]):wo.add(this));var V=f.stack;this.componentDidCatch(f.value,{componentStack:V!==null?V:""})})}function Y$(i,r,c,f,g){if(c.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(r=c.alternate,r!==null&&xs(r,c,g,!0),c=fn.current,c!==null){switch(c.tag){case 31:case 13:return Tn===null?xf():c.alternate===null&&ye===0&&(ye=3),c.flags&=-257,c.flags|=65536,c.lanes=g,f===Xu?c.flags|=16384:(r=c.updateQueue,r===null?c.updateQueue=new Set([f]):r.add(f),Qg(i,f,g)),!1;case 22:return c.flags|=65536,f===Xu?c.flags|=16384:(r=c.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([f])},c.updateQueue=r):(c=r.retryQueue,c===null?r.retryQueue=new Set([f]):c.add(f)),Qg(i,f,g)),!1}throw Error(o(435,c.tag))}return Qg(i,f,g),xf(),!1}if(qt)return r=fn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=g,f!==qm&&(i=Error(o(422),{cause:f}),il(_n(i,c)))):(f!==qm&&(r=Error(o(423),{cause:f}),il(_n(r,c))),i=i.current.alternate,i.flags|=65536,g&=-g,i.lanes|=g,f=_n(f,c),g=Tg(i.stateNode,f,g),ng(i,g),ye!==4&&(ye=2)),!1;var v=Error(o(520),{cause:f});if(v=_n(v,c),_l===null?_l=[v]:_l.push(v),ye!==4&&(ye=2),r===null)return!0;f=_n(f,c),c=r;do{switch(c.tag){case 3:return c.flags|=65536,i=g&-g,c.lanes|=i,i=Tg(c.stateNode,f,i),ng(c,i),!1;case 1:if(r=c.type,v=c.stateNode,(c.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(wo===null||!wo.has(v))))return c.flags|=65536,g&=-g,c.lanes|=g,g=kC(g),OC(g,i,c,f),ng(c,g),!1}c=c.return}while(c!==null);return!1}var Ng=Error(o(461)),Te=!1;function Be(i,r,c,f){r.child=i===null?VE(r,null,c,f):yr(r,i.child,c,f)}function DC(i,r,c,f,g){c=c.render;var v=r.ref;if("ref"in f){var T={};for(var V in f)V!=="ref"&&(T[V]=f[V])}else T=f;return hr(r),f=lg(i,r,c,T,v,g),V=cg(),i!==null&&!Te?(ug(i,r,g),Oi(i,r,g)):(qt&&V&&$m(r),r.flags|=1,Be(i,r,f,g),r.child)}function jC(i,r,c,f,g){if(i===null){var v=c.type;return typeof v=="function"&&!Bm(v)&&v.defaultProps===void 0&&c.compare===null?(r.tag=15,r.type=v,zC(i,r,v,f,g)):(i=Uu(c.type,null,f,r,r.mode,g),i.ref=r.ref,i.return=r,r.child=i)}if(v=i.child,!zg(i,g)){var T=v.memoizedProps;if(c=c.compare,c=c!==null?c:tl,c(T,f)&&i.ref===r.ref)return Oi(i,r,g)}return r.flags|=1,i=Ti(v,f),i.ref=r.ref,i.return=r,r.child=i}function zC(i,r,c,f,g){if(i!==null){var v=i.memoizedProps;if(tl(v,f)&&i.ref===r.ref)if(Te=!1,r.pendingProps=f=v,zg(i,g))(i.flags&131072)!==0&&(Te=!0);else return r.lanes=i.lanes,Oi(i,r,g)}return Ag(i,r,c,f,g)}function VC(i,r,c,f){var g=f.children,v=i!==null?i.memoizedState:null;if(i===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((r.flags&128)!==0){if(v=v!==null?v.baseLanes|c:c,i!==null){for(f=r.child=i.child,g=0;f!==null;)g=g|f.lanes|f.childLanes,f=f.sibling;f=g&~v}else f=0,r.child=null;return LC(i,r,v,c,f)}if((c&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},i!==null&&Gu(r,v!==null?v.cachePool:null),v!==null?PE(r,v):og(),BE(r);else return f=r.lanes=536870912,LC(i,r,v!==null?v.baseLanes|c:c,c,f)}else v!==null?(Gu(r,v.cachePool),PE(r,v),yo(),r.memoizedState=null):(i!==null&&Gu(r,null),og(),yo());return Be(i,r,g,c),r.child}function ml(i,r){return i!==null&&i.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function LC(i,r,c,f,g){var v=Wm();return v=v===null?null:{parent:Ee._currentValue,pool:v},r.memoizedState={baseLanes:c,cachePool:v},i!==null&&Gu(r,null),og(),BE(r),i!==null&&xs(i,r,f,!0),r.childLanes=g,null}function cf(i,r){return r=ff({mode:r.mode,children:r.children},i.mode),r.ref=i.ref,i.child=r,r.return=i,r}function IC(i,r,c){return yr(r,i.child,null,c),i=cf(r,r.pendingProps),i.flags|=2,dn(r),r.memoizedState=null,i}function q$(i,r,c){var f=r.pendingProps,g=(r.flags&128)!==0;if(r.flags&=-129,i===null){if(qt){if(f.mode==="hidden")return i=cf(r,f),r.lanes=536870912,ml(null,i);if(sg(r),(i=ce)?(i=KT(i,Cn),i=i!==null&&i.data==="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:lo!==null?{id:si,overflow:ai}:null,retryLane:536870912,hydrationErrors:null},c=wE(i),c.return=r,r.child=c,Ie=r,ce=null)):i=null,i===null)throw uo(r);return r.lanes=536870912,null}return cf(r,f)}var v=i.memoizedState;if(v!==null){var T=v.dehydrated;if(sg(r),g)if(r.flags&256)r.flags&=-257,r=IC(i,r,c);else if(r.memoizedState!==null)r.child=i.child,r.flags|=128,r=null;else throw Error(o(558));else if(Te||xs(i,r,c,!1),g=(c&i.childLanes)!==0,Te||g){if(f=oe,f!==null&&(T=xu(f,c),T!==0&&T!==v.retryLane))throw v.retryLane=T,cr(i,T),on(f,i,T),Ng;xf(),r=IC(i,r,c)}else i=v.treeContext,ce=Nn(T.nextSibling),Ie=r,qt=!0,co=null,Cn=!1,i!==null&&EE(r,i),r=cf(r,f),r.flags|=4096;return r}return i=Ti(i.child,{mode:f.mode,children:f.children}),i.ref=r.ref,r.child=i,i.return=r,i}function uf(i,r){var c=r.ref;if(c===null)i!==null&&i.ref!==null&&(r.flags|=4194816);else{if(typeof c!="function"&&typeof c!="object")throw Error(o(284));(i===null||i.ref!==c)&&(r.flags|=4194816)}}function Ag(i,r,c,f,g){return hr(r),c=lg(i,r,c,f,void 0,g),f=cg(),i!==null&&!Te?(ug(i,r,g),Oi(i,r,g)):(qt&&f&&$m(r),r.flags|=1,Be(i,r,c,g),r.child)}function PC(i,r,c,f,g,v){return hr(r),r.updateQueue=null,c=UE(r,f,c,g),HE(i),f=cg(),i!==null&&!Te?(ug(i,r,v),Oi(i,r,v)):(qt&&f&&$m(r),r.flags|=1,Be(i,r,c,v),r.child)}function BC(i,r,c,f,g){if(hr(r),r.stateNode===null){var v=gs,T=c.contextType;typeof T=="object"&&T!==null&&(v=Pe(T)),v=new c(f,v),r.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Cg,r.stateNode=v,v._reactInternals=r,v=r.stateNode,v.props=f,v.state=r.memoizedState,v.refs={},tg(r),T=c.contextType,v.context=typeof T=="object"&&T!==null?Pe(T):gs,v.state=r.memoizedState,T=c.getDerivedStateFromProps,typeof T=="function"&&(Eg(r,c,T,f),v.state=r.memoizedState),typeof c.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(T=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),T!==v.state&&Cg.enqueueReplaceState(v,v.state,null),ul(r,f,v,g),cl(),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308),f=!0}else if(i===null){v=r.stateNode;var V=r.memoizedProps,Z=br(c,V);v.props=Z;var nt=v.context,st=c.contextType;T=gs,typeof st=="object"&&st!==null&&(T=Pe(st));var lt=c.getDerivedStateFromProps;st=typeof lt=="function"||typeof v.getSnapshotBeforeUpdate=="function",V=r.pendingProps!==V,st||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(V||nt!==T)&&TC(r,v,f,T),ho=!1;var it=r.memoizedState;v.state=it,ul(r,f,v,g),cl(),nt=r.memoizedState,V||it!==nt||ho?(typeof lt=="function"&&(Eg(r,c,lt,f),nt=r.memoizedState),(Z=ho||CC(r,c,Z,f,it,nt,T))?(st||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(r.flags|=4194308)):(typeof v.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=f,r.memoizedState=nt),v.props=f,v.state=nt,v.context=T,f=Z):(typeof v.componentDidMount=="function"&&(r.flags|=4194308),f=!1)}else{v=r.stateNode,eg(i,r),T=r.memoizedProps,st=br(c,T),v.props=st,lt=r.pendingProps,it=v.context,nt=c.contextType,Z=gs,typeof nt=="object"&&nt!==null&&(Z=Pe(nt)),V=c.getDerivedStateFromProps,(nt=typeof V=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(T!==lt||it!==Z)&&TC(r,v,f,Z),ho=!1,it=r.memoizedState,v.state=it,ul(r,f,v,g),cl();var ot=r.memoizedState;T!==lt||it!==ot||ho||i!==null&&i.dependencies!==null&&Yu(i.dependencies)?(typeof V=="function"&&(Eg(r,c,V,f),ot=r.memoizedState),(st=ho||CC(r,c,st,f,it,ot,Z)||i!==null&&i.dependencies!==null&&Yu(i.dependencies))?(nt||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(f,ot,Z),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(f,ot,Z)),typeof v.componentDidUpdate=="function"&&(r.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof v.componentDidUpdate!="function"||T===i.memoizedProps&&it===i.memoizedState||(r.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||T===i.memoizedProps&&it===i.memoizedState||(r.flags|=1024),r.memoizedProps=f,r.memoizedState=ot),v.props=f,v.state=ot,v.context=Z,f=st):(typeof v.componentDidUpdate!="function"||T===i.memoizedProps&&it===i.memoizedState||(r.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||T===i.memoizedProps&&it===i.memoizedState||(r.flags|=1024),f=!1)}return v=f,uf(i,r),f=(r.flags&128)!==0,v||f?(v=r.stateNode,c=f&&typeof c.getDerivedStateFromError!="function"?null:v.render(),r.flags|=1,i!==null&&f?(r.child=yr(r,i.child,null,g),r.child=yr(r,null,c,g)):Be(i,r,c,g),r.memoizedState=v.state,i=r.child):i=Oi(i,r,g),i}function HC(i,r,c,f){return fr(),r.flags|=256,Be(i,r,c,f),r.child}var Mg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Rg(i){return{baseLanes:i,cachePool:RE()}}function kg(i,r,c){return i=i!==null?i.childLanes&~c:0,r&&(i|=pn),i}function UC(i,r,c){var f=r.pendingProps,g=!1,v=(r.flags&128)!==0,T;if((T=v)||(T=i!==null&&i.memoizedState===null?!1:(be.current&2)!==0),T&&(g=!0,r.flags&=-129),T=(r.flags&32)!==0,r.flags&=-33,i===null){if(qt){if(g?go(r):yo(),(i=ce)?(i=KT(i,Cn),i=i!==null&&i.data!=="&"?i:null,i!==null&&(r.memoizedState={dehydrated:i,treeContext:lo!==null?{id:si,overflow:ai}:null,retryLane:536870912,hydrationErrors:null},c=wE(i),c.return=r,r.child=c,Ie=r,ce=null)):i=null,i===null)throw uo(r);return h0(i)?r.lanes=32:r.lanes=536870912,null}var V=f.children;return f=f.fallback,g?(yo(),g=r.mode,V=ff({mode:"hidden",children:V},g),f=ur(f,g,c,null),V.return=r,f.return=r,V.sibling=f,r.child=V,f=r.child,f.memoizedState=Rg(c),f.childLanes=kg(i,T,c),r.memoizedState=Mg,ml(null,f)):(go(r),Og(r,V))}var Z=i.memoizedState;if(Z!==null&&(V=Z.dehydrated,V!==null)){if(v)r.flags&256?(go(r),r.flags&=-257,r=Dg(i,r,c)):r.memoizedState!==null?(yo(),r.child=i.child,r.flags|=128,r=null):(yo(),V=f.fallback,g=r.mode,f=ff({mode:"visible",children:f.children},g),V=ur(V,g,c,null),V.flags|=2,f.return=r,V.return=r,f.sibling=V,r.child=f,yr(r,i.child,null,c),f=r.child,f.memoizedState=Rg(c),f.childLanes=kg(i,T,c),r.memoizedState=Mg,r=ml(null,f));else if(go(r),h0(V)){if(T=V.nextSibling&&V.nextSibling.dataset,T)var nt=T.dgst;T=nt,f=Error(o(419)),f.stack="",f.digest=T,il({value:f,source:null,stack:null}),r=Dg(i,r,c)}else if(Te||xs(i,r,c,!1),T=(c&i.childLanes)!==0,Te||T){if(T=oe,T!==null&&(f=xu(T,c),f!==0&&f!==Z.retryLane))throw Z.retryLane=f,cr(i,f),on(T,i,f),Ng;d0(V)||xf(),r=Dg(i,r,c)}else d0(V)?(r.flags|=192,r.child=i.child,r=null):(i=Z.treeContext,ce=Nn(V.nextSibling),Ie=r,qt=!0,co=null,Cn=!1,i!==null&&EE(r,i),r=Og(r,f.children),r.flags|=4096);return r}return g?(yo(),V=f.fallback,g=r.mode,Z=i.child,nt=Z.sibling,f=Ti(Z,{mode:"hidden",children:f.children}),f.subtreeFlags=Z.subtreeFlags&65011712,nt!==null?V=Ti(nt,V):(V=ur(V,g,c,null),V.flags|=2),V.return=r,f.return=r,f.sibling=V,r.child=f,ml(null,f),f=r.child,V=i.child.memoizedState,V===null?V=Rg(c):(g=V.cachePool,g!==null?(Z=Ee._currentValue,g=g.parent!==Z?{parent:Z,pool:Z}:g):g=RE(),V={baseLanes:V.baseLanes|c,cachePool:g}),f.memoizedState=V,f.childLanes=kg(i,T,c),r.memoizedState=Mg,ml(i.child,f)):(go(r),c=i.child,i=c.sibling,c=Ti(c,{mode:"visible",children:f.children}),c.return=r,c.sibling=null,i!==null&&(T=r.deletions,T===null?(r.deletions=[i],r.flags|=16):T.push(i)),r.child=c,r.memoizedState=null,c)}function Og(i,r){return r=ff({mode:"visible",children:r},i.mode),r.return=i,i.child=r}function ff(i,r){return i=un(22,i,null,r),i.lanes=0,i}function Dg(i,r,c){return yr(r,i.child,null,c),i=Og(r,r.pendingProps.children),i.flags|=2,r.memoizedState=null,i}function $C(i,r,c){i.lanes|=r;var f=i.alternate;f!==null&&(f.lanes|=r),Xm(i.return,r,c)}function jg(i,r,c,f,g,v){var T=i.memoizedState;T===null?i.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:f,tail:c,tailMode:g,treeForkCount:v}:(T.isBackwards=r,T.rendering=null,T.renderingStartTime=0,T.last=f,T.tail=c,T.tailMode=g,T.treeForkCount=v)}function YC(i,r,c){var f=r.pendingProps,g=f.revealOrder,v=f.tail;f=f.children;var T=be.current,V=(T&2)!==0;if(V?(T=T&1|2,r.flags|=128):T&=1,et(be,T),Be(i,r,f,c),f=qt?nl:0,!V&&i!==null&&(i.flags&128)!==0)t:for(i=r.child;i!==null;){if(i.tag===13)i.memoizedState!==null&&$C(i,c,r);else if(i.tag===19)$C(i,c,r);else if(i.child!==null){i.child.return=i,i=i.child;continue}if(i===r)break t;for(;i.sibling===null;){if(i.return===null||i.return===r)break t;i=i.return}i.sibling.return=i.return,i=i.sibling}switch(g){case"forwards":for(c=r.child,g=null;c!==null;)i=c.alternate,i!==null&&Wu(i)===null&&(g=c),c=c.sibling;c=g,c===null?(g=r.child,r.child=null):(g=c.sibling,c.sibling=null),jg(r,!1,g,c,v,f);break;case"backwards":case"unstable_legacy-backwards":for(c=null,g=r.child,r.child=null;g!==null;){if(i=g.alternate,i!==null&&Wu(i)===null){r.child=g;break}i=g.sibling,g.sibling=c,c=g,g=i}jg(r,!0,c,null,v,f);break;case"together":jg(r,!1,null,null,void 0,f);break;default:r.memoizedState=null}return r.child}function Oi(i,r,c){if(i!==null&&(r.dependencies=i.dependencies),xo|=r.lanes,(c&r.childLanes)===0)if(i!==null){if(xs(i,r,c,!1),(c&r.childLanes)===0)return null}else return null;if(i!==null&&r.child!==i.child)throw Error(o(153));if(r.child!==null){for(i=r.child,c=Ti(i,i.pendingProps),r.child=c,c.return=r;i.sibling!==null;)i=i.sibling,c=c.sibling=Ti(i,i.pendingProps),c.return=r;c.sibling=null}return r.child}function zg(i,r){return(i.lanes&r)!==0?!0:(i=i.dependencies,!!(i!==null&&Yu(i)))}function G$(i,r,c){switch(r.tag){case 3:ut(r,r.stateNode.containerInfo),fo(r,Ee,i.memoizedState.cache),fr();break;case 27:case 5:Ot(r);break;case 4:ut(r,r.stateNode.containerInfo);break;case 10:fo(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,sg(r),null;break;case 13:var f=r.memoizedState;if(f!==null)return f.dehydrated!==null?(go(r),r.flags|=128,null):(c&r.child.childLanes)!==0?UC(i,r,c):(go(r),i=Oi(i,r,c),i!==null?i.sibling:null);go(r);break;case 19:var g=(i.flags&128)!==0;if(f=(c&r.childLanes)!==0,f||(xs(i,r,c,!1),f=(c&r.childLanes)!==0),g){if(f)return YC(i,r,c);r.flags|=128}if(g=r.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),et(be,be.current),f)break;return null;case 22:return r.lanes=0,VC(i,r,c,r.pendingProps);case 24:fo(r,Ee,i.memoizedState.cache)}return Oi(i,r,c)}function qC(i,r,c){if(i!==null)if(i.memoizedProps!==r.pendingProps)Te=!0;else{if(!zg(i,c)&&(r.flags&128)===0)return Te=!1,G$(i,r,c);Te=(i.flags&131072)!==0}else Te=!1,qt&&(r.flags&1048576)!==0&&SE(r,nl,r.index);switch(r.lanes=0,r.tag){case 16:t:{var f=r.pendingProps;if(i=mr(r.elementType),r.type=i,typeof i=="function")Bm(i)?(f=br(i,f),r.tag=1,r=BC(null,r,i,f,c)):(r.tag=0,r=Ag(null,r,i,f,c));else{if(i!=null){var g=i.$$typeof;if(g===E){r.tag=11,r=DC(null,r,i,f,c);break t}else if(g===O){r.tag=14,r=jC(null,r,i,f,c);break t}}throw r=B(i)||i,Error(o(306,r,""))}}return r;case 0:return Ag(i,r,r.type,r.pendingProps,c);case 1:return f=r.type,g=br(f,r.pendingProps),BC(i,r,f,g,c);case 3:t:{if(ut(r,r.stateNode.containerInfo),i===null)throw Error(o(387));f=r.pendingProps;var v=r.memoizedState;g=v.element,eg(i,r),ul(r,f,null,c);var T=r.memoizedState;if(f=T.cache,fo(r,Ee,f),f!==v.cache&&Zm(r,[Ee],c,!0),cl(),f=T.element,v.isDehydrated)if(v={element:f,isDehydrated:!1,cache:T.cache},r.updateQueue.baseState=v,r.memoizedState=v,r.flags&256){r=HC(i,r,f,c);break t}else if(f!==g){g=_n(Error(o(424)),r),il(g),r=HC(i,r,f,c);break t}else for(i=r.stateNode.containerInfo,i.nodeType===9?i=i.body:i=i.nodeName==="HTML"?i.ownerDocument.body:i,ce=Nn(i.firstChild),Ie=r,qt=!0,co=null,Cn=!0,c=VE(r,null,f,c),r.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{if(fr(),f===g){r=Oi(i,r,c);break t}Be(i,r,f,c)}r=r.child}return r;case 26:return uf(i,r),i===null?(c=nN(r.type,null,r.pendingProps,null))?r.memoizedState=c:qt||(c=r.type,i=r.pendingProps,f=Nf(ht.current).createElement(c),f[ke]=r,f[Ye]=i,He(f,c,i),Se(f),r.stateNode=f):r.memoizedState=nN(r.type,i.memoizedProps,r.pendingProps,i.memoizedState),null;case 27:return Ot(r),i===null&&qt&&(f=r.stateNode=JT(r.type,r.pendingProps,ht.current),Ie=r,Cn=!0,g=ce,Co(r.type)?(p0=g,ce=Nn(f.firstChild)):ce=g),Be(i,r,r.pendingProps.children,c),uf(i,r),i===null&&(r.flags|=4194304),r.child;case 5:return i===null&&qt&&((g=f=ce)&&(f=_7(f,r.type,r.pendingProps,Cn),f!==null?(r.stateNode=f,Ie=r,ce=Nn(f.firstChild),Cn=!1,g=!0):g=!1),g||uo(r)),Ot(r),g=r.type,v=r.pendingProps,T=i!==null?i.memoizedProps:null,f=v.children,c0(g,v)?f=null:T!==null&&c0(g,T)&&(r.flags|=32),r.memoizedState!==null&&(g=lg(i,r,L$,null,null,c),Rl._currentValue=g),uf(i,r),Be(i,r,f,c),r.child;case 6:return i===null&&qt&&((i=c=ce)&&(c=S7(c,r.pendingProps,Cn),c!==null?(r.stateNode=c,Ie=r,ce=null,i=!0):i=!1),i||uo(r)),null;case 13:return UC(i,r,c);case 4:return ut(r,r.stateNode.containerInfo),f=r.pendingProps,i===null?r.child=yr(r,null,f,c):Be(i,r,f,c),r.child;case 11:return DC(i,r,r.type,r.pendingProps,c);case 7:return Be(i,r,r.pendingProps,c),r.child;case 8:return Be(i,r,r.pendingProps.children,c),r.child;case 12:return Be(i,r,r.pendingProps.children,c),r.child;case 10:return f=r.pendingProps,fo(r,r.type,f.value),Be(i,r,f.children,c),r.child;case 9:return g=r.type._context,f=r.pendingProps.children,hr(r),g=Pe(g),f=f(g),r.flags|=1,Be(i,r,f,c),r.child;case 14:return jC(i,r,r.type,r.pendingProps,c);case 15:return zC(i,r,r.type,r.pendingProps,c);case 19:return YC(i,r,c);case 31:return q$(i,r,c);case 22:return VC(i,r,c,r.pendingProps);case 24:return hr(r),f=Pe(Ee),i===null?(g=Wm(),g===null&&(g=oe,v=Km(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=c),g=v),r.memoizedState={parent:f,cache:g},tg(r),fo(r,Ee,g)):((i.lanes&c)!==0&&(eg(i,r),ul(r,null,null,c),cl()),g=i.memoizedState,v=r.memoizedState,g.parent!==f?(g={parent:f,cache:f},r.memoizedState=g,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=g),fo(r,Ee,f)):(f=v.cache,fo(r,Ee,f),f!==g.cache&&Zm(r,[Ee],c,!0))),Be(i,r,r.pendingProps.children,c),r.child;case 29:throw r.pendingProps}throw Error(o(156,r.tag))}function Di(i){i.flags|=4}function Vg(i,r,c,f,g){if((r=(i.mode&32)!==0)&&(r=!1),r){if(i.flags|=16777216,(g&335544128)===g)if(i.stateNode.complete)i.flags|=8192;else if(vT())i.flags|=8192;else throw gr=Xu,Jm}else i.flags&=-16777217}function GC(i,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)i.flags&=-16777217;else if(i.flags|=16777216,!aN(r))if(vT())i.flags|=8192;else throw gr=Xu,Jm}function df(i,r){r!==null&&(i.flags|=4),i.flags&16384&&(r=i.tag!==22?yu():536870912,i.lanes|=r,Os|=r)}function gl(i,r){if(!qt)switch(i.tailMode){case"hidden":r=i.tail;for(var c=null;r!==null;)r.alternate!==null&&(c=r),r=r.sibling;c===null?i.tail=null:c.sibling=null;break;case"collapsed":c=i.tail;for(var f=null;c!==null;)c.alternate!==null&&(f=c),c=c.sibling;f===null?r||i.tail===null?i.tail=null:i.tail.sibling=null:f.sibling=null}}function ue(i){var r=i.alternate!==null&&i.alternate.child===i.child,c=0,f=0;if(r)for(var g=i.child;g!==null;)c|=g.lanes|g.childLanes,f|=g.subtreeFlags&65011712,f|=g.flags&65011712,g.return=i,g=g.sibling;else for(g=i.child;g!==null;)c|=g.lanes|g.childLanes,f|=g.subtreeFlags,f|=g.flags,g.return=i,g=g.sibling;return i.subtreeFlags|=f,i.childLanes=c,r}function F$(i,r,c){var f=r.pendingProps;switch(Ym(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return ue(r),null;case 1:return ue(r),null;case 3:return c=r.stateNode,f=null,i!==null&&(f=i.memoizedState.cache),r.memoizedState.cache!==f&&(r.flags|=2048),Mi(Ee),dt(),c.pendingContext&&(c.context=c.pendingContext,c.pendingContext=null),(i===null||i.child===null)&&(bs(r)?Di(r):i===null||i.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Gm())),ue(r),null;case 26:var g=r.type,v=r.memoizedState;return i===null?(Di(r),v!==null?(ue(r),GC(r,v)):(ue(r),Vg(r,g,null,f,c))):v?v!==i.memoizedState?(Di(r),ue(r),GC(r,v)):(ue(r),r.flags&=-16777217):(i=i.memoizedProps,i!==f&&Di(r),ue(r),Vg(r,g,i,f,c)),null;case 27:if(At(r),c=ht.current,g=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==f&&Di(r);else{if(!f){if(r.stateNode===null)throw Error(o(166));return ue(r),null}i=rt.current,bs(r)?CE(r):(i=JT(g,f,c),r.stateNode=i,Di(r))}return ue(r),null;case 5:if(At(r),g=r.type,i!==null&&r.stateNode!=null)i.memoizedProps!==f&&Di(r);else{if(!f){if(r.stateNode===null)throw Error(o(166));return ue(r),null}if(v=rt.current,bs(r))CE(r);else{var T=Nf(ht.current);switch(v){case 1:v=T.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=T.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=T.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=T.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=T.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof f.is=="string"?T.createElement("select",{is:f.is}):T.createElement("select"),f.multiple?v.multiple=!0:f.size&&(v.size=f.size);break;default:v=typeof f.is=="string"?T.createElement(g,{is:f.is}):T.createElement(g)}}v[ke]=r,v[Ye]=f;t:for(T=r.child;T!==null;){if(T.tag===5||T.tag===6)v.appendChild(T.stateNode);else if(T.tag!==4&&T.tag!==27&&T.child!==null){T.child.return=T,T=T.child;continue}if(T===r)break t;for(;T.sibling===null;){if(T.return===null||T.return===r)break t;T=T.return}T.sibling.return=T.return,T=T.sibling}r.stateNode=v;t:switch(He(v,g,f),g){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break t;case"img":f=!0;break t;default:f=!1}f&&Di(r)}}return ue(r),Vg(r,r.type,i===null?null:i.memoizedProps,r.pendingProps,c),null;case 6:if(i&&r.stateNode!=null)i.memoizedProps!==f&&Di(r);else{if(typeof f!="string"&&r.stateNode===null)throw Error(o(166));if(i=ht.current,bs(r)){if(i=r.stateNode,c=r.memoizedProps,f=null,g=Ie,g!==null)switch(g.tag){case 27:case 5:f=g.memoizedProps}i[ke]=r,i=!!(i.nodeValue===c||f!==null&&f.suppressHydrationWarning===!0||UT(i.nodeValue,c)),i||uo(r,!0)}else i=Nf(i).createTextNode(f),i[ke]=r,r.stateNode=i}return ue(r),null;case 31:if(c=r.memoizedState,i===null||i.memoizedState!==null){if(f=bs(r),c!==null){if(i===null){if(!f)throw Error(o(318));if(i=r.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(o(557));i[ke]=r}else fr(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ue(r),i=!1}else c=Gm(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=c),i=!0;if(!i)return r.flags&256?(dn(r),r):(dn(r),null);if((r.flags&128)!==0)throw Error(o(558))}return ue(r),null;case 13:if(f=r.memoizedState,i===null||i.memoizedState!==null&&i.memoizedState.dehydrated!==null){if(g=bs(r),f!==null&&f.dehydrated!==null){if(i===null){if(!g)throw Error(o(318));if(g=r.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(o(317));g[ke]=r}else fr(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;ue(r),g=!1}else g=Gm(),i!==null&&i.memoizedState!==null&&(i.memoizedState.hydrationErrors=g),g=!0;if(!g)return r.flags&256?(dn(r),r):(dn(r),null)}return dn(r),(r.flags&128)!==0?(r.lanes=c,r):(c=f!==null,i=i!==null&&i.memoizedState!==null,c&&(f=r.child,g=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(g=f.alternate.memoizedState.cachePool.pool),v=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(v=f.memoizedState.cachePool.pool),v!==g&&(f.flags|=2048)),c!==i&&c&&(r.child.flags|=8192),df(r,r.updateQueue),ue(r),null);case 4:return dt(),i===null&&o0(r.stateNode.containerInfo),ue(r),null;case 10:return Mi(r.type),ue(r),null;case 19:if(F(be),f=r.memoizedState,f===null)return ue(r),null;if(g=(r.flags&128)!==0,v=f.rendering,v===null)if(g)gl(f,!1);else{if(ye!==0||i!==null&&(i.flags&128)!==0)for(i=r.child;i!==null;){if(v=Wu(i),v!==null){for(r.flags|=128,gl(f,!1),i=v.updateQueue,r.updateQueue=i,df(r,i),r.subtreeFlags=0,i=c,c=r.child;c!==null;)xE(c,i),c=c.sibling;return et(be,be.current&1|2),qt&&Ni(r,f.treeForkCount),r.child}i=i.sibling}f.tail!==null&&Vt()>yf&&(r.flags|=128,g=!0,gl(f,!1),r.lanes=4194304)}else{if(!g)if(i=Wu(v),i!==null){if(r.flags|=128,g=!0,i=i.updateQueue,r.updateQueue=i,df(r,i),gl(f,!0),f.tail===null&&f.tailMode==="hidden"&&!v.alternate&&!qt)return ue(r),null}else 2*Vt()-f.renderingStartTime>yf&&c!==536870912&&(r.flags|=128,g=!0,gl(f,!1),r.lanes=4194304);f.isBackwards?(v.sibling=r.child,r.child=v):(i=f.last,i!==null?i.sibling=v:r.child=v,f.last=v)}return f.tail!==null?(i=f.tail,f.rendering=i,f.tail=i.sibling,f.renderingStartTime=Vt(),i.sibling=null,c=be.current,et(be,g?c&1|2:c&1),qt&&Ni(r,f.treeForkCount),i):(ue(r),null);case 22:case 23:return dn(r),rg(),f=r.memoizedState!==null,i!==null?i.memoizedState!==null!==f&&(r.flags|=8192):f&&(r.flags|=8192),f?(c&536870912)!==0&&(r.flags&128)===0&&(ue(r),r.subtreeFlags&6&&(r.flags|=8192)):ue(r),c=r.updateQueue,c!==null&&df(r,c.retryQueue),c=null,i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),f=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),f!==c&&(r.flags|=2048),i!==null&&F(pr),null;case 24:return c=null,i!==null&&(c=i.memoizedState.cache),r.memoizedState.cache!==c&&(r.flags|=2048),Mi(Ee),ue(r),null;case 25:return null;case 30:return null}throw Error(o(156,r.tag))}function X$(i,r){switch(Ym(r),r.tag){case 1:return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 3:return Mi(Ee),dt(),i=r.flags,(i&65536)!==0&&(i&128)===0?(r.flags=i&-65537|128,r):null;case 26:case 27:case 5:return At(r),null;case 31:if(r.memoizedState!==null){if(dn(r),r.alternate===null)throw Error(o(340));fr()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 13:if(dn(r),i=r.memoizedState,i!==null&&i.dehydrated!==null){if(r.alternate===null)throw Error(o(340));fr()}return i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 19:return F(be),null;case 4:return dt(),null;case 10:return Mi(r.type),null;case 22:case 23:return dn(r),rg(),i!==null&&F(pr),i=r.flags,i&65536?(r.flags=i&-65537|128,r):null;case 24:return Mi(Ee),null;case 25:return null;default:return null}}function FC(i,r){switch(Ym(r),r.tag){case 3:Mi(Ee),dt();break;case 26:case 27:case 5:At(r);break;case 4:dt();break;case 31:r.memoizedState!==null&&dn(r);break;case 13:dn(r);break;case 19:F(be);break;case 10:Mi(r.type);break;case 22:case 23:dn(r),rg(),i!==null&&F(pr);break;case 24:Mi(Ee)}}function yl(i,r){try{var c=r.updateQueue,f=c!==null?c.lastEffect:null;if(f!==null){var g=f.next;c=g;do{if((c.tag&i)===i){f=void 0;var v=c.create,T=c.inst;f=v(),T.destroy=f}c=c.next}while(c!==g)}}catch(V){te(r,r.return,V)}}function vo(i,r,c){try{var f=r.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var v=g.next;f=v;do{if((f.tag&i)===i){var T=f.inst,V=T.destroy;if(V!==void 0){T.destroy=void 0,g=r;var Z=c,nt=V;try{nt()}catch(st){te(g,Z,st)}}}f=f.next}while(f!==v)}}catch(st){te(r,r.return,st)}}function XC(i){var r=i.updateQueue;if(r!==null){var c=i.stateNode;try{IE(r,c)}catch(f){te(i,i.return,f)}}}function ZC(i,r,c){c.props=br(i.type,i.memoizedProps),c.state=i.memoizedState;try{c.componentWillUnmount()}catch(f){te(i,r,f)}}function vl(i,r){try{var c=i.ref;if(c!==null){switch(i.tag){case 26:case 27:case 5:var f=i.stateNode;break;case 30:f=i.stateNode;break;default:f=i.stateNode}typeof c=="function"?i.refCleanup=c(f):c.current=f}}catch(g){te(i,r,g)}}function li(i,r){var c=i.ref,f=i.refCleanup;if(c!==null)if(typeof f=="function")try{f()}catch(g){te(i,r,g)}finally{i.refCleanup=null,i=i.alternate,i!=null&&(i.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(g){te(i,r,g)}else c.current=null}function KC(i){var r=i.type,c=i.memoizedProps,f=i.stateNode;try{t:switch(r){case"button":case"input":case"select":case"textarea":c.autoFocus&&f.focus();break t;case"img":c.src?f.src=c.src:c.srcSet&&(f.srcset=c.srcSet)}}catch(g){te(i,i.return,g)}}function Lg(i,r,c){try{var f=i.stateNode;g7(f,i.type,c,r),f[Ye]=r}catch(g){te(i,i.return,g)}}function QC(i){return i.tag===5||i.tag===3||i.tag===26||i.tag===27&&Co(i.type)||i.tag===4}function Ig(i){t:for(;;){for(;i.sibling===null;){if(i.return===null||QC(i.return))return null;i=i.return}for(i.sibling.return=i.return,i=i.sibling;i.tag!==5&&i.tag!==6&&i.tag!==18;){if(i.tag===27&&Co(i.type)||i.flags&2||i.child===null||i.tag===4)continue t;i.child.return=i,i=i.child}if(!(i.flags&2))return i.stateNode}}function Pg(i,r,c){var f=i.tag;if(f===5||f===6)i=i.stateNode,r?(c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c).insertBefore(i,r):(r=c.nodeType===9?c.body:c.nodeName==="HTML"?c.ownerDocument.body:c,r.appendChild(i),c=c._reactRootContainer,c!=null||r.onclick!==null||(r.onclick=Ei));else if(f!==4&&(f===27&&Co(i.type)&&(c=i.stateNode,r=null),i=i.child,i!==null))for(Pg(i,r,c),i=i.sibling;i!==null;)Pg(i,r,c),i=i.sibling}function hf(i,r,c){var f=i.tag;if(f===5||f===6)i=i.stateNode,r?c.insertBefore(i,r):c.appendChild(i);else if(f!==4&&(f===27&&Co(i.type)&&(c=i.stateNode),i=i.child,i!==null))for(hf(i,r,c),i=i.sibling;i!==null;)hf(i,r,c),i=i.sibling}function WC(i){var r=i.stateNode,c=i.memoizedProps;try{for(var f=i.type,g=r.attributes;g.length;)r.removeAttributeNode(g[0]);He(r,f,c),r[ke]=i,r[Ye]=c}catch(v){te(i,i.return,v)}}var ji=!1,Ne=!1,Bg=!1,JC=typeof WeakSet=="function"?WeakSet:Set,Ve=null;function Z$(i,r){if(i=i.containerInfo,a0=jf,i=fE(i),Dm(i)){if("selectionStart"in i)var c={start:i.selectionStart,end:i.selectionEnd};else t:{c=(c=i.ownerDocument)&&c.defaultView||window;var f=c.getSelection&&c.getSelection();if(f&&f.rangeCount!==0){c=f.anchorNode;var g=f.anchorOffset,v=f.focusNode;f=f.focusOffset;try{c.nodeType,v.nodeType}catch{c=null;break t}var T=0,V=-1,Z=-1,nt=0,st=0,lt=i,it=null;e:for(;;){for(var ot;lt!==c||g!==0&<.nodeType!==3||(V=T+g),lt!==v||f!==0&<.nodeType!==3||(Z=T+f),lt.nodeType===3&&(T+=lt.nodeValue.length),(ot=lt.firstChild)!==null;)it=lt,lt=ot;for(;;){if(lt===i)break e;if(it===c&&++nt===g&&(V=T),it===v&&++st===f&&(Z=T),(ot=lt.nextSibling)!==null)break;lt=it,it=lt.parentNode}lt=ot}c=V===-1||Z===-1?null:{start:V,end:Z}}else c=null}c=c||{start:0,end:0}}else c=null;for(l0={focusedElem:i,selectionRange:c},jf=!1,Ve=r;Ve!==null;)if(r=Ve,i=r.child,(r.subtreeFlags&1028)!==0&&i!==null)i.return=r,Ve=i;else for(;Ve!==null;){switch(r=Ve,v=r.alternate,i=r.flags,r.tag){case 0:if((i&4)!==0&&(i=r.updateQueue,i=i!==null?i.events:null,i!==null))for(c=0;c<i.length;c++)g=i[c],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((i&1024)!==0&&v!==null){i=void 0,c=r,g=v.memoizedProps,v=v.memoizedState,f=c.stateNode;try{var xt=br(c.type,g);i=f.getSnapshotBeforeUpdate(xt,v),f.__reactInternalSnapshotBeforeUpdate=i}catch(kt){te(c,c.return,kt)}}break;case 3:if((i&1024)!==0){if(i=r.stateNode.containerInfo,c=i.nodeType,c===9)f0(i);else if(c===1)switch(i.nodeName){case"HEAD":case"HTML":case"BODY":f0(i);break;default:i.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((i&1024)!==0)throw Error(o(163))}if(i=r.sibling,i!==null){i.return=r.return,Ve=i;break}Ve=r.return}}function tT(i,r,c){var f=c.flags;switch(c.tag){case 0:case 11:case 15:Vi(i,c),f&4&&yl(5,c);break;case 1:if(Vi(i,c),f&4)if(i=c.stateNode,r===null)try{i.componentDidMount()}catch(T){te(c,c.return,T)}else{var g=br(c.type,r.memoizedProps);r=r.memoizedState;try{i.componentDidUpdate(g,r,i.__reactInternalSnapshotBeforeUpdate)}catch(T){te(c,c.return,T)}}f&64&&XC(c),f&512&&vl(c,c.return);break;case 3:if(Vi(i,c),f&64&&(i=c.updateQueue,i!==null)){if(r=null,c.child!==null)switch(c.child.tag){case 27:case 5:r=c.child.stateNode;break;case 1:r=c.child.stateNode}try{IE(i,r)}catch(T){te(c,c.return,T)}}break;case 27:r===null&&f&4&&WC(c);case 26:case 5:Vi(i,c),r===null&&f&4&&KC(c),f&512&&vl(c,c.return);break;case 12:Vi(i,c);break;case 31:Vi(i,c),f&4&&iT(i,c);break;case 13:Vi(i,c),f&4&&oT(i,c),f&64&&(i=c.memoizedState,i!==null&&(i=i.dehydrated,i!==null&&(c=o7.bind(null,c),E7(i,c))));break;case 22:if(f=c.memoizedState!==null||ji,!f){r=r!==null&&r.memoizedState!==null||Ne,g=ji;var v=Ne;ji=f,(Ne=r)&&!v?Li(i,c,(c.subtreeFlags&8772)!==0):Vi(i,c),ji=g,Ne=v}break;case 30:break;default:Vi(i,c)}}function eT(i){var r=i.alternate;r!==null&&(i.alternate=null,eT(r)),i.child=null,i.deletions=null,i.sibling=null,i.tag===5&&(r=i.stateNode,r!==null&&Ya(r)),i.stateNode=null,i.return=null,i.dependencies=null,i.memoizedProps=null,i.memoizedState=null,i.pendingProps=null,i.stateNode=null,i.updateQueue=null}var de=null,Je=!1;function zi(i,r,c){for(c=c.child;c!==null;)nT(i,r,c),c=c.sibling}function nT(i,r,c){if(me&&typeof me.onCommitFiberUnmount=="function")try{me.onCommitFiberUnmount(Re,c)}catch{}switch(c.tag){case 26:Ne||li(c,r),zi(i,r,c),c.memoizedState?c.memoizedState.count--:c.stateNode&&(c=c.stateNode,c.parentNode.removeChild(c));break;case 27:Ne||li(c,r);var f=de,g=Je;Co(c.type)&&(de=c.stateNode,Je=!1),zi(i,r,c),Nl(c.stateNode),de=f,Je=g;break;case 5:Ne||li(c,r);case 6:if(f=de,g=Je,de=null,zi(i,r,c),de=f,Je=g,de!==null)if(Je)try{(de.nodeType===9?de.body:de.nodeName==="HTML"?de.ownerDocument.body:de).removeChild(c.stateNode)}catch(v){te(c,r,v)}else try{de.removeChild(c.stateNode)}catch(v){te(c,r,v)}break;case 18:de!==null&&(Je?(i=de,XT(i.nodeType===9?i.body:i.nodeName==="HTML"?i.ownerDocument.body:i,c.stateNode),Bs(i)):XT(de,c.stateNode));break;case 4:f=de,g=Je,de=c.stateNode.containerInfo,Je=!0,zi(i,r,c),de=f,Je=g;break;case 0:case 11:case 14:case 15:vo(2,c,r),Ne||vo(4,c,r),zi(i,r,c);break;case 1:Ne||(li(c,r),f=c.stateNode,typeof f.componentWillUnmount=="function"&&ZC(c,r,f)),zi(i,r,c);break;case 21:zi(i,r,c);break;case 22:Ne=(f=Ne)||c.memoizedState!==null,zi(i,r,c),Ne=f;break;default:zi(i,r,c)}}function iT(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null))){i=i.dehydrated;try{Bs(i)}catch(c){te(r,r.return,c)}}}function oT(i,r){if(r.memoizedState===null&&(i=r.alternate,i!==null&&(i=i.memoizedState,i!==null&&(i=i.dehydrated,i!==null))))try{Bs(i)}catch(c){te(r,r.return,c)}}function K$(i){switch(i.tag){case 31:case 13:case 19:var r=i.stateNode;return r===null&&(r=i.stateNode=new JC),r;case 22:return i=i.stateNode,r=i._retryCache,r===null&&(r=i._retryCache=new JC),r;default:throw Error(o(435,i.tag))}}function pf(i,r){var c=K$(i);r.forEach(function(f){if(!c.has(f)){c.add(f);var g=r7.bind(null,i,f);f.then(g,g)}})}function tn(i,r){var c=r.deletions;if(c!==null)for(var f=0;f<c.length;f++){var g=c[f],v=i,T=r,V=T;t:for(;V!==null;){switch(V.tag){case 27:if(Co(V.type)){de=V.stateNode,Je=!1;break t}break;case 5:de=V.stateNode,Je=!1;break t;case 3:case 4:de=V.stateNode.containerInfo,Je=!0;break t}V=V.return}if(de===null)throw Error(o(160));nT(v,T,g),de=null,Je=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)rT(r,i),r=r.sibling}var Yn=null;function rT(i,r){var c=i.alternate,f=i.flags;switch(i.tag){case 0:case 11:case 14:case 15:tn(r,i),en(i),f&4&&(vo(3,i,i.return),yl(3,i),vo(5,i,i.return));break;case 1:tn(r,i),en(i),f&512&&(Ne||c===null||li(c,c.return)),f&64&&ji&&(i=i.updateQueue,i!==null&&(f=i.callbacks,f!==null&&(c=i.shared.hiddenCallbacks,i.shared.hiddenCallbacks=c===null?f:c.concat(f))));break;case 26:var g=Yn;if(tn(r,i),en(i),f&512&&(Ne||c===null||li(c,c.return)),f&4){var v=c!==null?c.memoizedState:null;if(f=i.memoizedState,c===null)if(f===null)if(i.stateNode===null){t:{f=i.type,c=i.memoizedProps,g=g.ownerDocument||g;e:switch(f){case"title":v=g.getElementsByTagName("title")[0],(!v||v[ir]||v[ke]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(f),g.head.insertBefore(v,g.querySelector("head > title"))),He(v,f,c),v[ke]=i,Se(v),f=v;break t;case"link":var T=rN("link","href",g).get(f+(c.href||""));if(T){for(var V=0;V<T.length;V++)if(v=T[V],v.getAttribute("href")===(c.href==null||c.href===""?null:c.href)&&v.getAttribute("rel")===(c.rel==null?null:c.rel)&&v.getAttribute("title")===(c.title==null?null:c.title)&&v.getAttribute("crossorigin")===(c.crossOrigin==null?null:c.crossOrigin)){T.splice(V,1);break e}}v=g.createElement(f),He(v,f,c),g.head.appendChild(v);break;case"meta":if(T=rN("meta","content",g).get(f+(c.content||""))){for(V=0;V<T.length;V++)if(v=T[V],v.getAttribute("content")===(c.content==null?null:""+c.content)&&v.getAttribute("name")===(c.name==null?null:c.name)&&v.getAttribute("property")===(c.property==null?null:c.property)&&v.getAttribute("http-equiv")===(c.httpEquiv==null?null:c.httpEquiv)&&v.getAttribute("charset")===(c.charSet==null?null:c.charSet)){T.splice(V,1);break e}}v=g.createElement(f),He(v,f,c),g.head.appendChild(v);break;default:throw Error(o(468,f))}v[ke]=i,Se(v),f=v}i.stateNode=f}else sN(g,i.type,i.stateNode);else i.stateNode=oN(g,f,i.memoizedProps);else v!==f?(v===null?c.stateNode!==null&&(c=c.stateNode,c.parentNode.removeChild(c)):v.count--,f===null?sN(g,i.type,i.stateNode):oN(g,f,i.memoizedProps)):f===null&&i.stateNode!==null&&Lg(i,i.memoizedProps,c.memoizedProps)}break;case 27:tn(r,i),en(i),f&512&&(Ne||c===null||li(c,c.return)),c!==null&&f&4&&Lg(i,i.memoizedProps,c.memoizedProps);break;case 5:if(tn(r,i),en(i),f&512&&(Ne||c===null||li(c,c.return)),i.flags&32){g=i.stateNode;try{cs(g,"")}catch(xt){te(i,i.return,xt)}}f&4&&i.stateNode!=null&&(g=i.memoizedProps,Lg(i,g,c!==null?c.memoizedProps:g)),f&1024&&(Bg=!0);break;case 6:if(tn(r,i),en(i),f&4){if(i.stateNode===null)throw Error(o(162));f=i.memoizedProps,c=i.stateNode;try{c.nodeValue=f}catch(xt){te(i,i.return,xt)}}break;case 3:if(Rf=null,g=Yn,Yn=Af(r.containerInfo),tn(r,i),Yn=g,en(i),f&4&&c!==null&&c.memoizedState.isDehydrated)try{Bs(r.containerInfo)}catch(xt){te(i,i.return,xt)}Bg&&(Bg=!1,sT(i));break;case 4:f=Yn,Yn=Af(i.stateNode.containerInfo),tn(r,i),en(i),Yn=f;break;case 12:tn(r,i),en(i);break;case 31:tn(r,i),en(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,pf(i,f)));break;case 13:tn(r,i),en(i),i.child.flags&8192&&i.memoizedState!==null!=(c!==null&&c.memoizedState!==null)&&(gf=Vt()),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,pf(i,f)));break;case 22:g=i.memoizedState!==null;var Z=c!==null&&c.memoizedState!==null,nt=ji,st=Ne;if(ji=nt||g,Ne=st||Z,tn(r,i),Ne=st,ji=nt,en(i),f&8192)t:for(r=i.stateNode,r._visibility=g?r._visibility&-2:r._visibility|1,g&&(c===null||Z||ji||Ne||xr(i)),c=null,r=i;;){if(r.tag===5||r.tag===26){if(c===null){Z=c=r;try{if(v=Z.stateNode,g)T=v.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none";else{V=Z.stateNode;var lt=Z.memoizedProps.style,it=lt!=null&<.hasOwnProperty("display")?lt.display:null;V.style.display=it==null||typeof it=="boolean"?"":(""+it).trim()}}catch(xt){te(Z,Z.return,xt)}}}else if(r.tag===6){if(c===null){Z=r;try{Z.stateNode.nodeValue=g?"":Z.memoizedProps}catch(xt){te(Z,Z.return,xt)}}}else if(r.tag===18){if(c===null){Z=r;try{var ot=Z.stateNode;g?ZT(ot,!0):ZT(Z.stateNode,!1)}catch(xt){te(Z,Z.return,xt)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===i)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===i)break t;for(;r.sibling===null;){if(r.return===null||r.return===i)break t;c===r&&(c=null),r=r.return}c===r&&(c=null),r.sibling.return=r.return,r=r.sibling}f&4&&(f=i.updateQueue,f!==null&&(c=f.retryQueue,c!==null&&(f.retryQueue=null,pf(i,c))));break;case 19:tn(r,i),en(i),f&4&&(f=i.updateQueue,f!==null&&(i.updateQueue=null,pf(i,f)));break;case 30:break;case 21:break;default:tn(r,i),en(i)}}function en(i){var r=i.flags;if(r&2){try{for(var c,f=i.return;f!==null;){if(QC(f)){c=f;break}f=f.return}if(c==null)throw Error(o(160));switch(c.tag){case 27:var g=c.stateNode,v=Ig(i);hf(i,v,g);break;case 5:var T=c.stateNode;c.flags&32&&(cs(T,""),c.flags&=-33);var V=Ig(i);hf(i,V,T);break;case 3:case 4:var Z=c.stateNode.containerInfo,nt=Ig(i);Pg(i,nt,Z);break;default:throw Error(o(161))}}catch(st){te(i,i.return,st)}i.flags&=-3}r&4096&&(i.flags&=-4097)}function sT(i){if(i.subtreeFlags&1024)for(i=i.child;i!==null;){var r=i;sT(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),i=i.sibling}}function Vi(i,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)tT(i,r.alternate,r),r=r.sibling}function xr(i){for(i=i.child;i!==null;){var r=i;switch(r.tag){case 0:case 11:case 14:case 15:vo(4,r,r.return),xr(r);break;case 1:li(r,r.return);var c=r.stateNode;typeof c.componentWillUnmount=="function"&&ZC(r,r.return,c),xr(r);break;case 27:Nl(r.stateNode);case 26:case 5:li(r,r.return),xr(r);break;case 22:r.memoizedState===null&&xr(r);break;case 30:xr(r);break;default:xr(r)}i=i.sibling}}function Li(i,r,c){for(c=c&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var f=r.alternate,g=i,v=r,T=v.flags;switch(v.tag){case 0:case 11:case 15:Li(g,v,c),yl(4,v);break;case 1:if(Li(g,v,c),f=v,g=f.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(nt){te(f,f.return,nt)}if(f=v,g=f.updateQueue,g!==null){var V=f.stateNode;try{var Z=g.shared.hiddenCallbacks;if(Z!==null)for(g.shared.hiddenCallbacks=null,g=0;g<Z.length;g++)LE(Z[g],V)}catch(nt){te(f,f.return,nt)}}c&&T&64&&XC(v),vl(v,v.return);break;case 27:WC(v);case 26:case 5:Li(g,v,c),c&&f===null&&T&4&&KC(v),vl(v,v.return);break;case 12:Li(g,v,c);break;case 31:Li(g,v,c),c&&T&4&&iT(g,v);break;case 13:Li(g,v,c),c&&T&4&&oT(g,v);break;case 22:v.memoizedState===null&&Li(g,v,c),vl(v,v.return);break;case 30:break;default:Li(g,v,c)}r=r.sibling}}function Hg(i,r){var c=null;i!==null&&i.memoizedState!==null&&i.memoizedState.cachePool!==null&&(c=i.memoizedState.cachePool.pool),i=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(i=r.memoizedState.cachePool.pool),i!==c&&(i!=null&&i.refCount++,c!=null&&ol(c))}function Ug(i,r){i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&ol(i))}function qn(i,r,c,f){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)aT(i,r,c,f),r=r.sibling}function aT(i,r,c,f){var g=r.flags;switch(r.tag){case 0:case 11:case 15:qn(i,r,c,f),g&2048&&yl(9,r);break;case 1:qn(i,r,c,f);break;case 3:qn(i,r,c,f),g&2048&&(i=null,r.alternate!==null&&(i=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==i&&(r.refCount++,i!=null&&ol(i)));break;case 12:if(g&2048){qn(i,r,c,f),i=r.stateNode;try{var v=r.memoizedProps,T=v.id,V=v.onPostCommit;typeof V=="function"&&V(T,r.alternate===null?"mount":"update",i.passiveEffectDuration,-0)}catch(Z){te(r,r.return,Z)}}else qn(i,r,c,f);break;case 31:qn(i,r,c,f);break;case 13:qn(i,r,c,f);break;case 23:break;case 22:v=r.stateNode,T=r.alternate,r.memoizedState!==null?v._visibility&2?qn(i,r,c,f):bl(i,r):v._visibility&2?qn(i,r,c,f):(v._visibility|=2,Ms(i,r,c,f,(r.subtreeFlags&10256)!==0||!1)),g&2048&&Hg(T,r);break;case 24:qn(i,r,c,f),g&2048&&Ug(r.alternate,r);break;default:qn(i,r,c,f)}}function Ms(i,r,c,f,g){for(g=g&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var v=i,T=r,V=c,Z=f,nt=T.flags;switch(T.tag){case 0:case 11:case 15:Ms(v,T,V,Z,g),yl(8,T);break;case 23:break;case 22:var st=T.stateNode;T.memoizedState!==null?st._visibility&2?Ms(v,T,V,Z,g):bl(v,T):(st._visibility|=2,Ms(v,T,V,Z,g)),g&&nt&2048&&Hg(T.alternate,T);break;case 24:Ms(v,T,V,Z,g),g&&nt&2048&&Ug(T.alternate,T);break;default:Ms(v,T,V,Z,g)}r=r.sibling}}function bl(i,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var c=i,f=r,g=f.flags;switch(f.tag){case 22:bl(c,f),g&2048&&Hg(f.alternate,f);break;case 24:bl(c,f),g&2048&&Ug(f.alternate,f);break;default:bl(c,f)}r=r.sibling}}var xl=8192;function Rs(i,r,c){if(i.subtreeFlags&xl)for(i=i.child;i!==null;)lT(i,r,c),i=i.sibling}function lT(i,r,c){switch(i.tag){case 26:Rs(i,r,c),i.flags&xl&&i.memoizedState!==null&&V7(c,Yn,i.memoizedState,i.memoizedProps);break;case 5:Rs(i,r,c);break;case 3:case 4:var f=Yn;Yn=Af(i.stateNode.containerInfo),Rs(i,r,c),Yn=f;break;case 22:i.memoizedState===null&&(f=i.alternate,f!==null&&f.memoizedState!==null?(f=xl,xl=16777216,Rs(i,r,c),xl=f):Rs(i,r,c));break;default:Rs(i,r,c)}}function cT(i){var r=i.alternate;if(r!==null&&(i=r.child,i!==null)){r.child=null;do r=i.sibling,i.sibling=null,i=r;while(i!==null)}}function wl(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var f=r[c];Ve=f,fT(f,i)}cT(i)}if(i.subtreeFlags&10256)for(i=i.child;i!==null;)uT(i),i=i.sibling}function uT(i){switch(i.tag){case 0:case 11:case 15:wl(i),i.flags&2048&&vo(9,i,i.return);break;case 3:wl(i);break;case 12:wl(i);break;case 22:var r=i.stateNode;i.memoizedState!==null&&r._visibility&2&&(i.return===null||i.return.tag!==13)?(r._visibility&=-3,mf(i)):wl(i);break;default:wl(i)}}function mf(i){var r=i.deletions;if((i.flags&16)!==0){if(r!==null)for(var c=0;c<r.length;c++){var f=r[c];Ve=f,fT(f,i)}cT(i)}for(i=i.child;i!==null;){switch(r=i,r.tag){case 0:case 11:case 15:vo(8,r,r.return),mf(r);break;case 22:c=r.stateNode,c._visibility&2&&(c._visibility&=-3,mf(r));break;default:mf(r)}i=i.sibling}}function fT(i,r){for(;Ve!==null;){var c=Ve;switch(c.tag){case 0:case 11:case 15:vo(8,c,r);break;case 23:case 22:if(c.memoizedState!==null&&c.memoizedState.cachePool!==null){var f=c.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:ol(c.memoizedState.cache)}if(f=c.child,f!==null)f.return=c,Ve=f;else t:for(c=i;Ve!==null;){f=Ve;var g=f.sibling,v=f.return;if(eT(f),f===c){Ve=null;break t}if(g!==null){g.return=v,Ve=g;break t}Ve=v}}}var Q$={getCacheForType:function(i){var r=Pe(Ee),c=r.data.get(i);return c===void 0&&(c=i(),r.data.set(i,c)),c},cacheSignal:function(){return Pe(Ee).controller.signal}},W$=typeof WeakMap=="function"?WeakMap:Map,Qt=0,oe=null,Ht=null,$t=0,Jt=0,hn=null,bo=!1,ks=!1,$g=!1,Ii=0,ye=0,xo=0,wr=0,Yg=0,pn=0,Os=0,_l=null,nn=null,qg=!1,gf=0,dT=0,yf=1/0,vf=null,wo=null,Oe=0,_o=null,Ds=null,Pi=0,Gg=0,Fg=null,hT=null,Sl=0,Xg=null;function mn(){return(Qt&2)!==0&&$t!==0?$t&-$t:j.T!==null?t0():wu()}function pT(){if(pn===0)if(($t&536870912)===0||qt){var i=ns;ns<<=1,(ns&3932160)===0&&(ns=262144),pn=i}else pn=536870912;return i=fn.current,i!==null&&(i.flags|=32),pn}function on(i,r,c){(i===oe&&(Jt===2||Jt===9)||i.cancelPendingCommit!==null)&&(js(i,0),So(i,$t,pn,!1)),nr(i,c),((Qt&2)===0||i!==oe)&&(i===oe&&((Qt&2)===0&&(wr|=c),ye===4&&So(i,$t,pn,!1)),ci(i))}function mT(i,r,c){if((Qt&6)!==0)throw Error(o(327));var f=!c&&(r&127)===0&&(r&i.expiredLanes)===0||er(i,r),g=f?e7(i,r):Kg(i,r,!0),v=f;do{if(g===0){ks&&!f&&So(i,r,0,!1);break}else{if(c=i.current.alternate,v&&!J$(c)){g=Kg(i,r,!1),v=!1;continue}if(g===2){if(v=r,i.errorRecoveryDisabledLanes&v)var T=0;else T=i.pendingLanes&-536870913,T=T!==0?T:T&536870912?536870912:0;if(T!==0){r=T;t:{var V=i;g=_l;var Z=V.current.memoizedState.isDehydrated;if(Z&&(js(V,T).flags|=256),T=Kg(V,T,!1),T!==2){if($g&&!Z){V.errorRecoveryDisabledLanes|=v,wr|=v,g=4;break t}v=nn,nn=g,v!==null&&(nn===null?nn=v:nn.push.apply(nn,v))}g=T}if(v=!1,g!==2)continue}}if(g===1){js(i,0),So(i,r,0,!0);break}t:{switch(f=i,v=g,v){case 0:case 1:throw Error(o(345));case 4:if((r&4194048)!==r)break;case 6:So(f,r,pn,!bo);break t;case 2:nn=null;break;case 3:case 5:break;default:throw Error(o(329))}if((r&62914560)===r&&(g=gf+300-Vt(),10<g)){if(So(f,r,pn,!bo),os(f,0,!0)!==0)break t;Pi=r,f.timeoutHandle=GT(gT.bind(null,f,c,nn,vf,qg,r,pn,wr,Os,bo,v,"Throttled",-0,0),g);break t}gT(f,c,nn,vf,qg,r,pn,wr,Os,bo,v,null,-0,0)}}break}while(!0);ci(i)}function gT(i,r,c,f,g,v,T,V,Z,nt,st,lt,it,ot){if(i.timeoutHandle=-1,lt=r.subtreeFlags,lt&8192||(lt&16785408)===16785408){lt={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Ei},lT(r,v,lt);var xt=(v&62914560)===v?gf-Vt():(v&4194048)===v?dT-Vt():0;if(xt=L7(lt,xt),xt!==null){Pi=v,i.cancelPendingCommit=xt(ET.bind(null,i,r,v,c,f,g,T,V,Z,st,lt,null,it,ot)),So(i,v,T,!nt);return}}ET(i,r,v,c,f,g,T,V,Z)}function J$(i){for(var r=i;;){var c=r.tag;if((c===0||c===11||c===15)&&r.flags&16384&&(c=r.updateQueue,c!==null&&(c=c.stores,c!==null)))for(var f=0;f<c.length;f++){var g=c[f],v=g.getSnapshot;g=g.value;try{if(!cn(v(),g))return!1}catch{return!1}}if(c=r.child,r.subtreeFlags&16384&&c!==null)c.return=r,r=c;else{if(r===i)break;for(;r.sibling===null;){if(r.return===null||r.return===i)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function So(i,r,c,f){r&=~Yg,r&=~wr,i.suspendedLanes|=r,i.pingedLanes&=~r,f&&(i.warmLanes|=r),f=i.expirationTimes;for(var g=r;0<g;){var v=31-ze(g),T=1<<v;f[v]=-1,g&=~T}c!==0&&vu(i,c,r)}function bf(){return(Qt&6)===0?(El(0),!1):!0}function Zg(){if(Ht!==null){if(Jt===0)var i=Ht.return;else i=Ht,Ai=dr=null,fg(i),Es=null,sl=0,i=Ht;for(;i!==null;)FC(i.alternate,i),i=i.return;Ht=null}}function js(i,r){var c=i.timeoutHandle;c!==-1&&(i.timeoutHandle=-1,b7(c)),c=i.cancelPendingCommit,c!==null&&(i.cancelPendingCommit=null,c()),Pi=0,Zg(),oe=i,Ht=c=Ti(i.current,null),$t=r,Jt=0,hn=null,bo=!1,ks=er(i,r),$g=!1,Os=pn=Yg=wr=xo=ye=0,nn=_l=null,qg=!1,(r&8)!==0&&(r|=r&32);var f=i.entangledLanes;if(f!==0)for(i=i.entanglements,f&=r;0<f;){var g=31-ze(f),v=1<<g;r|=i[g],f&=~v}return Ii=r,Pu(),c}function yT(i,r){Lt=null,j.H=pl,r===Ss||r===Fu?(r=DE(),Jt=3):r===Jm?(r=DE(),Jt=4):Jt=r===Ng?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,hn=r,Ht===null&&(ye=1,lf(i,_n(r,i.current)))}function vT(){var i=fn.current;return i===null?!0:($t&4194048)===$t?Tn===null:($t&62914560)===$t||($t&536870912)!==0?i===Tn:!1}function bT(){var i=j.H;return j.H=pl,i===null?pl:i}function xT(){var i=j.A;return j.A=Q$,i}function xf(){ye=4,bo||($t&4194048)!==$t&&fn.current!==null||(ks=!0),(xo&134217727)===0&&(wr&134217727)===0||oe===null||So(oe,$t,pn,!1)}function Kg(i,r,c){var f=Qt;Qt|=2;var g=bT(),v=xT();(oe!==i||$t!==r)&&(vf=null,js(i,r)),r=!1;var T=ye;t:do try{if(Jt!==0&&Ht!==null){var V=Ht,Z=hn;switch(Jt){case 8:Zg(),T=6;break t;case 3:case 2:case 9:case 6:fn.current===null&&(r=!0);var nt=Jt;if(Jt=0,hn=null,zs(i,V,Z,nt),c&&ks){T=0;break t}break;default:nt=Jt,Jt=0,hn=null,zs(i,V,Z,nt)}}t7(),T=ye;break}catch(st){yT(i,st)}while(!0);return r&&i.shellSuspendCounter++,Ai=dr=null,Qt=f,j.H=g,j.A=v,Ht===null&&(oe=null,$t=0,Pu()),T}function t7(){for(;Ht!==null;)wT(Ht)}function e7(i,r){var c=Qt;Qt|=2;var f=bT(),g=xT();oe!==i||$t!==r?(vf=null,yf=Vt()+500,js(i,r)):ks=er(i,r);t:do try{if(Jt!==0&&Ht!==null){r=Ht;var v=hn;e:switch(Jt){case 1:Jt=0,hn=null,zs(i,r,v,1);break;case 2:case 9:if(kE(v)){Jt=0,hn=null,_T(r);break}r=function(){Jt!==2&&Jt!==9||oe!==i||(Jt=7),ci(i)},v.then(r,r);break t;case 3:Jt=7;break t;case 4:Jt=5;break t;case 7:kE(v)?(Jt=0,hn=null,_T(r)):(Jt=0,hn=null,zs(i,r,v,7));break;case 5:var T=null;switch(Ht.tag){case 26:T=Ht.memoizedState;case 5:case 27:var V=Ht;if(T?aN(T):V.stateNode.complete){Jt=0,hn=null;var Z=V.sibling;if(Z!==null)Ht=Z;else{var nt=V.return;nt!==null?(Ht=nt,wf(nt)):Ht=null}break e}}Jt=0,hn=null,zs(i,r,v,5);break;case 6:Jt=0,hn=null,zs(i,r,v,6);break;case 8:Zg(),ye=6;break t;default:throw Error(o(462))}}n7();break}catch(st){yT(i,st)}while(!0);return Ai=dr=null,j.H=f,j.A=g,Qt=c,Ht!==null?0:(oe=null,$t=0,Pu(),ye)}function n7(){for(;Ht!==null&&!It();)wT(Ht)}function wT(i){var r=qC(i.alternate,i,Ii);i.memoizedProps=i.pendingProps,r===null?wf(i):Ht=r}function _T(i){var r=i,c=r.alternate;switch(r.tag){case 15:case 0:r=PC(c,r,r.pendingProps,r.type,void 0,$t);break;case 11:r=PC(c,r,r.pendingProps,r.type.render,r.ref,$t);break;case 5:fg(r);default:FC(c,r),r=Ht=xE(r,Ii),r=qC(c,r,Ii)}i.memoizedProps=i.pendingProps,r===null?wf(i):Ht=r}function zs(i,r,c,f){Ai=dr=null,fg(r),Es=null,sl=0;var g=r.return;try{if(Y$(i,g,r,c,$t)){ye=1,lf(i,_n(c,i.current)),Ht=null;return}}catch(v){if(g!==null)throw Ht=g,v;ye=1,lf(i,_n(c,i.current)),Ht=null;return}r.flags&32768?(qt||f===1?i=!0:ks||($t&536870912)!==0?i=!1:(bo=i=!0,(f===2||f===9||f===3||f===6)&&(f=fn.current,f!==null&&f.tag===13&&(f.flags|=16384))),ST(r,i)):wf(r)}function wf(i){var r=i;do{if((r.flags&32768)!==0){ST(r,bo);return}i=r.return;var c=F$(r.alternate,r,Ii);if(c!==null){Ht=c;return}if(r=r.sibling,r!==null){Ht=r;return}Ht=r=i}while(r!==null);ye===0&&(ye=5)}function ST(i,r){do{var c=X$(i.alternate,i);if(c!==null){c.flags&=32767,Ht=c;return}if(c=i.return,c!==null&&(c.flags|=32768,c.subtreeFlags=0,c.deletions=null),!r&&(i=i.sibling,i!==null)){Ht=i;return}Ht=i=c}while(i!==null);ye=6,Ht=null}function ET(i,r,c,f,g,v,T,V,Z){i.cancelPendingCommit=null;do _f();while(Oe!==0);if((Qt&6)!==0)throw Error(o(327));if(r!==null){if(r===i.current)throw Error(o(177));if(v=r.lanes|r.childLanes,v|=Im,pm(i,c,v,T,V,Z),i===oe&&(Ht=oe=null,$t=0),Ds=r,_o=i,Pi=c,Gg=v,Fg=g,hT=f,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(i.callbackNode=null,i.callbackPriority=0,s7(xn,function(){return MT(),null})):(i.callbackNode=null,i.callbackPriority=0),f=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||f){f=j.T,j.T=null,g=I.p,I.p=2,T=Qt,Qt|=4;try{Z$(i,r,c)}finally{Qt=T,I.p=g,j.T=f}}Oe=1,CT(),TT(),NT()}}function CT(){if(Oe===1){Oe=0;var i=_o,r=Ds,c=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||c){c=j.T,j.T=null;var f=I.p;I.p=2;var g=Qt;Qt|=4;try{rT(r,i);var v=l0,T=fE(i.containerInfo),V=v.focusedElem,Z=v.selectionRange;if(T!==V&&V&&V.ownerDocument&&uE(V.ownerDocument.documentElement,V)){if(Z!==null&&Dm(V)){var nt=Z.start,st=Z.end;if(st===void 0&&(st=nt),"selectionStart"in V)V.selectionStart=nt,V.selectionEnd=Math.min(st,V.value.length);else{var lt=V.ownerDocument||document,it=lt&<.defaultView||window;if(it.getSelection){var ot=it.getSelection(),xt=V.textContent.length,kt=Math.min(Z.start,xt),ie=Z.end===void 0?kt:Math.min(Z.end,xt);!ot.extend&&kt>ie&&(T=ie,ie=kt,kt=T);var J=cE(V,kt),Q=cE(V,ie);if(J&&Q&&(ot.rangeCount!==1||ot.anchorNode!==J.node||ot.anchorOffset!==J.offset||ot.focusNode!==Q.node||ot.focusOffset!==Q.offset)){var tt=lt.createRange();tt.setStart(J.node,J.offset),ot.removeAllRanges(),kt>ie?(ot.addRange(tt),ot.extend(Q.node,Q.offset)):(tt.setEnd(Q.node,Q.offset),ot.addRange(tt))}}}}for(lt=[],ot=V;ot=ot.parentNode;)ot.nodeType===1&<.push({element:ot,left:ot.scrollLeft,top:ot.scrollTop});for(typeof V.focus=="function"&&V.focus(),V=0;V<lt.length;V++){var at=lt[V];at.element.scrollLeft=at.left,at.element.scrollTop=at.top}}jf=!!a0,l0=a0=null}finally{Qt=g,I.p=f,j.T=c}}i.current=r,Oe=2}}function TT(){if(Oe===2){Oe=0;var i=_o,r=Ds,c=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||c){c=j.T,j.T=null;var f=I.p;I.p=2;var g=Qt;Qt|=4;try{tT(i,r.alternate,r)}finally{Qt=g,I.p=f,j.T=c}}Oe=3}}function NT(){if(Oe===4||Oe===3){Oe=0,zt();var i=_o,r=Ds,c=Pi,f=hT;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Oe=5:(Oe=0,Ds=_o=null,AT(i,i.pendingLanes));var g=i.pendingLanes;if(g===0&&(wo=null),$a(c),r=r.stateNode,me&&typeof me.onCommitFiberRoot=="function")try{me.onCommitFiberRoot(Re,r,void 0,(r.current.flags&128)===128)}catch{}if(f!==null){r=j.T,g=I.p,I.p=2,j.T=null;try{for(var v=i.onRecoverableError,T=0;T<f.length;T++){var V=f[T];v(V.value,{componentStack:V.stack})}}finally{j.T=r,I.p=g}}(Pi&3)!==0&&_f(),ci(i),g=i.pendingLanes,(c&261930)!==0&&(g&42)!==0?i===Xg?Sl++:(Sl=0,Xg=i):Sl=0,El(0)}}function AT(i,r){(i.pooledCacheLanes&=r)===0&&(r=i.pooledCache,r!=null&&(i.pooledCache=null,ol(r)))}function _f(){return CT(),TT(),NT(),MT()}function MT(){if(Oe!==5)return!1;var i=_o,r=Gg;Gg=0;var c=$a(Pi),f=j.T,g=I.p;try{I.p=32>c?32:c,j.T=null,c=Fg,Fg=null;var v=_o,T=Pi;if(Oe=0,Ds=_o=null,Pi=0,(Qt&6)!==0)throw Error(o(331));var V=Qt;if(Qt|=4,uT(v.current),aT(v,v.current,T,c),Qt=V,El(0,!1),me&&typeof me.onPostCommitFiberRoot=="function")try{me.onPostCommitFiberRoot(Re,v)}catch{}return!0}finally{I.p=g,j.T=f,AT(i,r)}}function RT(i,r,c){r=_n(c,r),r=Tg(i.stateNode,r,2),i=mo(i,r,2),i!==null&&(nr(i,2),ci(i))}function te(i,r,c){if(i.tag===3)RT(i,i,c);else for(;r!==null;){if(r.tag===3){RT(r,i,c);break}else if(r.tag===1){var f=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(wo===null||!wo.has(f))){i=_n(c,i),c=kC(2),f=mo(r,c,2),f!==null&&(OC(c,f,r,i),nr(f,2),ci(f));break}}r=r.return}}function Qg(i,r,c){var f=i.pingCache;if(f===null){f=i.pingCache=new W$;var g=new Set;f.set(r,g)}else g=f.get(r),g===void 0&&(g=new Set,f.set(r,g));g.has(c)||($g=!0,g.add(c),i=i7.bind(null,i,r,c),r.then(i,i))}function i7(i,r,c){var f=i.pingCache;f!==null&&f.delete(r),i.pingedLanes|=i.suspendedLanes&c,i.warmLanes&=~c,oe===i&&($t&c)===c&&(ye===4||ye===3&&($t&62914560)===$t&&300>Vt()-gf?(Qt&2)===0&&js(i,0):Yg|=c,Os===$t&&(Os=0)),ci(i)}function kT(i,r){r===0&&(r=yu()),i=cr(i,r),i!==null&&(nr(i,r),ci(i))}function o7(i){var r=i.memoizedState,c=0;r!==null&&(c=r.retryLane),kT(i,c)}function r7(i,r){var c=0;switch(i.tag){case 31:case 13:var f=i.stateNode,g=i.memoizedState;g!==null&&(c=g.retryLane);break;case 19:f=i.stateNode;break;case 22:f=i.stateNode._retryCache;break;default:throw Error(o(314))}f!==null&&f.delete(r),kT(i,c)}function s7(i,r){return mt(i,r)}var Sf=null,Vs=null,Wg=!1,Ef=!1,Jg=!1,Eo=0;function ci(i){i!==Vs&&i.next===null&&(Vs===null?Sf=Vs=i:Vs=Vs.next=i),Ef=!0,Wg||(Wg=!0,l7())}function El(i,r){if(!Jg&&Ef){Jg=!0;do for(var c=!1,f=Sf;f!==null;){if(i!==0){var g=f.pendingLanes;if(g===0)var v=0;else{var T=f.suspendedLanes,V=f.pingedLanes;v=(1<<31-ze(42|i)+1)-1,v&=g&~(T&~V),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(c=!0,zT(f,v))}else v=$t,v=os(f,f===oe?v:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(v&3)===0||er(f,v)||(c=!0,zT(f,v));f=f.next}while(c);Jg=!1}}function a7(){OT()}function OT(){Ef=Wg=!1;var i=0;Eo!==0&&v7()&&(i=Eo);for(var r=Vt(),c=null,f=Sf;f!==null;){var g=f.next,v=DT(f,r);v===0?(f.next=null,c===null?Sf=g:c.next=g,g===null&&(Vs=c)):(c=f,(i!==0||(v&3)!==0)&&(Ef=!0)),f=g}Oe!==0&&Oe!==5||El(i),Eo!==0&&(Eo=0)}function DT(i,r){for(var c=i.suspendedLanes,f=i.pingedLanes,g=i.expirationTimes,v=i.pendingLanes&-62914561;0<v;){var T=31-ze(v),V=1<<T,Z=g[T];Z===-1?((V&c)===0||(V&f)!==0)&&(g[T]=hm(V,r)):Z<=r&&(i.expiredLanes|=V),v&=~V}if(r=oe,c=$t,c=os(i,i===r?c:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f=i.callbackNode,c===0||i===r&&(Jt===2||Jt===9)||i.cancelPendingCommit!==null)return f!==null&&f!==null&&Ct(f),i.callbackNode=null,i.callbackPriority=0;if((c&3)===0||er(i,c)){if(r=c&-c,r===i.callbackPriority)return r;switch(f!==null&&Ct(f),$a(c)){case 2:case 8:c=je;break;case 32:c=xn;break;case 268435456:c=Hn;break;default:c=xn}return f=jT.bind(null,i),c=mt(c,f),i.callbackPriority=r,i.callbackNode=c,r}return f!==null&&f!==null&&Ct(f),i.callbackPriority=2,i.callbackNode=null,2}function jT(i,r){if(Oe!==0&&Oe!==5)return i.callbackNode=null,i.callbackPriority=0,null;var c=i.callbackNode;if(_f()&&i.callbackNode!==c)return null;var f=$t;return f=os(i,i===oe?f:0,i.cancelPendingCommit!==null||i.timeoutHandle!==-1),f===0?null:(mT(i,f,r),DT(i,Vt()),i.callbackNode!=null&&i.callbackNode===c?jT.bind(null,i):null)}function zT(i,r){if(_f())return null;mT(i,r,!0)}function l7(){x7(function(){(Qt&6)!==0?mt(Wt,a7):OT()})}function t0(){if(Eo===0){var i=ws;i===0&&(i=es,es<<=1,(es&261888)===0&&(es=256)),Eo=i}return Eo}function VT(i){return i==null||typeof i=="symbol"||typeof i=="boolean"?null:typeof i=="function"?i:ku(""+i)}function LT(i,r){var c=r.ownerDocument.createElement("input");return c.name=r.name,c.value=r.value,i.id&&c.setAttribute("form",i.id),r.parentNode.insertBefore(c,r),i=new FormData(i),c.parentNode.removeChild(c),i}function c7(i,r,c,f,g){if(r==="submit"&&c&&c.stateNode===g){var v=VT((g[Ye]||null).action),T=f.submitter;T&&(r=(r=T[Ye]||null)?VT(r.formAction):T.getAttribute("formAction"),r!==null&&(v=r,T=null));var V=new zu("action","action",null,f,g);i.push({event:V,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(Eo!==0){var Z=T?LT(g,T):new FormData(g);xg(c,{pending:!0,data:Z,method:g.method,action:v},null,Z)}}else typeof v=="function"&&(V.preventDefault(),Z=T?LT(g,T):new FormData(g),xg(c,{pending:!0,data:Z,method:g.method,action:v},v,Z))},currentTarget:g}]})}}for(var e0=0;e0<Lm.length;e0++){var n0=Lm[e0],u7=n0.toLowerCase(),f7=n0[0].toUpperCase()+n0.slice(1);$n(u7,"on"+f7)}$n(pE,"onAnimationEnd"),$n(mE,"onAnimationIteration"),$n(gE,"onAnimationStart"),$n("dblclick","onDoubleClick"),$n("focusin","onFocus"),$n("focusout","onBlur"),$n(N$,"onTransitionRun"),$n(A$,"onTransitionStart"),$n(M$,"onTransitionCancel"),$n(yE,"onTransitionEnd"),so("onMouseEnter",["mouseout","mouseover"]),so("onMouseLeave",["mouseout","mouseover"]),so("onPointerEnter",["pointerout","pointerover"]),so("onPointerLeave",["pointerout","pointerover"]),_i("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),_i("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),_i("onBeforeInput",["compositionend","keypress","textInput","paste"]),_i("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),_i("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),_i("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var Cl="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(" "),d7=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(Cl));function IT(i,r){r=(r&4)!==0;for(var c=0;c<i.length;c++){var f=i[c],g=f.event;f=f.listeners;t:{var v=void 0;if(r)for(var T=f.length-1;0<=T;T--){var V=f[T],Z=V.instance,nt=V.currentTarget;if(V=V.listener,Z!==v&&g.isPropagationStopped())break t;v=V,g.currentTarget=nt;try{v(g)}catch(st){Iu(st)}g.currentTarget=null,v=Z}else for(T=0;T<f.length;T++){if(V=f[T],Z=V.instance,nt=V.currentTarget,V=V.listener,Z!==v&&g.isPropagationStopped())break t;v=V,g.currentTarget=nt;try{v(g)}catch(st){Iu(st)}g.currentTarget=null,v=Z}}}}function Ut(i,r){var c=r[rs];c===void 0&&(c=r[rs]=new Set);var f=i+"__bubble";c.has(f)||(PT(r,i,2,!1),c.add(f))}function i0(i,r,c){var f=0;r&&(f|=4),PT(c,i,f,r)}var Cf="_reactListening"+Math.random().toString(36).slice(2);function o0(i){if(!i[Cf]){i[Cf]=!0,Cu.forEach(function(c){c!=="selectionchange"&&(d7.has(c)||i0(c,!1,i),i0(c,!0,i))});var r=i.nodeType===9?i:i.ownerDocument;r===null||r[Cf]||(r[Cf]=!0,i0("selectionchange",!1,r))}}function PT(i,r,c,f){switch(pN(r)){case 2:var g=B7;break;case 8:g=H7;break;default:g=b0}c=g.bind(null,r,c,i),g=void 0,!Em||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(g=!0),f?g!==void 0?i.addEventListener(r,c,{capture:!0,passive:g}):i.addEventListener(r,c,!0):g!==void 0?i.addEventListener(r,c,{passive:g}):i.addEventListener(r,c,!1)}function r0(i,r,c,f,g){var v=f;if((r&1)===0&&(r&2)===0&&f!==null)t:for(;;){if(f===null)return;var T=f.tag;if(T===3||T===4){var V=f.stateNode.containerInfo;if(V===g)break;if(T===4)for(T=f.return;T!==null;){var Z=T.tag;if((Z===3||Z===4)&&T.stateNode.containerInfo===g)return;T=T.return}for(;V!==null;){if(T=no(V),T===null)return;if(Z=T.tag,Z===5||Z===6||Z===26||Z===27){f=v=T;continue t}V=V.parentNode}}f=f.return}Y2(function(){var nt=v,st=_m(c),lt=[];t:{var it=vE.get(i);if(it!==void 0){var ot=zu,xt=i;switch(i){case"keypress":if(Du(c)===0)break t;case"keydown":case"keyup":ot=r$;break;case"focusin":xt="focus",ot=Am;break;case"focusout":xt="blur",ot=Am;break;case"beforeblur":case"afterblur":ot=Am;break;case"click":if(c.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ot=F2;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ot=F9;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ot=l$;break;case pE:case mE:case gE:ot=K9;break;case yE:ot=u$;break;case"scroll":case"scrollend":ot=q9;break;case"wheel":ot=d$;break;case"copy":case"cut":case"paste":ot=W9;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ot=Z2;break;case"toggle":case"beforetoggle":ot=p$}var kt=(r&4)!==0,ie=!kt&&(i==="scroll"||i==="scrollend"),J=kt?it!==null?it+"Capture":null:it;kt=[];for(var Q=nt,tt;Q!==null;){var at=Q;if(tt=at.stateNode,at=at.tag,at!==5&&at!==26&&at!==27||tt===null||J===null||(at=Fa(Q,J),at!=null&&kt.push(Tl(Q,at,tt))),ie)break;Q=Q.return}0<kt.length&&(it=new ot(it,xt,null,c,st),lt.push({event:it,listeners:kt}))}}if((r&7)===0){t:{if(it=i==="mouseover"||i==="pointerover",ot=i==="mouseout"||i==="pointerout",it&&c!==wm&&(xt=c.relatedTarget||c.fromElement)&&(no(xt)||xt[wi]))break t;if((ot||it)&&(it=st.window===st?st:(it=st.ownerDocument)?it.defaultView||it.parentWindow:window,ot?(xt=c.relatedTarget||c.toElement,ot=nt,xt=xt?no(xt):null,xt!==null&&(ie=a(xt),kt=xt.tag,xt!==ie||kt!==5&&kt!==27&&kt!==6)&&(xt=null)):(ot=null,xt=nt),ot!==xt)){if(kt=F2,at="onMouseLeave",J="onMouseEnter",Q="mouse",(i==="pointerout"||i==="pointerover")&&(kt=Z2,at="onPointerLeave",J="onPointerEnter",Q="pointer"),ie=ot==null?it:oo(ot),tt=xt==null?it:oo(xt),it=new kt(at,Q+"leave",ot,c,st),it.target=ie,it.relatedTarget=tt,at=null,no(st)===nt&&(kt=new kt(J,Q+"enter",xt,c,st),kt.target=tt,kt.relatedTarget=ie,at=kt),ie=at,ot&&xt)e:{for(kt=h7,J=ot,Q=xt,tt=0,at=J;at;at=kt(at))tt++;at=0;for(var Mt=Q;Mt;Mt=kt(Mt))at++;for(;0<tt-at;)J=kt(J),tt--;for(;0<at-tt;)Q=kt(Q),at--;for(;tt--;){if(J===Q||Q!==null&&J===Q.alternate){kt=J;break e}J=kt(J),Q=kt(Q)}kt=null}else kt=null;ot!==null&&BT(lt,it,ot,kt,!1),xt!==null&&ie!==null&&BT(lt,ie,xt,kt,!0)}}t:{if(it=nt?oo(nt):window,ot=it.nodeName&&it.nodeName.toLowerCase(),ot==="select"||ot==="input"&&it.type==="file")var Zt=iE;else if(eE(it))if(oE)Zt=E$;else{Zt=_$;var Et=w$}else ot=it.nodeName,!ot||ot.toLowerCase()!=="input"||it.type!=="checkbox"&&it.type!=="radio"?nt&&xm(nt.elementType)&&(Zt=iE):Zt=S$;if(Zt&&(Zt=Zt(i,nt))){nE(lt,Zt,c,st);break t}Et&&Et(i,it,nt),i==="focusout"&&nt&&it.type==="number"&&nt.memoizedProps.value!=null&&Ga(it,"number",it.value)}switch(Et=nt?oo(nt):window,i){case"focusin":(eE(Et)||Et.contentEditable==="true")&&(hs=Et,jm=nt,el=null);break;case"focusout":el=jm=hs=null;break;case"mousedown":zm=!0;break;case"contextmenu":case"mouseup":case"dragend":zm=!1,dE(lt,c,st);break;case"selectionchange":if(T$)break;case"keydown":case"keyup":dE(lt,c,st)}var Pt;if(Rm)t:{switch(i){case"compositionstart":var Yt="onCompositionStart";break t;case"compositionend":Yt="onCompositionEnd";break t;case"compositionupdate":Yt="onCompositionUpdate";break t}Yt=void 0}else ds?J2(i,c)&&(Yt="onCompositionEnd"):i==="keydown"&&c.keyCode===229&&(Yt="onCompositionStart");Yt&&(K2&&c.locale!=="ko"&&(ds||Yt!=="onCompositionStart"?Yt==="onCompositionEnd"&&ds&&(Pt=q2()):(ao=st,Cm="value"in ao?ao.value:ao.textContent,ds=!0)),Et=Tf(nt,Yt),0<Et.length&&(Yt=new X2(Yt,i,null,c,st),lt.push({event:Yt,listeners:Et}),Pt?Yt.data=Pt:(Pt=tE(c),Pt!==null&&(Yt.data=Pt)))),(Pt=g$?y$(i,c):v$(i,c))&&(Yt=Tf(nt,"onBeforeInput"),0<Yt.length&&(Et=new X2("onBeforeInput","beforeinput",null,c,st),lt.push({event:Et,listeners:Yt}),Et.data=Pt)),c7(lt,i,nt,c,st)}IT(lt,r)})}function Tl(i,r,c){return{instance:i,listener:r,currentTarget:c}}function Tf(i,r){for(var c=r+"Capture",f=[];i!==null;){var g=i,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=Fa(i,c),g!=null&&f.unshift(Tl(i,g,v)),g=Fa(i,r),g!=null&&f.push(Tl(i,g,v))),i.tag===3)return f;i=i.return}return[]}function h7(i){if(i===null)return null;do i=i.return;while(i&&i.tag!==5&&i.tag!==27);return i||null}function BT(i,r,c,f,g){for(var v=r._reactName,T=[];c!==null&&c!==f;){var V=c,Z=V.alternate,nt=V.stateNode;if(V=V.tag,Z!==null&&Z===f)break;V!==5&&V!==26&&V!==27||nt===null||(Z=nt,g?(nt=Fa(c,v),nt!=null&&T.unshift(Tl(c,nt,Z))):g||(nt=Fa(c,v),nt!=null&&T.push(Tl(c,nt,Z)))),c=c.return}T.length!==0&&i.push({event:r,listeners:T})}var p7=/\r\n?/g,m7=/\u0000|\uFFFD/g;function HT(i){return(typeof i=="string"?i:""+i).replace(p7,`
|
|
9
|
+
`).replace(m7,"")}function UT(i,r){return r=HT(r),HT(i)===r}function ne(i,r,c,f,g,v){switch(c){case"children":typeof f=="string"?r==="body"||r==="textarea"&&f===""||cs(i,f):(typeof f=="number"||typeof f=="bigint")&&r!=="body"&&cs(i,""+f);break;case"className":as(i,"class",f);break;case"tabIndex":as(i,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":as(i,c,f);break;case"style":U2(i,f,v);break;case"data":if(r!=="object"){as(i,"data",f);break}case"src":case"href":if(f===""&&(r!=="a"||c!=="href")){i.removeAttribute(c);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(c);break}f=ku(""+f),i.setAttribute(c,f);break;case"action":case"formAction":if(typeof f=="function"){i.setAttribute(c,"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 v=="function"&&(c==="formAction"?(r!=="input"&&ne(i,r,"name",g.name,g,null),ne(i,r,"formEncType",g.formEncType,g,null),ne(i,r,"formMethod",g.formMethod,g,null),ne(i,r,"formTarget",g.formTarget,g,null)):(ne(i,r,"encType",g.encType,g,null),ne(i,r,"method",g.method,g,null),ne(i,r,"target",g.target,g,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){i.removeAttribute(c);break}f=ku(""+f),i.setAttribute(c,f);break;case"onClick":f!=null&&(i.onclick=Ei);break;case"onScroll":f!=null&&Ut("scroll",i);break;case"onScrollEnd":f!=null&&Ut("scrollend",i);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(o(61));if(c=f.__html,c!=null){if(g.children!=null)throw Error(o(60));i.innerHTML=c}}break;case"multiple":i.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":i.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){i.removeAttribute("xlink:href");break}c=ku(""+f),i.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",c);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,""+f):i.removeAttribute(c);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":f&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,""):i.removeAttribute(c);break;case"capture":case"download":f===!0?i.setAttribute(c,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?i.setAttribute(c,f):i.removeAttribute(c);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?i.setAttribute(c,f):i.removeAttribute(c);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?i.removeAttribute(c):i.setAttribute(c,f);break;case"popover":Ut("beforetoggle",i),Ut("toggle",i),ss(i,"popover",f);break;case"xlinkActuate":Un(i,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Un(i,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Un(i,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Un(i,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Un(i,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Un(i,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Un(i,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Un(i,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Un(i,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":ss(i,"is",f);break;case"innerText":case"textContent":break;default:(!(2<c.length)||c[0]!=="o"&&c[0]!=="O"||c[1]!=="n"&&c[1]!=="N")&&(c=$9.get(c)||c,ss(i,c,f))}}function s0(i,r,c,f,g,v){switch(c){case"style":U2(i,f,v);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(o(61));if(c=f.__html,c!=null){if(g.children!=null)throw Error(o(60));i.innerHTML=c}}break;case"children":typeof f=="string"?cs(i,f):(typeof f=="number"||typeof f=="bigint")&&cs(i,""+f);break;case"onScroll":f!=null&&Ut("scroll",i);break;case"onScrollEnd":f!=null&&Ut("scrollend",i);break;case"onClick":f!=null&&(i.onclick=Ei);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Tu.hasOwnProperty(c))t:{if(c[0]==="o"&&c[1]==="n"&&(g=c.endsWith("Capture"),r=c.slice(2,g?c.length-7:void 0),v=i[Ye]||null,v=v!=null?v[c]:null,typeof v=="function"&&i.removeEventListener(r,v,g),typeof f=="function")){typeof v!="function"&&v!==null&&(c in i?i[c]=null:i.hasAttribute(c)&&i.removeAttribute(c)),i.addEventListener(r,f,g);break t}c in i?i[c]=f:f===!0?i.setAttribute(c,""):ss(i,c,f)}}}function He(i,r,c){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ut("error",i),Ut("load",i);var f=!1,g=!1,v;for(v in c)if(c.hasOwnProperty(v)){var T=c[v];if(T!=null)switch(v){case"src":f=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(o(137,r));default:ne(i,r,v,T,c,null)}}g&&ne(i,r,"srcSet",c.srcSet,c,null),f&&ne(i,r,"src",c.src,c,null);return;case"input":Ut("invalid",i);var V=v=T=g=null,Z=null,nt=null;for(f in c)if(c.hasOwnProperty(f)){var st=c[f];if(st!=null)switch(f){case"name":g=st;break;case"type":T=st;break;case"checked":Z=st;break;case"defaultChecked":nt=st;break;case"value":v=st;break;case"defaultValue":V=st;break;case"children":case"dangerouslySetInnerHTML":if(st!=null)throw Error(o(137,r));break;default:ne(i,r,f,st,c,null)}}Ru(i,v,V,Z,nt,T,g,!1);return;case"select":Ut("invalid",i),f=T=v=null;for(g in c)if(c.hasOwnProperty(g)&&(V=c[g],V!=null))switch(g){case"value":v=V;break;case"defaultValue":T=V;break;case"multiple":f=V;default:ne(i,r,g,V,c,null)}r=v,c=T,i.multiple=!!f,r!=null?Si(i,!!f,r,!1):c!=null&&Si(i,!!f,c,!0);return;case"textarea":Ut("invalid",i),v=g=f=null;for(T in c)if(c.hasOwnProperty(T)&&(V=c[T],V!=null))switch(T){case"value":f=V;break;case"defaultValue":g=V;break;case"children":v=V;break;case"dangerouslySetInnerHTML":if(V!=null)throw Error(o(91));break;default:ne(i,r,T,V,c,null)}B2(i,f,g,v);return;case"option":for(Z in c)c.hasOwnProperty(Z)&&(f=c[Z],f!=null)&&(Z==="selected"?i.selected=f&&typeof f!="function"&&typeof f!="symbol":ne(i,r,Z,f,c,null));return;case"dialog":Ut("beforetoggle",i),Ut("toggle",i),Ut("cancel",i),Ut("close",i);break;case"iframe":case"object":Ut("load",i);break;case"video":case"audio":for(f=0;f<Cl.length;f++)Ut(Cl[f],i);break;case"image":Ut("error",i),Ut("load",i);break;case"details":Ut("toggle",i);break;case"embed":case"source":case"link":Ut("error",i),Ut("load",i);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(nt in c)if(c.hasOwnProperty(nt)&&(f=c[nt],f!=null))switch(nt){case"children":case"dangerouslySetInnerHTML":throw Error(o(137,r));default:ne(i,r,nt,f,c,null)}return;default:if(xm(r)){for(st in c)c.hasOwnProperty(st)&&(f=c[st],f!==void 0&&s0(i,r,st,f,c,void 0));return}}for(V in c)c.hasOwnProperty(V)&&(f=c[V],f!=null&&ne(i,r,V,f,c,null))}function g7(i,r,c,f){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,v=null,T=null,V=null,Z=null,nt=null,st=null;for(ot in c){var lt=c[ot];if(c.hasOwnProperty(ot)&<!=null)switch(ot){case"checked":break;case"value":break;case"defaultValue":Z=lt;default:f.hasOwnProperty(ot)||ne(i,r,ot,null,f,lt)}}for(var it in f){var ot=f[it];if(lt=c[it],f.hasOwnProperty(it)&&(ot!=null||lt!=null))switch(it){case"type":v=ot;break;case"name":g=ot;break;case"checked":nt=ot;break;case"defaultChecked":st=ot;break;case"value":T=ot;break;case"defaultValue":V=ot;break;case"children":case"dangerouslySetInnerHTML":if(ot!=null)throw Error(o(137,r));break;default:ot!==lt&&ne(i,r,it,ot,f,lt)}}rr(i,T,V,Z,nt,st,v,g);return;case"select":ot=T=V=it=null;for(v in c)if(Z=c[v],c.hasOwnProperty(v)&&Z!=null)switch(v){case"value":break;case"multiple":ot=Z;default:f.hasOwnProperty(v)||ne(i,r,v,null,f,Z)}for(g in f)if(v=f[g],Z=c[g],f.hasOwnProperty(g)&&(v!=null||Z!=null))switch(g){case"value":it=v;break;case"defaultValue":V=v;break;case"multiple":T=v;default:v!==Z&&ne(i,r,g,v,f,Z)}r=V,c=T,f=ot,it!=null?Si(i,!!c,it,!1):!!f!=!!c&&(r!=null?Si(i,!!c,r,!0):Si(i,!!c,c?[]:"",!1));return;case"textarea":ot=it=null;for(V in c)if(g=c[V],c.hasOwnProperty(V)&&g!=null&&!f.hasOwnProperty(V))switch(V){case"value":break;case"children":break;default:ne(i,r,V,null,f,g)}for(T in f)if(g=f[T],v=c[T],f.hasOwnProperty(T)&&(g!=null||v!=null))switch(T){case"value":it=g;break;case"defaultValue":ot=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(o(91));break;default:g!==v&&ne(i,r,T,g,f,v)}P2(i,it,ot);return;case"option":for(var xt in c)it=c[xt],c.hasOwnProperty(xt)&&it!=null&&!f.hasOwnProperty(xt)&&(xt==="selected"?i.selected=!1:ne(i,r,xt,null,f,it));for(Z in f)it=f[Z],ot=c[Z],f.hasOwnProperty(Z)&&it!==ot&&(it!=null||ot!=null)&&(Z==="selected"?i.selected=it&&typeof it!="function"&&typeof it!="symbol":ne(i,r,Z,it,f,ot));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 kt in c)it=c[kt],c.hasOwnProperty(kt)&&it!=null&&!f.hasOwnProperty(kt)&&ne(i,r,kt,null,f,it);for(nt in f)if(it=f[nt],ot=c[nt],f.hasOwnProperty(nt)&&it!==ot&&(it!=null||ot!=null))switch(nt){case"children":case"dangerouslySetInnerHTML":if(it!=null)throw Error(o(137,r));break;default:ne(i,r,nt,it,f,ot)}return;default:if(xm(r)){for(var ie in c)it=c[ie],c.hasOwnProperty(ie)&&it!==void 0&&!f.hasOwnProperty(ie)&&s0(i,r,ie,void 0,f,it);for(st in f)it=f[st],ot=c[st],!f.hasOwnProperty(st)||it===ot||it===void 0&&ot===void 0||s0(i,r,st,it,f,ot);return}}for(var J in c)it=c[J],c.hasOwnProperty(J)&&it!=null&&!f.hasOwnProperty(J)&&ne(i,r,J,null,f,it);for(lt in f)it=f[lt],ot=c[lt],!f.hasOwnProperty(lt)||it===ot||it==null&&ot==null||ne(i,r,lt,it,f,ot)}function $T(i){switch(i){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function y7(){if(typeof performance.getEntriesByType=="function"){for(var i=0,r=0,c=performance.getEntriesByType("resource"),f=0;f<c.length;f++){var g=c[f],v=g.transferSize,T=g.initiatorType,V=g.duration;if(v&&V&&$T(T)){for(T=0,V=g.responseEnd,f+=1;f<c.length;f++){var Z=c[f],nt=Z.startTime;if(nt>V)break;var st=Z.transferSize,lt=Z.initiatorType;st&&$T(lt)&&(Z=Z.responseEnd,T+=st*(Z<V?1:(V-nt)/(Z-nt)))}if(--f,r+=8*(v+T)/(g.duration/1e3),i++,10<i)break}}if(0<i)return r/i/1e6}return navigator.connection&&(i=navigator.connection.downlink,typeof i=="number")?i:5}var a0=null,l0=null;function Nf(i){return i.nodeType===9?i:i.ownerDocument}function YT(i){switch(i){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function qT(i,r){if(i===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return i===1&&r==="foreignObject"?0:i}function c0(i,r){return i==="textarea"||i==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var u0=null;function v7(){var i=window.event;return i&&i.type==="popstate"?i===u0?!1:(u0=i,!0):(u0=null,!1)}var GT=typeof setTimeout=="function"?setTimeout:void 0,b7=typeof clearTimeout=="function"?clearTimeout:void 0,FT=typeof Promise=="function"?Promise:void 0,x7=typeof queueMicrotask=="function"?queueMicrotask:typeof FT<"u"?function(i){return FT.resolve(null).then(i).catch(w7)}:GT;function w7(i){setTimeout(function(){throw i})}function Co(i){return i==="head"}function XT(i,r){var c=r,f=0;do{var g=c.nextSibling;if(i.removeChild(c),g&&g.nodeType===8)if(c=g.data,c==="/$"||c==="/&"){if(f===0){i.removeChild(g),Bs(r);return}f--}else if(c==="$"||c==="$?"||c==="$~"||c==="$!"||c==="&")f++;else if(c==="html")Nl(i.ownerDocument.documentElement);else if(c==="head"){c=i.ownerDocument.head,Nl(c);for(var v=c.firstChild;v;){var T=v.nextSibling,V=v.nodeName;v[ir]||V==="SCRIPT"||V==="STYLE"||V==="LINK"&&v.rel.toLowerCase()==="stylesheet"||c.removeChild(v),v=T}}else c==="body"&&Nl(i.ownerDocument.body);c=g}while(c);Bs(r)}function ZT(i,r){var c=i;i=0;do{var f=c.nextSibling;if(c.nodeType===1?r?(c._stashedDisplay=c.style.display,c.style.display="none"):(c.style.display=c._stashedDisplay||"",c.getAttribute("style")===""&&c.removeAttribute("style")):c.nodeType===3&&(r?(c._stashedText=c.nodeValue,c.nodeValue=""):c.nodeValue=c._stashedText||""),f&&f.nodeType===8)if(c=f.data,c==="/$"){if(i===0)break;i--}else c!=="$"&&c!=="$?"&&c!=="$~"&&c!=="$!"||i++;c=f}while(c)}function f0(i){var r=i.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var c=r;switch(r=r.nextSibling,c.nodeName){case"HTML":case"HEAD":case"BODY":f0(c),Ya(c);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(c.rel.toLowerCase()==="stylesheet")continue}i.removeChild(c)}}function _7(i,r,c,f){for(;i.nodeType===1;){var g=c;if(i.nodeName.toLowerCase()!==r.toLowerCase()){if(!f&&(i.nodeName!=="INPUT"||i.type!=="hidden"))break}else if(f){if(!i[ir])switch(r){case"meta":if(!i.hasAttribute("itemprop"))break;return i;case"link":if(v=i.getAttribute("rel"),v==="stylesheet"&&i.hasAttribute("data-precedence"))break;if(v!==g.rel||i.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||i.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||i.getAttribute("title")!==(g.title==null?null:g.title))break;return i;case"style":if(i.hasAttribute("data-precedence"))break;return i;case"script":if(v=i.getAttribute("src"),(v!==(g.src==null?null:g.src)||i.getAttribute("type")!==(g.type==null?null:g.type)||i.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&i.hasAttribute("async")&&!i.hasAttribute("itemprop"))break;return i;default:return i}}else if(r==="input"&&i.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&i.getAttribute("name")===v)return i}else return i;if(i=Nn(i.nextSibling),i===null)break}return null}function S7(i,r,c){if(r==="")return null;for(;i.nodeType!==3;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!c||(i=Nn(i.nextSibling),i===null))return null;return i}function KT(i,r){for(;i.nodeType!==8;)if((i.nodeType!==1||i.nodeName!=="INPUT"||i.type!=="hidden")&&!r||(i=Nn(i.nextSibling),i===null))return null;return i}function d0(i){return i.data==="$?"||i.data==="$~"}function h0(i){return i.data==="$!"||i.data==="$?"&&i.ownerDocument.readyState!=="loading"}function E7(i,r){var c=i.ownerDocument;if(i.data==="$~")i._reactRetry=r;else if(i.data!=="$?"||c.readyState!=="loading")r();else{var f=function(){r(),c.removeEventListener("DOMContentLoaded",f)};c.addEventListener("DOMContentLoaded",f),i._reactRetry=f}}function Nn(i){for(;i!=null;i=i.nextSibling){var r=i.nodeType;if(r===1||r===3)break;if(r===8){if(r=i.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return i}var p0=null;function QT(i){i=i.nextSibling;for(var r=0;i;){if(i.nodeType===8){var c=i.data;if(c==="/$"||c==="/&"){if(r===0)return Nn(i.nextSibling);r--}else c!=="$"&&c!=="$!"&&c!=="$?"&&c!=="$~"&&c!=="&"||r++}i=i.nextSibling}return null}function WT(i){i=i.previousSibling;for(var r=0;i;){if(i.nodeType===8){var c=i.data;if(c==="$"||c==="$!"||c==="$?"||c==="$~"||c==="&"){if(r===0)return i;r--}else c!=="/$"&&c!=="/&"||r++}i=i.previousSibling}return null}function JT(i,r,c){switch(r=Nf(c),i){case"html":if(i=r.documentElement,!i)throw Error(o(452));return i;case"head":if(i=r.head,!i)throw Error(o(453));return i;case"body":if(i=r.body,!i)throw Error(o(454));return i;default:throw Error(o(451))}}function Nl(i){for(var r=i.attributes;r.length;)i.removeAttributeNode(r[0]);Ya(i)}var An=new Map,tN=new Set;function Af(i){return typeof i.getRootNode=="function"?i.getRootNode():i.nodeType===9?i:i.ownerDocument}var Bi=I.d;I.d={f:C7,r:T7,D:N7,C:A7,L:M7,m:R7,X:O7,S:k7,M:D7};function C7(){var i=Bi.f(),r=bf();return i||r}function T7(i){var r=io(i);r!==null&&r.tag===5&&r.type==="form"?yC(r):Bi.r(i)}var Ls=typeof document>"u"?null:document;function eN(i,r,c){var f=Ls;if(f&&typeof r=="string"&&r){var g=Qe(r);g='link[rel="'+i+'"][href="'+g+'"]',typeof c=="string"&&(g+='[crossorigin="'+c+'"]'),tN.has(g)||(tN.add(g),i={rel:i,crossOrigin:c,href:r},f.querySelector(g)===null&&(r=f.createElement("link"),He(r,"link",i),Se(r),f.head.appendChild(r)))}}function N7(i){Bi.D(i),eN("dns-prefetch",i,null)}function A7(i,r){Bi.C(i,r),eN("preconnect",i,r)}function M7(i,r,c){Bi.L(i,r,c);var f=Ls;if(f&&i&&r){var g='link[rel="preload"][as="'+Qe(r)+'"]';r==="image"&&c&&c.imageSrcSet?(g+='[imagesrcset="'+Qe(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(g+='[imagesizes="'+Qe(c.imageSizes)+'"]')):g+='[href="'+Qe(i)+'"]';var v=g;switch(r){case"style":v=Is(i);break;case"script":v=Ps(i)}An.has(v)||(i=m({rel:"preload",href:r==="image"&&c&&c.imageSrcSet?void 0:i,as:r},c),An.set(v,i),f.querySelector(g)!==null||r==="style"&&f.querySelector(Al(v))||r==="script"&&f.querySelector(Ml(v))||(r=f.createElement("link"),He(r,"link",i),Se(r),f.head.appendChild(r)))}}function R7(i,r){Bi.m(i,r);var c=Ls;if(c&&i){var f=r&&typeof r.as=="string"?r.as:"script",g='link[rel="modulepreload"][as="'+Qe(f)+'"][href="'+Qe(i)+'"]',v=g;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=Ps(i)}if(!An.has(v)&&(i=m({rel:"modulepreload",href:i},r),An.set(v,i),c.querySelector(g)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Ml(v)))return}f=c.createElement("link"),He(f,"link",i),Se(f),c.head.appendChild(f)}}}function k7(i,r,c){Bi.S(i,r,c);var f=Ls;if(f&&i){var g=ro(f).hoistableStyles,v=Is(i);r=r||"default";var T=g.get(v);if(!T){var V={loading:0,preload:null};if(T=f.querySelector(Al(v)))V.loading=5;else{i=m({rel:"stylesheet",href:i,"data-precedence":r},c),(c=An.get(v))&&m0(i,c);var Z=T=f.createElement("link");Se(Z),He(Z,"link",i),Z._p=new Promise(function(nt,st){Z.onload=nt,Z.onerror=st}),Z.addEventListener("load",function(){V.loading|=1}),Z.addEventListener("error",function(){V.loading|=2}),V.loading|=4,Mf(T,r,f)}T={type:"stylesheet",instance:T,count:1,state:V},g.set(v,T)}}}function O7(i,r){Bi.X(i,r);var c=Ls;if(c&&i){var f=ro(c).hoistableScripts,g=Ps(i),v=f.get(g);v||(v=c.querySelector(Ml(g)),v||(i=m({src:i,async:!0},r),(r=An.get(g))&&g0(i,r),v=c.createElement("script"),Se(v),He(v,"link",i),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(g,v))}}function D7(i,r){Bi.M(i,r);var c=Ls;if(c&&i){var f=ro(c).hoistableScripts,g=Ps(i),v=f.get(g);v||(v=c.querySelector(Ml(g)),v||(i=m({src:i,async:!0,type:"module"},r),(r=An.get(g))&&g0(i,r),v=c.createElement("script"),Se(v),He(v,"link",i),c.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(g,v))}}function nN(i,r,c,f){var g=(g=ht.current)?Af(g):null;if(!g)throw Error(o(446));switch(i){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(r=Is(c.href),c=ro(g).hoistableStyles,f=c.get(r),f||(f={type:"style",instance:null,count:0,state:null},c.set(r,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){i=Is(c.href);var v=ro(g).hoistableStyles,T=v.get(i);if(T||(g=g.ownerDocument||g,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(i,T),(v=g.querySelector(Al(i)))&&!v._p&&(T.instance=v,T.state.loading=5),An.has(i)||(c={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},An.set(i,c),v||j7(g,i,c,T.state))),r&&f===null)throw Error(o(528,""));return T}if(r&&f!==null)throw Error(o(529,""));return null;case"script":return r=c.async,c=c.src,typeof c=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=Ps(c),c=ro(g).hoistableScripts,f=c.get(r),f||(f={type:"script",instance:null,count:0,state:null},c.set(r,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(o(444,i))}}function Is(i){return'href="'+Qe(i)+'"'}function Al(i){return'link[rel="stylesheet"]['+i+"]"}function iN(i){return m({},i,{"data-precedence":i.precedence,precedence:null})}function j7(i,r,c,f){i.querySelector('link[rel="preload"][as="style"]['+r+"]")?f.loading=1:(r=i.createElement("link"),f.preload=r,r.addEventListener("load",function(){return f.loading|=1}),r.addEventListener("error",function(){return f.loading|=2}),He(r,"link",c),Se(r),i.head.appendChild(r))}function Ps(i){return'[src="'+Qe(i)+'"]'}function Ml(i){return"script[async]"+i}function oN(i,r,c){if(r.count++,r.instance===null)switch(r.type){case"style":var f=i.querySelector('style[data-href~="'+Qe(c.href)+'"]');if(f)return r.instance=f,Se(f),f;var g=m({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return f=(i.ownerDocument||i).createElement("style"),Se(f),He(f,"style",g),Mf(f,c.precedence,i),r.instance=f;case"stylesheet":g=Is(c.href);var v=i.querySelector(Al(g));if(v)return r.state.loading|=4,r.instance=v,Se(v),v;f=iN(c),(g=An.get(g))&&m0(f,g),v=(i.ownerDocument||i).createElement("link"),Se(v);var T=v;return T._p=new Promise(function(V,Z){T.onload=V,T.onerror=Z}),He(v,"link",f),r.state.loading|=4,Mf(v,c.precedence,i),r.instance=v;case"script":return v=Ps(c.src),(g=i.querySelector(Ml(v)))?(r.instance=g,Se(g),g):(f=c,(g=An.get(v))&&(f=m({},c),g0(f,g)),i=i.ownerDocument||i,g=i.createElement("script"),Se(g),He(g,"link",f),i.head.appendChild(g),r.instance=g);case"void":return null;default:throw Error(o(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(f=r.instance,r.state.loading|=4,Mf(f,c.precedence,i));return r.instance}function Mf(i,r,c){for(var f=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=f.length?f[f.length-1]:null,v=g,T=0;T<f.length;T++){var V=f[T];if(V.dataset.precedence===r)v=V;else if(v!==g)break}v?v.parentNode.insertBefore(i,v.nextSibling):(r=c.nodeType===9?c.head:c,r.insertBefore(i,r.firstChild))}function m0(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.title==null&&(i.title=r.title)}function g0(i,r){i.crossOrigin==null&&(i.crossOrigin=r.crossOrigin),i.referrerPolicy==null&&(i.referrerPolicy=r.referrerPolicy),i.integrity==null&&(i.integrity=r.integrity)}var Rf=null;function rN(i,r,c){if(Rf===null){var f=new Map,g=Rf=new Map;g.set(c,f)}else g=Rf,f=g.get(c),f||(f=new Map,g.set(c,f));if(f.has(i))return f;for(f.set(i,null),c=c.getElementsByTagName(i),g=0;g<c.length;g++){var v=c[g];if(!(v[ir]||v[ke]||i==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var T=v.getAttribute(r)||"";T=i+T;var V=f.get(T);V?V.push(v):f.set(T,[v])}}return f}function sN(i,r,c){i=i.ownerDocument||i,i.head.insertBefore(c,r==="title"?i.querySelector("head > title"):null)}function z7(i,r,c){if(c===1||r.itemProp!=null)return!1;switch(i){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;return r.rel==="stylesheet"?(i=r.disabled,typeof r.precedence=="string"&&i==null):!0;case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function aN(i){return!(i.type==="stylesheet"&&(i.state.loading&3)===0)}function V7(i,r,c,f){if(c.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var g=Is(f.href),v=r.querySelector(Al(g));if(v){r=v._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(i.count++,i=kf.bind(i),r.then(i,i)),c.state.loading|=4,c.instance=v,Se(v);return}v=r.ownerDocument||r,f=iN(f),(g=An.get(g))&&m0(f,g),v=v.createElement("link"),Se(v);var T=v;T._p=new Promise(function(V,Z){T.onload=V,T.onerror=Z}),He(v,"link",f),c.instance=v}i.stylesheets===null&&(i.stylesheets=new Map),i.stylesheets.set(c,r),(r=c.state.preload)&&(c.state.loading&3)===0&&(i.count++,c=kf.bind(i),r.addEventListener("load",c),r.addEventListener("error",c))}}var y0=0;function L7(i,r){return i.stylesheets&&i.count===0&&Df(i,i.stylesheets),0<i.count||0<i.imgCount?function(c){var f=setTimeout(function(){if(i.stylesheets&&Df(i,i.stylesheets),i.unsuspend){var v=i.unsuspend;i.unsuspend=null,v()}},6e4+r);0<i.imgBytes&&y0===0&&(y0=62500*y7());var g=setTimeout(function(){if(i.waitingForImages=!1,i.count===0&&(i.stylesheets&&Df(i,i.stylesheets),i.unsuspend)){var v=i.unsuspend;i.unsuspend=null,v()}},(i.imgBytes>y0?50:800)+r);return i.unsuspend=c,function(){i.unsuspend=null,clearTimeout(f),clearTimeout(g)}}:null}function kf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Df(this,this.stylesheets);else if(this.unsuspend){var i=this.unsuspend;this.unsuspend=null,i()}}}var Of=null;function Df(i,r){i.stylesheets=null,i.unsuspend!==null&&(i.count++,Of=new Map,r.forEach(I7,i),Of=null,kf.call(i))}function I7(i,r){if(!(r.state.loading&4)){var c=Of.get(i);if(c)var f=c.get(null);else{c=new Map,Of.set(i,c);for(var g=i.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var T=g[v];(T.nodeName==="LINK"||T.getAttribute("media")!=="not all")&&(c.set(T.dataset.precedence,T),f=T)}f&&c.set(null,f)}g=r.instance,T=g.getAttribute("data-precedence"),v=c.get(T)||f,v===f&&c.set(null,g),c.set(T,g),this.count++,f=kf.bind(this),g.addEventListener("load",f),g.addEventListener("error",f),v?v.parentNode.insertBefore(g,v.nextSibling):(i=i.nodeType===9?i.head:i,i.insertBefore(g,i.firstChild)),r.state.loading|=4}}var Rl={$$typeof:C,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function P7(i,r,c,f,g,v,T,V,Z){this.tag=1,this.containerInfo=i,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=Ha(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ha(0),this.hiddenUpdates=Ha(null),this.identifierPrefix=f,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=T,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=Z,this.incompleteTransitions=new Map}function lN(i,r,c,f,g,v,T,V,Z,nt,st,lt){return i=new P7(i,r,c,T,Z,nt,st,lt,V),r=1,v===!0&&(r|=24),v=un(3,null,null,r),i.current=v,v.stateNode=i,r=Km(),r.refCount++,i.pooledCache=r,r.refCount++,v.memoizedState={element:f,isDehydrated:c,cache:r},tg(v),i}function cN(i){return i?(i=gs,i):gs}function uN(i,r,c,f,g,v){g=cN(g),f.context===null?f.context=g:f.pendingContext=g,f=po(r),f.payload={element:c},v=v===void 0?null:v,v!==null&&(f.callback=v),c=mo(i,f,r),c!==null&&(on(c,i,r),ll(c,i,r))}function fN(i,r){if(i=i.memoizedState,i!==null&&i.dehydrated!==null){var c=i.retryLane;i.retryLane=c!==0&&c<r?c:r}}function v0(i,r){fN(i,r),(i=i.alternate)&&fN(i,r)}function dN(i){if(i.tag===13||i.tag===31){var r=cr(i,67108864);r!==null&&on(r,i,67108864),v0(i,67108864)}}function hN(i){if(i.tag===13||i.tag===31){var r=mn();r=Ua(r);var c=cr(i,r);c!==null&&on(c,i,r),v0(i,r)}}var jf=!0;function B7(i,r,c,f){var g=j.T;j.T=null;var v=I.p;try{I.p=2,b0(i,r,c,f)}finally{I.p=v,j.T=g}}function H7(i,r,c,f){var g=j.T;j.T=null;var v=I.p;try{I.p=8,b0(i,r,c,f)}finally{I.p=v,j.T=g}}function b0(i,r,c,f){if(jf){var g=x0(f);if(g===null)r0(i,r,f,zf,c),mN(i,f);else if($7(g,i,r,c,f))f.stopPropagation();else if(mN(i,f),r&4&&-1<U7.indexOf(i)){for(;g!==null;){var v=io(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var T=xi(v.pendingLanes);if(T!==0){var V=v;for(V.pendingLanes|=2,V.entangledLanes|=2;T;){var Z=1<<31-ze(T);V.entanglements[1]|=Z,T&=~Z}ci(v),(Qt&6)===0&&(yf=Vt()+500,El(0))}}break;case 31:case 13:V=cr(v,2),V!==null&&on(V,v,2),bf(),v0(v,2)}if(v=x0(f),v===null&&r0(i,r,f,zf,c),v===g)break;g=v}g!==null&&f.stopPropagation()}else r0(i,r,f,null,c)}}function x0(i){return i=_m(i),w0(i)}var zf=null;function w0(i){if(zf=null,i=no(i),i!==null){var r=a(i);if(r===null)i=null;else{var c=r.tag;if(c===13){if(i=l(r),i!==null)return i;i=null}else if(c===31){if(i=u(r),i!==null)return i;i=null}else if(c===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;i=null}else r!==i&&(i=null)}}return zf=i,null}function pN(i){switch(i){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(ve()){case Wt:return 2;case je:return 8;case xn:case Pa:return 32;case Hn:return 268435456;default:return 32}default:return 32}}var _0=!1,To=null,No=null,Ao=null,kl=new Map,Ol=new Map,Mo=[],U7="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 mN(i,r){switch(i){case"focusin":case"focusout":To=null;break;case"dragenter":case"dragleave":No=null;break;case"mouseover":case"mouseout":Ao=null;break;case"pointerover":case"pointerout":kl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ol.delete(r.pointerId)}}function Dl(i,r,c,f,g,v){return i===null||i.nativeEvent!==v?(i={blockedOn:r,domEventName:c,eventSystemFlags:f,nativeEvent:v,targetContainers:[g]},r!==null&&(r=io(r),r!==null&&dN(r)),i):(i.eventSystemFlags|=f,r=i.targetContainers,g!==null&&r.indexOf(g)===-1&&r.push(g),i)}function $7(i,r,c,f,g){switch(r){case"focusin":return To=Dl(To,i,r,c,f,g),!0;case"dragenter":return No=Dl(No,i,r,c,f,g),!0;case"mouseover":return Ao=Dl(Ao,i,r,c,f,g),!0;case"pointerover":var v=g.pointerId;return kl.set(v,Dl(kl.get(v)||null,i,r,c,f,g)),!0;case"gotpointercapture":return v=g.pointerId,Ol.set(v,Dl(Ol.get(v)||null,i,r,c,f,g)),!0}return!1}function gN(i){var r=no(i.target);if(r!==null){var c=a(r);if(c!==null){if(r=c.tag,r===13){if(r=l(c),r!==null){i.blockedOn=r,_u(i.priority,function(){hN(c)});return}}else if(r===31){if(r=u(c),r!==null){i.blockedOn=r,_u(i.priority,function(){hN(c)});return}}else if(r===3&&c.stateNode.current.memoizedState.isDehydrated){i.blockedOn=c.tag===3?c.stateNode.containerInfo:null;return}}}i.blockedOn=null}function Vf(i){if(i.blockedOn!==null)return!1;for(var r=i.targetContainers;0<r.length;){var c=x0(i.nativeEvent);if(c===null){c=i.nativeEvent;var f=new c.constructor(c.type,c);wm=f,c.target.dispatchEvent(f),wm=null}else return r=io(c),r!==null&&dN(r),i.blockedOn=c,!1;r.shift()}return!0}function yN(i,r,c){Vf(i)&&c.delete(r)}function Y7(){_0=!1,To!==null&&Vf(To)&&(To=null),No!==null&&Vf(No)&&(No=null),Ao!==null&&Vf(Ao)&&(Ao=null),kl.forEach(yN),Ol.forEach(yN)}function Lf(i,r){i.blockedOn===r&&(i.blockedOn=null,_0||(_0=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,Y7)))}var If=null;function vN(i){If!==i&&(If=i,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){If===i&&(If=null);for(var r=0;r<i.length;r+=3){var c=i[r],f=i[r+1],g=i[r+2];if(typeof f!="function"){if(w0(f||c)===null)continue;break}var v=io(c);v!==null&&(i.splice(r,3),r-=3,xg(v,{pending:!0,data:g,method:c.method,action:f},f,g))}}))}function Bs(i){function r(Z){return Lf(Z,i)}To!==null&&Lf(To,i),No!==null&&Lf(No,i),Ao!==null&&Lf(Ao,i),kl.forEach(r),Ol.forEach(r);for(var c=0;c<Mo.length;c++){var f=Mo[c];f.blockedOn===i&&(f.blockedOn=null)}for(;0<Mo.length&&(c=Mo[0],c.blockedOn===null);)gN(c),c.blockedOn===null&&Mo.shift();if(c=(i.ownerDocument||i).$$reactFormReplay,c!=null)for(f=0;f<c.length;f+=3){var g=c[f],v=c[f+1],T=g[Ye]||null;if(typeof v=="function")T||vN(c);else if(T){var V=null;if(v&&v.hasAttribute("formAction")){if(g=v,T=v[Ye]||null)V=T.formAction;else if(w0(g)!==null)continue}else V=T.action;typeof V=="function"?c[f+1]=V:(c.splice(f,3),f-=3),vN(c)}}}function bN(){function i(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(T){return g=T})},focusReset:"manual",scroll:"manual"})}function r(){g!==null&&(g(),g=null),f||setTimeout(c,20)}function c(){if(!f&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,g=null;return navigation.addEventListener("navigate",i),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(c,100),function(){f=!0,navigation.removeEventListener("navigate",i),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),g!==null&&(g(),g=null)}}}function S0(i){this._internalRoot=i}Pf.prototype.render=S0.prototype.render=function(i){var r=this._internalRoot;if(r===null)throw Error(o(409));var c=r.current,f=mn();uN(c,f,i,r,null,null)},Pf.prototype.unmount=S0.prototype.unmount=function(){var i=this._internalRoot;if(i!==null){this._internalRoot=null;var r=i.containerInfo;uN(i.current,2,null,i,null,null),bf(),r[wi]=null}};function Pf(i){this._internalRoot=i}Pf.prototype.unstable_scheduleHydration=function(i){if(i){var r=wu();i={blockedOn:null,target:i,priority:r};for(var c=0;c<Mo.length&&r!==0&&r<Mo[c].priority;c++);Mo.splice(c,0,i),c===0&&gN(i)}};var xN=e.version;if(xN!=="19.2.0")throw Error(o(527,xN,"19.2.0"));I.findDOMNode=function(i){var r=i._reactInternals;if(r===void 0)throw typeof i.render=="function"?Error(o(188)):(i=Object.keys(i).join(","),Error(o(268,i)));return i=h(r),i=i!==null?p(i):null,i=i===null?null:i.stateNode,i};var q7={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:j,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Bf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Bf.isDisabled&&Bf.supportsFiber)try{Re=Bf.inject(q7),me=Bf}catch{}}return Us.createRoot=function(i,r){if(!s(i))throw Error(o(299));var c=!1,f="",g=NC,v=AC,T=MC;return r!=null&&(r.unstable_strictMode===!0&&(c=!0),r.identifierPrefix!==void 0&&(f=r.identifierPrefix),r.onUncaughtError!==void 0&&(g=r.onUncaughtError),r.onCaughtError!==void 0&&(v=r.onCaughtError),r.onRecoverableError!==void 0&&(T=r.onRecoverableError)),r=lN(i,1,!1,null,null,c,f,null,g,v,T,bN),i[wi]=r.current,o0(i),new S0(r)},Us.hydrateRoot=function(i,r,c){if(!s(i))throw Error(o(299));var f=!1,g="",v=NC,T=AC,V=MC,Z=null;return c!=null&&(c.unstable_strictMode===!0&&(f=!0),c.identifierPrefix!==void 0&&(g=c.identifierPrefix),c.onUncaughtError!==void 0&&(v=c.onUncaughtError),c.onCaughtError!==void 0&&(T=c.onCaughtError),c.onRecoverableError!==void 0&&(V=c.onRecoverableError),c.formState!==void 0&&(Z=c.formState)),r=lN(i,1,!0,r,c??null,f,g,Z,v,T,V,bN),r.context=cN(null),c=r.current,f=mn(),f=Ua(f),g=po(f),g.callback=null,mo(c,g,f),c=f,r.current.lanes=c,nr(r,c),ci(r),i[wi]=r.current,o0(i),new Pf(r)},Us.version="19.2.0",Us}var D0;function NN(){if(D0)return qf.exports;D0=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),qf.exports=TN(),qf.exports}var AN=NN();const MN={stringify:t=>t?"true":"false",parse:t=>/^[ty1-9]/i.test(t)},RN={stringify:t=>t.name,parse:(t,e,n)=>{const o=(()=>{if(typeof window<"u"&&t in window)return window[t];if(typeof global<"u"&&t in global)return global[t]})();return typeof o=="function"?o.bind(n):void 0}},kN={stringify:t=>JSON.stringify(t),parse:t=>JSON.parse(t)};function ON(t){return t.replace(/([a-z0-9])([A-Z])/g,(e,n,o)=>`${n}-${o.toLowerCase()}`)}function DN(t){return t.replace(/[-:]([a-z])/g,(e,n)=>`${n.toUpperCase()}`)}const j0=Symbol.for("r2wc.bound"),jN={parse:(t,e,n)=>{const o=DN(e),s=n;if(typeof s<"u"&&o in s&&typeof s[o]<"u"){let a=s[o];return j0 in s[o]||(a=a.bind(s),Object.defineProperty(a,j0,{value:!0})),a}else return}},zN={stringify:t=>`${t}`,parse:t=>parseFloat(t)},VN={stringify:t=>t,parse:t=>t},Zf={string:VN,number:zN,boolean:MN,function:RN,method:jN,json:kN},jl=Symbol.for("r2wc.render"),zl=Symbol.for("r2wc.connected"),Oo=Symbol.for("r2wc.context"),Gn=Symbol.for("r2wc.props");function LN(t,e,n){e.props||(e.props=t.propTypes?Object.keys(t.propTypes):[]),e.events||(e.events=[]);const o=Array.isArray(e.props)?e.props.slice():Object.keys(e.props),s=Array.isArray(e.events)?e.events.slice():Object.keys(e.events),a={},l={},u={},d={};for(const p of o){a[p]=Array.isArray(e.props)?"string":e.props[p];const m=ON(p);u[p]=m,d[m]=p}for(const p of s)l[p]=Array.isArray(e.events)?{}:e.events[p];class h extends HTMLElement{static get observedAttributes(){return Object.keys(d)}[zl]=!0;[Oo];[Gn]={};container;constructor(){super(),e.shadow?this.container=this.attachShadow({mode:e.shadow}):this.container=this,this[Gn].container=this.container;for(const m of o){const y=u[m],b=this.getAttribute(y),x=a[m],w=x?Zf[x]:null;w?.parse&&(b||x==="method")&&(this[Gn][m]=w.parse(b,y,this))}for(const m of s)this[Gn][m]=y=>{const b=m.replace(/^on/,"").toLowerCase();this.dispatchEvent(new CustomEvent(b,{detail:y,...l[m]}))}}connectedCallback(){this[zl]=!0,this[jl]()}disconnectedCallback(){this[zl]=!1,this[Oo]&&n.unmount(this[Oo]),delete this[Oo]}attributeChangedCallback(m,y,b){const x=d[m],w=a[x],_=w?Zf[w]:null;x in a&&_?.parse&&(b||w==="method")&&(this[Gn][x]=_.parse(b,m,this),this[jl]())}[jl](){this[zl]&&(this[Oo]?n.update(this[Oo],this[Gn]):this[Oo]=n.mount(this.container,t,this[Gn]))}}for(const p of o){const m=u[p],y=a[p];Object.defineProperty(h.prototype,p,{enumerable:!0,configurable:!0,get(){return this[Gn][p]},set(b){this[Gn][p]=b;const x=y?Zf[y]:null;if(x?.stringify){const w=x.stringify(b,m,this);this.getAttribute(m)!==w&&(w==null?this.removeAttribute(m):this.setAttribute(m,w))}else p in a&&x?.parse&&(b||y==="method")&&(this[Gn][p]=x.parse(b,m,this)),this[jl]()}})}return h}function IN(t,e,n){const o=AN.createRoot(t),s=ko.createElement(e,n);return o.render(s),{root:o,ReactComponent:e}}function PN({root:t,ReactComponent:e},n){const o=ko.createElement(e,n);t.render(o)}function BN({root:t}){t.unmount()}function HN(t,e={}){return LN(t,e,{mount:IN,update:PN,unmount:BN})}var Kf={exports:{}},$s={};var z0;function UN(){if(z0)return $s;z0=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(o,s,a){var l=null;if(a!==void 0&&(l=""+a),s.key!==void 0&&(l=""+s.key),"key"in s){a={};for(var u in s)u!=="key"&&(a[u]=s[u])}else a=s;return s=a.ref,{$$typeof:t,type:o,key:l,ref:s!==void 0?s:null,props:a}}return $s.Fragment=e,$s.jsx=n,$s.jsxs=n,$s}var V0;function $N(){return V0||(V0=1,Kf.exports=UN()),Kf.exports}var M=$N();const YN={PROD:!0},L0=typeof{url:Uf&&Uf.tagName.toUpperCase()==="SCRIPT"&&Uf.src||new URL("circuit-embed.js",document.baseURI).href}<"u"?YN:void 0,Qf=L0?.VITE_SANDBOX_ORIGIN||(L0?.PROD?"https://sandbox.simten.dev":"http://localhost:3002");function I0(t,e,n,o){t.iframe&&(t.iframe.remove(),t.iframe=null,t.ready=!1);const s=document.createElement("iframe");return s.src=Qf,s.setAttribute("sandbox","allow-scripts allow-same-origin"),s.style.cssText="display:none;width:0;height:0;position:absolute;",s.setAttribute("aria-hidden","true"),s.onerror=o,e.appendChild(s),t.iframe=s,t.ready=!1,window.addEventListener("message",n),s}function qN(t){return`sb-${++t.idCounter}`}function GN(){const t=N.useRef({iframe:null,ready:!1,pending:new Map,readyQueue:[],idCounter:0}),e=N.useRef(null),n=N.useRef(()=>{}),o=N.useCallback(()=>{const E=t.current,R=e.current;if(R){for(const[,A]of E.pending)A({type:"error",error:"Sandbox restarted (crash)"});E.pending.clear(),E.readyQueue=[],window.removeEventListener("message",n.current),I0(E,R,n.current,a.current)}},[]),s=N.useCallback(E=>{if(E.origin!==Qf)return;const R=t.current,A=E.data;if(A.type==="ready"){R.ready=!0;for(const D of R.readyQueue)D();R.readyQueue=[];return}if(!A.id)return;const O=R.pending.get(A.id);O&&(R.pending.delete(A.id),O(A))},[]);n.current=s;const a=N.useRef(o);a.current=o,N.useEffect(()=>{const E=document.createElement("div");E.style.cssText="position:absolute;left:-9999px;top:-9999px;",document.body.appendChild(E),e.current=E;const R=t.current;return I0(R,E,s,o),()=>{window.removeEventListener("message",s),E.remove(),e.current=null}},[s]);const l=N.useCallback(E=>new Promise(R=>{const A=t.current,O=qN(A),D={...E,id:O};A.pending.set(O,R);const U=()=>{const q=A.iframe;if(!q?.contentWindow){A.pending.delete(O),R({type:"error",error:"Sandbox iframe not available"});return}q.contentWindow.postMessage(D,Qf)};A.ready?U():A.readyQueue.push(U)}),[]),u=N.useCallback(async(E,R="default")=>{const A=await l({type:"compile",source:E,slot:R});if("error"in A)return A;const O=A;return{circuits:O.circuits,libraryCircuits:O.libraryCircuits,portValues:O.portValues,peripheralState:O.peripheralState}},[l]),d=N.useCallback(async(E,R,A,O)=>{const D=await l({type:"compile-ir",circuit:E,libraryCircuits:R,slot:A,evalSources:O?.evalSources,snapshot:O?.snapshot});if("error"in D)return D;const U=D;return{portValues:U.portValues,peripheralState:U.peripheralState,snapshotId:U.snapshotId}},[l]),h=N.useCallback(async(E,R="default",A)=>{const O=await l({type:"tick",inputs:E,slot:R,snapshot:A?.snapshot});if("error"in O)return O;const D=O;return{portValues:D.portValues,cycle:D.cycle,peripheralState:D.peripheralState,snapshotId:D.snapshotId}},[l]),p=N.useCallback(async(E,R,A="default",O)=>{const D=await l({type:"tick-n",n:E,inputs:R,slot:A,snapshot:O?.snapshot});if("error"in D)return D;const U=D;return{portValues:U.portValues,cycle:U.cycle,peripheralState:U.peripheralState,snapshotId:U.snapshotId}},[l]),m=N.useCallback(async(E,R,A,O="default")=>{const D=await l({type:"scan-port",addrNodeId:E,valuePortKey:R,count:A,slot:O});return"error"in D?D:{values:D.values}},[l]),y=N.useCallback(async E=>{const R=await l({type:"simulate",...E});if("error"in R)return R;const A=R;return{circuitName:A.circuitName,signals:A.signals,vcd:A.vcd,ticks:A.ticks,steadyStateAt:A.steadyStateAt}},[l]),b=N.useCallback(async(E="default")=>{const R=await l({type:"reset",slot:E});if("error"in R)return R;const A=R;return{portValues:A.portValues,peripheralState:A.peripheralState}},[l]),x=N.useCallback(async(E,R,A="default",O)=>{const D=await l({type:"set-node",nodeId:E,value:R,slot:A,snapshot:O?.snapshot});if("error"in D)return D;const U=D;return{portValues:U.portValues,peripheralState:U.peripheralState,snapshotId:U.snapshotId}},[l]),w=N.useCallback(async(E="default")=>{const R=await l({type:"snapshot",slot:E});return"error"in R?R:{snapshotId:R.snapshotId}},[l]),_=N.useCallback(async(E,R="default")=>{const A=await l({type:"restore",snapshotId:E,slot:R});if("error"in A)return A;const O=A;return{portValues:O.portValues,cycle:O.cycle,peripheralState:O.peripheralState}},[l]),S=N.useCallback(async(E,R="default")=>{const A=await l({type:"prune-snapshots",keepAfterId:E,slot:R});return"error"in A,A},[l]),k=N.useCallback(async E=>{await l({type:"dispose",slot:E})},[l]),C=N.useCallback(()=>t.current.ready,[]);return{compile:u,compileIR:d,tick:h,tickN:p,scanPort:m,simulate:y,reset:b,setNode:x,snapshot:w,restore:_,pruneSnapshots:S,dispose:k,isReady:C}}const P0=N.createContext(null);function FN({children:t}){const e=GN();return M.jsx(P0.Provider,{value:e,children:t})}const XN={compile:async()=>({type:"error",error:"Sandbox not ready"}),compileIR:async()=>({type:"error",error:"Sandbox not ready"}),tick:async()=>({type:"error",error:"Sandbox not ready"}),tickN:async()=>({type:"error",error:"Sandbox not ready"}),scanPort:async()=>({type:"error",error:"Sandbox not ready"}),simulate:async()=>({type:"error",error:"Sandbox not ready"}),reset:async()=>({type:"error",error:"Sandbox not ready"}),setNode:async()=>({type:"error",error:"Sandbox not ready"}),snapshot:async()=>({type:"error",error:"Sandbox not ready"}),restore:async()=>({type:"error",error:"Sandbox not ready"}),pruneSnapshots:async()=>({type:"error",error:"Sandbox not ready"}),dispose:async()=>{},isReady:()=>!1};function Wf(){return N.useContext(P0)??XN}function Do(t,e,n){if(t<1||!Number.isInteger(t))throw new Error(`Memory depth must be a positive integer, got ${t}`);if(e<1||!Number.isInteger(e))throw new Error(`Memory width must be a positive integer, got ${e}`);return{__stateKind:"mem",depth:t,width:e,initial:n??new Map}}function ZN(t){return t!=null&&typeof t=="object"&&t.__stateKind==="reg"}function KN(t){return t!=null&&typeof t=="object"&&t.__stateKind==="mem"}const X={kind:"bit"};function P(t){if(t<1||!Number.isInteger(t))throw new Error(`Bus width must be a positive integer, got ${t}`);return{kind:"bus",width:t}}function B0(t){return typeof t=="number"?t===1?X:P(t):t}const Vl=new Map;function QN(t,e){Vl.has(t)||Vl.set(t,e)}function Ll(t){return Vl.get(t)}function WN(){return Vl}function JN(t,e,n){return{_path:{nodeId:t,portName:e},_type:n,to(...o){return{source:{nodeId:t,portName:e},targets:o.map(s=>({nodeId:s._path.nodeId,portName:s._path.portName})),portType:n}}}}function Jf(t,e,n){const o={};for(const[s,a]of e)o[s]=JN(t,s,a);return new Proxy(o,{get(s,a){if(a in s)return s[a];if(typeof a=="symbol"||a.startsWith("_"))return;const l=t===""?"circuit":`node '${t}'${n?` (${n})`:""}`,u=Object.keys(s).join(", ");throw new Error(`Port '${a}' does not exist on ${l}. Available ports: ${u||"none"}`)}})}function gt(t,e={}){if(typeof t!="string"){const z=t===null?"null":Array.isArray(t)?"array":typeof t;throw new Error(`circuit() expects a string name as the first argument, got ${z}. Usage: circuit('MyCircuit', { inputs, outputs, nodes, connect }). (A common cause is a stray import / variable being passed by mistake, e.g. circuit(React, {...}) — the first argument must be a literal string name.)`)}if(typeof e=="function"){const z=e;return $=>{const G=z($),L=gt(t,G);L._args=$??{};for(const F of L.circuit.state)if(F.stateType.kind==="bit")F.initialValue=!1;else if(F.stateType.kind==="bus")typeof F.initialValue=="number"&&(F.initialValue=0);else if(F.stateType.kind==="memory"){const et=F.initialValue;F.initialValue={data:new Map,addressWidth:et?.addressWidth??F.stateType.addressWidth,dataWidth:et?.dataWidth??F.stateType.dataWidth}}return L}}const n=e,o=new Map;if(n.inputs)for(const[z,$]of Object.entries(n.inputs))o.set(z,B0($));const s=new Map;if(n.outputs)for(const[z,$]of Object.entries(n.outputs))s.set(z,B0($));const a=n.nodes??{},l=[],u=new Set;for(const z of o.keys())u.has(z)&&l.push(`Duplicate port name: '${z}'`),u.add(z);for(const z of s.keys())u.has(z)&&l.push(`Port name '${z}' used for both input and output`),u.add(z);if(n.state)for(const z of Object.keys(n.state))o.has(z)&&l.push(`State name '${z}' collides with input port name`),s.has(z)&&l.push(`State name '${z}' collides with output port name`);for(const z of Object.keys(a))(z==="inputs"||z==="outputs"||z==="nodes")&&l.push(`Node name '${z}' is reserved`);n.onTick&&!n.state&&l.push(".onTick() requires state to be defined");let d=[];if(n.connect){const z={};for(const[G,L]of Object.entries(a)){const F=new Map;for(const et of L.circuit.inputs)F.set(et.name,et.portType);for(const et of L.circuit.outputs)F.set(et.name,et.portType);z[G]=Jf(G,F,L.circuit.name)}const $={inputs:Jf("",o),outputs:Jf("",s),nodes:z};try{d=n.connect($)}catch(G){l.push(G instanceof Error?G.message:String(G))}}for(const z of d){H0(z.source,o,s,a,l);for(const $ of z.targets)H0($,o,s,a,l)}const h=z=>z.nodeId===""?z.portName:`${z.nodeId}.${z.portName}`,p=new Map,m=new Map,y=[];for(const z of d){const $=[];for(const G of z.targets){const L=h(G),F=p.get(L);if(F){if(F.nodeId===z.source.nodeId&&F.portName===z.source.portName)continue;let et=m.get(L);et||(et=new Set([h(F)]),m.set(L,et)),et.add(h(z.source));continue}p.set(L,{nodeId:z.source.nodeId,portName:z.source.portName}),$.push(G)}$.length>0&&y.push({...z,targets:$})}d=y;const b=[...m.keys()].sort();for(const z of b){const $=[...m.get(z)].join(", ");l.push(`${z} has multiple drivers: ${$}`)}if(l.length>0)throw new Error(`Circuit '${t}' validation failed:
|
|
10
|
+
- ${l.join(`
|
|
11
|
+
- `)}`);const x=n.eval!=null,w=Object.keys(a).length>0;let _,S;x&&!w?(_={kind:"primitive"},S=n.state!=null?"sequential":"combinational"):w?(_={kind:"composite"},S=tA(a,n.state)?"sequential":"combinational"):(_={kind:"primitive"},S="combinational");const k=Array.from(o,([z,$])=>({name:z,portType:$})),C=Array.from(s,([z,$])=>({name:z,portType:$})),E=[];(n.state!=null||n.onTick!=null)&&E.push({name:"clk"});const R=[];if(n.state!=null)for(const[z,$]of Object.entries(n.state))if(KN($)){const G=Math.ceil(Math.log2($.depth))||1;R.push({id:`${t}-${z}`,name:z,stateType:{kind:"memory",addressWidth:G,dataWidth:$.width},initialValue:{data:new Map($.initial),addressWidth:G,dataWidth:$.width},clockRef:"clk",edge:"rising"})}else ZN($)?R.push({id:`${t}-${z}`,name:z,stateType:$.width===1?{kind:"bit"}:{kind:"bus",width:$.width},initialValue:$.initial,clockRef:"clk",edge:"rising"}):$ instanceof Map?R.push({id:`${t}-${z}`,name:z,stateType:{kind:"memory",addressWidth:16,dataWidth:8},initialValue:{data:new Map($),addressWidth:16,dataWidth:8},clockRef:"clk",edge:"rising"}):typeof $=="boolean"?R.push({id:`${t}-${z}`,name:z,stateType:{kind:"bit"},initialValue:$,clockRef:"clk",edge:"rising"}):R.push({id:`${t}-${z}`,name:z,stateType:{kind:"bus",width:32},initialValue:$,clockRef:"clk",edge:"rising"});const A=[];for(const[z,$]of Object.entries(a)){const G=$._args??{};A.push({id:z,componentRef:$.circuit.name,arguments:G,inputs:$.circuit.inputs.map(L=>({id:`${z}.${L.name}`,name:L.name,portType:L.portType})),outputs:$.circuit.outputs.map(L=>({id:`${z}.${L.name}`,name:L.name,portType:L.portType})),clocks:$.circuit.clocks.map(L=>({id:`${z}.${L.name}`,name:L.name}))})}const O=[];let D=0;for(const z of d)for(const $ of z.targets)O.push({id:`conn_${D++}`,source:{nodeId:z.source.nodeId,portName:z.source.portName},target:{nodeId:$.nodeId,portName:$.portName},portType:z.portType});const U={timing:S},q=n.meta;q&&(q.description!==void 0&&(U.description=q.description),q.category!==void 0&&(U.category=q.category),q.icon!==void 0&&(U.icon=q.icon),q.tags!==void 0&&(U.tags=q.tags),q.author!==void 0&&(U.author=q.author),q.version!==void 0&&(U.version=q.version),q.synthesizable!==void 0&&(U.synthesizable=q.synthesizable),q.interactiveArg!==void 0&&(U.interactiveArg=q.interactiveArg));const Y={version:1,name:t,inputs:k,outputs:C,clocks:E,state:R,nodes:A,connections:O,implementation:_,metadata:U};for(const[z,$]of o);for(const[z,$]of s);const K=new Map;for(const[,z]of Object.entries(a))if(K.has(z.circuit.name)||K.set(z.circuit.name,z),z._dependencies)for(const[$,G]of z._dependencies)K.has($)||K.set($,G);const W={};for(const z of k)W[z.name]=z;const B={};for(const z of C)B[z.name]=z;const H={};for(const z of A)H[z.id]=z;const j={circuit:Y,inputs:W,outputs:B,nodes:H,_dependencies:K};Object.defineProperty(j,"toJSON",{value:function(){const z={};for(const[$,G]of this._dependencies)z[$]=G;return{circuit:this.circuit,_dependencies:z}},enumerable:!1});const I=n.state?Object.keys(n.state):void 0;return QN(t,{inputNames:Y.inputs.map(z=>z.name),outputNames:Y.outputs.map(z=>z.name),evalFn:n.eval??(()=>({})),stateKeys:I,onTickFn:n.onTick}),j}function H0(t,e,n,o,s){if(t.nodeId==="")!e.has(t.portName)&&!n.has(t.portName)&&s.push(`Circuit port '${t.portName}' does not exist`);else{const a=o[t.nodeId];if(!a){s.push(`Node '${t.nodeId}' does not exist`);return}a.circuit.inputs.some(u=>u.name===t.portName)||a.circuit.outputs.some(u=>u.name===t.portName)||s.push(`Port '${t.portName}' does not exist on node '${t.nodeId}' (${a.circuit.name})`)}}function tA(t,e){if(e!=null)return!0;for(const n of Object.values(t))if(n.circuit.clocks.length>0||n.circuit.state.length>0)return!0;return!1}const U0=gt("And",{inputs:{a:X,b:X},outputs:{out:X},meta:{category:"logic-gates",icon:"&",description:"Logical AND gate"},eval:({a:t,b:e})=>({out:t&&e?1:0})}),td=gt("Or",{inputs:{a:X,b:X},outputs:{out:X},meta:{category:"logic-gates",icon:"≥1",description:"Logical OR gate"},eval:({a:t,b:e})=>({out:t||e?1:0})}),$0=gt("Not",{inputs:{in:X},outputs:{out:X},meta:{category:"logic-gates",icon:"¬",description:"Logical NOT gate"},eval:({in:t})=>({out:t?0:1})}),eA=gt("Nand",{inputs:{a:X,b:X},outputs:{out:X},meta:{category:"logic-gates",icon:"⊼",description:"Logical NAND gate"},eval:({a:t,b:e})=>({out:t&&e?0:1})}),nA=gt("Nor",{inputs:{a:X,b:X},outputs:{out:X},meta:{category:"logic-gates",icon:"⊽",description:"Logical NOR gate"},eval:({a:t,b:e})=>({out:t||e?0:1})}),iA=gt("Xor",{inputs:{a:X,b:X},outputs:{out:X},meta:{category:"logic-gates",icon:"⊕",description:"Logical XOR gate"},eval:({a:t,b:e})=>({out:t!==e?1:0})}),oA=gt("Xnor",{inputs:{a:X,b:X},outputs:{out:X},meta:{category:"logic-gates",icon:"⊙",description:"Logical XNOR gate"},eval:({a:t,b:e})=>({out:t===e?1:0})}),rA=gt("Buffer",{inputs:{in:X},outputs:{out:X},meta:{category:"logic-gates",icon:"▷",description:"Buffer — passes input through unchanged"},eval:({in:t})=>({out:t})}),sA=Object.freeze(Object.defineProperty({__proto__:null,And:U0,Buffer:rA,Nand:eA,Nor:nA,Not:$0,Or:td,Xnor:oA,Xor:iA},Symbol.toStringTag,{value:"Module"})),aA=gt("Incrementer",{inputs:{in:P(8)},outputs:{out:P(8)},meta:{category:"arithmetic",icon:"+1",description:"Adds 1 to the input"},eval:({in:t})=>({out:t+1&255})}),Il=gt("Adder",({width:t=8}={})=>({inputs:{a:P(t),b:P(t),carry_in:X},outputs:{sum:P(t),carry_out:X},meta:{category:"arithmetic",icon:"+",description:"N-bit adder with carry"},eval:({a:e,b:n,carry_in:o,width:s=t})=>{const a=s,l=a>=32?4294967295:(1<<a)-1,u=(e>>>0)+(n>>>0)+o;return{sum:u&l,carry_out:u>l?1:0}}})),lA=gt("Subtractor",({width:t=8}={})=>({inputs:{a:P(t),b:P(t),borrow_in:X},outputs:{difference:P(t),borrow_out:X},meta:{category:"arithmetic",icon:"−",description:"N-bit subtractor with borrow"},eval:({a:e,b:n,borrow_in:o,width:s=t})=>{const a=s,l=a>=32?4294967295:(1<<a)-1,u=(e>>>0)-(n>>>0)-o;return{difference:u&l,borrow_out:u<0?1:0}}})),cA=gt("Multiplier",{inputs:{a:P(8),b:P(8)},outputs:{product:P(16)},meta:{category:"arithmetic",icon:"×",description:"N-bit multiplier"},eval:({a:t,b:e})=>({product:t*e&65535})}),uA=gt("Comparator",({width:t=8}={})=>({inputs:{a:P(t),b:P(t)},outputs:{eq:X,lt:X,gt:X},meta:{category:"arithmetic",icon:"⋚",description:"Unsigned comparator"},eval:({a:e,b:n})=>{const o=e>>>0,s=n>>>0;return{eq:o===s?1:0,lt:o<s?1:0,gt:o>s?1:0}}})),fA=gt("LeftShifter",({width:t=8}={})=>({inputs:{value:P(t),shift:P(t)},outputs:{result:P(t)},meta:{category:"arithmetic",icon:"≪",description:"Left bit shifter"},eval:({value:e,shift:n,width:o=t})=>{const s=o,a=n,l=s>=32?4294967295:(1<<s)-1;return{result:a>=s?0:e<<a&l}}})),dA=gt("RightShifter",({width:t=8}={})=>({inputs:{value:P(t),shift:P(t)},outputs:{result:P(t)},meta:{category:"arithmetic",icon:"≫",description:"Right bit shifter"},eval:({value:e,shift:n,width:o=t})=>{const s=o,a=n;return{result:a>=s?0:e>>>a}}})),hA=gt("SignedAdder",{inputs:{a:P(8),b:P(8),carry_in:X},outputs:{sum:P(8),overflow:X,carry_out:X},meta:{category:"arithmetic",icon:"±+",description:"Signed adder with overflow detection"},eval:({a:t,b:e,carry_in:n})=>{const a=t>>>0,l=e>>>0,u=a+l+n,d=u&255,h=(a&128)!==0,p=(l&128)!==0,m=(d&128)!==0;return{sum:d,overflow:h===p&&h!==m?1:0,carry_out:u>255?1:0}}}),pA=gt("SignedComparator",{inputs:{a:P(8),b:P(8)},outputs:{eq:X,lt:X,gt:X,lte:X,gte:X},meta:{category:"arithmetic",icon:"±⋚",description:"Signed comparator"},eval:({a:t,b:e})=>{const s=t&255,a=e&255,l=s&128?s-256:s,u=a&128?a-256:a;return{eq:l===u?1:0,lt:l<u?1:0,gt:l>u?1:0,lte:l<=u?1:0,gte:l>=u?1:0}}}),mA=gt("SignedMultiplier",{inputs:{a:P(8),b:P(8)},outputs:{product:P(16)},meta:{category:"arithmetic",icon:"±×",description:"Signed multiplier"},eval:({a:t,b:e})=>{const s=t&255,a=e&255,l=s&128?s-256:s,u=a&128?a-256:a,d=l*u;return{product:d>=0?d:d+65536}}}),Y0=gt("BusAnd",({width:t=8}={})=>({inputs:{a:P(t),b:P(t)},outputs:{out:P(t)},meta:{category:"bus-operations",icon:"&8",description:"Bitwise AND on buses"},eval:({a:e,b:n})=>({out:e&n})})),gA=gt("BusOr",({width:t=8}={})=>({inputs:{a:P(t),b:P(t)},outputs:{out:P(t)},meta:{category:"bus-operations",icon:"|8",description:"Bitwise OR on buses"},eval:({a:e,b:n})=>({out:(e|n)>>>0})})),yA=gt("BusNot",{inputs:{in:P(8)},outputs:{out:P(8)},meta:{category:"bus-operations",icon:"¬8",description:"Bitwise NOT on bus"},eval:({in:t})=>({out:~t&255})}),vA=gt("BusXor",({width:t=8}={})=>({inputs:{a:P(t),b:P(t)},outputs:{out:P(t)},meta:{category:"bus-operations",icon:"⊕8",description:"Bitwise XOR on buses"},eval:({a:e,b:n})=>({out:(e^n)>>>0})})),bA=Object.freeze(Object.defineProperty({__proto__:null,Adder:Il,BusAnd:Y0,BusNot:yA,BusOr:gA,BusXor:vA,Comparator:uA,Incrementer:aA,LeftShifter:fA,Multiplier:cA,RightShifter:dA,SignedAdder:hA,SignedComparator:pA,SignedMultiplier:mA,Subtractor:lA},Symbol.toStringTag,{value:"Module"})),se=gt("Mux",({width:t=1}={})=>({inputs:{in0:t===1?X:P(t),in1:t===1?X:P(t),sel:X},outputs:{out:t===1?X:P(t)},meta:{category:"plexers",icon:"MUX",description:"Multiplexer — sel=0 picks in0, sel=1 picks in1"},eval:({in0:e,in1:n,sel:o})=>({out:o?n:e})})),xA=gt("Decoder",{inputs:{in:P(2)},outputs:{out0:X,out1:X,out2:X,out3:X},meta:{category:"plexers",icon:"DEC",description:"2-to-4 decoder"},eval:({in:t})=>({out0:t===0?1:0,out1:t===1?1:0,out2:t===2?1:0,out3:t===3?1:0})}),wA=gt("Splitter",{inputs:{in:P(8)},outputs:{out0:P(4),out1:P(4)},meta:{category:"utilities",icon:"⊢",description:"Bus splitter"},eval:({in:t})=>({out0:t&15,out1:t>>4&15})}),_A=gt("Splitter8to8",{inputs:{in:P(8)},outputs:{bit0:X,bit1:X,bit2:X,bit3:X,bit4:X,bit5:X,bit6:X,bit7:X},meta:{category:"utilities",icon:"⊢8",description:"Splits 8-bit bus into 8 individual bits"},eval:({in:t})=>({bit0:t>>0&1,bit1:t>>1&1,bit2:t>>2&1,bit3:t>>3&1,bit4:t>>4&1,bit5:t>>5&1,bit6:t>>6&1,bit7:t>>7&1})}),SA=gt("Combiner8to8",{inputs:{bit0:X,bit1:X,bit2:X,bit3:X,bit4:X,bit5:X,bit6:X,bit7:X},outputs:{out:P(8)},meta:{category:"utilities",icon:"⊣8",description:"Combines 8 bits into an 8-bit bus"},eval:({bit0:t,bit1:e,bit2:n,bit3:o,bit4:s,bit5:a,bit6:l,bit7:u})=>({out:t&1|(e&1)<<1|(n&1)<<2|(o&1)<<3|(s&1)<<4|(a&1)<<5|(l&1)<<6|(u&1)<<7})}),EA=gt("Concat",{inputs:{high:P(4),low:P(4)},outputs:{out:P(8)},meta:{category:"utilities",icon:"||",description:"Concatenate two buses"},eval:({high:t,low:e})=>({out:t<<4|e})}),jo=gt("BitSlice",t=>({inputs:{in:P(8)},outputs:{out:P(8)},meta:{category:"utilities",icon:"[]",description:"Extract bits [low..high] from input"},eval:({in:e,low:n=0,high:o=7})=>{const s=n,l=o-s+1,u=l>=32?4294967295:(1<<l)-1;return{out:e>>s&u}}})),CA=gt("AddressCombiner",{inputs:{lo:P(8),hi:P(8)},outputs:{out:P(16)},meta:{category:"utilities",icon:"⊕16",description:"Combines two 8-bit buses into 16-bit"},eval:({lo:t,hi:e})=>({out:(e&255)<<8|t&255})}),TA=gt("Probe",{inputs:{in:X},outputs:{out:X},meta:{category:"utilities",icon:"🔍",description:"Debug observation point"},eval:({in:t})=>({out:t})}),NA=Object.freeze(Object.defineProperty({__proto__:null,AddressCombiner:CA,BitSlice:jo,Combiner8to8:SA,Concat:EA,Decoder:xA,Mux:se,Probe:TA,Splitter:wA,Splitter8to8:_A},Symbol.toStringTag,{value:"Module"})),AA=gt("DFlipFlop",({value:t=!1}={})=>({inputs:{d:X},outputs:{q:X,q_bar:X},state:{value:t},meta:{category:"sequential",icon:"D",description:"D Flip-Flop — stores 1 bit on rising clock edge"},eval:({value:e})=>({q:e?1:0,q_bar:e?0:1}),onTick:({d:e})=>({value:!!e})})),Rt=gt("Register",({width:t=8,value:e=0}={})=>({inputs:{data:P(t),we:X},outputs:{q:P(t)},state:{value:e},meta:{category:"sequential",icon:"REG",description:"N-bit register — stores data on rising clock edge when write-enable is high"},eval:({value:n})=>({q:n}),onTick:({data:n,we:o,value:s})=>({value:o?n:s})})),MA=Object.freeze(Object.defineProperty({__proto__:null,DFlipFlop:AA,Register:Rt},Symbol.toStringTag,{value:"Module"})),RA=gt("ROM",t=>({inputs:{addr:P(16)},outputs:{data_out:P(8)},state:{memory:Do(65536,8)},meta:{category:"memory",icon:"📀",description:"Read-only memory with address decoding"},eval:({addr:e,memory:n})=>({data_out:n[e]}),onTick:({memory:e})=>({memory:e})})),kA=gt("RAM",t=>({inputs:{addr:P(8),data_in:P(8),we:X},outputs:{data_out:P(8)},state:{memory:Do(256,8)},meta:{category:"memory",icon:"📝",description:"Random access memory"},eval:({addr:e,memory:n})=>({data_out:n[e]}),onTick:({addr:e,data_in:n,we:o,memory:s})=>(o&&(s[e]=n),{memory:s})})),OA=gt("DualPortRAM",t=>({inputs:{addrA:P(8),dataA:P(8),weA:X,addrB:P(8)},outputs:{outA:P(8),outB:P(8)},state:{memory:Do(256,8)},meta:{category:"memory",icon:"📝×2",description:"Dual-port RAM"},eval:({addrA:e,addrB:n,memory:o})=>({outA:o[e],outB:o[n]}),onTick:({addrA:e,dataA:n,weA:o,memory:s})=>(o&&(s[e]=n),{memory:s})}));function DA(t){const e={};for(let n=0;n<t.length;n++){const o=t[n]&255;o!==0&&(e[n]=o)}return e}function jA(t,e){if(!Number.isInteger(e)||e<1||e>32)throw new Error(`ROM word width must be an integer in 1..32, got ${e}`);const n=e===32?4294967295:(1<<e)-1>>>0,o={};for(let s=0;s<t.length;s++){const a=(t[s]>>>0&n)>>>0;a!==0&&(o[s]=a)}return o}function zA(t){const e={};for(const[n,o]of t){if(!Number.isInteger(n)||n<0)throw new Error(`ROM address must be a non-negative integer, got ${n}`);o!==0&&(e[n]=o)}return e}const VA=Object.freeze(Object.defineProperty({__proto__:null,DualPortRAM:OA,RAM:kA,ROM:RA,romFromBytes:DA,romFromEntries:zA,romFromWords:jA},Symbol.toStringTag,{value:"Module"})),ed=gt("Switch",t=>({outputs:{out:X},eval:({value:e})=>({out:e?1:0}),meta:{category:"input-output",icon:"⚡",description:"User-controllable 1-bit toggle",interactiveArg:"value"}})),nd=gt("Button",t=>({outputs:{out:X},eval:({value:e})=>({out:e?1:0}),meta:{category:"input-output",icon:"🔘",description:"Push button input (momentary)",interactiveArg:"value"}})),id=gt("Led",{inputs:{in:X},eval:()=>({}),meta:{category:"input-output",icon:"💡",description:"Visual output LED indicator"}}),od=gt("Input",t=>({outputs:{out:P(8)},eval:({value:e})=>({out:typeof e=="number"?e:0}),meta:{category:"input-output",icon:"🔢",description:"Multi-bit numeric input",interactiveArg:"value"}})),rd=gt("Output",{inputs:{in:P(8)},eval:()=>({}),meta:{category:"input-output",icon:"📤",description:"Multi-bit output sink"}}),gn=gt("Constant",({width:t=1}={})=>({outputs:{out:t===1?X:P(t)},eval:({value:e})=>({out:typeof e=="number"?e:0}),meta:{category:"utilities",icon:"K",description:"Fixed value source",interactiveArg:"value"}})),LA=Object.freeze(Object.defineProperty({__proto__:null,Button:nd,Constant:gn,Input:od,Led:id,Output:rd,Switch:ed},Symbol.toStringTag,{value:"Module"})),IA=gt("SevenSegment",{inputs:{in:P(4)},meta:{category:"display",icon:"7",description:"4-bit seven-segment display",synthesizable:!1}}),sd=gt("HexDisplay",{inputs:{in:P(8)},meta:{category:"display",icon:"0xFF",description:"Hexadecimal display",synthesizable:!1}}),PA=gt("Screen",t=>({inputs:{dataIn:P(8)},outputs:{addrB:P(16)},state:{memory:new Map},meta:{category:"display",icon:"🖥️",description:"Pixel display",synthesizable:!1},eval:()=>({addrB:0})})),BA=gt("RasterDisplay",t=>({inputs:{dataIn:P(8)},outputs:{addrB:P(16),scanX:P(8),scanY:P(8),hblank:X,vblank:X},state:{memory:new Map},meta:{category:"display",icon:"📺",description:"Hardware-accurate raster display with scan counters",synthesizable:!1},eval:()=>({addrB:0,scanX:0,scanY:0,hblank:0,vblank:0})})),HA=gt("Console",{inputs:{data:P(8),we:X},state:{text:""},onTick:({data:t,we:e,text:n})=>{if(!e)return{text:n};const o=t&255;if(o===0)return{text:n};if(o===12)return{text:""};const s=(n??"")+String.fromCharCode(o);return{text:s.length>4096?s.slice(-4096):s}},meta:{category:"display",icon:"📟",description:"Text console output",synthesizable:!1}}),UA=Object.freeze(Object.defineProperty({__proto__:null,Console:HA,HexDisplay:sd,RasterDisplay:BA,Screen:PA,SevenSegment:IA},Symbol.toStringTag,{value:"Module"})),ad=gt("RV32I_Decode",{inputs:{instruction:P(32)},outputs:{opcode:P(7),rd:P(5),funct3:P(3),rs1:P(5),rs2:P(5),funct7:P(7)},eval:({instruction:t})=>{const e=t>>>0;return{opcode:e&127,rd:e>>>7&31,funct3:e>>>12&7,rs1:e>>>15&31,rs2:e>>>20&31,funct7:e>>>25&127}},meta:{category:"rv32i",icon:"DEC",description:"RISC-V instruction decoder"}}),q0=gt("RV32I_ALU",{inputs:{a:P(32),b:P(32),alu_op:P(4)},outputs:{result:P(32),zero:X},eval:({a:t,b:e,alu_op:n})=>{const o=t>>>0,s=e>>>0,a=n&15;let l;switch(a){case 0:l=o+s>>>0;break;case 1:l=o-s>>>0;break;case 2:l=(o&s)>>>0;break;case 3:l=(o|s)>>>0;break;case 4:l=(o^s)>>>0;break;case 5:l=o<<(s&31)>>>0;break;case 6:l=o>>>(s&31);break;case 7:l=(o|0)>>(s&31)>>>0;break;case 8:l=(o|0)<(s|0)?1:0;break;case 9:l=o<s?1:0;break;default:l=0}return{result:l,zero:l===0?1:0}},meta:{category:"rv32i",icon:"ALU",description:"RISC-V ALU"}}),G0=gt("RV32I_ImmGen",{inputs:{instruction:P(32)},outputs:{immediate:P(32)},eval:({instruction:t})=>{const e=t>>>0,n=e&127;let o;switch(n){case 19:case 3:case 103:o=e>>20|0;break;case 35:o=e>>25<<5|e>>>7&31|0,o=o<<20>>20;break;case 99:{const s=e>>>31&1,a=e>>>7&1,l=e>>>25&63,u=e>>>8&15;o=s<<12|a<<11|l<<5|u<<1,o=o<<19>>19;break}case 55:case 23:o=e&4294963200|0;break;case 111:{const s=e>>>31&1,a=e>>>12&255,l=e>>>20&1,u=e>>>21&1023;o=s<<20|a<<12|l<<11|u<<1,o=o<<11>>11;break}default:o=0}return{immediate:o>>>0}},meta:{category:"rv32i",icon:"IMM",description:"RISC-V immediate generator"}}),F0=gt("RV32I_Control",{inputs:{opcode:P(7),funct3:P(3),funct7_bit:X},outputs:{alu_op:P(4),alu_src:X,mem_read:X,mem_write:X,reg_write:X,mem_to_reg:X,branch:X,jump:X,lui:X,auipc:X,is_jalr:X},eval:({opcode:t,funct3:e,funct7_bit:n})=>{const o=t&127,s=e&7,a=n?1:0;let l=0,u=0,d=0,h=0,p=0,m=0,y=0,b=0,x=0,w=0,_=0;switch(o){case 51:switch(p=1,s){case 0:l=a?1:0;break;case 1:l=5;break;case 2:l=8;break;case 3:l=9;break;case 4:l=4;break;case 5:l=a?7:6;break;case 6:l=3;break;case 7:l=2;break}break;case 19:switch(p=1,u=1,s){case 0:l=0;break;case 1:l=5;break;case 2:l=8;break;case 3:l=9;break;case 4:l=4;break;case 5:l=a?7:6;break;case 6:l=3;break;case 7:l=2;break}break;case 3:p=1,u=1,d=1,m=1,l=0;break;case 35:u=1,h=1,l=0;break;case 99:y=1,l=1;break;case 111:p=1,b=1;break;case 103:p=1,b=1,u=1,_=1,l=0;break;case 55:p=1,x=1;break;case 23:p=1,w=1;break}return{alu_op:l,alu_src:u,mem_read:d,mem_write:h,reg_write:p,mem_to_reg:m,branch:y,jump:b,lui:x,auipc:w,is_jalr:_}},meta:{category:"rv32i",icon:"CTL",description:"RISC-V control unit"}}),X0=gt("RV32I_BranchComp",{inputs:{a:P(32),b:P(32),funct3:P(3)},outputs:{take_branch:X},eval:({a:t,b:e,funct3:n})=>{const o=t>>>0,s=e>>>0,a=o|0,l=s|0,u=n&7;let d=0;switch(u){case 0:d=o===s?1:0;break;case 1:d=o!==s?1:0;break;case 4:d=a<l?1:0;break;case 5:d=a>=l?1:0;break;case 6:d=o<s?1:0;break;case 7:d=o>=s?1:0;break}return{take_branch:d}},meta:{category:"rv32i",icon:"CMP",description:"RISC-V branch comparator"}}),Z0=gt("RV32I_RegisterFile",{inputs:{rs1:P(5),rs2:P(5),rd:P(5),write_data:P(32),we:X,debug_rs:P(5)},outputs:{read1:P(32),read2:P(32),debug_read:P(32)},state:{memory:Do(32,32)},eval:({rs1:t,rs2:e,debug_rs:n,memory:o})=>{const s=t&31,a=e&31,l=n&31;return{read1:s===0?0:o[s]>>>0,read2:a===0?0:o[a]>>>0,debug_read:l===0?0:o[l]>>>0}},onTick:({rd:t,write_data:e,we:n,memory:o})=>{const s=t&31;return n&&s!==0&&(o[s]=e>>>0),{memory:o}},meta:{category:"rv32i",icon:"RF",description:"RISC-V 32-register file"}}),$A=gt("RV32I_InstrMem",{inputs:{addr:P(32)},outputs:{instruction:P(32)},state:{memory:Do(65536,8)},eval:({addr:t,memory:e})=>{const n=t>>>0&-4,o=e[n],s=e[n+1],a=e[n+2];return{instruction:(e[n+3]<<24|a<<16|s<<8|o)>>>0}},onTick:({memory:t})=>({memory:t}),meta:{category:"rv32i",icon:"IM",description:"RISC-V instruction memory"}}),YA=gt("RV32I_DataMem",{inputs:{addr:P(32),write_data:P(32),mem_read:X,mem_write:X,funct3:P(3)},outputs:{read_data:P(32),misalign:X},state:{memory:Do(65536,8)},eval:({addr:t,mem_read:e,mem_write:n,funct3:o,memory:s})=>{if(!e&&!n)return{read_data:0,misalign:0};const a=t>>>0,l=o&7;let u=0;if(((l===1||l===5)&&(a&1)!==0||l===2&&(a&3)!==0)&&(u=1),!e)return{read_data:0,misalign:u};const d=a&-4;return{read_data:(s[d+3]<<24|s[d+2]<<16|s[d+1]<<8|s[d])>>>0,misalign:u}},onTick:({addr:t,write_data:e,mem_write:n,funct3:o,memory:s})=>{if(!n)return{memory:s};const a=t>>>0,l=e>>>0;switch(o&7){case 0:s[a]=l&255;break;case 1:s[a]=l&255,s[a+1]=l>>>8&255;break;case 2:s[a]=l&255,s[a+1]=l>>>8&255,s[a+2]=l>>>16&255,s[a+3]=l>>>24&255;break}return{memory:s}},meta:{category:"rv32i",icon:"DM",description:"RISC-V data memory with byte/half/word access"}}),ld=gt("RV32I_WritebackMux",{inputs:{alu_result:P(32),load_data:P(32),pc_plus4:P(32),immediate:P(32),pc_plus_imm:P(32),mem_to_reg:X,lui:X,auipc:X,jump:X},outputs:{write_data:P(32)},eval:({alu_result:t,load_data:e,pc_plus4:n,immediate:o,pc_plus_imm:s,mem_to_reg:a,lui:l,auipc:u,jump:d})=>{let h;return d?h=n:u?h=s:l?h=o:a?h=e:h=t,{write_data:(h??0)>>>0}},meta:{category:"rv32i",icon:"WB",description:"RISC-V writeback mux"}}),K0=gt("RV32I_NextPCMux",{inputs:{pc_plus4:P(32),branch_target:P(32),jal_target:P(32),jalr_target:P(32),branch:X,take_branch:X,jump:X,is_jalr:X},outputs:{next_pc:P(32)},eval:({pc_plus4:t,branch_target:e,jal_target:n,jalr_target:o,branch:s,take_branch:a,jump:l,is_jalr:u})=>{let d;return l?d=u?o&-2:n:s&&a?d=e:d=t,{next_pc:(d??0)>>>0}},meta:{category:"rv32i",icon:"PC",description:"RISC-V next PC mux"}}),Q0=gt("RV32I_ForwardingUnit",{inputs:{id_rs1:P(5),id_rs2:P(5),ex_rd:P(5),ex_reg_write:X,mem_rd:P(5),mem_reg_write:X},outputs:{forward_a:P(2),forward_b:P(2)},eval:({id_rs1:t,id_rs2:e,ex_rd:n,ex_reg_write:o,mem_rd:s,mem_reg_write:a})=>{const l=t&31,u=e&31,d=n&31,h=s&31;let p=0,m=0;return o&&d!==0&&d===l?p=1:a&&h!==0&&h===l&&(p=2),o&&d!==0&&d===u?m=1:a&&h!==0&&h===u&&(m=2),{forward_a:p,forward_b:m}},meta:{category:"rv32i",icon:"FWD",description:"RISC-V data forwarding unit"}}),cd=gt("RV32I_WBBypass",{inputs:{rs_val:P(32),rs_addr:P(5),wb_val:P(32),wb_rd:P(5),wb_we:X},outputs:{out:P(32)},eval:({rs_val:t,rs_addr:e,wb_val:n,wb_rd:o,wb_we:s})=>{const a=e&31,l=o&31;return{out:(s&&l!==0&&l===a?n:t)>>>0}},meta:{category:"rv32i",icon:"BYP",description:"RISC-V writeback bypass"}}),qA=gt("RV32I_LoadAlign",{inputs:{data:P(32),funct3:P(3)},outputs:{out:P(32)},eval:({data:t,funct3:e})=>{const n=t>>>0,o=e&7;let s;switch(o){case 0:{s=(n&255)<<24>>24>>>0;break}case 1:{s=(n&65535)<<16>>16>>>0;break}case 4:s=n&255;break;case 5:s=n&65535;break;default:s=n}return{out:s}},meta:{category:"rv32i",icon:"LA",description:"RISC-V load alignment (byte/half/word)"}}),W0=gt("RV32I_LoadAlignFull",{inputs:{data:P(32),byte_offset:P(2),funct3:P(3)},outputs:{out:P(32)},eval:({data:t,byte_offset:e,funct3:n})=>{const o=t>>>0,s=e&3,a=n&7,l=o>>>s*8&255,u=o>>>(s&2)*8&65535;let d;switch(a){case 0:d=l<<24>>24>>>0;break;case 1:d=u<<16>>16>>>0;break;case 4:d=l;break;case 5:d=u;break;default:d=o;break}return{out:d}},meta:{category:"rv32i",icon:"LA2",description:"RISC-V full load aligner (raw word + byte offset + funct3)"}}),J0=gt("RV32I_HazardUnit",{inputs:{if_rs1:P(5),if_rs2:P(5),id_rd:P(5),id_mem_read:X,branch_taken:X,jump:X},outputs:{stall:X,flush:X},eval:({if_rs1:t,if_rs2:e,id_rd:n,id_mem_read:o,branch_taken:s,jump:a})=>{const l=t&31,u=e&31,d=n&31;return{stall:o&&d!==0&&(d===l||d===u)?1:0,flush:s||a?1:0}},meta:{category:"rv32i",icon:"HAZ",description:"RISC-V hazard detection unit"}}),GA=gt("DualPortROM",t=>({inputs:{addrA:P(32),addrB:P(32)},outputs:{dataA:P(32),dataB:P(32)},state:{memory:Do(65536,8)},eval:({addrA:e,addrB:n,memory:o})=>{const s=e>>>0&-4,a=n>>>0&-4;return{dataA:(o[s+3]<<24|o[s+2]<<16|o[s+1]<<8|o[s])>>>0,dataB:(o[a+3]<<24|o[a+2]<<16|o[a+1]<<8|o[a])>>>0}},onTick:({memory:e})=>({memory:e}),meta:{category:"memory",description:"Dual-port read-only memory"}})),FA=Object.freeze(Object.defineProperty({__proto__:null,DualPortROM:GA,RV32I_ALU:q0,RV32I_BranchComp:X0,RV32I_Control:F0,RV32I_DataMem:YA,RV32I_Decode:ad,RV32I_ForwardingUnit:Q0,RV32I_HazardUnit:J0,RV32I_ImmGen:G0,RV32I_InstrMem:$A,RV32I_LoadAlign:qA,RV32I_LoadAlignFull:W0,RV32I_NextPCMux:K0,RV32I_RegisterFile:Z0,RV32I_WBBypass:cd,RV32I_WritebackMux:ld},Symbol.toStringTag,{value:"Module"})),XA=gt("RV32I_IF_Stage",()=>({inputs:{stall_n:X,redirect_taken:X,redirect_target:P(32)},outputs:{pc:P(32),pc4:P(32)},nodes:{pc:Rt({width:32}),four:gn({value:4,width:32}),pc_plus4:Il({width:32}),pc_next_mux:se({width:32})},connect:({inputs:t,outputs:e,nodes:{pc:n,four:o,pc_plus4:s,pc_next_mux:a}})=>[n.q.to(s.a,e.pc),o.out.to(s.b),s.sum.to(a.in0,e.pc4),t.redirect_target.to(a.in1),t.redirect_taken.to(a.sel),a.out.to(n.data),t.stall_n.to(n.we)]})),ZA=gt("RV32I_IFID_Regs",()=>({inputs:{instruction_in:P(32),pc_in:P(32),pc4_in:P(32),we:X,flush:X},outputs:{instruction:P(32),pc:P(32),pc4:P(32)},nodes:{zero32:gn({value:0,width:32}),instr_mux:se({width:32}),instr:Rt({width:32}),pc_mux:se({width:32}),pc:Rt({width:32}),pc4_mux:se({width:32}),pc4:Rt({width:32})},connect:({inputs:t,outputs:e,nodes:{zero32:n,instr_mux:o,instr:s,pc_mux:a,pc:l,pc4_mux:u,pc4:d}})=>[t.instruction_in.to(o.in0),t.pc_in.to(a.in0),t.pc4_in.to(u.in0),n.out.to(o.in1,a.in1,u.in1),t.flush.to(o.sel,a.sel,u.sel),o.out.to(s.data),a.out.to(l.data),u.out.to(d.data),t.we.to(s.we,l.we,d.we),s.q.to(e.instruction),l.q.to(e.pc),d.q.to(e.pc4)]})),KA=gt("RV32I_ID_Stage",({debug:t=!1}={})=>{const e={instruction:P(32),wb_write_data:P(32),wb_rd:P(5),wb_we:X,...t?{debug_rs:P(5)}:{}},n={read1:P(32),read2:P(32),imm:P(32),rs1:P(5),rs2:P(5),rd:P(5),funct3:P(3),alu_op:P(4),alu_src:X,mem_read:X,mem_write:X,reg_write:X,mem_to_reg:X,branch:X,jump:X,lui:X,auipc:X,is_jalr:X,hazard_rs1:P(5),hazard_rs2:P(5),...t?{debug_read:P(32)}:{}};return{inputs:e,outputs:n,nodes:{decode:ad,immgen:G0,control:F0,funct7_splitter:jo({low:5,high:5}),regfile:Z0,hazard_decode:ad,wb_bypass1:cd,wb_bypass2:cd},connect:({inputs:o,outputs:s,nodes:{decode:a,immgen:l,control:u,funct7_splitter:d,regfile:h,hazard_decode:p,wb_bypass1:m,wb_bypass2:y}})=>{const b=[o.instruction.to(a.instruction,l.instruction,p.instruction),a.opcode.to(u.opcode),a.funct3.to(u.funct3,s.funct3),a.funct7.to(d.in),d.out.to(u.funct7_bit),a.rs1.to(h.rs1,m.rs_addr,s.rs1),a.rs2.to(h.rs2,y.rs_addr,s.rs2),a.rd.to(s.rd),p.rs1.to(s.hazard_rs1),p.rs2.to(s.hazard_rs2),h.read1.to(m.rs_val),h.read2.to(y.rs_val),o.wb_write_data.to(m.wb_val,y.wb_val,h.write_data),o.wb_rd.to(m.wb_rd,y.wb_rd,h.rd),o.wb_we.to(m.wb_we,y.wb_we,h.we),m.out.to(s.read1),y.out.to(s.read2),l.immediate.to(s.imm),u.alu_op.to(s.alu_op),u.alu_src.to(s.alu_src),u.mem_read.to(s.mem_read),u.mem_write.to(s.mem_write),u.reg_write.to(s.reg_write),u.mem_to_reg.to(s.mem_to_reg),u.branch.to(s.branch),u.jump.to(s.jump),u.lui.to(s.lui),u.auipc.to(s.auipc),u.is_jalr.to(s.is_jalr)];return t&&b.push(o.debug_rs.to(h.debug_rs),h.debug_read.to(s.debug_read)),b}}}),QA=gt("RV32I_IDEX_Regs",()=>({inputs:{pc_in:P(32),pc4_in:P(32),read1_in:P(32),read2_in:P(32),imm_in:P(32),rs1_in:P(5),rs2_in:P(5),rd_in:P(5),funct3_in:P(3),alu_op_in:P(4),alu_src_in:X,mem_read_in:X,mem_write_in:X,reg_write_in:X,mem_to_reg_in:X,branch_in:X,jump_in:X,lui_in:X,auipc_in:X,is_jalr_in:X,flush:X,stall:X},outputs:{pc:P(32),pc4:P(32),read1:P(32),read2:P(32),imm:P(32),rs1:P(5),rs2:P(5),rd:P(5),funct3:P(3),alu_op:P(4),alu_src:X,mem_read:X,mem_write:X,reg_write:X,mem_to_reg:X,branch:X,jump:X,lui:X,auipc:X,is_jalr:X},nodes:{one1:gn({value:1,width:1}),zero5:gn({value:0,width:5}),zero4:gn({value:0,width:4}),zero3:gn({value:0,width:3}),zero1:gn({value:0,width:1}),flush_or:td,pc:Rt({width:32}),pc4:Rt({width:32}),read1:Rt({width:32}),read2:Rt({width:32}),imm:Rt({width:32}),rs1_mux:se({width:5}),rs1:Rt({width:5}),rs2_mux:se({width:5}),rs2:Rt({width:5}),rd_mux:se({width:5}),rd:Rt({width:5}),funct3_mux:se({width:3}),funct3:Rt({width:3}),alu_op_mux:se({width:4}),alu_op:Rt({width:4}),alu_src_mux:se({width:1}),alu_src:Rt({width:1}),mem_read_mux:se({width:1}),mem_read:Rt({width:1}),mem_write_mux:se({width:1}),mem_write:Rt({width:1}),reg_write_mux:se({width:1}),reg_write:Rt({width:1}),mem_to_reg_mux:se({width:1}),mem_to_reg:Rt({width:1}),branch_mux:se({width:1}),branch:Rt({width:1}),jump_mux:se({width:1}),jump:Rt({width:1}),lui_mux:se({width:1}),lui:Rt({width:1}),auipc_mux:se({width:1}),auipc:Rt({width:1}),is_jalr_mux:se({width:1}),is_jalr:Rt({width:1})},connect:({inputs:t,outputs:e,nodes:n})=>{const{one1:o,zero5:s,zero4:a,zero3:l,zero1:u,flush_or:d}=n,h=[{mux:n.rs1_mux,reg:n.rs1,zero:s,in:t.rs1_in,out:e.rs1},{mux:n.rs2_mux,reg:n.rs2,zero:s,in:t.rs2_in,out:e.rs2},{mux:n.rd_mux,reg:n.rd,zero:s,in:t.rd_in,out:e.rd},{mux:n.funct3_mux,reg:n.funct3,zero:l,in:t.funct3_in,out:e.funct3},{mux:n.alu_op_mux,reg:n.alu_op,zero:a,in:t.alu_op_in,out:e.alu_op},{mux:n.alu_src_mux,reg:n.alu_src,zero:u,in:t.alu_src_in,out:e.alu_src},{mux:n.mem_read_mux,reg:n.mem_read,zero:u,in:t.mem_read_in,out:e.mem_read},{mux:n.mem_write_mux,reg:n.mem_write,zero:u,in:t.mem_write_in,out:e.mem_write},{mux:n.reg_write_mux,reg:n.reg_write,zero:u,in:t.reg_write_in,out:e.reg_write},{mux:n.mem_to_reg_mux,reg:n.mem_to_reg,zero:u,in:t.mem_to_reg_in,out:e.mem_to_reg},{mux:n.branch_mux,reg:n.branch,zero:u,in:t.branch_in,out:e.branch},{mux:n.jump_mux,reg:n.jump,zero:u,in:t.jump_in,out:e.jump},{mux:n.lui_mux,reg:n.lui,zero:u,in:t.lui_in,out:e.lui},{mux:n.auipc_mux,reg:n.auipc,zero:u,in:t.auipc_in,out:e.auipc},{mux:n.is_jalr_mux,reg:n.is_jalr,zero:u,in:t.is_jalr_in,out:e.is_jalr}],p=[{reg:n.pc,in:t.pc_in,out:e.pc},{reg:n.pc4,in:t.pc4_in,out:e.pc4},{reg:n.read1,in:t.read1_in,out:e.read1},{reg:n.read2,in:t.read2_in,out:e.read2},{reg:n.imm,in:t.imm_in,out:e.imm}];return[t.flush.to(d.a),t.stall.to(d.b),...h.flatMap(m=>[m.in.to(m.mux.in0),m.zero.out.to(m.mux.in1),d.out.to(m.mux.sel),m.mux.out.to(m.reg.data),m.reg.q.to(m.out)]),...p.flatMap(m=>[m.in.to(m.reg.data),m.reg.q.to(m.out)]),o.out.to(n.pc.we,n.pc4.we,n.read1.we,n.read2.we,n.imm.we,...h.map(m=>m.reg.we))]}})),WA=gt("RV32I_EX_Stage",()=>({inputs:{pc:P(32),pc4:P(32),read1:P(32),read2:P(32),imm:P(32),alu_op:P(4),alu_src:X,funct3:P(3),branch:X,jump:X,is_jalr:X,lui:X,auipc:X,mem_to_reg:X,forward_a:P(2),forward_b:P(2),mem_fwd:P(32),wb_fwd:P(32)},outputs:{alu_result:P(32),result:P(32),store_data:P(32),pc_plus_imm:P(32),branch_taken:X,redirect_taken:X,redirect_target:P(32)},nodes:{zero32:gn({value:0,width:32}),fwd_a_bit0:jo({low:0,high:0}),fwd_a_bit1:jo({low:1,high:1}),fwd_a_mux1:se({width:32}),fwd_a_mux2:se({width:32}),fwd_b_bit0:jo({low:0,high:0}),fwd_b_bit1:jo({low:1,high:1}),fwd_b_mux1:se({width:32}),fwd_b_mux2:se({width:32}),alu_src_mux:se({width:32}),alu:q0,branch_comp:X0,branch_target:Il({width:32}),jalr_target:Y0({width:32}),jalr_mask:gn({value:4294967294,width:32}),pc_plus_imm:Il({width:32}),ex_result:ld,branch_and:U0,next_pc:K0,pc_src_taken:td},connect:({inputs:t,outputs:e,nodes:{zero32:n,fwd_a_bit0:o,fwd_a_bit1:s,fwd_a_mux1:a,fwd_a_mux2:l,fwd_b_bit0:u,fwd_b_bit1:d,fwd_b_mux1:h,fwd_b_mux2:p,alu_src_mux:m,alu:y,branch_comp:b,branch_target:x,jalr_target:w,jalr_mask:_,pc_plus_imm:S,ex_result:k,branch_and:C,next_pc:E,pc_src_taken:R}})=>[t.forward_a.to(o.in,s.in),t.read1.to(a.in0),t.mem_fwd.to(a.in1,h.in1),o.out.to(a.sel),a.out.to(l.in0),t.wb_fwd.to(l.in1,p.in1),s.out.to(l.sel),t.forward_b.to(u.in,d.in),t.read2.to(h.in0),u.out.to(h.sel),h.out.to(p.in0),d.out.to(p.sel),p.out.to(m.in0,b.b,e.store_data),t.imm.to(m.in1,x.b,S.b,k.immediate),t.alu_src.to(m.sel),l.out.to(y.a,b.a),m.out.to(y.b),t.alu_op.to(y.alu_op),t.funct3.to(b.funct3),t.pc.to(x.a,S.a),y.result.to(w.a,k.alu_result,e.alu_result),_.out.to(w.b),n.out.to(k.load_data),t.pc4.to(k.pc_plus4,E.pc_plus4),S.sum.to(k.pc_plus_imm,e.pc_plus_imm),t.mem_to_reg.to(k.mem_to_reg),t.lui.to(k.lui),t.auipc.to(k.auipc),t.jump.to(k.jump,E.jump,R.b),t.branch.to(C.a,E.branch),b.take_branch.to(C.b,E.take_branch),x.sum.to(E.branch_target,E.jal_target),w.out.to(E.jalr_target),t.is_jalr.to(E.is_jalr),C.out.to(R.a,e.branch_taken),E.next_pc.to(e.redirect_target),R.out.to(e.redirect_taken),k.write_data.to(e.result)]})),JA=gt("RV32I_EXMEM_Regs",()=>({inputs:{alu_result_in:P(32),result_in:P(32),store_data_in:P(32),rd_in:P(5),funct3_in:P(3),pc4_in:P(32),imm_in:P(32),pc_plus_imm_in:P(32),mem_read_in:X,mem_write_in:X,reg_write_in:X,mem_to_reg_in:X,lui_in:X,auipc_in:X,jump_in:X},outputs:{alu_result:P(32),result:P(32),store_data:P(32),rd:P(5),funct3:P(3),pc4:P(32),imm:P(32),pc_plus_imm:P(32),mem_read:X,mem_write:X,reg_write:X,mem_to_reg:X,lui:X,auipc:X,jump:X},nodes:{one1:gn({value:1,width:1}),alu_result:Rt({width:32}),result:Rt({width:32}),store_data:Rt({width:32}),rd:Rt({width:5}),funct3:Rt({width:3}),pc4:Rt({width:32}),imm:Rt({width:32}),pc_plus_imm:Rt({width:32}),mem_read:Rt({width:1}),mem_write:Rt({width:1}),reg_write:Rt({width:1}),mem_to_reg:Rt({width:1}),lui:Rt({width:1}),auipc:Rt({width:1}),jump:Rt({width:1})},connect:({inputs:t,outputs:e,nodes:n})=>{const o=[{reg:n.alu_result,in:t.alu_result_in,out:e.alu_result},{reg:n.result,in:t.result_in,out:e.result},{reg:n.store_data,in:t.store_data_in,out:e.store_data},{reg:n.rd,in:t.rd_in,out:e.rd},{reg:n.funct3,in:t.funct3_in,out:e.funct3},{reg:n.pc4,in:t.pc4_in,out:e.pc4},{reg:n.imm,in:t.imm_in,out:e.imm},{reg:n.pc_plus_imm,in:t.pc_plus_imm_in,out:e.pc_plus_imm},{reg:n.mem_read,in:t.mem_read_in,out:e.mem_read},{reg:n.mem_write,in:t.mem_write_in,out:e.mem_write},{reg:n.reg_write,in:t.reg_write_in,out:e.reg_write},{reg:n.mem_to_reg,in:t.mem_to_reg_in,out:e.mem_to_reg},{reg:n.lui,in:t.lui_in,out:e.lui},{reg:n.auipc,in:t.auipc_in,out:e.auipc},{reg:n.jump,in:t.jump_in,out:e.jump}];return[...o.flatMap(s=>[s.in.to(s.reg.data),s.reg.q.to(s.out)]),n.one1.out.to(...o.map(s=>s.reg.we))]}})),tM=gt("RV32I_MEMWB_Regs",()=>({inputs:{alu_result_in:P(32),load_data_in:P(32),rd_in:P(5),funct3_in:P(3),pc4_in:P(32),imm_in:P(32),pc_plus_imm_in:P(32),reg_write_in:X,mem_to_reg_in:X,lui_in:X,auipc_in:X,jump_in:X},outputs:{alu_result:P(32),load_data:P(32),byte_offset:P(2),rd:P(5),funct3:P(3),pc4:P(32),imm:P(32),pc_plus_imm:P(32),reg_write:X,mem_to_reg:X,lui:X,auipc:X,jump:X},nodes:{one1:gn({value:1,width:1}),lo2:jo({low:0,high:1}),alu_result:Rt({width:32}),load_data:Rt({width:32}),byte_offset:Rt({width:2}),rd:Rt({width:5}),funct3:Rt({width:3}),pc4:Rt({width:32}),imm:Rt({width:32}),pc_plus_imm:Rt({width:32}),reg_write:Rt({width:1}),mem_to_reg:Rt({width:1}),lui:Rt({width:1}),auipc:Rt({width:1}),jump:Rt({width:1})},connect:({inputs:t,outputs:e,nodes:n})=>{const o=[{reg:n.alu_result,in:t.alu_result_in,out:e.alu_result},{reg:n.load_data,in:t.load_data_in,out:e.load_data},{reg:n.rd,in:t.rd_in,out:e.rd},{reg:n.funct3,in:t.funct3_in,out:e.funct3},{reg:n.pc4,in:t.pc4_in,out:e.pc4},{reg:n.imm,in:t.imm_in,out:e.imm},{reg:n.pc_plus_imm,in:t.pc_plus_imm_in,out:e.pc_plus_imm},{reg:n.reg_write,in:t.reg_write_in,out:e.reg_write},{reg:n.mem_to_reg,in:t.mem_to_reg_in,out:e.mem_to_reg},{reg:n.lui,in:t.lui_in,out:e.lui},{reg:n.auipc,in:t.auipc_in,out:e.auipc},{reg:n.jump,in:t.jump_in,out:e.jump}];return[...o.flatMap(s=>[s.in.to(s.reg.data),s.reg.q.to(s.out)]),t.alu_result_in.to(n.lo2.in),n.lo2.out.to(n.byte_offset.data),n.byte_offset.q.to(e.byte_offset),n.one1.out.to(...o.map(s=>s.reg.we),n.byte_offset.we)]}})),eM=gt("RV32I_WB_Stage",()=>({inputs:{alu_result:P(32),load_data:P(32),byte_offset:P(2),funct3:P(3),pc4:P(32),imm:P(32),pc_plus_imm:P(32),mem_to_reg:X,lui:X,auipc:X,jump:X},outputs:{write_data:P(32)},nodes:{load_align:W0,wb_mux:ld},connect:({inputs:t,outputs:e,nodes:{load_align:n,wb_mux:o}})=>[t.load_data.to(n.data),t.byte_offset.to(n.byte_offset),t.funct3.to(n.funct3),n.out.to(o.load_data),t.alu_result.to(o.alu_result),t.pc4.to(o.pc_plus4),t.imm.to(o.immediate),t.pc_plus_imm.to(o.pc_plus_imm),t.mem_to_reg.to(o.mem_to_reg),t.lui.to(o.lui),t.auipc.to(o.auipc),t.jump.to(o.jump),o.write_data.to(e.write_data)]})),nM=gt("RV32I_Core",({debug:t=!1}={})=>{const e={instruction:P(32),data_read:P(32),net_rx_data:P(32),net_rx_valid:X,net_rx_frame:X,...t?{debug_addr:P(5)}:{}},n={instr_addr:P(32),data_addr:P(32),data_write:P(32),data_mem_read:X,data_mem_write:X,data_funct3:P(3),net_tx_data:P(32),net_tx_valid:X,net_tx_frame:X,pc_out:P(32),...t?{debug_value:P(32),if_pc:P(32),id_pc:P(32),ex_pc:P(32),mem_pc4:P(32),wb_pc4:P(32)}:{}};return{inputs:e,outputs:n,nodes:{IF:XA(),IFID:ZA(),ID:KA({debug:t}),IDEX:QA(),EX:WA(),EXMEM:JA(),MEMWB:tM(),WB:eM(),hazard:J0,forward:Q0,stall_inv:$0},connect:({inputs:o,outputs:s,nodes:{IF:a,IFID:l,ID:u,IDEX:d,EX:h,EXMEM:p,MEMWB:m,WB:y,hazard:b,forward:x,stall_inv:w}})=>{const _=[b.stall.to(w.in,d.stall),b.flush.to(l.flush,d.flush),w.out.to(a.stall_n,l.we),a.pc.to(s.instr_addr,s.pc_out,l.pc_in),a.pc4.to(l.pc4_in),o.instruction.to(l.instruction_in),l.instruction.to(u.instruction),l.pc.to(d.pc_in),l.pc4.to(d.pc4_in),u.hazard_rs1.to(b.if_rs1),u.hazard_rs2.to(b.if_rs2),u.read1.to(d.read1_in),u.read2.to(d.read2_in),u.imm.to(d.imm_in),u.rs1.to(d.rs1_in),u.rs2.to(d.rs2_in),u.rd.to(d.rd_in),u.funct3.to(d.funct3_in),u.alu_op.to(d.alu_op_in),u.alu_src.to(d.alu_src_in),u.mem_read.to(d.mem_read_in),u.mem_write.to(d.mem_write_in),u.reg_write.to(d.reg_write_in),u.mem_to_reg.to(d.mem_to_reg_in),u.branch.to(d.branch_in),u.jump.to(d.jump_in),u.lui.to(d.lui_in),u.auipc.to(d.auipc_in),u.is_jalr.to(d.is_jalr_in),d.pc.to(h.pc),d.pc4.to(h.pc4,p.pc4_in),d.read1.to(h.read1),d.read2.to(h.read2),d.imm.to(h.imm,p.imm_in),d.rs1.to(x.id_rs1),d.rs2.to(x.id_rs2),d.rd.to(b.id_rd,p.rd_in),d.funct3.to(h.funct3,p.funct3_in),d.alu_op.to(h.alu_op),d.alu_src.to(h.alu_src),d.mem_read.to(b.id_mem_read,p.mem_read_in),d.mem_write.to(p.mem_write_in),d.reg_write.to(p.reg_write_in),d.mem_to_reg.to(h.mem_to_reg,p.mem_to_reg_in),d.branch.to(h.branch),d.jump.to(h.jump,b.jump,p.jump_in),d.lui.to(h.lui,p.lui_in),d.auipc.to(h.auipc,p.auipc_in),d.is_jalr.to(h.is_jalr),x.forward_a.to(h.forward_a),x.forward_b.to(h.forward_b),p.result.to(h.mem_fwd),y.write_data.to(h.wb_fwd,u.wb_write_data),h.alu_result.to(p.alu_result_in),h.result.to(p.result_in),h.store_data.to(p.store_data_in),h.pc_plus_imm.to(p.pc_plus_imm_in),h.branch_taken.to(b.branch_taken),h.redirect_taken.to(a.redirect_taken),h.redirect_target.to(a.redirect_target),p.alu_result.to(s.data_addr,m.alu_result_in),p.store_data.to(s.data_write),p.mem_read.to(s.data_mem_read),p.mem_write.to(s.data_mem_write),p.funct3.to(s.data_funct3,m.funct3_in),p.rd.to(x.ex_rd,m.rd_in),p.reg_write.to(x.ex_reg_write,m.reg_write_in),p.pc4.to(m.pc4_in),p.imm.to(m.imm_in),p.pc_plus_imm.to(m.pc_plus_imm_in),p.mem_to_reg.to(m.mem_to_reg_in),p.lui.to(m.lui_in),p.auipc.to(m.auipc_in),p.jump.to(m.jump_in),o.data_read.to(m.load_data_in),m.alu_result.to(y.alu_result),m.load_data.to(y.load_data),m.byte_offset.to(y.byte_offset),m.funct3.to(y.funct3),m.pc4.to(y.pc4),m.imm.to(y.imm),m.pc_plus_imm.to(y.pc_plus_imm),m.mem_to_reg.to(y.mem_to_reg),m.lui.to(y.lui),m.auipc.to(y.auipc),m.jump.to(y.jump),m.rd.to(u.wb_rd,x.mem_rd),m.reg_write.to(u.wb_we,x.mem_reg_write)];return t&&_.push(o.debug_addr.to(u.debug_rs),u.debug_read.to(s.debug_value),a.pc.to(s.if_pc),l.pc.to(s.id_pc),d.pc.to(s.ex_pc),p.pc4.to(s.mem_pc4),m.pc4.to(s.wb_pc4)),_}}}),iM=Object.freeze(Object.defineProperty({__proto__:null,RV32I_Core:nM},Symbol.toStringTag,{value:"Module"})),oM=(()=>{const t=new Array(256);for(let e=0;e<256;e++){let n=e;for(let o=0;o<8;o++)n=n&1?(n>>>1^3988292384)>>>0:n>>>1>>>0;t[e]=n>>>0}return t})(),rM=gt("Eth_ProtocolDecoder",{inputs:{ethertype:P(16)},outputs:{is_ipv4:X,is_ipv6:X,is_arp:X,is_vlan:X,is_mpls:X},eval:({ethertype:t})=>{const e=t&65535;return{is_ipv4:e===2048?1:0,is_ipv6:e===34525?1:0,is_arp:e===2054?1:0,is_vlan:e===33024?1:0,is_mpls:e===34887?1:0}},meta:{category:"networking",icon:"EP",description:"EtherType → protocol flags"}}),sM=gt("Eth_AddrClassifier",{inputs:{dst_mac_hi:P(16),dst_mac_lo:P(32)},outputs:{is_broadcast:X,is_multicast:X,is_unicast:X},eval:({dst_mac_hi:t,dst_mac_lo:e})=>{const n=t&65535,o=(e&4294967295)>>>0,s=n===65535&&o===4294967295?1:0,a=!s&&(o>>>24&1)===1?1:0;return{is_broadcast:s,is_multicast:a,is_unicast:!s&&!a?1:0}},meta:{category:"networking",icon:"EA",description:"MAC address classifier"}}),aM=gt("Eth_FrameInput",{inputs:{enable:X,reset:X},outputs:{tdata:P(32),tkeep:P(4),tvalid:X,tlast:X,byte_offset:P(16)},state:{memory:new Map},eval:({memory:t})=>{const e=t??new Map,n=(e.get(65539)??0)>>>0,o=(e.get(65540)??0)&15,s=(e.get(65541)??0)!==0?1:0,a=(e.get(65542)??0)!==0?1:0,l=(e.get(65543)??0)&65535;return{tdata:n,tkeep:o,tvalid:s,tlast:a,byte_offset:l}},onTick:({enable:t,reset:e,memory:n})=>{const o=n??new Map,s=65536,a=65537,l=65538,u=65539,d=65540,h=65541,p=65542,m=65543;if(e){const E=new Map(o);return E.set(s,0),E.set(l,0),E.set(h,0),E.set(p,0),{memory:E}}if(!t){const E=new Map(o);return E.set(h,0),{memory:E}}const y=new Map(o);if(!(o.get(l)??0)){let E=-1;for(const R of o.keys())R<65536&&R>E&&(E=R);y.set(a,E+1),y.set(l,1)}const b=y.get(a)??0,x=o.get(s)??0;if(x>=b||b===0)return y.set(u,0),y.set(d,0),y.set(h,0),y.set(p,0),y.set(m,x&65535),{memory:y};const w=b-x,_=Math.min(4,w);let S=0,k=0;for(let E=0;E<_;E++)S=(S|((o.get(x+E)??0)&255)<<24-E*8)>>>0,k|=1<<3-E;const C=x+_>=b;return y.set(u,S),y.set(d,k),y.set(h,1),y.set(p,C?1:0),y.set(m,x&65535),y.set(s,x+_),{memory:y}},meta:{category:"networking",icon:"EI",description:"Ethernet frame input (AXI-Stream)"}}),lM=gt("Eth_FrameParser",{inputs:{tdata:P(32),tkeep:P(4),tvalid:X,tlast:X},outputs:{dst_mac_hi:P(16),dst_mac_lo:P(32),dst_mac_valid:X,src_mac_hi:P(16),src_mac_lo:P(32),src_mac_valid:X,ethertype:P(16),ethertype_valid:X,has_vlan:X,vlan_tci:P(16),vlan_valid:X,payload_valid:X,frame_done:X,frame_length:P(16),parse_state:P(4)},state:{memory:new Map},eval:({memory:t})=>{const e=t??new Map,n=e.get(0)??0,o=(e.get(1)??0)>>>0,s=(e.get(2)??0)&65535,a=(e.get(3)??0)>>>0,l=(e.get(4)??0)&65535,u=(e.get(5)??0)&65535,d=(e.get(6)??0)&65535,h=(e.get(7)??0)!==0,p=(e.get(8)??0)&65535;return{dst_mac_hi:s,dst_mac_lo:o,dst_mac_valid:n>=2?1:0,src_mac_hi:l,src_mac_lo:a,src_mac_valid:n>=4?1:0,ethertype:u,ethertype_valid:n>=6?1:0,has_vlan:h?1:0,vlan_tci:d,vlan_valid:h&&n>=6?1:0,payload_valid:n===6||n===7?1:0,frame_done:n===7?1:0,frame_length:p,parse_state:n}},onTick:({tdata:t,tkeep:e,tvalid:n,tlast:o,memory:s})=>{const a=s??new Map;if(!n)return{memory:a};const l=t>>>0,u=e&15,d=!!o,h=0,p=1,m=2,y=3,b=4,x=5,w=6,_=7,S=8,k=0,C=2,E=3,R=4,A=5,O=6,D=7,U=new Map(a);let q=a.get(h)??k;const Y=(u>>3&1)+(u>>2&1)+(u>>1&1)+(u&1),K=a.get(S)??0;U.set(S,K+Y);const W=l>>>24&255,B=l>>>16&255,H=l>>>8&255,j=l&255;switch(q){case k:U.set(p,l),U.set(h,C);break;case C:U.set(m,W<<8|B),U.set(y,H<<8|j),U.set(h,E);break;case E:U.set(b,a.get(y)??0),U.set(y,l),U.set(h,R);break;case R:{const I=(W<<8|B)&65535;I===33024?(U.set(w,(H<<8|j)&65535),U.set(_,1),U.set(x,I),U.set(h,A)):(U.set(x,I),U.set(h,d?D:O));break}case A:U.set(x,(W<<8|B)&65535),U.set(h,d?D:O);break;case O:d&&U.set(h,D);break}return d&&q!==D&&U.set(S,K+Y),{memory:U}},meta:{category:"networking",icon:"EF",description:"Ethernet frame parser FSM"}}),cM=gt("Eth_CRC32",{inputs:{data:P(32),data_valid:X,tkeep:P(4),tlast:X,reset:X},outputs:{crc:P(32),crc_ok:X},state:{memory:new Map},eval:({memory:t})=>{const e=t??new Map,n=(e.get(0)??4294967295)>>>0,o=(e.get(1)??0)!==0;return{crc:~n>>>0,crc_ok:o&&n===3736805603?1:0}},onTick:({data:t,data_valid:e,tkeep:n,tlast:o,reset:s,memory:a})=>{const l=a??new Map;if(s){const m=new Map(l);return m.set(0,4294967295),m.set(1,0),{memory:m}}if(!e)return{memory:l};const u=t>>>0,d=n&15;let h=(l.get(0)??4294967295)>>>0;for(let m=3;m>=0;m--)if(d>>m&1){const y=u>>>m*8&255;h=(oM[(h^y)&255]^h>>>8)>>>0}const p=new Map(l);return p.set(0,h),o&&p.set(1,1),{memory:p}},meta:{category:"networking",icon:"EC",description:"IEEE 802.3 CRC-32 checker"}}),uM=gt("MemBusMux",{inputs:{addr:P(32),write_data:P(32),mem_read:X,mem_write:X,funct3:P(3),read_data_0:P(32),read_data_1:P(32),read_data_2:P(32),read_data_3:P(32),read_data_4:P(32)},outputs:{local_addr:P(32),write_data_out:P(32),funct3_out:P(3),read_data:P(32),p0_read:X,p0_write:X,p1_read:X,p1_write:X,p2_read:X,p2_write:X,p3_read:X,p3_write:X,p4_read:X,p4_write:X},eval:({addr:t,write_data:e,mem_read:n,mem_write:o,funct3:s,read_data_0:a,read_data_1:l,read_data_2:u,read_data_3:d,read_data_4:h,base0:p,base1:m,base2:y,base3:b,base4:x,end0:w,end1:_,end2:S,end3:k,end4:C})=>{const E=(t??0)>>>0,R=(e??0)>>>0,A=(s??0)&7,O=[{base:(p??65536)>>>0,end:(w??131071)>>>0},{base:(m??2147483648)>>>0,end:(_??2147487743)>>>0},{base:(y??2147487744)>>>0,end:(S??2147491839)>>>0},{base:(b??2147491840)>>>0,end:(k??2147495935)>>>0},{base:(x??0)>>>0,end:(C??65535)>>>0}];let D=-1;for(let B=0;B<5;B++)if(E>=O[B].base&&E<=O[B].end){D=B;break}const U=D>=0?E-O[D].base>>>0:0,q=[a,l,u,d,h].map(B=>(B??0)>>>0),Y=D>=0?q[D]:0,K=!!n,W=!!o;return{local_addr:U,write_data_out:R,funct3_out:A,read_data:Y,p0_read:D===0&&K?1:0,p0_write:D===0&&W?1:0,p1_read:D===1&&K?1:0,p1_write:D===1&&W?1:0,p2_read:D===2&&K?1:0,p2_write:D===2&&W?1:0,p3_read:D===3&&K?1:0,p3_write:D===3&&W?1:0,p4_read:D===4&&K?1:0,p4_write:D===4&&W?1:0}},meta:{category:"rv32i",icon:"BUS",description:"Memory bus multiplexer"}}),fM=gt("UART_TX",{inputs:{addr:P(32),write_data:P(32),mem_read:X,mem_write:X},outputs:{read_data:P(32)},state:{text:""},eval:({mem_read:t})=>({read_data:t?1:0}),onTick:({addr:t,write_data:e,mem_write:n,text:o})=>{if(!n)return{text:o};if(t>>>0!==0)return{text:o};const a=String.fromCharCode(e&255),l=(o??"")+a;return{text:l.length>4096?l.slice(-4096):l}},meta:{category:"io",icon:"TX",description:"UART transmitter",synthesizable:!1}}),dM=gt("NIC_FIFO",{inputs:{tx_addr:P(32),tx_write_data:P(32),tx_mem_read:X,tx_mem_write:X,rx_addr:P(32),rx_mem_read:X,rx_mem_write:X,net_rx_data:P(32),net_rx_valid:X,net_rx_frame:X},outputs:{tx_read_data:P(32),rx_read_data:P(32),net_tx_data:P(32),net_tx_valid:X,net_tx_frame:X},state:{memory:new Map},eval:({tx_mem_read:t,rx_mem_read:e,tx_addr:n,rx_addr:o,memory:s})=>{const a=s??new Map;let l=0;t&&(n??0)>>>0===8&&(l=(a.get(8192)??0)-(a.get(8193)??0));let u=0;if(e){const x=(o??0)>>>0;x===0?u=(a.get(4096+(a.get(8209)??0))??0)>>>0:x===8&&(u=a.get(8210)??0)}const d=a.get(8196)??0,h=a.get(8195)??0,p=a.get(8192)??0;let m=0,y=0,b=0;return d&&h<p&&(m=(a.get(0+h)??0)>>>0,y=1,b=h+1>=p?1:0),{tx_read_data:l,rx_read_data:u,net_tx_data:m,net_tx_valid:y,net_tx_frame:b}},onTick:({tx_addr:t,tx_write_data:e,tx_mem_write:n,rx_addr:o,rx_mem_write:s,net_rx_data:a,net_rx_valid:l,memory:u})=>{const d=u??new Map,h=new Map(d);if(n){const m=(t??0)>>>0,y=(e??0)>>>0;if(m===0){const b=h.get(8192)??0;h.set(0+b,y),h.set(8192,b+1)}else m===12&&(h.set(8194,1),h.set(8195,0),h.set(8196,1))}if(d.get(8196)??0){const m=h.get(8195)??0,y=h.get(8192)??0;m<y&&(h.set(8195,m+1),m+1>=y&&(h.set(8196,0),h.set(8192,0),h.set(8193,0),h.set(8194,0)))}if(l){const m=(a??0)>>>0,y=h.get(8208)??0;h.set(4096+y,m),h.set(8208,y+1),h.set(8210,(h.get(8210)??0)+1)}if(s&&(o??0)>>>0===4){const y=h.get(8209)??0,b=h.get(8210)??0;b>0&&(h.set(8209,y+1),h.set(8210,b-1))}return{memory:h}},meta:{category:"networking",icon:"NIC",description:"Network interface FIFO",synthesizable:!1}}),hM=Object.freeze(Object.defineProperty({__proto__:null,Eth_AddrClassifier:sM,Eth_CRC32:cM,Eth_FrameInput:aM,Eth_FrameParser:lM,Eth_ProtocolDecoder:rM,MemBusMux:uM,NIC_FIFO:dM,UART_TX:fM},Symbol.toStringTag,{value:"Module"})),ty=t=>!!t&&typeof t=="object"&&"circuit"in t,pM=[...Object.values(sA),...Object.values(bA),...Object.values(NA),...Object.values(MA),...Object.values(VA),...Object.values(LA),...Object.values(UA),...Object.values(FA),...Object.values(iM),...Object.values(hM)],mM=t=>{if(ty(t))return t;if(typeof t=="function")try{const e=t();return ty(e)?e:null}catch{return null}return null},gM=Object.freeze(pM.map(mM).filter(t=>t!==null));function yM(t,e){const n=new Map;for(const o of e)n.set(o.name,ny(ey(o,new Map)));return ny(ey(t,n))}function ey(t,e){const n={};for(const a of t.inputs)n[a.name]=a;const o={};for(const a of t.outputs)o[a.name]=a;const s={};for(const a of t.nodes)s[a.id]=a;return{circuit:t,inputs:n,outputs:o,nodes:s,_dependencies:e}}function ny(t){return Object.defineProperty(t,"toJSON",{value:function(){const e={};for(const[n,o]of this._dependencies)e[n]=o;return{circuit:this.circuit,_dependencies:e}},enumerable:!1}),t}function vM(t,e,n){if(t.inputs.length===0&&t.outputs.length===0)return t;e.resolveCircuit(t.name)||e.addCircuit(t);const o=`${t.name}Demo`,s=[],a=[];let l=0;s.push({id:"dut",componentRef:t.name,arguments:{},inputs:t.inputs.map(u=>({id:`dut.${u.name}`,name:u.name,portType:u.portType})),outputs:t.outputs.map(u=>({id:`dut.${u.name}`,name:u.name,portType:u.portType})),clocks:t.clocks.map(u=>({id:`dut.${u.name}`,name:u.name}))});for(const u of t.inputs){const d=u.portType.kind==="bit",h={};!d&&u.portType.kind==="bus"&&(h.width=u.portType.width),n&&u.name in n&&(h.value=n[u.name]),s.push({id:u.name,label:u.name,componentRef:d?"Switch":"Input",arguments:h,inputs:[],outputs:[{id:`${u.name}.out`,name:"out",portType:u.portType}],clocks:[]}),a.push({id:`c${l++}`,source:{nodeId:u.name,portName:"out"},target:{nodeId:"dut",portName:u.name},portType:u.portType})}for(const u of t.outputs){const d=u.portType.kind==="bit",h={};!d&&u.portType.kind==="bus"&&(h.width=u.portType.width),s.push({id:u.name,label:u.name,componentRef:d?"Led":"HexDisplay",arguments:h,inputs:[{id:`${u.name}.in`,name:"in",portType:u.portType}],outputs:[],clocks:[]}),a.push({id:`c${l++}`,source:{nodeId:"dut",portName:u.name},target:{nodeId:u.name,portName:"in"},portType:u.portType})}return{version:1,name:o,inputs:[],outputs:[],clocks:[],state:[],nodes:s,connections:a,implementation:{kind:"composite"},metadata:{description:`Auto-generated harness for ${t.name}`}}}function ud(t,e,n=new Set){if(!t||n.has(t.name))return!1;if(n.add(t.name),t.clocks?.length>0||t.state?.length>0)return!0;for(const o of t.nodes){const s=e(o.componentRef);if(s&&ud(s,e,n))return!0}return!1}const iy=new Set(gM.map(t=>t.circuit.name));class Pl extends Error{constructor(e){super(e),this.name="CircuitToSourceError"}}function bM(t){const e=new Map;for(const[s,a]of t._dependencies)iy.has(s)||e.set(s,a.circuit);for(const s of t.circuit.nodes)if(!iy.has(s.componentRef)&&!e.has(s.componentRef)){const a=t._dependencies.get(s.componentRef);a&&e.set(s.componentRef,a.circuit)}const n=[],o=xM(e);for(const s of o)n.push(oy(s)),n.push("");return n.push(oy(t.circuit)),n.join(`
|
|
12
|
+
`)}function xM(t){const e=new Set,n=[],o=s=>{if(e.has(s))return;e.add(s);const a=t.get(s);if(a){for(const l of a.nodes)t.has(l.componentRef)&&o(l.componentRef);n.push(a)}};for(const s of t.keys())o(s);return n}function oy(t){if(t.implementation.kind==="intrinsic")throw new Pl(`Cannot serialize circuit '${t.name}': intrinsic implementations are not supported.`);if(t.implementation.kind==="primitive"&&Ll(t.name))throw new Pl(`Cannot serialize circuit '${t.name}': primitives with eval/onTick callbacks aren't supported by the v1 fork serializer.`);const e=[];return t.inputs.length>0&&e.push(` inputs: ${ry(t.inputs)},`),t.outputs.length>0&&e.push(` outputs: ${ry(t.outputs)},`),t.state.length>0&&e.push(` state: ${_M(t.state,t.name)},`),t.nodes.length>0&&e.push(` nodes: ${CM(t.nodes)},`),t.connections.length>0&&e.push(` connect: ${NM(t)},`),`const ${t.name} = circuit('${t.name}', {
|
|
13
13
|
${e.join(`
|
|
14
14
|
`)}
|
|
15
|
-
});`}function ry(t){return`{ ${t.map(n=>`${n.name}: ${
|
|
15
|
+
});`}function ry(t){return`{ ${t.map(n=>`${n.name}: ${wM(n.portType)}`).join(", ")} }`}function wM(t){if(t.kind==="bit")return"bit";if(t.kind==="bus")return`bus(${t.width})`;throw new Pl(`Unsupported port type kind: ${t.kind}`)}function _M(t,e){return`{ ${t.map(o=>{if(o.stateType.kind==="bit")return`${o.name}: ${sy(o.initialValue)}`;if(o.stateType.kind==="bus"){const s=o.initialValue;return s===0?`${o.name}: reg(${o.stateType.width})`:`${o.name}: reg(${o.stateType.width}, ${s})`}if(o.stateType.kind==="memory"){const s=o.initialValue,a=1<<o.stateType.addressWidth,l=s.data.size>0?`, ${SM(s.data)}`:"";return`${o.name}: mem(${a}, ${o.stateType.dataWidth}${l})`}throw new Pl(`Cannot serialize state '${o.name}' on circuit '${e}': unsupported state type.`)}).join(", ")} }`}function SM(t){return`new Map([${[...t.entries()].sort((n,o)=>n[0]-o[0]).map(([n,o])=>`[${n}, ${o}]`).join(", ")}])`}const EM=new Set(["Constant","Switch","Button","Input","Register","DFlipFlop","ROM","RAM","DualPortRAM","DualPortROM","BitSlice","Adder","Subtractor","Comparator","LeftShifter","RightShifter","BusAnd","BusOr","BusXor","Mux","Screen","RasterDisplay"]);function CM(t){return`{ ${t.map(n=>n.arguments&&Object.keys(n.arguments).length>0?`${n.id}: ${n.componentRef}(${TM(n.arguments)})`:EM.has(n.componentRef)?`${n.id}: ${n.componentRef}()`:`${n.id}: ${n.componentRef}`).join(", ")} }`}function TM(t){return`{ ${Object.entries(t).map(([n,o])=>`${n}: ${sy(o)}`).join(", ")} }`}function sy(t){return t==null?"null":typeof t=="boolean"?t?"true":"false":typeof t=="number"?String(t):typeof t=="string"?JSON.stringify(t):Array.isArray(t)?`[${t.join(", ")}]`:`{ ${Object.entries(t).map(([n,o])=>`${n}: ${o}`).join(", ")} }`}function NM(t){const e=new Map;for(const o of t.connections){const s=`${o.source.nodeId}|${o.source.portName}`,a=e.get(s);a?a.targets.push(o.target):e.set(s,{source:o.source,targets:[o.target]})}const n=[];for(const{source:o,targets:s}of e.values()){const a=ay(o,"source"),l=s.map(u=>ay(u,"target")).join(", ");n.push(` ${a}.to(${l}),`)}return`({ inputs, outputs, nodes }) => [
|
|
16
16
|
${n.join(`
|
|
17
17
|
`)}
|
|
18
|
-
]`}function ay(t,e){return t.nodeId===""?e==="source"?`inputs.${t.portName}`:`outputs.${t.portName}`:`nodes.${t.nodeId}.${t.portName}`}const xM="__top__";function wM(t){const e={},n=new Set;function i(s){const a=s.circuit.name;if(n.has(a))return;n.add(a);const c=nc(a);c&&(e[a]={evalSource:c.evalFn.toString(),onTickSource:c.onTickFn?.toString(),inputNames:c.inputNames,outputNames:c.outputNames,stateKeys:c.stateKeys});for(const[,u]of s._dependencies)u&&i(u)}return i(t),e}function SM(t,e){const n=sd(),i=N.useMemo(()=>`embed-${typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2)}`,[]),{rawCircuit:s,componentLibrary:a}=N.useMemo(()=>{const pt=new Map,gt={resolveCircuit:yt=>pt.get(yt),getAllPrimitiveNames:()=>[...pt.entries()].filter(([,yt])=>yt.implementation.kind==="primitive").map(([yt])=>yt),addCircuit:yt=>{pt.set(yt.name,yt)}};for(const yt of[cd(),ud(),fd,dd(),hd,pd])gt.addCircuit(yt.circuit);if(t&&(gt.addCircuit(t.circuit),t._dependencies))for(const[,yt]of t._dependencies)yt?.circuit&>.addCircuit(yt.circuit);return{rawCircuit:t?.circuit??null,componentLibrary:gt}},[t]),c=N.useMemo(()=>s?e?.autoHarness?uM(s,a,e.initialInputs):s:null,[s,a,e?.autoHarness,e?.initialInputs]),u=N.useMemo(()=>vd(c,a.resolveCircuit),[c,a]),[d,h]=N.useState(new Map),[p,m]=N.useState({}),[y,b]=N.useState(0),[x,w]=N.useState(!1),[S,E]=N.useState(!1),[D,T]=N.useState(5),C=N.useRef(null),R=N.useRef([]),[A,O]=N.useState(-1),[k,H]=N.useState(0),$=200,q=N.useMemo(()=>{const pt={};if(!c)return pt;for(const gt of c.inputs)pt[gt.name]=gt.portType.kind==="bit"?!1:0;return pt},[c]),[F,Q]=N.useState({}),[B,P]=N.useState(q),j=N.useRef(B);N.useEffect(()=>{j.current=B},[B]),N.useEffect(()=>{if(!t||!c){w(!1),h(new Map);return}let pt=!1;async function gt(){if(!t||!c)return;const yt=wM(t),mt=[],Et=new Set,Vt=Xt=>{Et.has(Xt.name)||(Et.add(Xt.name),mt.push(Xt))};Vt(t.circuit);for(const[,Xt]of t._dependencies)Xt?.circuit&&Vt(Xt.circuit);for(const Xt of[cd(),ud(),fd,dd(),hd,pd])Vt(Xt.circuit);const jt=a.getAllPrimitiveNames();for(const Xt of jt){const xe=a.resolveCircuit(Xt);xe&&Vt(xe)}const zt=await n.compileIR(c,mt,i,{evalSources:yt,snapshot:u});if(pt)return;if("error"in zt){console.error("[useCircuitSimulator] compileIR failed:",zt.error),w(!1);return}const ue=new Map;for(const[Xt,xe]of Object.entries(zt.portValues))ue.set(Xt,xe);h(ue),zt.peripheralState&&m(zt.peripheralState),b(0),R.current=zt.snapshotId!==void 0?[{snapshotId:zt.snapshotId,cycle:0,inputs:{...q}}]:[],O(zt.snapshotId!==void 0?0:-1),H(R.current.length),w(!0)}return gt(),()=>{pt=!0,n.dispose(i).catch(()=>{})}},[t,c,a,n,i,u]),N.useEffect(()=>{P(q)},[q]),N.useEffect(()=>{if(!x||d.size===0||!c)return;const pt={};for(const gt of c.outputs){const yt=`${xM}.${gt.name}`,mt=d.get(yt);mt!==void 0&&(pt[gt.name]=typeof mt=="number"?mt:!!mt)}Q(pt)},[x,d,c]);const I=N.useCallback((pt,gt,yt)=>{if(pt===void 0)return;const mt=R.current,Et=z.current;if(Et>=0&&Et<mt.length-1&&(mt.length=Et+1),mt.push({snapshotId:pt,cycle:gt,inputs:{...yt}}),mt.length>$){const Vt=mt.length-$,jt=mt[Vt-1].snapshotId;mt.splice(0,Vt),n.pruneSnapshots(jt,i).catch(()=>{})}z.current=mt.length-1,O(mt.length-1),H(mt.length)},[n,i]),z=N.useRef(-1);N.useEffect(()=>{z.current=A},[A]);const U=N.useCallback(async(pt,gt)=>{const yt={...j.current,[pt]:gt};if(j.current=yt,P(yt),!x)return;const mt=await n.setNode(pt,gt,i);if("error"in mt)return;const Et=new Map;for(const[Vt,jt]of Object.entries(mt.portValues))Et.set(Vt,jt);h(Et),mt.peripheralState&&m(mt.peripheralState)},[x,n,i]),Y=N.useCallback(pt=>{const gt=B[pt];U(pt,typeof gt=="boolean"?!gt:gt===0?1:0)},[B,U]),L=N.useCallback(async pt=>{if(!x)return;const gt=`${pt}.out`,yt=d.get(gt),mt=typeof yt=="boolean"?!yt:yt===1?0:1,Et=await n.setNode(pt,mt,i);if("error"in Et)return;const Vt=new Map;for(const[jt,zt]of Object.entries(Et.portValues))Vt.set(jt,zt);h(Vt),Et.peripheralState&&m(Et.peripheralState)},[x,d,n,i]),G=N.useCallback(async(pt,gt)=>{if(!x)return null;const yt=await n.setNode(pt,gt,i);if("error"in yt)return null;const mt=new Map;for(const[Et,Vt]of Object.entries(yt.portValues))mt.set(Et,Vt);return h(mt),yt.peripheralState&&m(yt.peripheralState),mt},[x,n,i]),tt=N.useCallback(async()=>{if(!x)return;const pt=await n.tick(void 0,i,{snapshot:u});if("error"in pt)return;const gt=new Map;for(const[yt,mt]of Object.entries(pt.portValues))gt.set(yt,mt);h(gt),b(pt.cycle),pt.peripheralState&&m(pt.peripheralState),I(pt.snapshotId,pt.cycle,j.current)},[x,n,i,u,I]),it=N.useCallback(async pt=>{if(!x||pt<=0)return;const gt=await n.tickN(pt,void 0,i,{snapshot:u});if("error"in gt)return;const yt=new Map;for(const[mt,Et]of Object.entries(gt.portValues))yt.set(mt,Et);h(yt),b(gt.cycle),gt.peripheralState&&m(gt.peripheralState),I(gt.snapshotId,gt.cycle,j.current)},[x,n,i,u,I]),lt=N.useCallback(async(pt,gt,yt)=>{if(!x||yt<=0)return null;const mt=await n.scanPort(pt,gt,yt,i);return"error"in mt?null:mt.values},[x,n,i]),ht=N.useCallback(async()=>{const pt=await n.reset(i);if("error"in pt)return;const gt=new Map;for(const[yt,mt]of Object.entries(pt.portValues))gt.set(yt,mt);if(h(gt),b(0),P(q),pt.peripheralState?m(pt.peripheralState):m({}),R.current=[],u){const yt=await n.snapshot(i);!("error"in yt)&&yt.snapshotId!==void 0&&(R.current=[{snapshotId:yt.snapshotId,cycle:0,inputs:{...q}}])}z.current=R.current.length>0?0:-1,O(R.current.length>0?0:-1),H(R.current.length)},[n,i,q,u]),ft=N.useCallback(async(pt,gt)=>{const yt=await n.restore(pt.snapshotId,i);if("error"in yt)return;const mt=new Map;for(const[Vt,jt]of Object.entries(yt.portValues))mt.set(Vt,jt);h(mt),b(yt.cycle),yt.peripheralState?m(yt.peripheralState):m({});const Et={...pt.inputs};j.current=Et,P(Et),z.current=gt,O(gt)},[n,i]),ut=N.useCallback(async()=>{if(!x)return;const pt=R.current,gt=z.current;gt<=0||await ft(pt[gt-1],gt-1)},[x,ft]),dt=N.useCallback(async()=>{if(!x)return;const pt=R.current,gt=z.current;gt>=pt.length-1||await ft(pt[gt+1],gt+1)},[x,ft]),Mt=N.useCallback(async pt=>{if(!x)return;const gt=R.current;pt<0||pt>=gt.length||await ft(gt[pt],pt)},[x,ft]),Nt=N.useRef(tt);N.useEffect(()=>{Nt.current=tt},[tt]);const bt=N.useCallback((pt,gt)=>{C.current&&clearInterval(C.current),T(pt),E(!0);const yt=Math.max(1,Math.floor(1e3/pt));C.current=setInterval(()=>{Nt.current()},yt)},[]),Tt=N.useCallback(()=>{C.current&&(clearInterval(C.current),C.current=null),E(!1)},[]),Dt=N.useCallback(pt=>{if(T(pt),C.current){clearInterval(C.current);const gt=Math.max(1,Math.floor(1e3/pt));C.current=setInterval(()=>{Nt.current()},gt)}},[]);N.useEffect(()=>()=>{C.current&&clearInterval(C.current)},[]);const qt=N.useMemo(()=>{const pt=Object.entries(p);if(pt.length===0)return null;const gt=new Map;for(const[yt,mt]of pt)gt.set(yt,mt);return{currentState:gt,nextState:new Map,clocks:new Map,cycleCount:y}},[p,y]),Ht=N.useMemo(()=>R.current.slice(0,k).map(pt=>({engineSnapshot:pt.snapshotId,metadata:pt.cycle})),[k]);return{outputs:F,inputs:B,cycleCount:y,ready:x,error:null,isSequential:u,circuit:c,portValues:d.size>0?d:null,sequentialState:qt,componentLibrary:a,history:Ht,historyIndex:A,isViewingPast:A>=0&&A<k-1,isRunning:S,speed:D,setNode:U,toggleInput:Y,toggleNode:L,setNodeValue:G,tick:tt,tickN:it,scanPort:lt,reset:ht,stepBack:ut,stepForward:dt,seek:Mt,startAutoRun:bt,stopAutoRun:Tt,setSpeed:Dt,runCombinational:()=>{},getSimulator:()=>null}}function _e(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,i;n<t.length;n++)(i=_e(t[n]))!==""&&(e+=(e&&" ")+i);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var EM={value:()=>{}};function rc(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new sc(n)}function sc(t){this._=t}function CM(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",s=n.indexOf(".");if(s>=0&&(i=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}sc.prototype=rc.prototype={constructor:sc,on:function(t,e){var n=this._,i=CM(t+"",n),s,a=-1,c=i.length;if(arguments.length<2){for(;++a<c;)if((s=(t=i[a]).type)&&(s=TM(n[s],t.name)))return s;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<c;)if(s=(t=i[a]).type)n[s]=ly(n[s],t.name,e);else if(e==null)for(s in n)n[s]=ly(n[s],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new sc(t)},call:function(t,e){if((s=arguments.length-2)>0)for(var n=new Array(s),i=0,s,a;i<s;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=this._[t],i=0,s=a.length;i<s;++i)a[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],s=0,a=i.length;s<a;++s)i[s].value.apply(e,n)}};function TM(t,e){for(var n=0,i=t.length,s;n<i;++n)if((s=t[n]).name===e)return s.value}function ly(t,e,n){for(var i=0,s=t.length;i<s;++i)if(t[i].name===e){t[i]=EM,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}var bd="http://www.w3.org/1999/xhtml";const cy={svg:"http://www.w3.org/2000/svg",xhtml:bd,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ac(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),cy.hasOwnProperty(e)?{space:cy[e],local:t}:t}function _M(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===bd&&e.documentElement.namespaceURI===bd?e.createElement(t):e.createElementNS(n,t)}}function NM(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function uy(t){var e=ac(t);return(e.local?NM:_M)(e)}function AM(){}function xd(t){return t==null?AM:function(){return this.querySelector(t)}}function MM(t){typeof t!="function"&&(t=xd(t));for(var e=this._groups,n=e.length,i=new Array(n),s=0;s<n;++s)for(var a=e[s],c=a.length,u=i[s]=new Array(c),d,h,p=0;p<c;++p)(d=a[p])&&(h=t.call(d,d.__data__,p,a))&&("__data__"in d&&(h.__data__=d.__data__),u[p]=h);return new fn(i,this._parents)}function RM(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function kM(){return[]}function fy(t){return t==null?kM:function(){return this.querySelectorAll(t)}}function OM(t){return function(){return RM(t.apply(this,arguments))}}function DM(t){typeof t=="function"?t=OM(t):t=fy(t);for(var e=this._groups,n=e.length,i=[],s=[],a=0;a<n;++a)for(var c=e[a],u=c.length,d,h=0;h<u;++h)(d=c[h])&&(i.push(t.call(d,d.__data__,h,c)),s.push(d));return new fn(i,s)}function dy(t){return function(){return this.matches(t)}}function hy(t){return function(e){return e.matches(t)}}var jM=Array.prototype.find;function zM(t){return function(){return jM.call(this.children,t)}}function VM(){return this.firstElementChild}function LM(t){return this.select(t==null?VM:zM(typeof t=="function"?t:hy(t)))}var IM=Array.prototype.filter;function BM(){return Array.from(this.children)}function PM(t){return function(){return IM.call(this.children,t)}}function HM(t){return this.selectAll(t==null?BM:PM(typeof t=="function"?t:hy(t)))}function UM(t){typeof t!="function"&&(t=dy(t));for(var e=this._groups,n=e.length,i=new Array(n),s=0;s<n;++s)for(var a=e[s],c=a.length,u=i[s]=[],d,h=0;h<c;++h)(d=a[h])&&t.call(d,d.__data__,h,a)&&u.push(d);return new fn(i,this._parents)}function py(t){return new Array(t.length)}function $M(){return new fn(this._enter||this._groups.map(py),this._parents)}function lc(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}lc.prototype={constructor:lc,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function qM(t){return function(){return t}}function YM(t,e,n,i,s,a){for(var c=0,u,d=e.length,h=a.length;c<h;++c)(u=e[c])?(u.__data__=a[c],i[c]=u):n[c]=new lc(t,a[c]);for(;c<d;++c)(u=e[c])&&(s[c]=u)}function GM(t,e,n,i,s,a,c){var u,d,h=new Map,p=e.length,m=a.length,y=new Array(p),b;for(u=0;u<p;++u)(d=e[u])&&(y[u]=b=c.call(d,d.__data__,u,e)+"",h.has(b)?s[u]=d:h.set(b,d));for(u=0;u<m;++u)b=c.call(t,a[u],u,a)+"",(d=h.get(b))?(i[u]=d,d.__data__=a[u],h.delete(b)):n[u]=new lc(t,a[u]);for(u=0;u<p;++u)(d=e[u])&&h.get(y[u])===d&&(s[u]=d)}function XM(t){return t.__data__}function FM(t,e){if(!arguments.length)return Array.from(this,XM);var n=e?GM:YM,i=this._parents,s=this._groups;typeof t!="function"&&(t=qM(t));for(var a=s.length,c=new Array(a),u=new Array(a),d=new Array(a),h=0;h<a;++h){var p=i[h],m=s[h],y=m.length,b=ZM(t.call(p,p&&p.__data__,h,i)),x=b.length,w=u[h]=new Array(x),S=c[h]=new Array(x),E=d[h]=new Array(y);n(p,m,w,S,E,b,e);for(var D=0,T=0,C,R;D<x;++D)if(C=w[D]){for(D>=T&&(T=D+1);!(R=S[T])&&++T<x;);C._next=R||null}}return c=new fn(c,i),c._enter=u,c._exit=d,c}function ZM(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function KM(){return new fn(this._exit||this._groups.map(py),this._parents)}function QM(t,e,n){var i=this.enter(),s=this,a=this.exit();return typeof t=="function"?(i=t(i),i&&(i=i.selection())):i=i.append(t+""),e!=null&&(s=e(s),s&&(s=s.selection())),n==null?a.remove():n(a),i&&s?i.merge(s).order():s}function WM(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,s=n.length,a=i.length,c=Math.min(s,a),u=new Array(s),d=0;d<c;++d)for(var h=n[d],p=i[d],m=h.length,y=u[d]=new Array(m),b,x=0;x<m;++x)(b=h[x]||p[x])&&(y[x]=b);for(;d<s;++d)u[d]=n[d];return new fn(u,this._parents)}function JM(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i=t[e],s=i.length-1,a=i[s],c;--s>=0;)(c=i[s])&&(a&&c.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(c,a),a=c);return this}function tR(t){t||(t=eR);function e(m,y){return m&&y?t(m.__data__,y.__data__):!m-!y}for(var n=this._groups,i=n.length,s=new Array(i),a=0;a<i;++a){for(var c=n[a],u=c.length,d=s[a]=new Array(u),h,p=0;p<u;++p)(h=c[p])&&(d[p]=h);d.sort(e)}return new fn(s,this._parents).order()}function eR(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function nR(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function oR(){return Array.from(this)}function iR(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],s=0,a=i.length;s<a;++s){var c=i[s];if(c)return c}return null}function rR(){let t=0;for(const e of this)++t;return t}function sR(){return!this.node()}function aR(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var s=e[n],a=0,c=s.length,u;a<c;++a)(u=s[a])&&t.call(u,u.__data__,a,s);return this}function lR(t){return function(){this.removeAttribute(t)}}function cR(t){return function(){this.removeAttributeNS(t.space,t.local)}}function uR(t,e){return function(){this.setAttribute(t,e)}}function fR(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function dR(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function hR(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function pR(t,e){var n=ac(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((e==null?n.local?cR:lR:typeof e=="function"?n.local?hR:dR:n.local?fR:uR)(n,e))}function my(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function mR(t){return function(){this.style.removeProperty(t)}}function gR(t,e,n){return function(){this.style.setProperty(t,e,n)}}function yR(t,e,n){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function vR(t,e,n){return arguments.length>1?this.each((e==null?mR:typeof e=="function"?yR:gR)(t,e,n??"")):ts(this.node(),t)}function ts(t,e){return t.style.getPropertyValue(e)||my(t).getComputedStyle(t,null).getPropertyValue(e)}function bR(t){return function(){delete this[t]}}function xR(t,e){return function(){this[t]=e}}function wR(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function SR(t,e){return arguments.length>1?this.each((e==null?bR:typeof e=="function"?wR:xR)(t,e)):this.node()[t]}function gy(t){return t.trim().split(/^|\s+/)}function wd(t){return t.classList||new yy(t)}function yy(t){this._node=t,this._names=gy(t.getAttribute("class")||"")}yy.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function vy(t,e){for(var n=wd(t),i=-1,s=e.length;++i<s;)n.add(e[i])}function by(t,e){for(var n=wd(t),i=-1,s=e.length;++i<s;)n.remove(e[i])}function ER(t){return function(){vy(this,t)}}function CR(t){return function(){by(this,t)}}function TR(t,e){return function(){(e.apply(this,arguments)?vy:by)(this,t)}}function _R(t,e){var n=gy(t+"");if(arguments.length<2){for(var i=wd(this.node()),s=-1,a=n.length;++s<a;)if(!i.contains(n[s]))return!1;return!0}return this.each((typeof e=="function"?TR:e?ER:CR)(n,e))}function NR(){this.textContent=""}function AR(t){return function(){this.textContent=t}}function MR(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function RR(t){return arguments.length?this.each(t==null?NR:(typeof t=="function"?MR:AR)(t)):this.node().textContent}function kR(){this.innerHTML=""}function OR(t){return function(){this.innerHTML=t}}function DR(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function jR(t){return arguments.length?this.each(t==null?kR:(typeof t=="function"?DR:OR)(t)):this.node().innerHTML}function zR(){this.nextSibling&&this.parentNode.appendChild(this)}function VR(){return this.each(zR)}function LR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function IR(){return this.each(LR)}function BR(t){var e=typeof t=="function"?t:uy(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function PR(){return null}function HR(t,e){var n=typeof t=="function"?t:uy(t),i=e==null?PR:typeof e=="function"?e:xd(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function UR(){var t=this.parentNode;t&&t.removeChild(this)}function $R(){return this.each(UR)}function qR(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function YR(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function GR(t){return this.select(t?YR:qR)}function XR(t){return arguments.length?this.property("__data__",t):this.node().__data__}function FR(t){return function(e){t.call(this,e,this.__data__)}}function ZR(t){return t.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");return i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),{type:e,name:n}})}function KR(t){return function(){var e=this.__on;if(e){for(var n=0,i=-1,s=e.length,a;n<s;++n)a=e[n],(!t.type||a.type===t.type)&&a.name===t.name?this.removeEventListener(a.type,a.listener,a.options):e[++i]=a;++i?e.length=i:delete this.__on}}}function QR(t,e,n){return function(){var i=this.__on,s,a=FR(e);if(i){for(var c=0,u=i.length;c<u;++c)if((s=i[c]).type===t.type&&s.name===t.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=a,s.options=n),s.value=e;return}}this.addEventListener(t.type,a,n),s={type:t.type,name:t.name,value:e,listener:a,options:n},i?i.push(s):this.__on=[s]}}function WR(t,e,n){var i=ZR(t+""),s,a=i.length,c;if(arguments.length<2){var u=this.node().__on;if(u){for(var d=0,h=u.length,p;d<h;++d)for(s=0,p=u[d];s<a;++s)if((c=i[s]).type===p.type&&c.name===p.name)return p.value}return}for(u=e?QR:KR,s=0;s<a;++s)this.each(u(i[s],e,n));return this}function xy(t,e,n){var i=my(t),s=i.CustomEvent;typeof s=="function"?s=new s(e,n):(s=i.document.createEvent("Event"),n?(s.initEvent(e,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(e,!1,!1)),t.dispatchEvent(s)}function JR(t,e){return function(){return xy(this,t,e)}}function t3(t,e){return function(){return xy(this,t,e.apply(this,arguments))}}function e3(t,e){return this.each((typeof e=="function"?t3:JR)(t,e))}function*n3(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],s=0,a=i.length,c;s<a;++s)(c=i[s])&&(yield c)}var wy=[null];function fn(t,e){this._groups=t,this._parents=e}function ga(){return new fn([[document.documentElement]],wy)}function o3(){return this}fn.prototype=ga.prototype={constructor:fn,select:MM,selectAll:DM,selectChild:LM,selectChildren:HM,filter:UM,data:FM,enter:$M,exit:KM,join:QM,merge:WM,selection:o3,order:JM,sort:tR,call:nR,nodes:oR,node:iR,size:rR,empty:sR,each:aR,attr:pR,style:vR,property:SR,classed:_R,text:RR,html:jR,raise:VR,lower:IR,append:BR,insert:HR,remove:$R,clone:GR,datum:XR,on:WR,dispatch:e3,[Symbol.iterator]:n3};function dn(t){return typeof t=="string"?new fn([[document.querySelector(t)]],[document.documentElement]):new fn([[t]],wy)}function i3(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Hn(t,e){if(t=i3(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}if(e.getBoundingClientRect){var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}}return[t.pageX,t.pageY]}const r3={passive:!1},ya={capture:!0,passive:!1};function Sd(t){t.stopImmediatePropagation()}function es(t){t.preventDefault(),t.stopImmediatePropagation()}function Sy(t){var e=t.document.documentElement,n=dn(t).on("dragstart.drag",es,ya);"onselectstart"in e?n.on("selectstart.drag",es,ya):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Ey(t,e){var n=t.document.documentElement,i=dn(t).on("dragstart.drag",null);e&&(i.on("click.drag",es,ya),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const cc=t=>()=>t;function Ed(t,{sourceEvent:e,subject:n,target:i,identifier:s,active:a,x:c,y:u,dx:d,dy:h,dispatch:p}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:p}})}Ed.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function s3(t){return!t.ctrlKey&&!t.button}function a3(){return this.parentNode}function l3(t,e){return e??{x:t.x,y:t.y}}function c3(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cy(){var t=s3,e=a3,n=l3,i=c3,s={},a=rc("start","drag","end"),c=0,u,d,h,p,m=0;function y(C){C.on("mousedown.drag",b).filter(i).on("touchstart.drag",S).on("touchmove.drag",E,r3).on("touchend.drag touchcancel.drag",D).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function b(C,R){if(!(p||!t.call(this,C,R))){var A=T(this,e.call(this,C,R),C,R,"mouse");A&&(dn(C.view).on("mousemove.drag",x,ya).on("mouseup.drag",w,ya),Sy(C.view),Sd(C),h=!1,u=C.clientX,d=C.clientY,A("start",C))}}function x(C){if(es(C),!h){var R=C.clientX-u,A=C.clientY-d;h=R*R+A*A>m}s.mouse("drag",C)}function w(C){dn(C.view).on("mousemove.drag mouseup.drag",null),Ey(C.view,h),es(C),s.mouse("end",C)}function S(C,R){if(t.call(this,C,R)){var A=C.changedTouches,O=e.call(this,C,R),k=A.length,H,$;for(H=0;H<k;++H)($=T(this,O,C,R,A[H].identifier,A[H]))&&(Sd(C),$("start",C,A[H]))}}function E(C){var R=C.changedTouches,A=R.length,O,k;for(O=0;O<A;++O)(k=s[R[O].identifier])&&(es(C),k("drag",C,R[O]))}function D(C){var R=C.changedTouches,A=R.length,O,k;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),O=0;O<A;++O)(k=s[R[O].identifier])&&(Sd(C),k("end",C,R[O]))}function T(C,R,A,O,k,H){var $=a.copy(),q=Hn(H||A,R),F,Q,B;if((B=n.call(C,new Ed("beforestart",{sourceEvent:A,target:y,identifier:k,active:c,x:q[0],y:q[1],dx:0,dy:0,dispatch:$}),O))!=null)return F=B.x-q[0]||0,Q=B.y-q[1]||0,function P(j,I,z){var U=q,Y;switch(j){case"start":s[k]=P,Y=c++;break;case"end":delete s[k],--c;case"drag":q=Hn(z||I,R),Y=c;break}$.call(j,C,new Ed(j,{sourceEvent:I,subject:B,target:y,identifier:k,active:Y,x:q[0]+F,y:q[1]+Q,dx:q[0]-U[0],dy:q[1]-U[1],dispatch:$}),O)}}return y.filter=function(C){return arguments.length?(t=typeof C=="function"?C:cc(!!C),y):t},y.container=function(C){return arguments.length?(e=typeof C=="function"?C:cc(C),y):e},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:cc(C),y):n},y.touchable=function(C){return arguments.length?(i=typeof C=="function"?C:cc(!!C),y):i},y.on=function(){var C=a.on.apply(a,arguments);return C===a?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function Cd(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Ty(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function va(){}var ba=.7,uc=1/ba,ns="\\s*([+-]?\\d+)\\s*",xa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",co="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",u3=/^#([0-9a-f]{3,8})$/,f3=new RegExp(`^rgb\\(${ns},${ns},${ns}\\)$`),d3=new RegExp(`^rgb\\(${co},${co},${co}\\)$`),h3=new RegExp(`^rgba\\(${ns},${ns},${ns},${xa}\\)$`),p3=new RegExp(`^rgba\\(${co},${co},${co},${xa}\\)$`),m3=new RegExp(`^hsl\\(${xa},${co},${co}\\)$`),g3=new RegExp(`^hsla\\(${xa},${co},${co},${xa}\\)$`),_y={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};Cd(va,gr,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ny,formatHex:Ny,formatHex8:y3,formatHsl:v3,formatRgb:Ay,toString:Ay});function Ny(){return this.rgb().formatHex()}function y3(){return this.rgb().formatHex8()}function v3(){return Dy(this).formatHsl()}function Ay(){return this.rgb().formatRgb()}function gr(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=u3.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?My(e):n===3?new We(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?fc(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?fc(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=f3.exec(t))?new We(e[1],e[2],e[3],1):(e=d3.exec(t))?new We(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=h3.exec(t))?fc(e[1],e[2],e[3],e[4]):(e=p3.exec(t))?fc(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=m3.exec(t))?Oy(e[1],e[2]/100,e[3]/100,1):(e=g3.exec(t))?Oy(e[1],e[2]/100,e[3]/100,e[4]):_y.hasOwnProperty(t)?My(_y[t]):t==="transparent"?new We(NaN,NaN,NaN,0):null}function My(t){return new We(t>>16&255,t>>8&255,t&255,1)}function fc(t,e,n,i){return i<=0&&(t=e=n=NaN),new We(t,e,n,i)}function b3(t){return t instanceof va||(t=gr(t)),t?(t=t.rgb(),new We(t.r,t.g,t.b,t.opacity)):new We}function Td(t,e,n,i){return arguments.length===1?b3(t):new We(t,e,n,i??1)}function We(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}Cd(We,Td,Ty(va,{brighter(t){return t=t==null?uc:Math.pow(uc,t),new We(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ba:Math.pow(ba,t),new We(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new We(yr(this.r),yr(this.g),yr(this.b),dc(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:Ry,formatHex:Ry,formatHex8:x3,formatRgb:ky,toString:ky}));function Ry(){return`#${vr(this.r)}${vr(this.g)}${vr(this.b)}`}function x3(){return`#${vr(this.r)}${vr(this.g)}${vr(this.b)}${vr((isNaN(this.opacity)?1:this.opacity)*255)}`}function ky(){const t=dc(this.opacity);return`${t===1?"rgb(":"rgba("}${yr(this.r)}, ${yr(this.g)}, ${yr(this.b)}${t===1?")":`, ${t})`}`}function dc(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function yr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function vr(t){return t=yr(t),(t<16?"0":"")+t.toString(16)}function Oy(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Un(t,e,n,i)}function Dy(t){if(t instanceof Un)return new Un(t.h,t.s,t.l,t.opacity);if(t instanceof va||(t=gr(t)),!t)return new Un;if(t instanceof Un)return t;t=t.rgb();var e=t.r/255,n=t.g/255,i=t.b/255,s=Math.min(e,n,i),a=Math.max(e,n,i),c=NaN,u=a-s,d=(a+s)/2;return u?(e===a?c=(n-i)/u+(n<i)*6:n===a?c=(i-e)/u+2:c=(e-n)/u+4,u/=d<.5?a+s:2-a-s,c*=60):u=d>0&&d<1?0:c,new Un(c,u,d,t.opacity)}function w3(t,e,n,i){return arguments.length===1?Dy(t):new Un(t,e,n,i??1)}function Un(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}Cd(Un,w3,Ty(va,{brighter(t){return t=t==null?uc:Math.pow(uc,t),new Un(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ba:Math.pow(ba,t),new Un(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,s=2*n-i;return new We(_d(t>=240?t-240:t+120,s,i),_d(t,s,i),_d(t<120?t+240:t-120,s,i),this.opacity)},clamp(){return new Un(jy(this.h),hc(this.s),hc(this.l),dc(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 t=dc(this.opacity);return`${t===1?"hsl(":"hsla("}${jy(this.h)}, ${hc(this.s)*100}%, ${hc(this.l)*100}%${t===1?")":`, ${t})`}`}}));function jy(t){return t=(t||0)%360,t<0?t+360:t}function hc(t){return Math.max(0,Math.min(1,t||0))}function _d(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Nd=t=>()=>t;function S3(t,e){return function(n){return t+n*e}}function E3(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}function C3(t){return(t=+t)==1?zy:function(e,n){return n-e?E3(e,n,t):Nd(isNaN(e)?n:e)}}function zy(t,e){var n=e-t;return n?S3(t,n):Nd(isNaN(t)?e:t)}const pc=(function t(e){var n=C3(e);function i(s,a){var c=n((s=Td(s)).r,(a=Td(a)).r),u=n(s.g,a.g),d=n(s.b,a.b),h=zy(s.opacity,a.opacity);return function(p){return s.r=c(p),s.g=u(p),s.b=d(p),s.opacity=h(p),s+""}}return i.gamma=t,i})(1);function T3(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,i=e.slice(),s;return function(a){for(s=0;s<n;++s)i[s]=t[s]*(1-a)+e[s]*a;return i}}function _3(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function N3(t,e){var n=e?e.length:0,i=t?Math.min(n,t.length):0,s=new Array(i),a=new Array(n),c;for(c=0;c<i;++c)s[c]=wa(t[c],e[c]);for(;c<n;++c)a[c]=e[c];return function(u){for(c=0;c<i;++c)a[c]=s[c](u);return a}}function A3(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function uo(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function M3(t,e){var n={},i={},s;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(s in e)s in t?n[s]=wa(t[s],e[s]):i[s]=e[s];return function(a){for(s in n)i[s]=n[s](a);return i}}var Ad=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Md=new RegExp(Ad.source,"g");function R3(t){return function(){return t}}function k3(t){return function(e){return t(e)+""}}function Vy(t,e){var n=Ad.lastIndex=Md.lastIndex=0,i,s,a,c=-1,u=[],d=[];for(t=t+"",e=e+"";(i=Ad.exec(t))&&(s=Md.exec(e));)(a=s.index)>n&&(a=e.slice(n,a),u[c]?u[c]+=a:u[++c]=a),(i=i[0])===(s=s[0])?u[c]?u[c]+=s:u[++c]=s:(u[++c]=null,d.push({i:c,x:uo(i,s)})),n=Md.lastIndex;return n<e.length&&(a=e.slice(n),u[c]?u[c]+=a:u[++c]=a),u.length<2?d[0]?k3(d[0].x):R3(e):(e=d.length,function(h){for(var p=0,m;p<e;++p)u[(m=d[p]).i]=m.x(h);return u.join("")})}function wa(t,e){var n=typeof e,i;return e==null||n==="boolean"?Nd(e):(n==="number"?uo:n==="string"?(i=gr(e))?(e=i,pc):Vy:e instanceof gr?pc:e instanceof Date?A3:_3(e)?T3:Array.isArray(e)?N3:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?M3:uo)(t,e)}var Ly=180/Math.PI,Rd={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Iy(t,e,n,i,s,a){var c,u,d;return(c=Math.sqrt(t*t+e*e))&&(t/=c,e/=c),(d=t*n+e*i)&&(n-=t*d,i-=e*d),(u=Math.sqrt(n*n+i*i))&&(n/=u,i/=u,d/=u),t*i<e*n&&(t=-t,e=-e,d=-d,c=-c),{translateX:s,translateY:a,rotate:Math.atan2(e,t)*Ly,skewX:Math.atan(d)*Ly,scaleX:c,scaleY:u}}var mc;function O3(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Rd:Iy(e.a,e.b,e.c,e.d,e.e,e.f)}function D3(t){return t==null||(mc||(mc=document.createElementNS("http://www.w3.org/2000/svg","g")),mc.setAttribute("transform",t),!(t=mc.transform.baseVal.consolidate()))?Rd:(t=t.matrix,Iy(t.a,t.b,t.c,t.d,t.e,t.f))}function By(t,e,n,i){function s(h){return h.length?h.pop()+" ":""}function a(h,p,m,y,b,x){if(h!==m||p!==y){var w=b.push("translate(",null,e,null,n);x.push({i:w-4,x:uo(h,m)},{i:w-2,x:uo(p,y)})}else(m||y)&&b.push("translate("+m+e+y+n)}function c(h,p,m,y){h!==p?(h-p>180?p+=360:p-h>180&&(h+=360),y.push({i:m.push(s(m)+"rotate(",null,i)-2,x:uo(h,p)})):p&&m.push(s(m)+"rotate("+p+i)}function u(h,p,m,y){h!==p?y.push({i:m.push(s(m)+"skewX(",null,i)-2,x:uo(h,p)}):p&&m.push(s(m)+"skewX("+p+i)}function d(h,p,m,y,b,x){if(h!==m||p!==y){var w=b.push(s(b)+"scale(",null,",",null,")");x.push({i:w-4,x:uo(h,m)},{i:w-2,x:uo(p,y)})}else(m!==1||y!==1)&&b.push(s(b)+"scale("+m+","+y+")")}return function(h,p){var m=[],y=[];return h=t(h),p=t(p),a(h.translateX,h.translateY,p.translateX,p.translateY,m,y),c(h.rotate,p.rotate,m,y),u(h.skewX,p.skewX,m,y),d(h.scaleX,h.scaleY,p.scaleX,p.scaleY,m,y),h=p=null,function(b){for(var x=-1,w=y.length,S;++x<w;)m[(S=y[x]).i]=S.x(b);return m.join("")}}}var j3=By(O3,"px, ","px)","deg)"),z3=By(D3,", ",")",")"),V3=1e-12;function Py(t){return((t=Math.exp(t))+1/t)/2}function L3(t){return((t=Math.exp(t))-1/t)/2}function I3(t){return((t=Math.exp(2*t))-1)/(t+1)}const gc=(function t(e,n,i){function s(a,c){var u=a[0],d=a[1],h=a[2],p=c[0],m=c[1],y=c[2],b=p-u,x=m-d,w=b*b+x*x,S,E;if(w<V3)E=Math.log(y/h)/e,S=function(O){return[u+O*b,d+O*x,h*Math.exp(e*O*E)]};else{var D=Math.sqrt(w),T=(y*y-h*h+i*w)/(2*h*n*D),C=(y*y-h*h-i*w)/(2*y*n*D),R=Math.log(Math.sqrt(T*T+1)-T),A=Math.log(Math.sqrt(C*C+1)-C);E=(A-R)/e,S=function(O){var k=O*E,H=Py(R),$=h/(n*D)*(H*I3(e*k+R)-L3(R));return[u+$*b,d+$*x,h*H/Py(e*k+R)]}}return S.duration=E*1e3*e/Math.SQRT2,S}return s.rho=function(a){var c=Math.max(.001,+a),u=c*c,d=u*u;return t(c,u,d)},s})(Math.SQRT2,2,4);var os=0,Sa=0,Ea=0,Hy=1e3,yc,Ca,vc=0,br=0,bc=0,Ta=typeof performance=="object"&&performance.now?performance:Date,Uy=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function kd(){return br||(Uy(B3),br=Ta.now()+bc)}function B3(){br=0}function xc(){this._call=this._time=this._next=null}xc.prototype=$y.prototype={constructor:xc,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?kd():+n)+(e==null?0:+e),!this._next&&Ca!==this&&(Ca?Ca._next=this:yc=this,Ca=this),this._call=t,this._time=n,Od()},stop:function(){this._call&&(this._call=null,this._time=1/0,Od())}};function $y(t,e,n){var i=new xc;return i.restart(t,e,n),i}function P3(){kd(),++os;for(var t=yc,e;t;)(e=br-t._time)>=0&&t._call.call(void 0,e),t=t._next;--os}function qy(){br=(vc=Ta.now())+bc,os=Sa=0;try{P3()}finally{os=0,U3(),br=0}}function H3(){var t=Ta.now(),e=t-vc;e>Hy&&(bc-=e,vc=t)}function U3(){for(var t,e=yc,n,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:yc=n);Ca=t,Od(i)}function Od(t){if(!os){Sa&&(Sa=clearTimeout(Sa));var e=t-br;e>24?(t<1/0&&(Sa=setTimeout(qy,t-Ta.now()-bc)),Ea&&(Ea=clearInterval(Ea))):(Ea||(vc=Ta.now(),Ea=setInterval(H3,Hy)),os=1,Uy(qy))}}function Yy(t,e,n){var i=new xc;return e=e==null?0:+e,i.restart(s=>{i.stop(),t(s+e)},e,n),i}var $3=rc("start","end","cancel","interrupt"),q3=[],Gy=0,Xy=1,Dd=2,wc=3,Fy=4,jd=5,Sc=6;function Ec(t,e,n,i,s,a){var c=t.__transition;if(!c)t.__transition={};else if(n in c)return;Y3(t,n,{name:e,index:i,group:s,on:$3,tween:q3,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Gy})}function zd(t,e){var n=$n(t,e);if(n.state>Gy)throw new Error("too late; already scheduled");return n}function fo(t,e){var n=$n(t,e);if(n.state>wc)throw new Error("too late; already running");return n}function $n(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Y3(t,e,n){var i=t.__transition,s;i[e]=n,n.timer=$y(a,0,n.time);function a(h){n.state=Xy,n.timer.restart(c,n.delay,n.time),n.delay<=h&&c(h-n.delay)}function c(h){var p,m,y,b;if(n.state!==Xy)return d();for(p in i)if(b=i[p],b.name===n.name){if(b.state===wc)return Yy(c);b.state===Fy?(b.state=Sc,b.timer.stop(),b.on.call("interrupt",t,t.__data__,b.index,b.group),delete i[p]):+p<e&&(b.state=Sc,b.timer.stop(),b.on.call("cancel",t,t.__data__,b.index,b.group),delete i[p])}if(Yy(function(){n.state===wc&&(n.state=Fy,n.timer.restart(u,n.delay,n.time),u(h))}),n.state=Dd,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Dd){for(n.state=wc,s=new Array(y=n.tween.length),p=0,m=-1;p<y;++p)(b=n.tween[p].value.call(t,t.__data__,n.index,n.group))&&(s[++m]=b);s.length=m+1}}function u(h){for(var p=h<n.duration?n.ease.call(null,h/n.duration):(n.timer.restart(d),n.state=jd,1),m=-1,y=s.length;++m<y;)s[m].call(t,p);n.state===jd&&(n.on.call("end",t,t.__data__,n.index,n.group),d())}function d(){n.state=Sc,n.timer.stop(),delete i[e];for(var h in i)return;delete t.__transition}}function Cc(t,e){var n=t.__transition,i,s,a=!0,c;if(n){e=e==null?null:e+"";for(c in n){if((i=n[c]).name!==e){a=!1;continue}s=i.state>Dd&&i.state<jd,i.state=Sc,i.timer.stop(),i.on.call(s?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete n[c]}a&&delete t.__transition}}function G3(t){return this.each(function(){Cc(this,t)})}function X3(t,e){var n,i;return function(){var s=fo(this,t),a=s.tween;if(a!==n){i=n=a;for(var c=0,u=i.length;c<u;++c)if(i[c].name===e){i=i.slice(),i.splice(c,1);break}}s.tween=i}}function F3(t,e,n){var i,s;if(typeof n!="function")throw new Error;return function(){var a=fo(this,t),c=a.tween;if(c!==i){s=(i=c).slice();for(var u={name:e,value:n},d=0,h=s.length;d<h;++d)if(s[d].name===e){s[d]=u;break}d===h&&s.push(u)}a.tween=s}}function Z3(t,e){var n=this._id;if(t+="",arguments.length<2){for(var i=$n(this.node(),n).tween,s=0,a=i.length,c;s<a;++s)if((c=i[s]).name===t)return c.value;return null}return this.each((e==null?X3:F3)(n,t,e))}function Vd(t,e,n){var i=t._id;return t.each(function(){var s=fo(this,i);(s.value||(s.value={}))[e]=n.apply(this,arguments)}),function(s){return $n(s,i).value[e]}}function Zy(t,e){var n;return(typeof e=="number"?uo:e instanceof gr?pc:(n=gr(e))?(e=n,pc):Vy)(t,e)}function K3(t){return function(){this.removeAttribute(t)}}function Q3(t){return function(){this.removeAttributeNS(t.space,t.local)}}function W3(t,e,n){var i,s=n+"",a;return function(){var c=this.getAttribute(t);return c===s?null:c===i?a:a=e(i=c,n)}}function J3(t,e,n){var i,s=n+"",a;return function(){var c=this.getAttributeNS(t.space,t.local);return c===s?null:c===i?a:a=e(i=c,n)}}function tk(t,e,n){var i,s,a;return function(){var c,u=n(this),d;return u==null?void this.removeAttribute(t):(c=this.getAttribute(t),d=u+"",c===d?null:c===i&&d===s?a:(s=d,a=e(i=c,u)))}}function ek(t,e,n){var i,s,a;return function(){var c,u=n(this),d;return u==null?void this.removeAttributeNS(t.space,t.local):(c=this.getAttributeNS(t.space,t.local),d=u+"",c===d?null:c===i&&d===s?a:(s=d,a=e(i=c,u)))}}function nk(t,e){var n=ac(t),i=n==="transform"?z3:Zy;return this.attrTween(t,typeof e=="function"?(n.local?ek:tk)(n,i,Vd(this,"attr."+t,e)):e==null?(n.local?Q3:K3)(n):(n.local?J3:W3)(n,i,e))}function ok(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function ik(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function rk(t,e){var n,i;function s(){var a=e.apply(this,arguments);return a!==i&&(n=(i=a)&&ik(t,a)),n}return s._value=e,s}function sk(t,e){var n,i;function s(){var a=e.apply(this,arguments);return a!==i&&(n=(i=a)&&ok(t,a)),n}return s._value=e,s}function ak(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var i=ac(t);return this.tween(n,(i.local?rk:sk)(i,e))}function lk(t,e){return function(){zd(this,t).delay=+e.apply(this,arguments)}}function ck(t,e){return e=+e,function(){zd(this,t).delay=e}}function uk(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?lk:ck)(e,t)):$n(this.node(),e).delay}function fk(t,e){return function(){fo(this,t).duration=+e.apply(this,arguments)}}function dk(t,e){return e=+e,function(){fo(this,t).duration=e}}function hk(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?fk:dk)(e,t)):$n(this.node(),e).duration}function pk(t,e){if(typeof e!="function")throw new Error;return function(){fo(this,t).ease=e}}function mk(t){var e=this._id;return arguments.length?this.each(pk(e,t)):$n(this.node(),e).ease}function gk(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;fo(this,t).ease=n}}function yk(t){if(typeof t!="function")throw new Error;return this.each(gk(this._id,t))}function vk(t){typeof t!="function"&&(t=dy(t));for(var e=this._groups,n=e.length,i=new Array(n),s=0;s<n;++s)for(var a=e[s],c=a.length,u=i[s]=[],d,h=0;h<c;++h)(d=a[h])&&t.call(d,d.__data__,h,a)&&u.push(d);return new Ro(i,this._parents,this._name,this._id)}function bk(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,i=e.length,s=n.length,a=Math.min(i,s),c=new Array(i),u=0;u<a;++u)for(var d=e[u],h=n[u],p=d.length,m=c[u]=new Array(p),y,b=0;b<p;++b)(y=d[b]||h[b])&&(m[b]=y);for(;u<i;++u)c[u]=e[u];return new Ro(c,this._parents,this._name,this._id)}function xk(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function wk(t,e,n){var i,s,a=xk(e)?zd:fo;return function(){var c=a(this,t),u=c.on;u!==i&&(s=(i=u).copy()).on(e,n),c.on=s}}function Sk(t,e){var n=this._id;return arguments.length<2?$n(this.node(),n).on.on(t):this.each(wk(n,t,e))}function Ek(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Ck(){return this.on("end.remove",Ek(this._id))}function Tk(t){var e=this._name,n=this._id;typeof t!="function"&&(t=xd(t));for(var i=this._groups,s=i.length,a=new Array(s),c=0;c<s;++c)for(var u=i[c],d=u.length,h=a[c]=new Array(d),p,m,y=0;y<d;++y)(p=u[y])&&(m=t.call(p,p.__data__,y,u))&&("__data__"in p&&(m.__data__=p.__data__),h[y]=m,Ec(h[y],e,n,y,h,$n(p,n)));return new Ro(a,this._parents,e,n)}function _k(t){var e=this._name,n=this._id;typeof t!="function"&&(t=fy(t));for(var i=this._groups,s=i.length,a=[],c=[],u=0;u<s;++u)for(var d=i[u],h=d.length,p,m=0;m<h;++m)if(p=d[m]){for(var y=t.call(p,p.__data__,m,d),b,x=$n(p,n),w=0,S=y.length;w<S;++w)(b=y[w])&&Ec(b,e,n,w,y,x);a.push(y),c.push(p)}return new Ro(a,c,e,n)}var Nk=ga.prototype.constructor;function Ak(){return new Nk(this._groups,this._parents)}function Mk(t,e){var n,i,s;return function(){var a=ts(this,t),c=(this.style.removeProperty(t),ts(this,t));return a===c?null:a===n&&c===i?s:s=e(n=a,i=c)}}function Ky(t){return function(){this.style.removeProperty(t)}}function Rk(t,e,n){var i,s=n+"",a;return function(){var c=ts(this,t);return c===s?null:c===i?a:a=e(i=c,n)}}function kk(t,e,n){var i,s,a;return function(){var c=ts(this,t),u=n(this),d=u+"";return u==null&&(d=u=(this.style.removeProperty(t),ts(this,t))),c===d?null:c===i&&d===s?a:(s=d,a=e(i=c,u))}}function Ok(t,e){var n,i,s,a="style."+e,c="end."+a,u;return function(){var d=fo(this,t),h=d.on,p=d.value[a]==null?u||(u=Ky(e)):void 0;(h!==n||s!==p)&&(i=(n=h).copy()).on(c,s=p),d.on=i}}function Dk(t,e,n){var i=(t+="")=="transform"?j3:Zy;return e==null?this.styleTween(t,Mk(t,i)).on("end.style."+t,Ky(t)):typeof e=="function"?this.styleTween(t,kk(t,i,Vd(this,"style."+t,e))).each(Ok(this._id,t)):this.styleTween(t,Rk(t,i,e),n).on("end.style."+t,null)}function jk(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function zk(t,e,n){var i,s;function a(){var c=e.apply(this,arguments);return c!==s&&(i=(s=c)&&jk(t,c,n)),i}return a._value=e,a}function Vk(t,e,n){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(e==null)return this.tween(i,null);if(typeof e!="function")throw new Error;return this.tween(i,zk(t,e,n??""))}function Lk(t){return function(){this.textContent=t}}function Ik(t){return function(){var e=t(this);this.textContent=e??""}}function Bk(t){return this.tween("text",typeof t=="function"?Ik(Vd(this,"text",t)):Lk(t==null?"":t+""))}function Pk(t){return function(e){this.textContent=t.call(this,e)}}function Hk(t){var e,n;function i(){var s=t.apply(this,arguments);return s!==n&&(e=(n=s)&&Pk(s)),e}return i._value=t,i}function Uk(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Hk(t))}function $k(){for(var t=this._name,e=this._id,n=Qy(),i=this._groups,s=i.length,a=0;a<s;++a)for(var c=i[a],u=c.length,d,h=0;h<u;++h)if(d=c[h]){var p=$n(d,e);Ec(d,t,n,h,c,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new Ro(i,this._parents,t,n)}function qk(){var t,e,n=this,i=n._id,s=n.size();return new Promise(function(a,c){var u={value:c},d={value:function(){--s===0&&a()}};n.each(function(){var h=fo(this,i),p=h.on;p!==t&&(e=(t=p).copy(),e._.cancel.push(u),e._.interrupt.push(u),e._.end.push(d)),h.on=e}),s===0&&a()})}var Yk=0;function Ro(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function Qy(){return++Yk}var ko=ga.prototype;Ro.prototype={constructor:Ro,select:Tk,selectAll:_k,selectChild:ko.selectChild,selectChildren:ko.selectChildren,filter:vk,merge:bk,selection:Ak,transition:$k,call:ko.call,nodes:ko.nodes,node:ko.node,size:ko.size,empty:ko.empty,each:ko.each,on:Sk,attr:nk,attrTween:ak,style:Dk,styleTween:Vk,text:Bk,textTween:Uk,remove:Ck,tween:Z3,delay:uk,duration:hk,ease:mk,easeVarying:yk,end:qk,[Symbol.iterator]:ko[Symbol.iterator]};function Gk(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Xk={time:null,delay:0,duration:250,ease:Gk};function Fk(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Zk(t){var e,n;t instanceof Ro?(e=t._id,t=t._name):(e=Qy(),(n=Xk).time=kd(),t=t==null?null:t+"");for(var i=this._groups,s=i.length,a=0;a<s;++a)for(var c=i[a],u=c.length,d,h=0;h<u;++h)(d=c[h])&&Ec(d,t,e,h,c,n||Fk(d,e));return new Ro(i,this._parents,t,e)}ga.prototype.interrupt=G3,ga.prototype.transition=Zk;const Tc=t=>()=>t;function Kk(t,{sourceEvent:e,target:n,transform:i,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:s}})}function Oo(t,e,n){this.k=t,this.x=e,this.y=n}Oo.prototype={constructor:Oo,scale:function(t){return t===1?this:new Oo(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Oo(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var _c=new Oo(1,0,0);Wy.prototype=Oo.prototype;function Wy(t){for(;!t.__zoom;)if(!(t=t.parentNode))return _c;return t.__zoom}function Ld(t){t.stopImmediatePropagation()}function _a(t){t.preventDefault(),t.stopImmediatePropagation()}function Qk(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Wk(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Jy(){return this.__zoom||_c}function Jk(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function tO(){return navigator.maxTouchPoints||"ontouchstart"in this}function eO(t,e,n){var i=t.invertX(e[0][0])-n[0][0],s=t.invertX(e[1][0])-n[1][0],a=t.invertY(e[0][1])-n[0][1],c=t.invertY(e[1][1])-n[1][1];return t.translate(s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s),c>a?(a+c)/2:Math.min(0,a)||Math.max(0,c))}function tv(){var t=Qk,e=Wk,n=eO,i=Jk,s=tO,a=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,d=gc,h=rc("start","zoom","end"),p,m,y,b=500,x=150,w=0,S=10;function E(B){B.property("__zoom",Jy).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",H).on("dblclick.zoom",$).filter(s).on("touchstart.zoom",q).on("touchmove.zoom",F).on("touchend.zoom touchcancel.zoom",Q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(B,P,j,I){var z=B.selection?B.selection():B;z.property("__zoom",Jy),B!==z?R(B,P,j,I):z.interrupt().each(function(){A(this,arguments).event(I).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},E.scaleBy=function(B,P,j,I){E.scaleTo(B,function(){var z=this.__zoom.k,U=typeof P=="function"?P.apply(this,arguments):P;return z*U},j,I)},E.scaleTo=function(B,P,j,I){E.transform(B,function(){var z=e.apply(this,arguments),U=this.__zoom,Y=j==null?C(z):typeof j=="function"?j.apply(this,arguments):j,L=U.invert(Y),G=typeof P=="function"?P.apply(this,arguments):P;return n(T(D(U,G),Y,L),z,c)},j,I)},E.translateBy=function(B,P,j,I){E.transform(B,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof j=="function"?j.apply(this,arguments):j),e.apply(this,arguments),c)},null,I)},E.translateTo=function(B,P,j,I,z){E.transform(B,function(){var U=e.apply(this,arguments),Y=this.__zoom,L=I==null?C(U):typeof I=="function"?I.apply(this,arguments):I;return n(_c.translate(L[0],L[1]).scale(Y.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof j=="function"?-j.apply(this,arguments):-j),U,c)},I,z)};function D(B,P){return P=Math.max(a[0],Math.min(a[1],P)),P===B.k?B:new Oo(P,B.x,B.y)}function T(B,P,j){var I=P[0]-j[0]*B.k,z=P[1]-j[1]*B.k;return I===B.x&&z===B.y?B:new Oo(B.k,I,z)}function C(B){return[(+B[0][0]+ +B[1][0])/2,(+B[0][1]+ +B[1][1])/2]}function R(B,P,j,I){B.on("start.zoom",function(){A(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(I).end()}).tween("zoom",function(){var z=this,U=arguments,Y=A(z,U).event(I),L=e.apply(z,U),G=j==null?C(L):typeof j=="function"?j.apply(z,U):j,tt=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),it=z.__zoom,lt=typeof P=="function"?P.apply(z,U):P,ht=d(it.invert(G).concat(tt/it.k),lt.invert(G).concat(tt/lt.k));return function(ft){if(ft===1)ft=lt;else{var ut=ht(ft),dt=tt/ut[2];ft=new Oo(dt,G[0]-ut[0]*dt,G[1]-ut[1]*dt)}Y.zoom(null,ft)}})}function A(B,P,j){return!j&&B.__zooming||new O(B,P)}function O(B,P){this.that=B,this.args=P,this.active=0,this.sourceEvent=null,this.extent=e.apply(B,P),this.taps=0}O.prototype={event:function(B){return B&&(this.sourceEvent=B),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(B,P){return this.mouse&&B!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&B!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&B!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(B){var P=dn(this.that).datum();h.call(B,this.that,new Kk(B,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:h}),P)}};function k(B,...P){if(!t.apply(this,arguments))return;var j=A(this,P).event(B),I=this.__zoom,z=Math.max(a[0],Math.min(a[1],I.k*Math.pow(2,i.apply(this,arguments)))),U=Hn(B);if(j.wheel)(j.mouse[0][0]!==U[0]||j.mouse[0][1]!==U[1])&&(j.mouse[1]=I.invert(j.mouse[0]=U)),clearTimeout(j.wheel);else{if(I.k===z)return;j.mouse=[U,I.invert(U)],Cc(this),j.start()}_a(B),j.wheel=setTimeout(Y,x),j.zoom("mouse",n(T(D(I,z),j.mouse[0],j.mouse[1]),j.extent,c));function Y(){j.wheel=null,j.end()}}function H(B,...P){if(y||!t.apply(this,arguments))return;var j=B.currentTarget,I=A(this,P,!0).event(B),z=dn(B.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",tt,!0),U=Hn(B,j),Y=B.clientX,L=B.clientY;Sy(B.view),Ld(B),I.mouse=[U,this.__zoom.invert(U)],Cc(this),I.start();function G(it){if(_a(it),!I.moved){var lt=it.clientX-Y,ht=it.clientY-L;I.moved=lt*lt+ht*ht>w}I.event(it).zoom("mouse",n(T(I.that.__zoom,I.mouse[0]=Hn(it,j),I.mouse[1]),I.extent,c))}function tt(it){z.on("mousemove.zoom mouseup.zoom",null),Ey(it.view,I.moved),_a(it),I.event(it).end()}}function $(B,...P){if(t.apply(this,arguments)){var j=this.__zoom,I=Hn(B.changedTouches?B.changedTouches[0]:B,this),z=j.invert(I),U=j.k*(B.shiftKey?.5:2),Y=n(T(D(j,U),I,z),e.apply(this,P),c);_a(B),u>0?dn(this).transition().duration(u).call(R,Y,I,B):dn(this).call(E.transform,Y,I,B)}}function q(B,...P){if(t.apply(this,arguments)){var j=B.touches,I=j.length,z=A(this,P,B.changedTouches.length===I).event(B),U,Y,L,G;for(Ld(B),Y=0;Y<I;++Y)L=j[Y],G=Hn(L,this),G=[G,this.__zoom.invert(G),L.identifier],z.touch0?!z.touch1&&z.touch0[2]!==G[2]&&(z.touch1=G,z.taps=0):(z.touch0=G,U=!0,z.taps=1+!!p);p&&(p=clearTimeout(p)),U&&(z.taps<2&&(m=G[0],p=setTimeout(function(){p=null},b)),Cc(this),z.start())}}function F(B,...P){if(this.__zooming){var j=A(this,P).event(B),I=B.changedTouches,z=I.length,U,Y,L,G;for(_a(B),U=0;U<z;++U)Y=I[U],L=Hn(Y,this),j.touch0&&j.touch0[2]===Y.identifier?j.touch0[0]=L:j.touch1&&j.touch1[2]===Y.identifier&&(j.touch1[0]=L);if(Y=j.that.__zoom,j.touch1){var tt=j.touch0[0],it=j.touch0[1],lt=j.touch1[0],ht=j.touch1[1],ft=(ft=lt[0]-tt[0])*ft+(ft=lt[1]-tt[1])*ft,ut=(ut=ht[0]-it[0])*ut+(ut=ht[1]-it[1])*ut;Y=D(Y,Math.sqrt(ft/ut)),L=[(tt[0]+lt[0])/2,(tt[1]+lt[1])/2],G=[(it[0]+ht[0])/2,(it[1]+ht[1])/2]}else if(j.touch0)L=j.touch0[0],G=j.touch0[1];else return;j.zoom("touch",n(T(Y,L,G),j.extent,c))}}function Q(B,...P){if(this.__zooming){var j=A(this,P).event(B),I=B.changedTouches,z=I.length,U,Y;for(Ld(B),y&&clearTimeout(y),y=setTimeout(function(){y=null},b),U=0;U<z;++U)Y=I[U],j.touch0&&j.touch0[2]===Y.identifier?delete j.touch0:j.touch1&&j.touch1[2]===Y.identifier&&delete j.touch1;if(j.touch1&&!j.touch0&&(j.touch0=j.touch1,delete j.touch1),j.touch0)j.touch0[1]=this.__zoom.invert(j.touch0[0]);else if(j.end(),j.taps===2&&(Y=Hn(Y,this),Math.hypot(m[0]-Y[0],m[1]-Y[1])<S)){var L=dn(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return E.wheelDelta=function(B){return arguments.length?(i=typeof B=="function"?B:Tc(+B),E):i},E.filter=function(B){return arguments.length?(t=typeof B=="function"?B:Tc(!!B),E):t},E.touchable=function(B){return arguments.length?(s=typeof B=="function"?B:Tc(!!B),E):s},E.extent=function(B){return arguments.length?(e=typeof B=="function"?B:Tc([[+B[0][0],+B[0][1]],[+B[1][0],+B[1][1]]]),E):e},E.scaleExtent=function(B){return arguments.length?(a[0]=+B[0],a[1]=+B[1],E):[a[0],a[1]]},E.translateExtent=function(B){return arguments.length?(c[0][0]=+B[0][0],c[1][0]=+B[1][0],c[0][1]=+B[0][1],c[1][1]=+B[1][1],E):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},E.constrain=function(B){return arguments.length?(n=B,E):n},E.duration=function(B){return arguments.length?(u=+B,E):u},E.interpolate=function(B){return arguments.length?(d=B,E):d},E.on=function(){var B=h.on.apply(h,arguments);return B===h?E:B},E.clickDistance=function(B){return arguments.length?(w=(B=+B)*B,E):Math.sqrt(w)},E.tapDistance=function(B){return arguments.length?(S=+B,E):S},E}const ho={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:t=>`Node type "${t}" 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:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:i})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:i}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/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."},Na=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ev=["Enter"," ","Escape"],nv={"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:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"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 is;(function(t){t.Strict="strict",t.Loose="loose"})(is||(is={}));var xr;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(xr||(xr={}));var Aa;(function(t){t.Partial="partial",t.Full="full"})(Aa||(Aa={}));const ov={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var fi;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(fi||(fi={}));var Nc;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Nc||(Nc={}));var At;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(At||(At={}));const iv={[At.Left]:At.Right,[At.Right]:At.Left,[At.Top]:At.Bottom,[At.Bottom]:At.Top};function rv(t){return t===null?null:t?"valid":"invalid"}const sv=t=>"id"in t&&"source"in t&&"target"in t,nO=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),Id=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),Ma=(t,e=[0,0])=>{const{width:n,height:i}=Do(t),s=t.origin??e,a=n*s[0],c=i*s[1];return{x:t.position.x-a,y:t.position.y-c}},oO=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((i,s)=>{const a=typeof s=="string";let c=!e.nodeLookup&&!a?s:void 0;e.nodeLookup&&(c=a?e.nodeLookup.get(s):Id(s)?s:e.nodeLookup.get(s.id));const u=c?Rc(c,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ac(i,u)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Mc(n)},Ra=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return t.forEach(s=>{(e.filter===void 0||e.filter(s))&&(n=Ac(n,Rc(s)),i=!0)}),i?Mc(n):{x:0,y:0,width:0,height:0}},Bd=(t,e,[n,i,s]=[0,0,1],a=!1,c=!1)=>{const u={...Da(e,[n,i,s]),width:e.width/s,height:e.height/s},d=[];for(const h of t.values()){const{measured:p,selectable:m=!0,hidden:y=!1}=h;if(c&&!m||y)continue;const b=p.width??h.width??h.initialWidth??null,x=p.height??h.height??h.initialHeight??null,w=ka(u,ss(h)),S=(b??0)*(x??0),E=a&&w>0;(!h.internals.handleBounds||E||w>=S||h.dragging)&&d.push(h)}return d},iO=(t,e)=>{const n=new Set;return t.forEach(i=>{n.add(i.id)}),e.filter(i=>n.has(i.source)||n.has(i.target))};function rO(t,e){const n=new Map,i=e?.nodes?new Set(e.nodes.map(s=>s.id)):null;return t.forEach(s=>{s.measured.width&&s.measured.height&&(e?.includeHiddenNodes||!s.hidden)&&(!i||i.has(s.id))&&n.set(s.id,s)}),n}async function sO({nodes:t,width:e,height:n,panZoom:i,minZoom:s,maxZoom:a},c){if(t.size===0)return Promise.resolve(!0);const u=rO(t,c),d=Ra(u),h=Hd(d,e,n,c?.minZoom??s,c?.maxZoom??a,c?.padding??.1);return await i.setViewport(h,{duration:c?.duration,ease:c?.ease,interpolate:c?.interpolate}),Promise.resolve(!0)}function av({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:i=[0,0],nodeExtent:s,onError:a}){const c=n.get(t),u=c.parentId?n.get(c.parentId):void 0,{x:d,y:h}=u?u.internals.positionAbsolute:{x:0,y:0},p=c.origin??i;let m=c.extent||s;if(c.extent==="parent"&&!c.expandParent)if(!u)a?.("005",ho.error005());else{const b=u.measured.width,x=u.measured.height;b&&x&&(m=[[d,h],[d+b,h+x]])}else u&&ls(c.extent)&&(m=[[c.extent[0][0]+d,c.extent[0][1]+h],[c.extent[1][0]+d,c.extent[1][1]+h]]);const y=ls(m)?wr(e,m,c.measured):e;return(c.measured.width===void 0||c.measured.height===void 0)&&a?.("015",ho.error015()),{position:{x:y.x-d+(c.measured.width??0)*p[0],y:y.y-h+(c.measured.height??0)*p[1]},positionAbsolute:y}}async function aO({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:i,onBeforeDelete:s}){const a=new Set(t.map(y=>y.id)),c=[];for(const y of n){if(y.deletable===!1)continue;const b=a.has(y.id),x=!b&&y.parentId&&c.find(w=>w.id===y.parentId);(b||x)&&c.push(y)}const u=new Set(e.map(y=>y.id)),d=i.filter(y=>y.deletable!==!1),p=iO(c,d);for(const y of d)u.has(y.id)&&!p.find(x=>x.id===y.id)&&p.push(y);if(!s)return{edges:p,nodes:c};const m=await s({nodes:c,edges:p});return typeof m=="boolean"?m?{edges:p,nodes:c}:{edges:[],nodes:[]}:m}const rs=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),wr=(t={x:0,y:0},e,n)=>({x:rs(t.x,e[0][0],e[1][0]-(n?.width??0)),y:rs(t.y,e[0][1],e[1][1]-(n?.height??0))});function lv(t,e,n){const{width:i,height:s}=Do(n),{x:a,y:c}=n.internals.positionAbsolute;return wr(t,[[a,c],[a+i,c+s]],e)}const cv=(t,e,n)=>t<e?rs(Math.abs(t-e),1,e)/e:t>n?-rs(Math.abs(t-n),1,e)/e:0,uv=(t,e,n=15,i=40)=>{const s=cv(t.x,i,e.width-i)*n,a=cv(t.y,i,e.height-i)*n;return[s,a]},Ac=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),Pd=({x:t,y:e,width:n,height:i})=>({x:t,y:e,x2:t+n,y2:e+i}),Mc=({x:t,y:e,x2:n,y2:i})=>({x:t,y:e,width:n-t,height:i-e}),ss=(t,e=[0,0])=>{const{x:n,y:i}=Id(t)?t.internals.positionAbsolute:Ma(t,e);return{x:n,y:i,width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}},Rc=(t,e=[0,0])=>{const{x:n,y:i}=Id(t)?t.internals.positionAbsolute:Ma(t,e);return{x:n,y:i,x2:n+(t.measured?.width??t.width??t.initialWidth??0),y2:i+(t.measured?.height??t.height??t.initialHeight??0)}},fv=(t,e)=>Mc(Ac(Pd(t),Pd(e))),ka=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),i=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*i)},dv=t=>qn(t.width)&&qn(t.height)&&qn(t.x)&&qn(t.y),qn=t=>!isNaN(t)&&isFinite(t),lO=(t,e)=>{},Oa=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),Da=({x:t,y:e},[n,i,s],a=!1,c=[1,1])=>{const u={x:(t-n)/s,y:(e-i)/s};return a?Oa(u,c):u},kc=({x:t,y:e},[n,i,s])=>({x:t*s+n,y:e*s+i});function as(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function cO(t,e,n){if(typeof t=="string"||typeof t=="number"){const i=as(t,n),s=as(t,e);return{top:i,right:s,bottom:i,left:s,x:s*2,y:i*2}}if(typeof t=="object"){const i=as(t.top??t.y??0,n),s=as(t.bottom??t.y??0,n),a=as(t.left??t.x??0,e),c=as(t.right??t.x??0,e);return{top:i,right:c,bottom:s,left:a,x:a+c,y:i+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function uO(t,e,n,i,s,a){const{x:c,y:u}=kc(t,[e,n,i]),{x:d,y:h}=kc({x:t.x+t.width,y:t.y+t.height},[e,n,i]),p=s-d,m=a-h;return{left:Math.floor(c),top:Math.floor(u),right:Math.floor(p),bottom:Math.floor(m)}}const Hd=(t,e,n,i,s,a)=>{const c=cO(a,e,n),u=(e-c.x)/t.width,d=(n-c.y)/t.height,h=Math.min(u,d),p=rs(h,i,s),m=t.x+t.width/2,y=t.y+t.height/2,b=e/2-m*p,x=n/2-y*p,w=uO(t,b,x,p,e,n),S={left:Math.min(w.left-c.left,0),top:Math.min(w.top-c.top,0),right:Math.min(w.right-c.right,0),bottom:Math.min(w.bottom-c.bottom,0)};return{x:b-S.left+S.right,y:x-S.top+S.bottom,zoom:p}},ja=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function ls(t){return t!=null&&t!=="parent"}function Do(t){return{width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}}function hv(t){return(t.measured?.width??t.width??t.initialWidth)!==void 0&&(t.measured?.height??t.height??t.initialHeight)!==void 0}function pv(t,e={width:0,height:0},n,i,s){const a={...t},c=i.get(n);if(c){const u=c.origin||s;a.x+=c.internals.positionAbsolute.x-(e.width??0)*u[0],a.y+=c.internals.positionAbsolute.y-(e.height??0)*u[1]}return a}function mv(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function fO(){let t,e;return{promise:new Promise((i,s)=>{t=i,e=s}),resolve:t,reject:e}}function dO(t){return{...nv,...t||{}}}function za(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:i,containerBounds:s}){const{x:a,y:c}=Yn(t),u=Da({x:a-(s?.left??0),y:c-(s?.top??0)},i),{x:d,y:h}=n?Oa(u,e):u;return{xSnapped:d,ySnapped:h,...u}}const Ud=t=>({width:t.offsetWidth,height:t.offsetHeight}),gv=t=>t?.getRootNode?.()||window?.document,hO=["INPUT","SELECT","TEXTAREA"];function yv(t){const e=t.composedPath?.()?.[0]||t.target;return e?.nodeType!==1?!1:hO.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const vv=t=>"clientX"in t,Yn=(t,e)=>{const n=vv(t),i=n?t.clientX:t.touches?.[0].clientX,s=n?t.clientY:t.touches?.[0].clientY;return{x:i-(e?.left??0),y:s-(e?.top??0)}},bv=(t,e,n,i,s)=>{const a=e.querySelectorAll(`.${t}`);return!a||!a.length?null:Array.from(a).map(c=>{const u=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),type:t,nodeId:s,position:c.getAttribute("data-handlepos"),x:(u.left-n.left)/i,y:(u.top-n.top)/i,...Ud(c)}})};function xv({sourceX:t,sourceY:e,targetX:n,targetY:i,sourceControlX:s,sourceControlY:a,targetControlX:c,targetControlY:u}){const d=t*.125+s*.375+c*.375+n*.125,h=e*.125+a*.375+u*.375+i*.125,p=Math.abs(d-t),m=Math.abs(h-e);return[d,h,p,m]}function Oc(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function wv({pos:t,x1:e,y1:n,x2:i,y2:s,c:a}){switch(t){case At.Left:return[e-Oc(e-i,a),n];case At.Right:return[e+Oc(i-e,a),n];case At.Top:return[e,n-Oc(n-s,a)];case At.Bottom:return[e,n+Oc(s-n,a)]}}function Sv({sourceX:t,sourceY:e,sourcePosition:n=At.Bottom,targetX:i,targetY:s,targetPosition:a=At.Top,curvature:c=.25}){const[u,d]=wv({pos:n,x1:t,y1:e,x2:i,y2:s,c}),[h,p]=wv({pos:a,x1:i,y1:s,x2:t,y2:e,c}),[m,y,b,x]=xv({sourceX:t,sourceY:e,targetX:i,targetY:s,sourceControlX:u,sourceControlY:d,targetControlX:h,targetControlY:p});return[`M${t},${e} C${u},${d} ${h},${p} ${i},${s}`,m,y,b,x]}function Ev({sourceX:t,sourceY:e,targetX:n,targetY:i}){const s=Math.abs(n-t)/2,a=n<t?n+s:n-s,c=Math.abs(i-e)/2,u=i<e?i+c:i-c;return[a,u,s,c]}function pO({sourceNode:t,targetNode:e,selected:n=!1,zIndex:i=0,elevateOnSelect:s=!1,zIndexMode:a="basic"}){if(a==="manual")return i;const c=s&&n?i+1e3:i,u=Math.max(t.parentId||s&&t.selected?t.internals.z:0,e.parentId||s&&e.selected?e.internals.z:0);return c+u}function mO({sourceNode:t,targetNode:e,width:n,height:i,transform:s}){const a=Ac(Rc(t),Rc(e));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const c={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:i/s[2]};return ka(c,Mc(a))>0}const gO=({source:t,sourceHandle:e,target:n,targetHandle:i})=>`xy-edge__${t}${e||""}-${n}${i||""}`,yO=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),vO=(t,e,n={})=>{if(!t.source||!t.target)return e;const i=n.getEdgeId||gO;let s;return sv(t)?s={...t}:s={...t,id:i(t)},yO(s,e)?e:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,e.concat(s))};function Cv({sourceX:t,sourceY:e,targetX:n,targetY:i}){const[s,a,c,u]=Ev({sourceX:t,sourceY:e,targetX:n,targetY:i});return[`M ${t},${e}L ${n},${i}`,s,a,c,u]}const Tv={[At.Left]:{x:-1,y:0},[At.Right]:{x:1,y:0},[At.Top]:{x:0,y:-1},[At.Bottom]:{x:0,y:1}},bO=({source:t,sourcePosition:e=At.Bottom,target:n})=>e===At.Left||e===At.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},_v=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function xO({source:t,sourcePosition:e=At.Bottom,target:n,targetPosition:i=At.Top,center:s,offset:a,stepPosition:c}){const u=Tv[e],d=Tv[i],h={x:t.x+u.x*a,y:t.y+u.y*a},p={x:n.x+d.x*a,y:n.y+d.y*a},m=bO({source:h,sourcePosition:e,target:p}),y=m.x!==0?"x":"y",b=m[y];let x=[],w,S;const E={x:0,y:0},D={x:0,y:0},[,,T,C]=Ev({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(u[y]*d[y]===-1){y==="x"?(w=s.x??h.x+(p.x-h.x)*c,S=s.y??(h.y+p.y)/2):(w=s.x??(h.x+p.x)/2,S=s.y??h.y+(p.y-h.y)*c);const A=[{x:w,y:h.y},{x:w,y:p.y}],O=[{x:h.x,y:S},{x:p.x,y:S}];u[y]===b?x=y==="x"?A:O:x=y==="x"?O:A}else{const A=[{x:h.x,y:p.y}],O=[{x:p.x,y:h.y}];if(y==="x"?x=u.x===b?O:A:x=u.y===b?A:O,e===i){const F=Math.abs(t[y]-n[y]);if(F<=a){const Q=Math.min(a-1,a-F);u[y]===b?E[y]=(h[y]>t[y]?-1:1)*Q:D[y]=(p[y]>n[y]?-1:1)*Q}}if(e!==i){const F=y==="x"?"y":"x",Q=u[y]===d[F],B=h[F]>p[F],P=h[F]<p[F];(u[y]===1&&(!Q&&B||Q&&P)||u[y]!==1&&(!Q&&P||Q&&B))&&(x=y==="x"?A:O)}const k={x:h.x+E.x,y:h.y+E.y},H={x:p.x+D.x,y:p.y+D.y},$=Math.max(Math.abs(k.x-x[0].x),Math.abs(H.x-x[0].x)),q=Math.max(Math.abs(k.y-x[0].y),Math.abs(H.y-x[0].y));$>=q?(w=(k.x+H.x)/2,S=x[0].y):(w=x[0].x,S=(k.y+H.y)/2)}return[[t,{x:h.x+E.x,y:h.y+E.y},...x,{x:p.x+D.x,y:p.y+D.y},n],w,S,T,C]}function wO(t,e,n,i){const s=Math.min(_v(t,e)/2,_v(e,n)/2,i),{x:a,y:c}=e;if(t.x===a&&a===n.x||t.y===c&&c===n.y)return`L${a} ${c}`;if(t.y===c){const h=t.x<n.x?-1:1,p=t.y<n.y?1:-1;return`L ${a+s*h},${c}Q ${a},${c} ${a},${c+s*p}`}const u=t.x<n.x?1:-1,d=t.y<n.y?-1:1;return`L ${a},${c+s*d}Q ${a},${c} ${a+s*u},${c}`}function $d({sourceX:t,sourceY:e,sourcePosition:n=At.Bottom,targetX:i,targetY:s,targetPosition:a=At.Top,borderRadius:c=5,centerX:u,centerY:d,offset:h=20,stepPosition:p=.5}){const[m,y,b,x,w]=xO({source:{x:t,y:e},sourcePosition:n,target:{x:i,y:s},targetPosition:a,center:{x:u,y:d},offset:h,stepPosition:p});return[m.reduce((E,D,T)=>{let C="";return T>0&&T<m.length-1?C=wO(m[T-1],D,m[T+1],c):C=`${T===0?"M":"L"}${D.x} ${D.y}`,E+=C,E},""),y,b,x,w]}function Nv(t){return t&&!!(t.internals.handleBounds||t.handles?.length)&&!!(t.measured.width||t.width||t.initialWidth)}function SO(t){const{sourceNode:e,targetNode:n}=t;if(!Nv(e)||!Nv(n))return null;const i=e.internals.handleBounds||Av(e.handles),s=n.internals.handleBounds||Av(n.handles),a=Mv(i?.source??[],t.sourceHandle),c=Mv(t.connectionMode===is.Strict?s?.target??[]:(s?.target??[]).concat(s?.source??[]),t.targetHandle);if(!a||!c)return t.onError?.("008",ho.error008(a?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const u=a?.position||At.Bottom,d=c?.position||At.Top,h=Sr(e,a,u),p=Sr(n,c,d);return{sourceX:h.x,sourceY:h.y,targetX:p.x,targetY:p.y,sourcePosition:u,targetPosition:d}}function Av(t){if(!t)return null;const e=[],n=[];for(const i of t)i.width=i.width??1,i.height=i.height??1,i.type==="source"?e.push(i):i.type==="target"&&n.push(i);return{source:e,target:n}}function Sr(t,e,n=At.Left,i=!1){const s=(e?.x??0)+t.internals.positionAbsolute.x,a=(e?.y??0)+t.internals.positionAbsolute.y,{width:c,height:u}=e??Do(t);if(i)return{x:s+c/2,y:a+u/2};switch(e?.position??n){case At.Top:return{x:s+c/2,y:a};case At.Right:return{x:s+c,y:a+u/2};case At.Bottom:return{x:s+c/2,y:a+u};case At.Left:return{x:s,y:a+u/2}}}function Mv(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function qd(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("&")}`:""}function EO(t,{id:e,defaultColor:n,defaultMarkerStart:i,defaultMarkerEnd:s}){const a=new Set;return t.reduce((c,u)=>([u.markerStart||i,u.markerEnd||s].forEach(d=>{if(d&&typeof d=="object"){const h=qd(d,e);a.has(h)||(c.push({id:h,color:d.color||n,...d}),a.add(h))}}),c),[]).sort((c,u)=>c.id.localeCompare(u.id))}const Rv=1e3,CO=10,Yd={nodeOrigin:[0,0],nodeExtent:Na,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},TO={...Yd,checkEquality:!0};function Gd(t,e){const n={...t};for(const i in e)e[i]!==void 0&&(n[i]=e[i]);return n}function _O(t,e,n){const i=Gd(Yd,n);for(const s of t.values())if(s.parentId)Zd(s,t,e,i);else{const a=Ma(s,i.nodeOrigin),c=ls(s.extent)?s.extent:i.nodeExtent,u=wr(a,c,Do(s));s.internals.positionAbsolute=u}}function NO(t,e){if(!t.handles)return t.measured?e?.internals.handleBounds:void 0;const n=[],i=[];for(const s of t.handles){const a={id:s.id,width:s.width??1,height:s.height??1,nodeId:t.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(a):s.type==="target"&&i.push(a)}return{source:n,target:i}}function Xd(t){return t==="manual"}function Fd(t,e,n,i={}){const s=Gd(TO,i),a={i:0},c=new Map(e),u=s?.elevateNodesOnSelect&&!Xd(s.zIndexMode)?Rv:0;let d=t.length>0;e.clear(),n.clear();for(const h of t){let p=c.get(h.id);if(s.checkEquality&&h===p?.internals.userNode)e.set(h.id,p);else{const m=Ma(h,s.nodeOrigin),y=ls(h.extent)?h.extent:s.nodeExtent,b=wr(m,y,Do(h));p={...s.defaults,...h,measured:{width:h.measured?.width,height:h.measured?.height},internals:{positionAbsolute:b,handleBounds:NO(h,p),z:kv(h,u,s.zIndexMode),userNode:h}},e.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(d=!1),h.parentId&&Zd(p,e,n,i,a)}return d}function AO(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function Zd(t,e,n,i,s){const{elevateNodesOnSelect:a,nodeOrigin:c,nodeExtent:u,zIndexMode:d}=Gd(Yd,i),h=t.parentId,p=e.get(h);if(!p){console.warn(`Parent node ${h} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}AO(t,n),s&&!p.parentId&&p.internals.rootParentIndex===void 0&&d==="auto"&&(p.internals.rootParentIndex=++s.i,p.internals.z=p.internals.z+s.i*CO),s&&p.internals.rootParentIndex!==void 0&&(s.i=p.internals.rootParentIndex);const m=a&&!Xd(d)?Rv:0,{x:y,y:b,z:x}=MO(t,p,c,u,m,d),{positionAbsolute:w}=t.internals,S=y!==w.x||b!==w.y;(S||x!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:S?{x:y,y:b}:w,z:x}})}function kv(t,e,n){const i=qn(t.zIndex)?t.zIndex:0;return Xd(n)?i:i+(t.selected?e:0)}function MO(t,e,n,i,s,a){const{x:c,y:u}=e.internals.positionAbsolute,d=Do(t),h=Ma(t,n),p=ls(t.extent)?wr(h,t.extent,d):h;let m=wr({x:c+p.x,y:u+p.y},i,d);t.extent==="parent"&&(m=lv(m,d,e));const y=kv(t,s,a),b=e.internals.z??0;return{x:m.x,y:m.y,z:b>=y?b+1:y}}function Kd(t,e,n,i=[0,0]){const s=[],a=new Map;for(const c of t){const u=e.get(c.parentId);if(!u)continue;const d=a.get(c.parentId)?.expandedRect??ss(u),h=fv(d,c.rect);a.set(c.parentId,{expandedRect:h,parent:u})}return a.size>0&&a.forEach(({expandedRect:c,parent:u},d)=>{const h=u.internals.positionAbsolute,p=Do(u),m=u.origin??i,y=c.x<h.x?Math.round(Math.abs(h.x-c.x)):0,b=c.y<h.y?Math.round(Math.abs(h.y-c.y)):0,x=Math.max(p.width,Math.round(c.width)),w=Math.max(p.height,Math.round(c.height)),S=(x-p.width)*m[0],E=(w-p.height)*m[1];(y>0||b>0||S||E)&&(s.push({id:d,type:"position",position:{x:u.position.x-y+S,y:u.position.y-b+E}}),n.get(d)?.forEach(D=>{t.some(T=>T.id===D.id)||s.push({id:D.id,type:"position",position:{x:D.position.x+y,y:D.position.y+b}})})),(p.width<c.width||p.height<c.height||y||b)&&s.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:x+(y?m[0]*y-S:0),height:w+(b?m[1]*b-E:0)}})}),s}function RO(t,e,n,i,s,a,c){const u=i?.querySelector(".xyflow__viewport");let d=!1;if(!u)return{changes:[],updatedInternals:d};const h=[],p=window.getComputedStyle(u),{m22:m}=new window.DOMMatrixReadOnly(p.transform),y=[];for(const b of t.values()){const x=e.get(b.id);if(!x)continue;if(x.hidden){e.set(x.id,{...x,internals:{...x.internals,handleBounds:void 0}}),d=!0;continue}const w=Ud(b.nodeElement),S=x.measured.width!==w.width||x.measured.height!==w.height;if(!!(w.width&&w.height&&(S||!x.internals.handleBounds||b.force))){const D=b.nodeElement.getBoundingClientRect(),T=ls(x.extent)?x.extent:a;let{positionAbsolute:C}=x.internals;x.parentId&&x.extent==="parent"?C=lv(C,w,e.get(x.parentId)):T&&(C=wr(C,T,w));const R={...x,measured:w,internals:{...x.internals,positionAbsolute:C,handleBounds:{source:bv("source",b.nodeElement,D,m,x.id),target:bv("target",b.nodeElement,D,m,x.id)}}};e.set(x.id,R),x.parentId&&Zd(R,e,n,{nodeOrigin:s,zIndexMode:c}),d=!0,S&&(h.push({id:x.id,type:"dimensions",dimensions:w}),x.expandParent&&x.parentId&&y.push({id:x.id,parentId:x.parentId,rect:ss(R,s)}))}}if(y.length>0){const b=Kd(y,e,n,s);h.push(...b)}return{changes:h,updatedInternals:d}}async function kO({delta:t,panZoom:e,transform:n,translateExtent:i,width:s,height:a}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const c=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[s,a]],i),u=!!c&&(c.x!==n[0]||c.y!==n[1]||c.k!==n[2]);return Promise.resolve(u)}function Ov(t,e,n,i,s,a){let c=s;const u=i.get(c)||new Map;i.set(c,u.set(n,e)),c=`${s}-${t}`;const d=i.get(c)||new Map;if(i.set(c,d.set(n,e)),a){c=`${s}-${t}-${a}`;const h=i.get(c)||new Map;i.set(c,h.set(n,e))}}function Dv(t,e,n){t.clear(),e.clear();for(const i of n){const{source:s,target:a,sourceHandle:c=null,targetHandle:u=null}=i,d={edgeId:i.id,source:s,target:a,sourceHandle:c,targetHandle:u},h=`${s}-${c}--${a}-${u}`,p=`${a}-${u}--${s}-${c}`;Ov("source",d,p,t,s,c),Ov("target",d,h,t,a,u),e.set(i.id,i)}}function jv(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:jv(n,e):!1}function zv(t,e,n){let i=t;do{if(i?.matches?.(e))return!0;if(i===n)return!1;i=i?.parentElement}while(i);return!1}function OO(t,e,n,i){const s=new Map;for(const[a,c]of t)if((c.selected||c.id===i)&&(!c.parentId||!jv(c,t))&&(c.draggable||e&&typeof c.draggable>"u")){const u=t.get(a);u&&s.set(a,{id:a,position:u.position||{x:0,y:0},distance:{x:n.x-u.internals.positionAbsolute.x,y:n.y-u.internals.positionAbsolute.y},extent:u.extent,parentId:u.parentId,origin:u.origin,expandParent:u.expandParent,internals:{positionAbsolute:u.internals.positionAbsolute||{x:0,y:0}},measured:{width:u.measured.width??0,height:u.measured.height??0}})}return s}function Qd({nodeId:t,dragItems:e,nodeLookup:n,dragging:i=!0}){const s=[];for(const[c,u]of e){const d=n.get(c)?.internals.userNode;d&&s.push({...d,position:u.position,dragging:i})}if(!t)return[s[0],s];const a=n.get(t)?.internals.userNode;return[a?{...a,position:e.get(t)?.position||a.position,dragging:i}:s[0],s]}function DO({dragItems:t,snapGrid:e,x:n,y:i}){const s=t.values().next().value;if(!s)return null;const a={x:n-s.distance.x,y:i-s.distance.y},c=Oa(a,e);return{x:c.x-a.x,y:c.y-a.y}}function jO({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:i,onDragStop:s}){let a={x:null,y:null},c=0,u=new Map,d=!1,h={x:0,y:0},p=null,m=!1,y=null,b=!1,x=!1,w=null;function S({noDragClassName:D,handleSelector:T,domNode:C,isSelectable:R,nodeId:A,nodeClickDistance:O=0}){y=dn(C);function k({x:F,y:Q}){const{nodeLookup:B,nodeExtent:P,snapGrid:j,snapToGrid:I,nodeOrigin:z,onNodeDrag:U,onSelectionDrag:Y,onError:L,updateNodePositions:G}=e();a={x:F,y:Q};let tt=!1;const it=u.size>1,lt=it&&P?Pd(Ra(u)):null,ht=it&&I?DO({dragItems:u,snapGrid:j,x:F,y:Q}):null;for(const[ft,ut]of u){if(!B.has(ft))continue;let dt={x:F-ut.distance.x,y:Q-ut.distance.y};I&&(dt=ht?{x:Math.round(dt.x+ht.x),y:Math.round(dt.y+ht.y)}:Oa(dt,j));let Mt=null;if(it&&P&&!ut.extent&<){const{positionAbsolute:Tt}=ut.internals,Dt=Tt.x-lt.x+P[0][0],qt=Tt.x+ut.measured.width-lt.x2+P[1][0],Ht=Tt.y-lt.y+P[0][1],pt=Tt.y+ut.measured.height-lt.y2+P[1][1];Mt=[[Dt,Ht],[qt,pt]]}const{position:Nt,positionAbsolute:bt}=av({nodeId:ft,nextPosition:dt,nodeLookup:B,nodeExtent:Mt||P,nodeOrigin:z,onError:L});tt=tt||ut.position.x!==Nt.x||ut.position.y!==Nt.y,ut.position=Nt,ut.internals.positionAbsolute=bt}if(x=x||tt,!!tt&&(G(u,!0),w&&(i||U||!A&&Y))){const[ft,ut]=Qd({nodeId:A,dragItems:u,nodeLookup:B});i?.(w,u,ft,ut),U?.(w,ft,ut),A||Y?.(w,ut)}}async function H(){if(!p)return;const{transform:F,panBy:Q,autoPanSpeed:B,autoPanOnNodeDrag:P}=e();if(!P){d=!1,cancelAnimationFrame(c);return}const[j,I]=uv(h,p,B);(j!==0||I!==0)&&(a.x=(a.x??0)-j/F[2],a.y=(a.y??0)-I/F[2],await Q({x:j,y:I})&&k(a)),c=requestAnimationFrame(H)}function $(F){const{nodeLookup:Q,multiSelectionActive:B,nodesDraggable:P,transform:j,snapGrid:I,snapToGrid:z,selectNodesOnDrag:U,onNodeDragStart:Y,onSelectionDragStart:L,unselectNodesAndEdges:G}=e();m=!0,(!U||!R)&&!B&&A&&(Q.get(A)?.selected||G()),R&&U&&A&&t?.(A);const tt=za(F.sourceEvent,{transform:j,snapGrid:I,snapToGrid:z,containerBounds:p});if(a=tt,u=OO(Q,P,tt,A),u.size>0&&(n||Y||!A&&L)){const[it,lt]=Qd({nodeId:A,dragItems:u,nodeLookup:Q});n?.(F.sourceEvent,u,it,lt),Y?.(F.sourceEvent,it,lt),A||L?.(F.sourceEvent,lt)}}const q=Cy().clickDistance(O).on("start",F=>{const{domNode:Q,nodeDragThreshold:B,transform:P,snapGrid:j,snapToGrid:I}=e();p=Q?.getBoundingClientRect()||null,b=!1,x=!1,w=F.sourceEvent,B===0&&$(F),a=za(F.sourceEvent,{transform:P,snapGrid:j,snapToGrid:I,containerBounds:p}),h=Yn(F.sourceEvent,p)}).on("drag",F=>{const{autoPanOnNodeDrag:Q,transform:B,snapGrid:P,snapToGrid:j,nodeDragThreshold:I,nodeLookup:z}=e(),U=za(F.sourceEvent,{transform:B,snapGrid:P,snapToGrid:j,containerBounds:p});if(w=F.sourceEvent,(F.sourceEvent.type==="touchmove"&&F.sourceEvent.touches.length>1||A&&!z.has(A))&&(b=!0),!b){if(!d&&Q&&m&&(d=!0,H()),!m){const Y=Yn(F.sourceEvent,p),L=Y.x-h.x,G=Y.y-h.y;Math.sqrt(L*L+G*G)>I&&$(F)}(a.x!==U.xSnapped||a.y!==U.ySnapped)&&u&&m&&(h=Yn(F.sourceEvent,p),k(U))}}).on("end",F=>{if(!(!m||b)&&(d=!1,m=!1,cancelAnimationFrame(c),u.size>0)){const{nodeLookup:Q,updateNodePositions:B,onNodeDragStop:P,onSelectionDragStop:j}=e();if(x&&(B(u,!1),x=!1),s||P||!A&&j){const[I,z]=Qd({nodeId:A,dragItems:u,nodeLookup:Q,dragging:!1});s?.(F.sourceEvent,u,I,z),P?.(F.sourceEvent,I,z),A||j?.(F.sourceEvent,z)}}}).filter(F=>{const Q=F.target;return!F.button&&(!D||!zv(Q,`.${D}`,C))&&(!T||zv(Q,T,C))});y.call(q)}function E(){y?.on(".drag",null)}return{update:S,destroy:E}}function zO(t,e,n){const i=[],s={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const a of e.values())ka(s,ss(a))>0&&i.push(a);return i}const VO=250;function LO(t,e,n,i){let s=[],a=1/0;const c=zO(t,n,e+VO);for(const u of c){const d=[...u.internals.handleBounds?.source??[],...u.internals.handleBounds?.target??[]];for(const h of d){if(i.nodeId===h.nodeId&&i.type===h.type&&i.id===h.id)continue;const{x:p,y:m}=Sr(u,h,h.position,!0),y=Math.sqrt(Math.pow(p-t.x,2)+Math.pow(m-t.y,2));y>e||(y<a?(s=[{...h,x:p,y:m}],a=y):y===a&&s.push({...h,x:p,y:m}))}}if(!s.length)return null;if(s.length>1){const u=i.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function Vv(t,e,n,i,s,a=!1){const c=i.get(t);if(!c)return null;const u=s==="strict"?c.internals.handleBounds?.[e]:[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]],d=(n?u?.find(h=>h.id===n):u?.[0])??null;return d&&a?{...d,...Sr(c,d,d.position,!0)}:d}function Lv(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function IO(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const Iv=()=>!0;function BO(t,{connectionMode:e,connectionRadius:n,handleId:i,nodeId:s,edgeUpdaterType:a,isTarget:c,domNode:u,nodeLookup:d,lib:h,autoPanOnConnect:p,flowId:m,panBy:y,cancelConnection:b,onConnectStart:x,onConnect:w,onConnectEnd:S,isValidConnection:E=Iv,onReconnectEnd:D,updateConnection:T,getTransform:C,getFromHandle:R,autoPanSpeed:A,dragThreshold:O=1,handleDomNode:k}){const H=gv(t.target);let $=0,q;const{x:F,y:Q}=Yn(t),B=Lv(a,k),P=u?.getBoundingClientRect();let j=!1;if(!P||!B)return;const I=Vv(s,B,i,d,e);if(!I)return;let z=Yn(t,P),U=!1,Y=null,L=!1,G=null;function tt(){if(!p||!P)return;const[Nt,bt]=uv(z,P,A);y({x:Nt,y:bt}),$=requestAnimationFrame(tt)}const it={...I,nodeId:s,type:B,position:I.position},lt=d.get(s);let ft={inProgress:!0,isValid:null,from:Sr(lt,it,At.Left,!0),fromHandle:it,fromPosition:it.position,fromNode:lt,to:z,toHandle:null,toPosition:iv[it.position],toNode:null,pointer:z};function ut(){j=!0,T(ft),x?.(t,{nodeId:s,handleId:i,handleType:B})}O===0&&ut();function dt(Nt){if(!j){const{x:pt,y:gt}=Yn(Nt),yt=pt-F,mt=gt-Q;if(!(yt*yt+mt*mt>O*O))return;ut()}if(!R()||!it){Mt(Nt);return}const bt=C();z=Yn(Nt,P),q=LO(Da(z,bt,!1,[1,1]),n,d,it),U||(tt(),U=!0);const Tt=Bv(Nt,{handle:q,connectionMode:e,fromNodeId:s,fromHandleId:i,fromType:c?"target":"source",isValidConnection:E,doc:H,lib:h,flowId:m,nodeLookup:d});G=Tt.handleDomNode,Y=Tt.connection,L=IO(!!q,Tt.isValid);const Dt=d.get(s),qt=Dt?Sr(Dt,it,At.Left,!0):ft.from,Ht={...ft,from:qt,isValid:L,to:Tt.toHandle&&L?kc({x:Tt.toHandle.x,y:Tt.toHandle.y},bt):z,toHandle:Tt.toHandle,toPosition:L&&Tt.toHandle?Tt.toHandle.position:iv[it.position],toNode:Tt.toHandle?d.get(Tt.toHandle.nodeId):null,pointer:z};T(Ht),ft=Ht}function Mt(Nt){if(!("touches"in Nt&&Nt.touches.length>0)){if(j){(q||G)&&Y&&L&&w?.(Y);const{inProgress:bt,...Tt}=ft,Dt={...Tt,toPosition:ft.toHandle?ft.toPosition:null};S?.(Nt,Dt),a&&D?.(Nt,Dt)}b(),cancelAnimationFrame($),U=!1,L=!1,Y=null,G=null,H.removeEventListener("mousemove",dt),H.removeEventListener("mouseup",Mt),H.removeEventListener("touchmove",dt),H.removeEventListener("touchend",Mt)}}H.addEventListener("mousemove",dt),H.addEventListener("mouseup",Mt),H.addEventListener("touchmove",dt),H.addEventListener("touchend",Mt)}function Bv(t,{handle:e,connectionMode:n,fromNodeId:i,fromHandleId:s,fromType:a,doc:c,lib:u,flowId:d,isValidConnection:h=Iv,nodeLookup:p}){const m=a==="target",y=e?c.querySelector(`.${u}-flow__handle[data-id="${d}-${e?.nodeId}-${e?.id}-${e?.type}"]`):null,{x:b,y:x}=Yn(t),w=c.elementFromPoint(b,x),S=w?.classList.contains(`${u}-flow__handle`)?w:y,E={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const D=Lv(void 0,S),T=S.getAttribute("data-nodeid"),C=S.getAttribute("data-handleid"),R=S.classList.contains("connectable"),A=S.classList.contains("connectableend");if(!T||!D)return E;const O={source:m?T:i,sourceHandle:m?C:s,target:m?i:T,targetHandle:m?s:C};E.connection=O;const H=R&&A&&(n===is.Strict?m&&D==="source"||!m&&D==="target":T!==i||C!==s);E.isValid=H&&h(O),E.toHandle=Vv(T,D,C,p,n,!0)}return E}const Wd={onPointerDown:BO,isValid:Bv};function PO({domNode:t,panZoom:e,getTransform:n,getViewScale:i}){const s=dn(t);function a({translateExtent:u,width:d,height:h,zoomStep:p=1,pannable:m=!0,zoomable:y=!0,inversePan:b=!1}){const x=T=>{if(T.sourceEvent.type!=="wheel"||!e)return;const C=n(),R=T.sourceEvent.ctrlKey&&ja()?10:1,A=-T.sourceEvent.deltaY*(T.sourceEvent.deltaMode===1?.05:T.sourceEvent.deltaMode?1:.002)*p,O=C[2]*Math.pow(2,A*R);e.scaleTo(O)};let w=[0,0];const S=T=>{(T.sourceEvent.type==="mousedown"||T.sourceEvent.type==="touchstart")&&(w=[T.sourceEvent.clientX??T.sourceEvent.touches[0].clientX,T.sourceEvent.clientY??T.sourceEvent.touches[0].clientY])},E=T=>{const C=n();if(T.sourceEvent.type!=="mousemove"&&T.sourceEvent.type!=="touchmove"||!e)return;const R=[T.sourceEvent.clientX??T.sourceEvent.touches[0].clientX,T.sourceEvent.clientY??T.sourceEvent.touches[0].clientY],A=[R[0]-w[0],R[1]-w[1]];w=R;const O=i()*Math.max(C[2],Math.log(C[2]))*(b?-1:1),k={x:C[0]-A[0]*O,y:C[1]-A[1]*O},H=[[0,0],[d,h]];e.setViewportConstrained({x:k.x,y:k.y,zoom:C[2]},H,u)},D=tv().on("start",S).on("zoom",m?E:null).on("zoom.wheel",y?x:null);s.call(D,{})}function c(){s.on("zoom",null)}return{update:a,destroy:c,pointer:Hn}}const Dc=t=>({x:t.x,y:t.y,zoom:t.k}),Jd=({x:t,y:e,zoom:n})=>_c.translate(t,e).scale(n),cs=(t,e)=>t.target.closest(`.${e}`),Pv=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),HO=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,th=(t,e=0,n=HO,i=()=>{})=>{const s=typeof e=="number"&&e>0;return s||i(),s?t.transition().duration(e).ease(n).on("end",i):t},Hv=t=>{const e=t.ctrlKey&&ja()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function UO({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:i,panOnScrollMode:s,panOnScrollSpeed:a,zoomOnPinch:c,onPanZoomStart:u,onPanZoom:d,onPanZoomEnd:h}){return p=>{if(cs(p,e))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const m=n.property("__zoom").k||1;if(p.ctrlKey&&c){const S=Hn(p),E=Hv(p),D=m*Math.pow(2,E);i.scaleTo(n,D,S,p);return}const y=p.deltaMode===1?20:1;let b=s===xr.Vertical?0:p.deltaX*y,x=s===xr.Horizontal?0:p.deltaY*y;!ja()&&p.shiftKey&&s!==xr.Vertical&&(b=p.deltaY*y,x=0),i.translateBy(n,-(b/m)*a,-(x/m)*a,{internal:!0});const w=Dc(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(d?.(p,w),t.panScrollTimeout=setTimeout(()=>{h?.(p,w),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,u?.(p,w))}}function $O({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(i,s){const a=i.type==="wheel",c=!e&&a&&!i.ctrlKey,u=cs(i,t);if(i.ctrlKey&&a&&u&&i.preventDefault(),c||u)return null;i.preventDefault(),n.call(this,i,s)}}function qO({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return i=>{if(i.sourceEvent?.internal)return;const s=Dc(i.transform);t.mouseButton=i.sourceEvent?.button||0,t.isZoomingOrPanning=!0,t.prevViewport=s,i.sourceEvent?.type==="mousedown"&&e(!0),n&&n?.(i.sourceEvent,s)}}function YO({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:i,onPanZoom:s}){return a=>{t.usedRightMouseButton=!!(n&&Pv(e,t.mouseButton??0)),a.sourceEvent?.sync||i([a.transform.x,a.transform.y,a.transform.k]),s&&!a.sourceEvent?.internal&&s?.(a.sourceEvent,Dc(a.transform))}}function GO({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:i,onPanZoomEnd:s,onPaneContextMenu:a}){return c=>{if(!c.sourceEvent?.internal&&(t.isZoomingOrPanning=!1,a&&Pv(e,t.mouseButton??0)&&!t.usedRightMouseButton&&c.sourceEvent&&a(c.sourceEvent),t.usedRightMouseButton=!1,i(!1),s)){const u=Dc(c.transform);t.prevViewport=u,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{s?.(c.sourceEvent,u)},n?150:0)}}}function XO({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:i,panOnScroll:s,zoomOnDoubleClick:a,userSelectionActive:c,noWheelClassName:u,noPanClassName:d,lib:h,connectionInProgress:p}){return m=>{const y=t||e,b=n&&m.ctrlKey,x=m.type==="wheel";if(m.button===1&&m.type==="mousedown"&&(cs(m,`${h}-flow__node`)||cs(m,`${h}-flow__edge`)))return!0;if(!i&&!y&&!s&&!a&&!n||c||p&&!x||cs(m,u)&&x||cs(m,d)&&(!x||s&&x&&!t)||!n&&m.ctrlKey&&x)return!1;if(!n&&m.type==="touchstart"&&m.touches?.length>1)return m.preventDefault(),!1;if(!y&&!s&&!b&&x||!i&&(m.type==="mousedown"||m.type==="touchstart")||Array.isArray(i)&&!i.includes(m.button)&&m.type==="mousedown")return!1;const w=Array.isArray(i)&&i.includes(m.button)||!m.button||m.button<=1;return(!m.ctrlKey||x)&&w}}function FO({domNode:t,minZoom:e,maxZoom:n,translateExtent:i,viewport:s,onPanZoom:a,onPanZoomStart:c,onPanZoomEnd:u,onDraggingChange:d}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=t.getBoundingClientRect(),m=tv().scaleExtent([e,n]).translateExtent(i),y=dn(t).call(m);D({x:s.x,y:s.y,zoom:rs(s.zoom,e,n)},[[0,0],[p.width,p.height]],i);const b=y.on("wheel.zoom"),x=y.on("dblclick.zoom");m.wheelDelta(Hv);function w(q,F){return y?new Promise(Q=>{m?.interpolate(F?.interpolate==="linear"?wa:gc).transform(th(y,F?.duration,F?.ease,()=>Q(!0)),q)}):Promise.resolve(!1)}function S({noWheelClassName:q,noPanClassName:F,onPaneContextMenu:Q,userSelectionActive:B,panOnScroll:P,panOnDrag:j,panOnScrollMode:I,panOnScrollSpeed:z,preventScrolling:U,zoomOnPinch:Y,zoomOnScroll:L,zoomOnDoubleClick:G,zoomActivationKeyPressed:tt,lib:it,onTransformChange:lt,connectionInProgress:ht,paneClickDistance:ft,selectionOnDrag:ut}){B&&!h.isZoomingOrPanning&&E();const dt=P&&!tt&&!B;m.clickDistance(ut?1/0:!qn(ft)||ft<0?0:ft);const Mt=dt?UO({zoomPanValues:h,noWheelClassName:q,d3Selection:y,d3Zoom:m,panOnScrollMode:I,panOnScrollSpeed:z,zoomOnPinch:Y,onPanZoomStart:c,onPanZoom:a,onPanZoomEnd:u}):$O({noWheelClassName:q,preventScrolling:U,d3ZoomHandler:b});if(y.on("wheel.zoom",Mt,{passive:!1}),!B){const bt=qO({zoomPanValues:h,onDraggingChange:d,onPanZoomStart:c});m.on("start",bt);const Tt=YO({zoomPanValues:h,panOnDrag:j,onPaneContextMenu:!!Q,onPanZoom:a,onTransformChange:lt});m.on("zoom",Tt);const Dt=GO({zoomPanValues:h,panOnDrag:j,panOnScroll:P,onPaneContextMenu:Q,onPanZoomEnd:u,onDraggingChange:d});m.on("end",Dt)}const Nt=XO({zoomActivationKeyPressed:tt,panOnDrag:j,zoomOnScroll:L,panOnScroll:P,zoomOnDoubleClick:G,zoomOnPinch:Y,userSelectionActive:B,noPanClassName:F,noWheelClassName:q,lib:it,connectionInProgress:ht});m.filter(Nt),G?y.on("dblclick.zoom",x):y.on("dblclick.zoom",null)}function E(){m.on("zoom",null)}async function D(q,F,Q){const B=Jd(q),P=m?.constrain()(B,F,Q);return P&&await w(P),new Promise(j=>j(P))}async function T(q,F){const Q=Jd(q);return await w(Q,F),new Promise(B=>B(Q))}function C(q){if(y){const F=Jd(q),Q=y.property("__zoom");(Q.k!==q.zoom||Q.x!==q.x||Q.y!==q.y)&&m?.transform(y,F,null,{sync:!0})}}function R(){const q=y?Wy(y.node()):{x:0,y:0,k:1};return{x:q.x,y:q.y,zoom:q.k}}function A(q,F){return y?new Promise(Q=>{m?.interpolate(F?.interpolate==="linear"?wa:gc).scaleTo(th(y,F?.duration,F?.ease,()=>Q(!0)),q)}):Promise.resolve(!1)}function O(q,F){return y?new Promise(Q=>{m?.interpolate(F?.interpolate==="linear"?wa:gc).scaleBy(th(y,F?.duration,F?.ease,()=>Q(!0)),q)}):Promise.resolve(!1)}function k(q){m?.scaleExtent(q)}function H(q){m?.translateExtent(q)}function $(q){const F=!qn(q)||q<0?0:q;m?.clickDistance(F)}return{update:S,destroy:E,setViewport:T,setViewportConstrained:D,getViewport:R,scaleTo:A,scaleBy:O,setScaleExtent:k,setTranslateExtent:H,syncViewport:C,setClickDistance:$}}var us;(function(t){t.Line="line",t.Handle="handle"})(us||(us={}));function ZO({width:t,prevWidth:e,height:n,prevHeight:i,affectsX:s,affectsY:a}){const c=t-e,u=n-i,d=[c>0?1:c<0?-1:0,u>0?1:u<0?-1:0];return c&&s&&(d[0]=d[0]*-1),u&&a&&(d[1]=d[1]*-1),d}function Uv(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),i=t.includes("left"),s=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:i,affectsY:s}}function di(t,e){return Math.max(0,e-t)}function hi(t,e){return Math.max(0,t-e)}function jc(t,e,n){return Math.max(0,e-t,t-n)}function $v(t,e){return t?!e:e}function KO(t,e,n,i,s,a,c,u){let{affectsX:d,affectsY:h}=e;const{isHorizontal:p,isVertical:m}=e,y=p&&m,{xSnapped:b,ySnapped:x}=n,{minWidth:w,maxWidth:S,minHeight:E,maxHeight:D}=i,{x:T,y:C,width:R,height:A,aspectRatio:O}=t;let k=Math.floor(p?b-t.pointerX:0),H=Math.floor(m?x-t.pointerY:0);const $=R+(d?-k:k),q=A+(h?-H:H),F=-a[0]*R,Q=-a[1]*A;let B=jc($,w,S),P=jc(q,E,D);if(c){let z=0,U=0;d&&k<0?z=di(T+k+F,c[0][0]):!d&&k>0&&(z=hi(T+$+F,c[1][0])),h&&H<0?U=di(C+H+Q,c[0][1]):!h&&H>0&&(U=hi(C+q+Q,c[1][1])),B=Math.max(B,z),P=Math.max(P,U)}if(u){let z=0,U=0;d&&k>0?z=hi(T+k,u[0][0]):!d&&k<0&&(z=di(T+$,u[1][0])),h&&H>0?U=hi(C+H,u[0][1]):!h&&H<0&&(U=di(C+q,u[1][1])),B=Math.max(B,z),P=Math.max(P,U)}if(s){if(p){const z=jc($/O,E,D)*O;if(B=Math.max(B,z),c){let U=0;!d&&!h||d&&!h&&y?U=hi(C+Q+$/O,c[1][1])*O:U=di(C+Q+(d?k:-k)/O,c[0][1])*O,B=Math.max(B,U)}if(u){let U=0;!d&&!h||d&&!h&&y?U=di(C+$/O,u[1][1])*O:U=hi(C+(d?k:-k)/O,u[0][1])*O,B=Math.max(B,U)}}if(m){const z=jc(q*O,w,S)/O;if(P=Math.max(P,z),c){let U=0;!d&&!h||h&&!d&&y?U=hi(T+q*O+F,c[1][0])/O:U=di(T+(h?H:-H)*O+F,c[0][0])/O,P=Math.max(P,U)}if(u){let U=0;!d&&!h||h&&!d&&y?U=di(T+q*O,u[1][0])/O:U=hi(T+(h?H:-H)*O,u[0][0])/O,P=Math.max(P,U)}}}H=H+(H<0?P:-P),k=k+(k<0?B:-B),s&&(y?$>q*O?H=($v(d,h)?-k:k)/O:k=($v(d,h)?-H:H)*O:p?(H=k/O,h=d):(k=H*O,d=h));const j=d?T+k:T,I=h?C+H:C;return{width:R+(d?-k:k),height:A+(h?-H:H),x:a[0]*k*(d?-1:1)+j,y:a[1]*H*(h?-1:1)+I}}const qv={width:0,height:0,x:0,y:0},QO={...qv,pointerX:0,pointerY:0,aspectRatio:1};function WO(t){return[[0,0],[t.measured.width,t.measured.height]]}function JO(t,e,n){const i=e.position.x+t.position.x,s=e.position.y+t.position.y,a=t.measured.width??0,c=t.measured.height??0,u=n[0]*a,d=n[1]*c;return[[i-u,s-d],[i+a-u,s+c-d]]}function tD({domNode:t,nodeId:e,getStoreItems:n,onChange:i,onEnd:s}){const a=dn(t);let c={controlDirection:Uv("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function u({controlPosition:h,boundaries:p,keepAspectRatio:m,resizeDirection:y,onResizeStart:b,onResize:x,onResizeEnd:w,shouldResize:S}){let E={...qv},D={...QO};c={boundaries:p,resizeDirection:y,keepAspectRatio:m,controlDirection:Uv(h)};let T,C=null,R=[],A,O,k,H=!1;const $=Cy().on("start",q=>{const{nodeLookup:F,transform:Q,snapGrid:B,snapToGrid:P,nodeOrigin:j,paneDomNode:I}=n();if(T=F.get(e),!T)return;C=I?.getBoundingClientRect()??null;const{xSnapped:z,ySnapped:U}=za(q.sourceEvent,{transform:Q,snapGrid:B,snapToGrid:P,containerBounds:C});E={width:T.measured.width??0,height:T.measured.height??0,x:T.position.x??0,y:T.position.y??0},D={...E,pointerX:z,pointerY:U,aspectRatio:E.width/E.height},A=void 0,T.parentId&&(T.extent==="parent"||T.expandParent)&&(A=F.get(T.parentId),O=A&&T.extent==="parent"?WO(A):void 0),R=[],k=void 0;for(const[Y,L]of F)if(L.parentId===e&&(R.push({id:Y,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){const G=JO(L,T,L.origin??j);k?k=[[Math.min(G[0][0],k[0][0]),Math.min(G[0][1],k[0][1])],[Math.max(G[1][0],k[1][0]),Math.max(G[1][1],k[1][1])]]:k=G}b?.(q,{...E})}).on("drag",q=>{const{transform:F,snapGrid:Q,snapToGrid:B,nodeOrigin:P}=n(),j=za(q.sourceEvent,{transform:F,snapGrid:Q,snapToGrid:B,containerBounds:C}),I=[];if(!T)return;const{x:z,y:U,width:Y,height:L}=E,G={},tt=T.origin??P,{width:it,height:lt,x:ht,y:ft}=KO(D,c.controlDirection,j,c.boundaries,c.keepAspectRatio,tt,O,k),ut=it!==Y,dt=lt!==L,Mt=ht!==z&&ut,Nt=ft!==U&&dt;if(!Mt&&!Nt&&!ut&&!dt)return;if((Mt||Nt||tt[0]===1||tt[1]===1)&&(G.x=Mt?ht:E.x,G.y=Nt?ft:E.y,E.x=G.x,E.y=G.y,R.length>0)){const qt=ht-z,Ht=ft-U;for(const pt of R)pt.position={x:pt.position.x-qt+tt[0]*(it-Y),y:pt.position.y-Ht+tt[1]*(lt-L)},I.push(pt)}if((ut||dt)&&(G.width=ut&&(!c.resizeDirection||c.resizeDirection==="horizontal")?it:E.width,G.height=dt&&(!c.resizeDirection||c.resizeDirection==="vertical")?lt:E.height,E.width=G.width,E.height=G.height),A&&T.expandParent){const qt=tt[0]*(G.width??0);G.x&&G.x<qt&&(E.x=qt,D.x=D.x-(G.x-qt));const Ht=tt[1]*(G.height??0);G.y&&G.y<Ht&&(E.y=Ht,D.y=D.y-(G.y-Ht))}const bt=ZO({width:E.width,prevWidth:Y,height:E.height,prevHeight:L,affectsX:c.controlDirection.affectsX,affectsY:c.controlDirection.affectsY}),Tt={...E,direction:bt};S?.(q,Tt)!==!1&&(H=!0,x?.(q,Tt),i(G,I))}).on("end",q=>{H&&(w?.(q,{...E}),s?.({...E}),H=!1)});a.call($)}function d(){a.on(".drag",null)}return{update:u,destroy:d}}var eh={exports:{}},nh={},oh={exports:{}},ih={};var Yv;function eD(){if(Yv)return ih;Yv=1;var t=ha();function e(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:e,i=t.useState,s=t.useEffect,a=t.useLayoutEffect,c=t.useDebugValue;function u(m,y){var b=y(),x=i({inst:{value:b,getSnapshot:y}}),w=x[0].inst,S=x[1];return a(function(){w.value=b,w.getSnapshot=y,d(w)&&S({inst:w})},[m,b,y]),s(function(){return d(w)&&S({inst:w}),m(function(){d(w)&&S({inst:w})})},[m]),c(b),b}function d(m){var y=m.getSnapshot;m=m.value;try{var b=y();return!n(m,b)}catch{return!0}}function h(m,y){return y()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:u;return ih.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,ih}var Gv;function nD(){return Gv||(Gv=1,oh.exports=eD()),oh.exports}var Xv;function oD(){if(Xv)return nh;Xv=1;var t=ha(),e=nD();function n(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var i=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,a=t.useRef,c=t.useEffect,u=t.useMemo,d=t.useDebugValue;return nh.useSyncExternalStoreWithSelector=function(h,p,m,y,b){var x=a(null);if(x.current===null){var w={hasValue:!1,value:null};x.current=w}else w=x.current;x=u(function(){function E(A){if(!D){if(D=!0,T=A,A=y(A),b!==void 0&&w.hasValue){var O=w.value;if(b(O,A))return C=O}return C=A}if(O=C,i(T,A))return O;var k=y(A);return b!==void 0&&b(O,k)?(T=A,O):(T=A,C=k)}var D=!1,T,C,R=m===void 0?null:m;return[function(){return E(p())},R===null?void 0:function(){return E(R())}]},[p,m,y,b]);var S=s(h,x[0],x[1]);return c(function(){w.hasValue=!0,w.value=S},[S]),d(S),S},nh}var Fv;function iD(){return Fv||(Fv=1,eh.exports=oD()),eh.exports}var rD=iD();const sD=Qf(rD),aD={},Zv=t=>{let e;const n=new Set,i=(p,m)=>{const y=typeof p=="function"?p(e):p;if(!Object.is(y,e)){const b=e;e=m??(typeof y!="object"||y===null)?y:Object.assign({},e,y),n.forEach(x=>x(e,b))}},s=()=>e,d={setState:i,getState:s,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(aD?"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."),n.clear()}},h=e=t(i,s,d);return d},lD=t=>t?Zv(t):Zv,{useDebugValue:cD}=dr,{useSyncExternalStoreWithSelector:uD}=sD,fD=t=>t;function Kv(t,e=fD,n){const i=uD(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return cD(i),i}const Qv=(t,e)=>{const n=lD(t),i=(s,a=e)=>Kv(n,s,a);return Object.assign(i,n),i},dD=(t,e)=>t?Qv(t,e):Qv;function he(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[i,s]of t)if(!Object.is(s,e.get(i)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(e,i)||!Object.is(t[i],e[i]))return!1;return!0}var rh=k0();const hD=Qf(rh),zc=N.createContext(null),pD=zc.Provider,Wv=ho.error001();function Zt(t,e){const n=N.useContext(zc);if(n===null)throw new Error(Wv);return Kv(n,t,e)}function ce(){const t=N.useContext(zc);if(t===null)throw new Error(Wv);return N.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const Jv={display:"none"},mD={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},tb="react-flow__node-desc",eb="react-flow__edge-desc",gD="react-flow__aria-live",yD=t=>t.ariaLiveMessage,vD=t=>t.ariaLabelConfig;function bD({rfId:t}){const e=Zt(yD);return M.jsx("div",{id:`${gD}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:mD,children:e})}function xD({rfId:t,disableKeyboardA11y:e}){const n=Zt(vD);return M.jsxs(M.Fragment,{children:[M.jsx("div",{id:`${tb}-${t}`,style:Jv,children:e?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),M.jsx("div",{id:`${eb}-${t}`,style:Jv,children:n["edge.a11yDescription.default"]}),!e&&M.jsx(bD,{rfId:t})]})}const Va=N.forwardRef(({position:t="top-left",children:e,className:n,style:i,...s},a)=>{const c=`${t}`.split("-");return M.jsx("div",{className:_e(["react-flow__panel",n,...c]),style:i,ref:a,...s,children:e})});Va.displayName="Panel";function wD({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:M.jsx(Va,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:M.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const SD=t=>{const e=[],n=[];for(const[,i]of t.nodeLookup)i.selected&&e.push(i.internals.userNode);for(const[,i]of t.edgeLookup)i.selected&&n.push(i);return{selectedNodes:e,selectedEdges:n}},Vc=t=>t.id;function ED(t,e){return he(t.selectedNodes.map(Vc),e.selectedNodes.map(Vc))&&he(t.selectedEdges.map(Vc),e.selectedEdges.map(Vc))}function CD({onSelectionChange:t}){const e=ce(),{selectedNodes:n,selectedEdges:i}=Zt(SD,ED);return N.useEffect(()=>{const s={nodes:n,edges:i};t?.(s),e.getState().onSelectionChangeHandlers.forEach(a=>a(s))},[n,i,t]),null}const TD=t=>!!t.onSelectionChangeHandlers;function _D({onSelectionChange:t}){const e=Zt(TD);return t||e?M.jsx(CD,{onSelectionChange:t}):null}const nb=[0,0],ND={x:0,y:0,zoom:1},ob=[...["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"],"rfId"],AD=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges}),ib={translateExtent:Na,nodeOrigin:nb,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function MD(t){const{setNodes:e,setEdges:n,setMinZoom:i,setMaxZoom:s,setTranslateExtent:a,setNodeExtent:c,reset:u,setDefaultNodesAndEdges:d}=Zt(AD,he),h=ce();N.useEffect(()=>(d(t.defaultNodes,t.defaultEdges),()=>{p.current=ib,u()}),[]);const p=N.useRef(ib);return N.useEffect(()=>{for(const m of ob){const y=t[m],b=p.current[m];y!==b&&(typeof t[m]>"u"||(m==="nodes"?e(y):m==="edges"?n(y):m==="minZoom"?i(y):m==="maxZoom"?s(y):m==="translateExtent"?a(y):m==="nodeExtent"?c(y):m==="ariaLabelConfig"?h.setState({ariaLabelConfig:dO(y)}):m==="fitView"?h.setState({fitViewQueued:y}):m==="fitViewOptions"?h.setState({fitViewOptions:y}):h.setState({[m]:y})))}p.current=t},ob.map(m=>t[m])),null}function rb(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function RD(t){const[e,n]=N.useState(t==="system"?null:t);return N.useEffect(()=>{if(t!=="system"){n(t);return}const i=rb(),s=()=>n(i?.matches?"dark":"light");return s(),i?.addEventListener("change",s),()=>{i?.removeEventListener("change",s)}},[t]),e!==null?e:rb()?.matches?"dark":"light"}const sb=typeof document<"u"?document:null;function La(t=null,e={target:sb,actInsideInputWithModifier:!0}){const[n,i]=N.useState(!1),s=N.useRef(!1),a=N.useRef(new Set([])),[c,u]=N.useMemo(()=>{if(t!==null){const h=(Array.isArray(t)?t:[t]).filter(m=>typeof m=="string").map(m=>m.replace("+",`
|
|
18
|
+
]`}function ay(t,e){return t.nodeId===""?e==="source"?`inputs.${t.portName}`:`outputs.${t.portName}`:`nodes.${t.nodeId}.${t.portName}`}const AM="__top__";function MM(t){const e={},n=new Set;function o(s){const a=s.circuit.name;if(n.has(a))return;n.add(a);const l=Ll(a);l&&(e[a]={evalSource:l.evalFn.toString(),onTickSource:l.onTickFn?.toString(),inputNames:l.inputNames,outputNames:l.outputNames,stateKeys:l.stateKeys});for(const[,u]of s._dependencies)u&&o(u)}return o(t),e}function RM(t,e){const n=Wf(),o=N.useMemo(()=>`embed-${typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2)}`,[]),{rawCircuit:s,componentLibrary:a}=N.useMemo(()=>{const pt=new Map,yt={resolveCircuit:vt=>pt.get(vt),getAllPrimitiveNames:()=>[...pt.entries()].filter(([,vt])=>vt.implementation.kind==="primitive").map(([vt])=>vt),addCircuit:vt=>{pt.set(vt.name,vt)}};for(const vt of[ed(),nd(),id,od(),rd,sd])yt.addCircuit(vt.circuit);if(t&&(yt.addCircuit(t.circuit),t._dependencies))for(const[,vt]of t._dependencies)vt?.circuit&&yt.addCircuit(vt.circuit);return{rawCircuit:t?.circuit??null,componentLibrary:yt}},[t]),l=N.useMemo(()=>s?e?.autoHarness?vM(s,a,e.initialInputs):s:null,[s,a,e?.autoHarness,e?.initialInputs]),u=N.useMemo(()=>ud(l,a.resolveCircuit),[l,a]),[d,h]=N.useState(new Map),[p,m]=N.useState({}),[y,b]=N.useState(0),[x,w]=N.useState(!1),[_,S]=N.useState(!1),[k,C]=N.useState(15),E=N.useRef(null),R=N.useRef([]),[A,O]=N.useState(-1),[D,U]=N.useState(0),q=200,Y=N.useMemo(()=>{const pt={};if(!l)return pt;for(const yt of l.inputs)pt[yt.name]=yt.portType.kind==="bit"?!1:0;return pt},[l]),[K,W]=N.useState({}),[B,H]=N.useState(Y),j=N.useRef(B);N.useEffect(()=>{j.current=B},[B]),N.useEffect(()=>{if(!t||!l){w(!1),h(new Map);return}let pt=!1;async function yt(){if(!t||!l)return;const vt=MM(t),mt=[],Ct=new Set,It=Wt=>{Ct.has(Wt.name)||(Ct.add(Wt.name),mt.push(Wt))};It(t.circuit);for(const[,Wt]of t._dependencies)Wt?.circuit&&It(Wt.circuit);for(const Wt of[ed(),nd(),id,od(),rd,sd])It(Wt.circuit);const zt=a.getAllPrimitiveNames();for(const Wt of zt){const je=a.resolveCircuit(Wt);je&&It(je)}const Vt=await n.compileIR(l,mt,o,{evalSources:vt,snapshot:u});if(pt)return;if("error"in Vt){console.error("[useCircuitSimulator] compileIR failed:",Vt.error),w(!1);return}const ve=new Map;for(const[Wt,je]of Object.entries(Vt.portValues))ve.set(Wt,je);h(ve),Vt.peripheralState&&m(Vt.peripheralState),b(0),R.current=Vt.snapshotId!==void 0?[{snapshotId:Vt.snapshotId,cycle:0,inputs:{...Y}}]:[],O(Vt.snapshotId!==void 0?0:-1),U(R.current.length),w(!0)}return yt(),()=>{pt=!0,n.dispose(o).catch(()=>{})}},[t,l,a,n,o,u]),N.useEffect(()=>{H(Y)},[Y]),N.useEffect(()=>{if(!x||d.size===0||!l)return;const pt={};for(const yt of l.outputs){const vt=`${AM}.${yt.name}`,mt=d.get(vt);mt!==void 0&&(pt[yt.name]=typeof mt=="number"?mt:!!mt)}W(pt)},[x,d,l]);const I=N.useCallback((pt,yt,vt)=>{if(pt===void 0)return;const mt=R.current,Ct=z.current;if(Ct>=0&&Ct<mt.length-1&&(mt.length=Ct+1),mt.push({snapshotId:pt,cycle:yt,inputs:{...vt}}),mt.length>q){const It=mt.length-q,zt=mt[It-1].snapshotId;mt.splice(0,It),n.pruneSnapshots(zt,o).catch(()=>{})}z.current=mt.length-1,O(mt.length-1),U(mt.length)},[n,o]),z=N.useRef(-1);N.useEffect(()=>{z.current=A},[A]);const $=N.useCallback(async(pt,yt)=>{const vt={...j.current,[pt]:yt};if(j.current=vt,H(vt),!x)return;const mt=await n.setNode(pt,yt,o);if("error"in mt)return;const Ct=new Map;for(const[It,zt]of Object.entries(mt.portValues))Ct.set(It,zt);h(Ct),mt.peripheralState&&m(mt.peripheralState)},[x,n,o]),G=N.useCallback(pt=>{const yt=B[pt];$(pt,typeof yt=="boolean"?!yt:yt===0?1:0)},[B,$]),L=N.useCallback(async pt=>{if(!x)return;const yt=`${pt}.out`,vt=d.get(yt),mt=typeof vt=="boolean"?!vt:vt===1?0:1,Ct=await n.setNode(pt,mt,o);if("error"in Ct)return;const It=new Map;for(const[zt,Vt]of Object.entries(Ct.portValues))It.set(zt,Vt);h(It),Ct.peripheralState&&m(Ct.peripheralState)},[x,d,n,o]),F=N.useCallback(async(pt,yt)=>{if(!x)return null;const vt=await n.setNode(pt,yt,o);if("error"in vt)return null;const mt=new Map;for(const[Ct,It]of Object.entries(vt.portValues))mt.set(Ct,It);return h(mt),vt.peripheralState&&m(vt.peripheralState),mt},[x,n,o]),et=N.useCallback(async()=>{if(!x)return;const pt=await n.tick(void 0,o,{snapshot:u});if("error"in pt)return;const yt=new Map;for(const[vt,mt]of Object.entries(pt.portValues))yt.set(vt,mt);h(yt),b(pt.cycle),pt.peripheralState&&m(pt.peripheralState),I(pt.snapshotId,pt.cycle,j.current)},[x,n,o,u,I]),rt=N.useCallback(async pt=>{if(!x||pt<=0)return;const yt=await n.tickN(pt,void 0,o,{snapshot:u});if("error"in yt)return;const vt=new Map;for(const[mt,Ct]of Object.entries(yt.portValues))vt.set(mt,Ct);h(vt),b(yt.cycle),yt.peripheralState&&m(yt.peripheralState),I(yt.snapshotId,yt.cycle,j.current)},[x,n,o,u,I]),ct=N.useCallback(async(pt,yt,vt)=>{if(!x||vt<=0)return null;const mt=await n.scanPort(pt,yt,vt,o);return"error"in mt?null:mt.values},[x,n,o]),ht=N.useCallback(async()=>{const pt=await n.reset(o);if("error"in pt)return;const yt=new Map;for(const[vt,mt]of Object.entries(pt.portValues))yt.set(vt,mt);if(h(yt),b(0),H(Y),pt.peripheralState?m(pt.peripheralState):m({}),R.current=[],u){const vt=await n.snapshot(o);!("error"in vt)&&vt.snapshotId!==void 0&&(R.current=[{snapshotId:vt.snapshotId,cycle:0,inputs:{...Y}}])}z.current=R.current.length>0?0:-1,O(R.current.length>0?0:-1),U(R.current.length)},[n,o,Y,u]),ft=N.useCallback(async(pt,yt)=>{const vt=await n.restore(pt.snapshotId,o);if("error"in vt)return;const mt=new Map;for(const[It,zt]of Object.entries(vt.portValues))mt.set(It,zt);h(mt),b(vt.cycle),vt.peripheralState?m(vt.peripheralState):m({});const Ct={...pt.inputs};j.current=Ct,H(Ct),z.current=yt,O(yt)},[n,o]),ut=N.useCallback(async()=>{if(!x)return;const pt=R.current,yt=z.current;yt<=0||await ft(pt[yt-1],yt-1)},[x,ft]),dt=N.useCallback(async()=>{if(!x)return;const pt=R.current,yt=z.current;yt>=pt.length-1||await ft(pt[yt+1],yt+1)},[x,ft]),Ot=N.useCallback(async pt=>{if(!x)return;const yt=R.current;pt<0||pt>=yt.length||await ft(yt[pt],pt)},[x,ft]),At=N.useRef(et);N.useEffect(()=>{At.current=et},[et]);const bt=N.useCallback((pt,yt)=>{E.current&&clearInterval(E.current),C(pt),S(!0);const vt=Math.max(1,Math.floor(1e3/pt));E.current=setInterval(()=>{At.current()},vt)},[]),Tt=N.useCallback(()=>{E.current&&(clearInterval(E.current),E.current=null),S(!1)},[]),Dt=N.useCallback(pt=>{if(C(pt),E.current){clearInterval(E.current);const yt=Math.max(1,Math.floor(1e3/pt));E.current=setInterval(()=>{At.current()},yt)}},[]);N.useEffect(()=>()=>{E.current&&clearInterval(E.current)},[]);const Xt=N.useMemo(()=>{const pt=Object.entries(p);if(pt.length===0)return null;const yt=new Map;for(const[vt,mt]of pt)yt.set(vt,mt);return{currentState:yt,nextState:new Map,clocks:new Map,cycleCount:y}},[p,y]),Ft=N.useMemo(()=>R.current.slice(0,D).map(pt=>({engineSnapshot:pt.snapshotId,metadata:pt.cycle})),[D]);return{outputs:K,inputs:B,cycleCount:y,ready:x,error:null,isSequential:u,circuit:l,portValues:d.size>0?d:null,sequentialState:Xt,componentLibrary:a,history:Ft,historyIndex:A,isViewingPast:A>=0&&A<D-1,isRunning:_,speed:k,setNode:$,toggleInput:G,toggleNode:L,setNodeValue:F,tick:et,tickN:rt,scanPort:ct,reset:ht,stepBack:ut,stepForward:dt,seek:Ot,startAutoRun:bt,stopAutoRun:Tt,setSpeed:Dt,runCombinational:()=>{},getSimulator:()=>null}}function we(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,o;n<t.length;n++)(o=we(t[n]))!==""&&(e+=(e&&" ")+o);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var kM={value:()=>{}};function Bl(){for(var t=0,e=arguments.length,n={},o;t<e;++t){if(!(o=arguments[t]+"")||o in n||/[\s.]/.test(o))throw new Error("illegal type: "+o);n[o]=[]}return new Hl(n)}function Hl(t){this._=t}function OM(t,e){return t.trim().split(/^|\s+/).map(function(n){var o="",s=n.indexOf(".");if(s>=0&&(o=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:o}})}Hl.prototype=Bl.prototype={constructor:Hl,on:function(t,e){var n=this._,o=OM(t+"",n),s,a=-1,l=o.length;if(arguments.length<2){for(;++a<l;)if((s=(t=o[a]).type)&&(s=DM(n[s],t.name)))return s;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<l;)if(s=(t=o[a]).type)n[s]=ly(n[s],t.name,e);else if(e==null)for(s in n)n[s]=ly(n[s],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Hl(t)},call:function(t,e){if((s=arguments.length-2)>0)for(var n=new Array(s),o=0,s,a;o<s;++o)n[o]=arguments[o+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=this._[t],o=0,s=a.length;o<s;++o)a[o].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var o=this._[t],s=0,a=o.length;s<a;++s)o[s].value.apply(e,n)}};function DM(t,e){for(var n=0,o=t.length,s;n<o;++n)if((s=t[n]).name===e)return s.value}function ly(t,e,n){for(var o=0,s=t.length;o<s;++o)if(t[o].name===e){t[o]=kM,t=t.slice(0,o).concat(t.slice(o+1));break}return n!=null&&t.push({name:e,value:n}),t}var fd="http://www.w3.org/1999/xhtml";const cy={svg:"http://www.w3.org/2000/svg",xhtml:fd,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ul(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),cy.hasOwnProperty(e)?{space:cy[e],local:t}:t}function jM(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===fd&&e.documentElement.namespaceURI===fd?e.createElement(t):e.createElementNS(n,t)}}function zM(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function uy(t){var e=Ul(t);return(e.local?zM:jM)(e)}function VM(){}function dd(t){return t==null?VM:function(){return this.querySelector(t)}}function LM(t){typeof t!="function"&&(t=dd(t));for(var e=this._groups,n=e.length,o=new Array(n),s=0;s<n;++s)for(var a=e[s],l=a.length,u=o[s]=new Array(l),d,h,p=0;p<l;++p)(d=a[p])&&(h=t.call(d,d.__data__,p,a))&&("__data__"in d&&(h.__data__=d.__data__),u[p]=h);return new rn(o,this._parents)}function IM(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function PM(){return[]}function fy(t){return t==null?PM:function(){return this.querySelectorAll(t)}}function BM(t){return function(){return IM(t.apply(this,arguments))}}function HM(t){typeof t=="function"?t=BM(t):t=fy(t);for(var e=this._groups,n=e.length,o=[],s=[],a=0;a<n;++a)for(var l=e[a],u=l.length,d,h=0;h<u;++h)(d=l[h])&&(o.push(t.call(d,d.__data__,h,l)),s.push(d));return new rn(o,s)}function dy(t){return function(){return this.matches(t)}}function hy(t){return function(e){return e.matches(t)}}var UM=Array.prototype.find;function $M(t){return function(){return UM.call(this.children,t)}}function YM(){return this.firstElementChild}function qM(t){return this.select(t==null?YM:$M(typeof t=="function"?t:hy(t)))}var GM=Array.prototype.filter;function FM(){return Array.from(this.children)}function XM(t){return function(){return GM.call(this.children,t)}}function ZM(t){return this.selectAll(t==null?FM:XM(typeof t=="function"?t:hy(t)))}function KM(t){typeof t!="function"&&(t=dy(t));for(var e=this._groups,n=e.length,o=new Array(n),s=0;s<n;++s)for(var a=e[s],l=a.length,u=o[s]=[],d,h=0;h<l;++h)(d=a[h])&&t.call(d,d.__data__,h,a)&&u.push(d);return new rn(o,this._parents)}function py(t){return new Array(t.length)}function QM(){return new rn(this._enter||this._groups.map(py),this._parents)}function $l(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}$l.prototype={constructor:$l,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function WM(t){return function(){return t}}function JM(t,e,n,o,s,a){for(var l=0,u,d=e.length,h=a.length;l<h;++l)(u=e[l])?(u.__data__=a[l],o[l]=u):n[l]=new $l(t,a[l]);for(;l<d;++l)(u=e[l])&&(s[l]=u)}function t3(t,e,n,o,s,a,l){var u,d,h=new Map,p=e.length,m=a.length,y=new Array(p),b;for(u=0;u<p;++u)(d=e[u])&&(y[u]=b=l.call(d,d.__data__,u,e)+"",h.has(b)?s[u]=d:h.set(b,d));for(u=0;u<m;++u)b=l.call(t,a[u],u,a)+"",(d=h.get(b))?(o[u]=d,d.__data__=a[u],h.delete(b)):n[u]=new $l(t,a[u]);for(u=0;u<p;++u)(d=e[u])&&h.get(y[u])===d&&(s[u]=d)}function e3(t){return t.__data__}function n3(t,e){if(!arguments.length)return Array.from(this,e3);var n=e?t3:JM,o=this._parents,s=this._groups;typeof t!="function"&&(t=WM(t));for(var a=s.length,l=new Array(a),u=new Array(a),d=new Array(a),h=0;h<a;++h){var p=o[h],m=s[h],y=m.length,b=i3(t.call(p,p&&p.__data__,h,o)),x=b.length,w=u[h]=new Array(x),_=l[h]=new Array(x),S=d[h]=new Array(y);n(p,m,w,_,S,b,e);for(var k=0,C=0,E,R;k<x;++k)if(E=w[k]){for(k>=C&&(C=k+1);!(R=_[C])&&++C<x;);E._next=R||null}}return l=new rn(l,o),l._enter=u,l._exit=d,l}function i3(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function o3(){return new rn(this._exit||this._groups.map(py),this._parents)}function r3(t,e,n){var o=this.enter(),s=this,a=this.exit();return typeof t=="function"?(o=t(o),o&&(o=o.selection())):o=o.append(t+""),e!=null&&(s=e(s),s&&(s=s.selection())),n==null?a.remove():n(a),o&&s?o.merge(s).order():s}function s3(t){for(var e=t.selection?t.selection():t,n=this._groups,o=e._groups,s=n.length,a=o.length,l=Math.min(s,a),u=new Array(s),d=0;d<l;++d)for(var h=n[d],p=o[d],m=h.length,y=u[d]=new Array(m),b,x=0;x<m;++x)(b=h[x]||p[x])&&(y[x]=b);for(;d<s;++d)u[d]=n[d];return new rn(u,this._parents)}function a3(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var o=t[e],s=o.length-1,a=o[s],l;--s>=0;)(l=o[s])&&(a&&l.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(l,a),a=l);return this}function l3(t){t||(t=c3);function e(m,y){return m&&y?t(m.__data__,y.__data__):!m-!y}for(var n=this._groups,o=n.length,s=new Array(o),a=0;a<o;++a){for(var l=n[a],u=l.length,d=s[a]=new Array(u),h,p=0;p<u;++p)(h=l[p])&&(d[p]=h);d.sort(e)}return new rn(s,this._parents).order()}function c3(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function u3(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function f3(){return Array.from(this)}function d3(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],s=0,a=o.length;s<a;++s){var l=o[s];if(l)return l}return null}function h3(){let t=0;for(const e of this)++t;return t}function p3(){return!this.node()}function m3(t){for(var e=this._groups,n=0,o=e.length;n<o;++n)for(var s=e[n],a=0,l=s.length,u;a<l;++a)(u=s[a])&&t.call(u,u.__data__,a,s);return this}function g3(t){return function(){this.removeAttribute(t)}}function y3(t){return function(){this.removeAttributeNS(t.space,t.local)}}function v3(t,e){return function(){this.setAttribute(t,e)}}function b3(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function x3(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function w3(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function _3(t,e){var n=Ul(t);if(arguments.length<2){var o=this.node();return n.local?o.getAttributeNS(n.space,n.local):o.getAttribute(n)}return this.each((e==null?n.local?y3:g3:typeof e=="function"?n.local?w3:x3:n.local?b3:v3)(n,e))}function my(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function S3(t){return function(){this.style.removeProperty(t)}}function E3(t,e,n){return function(){this.style.setProperty(t,e,n)}}function C3(t,e,n){return function(){var o=e.apply(this,arguments);o==null?this.style.removeProperty(t):this.style.setProperty(t,o,n)}}function T3(t,e,n){return arguments.length>1?this.each((e==null?S3:typeof e=="function"?C3:E3)(t,e,n??"")):_r(this.node(),t)}function _r(t,e){return t.style.getPropertyValue(e)||my(t).getComputedStyle(t,null).getPropertyValue(e)}function N3(t){return function(){delete this[t]}}function A3(t,e){return function(){this[t]=e}}function M3(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function R3(t,e){return arguments.length>1?this.each((e==null?N3:typeof e=="function"?M3:A3)(t,e)):this.node()[t]}function gy(t){return t.trim().split(/^|\s+/)}function hd(t){return t.classList||new yy(t)}function yy(t){this._node=t,this._names=gy(t.getAttribute("class")||"")}yy.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function vy(t,e){for(var n=hd(t),o=-1,s=e.length;++o<s;)n.add(e[o])}function by(t,e){for(var n=hd(t),o=-1,s=e.length;++o<s;)n.remove(e[o])}function k3(t){return function(){vy(this,t)}}function O3(t){return function(){by(this,t)}}function D3(t,e){return function(){(e.apply(this,arguments)?vy:by)(this,t)}}function j3(t,e){var n=gy(t+"");if(arguments.length<2){for(var o=hd(this.node()),s=-1,a=n.length;++s<a;)if(!o.contains(n[s]))return!1;return!0}return this.each((typeof e=="function"?D3:e?k3:O3)(n,e))}function z3(){this.textContent=""}function V3(t){return function(){this.textContent=t}}function L3(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function I3(t){return arguments.length?this.each(t==null?z3:(typeof t=="function"?L3:V3)(t)):this.node().textContent}function P3(){this.innerHTML=""}function B3(t){return function(){this.innerHTML=t}}function H3(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function U3(t){return arguments.length?this.each(t==null?P3:(typeof t=="function"?H3:B3)(t)):this.node().innerHTML}function $3(){this.nextSibling&&this.parentNode.appendChild(this)}function Y3(){return this.each($3)}function q3(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function G3(){return this.each(q3)}function F3(t){var e=typeof t=="function"?t:uy(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function X3(){return null}function Z3(t,e){var n=typeof t=="function"?t:uy(t),o=e==null?X3:typeof e=="function"?e:dd(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),o.apply(this,arguments)||null)})}function K3(){var t=this.parentNode;t&&t.removeChild(this)}function Q3(){return this.each(K3)}function W3(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function J3(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function tR(t){return this.select(t?J3:W3)}function eR(t){return arguments.length?this.property("__data__",t):this.node().__data__}function nR(t){return function(e){t.call(this,e,this.__data__)}}function iR(t){return t.trim().split(/^|\s+/).map(function(e){var n="",o=e.indexOf(".");return o>=0&&(n=e.slice(o+1),e=e.slice(0,o)),{type:e,name:n}})}function oR(t){return function(){var e=this.__on;if(e){for(var n=0,o=-1,s=e.length,a;n<s;++n)a=e[n],(!t.type||a.type===t.type)&&a.name===t.name?this.removeEventListener(a.type,a.listener,a.options):e[++o]=a;++o?e.length=o:delete this.__on}}}function rR(t,e,n){return function(){var o=this.__on,s,a=nR(e);if(o){for(var l=0,u=o.length;l<u;++l)if((s=o[l]).type===t.type&&s.name===t.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=a,s.options=n),s.value=e;return}}this.addEventListener(t.type,a,n),s={type:t.type,name:t.name,value:e,listener:a,options:n},o?o.push(s):this.__on=[s]}}function sR(t,e,n){var o=iR(t+""),s,a=o.length,l;if(arguments.length<2){var u=this.node().__on;if(u){for(var d=0,h=u.length,p;d<h;++d)for(s=0,p=u[d];s<a;++s)if((l=o[s]).type===p.type&&l.name===p.name)return p.value}return}for(u=e?rR:oR,s=0;s<a;++s)this.each(u(o[s],e,n));return this}function xy(t,e,n){var o=my(t),s=o.CustomEvent;typeof s=="function"?s=new s(e,n):(s=o.document.createEvent("Event"),n?(s.initEvent(e,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(e,!1,!1)),t.dispatchEvent(s)}function aR(t,e){return function(){return xy(this,t,e)}}function lR(t,e){return function(){return xy(this,t,e.apply(this,arguments))}}function cR(t,e){return this.each((typeof e=="function"?lR:aR)(t,e))}function*uR(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var o=t[e],s=0,a=o.length,l;s<a;++s)(l=o[s])&&(yield l)}var wy=[null];function rn(t,e){this._groups=t,this._parents=e}function Ys(){return new rn([[document.documentElement]],wy)}function fR(){return this}rn.prototype=Ys.prototype={constructor:rn,select:LM,selectAll:HM,selectChild:qM,selectChildren:ZM,filter:KM,data:n3,enter:QM,exit:o3,join:r3,merge:s3,selection:fR,order:a3,sort:l3,call:u3,nodes:f3,node:d3,size:h3,empty:p3,each:m3,attr:_3,style:T3,property:R3,classed:j3,text:I3,html:U3,raise:Y3,lower:G3,append:F3,insert:Z3,remove:Q3,clone:tR,datum:eR,on:sR,dispatch:cR,[Symbol.iterator]:uR};function sn(t){return typeof t=="string"?new rn([[document.querySelector(t)]],[document.documentElement]):new rn([[t]],wy)}function dR(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Mn(t,e){if(t=dR(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var o=n.createSVGPoint();return o.x=t.clientX,o.y=t.clientY,o=o.matrixTransform(e.getScreenCTM().inverse()),[o.x,o.y]}if(e.getBoundingClientRect){var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}}return[t.pageX,t.pageY]}const hR={passive:!1},qs={capture:!0,passive:!1};function pd(t){t.stopImmediatePropagation()}function Sr(t){t.preventDefault(),t.stopImmediatePropagation()}function _y(t){var e=t.document.documentElement,n=sn(t).on("dragstart.drag",Sr,qs);"onselectstart"in e?n.on("selectstart.drag",Sr,qs):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Sy(t,e){var n=t.document.documentElement,o=sn(t).on("dragstart.drag",null);e&&(o.on("click.drag",Sr,qs),setTimeout(function(){o.on("click.drag",null)},0)),"onselectstart"in n?o.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const Yl=t=>()=>t;function md(t,{sourceEvent:e,subject:n,target:o,identifier:s,active:a,x:l,y:u,dx:d,dy:h,dispatch:p}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:l,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:p}})}md.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function pR(t){return!t.ctrlKey&&!t.button}function mR(){return this.parentNode}function gR(t,e){return e??{x:t.x,y:t.y}}function yR(){return navigator.maxTouchPoints||"ontouchstart"in this}function Ey(){var t=pR,e=mR,n=gR,o=yR,s={},a=Bl("start","drag","end"),l=0,u,d,h,p,m=0;function y(E){E.on("mousedown.drag",b).filter(o).on("touchstart.drag",_).on("touchmove.drag",S,hR).on("touchend.drag touchcancel.drag",k).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function b(E,R){if(!(p||!t.call(this,E,R))){var A=C(this,e.call(this,E,R),E,R,"mouse");A&&(sn(E.view).on("mousemove.drag",x,qs).on("mouseup.drag",w,qs),_y(E.view),pd(E),h=!1,u=E.clientX,d=E.clientY,A("start",E))}}function x(E){if(Sr(E),!h){var R=E.clientX-u,A=E.clientY-d;h=R*R+A*A>m}s.mouse("drag",E)}function w(E){sn(E.view).on("mousemove.drag mouseup.drag",null),Sy(E.view,h),Sr(E),s.mouse("end",E)}function _(E,R){if(t.call(this,E,R)){var A=E.changedTouches,O=e.call(this,E,R),D=A.length,U,q;for(U=0;U<D;++U)(q=C(this,O,E,R,A[U].identifier,A[U]))&&(pd(E),q("start",E,A[U]))}}function S(E){var R=E.changedTouches,A=R.length,O,D;for(O=0;O<A;++O)(D=s[R[O].identifier])&&(Sr(E),D("drag",E,R[O]))}function k(E){var R=E.changedTouches,A=R.length,O,D;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),O=0;O<A;++O)(D=s[R[O].identifier])&&(pd(E),D("end",E,R[O]))}function C(E,R,A,O,D,U){var q=a.copy(),Y=Mn(U||A,R),K,W,B;if((B=n.call(E,new md("beforestart",{sourceEvent:A,target:y,identifier:D,active:l,x:Y[0],y:Y[1],dx:0,dy:0,dispatch:q}),O))!=null)return K=B.x-Y[0]||0,W=B.y-Y[1]||0,function H(j,I,z){var $=Y,G;switch(j){case"start":s[D]=H,G=l++;break;case"end":delete s[D],--l;case"drag":Y=Mn(z||I,R),G=l;break}q.call(j,E,new md(j,{sourceEvent:I,subject:B,target:y,identifier:D,active:G,x:Y[0]+K,y:Y[1]+W,dx:Y[0]-$[0],dy:Y[1]-$[1],dispatch:q}),O)}}return y.filter=function(E){return arguments.length?(t=typeof E=="function"?E:Yl(!!E),y):t},y.container=function(E){return arguments.length?(e=typeof E=="function"?E:Yl(E),y):e},y.subject=function(E){return arguments.length?(n=typeof E=="function"?E:Yl(E),y):n},y.touchable=function(E){return arguments.length?(o=typeof E=="function"?E:Yl(!!E),y):o},y.on=function(){var E=a.on.apply(a,arguments);return E===a?y:E},y.clickDistance=function(E){return arguments.length?(m=(E=+E)*E,y):Math.sqrt(m)},y}function gd(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Cy(t,e){var n=Object.create(t.prototype);for(var o in e)n[o]=e[o];return n}function Gs(){}var Fs=.7,ql=1/Fs,Er="\\s*([+-]?\\d+)\\s*",Xs="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Fn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",vR=/^#([0-9a-f]{3,8})$/,bR=new RegExp(`^rgb\\(${Er},${Er},${Er}\\)$`),xR=new RegExp(`^rgb\\(${Fn},${Fn},${Fn}\\)$`),wR=new RegExp(`^rgba\\(${Er},${Er},${Er},${Xs}\\)$`),_R=new RegExp(`^rgba\\(${Fn},${Fn},${Fn},${Xs}\\)$`),SR=new RegExp(`^hsl\\(${Xs},${Fn},${Fn}\\)$`),ER=new RegExp(`^hsla\\(${Xs},${Fn},${Fn},${Xs}\\)$`),Ty={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};gd(Gs,zo,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ny,formatHex:Ny,formatHex8:CR,formatHsl:TR,formatRgb:Ay,toString:Ay});function Ny(){return this.rgb().formatHex()}function CR(){return this.rgb().formatHex8()}function TR(){return Dy(this).formatHsl()}function Ay(){return this.rgb().formatRgb()}function zo(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=vR.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?My(e):n===3?new Xe(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Gl(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Gl(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=bR.exec(t))?new Xe(e[1],e[2],e[3],1):(e=xR.exec(t))?new Xe(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=wR.exec(t))?Gl(e[1],e[2],e[3],e[4]):(e=_R.exec(t))?Gl(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=SR.exec(t))?Oy(e[1],e[2]/100,e[3]/100,1):(e=ER.exec(t))?Oy(e[1],e[2]/100,e[3]/100,e[4]):Ty.hasOwnProperty(t)?My(Ty[t]):t==="transparent"?new Xe(NaN,NaN,NaN,0):null}function My(t){return new Xe(t>>16&255,t>>8&255,t&255,1)}function Gl(t,e,n,o){return o<=0&&(t=e=n=NaN),new Xe(t,e,n,o)}function NR(t){return t instanceof Gs||(t=zo(t)),t?(t=t.rgb(),new Xe(t.r,t.g,t.b,t.opacity)):new Xe}function yd(t,e,n,o){return arguments.length===1?NR(t):new Xe(t,e,n,o??1)}function Xe(t,e,n,o){this.r=+t,this.g=+e,this.b=+n,this.opacity=+o}gd(Xe,yd,Cy(Gs,{brighter(t){return t=t==null?ql:Math.pow(ql,t),new Xe(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?Fs:Math.pow(Fs,t),new Xe(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new Xe(Vo(this.r),Vo(this.g),Vo(this.b),Fl(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:Ry,formatHex:Ry,formatHex8:AR,formatRgb:ky,toString:ky}));function Ry(){return`#${Lo(this.r)}${Lo(this.g)}${Lo(this.b)}`}function AR(){return`#${Lo(this.r)}${Lo(this.g)}${Lo(this.b)}${Lo((isNaN(this.opacity)?1:this.opacity)*255)}`}function ky(){const t=Fl(this.opacity);return`${t===1?"rgb(":"rgba("}${Vo(this.r)}, ${Vo(this.g)}, ${Vo(this.b)}${t===1?")":`, ${t})`}`}function Fl(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Vo(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Lo(t){return t=Vo(t),(t<16?"0":"")+t.toString(16)}function Oy(t,e,n,o){return o<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Rn(t,e,n,o)}function Dy(t){if(t instanceof Rn)return new Rn(t.h,t.s,t.l,t.opacity);if(t instanceof Gs||(t=zo(t)),!t)return new Rn;if(t instanceof Rn)return t;t=t.rgb();var e=t.r/255,n=t.g/255,o=t.b/255,s=Math.min(e,n,o),a=Math.max(e,n,o),l=NaN,u=a-s,d=(a+s)/2;return u?(e===a?l=(n-o)/u+(n<o)*6:n===a?l=(o-e)/u+2:l=(e-n)/u+4,u/=d<.5?a+s:2-a-s,l*=60):u=d>0&&d<1?0:l,new Rn(l,u,d,t.opacity)}function MR(t,e,n,o){return arguments.length===1?Dy(t):new Rn(t,e,n,o??1)}function Rn(t,e,n,o){this.h=+t,this.s=+e,this.l=+n,this.opacity=+o}gd(Rn,MR,Cy(Gs,{brighter(t){return t=t==null?ql:Math.pow(ql,t),new Rn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?Fs:Math.pow(Fs,t),new Rn(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,o=n+(n<.5?n:1-n)*e,s=2*n-o;return new Xe(vd(t>=240?t-240:t+120,s,o),vd(t,s,o),vd(t<120?t+240:t-120,s,o),this.opacity)},clamp(){return new Rn(jy(this.h),Xl(this.s),Xl(this.l),Fl(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 t=Fl(this.opacity);return`${t===1?"hsl(":"hsla("}${jy(this.h)}, ${Xl(this.s)*100}%, ${Xl(this.l)*100}%${t===1?")":`, ${t})`}`}}));function jy(t){return t=(t||0)%360,t<0?t+360:t}function Xl(t){return Math.max(0,Math.min(1,t||0))}function vd(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const bd=t=>()=>t;function RR(t,e){return function(n){return t+n*e}}function kR(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(o){return Math.pow(t+o*e,n)}}function OR(t){return(t=+t)==1?zy:function(e,n){return n-e?kR(e,n,t):bd(isNaN(e)?n:e)}}function zy(t,e){var n=e-t;return n?RR(t,n):bd(isNaN(t)?e:t)}const Zl=(function t(e){var n=OR(e);function o(s,a){var l=n((s=yd(s)).r,(a=yd(a)).r),u=n(s.g,a.g),d=n(s.b,a.b),h=zy(s.opacity,a.opacity);return function(p){return s.r=l(p),s.g=u(p),s.b=d(p),s.opacity=h(p),s+""}}return o.gamma=t,o})(1);function DR(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,o=e.slice(),s;return function(a){for(s=0;s<n;++s)o[s]=t[s]*(1-a)+e[s]*a;return o}}function jR(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function zR(t,e){var n=e?e.length:0,o=t?Math.min(n,t.length):0,s=new Array(o),a=new Array(n),l;for(l=0;l<o;++l)s[l]=Zs(t[l],e[l]);for(;l<n;++l)a[l]=e[l];return function(u){for(l=0;l<o;++l)a[l]=s[l](u);return a}}function VR(t,e){var n=new Date;return t=+t,e=+e,function(o){return n.setTime(t*(1-o)+e*o),n}}function Xn(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function LR(t,e){var n={},o={},s;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(s in e)s in t?n[s]=Zs(t[s],e[s]):o[s]=e[s];return function(a){for(s in n)o[s]=n[s](a);return o}}var xd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wd=new RegExp(xd.source,"g");function IR(t){return function(){return t}}function PR(t){return function(e){return t(e)+""}}function Vy(t,e){var n=xd.lastIndex=wd.lastIndex=0,o,s,a,l=-1,u=[],d=[];for(t=t+"",e=e+"";(o=xd.exec(t))&&(s=wd.exec(e));)(a=s.index)>n&&(a=e.slice(n,a),u[l]?u[l]+=a:u[++l]=a),(o=o[0])===(s=s[0])?u[l]?u[l]+=s:u[++l]=s:(u[++l]=null,d.push({i:l,x:Xn(o,s)})),n=wd.lastIndex;return n<e.length&&(a=e.slice(n),u[l]?u[l]+=a:u[++l]=a),u.length<2?d[0]?PR(d[0].x):IR(e):(e=d.length,function(h){for(var p=0,m;p<e;++p)u[(m=d[p]).i]=m.x(h);return u.join("")})}function Zs(t,e){var n=typeof e,o;return e==null||n==="boolean"?bd(e):(n==="number"?Xn:n==="string"?(o=zo(e))?(e=o,Zl):Vy:e instanceof zo?Zl:e instanceof Date?VR:jR(e)?DR:Array.isArray(e)?zR:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?LR:Xn)(t,e)}var Ly=180/Math.PI,_d={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Iy(t,e,n,o,s,a){var l,u,d;return(l=Math.sqrt(t*t+e*e))&&(t/=l,e/=l),(d=t*n+e*o)&&(n-=t*d,o-=e*d),(u=Math.sqrt(n*n+o*o))&&(n/=u,o/=u,d/=u),t*o<e*n&&(t=-t,e=-e,d=-d,l=-l),{translateX:s,translateY:a,rotate:Math.atan2(e,t)*Ly,skewX:Math.atan(d)*Ly,scaleX:l,scaleY:u}}var Kl;function BR(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?_d:Iy(e.a,e.b,e.c,e.d,e.e,e.f)}function HR(t){return t==null||(Kl||(Kl=document.createElementNS("http://www.w3.org/2000/svg","g")),Kl.setAttribute("transform",t),!(t=Kl.transform.baseVal.consolidate()))?_d:(t=t.matrix,Iy(t.a,t.b,t.c,t.d,t.e,t.f))}function Py(t,e,n,o){function s(h){return h.length?h.pop()+" ":""}function a(h,p,m,y,b,x){if(h!==m||p!==y){var w=b.push("translate(",null,e,null,n);x.push({i:w-4,x:Xn(h,m)},{i:w-2,x:Xn(p,y)})}else(m||y)&&b.push("translate("+m+e+y+n)}function l(h,p,m,y){h!==p?(h-p>180?p+=360:p-h>180&&(h+=360),y.push({i:m.push(s(m)+"rotate(",null,o)-2,x:Xn(h,p)})):p&&m.push(s(m)+"rotate("+p+o)}function u(h,p,m,y){h!==p?y.push({i:m.push(s(m)+"skewX(",null,o)-2,x:Xn(h,p)}):p&&m.push(s(m)+"skewX("+p+o)}function d(h,p,m,y,b,x){if(h!==m||p!==y){var w=b.push(s(b)+"scale(",null,",",null,")");x.push({i:w-4,x:Xn(h,m)},{i:w-2,x:Xn(p,y)})}else(m!==1||y!==1)&&b.push(s(b)+"scale("+m+","+y+")")}return function(h,p){var m=[],y=[];return h=t(h),p=t(p),a(h.translateX,h.translateY,p.translateX,p.translateY,m,y),l(h.rotate,p.rotate,m,y),u(h.skewX,p.skewX,m,y),d(h.scaleX,h.scaleY,p.scaleX,p.scaleY,m,y),h=p=null,function(b){for(var x=-1,w=y.length,_;++x<w;)m[(_=y[x]).i]=_.x(b);return m.join("")}}}var UR=Py(BR,"px, ","px)","deg)"),$R=Py(HR,", ",")",")"),YR=1e-12;function By(t){return((t=Math.exp(t))+1/t)/2}function qR(t){return((t=Math.exp(t))-1/t)/2}function GR(t){return((t=Math.exp(2*t))-1)/(t+1)}const Ql=(function t(e,n,o){function s(a,l){var u=a[0],d=a[1],h=a[2],p=l[0],m=l[1],y=l[2],b=p-u,x=m-d,w=b*b+x*x,_,S;if(w<YR)S=Math.log(y/h)/e,_=function(O){return[u+O*b,d+O*x,h*Math.exp(e*O*S)]};else{var k=Math.sqrt(w),C=(y*y-h*h+o*w)/(2*h*n*k),E=(y*y-h*h-o*w)/(2*y*n*k),R=Math.log(Math.sqrt(C*C+1)-C),A=Math.log(Math.sqrt(E*E+1)-E);S=(A-R)/e,_=function(O){var D=O*S,U=By(R),q=h/(n*k)*(U*GR(e*D+R)-qR(R));return[u+q*b,d+q*x,h*U/By(e*D+R)]}}return _.duration=S*1e3*e/Math.SQRT2,_}return s.rho=function(a){var l=Math.max(.001,+a),u=l*l,d=u*u;return t(l,u,d)},s})(Math.SQRT2,2,4);var Cr=0,Ks=0,Qs=0,Hy=1e3,Wl,Ws,Jl=0,Io=0,tc=0,Js=typeof performance=="object"&&performance.now?performance:Date,Uy=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function Sd(){return Io||(Uy(FR),Io=Js.now()+tc)}function FR(){Io=0}function ec(){this._call=this._time=this._next=null}ec.prototype=$y.prototype={constructor:ec,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?Sd():+n)+(e==null?0:+e),!this._next&&Ws!==this&&(Ws?Ws._next=this:Wl=this,Ws=this),this._call=t,this._time=n,Ed()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ed())}};function $y(t,e,n){var o=new ec;return o.restart(t,e,n),o}function XR(){Sd(),++Cr;for(var t=Wl,e;t;)(e=Io-t._time)>=0&&t._call.call(void 0,e),t=t._next;--Cr}function Yy(){Io=(Jl=Js.now())+tc,Cr=Ks=0;try{XR()}finally{Cr=0,KR(),Io=0}}function ZR(){var t=Js.now(),e=t-Jl;e>Hy&&(tc-=e,Jl=t)}function KR(){for(var t,e=Wl,n,o=1/0;e;)e._call?(o>e._time&&(o=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:Wl=n);Ws=t,Ed(o)}function Ed(t){if(!Cr){Ks&&(Ks=clearTimeout(Ks));var e=t-Io;e>24?(t<1/0&&(Ks=setTimeout(Yy,t-Js.now()-tc)),Qs&&(Qs=clearInterval(Qs))):(Qs||(Jl=Js.now(),Qs=setInterval(ZR,Hy)),Cr=1,Uy(Yy))}}function qy(t,e,n){var o=new ec;return e=e==null?0:+e,o.restart(s=>{o.stop(),t(s+e)},e,n),o}var QR=Bl("start","end","cancel","interrupt"),WR=[],Gy=0,Fy=1,Cd=2,nc=3,Xy=4,Td=5,ic=6;function oc(t,e,n,o,s,a){var l=t.__transition;if(!l)t.__transition={};else if(n in l)return;JR(t,n,{name:e,index:o,group:s,on:QR,tween:WR,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Gy})}function Nd(t,e){var n=kn(t,e);if(n.state>Gy)throw new Error("too late; already scheduled");return n}function Zn(t,e){var n=kn(t,e);if(n.state>nc)throw new Error("too late; already running");return n}function kn(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function JR(t,e,n){var o=t.__transition,s;o[e]=n,n.timer=$y(a,0,n.time);function a(h){n.state=Fy,n.timer.restart(l,n.delay,n.time),n.delay<=h&&l(h-n.delay)}function l(h){var p,m,y,b;if(n.state!==Fy)return d();for(p in o)if(b=o[p],b.name===n.name){if(b.state===nc)return qy(l);b.state===Xy?(b.state=ic,b.timer.stop(),b.on.call("interrupt",t,t.__data__,b.index,b.group),delete o[p]):+p<e&&(b.state=ic,b.timer.stop(),b.on.call("cancel",t,t.__data__,b.index,b.group),delete o[p])}if(qy(function(){n.state===nc&&(n.state=Xy,n.timer.restart(u,n.delay,n.time),u(h))}),n.state=Cd,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Cd){for(n.state=nc,s=new Array(y=n.tween.length),p=0,m=-1;p<y;++p)(b=n.tween[p].value.call(t,t.__data__,n.index,n.group))&&(s[++m]=b);s.length=m+1}}function u(h){for(var p=h<n.duration?n.ease.call(null,h/n.duration):(n.timer.restart(d),n.state=Td,1),m=-1,y=s.length;++m<y;)s[m].call(t,p);n.state===Td&&(n.on.call("end",t,t.__data__,n.index,n.group),d())}function d(){n.state=ic,n.timer.stop(),delete o[e];for(var h in o)return;delete t.__transition}}function rc(t,e){var n=t.__transition,o,s,a=!0,l;if(n){e=e==null?null:e+"";for(l in n){if((o=n[l]).name!==e){a=!1;continue}s=o.state>Cd&&o.state<Td,o.state=ic,o.timer.stop(),o.on.call(s?"interrupt":"cancel",t,t.__data__,o.index,o.group),delete n[l]}a&&delete t.__transition}}function tk(t){return this.each(function(){rc(this,t)})}function ek(t,e){var n,o;return function(){var s=Zn(this,t),a=s.tween;if(a!==n){o=n=a;for(var l=0,u=o.length;l<u;++l)if(o[l].name===e){o=o.slice(),o.splice(l,1);break}}s.tween=o}}function nk(t,e,n){var o,s;if(typeof n!="function")throw new Error;return function(){var a=Zn(this,t),l=a.tween;if(l!==o){s=(o=l).slice();for(var u={name:e,value:n},d=0,h=s.length;d<h;++d)if(s[d].name===e){s[d]=u;break}d===h&&s.push(u)}a.tween=s}}function ik(t,e){var n=this._id;if(t+="",arguments.length<2){for(var o=kn(this.node(),n).tween,s=0,a=o.length,l;s<a;++s)if((l=o[s]).name===t)return l.value;return null}return this.each((e==null?ek:nk)(n,t,e))}function Ad(t,e,n){var o=t._id;return t.each(function(){var s=Zn(this,o);(s.value||(s.value={}))[e]=n.apply(this,arguments)}),function(s){return kn(s,o).value[e]}}function Zy(t,e){var n;return(typeof e=="number"?Xn:e instanceof zo?Zl:(n=zo(e))?(e=n,Zl):Vy)(t,e)}function ok(t){return function(){this.removeAttribute(t)}}function rk(t){return function(){this.removeAttributeNS(t.space,t.local)}}function sk(t,e,n){var o,s=n+"",a;return function(){var l=this.getAttribute(t);return l===s?null:l===o?a:a=e(o=l,n)}}function ak(t,e,n){var o,s=n+"",a;return function(){var l=this.getAttributeNS(t.space,t.local);return l===s?null:l===o?a:a=e(o=l,n)}}function lk(t,e,n){var o,s,a;return function(){var l,u=n(this),d;return u==null?void this.removeAttribute(t):(l=this.getAttribute(t),d=u+"",l===d?null:l===o&&d===s?a:(s=d,a=e(o=l,u)))}}function ck(t,e,n){var o,s,a;return function(){var l,u=n(this),d;return u==null?void this.removeAttributeNS(t.space,t.local):(l=this.getAttributeNS(t.space,t.local),d=u+"",l===d?null:l===o&&d===s?a:(s=d,a=e(o=l,u)))}}function uk(t,e){var n=Ul(t),o=n==="transform"?$R:Zy;return this.attrTween(t,typeof e=="function"?(n.local?ck:lk)(n,o,Ad(this,"attr."+t,e)):e==null?(n.local?rk:ok)(n):(n.local?ak:sk)(n,o,e))}function fk(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function dk(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function hk(t,e){var n,o;function s(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&dk(t,a)),n}return s._value=e,s}function pk(t,e){var n,o;function s(){var a=e.apply(this,arguments);return a!==o&&(n=(o=a)&&fk(t,a)),n}return s._value=e,s}function mk(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var o=Ul(t);return this.tween(n,(o.local?hk:pk)(o,e))}function gk(t,e){return function(){Nd(this,t).delay=+e.apply(this,arguments)}}function yk(t,e){return e=+e,function(){Nd(this,t).delay=e}}function vk(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?gk:yk)(e,t)):kn(this.node(),e).delay}function bk(t,e){return function(){Zn(this,t).duration=+e.apply(this,arguments)}}function xk(t,e){return e=+e,function(){Zn(this,t).duration=e}}function wk(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?bk:xk)(e,t)):kn(this.node(),e).duration}function _k(t,e){if(typeof e!="function")throw new Error;return function(){Zn(this,t).ease=e}}function Sk(t){var e=this._id;return arguments.length?this.each(_k(e,t)):kn(this.node(),e).ease}function Ek(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;Zn(this,t).ease=n}}function Ck(t){if(typeof t!="function")throw new Error;return this.each(Ek(this._id,t))}function Tk(t){typeof t!="function"&&(t=dy(t));for(var e=this._groups,n=e.length,o=new Array(n),s=0;s<n;++s)for(var a=e[s],l=a.length,u=o[s]=[],d,h=0;h<l;++h)(d=a[h])&&t.call(d,d.__data__,h,a)&&u.push(d);return new ui(o,this._parents,this._name,this._id)}function Nk(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,o=e.length,s=n.length,a=Math.min(o,s),l=new Array(o),u=0;u<a;++u)for(var d=e[u],h=n[u],p=d.length,m=l[u]=new Array(p),y,b=0;b<p;++b)(y=d[b]||h[b])&&(m[b]=y);for(;u<o;++u)l[u]=e[u];return new ui(l,this._parents,this._name,this._id)}function Ak(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function Mk(t,e,n){var o,s,a=Ak(e)?Nd:Zn;return function(){var l=a(this,t),u=l.on;u!==o&&(s=(o=u).copy()).on(e,n),l.on=s}}function Rk(t,e){var n=this._id;return arguments.length<2?kn(this.node(),n).on.on(t):this.each(Mk(n,t,e))}function kk(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Ok(){return this.on("end.remove",kk(this._id))}function Dk(t){var e=this._name,n=this._id;typeof t!="function"&&(t=dd(t));for(var o=this._groups,s=o.length,a=new Array(s),l=0;l<s;++l)for(var u=o[l],d=u.length,h=a[l]=new Array(d),p,m,y=0;y<d;++y)(p=u[y])&&(m=t.call(p,p.__data__,y,u))&&("__data__"in p&&(m.__data__=p.__data__),h[y]=m,oc(h[y],e,n,y,h,kn(p,n)));return new ui(a,this._parents,e,n)}function jk(t){var e=this._name,n=this._id;typeof t!="function"&&(t=fy(t));for(var o=this._groups,s=o.length,a=[],l=[],u=0;u<s;++u)for(var d=o[u],h=d.length,p,m=0;m<h;++m)if(p=d[m]){for(var y=t.call(p,p.__data__,m,d),b,x=kn(p,n),w=0,_=y.length;w<_;++w)(b=y[w])&&oc(b,e,n,w,y,x);a.push(y),l.push(p)}return new ui(a,l,e,n)}var zk=Ys.prototype.constructor;function Vk(){return new zk(this._groups,this._parents)}function Lk(t,e){var n,o,s;return function(){var a=_r(this,t),l=(this.style.removeProperty(t),_r(this,t));return a===l?null:a===n&&l===o?s:s=e(n=a,o=l)}}function Ky(t){return function(){this.style.removeProperty(t)}}function Ik(t,e,n){var o,s=n+"",a;return function(){var l=_r(this,t);return l===s?null:l===o?a:a=e(o=l,n)}}function Pk(t,e,n){var o,s,a;return function(){var l=_r(this,t),u=n(this),d=u+"";return u==null&&(d=u=(this.style.removeProperty(t),_r(this,t))),l===d?null:l===o&&d===s?a:(s=d,a=e(o=l,u))}}function Bk(t,e){var n,o,s,a="style."+e,l="end."+a,u;return function(){var d=Zn(this,t),h=d.on,p=d.value[a]==null?u||(u=Ky(e)):void 0;(h!==n||s!==p)&&(o=(n=h).copy()).on(l,s=p),d.on=o}}function Hk(t,e,n){var o=(t+="")=="transform"?UR:Zy;return e==null?this.styleTween(t,Lk(t,o)).on("end.style."+t,Ky(t)):typeof e=="function"?this.styleTween(t,Pk(t,o,Ad(this,"style."+t,e))).each(Bk(this._id,t)):this.styleTween(t,Ik(t,o,e),n).on("end.style."+t,null)}function Uk(t,e,n){return function(o){this.style.setProperty(t,e.call(this,o),n)}}function $k(t,e,n){var o,s;function a(){var l=e.apply(this,arguments);return l!==s&&(o=(s=l)&&Uk(t,l,n)),o}return a._value=e,a}function Yk(t,e,n){var o="style."+(t+="");if(arguments.length<2)return(o=this.tween(o))&&o._value;if(e==null)return this.tween(o,null);if(typeof e!="function")throw new Error;return this.tween(o,$k(t,e,n??""))}function qk(t){return function(){this.textContent=t}}function Gk(t){return function(){var e=t(this);this.textContent=e??""}}function Fk(t){return this.tween("text",typeof t=="function"?Gk(Ad(this,"text",t)):qk(t==null?"":t+""))}function Xk(t){return function(e){this.textContent=t.call(this,e)}}function Zk(t){var e,n;function o(){var s=t.apply(this,arguments);return s!==n&&(e=(n=s)&&Xk(s)),e}return o._value=t,o}function Kk(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Zk(t))}function Qk(){for(var t=this._name,e=this._id,n=Qy(),o=this._groups,s=o.length,a=0;a<s;++a)for(var l=o[a],u=l.length,d,h=0;h<u;++h)if(d=l[h]){var p=kn(d,e);oc(d,t,n,h,l,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new ui(o,this._parents,t,n)}function Wk(){var t,e,n=this,o=n._id,s=n.size();return new Promise(function(a,l){var u={value:l},d={value:function(){--s===0&&a()}};n.each(function(){var h=Zn(this,o),p=h.on;p!==t&&(e=(t=p).copy(),e._.cancel.push(u),e._.interrupt.push(u),e._.end.push(d)),h.on=e}),s===0&&a()})}var Jk=0;function ui(t,e,n,o){this._groups=t,this._parents=e,this._name=n,this._id=o}function Qy(){return++Jk}var fi=Ys.prototype;ui.prototype={constructor:ui,select:Dk,selectAll:jk,selectChild:fi.selectChild,selectChildren:fi.selectChildren,filter:Tk,merge:Nk,selection:Vk,transition:Qk,call:fi.call,nodes:fi.nodes,node:fi.node,size:fi.size,empty:fi.empty,each:fi.each,on:Rk,attr:uk,attrTween:mk,style:Hk,styleTween:Yk,text:Fk,textTween:Kk,remove:Ok,tween:ik,delay:vk,duration:wk,ease:Sk,easeVarying:Ck,end:Wk,[Symbol.iterator]:fi[Symbol.iterator]};function tO(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var eO={time:null,delay:0,duration:250,ease:tO};function nO(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function iO(t){var e,n;t instanceof ui?(e=t._id,t=t._name):(e=Qy(),(n=eO).time=Sd(),t=t==null?null:t+"");for(var o=this._groups,s=o.length,a=0;a<s;++a)for(var l=o[a],u=l.length,d,h=0;h<u;++h)(d=l[h])&&oc(d,t,e,h,l,n||nO(d,e));return new ui(o,this._parents,t,e)}Ys.prototype.interrupt=tk,Ys.prototype.transition=iO;const sc=t=>()=>t;function oO(t,{sourceEvent:e,target:n,transform:o,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:o,enumerable:!0,configurable:!0},_:{value:s}})}function di(t,e,n){this.k=t,this.x=e,this.y=n}di.prototype={constructor:di,scale:function(t){return t===1?this:new di(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new di(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ac=new di(1,0,0);Wy.prototype=di.prototype;function Wy(t){for(;!t.__zoom;)if(!(t=t.parentNode))return ac;return t.__zoom}function Md(t){t.stopImmediatePropagation()}function ta(t){t.preventDefault(),t.stopImmediatePropagation()}function rO(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function sO(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Jy(){return this.__zoom||ac}function aO(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function lO(){return navigator.maxTouchPoints||"ontouchstart"in this}function cO(t,e,n){var o=t.invertX(e[0][0])-n[0][0],s=t.invertX(e[1][0])-n[1][0],a=t.invertY(e[0][1])-n[0][1],l=t.invertY(e[1][1])-n[1][1];return t.translate(s>o?(o+s)/2:Math.min(0,o)||Math.max(0,s),l>a?(a+l)/2:Math.min(0,a)||Math.max(0,l))}function tv(){var t=rO,e=sO,n=cO,o=aO,s=lO,a=[0,1/0],l=[[-1/0,-1/0],[1/0,1/0]],u=250,d=Ql,h=Bl("start","zoom","end"),p,m,y,b=500,x=150,w=0,_=10;function S(B){B.property("__zoom",Jy).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",U).on("dblclick.zoom",q).filter(s).on("touchstart.zoom",Y).on("touchmove.zoom",K).on("touchend.zoom touchcancel.zoom",W).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}S.transform=function(B,H,j,I){var z=B.selection?B.selection():B;z.property("__zoom",Jy),B!==z?R(B,H,j,I):z.interrupt().each(function(){A(this,arguments).event(I).start().zoom(null,typeof H=="function"?H.apply(this,arguments):H).end()})},S.scaleBy=function(B,H,j,I){S.scaleTo(B,function(){var z=this.__zoom.k,$=typeof H=="function"?H.apply(this,arguments):H;return z*$},j,I)},S.scaleTo=function(B,H,j,I){S.transform(B,function(){var z=e.apply(this,arguments),$=this.__zoom,G=j==null?E(z):typeof j=="function"?j.apply(this,arguments):j,L=$.invert(G),F=typeof H=="function"?H.apply(this,arguments):H;return n(C(k($,F),G,L),z,l)},j,I)},S.translateBy=function(B,H,j,I){S.transform(B,function(){return n(this.__zoom.translate(typeof H=="function"?H.apply(this,arguments):H,typeof j=="function"?j.apply(this,arguments):j),e.apply(this,arguments),l)},null,I)},S.translateTo=function(B,H,j,I,z){S.transform(B,function(){var $=e.apply(this,arguments),G=this.__zoom,L=I==null?E($):typeof I=="function"?I.apply(this,arguments):I;return n(ac.translate(L[0],L[1]).scale(G.k).translate(typeof H=="function"?-H.apply(this,arguments):-H,typeof j=="function"?-j.apply(this,arguments):-j),$,l)},I,z)};function k(B,H){return H=Math.max(a[0],Math.min(a[1],H)),H===B.k?B:new di(H,B.x,B.y)}function C(B,H,j){var I=H[0]-j[0]*B.k,z=H[1]-j[1]*B.k;return I===B.x&&z===B.y?B:new di(B.k,I,z)}function E(B){return[(+B[0][0]+ +B[1][0])/2,(+B[0][1]+ +B[1][1])/2]}function R(B,H,j,I){B.on("start.zoom",function(){A(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(I).end()}).tween("zoom",function(){var z=this,$=arguments,G=A(z,$).event(I),L=e.apply(z,$),F=j==null?E(L):typeof j=="function"?j.apply(z,$):j,et=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),rt=z.__zoom,ct=typeof H=="function"?H.apply(z,$):H,ht=d(rt.invert(F).concat(et/rt.k),ct.invert(F).concat(et/ct.k));return function(ft){if(ft===1)ft=ct;else{var ut=ht(ft),dt=et/ut[2];ft=new di(dt,F[0]-ut[0]*dt,F[1]-ut[1]*dt)}G.zoom(null,ft)}})}function A(B,H,j){return!j&&B.__zooming||new O(B,H)}function O(B,H){this.that=B,this.args=H,this.active=0,this.sourceEvent=null,this.extent=e.apply(B,H),this.taps=0}O.prototype={event:function(B){return B&&(this.sourceEvent=B),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(B,H){return this.mouse&&B!=="mouse"&&(this.mouse[1]=H.invert(this.mouse[0])),this.touch0&&B!=="touch"&&(this.touch0[1]=H.invert(this.touch0[0])),this.touch1&&B!=="touch"&&(this.touch1[1]=H.invert(this.touch1[0])),this.that.__zoom=H,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(B){var H=sn(this.that).datum();h.call(B,this.that,new oO(B,{sourceEvent:this.sourceEvent,target:S,transform:this.that.__zoom,dispatch:h}),H)}};function D(B,...H){if(!t.apply(this,arguments))return;var j=A(this,H).event(B),I=this.__zoom,z=Math.max(a[0],Math.min(a[1],I.k*Math.pow(2,o.apply(this,arguments)))),$=Mn(B);if(j.wheel)(j.mouse[0][0]!==$[0]||j.mouse[0][1]!==$[1])&&(j.mouse[1]=I.invert(j.mouse[0]=$)),clearTimeout(j.wheel);else{if(I.k===z)return;j.mouse=[$,I.invert($)],rc(this),j.start()}ta(B),j.wheel=setTimeout(G,x),j.zoom("mouse",n(C(k(I,z),j.mouse[0],j.mouse[1]),j.extent,l));function G(){j.wheel=null,j.end()}}function U(B,...H){if(y||!t.apply(this,arguments))return;var j=B.currentTarget,I=A(this,H,!0).event(B),z=sn(B.view).on("mousemove.zoom",F,!0).on("mouseup.zoom",et,!0),$=Mn(B,j),G=B.clientX,L=B.clientY;_y(B.view),Md(B),I.mouse=[$,this.__zoom.invert($)],rc(this),I.start();function F(rt){if(ta(rt),!I.moved){var ct=rt.clientX-G,ht=rt.clientY-L;I.moved=ct*ct+ht*ht>w}I.event(rt).zoom("mouse",n(C(I.that.__zoom,I.mouse[0]=Mn(rt,j),I.mouse[1]),I.extent,l))}function et(rt){z.on("mousemove.zoom mouseup.zoom",null),Sy(rt.view,I.moved),ta(rt),I.event(rt).end()}}function q(B,...H){if(t.apply(this,arguments)){var j=this.__zoom,I=Mn(B.changedTouches?B.changedTouches[0]:B,this),z=j.invert(I),$=j.k*(B.shiftKey?.5:2),G=n(C(k(j,$),I,z),e.apply(this,H),l);ta(B),u>0?sn(this).transition().duration(u).call(R,G,I,B):sn(this).call(S.transform,G,I,B)}}function Y(B,...H){if(t.apply(this,arguments)){var j=B.touches,I=j.length,z=A(this,H,B.changedTouches.length===I).event(B),$,G,L,F;for(Md(B),G=0;G<I;++G)L=j[G],F=Mn(L,this),F=[F,this.__zoom.invert(F),L.identifier],z.touch0?!z.touch1&&z.touch0[2]!==F[2]&&(z.touch1=F,z.taps=0):(z.touch0=F,$=!0,z.taps=1+!!p);p&&(p=clearTimeout(p)),$&&(z.taps<2&&(m=F[0],p=setTimeout(function(){p=null},b)),rc(this),z.start())}}function K(B,...H){if(this.__zooming){var j=A(this,H).event(B),I=B.changedTouches,z=I.length,$,G,L,F;for(ta(B),$=0;$<z;++$)G=I[$],L=Mn(G,this),j.touch0&&j.touch0[2]===G.identifier?j.touch0[0]=L:j.touch1&&j.touch1[2]===G.identifier&&(j.touch1[0]=L);if(G=j.that.__zoom,j.touch1){var et=j.touch0[0],rt=j.touch0[1],ct=j.touch1[0],ht=j.touch1[1],ft=(ft=ct[0]-et[0])*ft+(ft=ct[1]-et[1])*ft,ut=(ut=ht[0]-rt[0])*ut+(ut=ht[1]-rt[1])*ut;G=k(G,Math.sqrt(ft/ut)),L=[(et[0]+ct[0])/2,(et[1]+ct[1])/2],F=[(rt[0]+ht[0])/2,(rt[1]+ht[1])/2]}else if(j.touch0)L=j.touch0[0],F=j.touch0[1];else return;j.zoom("touch",n(C(G,L,F),j.extent,l))}}function W(B,...H){if(this.__zooming){var j=A(this,H).event(B),I=B.changedTouches,z=I.length,$,G;for(Md(B),y&&clearTimeout(y),y=setTimeout(function(){y=null},b),$=0;$<z;++$)G=I[$],j.touch0&&j.touch0[2]===G.identifier?delete j.touch0:j.touch1&&j.touch1[2]===G.identifier&&delete j.touch1;if(j.touch1&&!j.touch0&&(j.touch0=j.touch1,delete j.touch1),j.touch0)j.touch0[1]=this.__zoom.invert(j.touch0[0]);else if(j.end(),j.taps===2&&(G=Mn(G,this),Math.hypot(m[0]-G[0],m[1]-G[1])<_)){var L=sn(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return S.wheelDelta=function(B){return arguments.length?(o=typeof B=="function"?B:sc(+B),S):o},S.filter=function(B){return arguments.length?(t=typeof B=="function"?B:sc(!!B),S):t},S.touchable=function(B){return arguments.length?(s=typeof B=="function"?B:sc(!!B),S):s},S.extent=function(B){return arguments.length?(e=typeof B=="function"?B:sc([[+B[0][0],+B[0][1]],[+B[1][0],+B[1][1]]]),S):e},S.scaleExtent=function(B){return arguments.length?(a[0]=+B[0],a[1]=+B[1],S):[a[0],a[1]]},S.translateExtent=function(B){return arguments.length?(l[0][0]=+B[0][0],l[1][0]=+B[1][0],l[0][1]=+B[0][1],l[1][1]=+B[1][1],S):[[l[0][0],l[0][1]],[l[1][0],l[1][1]]]},S.constrain=function(B){return arguments.length?(n=B,S):n},S.duration=function(B){return arguments.length?(u=+B,S):u},S.interpolate=function(B){return arguments.length?(d=B,S):d},S.on=function(){var B=h.on.apply(h,arguments);return B===h?S:B},S.clickDistance=function(B){return arguments.length?(w=(B=+B)*B,S):Math.sqrt(w)},S.tapDistance=function(B){return arguments.length?(_=+B,S):_},S}const Kn={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:t=>`Node type "${t}" 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:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:o})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:o}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/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."},ea=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ev=["Enter"," ","Escape"],nv={"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:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"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 Tr;(function(t){t.Strict="strict",t.Loose="loose"})(Tr||(Tr={}));var Po;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(Po||(Po={}));var na;(function(t){t.Partial="partial",t.Full="full"})(na||(na={}));const iv={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Hi;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Hi||(Hi={}));var lc;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(lc||(lc={}));var Nt;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(Nt||(Nt={}));const ov={[Nt.Left]:Nt.Right,[Nt.Right]:Nt.Left,[Nt.Top]:Nt.Bottom,[Nt.Bottom]:Nt.Top};function rv(t){return t===null?null:t?"valid":"invalid"}const sv=t=>"id"in t&&"source"in t&&"target"in t,uO=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),Rd=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),ia=(t,e=[0,0])=>{const{width:n,height:o}=hi(t),s=t.origin??e,a=n*s[0],l=o*s[1];return{x:t.position.x-a,y:t.position.y-l}},fO=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((o,s)=>{const a=typeof s=="string";let l=!e.nodeLookup&&!a?s:void 0;e.nodeLookup&&(l=a?e.nodeLookup.get(s):Rd(s)?s:e.nodeLookup.get(s.id));const u=l?fc(l,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return cc(o,u)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return uc(n)},oa=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},o=!1;return t.forEach(s=>{(e.filter===void 0||e.filter(s))&&(n=cc(n,fc(s)),o=!0)}),o?uc(n):{x:0,y:0,width:0,height:0}},kd=(t,e,[n,o,s]=[0,0,1],a=!1,l=!1)=>{const u={...aa(e,[n,o,s]),width:e.width/s,height:e.height/s},d=[];for(const h of t.values()){const{measured:p,selectable:m=!0,hidden:y=!1}=h;if(l&&!m||y)continue;const b=p.width??h.width??h.initialWidth??null,x=p.height??h.height??h.initialHeight??null,w=ra(u,Ar(h)),_=(b??0)*(x??0),S=a&&w>0;(!h.internals.handleBounds||S||w>=_||h.dragging)&&d.push(h)}return d},dO=(t,e)=>{const n=new Set;return t.forEach(o=>{n.add(o.id)}),e.filter(o=>n.has(o.source)||n.has(o.target))};function hO(t,e){const n=new Map,o=e?.nodes?new Set(e.nodes.map(s=>s.id)):null;return t.forEach(s=>{s.measured.width&&s.measured.height&&(e?.includeHiddenNodes||!s.hidden)&&(!o||o.has(s.id))&&n.set(s.id,s)}),n}async function pO({nodes:t,width:e,height:n,panZoom:o,minZoom:s,maxZoom:a},l){if(t.size===0)return Promise.resolve(!0);const u=hO(t,l),d=oa(u),h=Dd(d,e,n,l?.minZoom??s,l?.maxZoom??a,l?.padding??.1);return await o.setViewport(h,{duration:l?.duration,ease:l?.ease,interpolate:l?.interpolate}),Promise.resolve(!0)}function av({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:o=[0,0],nodeExtent:s,onError:a}){const l=n.get(t),u=l.parentId?n.get(l.parentId):void 0,{x:d,y:h}=u?u.internals.positionAbsolute:{x:0,y:0},p=l.origin??o;let m=l.extent||s;if(l.extent==="parent"&&!l.expandParent)if(!u)a?.("005",Kn.error005());else{const b=u.measured.width,x=u.measured.height;b&&x&&(m=[[d,h],[d+b,h+x]])}else u&&Rr(l.extent)&&(m=[[l.extent[0][0]+d,l.extent[0][1]+h],[l.extent[1][0]+d,l.extent[1][1]+h]]);const y=Rr(m)?Bo(e,m,l.measured):e;return(l.measured.width===void 0||l.measured.height===void 0)&&a?.("015",Kn.error015()),{position:{x:y.x-d+(l.measured.width??0)*p[0],y:y.y-h+(l.measured.height??0)*p[1]},positionAbsolute:y}}async function mO({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:o,onBeforeDelete:s}){const a=new Set(t.map(y=>y.id)),l=[];for(const y of n){if(y.deletable===!1)continue;const b=a.has(y.id),x=!b&&y.parentId&&l.find(w=>w.id===y.parentId);(b||x)&&l.push(y)}const u=new Set(e.map(y=>y.id)),d=o.filter(y=>y.deletable!==!1),p=dO(l,d);for(const y of d)u.has(y.id)&&!p.find(x=>x.id===y.id)&&p.push(y);if(!s)return{edges:p,nodes:l};const m=await s({nodes:l,edges:p});return typeof m=="boolean"?m?{edges:p,nodes:l}:{edges:[],nodes:[]}:m}const Nr=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Bo=(t={x:0,y:0},e,n)=>({x:Nr(t.x,e[0][0],e[1][0]-(n?.width??0)),y:Nr(t.y,e[0][1],e[1][1]-(n?.height??0))});function lv(t,e,n){const{width:o,height:s}=hi(n),{x:a,y:l}=n.internals.positionAbsolute;return Bo(t,[[a,l],[a+o,l+s]],e)}const cv=(t,e,n)=>t<e?Nr(Math.abs(t-e),1,e)/e:t>n?-Nr(Math.abs(t-n),1,e)/e:0,uv=(t,e,n=15,o=40)=>{const s=cv(t.x,o,e.width-o)*n,a=cv(t.y,o,e.height-o)*n;return[s,a]},cc=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),Od=({x:t,y:e,width:n,height:o})=>({x:t,y:e,x2:t+n,y2:e+o}),uc=({x:t,y:e,x2:n,y2:o})=>({x:t,y:e,width:n-t,height:o-e}),Ar=(t,e=[0,0])=>{const{x:n,y:o}=Rd(t)?t.internals.positionAbsolute:ia(t,e);return{x:n,y:o,width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}},fc=(t,e=[0,0])=>{const{x:n,y:o}=Rd(t)?t.internals.positionAbsolute:ia(t,e);return{x:n,y:o,x2:n+(t.measured?.width??t.width??t.initialWidth??0),y2:o+(t.measured?.height??t.height??t.initialHeight??0)}},fv=(t,e)=>uc(cc(Od(t),Od(e))),ra=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),o=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*o)},dv=t=>On(t.width)&&On(t.height)&&On(t.x)&&On(t.y),On=t=>!isNaN(t)&&isFinite(t),gO=(t,e)=>{},sa=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),aa=({x:t,y:e},[n,o,s],a=!1,l=[1,1])=>{const u={x:(t-n)/s,y:(e-o)/s};return a?sa(u,l):u},dc=({x:t,y:e},[n,o,s])=>({x:t*s+n,y:e*s+o});function Mr(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function yO(t,e,n){if(typeof t=="string"||typeof t=="number"){const o=Mr(t,n),s=Mr(t,e);return{top:o,right:s,bottom:o,left:s,x:s*2,y:o*2}}if(typeof t=="object"){const o=Mr(t.top??t.y??0,n),s=Mr(t.bottom??t.y??0,n),a=Mr(t.left??t.x??0,e),l=Mr(t.right??t.x??0,e);return{top:o,right:l,bottom:s,left:a,x:a+l,y:o+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function vO(t,e,n,o,s,a){const{x:l,y:u}=dc(t,[e,n,o]),{x:d,y:h}=dc({x:t.x+t.width,y:t.y+t.height},[e,n,o]),p=s-d,m=a-h;return{left:Math.floor(l),top:Math.floor(u),right:Math.floor(p),bottom:Math.floor(m)}}const Dd=(t,e,n,o,s,a)=>{const l=yO(a,e,n),u=(e-l.x)/t.width,d=(n-l.y)/t.height,h=Math.min(u,d),p=Nr(h,o,s),m=t.x+t.width/2,y=t.y+t.height/2,b=e/2-m*p,x=n/2-y*p,w=vO(t,b,x,p,e,n),_={left:Math.min(w.left-l.left,0),top:Math.min(w.top-l.top,0),right:Math.min(w.right-l.right,0),bottom:Math.min(w.bottom-l.bottom,0)};return{x:b-_.left+_.right,y:x-_.top+_.bottom,zoom:p}},la=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Rr(t){return t!=null&&t!=="parent"}function hi(t){return{width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}}function hv(t){return(t.measured?.width??t.width??t.initialWidth)!==void 0&&(t.measured?.height??t.height??t.initialHeight)!==void 0}function pv(t,e={width:0,height:0},n,o,s){const a={...t},l=o.get(n);if(l){const u=l.origin||s;a.x+=l.internals.positionAbsolute.x-(e.width??0)*u[0],a.y+=l.internals.positionAbsolute.y-(e.height??0)*u[1]}return a}function mv(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function bO(){let t,e;return{promise:new Promise((o,s)=>{t=o,e=s}),resolve:t,reject:e}}function xO(t){return{...nv,...t||{}}}function ca(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:o,containerBounds:s}){const{x:a,y:l}=Dn(t),u=aa({x:a-(s?.left??0),y:l-(s?.top??0)},o),{x:d,y:h}=n?sa(u,e):u;return{xSnapped:d,ySnapped:h,...u}}const jd=t=>({width:t.offsetWidth,height:t.offsetHeight}),gv=t=>t?.getRootNode?.()||window?.document,wO=["INPUT","SELECT","TEXTAREA"];function yv(t){const e=t.composedPath?.()?.[0]||t.target;return e?.nodeType!==1?!1:wO.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const vv=t=>"clientX"in t,Dn=(t,e)=>{const n=vv(t),o=n?t.clientX:t.touches?.[0].clientX,s=n?t.clientY:t.touches?.[0].clientY;return{x:o-(e?.left??0),y:s-(e?.top??0)}},bv=(t,e,n,o,s)=>{const a=e.querySelectorAll(`.${t}`);return!a||!a.length?null:Array.from(a).map(l=>{const u=l.getBoundingClientRect();return{id:l.getAttribute("data-handleid"),type:t,nodeId:s,position:l.getAttribute("data-handlepos"),x:(u.left-n.left)/o,y:(u.top-n.top)/o,...jd(l)}})};function xv({sourceX:t,sourceY:e,targetX:n,targetY:o,sourceControlX:s,sourceControlY:a,targetControlX:l,targetControlY:u}){const d=t*.125+s*.375+l*.375+n*.125,h=e*.125+a*.375+u*.375+o*.125,p=Math.abs(d-t),m=Math.abs(h-e);return[d,h,p,m]}function hc(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function wv({pos:t,x1:e,y1:n,x2:o,y2:s,c:a}){switch(t){case Nt.Left:return[e-hc(e-o,a),n];case Nt.Right:return[e+hc(o-e,a),n];case Nt.Top:return[e,n-hc(n-s,a)];case Nt.Bottom:return[e,n+hc(s-n,a)]}}function _v({sourceX:t,sourceY:e,sourcePosition:n=Nt.Bottom,targetX:o,targetY:s,targetPosition:a=Nt.Top,curvature:l=.25}){const[u,d]=wv({pos:n,x1:t,y1:e,x2:o,y2:s,c:l}),[h,p]=wv({pos:a,x1:o,y1:s,x2:t,y2:e,c:l}),[m,y,b,x]=xv({sourceX:t,sourceY:e,targetX:o,targetY:s,sourceControlX:u,sourceControlY:d,targetControlX:h,targetControlY:p});return[`M${t},${e} C${u},${d} ${h},${p} ${o},${s}`,m,y,b,x]}function Sv({sourceX:t,sourceY:e,targetX:n,targetY:o}){const s=Math.abs(n-t)/2,a=n<t?n+s:n-s,l=Math.abs(o-e)/2,u=o<e?o+l:o-l;return[a,u,s,l]}function _O({sourceNode:t,targetNode:e,selected:n=!1,zIndex:o=0,elevateOnSelect:s=!1,zIndexMode:a="basic"}){if(a==="manual")return o;const l=s&&n?o+1e3:o,u=Math.max(t.parentId||s&&t.selected?t.internals.z:0,e.parentId||s&&e.selected?e.internals.z:0);return l+u}function SO({sourceNode:t,targetNode:e,width:n,height:o,transform:s}){const a=cc(fc(t),fc(e));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const l={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:o/s[2]};return ra(l,uc(a))>0}const EO=({source:t,sourceHandle:e,target:n,targetHandle:o})=>`xy-edge__${t}${e||""}-${n}${o||""}`,CO=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),TO=(t,e,n={})=>{if(!t.source||!t.target)return e;const o=n.getEdgeId||EO;let s;return sv(t)?s={...t}:s={...t,id:o(t)},CO(s,e)?e:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,e.concat(s))};function Ev({sourceX:t,sourceY:e,targetX:n,targetY:o}){const[s,a,l,u]=Sv({sourceX:t,sourceY:e,targetX:n,targetY:o});return[`M ${t},${e}L ${n},${o}`,s,a,l,u]}const Cv={[Nt.Left]:{x:-1,y:0},[Nt.Right]:{x:1,y:0},[Nt.Top]:{x:0,y:-1},[Nt.Bottom]:{x:0,y:1}},NO=({source:t,sourcePosition:e=Nt.Bottom,target:n})=>e===Nt.Left||e===Nt.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},Tv=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function AO({source:t,sourcePosition:e=Nt.Bottom,target:n,targetPosition:o=Nt.Top,center:s,offset:a,stepPosition:l}){const u=Cv[e],d=Cv[o],h={x:t.x+u.x*a,y:t.y+u.y*a},p={x:n.x+d.x*a,y:n.y+d.y*a},m=NO({source:h,sourcePosition:e,target:p}),y=m.x!==0?"x":"y",b=m[y];let x=[],w,_;const S={x:0,y:0},k={x:0,y:0},[,,C,E]=Sv({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(u[y]*d[y]===-1){y==="x"?(w=s.x??h.x+(p.x-h.x)*l,_=s.y??(h.y+p.y)/2):(w=s.x??(h.x+p.x)/2,_=s.y??h.y+(p.y-h.y)*l);const A=[{x:w,y:h.y},{x:w,y:p.y}],O=[{x:h.x,y:_},{x:p.x,y:_}];u[y]===b?x=y==="x"?A:O:x=y==="x"?O:A}else{const A=[{x:h.x,y:p.y}],O=[{x:p.x,y:h.y}];if(y==="x"?x=u.x===b?O:A:x=u.y===b?A:O,e===o){const K=Math.abs(t[y]-n[y]);if(K<=a){const W=Math.min(a-1,a-K);u[y]===b?S[y]=(h[y]>t[y]?-1:1)*W:k[y]=(p[y]>n[y]?-1:1)*W}}if(e!==o){const K=y==="x"?"y":"x",W=u[y]===d[K],B=h[K]>p[K],H=h[K]<p[K];(u[y]===1&&(!W&&B||W&&H)||u[y]!==1&&(!W&&H||W&&B))&&(x=y==="x"?A:O)}const D={x:h.x+S.x,y:h.y+S.y},U={x:p.x+k.x,y:p.y+k.y},q=Math.max(Math.abs(D.x-x[0].x),Math.abs(U.x-x[0].x)),Y=Math.max(Math.abs(D.y-x[0].y),Math.abs(U.y-x[0].y));q>=Y?(w=(D.x+U.x)/2,_=x[0].y):(w=x[0].x,_=(D.y+U.y)/2)}return[[t,{x:h.x+S.x,y:h.y+S.y},...x,{x:p.x+k.x,y:p.y+k.y},n],w,_,C,E]}function MO(t,e,n,o){const s=Math.min(Tv(t,e)/2,Tv(e,n)/2,o),{x:a,y:l}=e;if(t.x===a&&a===n.x||t.y===l&&l===n.y)return`L${a} ${l}`;if(t.y===l){const h=t.x<n.x?-1:1,p=t.y<n.y?1:-1;return`L ${a+s*h},${l}Q ${a},${l} ${a},${l+s*p}`}const u=t.x<n.x?1:-1,d=t.y<n.y?-1:1;return`L ${a},${l+s*d}Q ${a},${l} ${a+s*u},${l}`}function zd({sourceX:t,sourceY:e,sourcePosition:n=Nt.Bottom,targetX:o,targetY:s,targetPosition:a=Nt.Top,borderRadius:l=5,centerX:u,centerY:d,offset:h=20,stepPosition:p=.5}){const[m,y,b,x,w]=AO({source:{x:t,y:e},sourcePosition:n,target:{x:o,y:s},targetPosition:a,center:{x:u,y:d},offset:h,stepPosition:p});return[m.reduce((S,k,C)=>{let E="";return C>0&&C<m.length-1?E=MO(m[C-1],k,m[C+1],l):E=`${C===0?"M":"L"}${k.x} ${k.y}`,S+=E,S},""),y,b,x,w]}function Nv(t){return t&&!!(t.internals.handleBounds||t.handles?.length)&&!!(t.measured.width||t.width||t.initialWidth)}function RO(t){const{sourceNode:e,targetNode:n}=t;if(!Nv(e)||!Nv(n))return null;const o=e.internals.handleBounds||Av(e.handles),s=n.internals.handleBounds||Av(n.handles),a=Mv(o?.source??[],t.sourceHandle),l=Mv(t.connectionMode===Tr.Strict?s?.target??[]:(s?.target??[]).concat(s?.source??[]),t.targetHandle);if(!a||!l)return t.onError?.("008",Kn.error008(a?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const u=a?.position||Nt.Bottom,d=l?.position||Nt.Top,h=Ho(e,a,u),p=Ho(n,l,d);return{sourceX:h.x,sourceY:h.y,targetX:p.x,targetY:p.y,sourcePosition:u,targetPosition:d}}function Av(t){if(!t)return null;const e=[],n=[];for(const o of t)o.width=o.width??1,o.height=o.height??1,o.type==="source"?e.push(o):o.type==="target"&&n.push(o);return{source:e,target:n}}function Ho(t,e,n=Nt.Left,o=!1){const s=(e?.x??0)+t.internals.positionAbsolute.x,a=(e?.y??0)+t.internals.positionAbsolute.y,{width:l,height:u}=e??hi(t);if(o)return{x:s+l/2,y:a+u/2};switch(e?.position??n){case Nt.Top:return{x:s+l/2,y:a};case Nt.Right:return{x:s+l,y:a+u/2};case Nt.Bottom:return{x:s+l/2,y:a+u};case Nt.Left:return{x:s,y:a+u/2}}}function Mv(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function Vd(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(o=>`${o}=${t[o]}`).join("&")}`:""}function kO(t,{id:e,defaultColor:n,defaultMarkerStart:o,defaultMarkerEnd:s}){const a=new Set;return t.reduce((l,u)=>([u.markerStart||o,u.markerEnd||s].forEach(d=>{if(d&&typeof d=="object"){const h=Vd(d,e);a.has(h)||(l.push({id:h,color:d.color||n,...d}),a.add(h))}}),l),[]).sort((l,u)=>l.id.localeCompare(u.id))}const Rv=1e3,OO=10,Ld={nodeOrigin:[0,0],nodeExtent:ea,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},DO={...Ld,checkEquality:!0};function Id(t,e){const n={...t};for(const o in e)e[o]!==void 0&&(n[o]=e[o]);return n}function jO(t,e,n){const o=Id(Ld,n);for(const s of t.values())if(s.parentId)Hd(s,t,e,o);else{const a=ia(s,o.nodeOrigin),l=Rr(s.extent)?s.extent:o.nodeExtent,u=Bo(a,l,hi(s));s.internals.positionAbsolute=u}}function zO(t,e){if(!t.handles)return t.measured?e?.internals.handleBounds:void 0;const n=[],o=[];for(const s of t.handles){const a={id:s.id,width:s.width??1,height:s.height??1,nodeId:t.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(a):s.type==="target"&&o.push(a)}return{source:n,target:o}}function Pd(t){return t==="manual"}function Bd(t,e,n,o={}){const s=Id(DO,o),a={i:0},l=new Map(e),u=s?.elevateNodesOnSelect&&!Pd(s.zIndexMode)?Rv:0;let d=t.length>0;e.clear(),n.clear();for(const h of t){let p=l.get(h.id);if(s.checkEquality&&h===p?.internals.userNode)e.set(h.id,p);else{const m=ia(h,s.nodeOrigin),y=Rr(h.extent)?h.extent:s.nodeExtent,b=Bo(m,y,hi(h));p={...s.defaults,...h,measured:{width:h.measured?.width,height:h.measured?.height},internals:{positionAbsolute:b,handleBounds:zO(h,p),z:kv(h,u,s.zIndexMode),userNode:h}},e.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(d=!1),h.parentId&&Hd(p,e,n,o,a)}return d}function VO(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function Hd(t,e,n,o,s){const{elevateNodesOnSelect:a,nodeOrigin:l,nodeExtent:u,zIndexMode:d}=Id(Ld,o),h=t.parentId,p=e.get(h);if(!p){console.warn(`Parent node ${h} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}VO(t,n),s&&!p.parentId&&p.internals.rootParentIndex===void 0&&d==="auto"&&(p.internals.rootParentIndex=++s.i,p.internals.z=p.internals.z+s.i*OO),s&&p.internals.rootParentIndex!==void 0&&(s.i=p.internals.rootParentIndex);const m=a&&!Pd(d)?Rv:0,{x:y,y:b,z:x}=LO(t,p,l,u,m,d),{positionAbsolute:w}=t.internals,_=y!==w.x||b!==w.y;(_||x!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:_?{x:y,y:b}:w,z:x}})}function kv(t,e,n){const o=On(t.zIndex)?t.zIndex:0;return Pd(n)?o:o+(t.selected?e:0)}function LO(t,e,n,o,s,a){const{x:l,y:u}=e.internals.positionAbsolute,d=hi(t),h=ia(t,n),p=Rr(t.extent)?Bo(h,t.extent,d):h;let m=Bo({x:l+p.x,y:u+p.y},o,d);t.extent==="parent"&&(m=lv(m,d,e));const y=kv(t,s,a),b=e.internals.z??0;return{x:m.x,y:m.y,z:b>=y?b+1:y}}function Ud(t,e,n,o=[0,0]){const s=[],a=new Map;for(const l of t){const u=e.get(l.parentId);if(!u)continue;const d=a.get(l.parentId)?.expandedRect??Ar(u),h=fv(d,l.rect);a.set(l.parentId,{expandedRect:h,parent:u})}return a.size>0&&a.forEach(({expandedRect:l,parent:u},d)=>{const h=u.internals.positionAbsolute,p=hi(u),m=u.origin??o,y=l.x<h.x?Math.round(Math.abs(h.x-l.x)):0,b=l.y<h.y?Math.round(Math.abs(h.y-l.y)):0,x=Math.max(p.width,Math.round(l.width)),w=Math.max(p.height,Math.round(l.height)),_=(x-p.width)*m[0],S=(w-p.height)*m[1];(y>0||b>0||_||S)&&(s.push({id:d,type:"position",position:{x:u.position.x-y+_,y:u.position.y-b+S}}),n.get(d)?.forEach(k=>{t.some(C=>C.id===k.id)||s.push({id:k.id,type:"position",position:{x:k.position.x+y,y:k.position.y+b}})})),(p.width<l.width||p.height<l.height||y||b)&&s.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:x+(y?m[0]*y-_:0),height:w+(b?m[1]*b-S:0)}})}),s}function IO(t,e,n,o,s,a,l){const u=o?.querySelector(".xyflow__viewport");let d=!1;if(!u)return{changes:[],updatedInternals:d};const h=[],p=window.getComputedStyle(u),{m22:m}=new window.DOMMatrixReadOnly(p.transform),y=[];for(const b of t.values()){const x=e.get(b.id);if(!x)continue;if(x.hidden){e.set(x.id,{...x,internals:{...x.internals,handleBounds:void 0}}),d=!0;continue}const w=jd(b.nodeElement),_=x.measured.width!==w.width||x.measured.height!==w.height;if(!!(w.width&&w.height&&(_||!x.internals.handleBounds||b.force))){const k=b.nodeElement.getBoundingClientRect(),C=Rr(x.extent)?x.extent:a;let{positionAbsolute:E}=x.internals;x.parentId&&x.extent==="parent"?E=lv(E,w,e.get(x.parentId)):C&&(E=Bo(E,C,w));const R={...x,measured:w,internals:{...x.internals,positionAbsolute:E,handleBounds:{source:bv("source",b.nodeElement,k,m,x.id),target:bv("target",b.nodeElement,k,m,x.id)}}};e.set(x.id,R),x.parentId&&Hd(R,e,n,{nodeOrigin:s,zIndexMode:l}),d=!0,_&&(h.push({id:x.id,type:"dimensions",dimensions:w}),x.expandParent&&x.parentId&&y.push({id:x.id,parentId:x.parentId,rect:Ar(R,s)}))}}if(y.length>0){const b=Ud(y,e,n,s);h.push(...b)}return{changes:h,updatedInternals:d}}async function PO({delta:t,panZoom:e,transform:n,translateExtent:o,width:s,height:a}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const l=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[s,a]],o),u=!!l&&(l.x!==n[0]||l.y!==n[1]||l.k!==n[2]);return Promise.resolve(u)}function Ov(t,e,n,o,s,a){let l=s;const u=o.get(l)||new Map;o.set(l,u.set(n,e)),l=`${s}-${t}`;const d=o.get(l)||new Map;if(o.set(l,d.set(n,e)),a){l=`${s}-${t}-${a}`;const h=o.get(l)||new Map;o.set(l,h.set(n,e))}}function Dv(t,e,n){t.clear(),e.clear();for(const o of n){const{source:s,target:a,sourceHandle:l=null,targetHandle:u=null}=o,d={edgeId:o.id,source:s,target:a,sourceHandle:l,targetHandle:u},h=`${s}-${l}--${a}-${u}`,p=`${a}-${u}--${s}-${l}`;Ov("source",d,p,t,s,l),Ov("target",d,h,t,a,u),e.set(o.id,o)}}function jv(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:jv(n,e):!1}function zv(t,e,n){let o=t;do{if(o?.matches?.(e))return!0;if(o===n)return!1;o=o?.parentElement}while(o);return!1}function BO(t,e,n,o){const s=new Map;for(const[a,l]of t)if((l.selected||l.id===o)&&(!l.parentId||!jv(l,t))&&(l.draggable||e&&typeof l.draggable>"u")){const u=t.get(a);u&&s.set(a,{id:a,position:u.position||{x:0,y:0},distance:{x:n.x-u.internals.positionAbsolute.x,y:n.y-u.internals.positionAbsolute.y},extent:u.extent,parentId:u.parentId,origin:u.origin,expandParent:u.expandParent,internals:{positionAbsolute:u.internals.positionAbsolute||{x:0,y:0}},measured:{width:u.measured.width??0,height:u.measured.height??0}})}return s}function $d({nodeId:t,dragItems:e,nodeLookup:n,dragging:o=!0}){const s=[];for(const[l,u]of e){const d=n.get(l)?.internals.userNode;d&&s.push({...d,position:u.position,dragging:o})}if(!t)return[s[0],s];const a=n.get(t)?.internals.userNode;return[a?{...a,position:e.get(t)?.position||a.position,dragging:o}:s[0],s]}function HO({dragItems:t,snapGrid:e,x:n,y:o}){const s=t.values().next().value;if(!s)return null;const a={x:n-s.distance.x,y:o-s.distance.y},l=sa(a,e);return{x:l.x-a.x,y:l.y-a.y}}function UO({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:o,onDragStop:s}){let a={x:null,y:null},l=0,u=new Map,d=!1,h={x:0,y:0},p=null,m=!1,y=null,b=!1,x=!1,w=null;function _({noDragClassName:k,handleSelector:C,domNode:E,isSelectable:R,nodeId:A,nodeClickDistance:O=0}){y=sn(E);function D({x:K,y:W}){const{nodeLookup:B,nodeExtent:H,snapGrid:j,snapToGrid:I,nodeOrigin:z,onNodeDrag:$,onSelectionDrag:G,onError:L,updateNodePositions:F}=e();a={x:K,y:W};let et=!1;const rt=u.size>1,ct=rt&&H?Od(oa(u)):null,ht=rt&&I?HO({dragItems:u,snapGrid:j,x:K,y:W}):null;for(const[ft,ut]of u){if(!B.has(ft))continue;let dt={x:K-ut.distance.x,y:W-ut.distance.y};I&&(dt=ht?{x:Math.round(dt.x+ht.x),y:Math.round(dt.y+ht.y)}:sa(dt,j));let Ot=null;if(rt&&H&&!ut.extent&&ct){const{positionAbsolute:Tt}=ut.internals,Dt=Tt.x-ct.x+H[0][0],Xt=Tt.x+ut.measured.width-ct.x2+H[1][0],Ft=Tt.y-ct.y+H[0][1],pt=Tt.y+ut.measured.height-ct.y2+H[1][1];Ot=[[Dt,Ft],[Xt,pt]]}const{position:At,positionAbsolute:bt}=av({nodeId:ft,nextPosition:dt,nodeLookup:B,nodeExtent:Ot||H,nodeOrigin:z,onError:L});et=et||ut.position.x!==At.x||ut.position.y!==At.y,ut.position=At,ut.internals.positionAbsolute=bt}if(x=x||et,!!et&&(F(u,!0),w&&(o||$||!A&&G))){const[ft,ut]=$d({nodeId:A,dragItems:u,nodeLookup:B});o?.(w,u,ft,ut),$?.(w,ft,ut),A||G?.(w,ut)}}async function U(){if(!p)return;const{transform:K,panBy:W,autoPanSpeed:B,autoPanOnNodeDrag:H}=e();if(!H){d=!1,cancelAnimationFrame(l);return}const[j,I]=uv(h,p,B);(j!==0||I!==0)&&(a.x=(a.x??0)-j/K[2],a.y=(a.y??0)-I/K[2],await W({x:j,y:I})&&D(a)),l=requestAnimationFrame(U)}function q(K){const{nodeLookup:W,multiSelectionActive:B,nodesDraggable:H,transform:j,snapGrid:I,snapToGrid:z,selectNodesOnDrag:$,onNodeDragStart:G,onSelectionDragStart:L,unselectNodesAndEdges:F}=e();m=!0,(!$||!R)&&!B&&A&&(W.get(A)?.selected||F()),R&&$&&A&&t?.(A);const et=ca(K.sourceEvent,{transform:j,snapGrid:I,snapToGrid:z,containerBounds:p});if(a=et,u=BO(W,H,et,A),u.size>0&&(n||G||!A&&L)){const[rt,ct]=$d({nodeId:A,dragItems:u,nodeLookup:W});n?.(K.sourceEvent,u,rt,ct),G?.(K.sourceEvent,rt,ct),A||L?.(K.sourceEvent,ct)}}const Y=Ey().clickDistance(O).on("start",K=>{const{domNode:W,nodeDragThreshold:B,transform:H,snapGrid:j,snapToGrid:I}=e();p=W?.getBoundingClientRect()||null,b=!1,x=!1,w=K.sourceEvent,B===0&&q(K),a=ca(K.sourceEvent,{transform:H,snapGrid:j,snapToGrid:I,containerBounds:p}),h=Dn(K.sourceEvent,p)}).on("drag",K=>{const{autoPanOnNodeDrag:W,transform:B,snapGrid:H,snapToGrid:j,nodeDragThreshold:I,nodeLookup:z}=e(),$=ca(K.sourceEvent,{transform:B,snapGrid:H,snapToGrid:j,containerBounds:p});if(w=K.sourceEvent,(K.sourceEvent.type==="touchmove"&&K.sourceEvent.touches.length>1||A&&!z.has(A))&&(b=!0),!b){if(!d&&W&&m&&(d=!0,U()),!m){const G=Dn(K.sourceEvent,p),L=G.x-h.x,F=G.y-h.y;Math.sqrt(L*L+F*F)>I&&q(K)}(a.x!==$.xSnapped||a.y!==$.ySnapped)&&u&&m&&(h=Dn(K.sourceEvent,p),D($))}}).on("end",K=>{if(!(!m||b)&&(d=!1,m=!1,cancelAnimationFrame(l),u.size>0)){const{nodeLookup:W,updateNodePositions:B,onNodeDragStop:H,onSelectionDragStop:j}=e();if(x&&(B(u,!1),x=!1),s||H||!A&&j){const[I,z]=$d({nodeId:A,dragItems:u,nodeLookup:W,dragging:!1});s?.(K.sourceEvent,u,I,z),H?.(K.sourceEvent,I,z),A||j?.(K.sourceEvent,z)}}}).filter(K=>{const W=K.target;return!K.button&&(!k||!zv(W,`.${k}`,E))&&(!C||zv(W,C,E))});y.call(Y)}function S(){y?.on(".drag",null)}return{update:_,destroy:S}}function $O(t,e,n){const o=[],s={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const a of e.values())ra(s,Ar(a))>0&&o.push(a);return o}const YO=250;function qO(t,e,n,o){let s=[],a=1/0;const l=$O(t,n,e+YO);for(const u of l){const d=[...u.internals.handleBounds?.source??[],...u.internals.handleBounds?.target??[]];for(const h of d){if(o.nodeId===h.nodeId&&o.type===h.type&&o.id===h.id)continue;const{x:p,y:m}=Ho(u,h,h.position,!0),y=Math.sqrt(Math.pow(p-t.x,2)+Math.pow(m-t.y,2));y>e||(y<a?(s=[{...h,x:p,y:m}],a=y):y===a&&s.push({...h,x:p,y:m}))}}if(!s.length)return null;if(s.length>1){const u=o.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function Vv(t,e,n,o,s,a=!1){const l=o.get(t);if(!l)return null;const u=s==="strict"?l.internals.handleBounds?.[e]:[...l.internals.handleBounds?.source??[],...l.internals.handleBounds?.target??[]],d=(n?u?.find(h=>h.id===n):u?.[0])??null;return d&&a?{...d,...Ho(l,d,d.position,!0)}:d}function Lv(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function GO(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const Iv=()=>!0;function FO(t,{connectionMode:e,connectionRadius:n,handleId:o,nodeId:s,edgeUpdaterType:a,isTarget:l,domNode:u,nodeLookup:d,lib:h,autoPanOnConnect:p,flowId:m,panBy:y,cancelConnection:b,onConnectStart:x,onConnect:w,onConnectEnd:_,isValidConnection:S=Iv,onReconnectEnd:k,updateConnection:C,getTransform:E,getFromHandle:R,autoPanSpeed:A,dragThreshold:O=1,handleDomNode:D}){const U=gv(t.target);let q=0,Y;const{x:K,y:W}=Dn(t),B=Lv(a,D),H=u?.getBoundingClientRect();let j=!1;if(!H||!B)return;const I=Vv(s,B,o,d,e);if(!I)return;let z=Dn(t,H),$=!1,G=null,L=!1,F=null;function et(){if(!p||!H)return;const[At,bt]=uv(z,H,A);y({x:At,y:bt}),q=requestAnimationFrame(et)}const rt={...I,nodeId:s,type:B,position:I.position},ct=d.get(s);let ft={inProgress:!0,isValid:null,from:Ho(ct,rt,Nt.Left,!0),fromHandle:rt,fromPosition:rt.position,fromNode:ct,to:z,toHandle:null,toPosition:ov[rt.position],toNode:null,pointer:z};function ut(){j=!0,C(ft),x?.(t,{nodeId:s,handleId:o,handleType:B})}O===0&&ut();function dt(At){if(!j){const{x:pt,y:yt}=Dn(At),vt=pt-K,mt=yt-W;if(!(vt*vt+mt*mt>O*O))return;ut()}if(!R()||!rt){Ot(At);return}const bt=E();z=Dn(At,H),Y=qO(aa(z,bt,!1,[1,1]),n,d,rt),$||(et(),$=!0);const Tt=Pv(At,{handle:Y,connectionMode:e,fromNodeId:s,fromHandleId:o,fromType:l?"target":"source",isValidConnection:S,doc:U,lib:h,flowId:m,nodeLookup:d});F=Tt.handleDomNode,G=Tt.connection,L=GO(!!Y,Tt.isValid);const Dt=d.get(s),Xt=Dt?Ho(Dt,rt,Nt.Left,!0):ft.from,Ft={...ft,from:Xt,isValid:L,to:Tt.toHandle&&L?dc({x:Tt.toHandle.x,y:Tt.toHandle.y},bt):z,toHandle:Tt.toHandle,toPosition:L&&Tt.toHandle?Tt.toHandle.position:ov[rt.position],toNode:Tt.toHandle?d.get(Tt.toHandle.nodeId):null,pointer:z};C(Ft),ft=Ft}function Ot(At){if(!("touches"in At&&At.touches.length>0)){if(j){(Y||F)&&G&&L&&w?.(G);const{inProgress:bt,...Tt}=ft,Dt={...Tt,toPosition:ft.toHandle?ft.toPosition:null};_?.(At,Dt),a&&k?.(At,Dt)}b(),cancelAnimationFrame(q),$=!1,L=!1,G=null,F=null,U.removeEventListener("mousemove",dt),U.removeEventListener("mouseup",Ot),U.removeEventListener("touchmove",dt),U.removeEventListener("touchend",Ot)}}U.addEventListener("mousemove",dt),U.addEventListener("mouseup",Ot),U.addEventListener("touchmove",dt),U.addEventListener("touchend",Ot)}function Pv(t,{handle:e,connectionMode:n,fromNodeId:o,fromHandleId:s,fromType:a,doc:l,lib:u,flowId:d,isValidConnection:h=Iv,nodeLookup:p}){const m=a==="target",y=e?l.querySelector(`.${u}-flow__handle[data-id="${d}-${e?.nodeId}-${e?.id}-${e?.type}"]`):null,{x:b,y:x}=Dn(t),w=l.elementFromPoint(b,x),_=w?.classList.contains(`${u}-flow__handle`)?w:y,S={handleDomNode:_,isValid:!1,connection:null,toHandle:null};if(_){const k=Lv(void 0,_),C=_.getAttribute("data-nodeid"),E=_.getAttribute("data-handleid"),R=_.classList.contains("connectable"),A=_.classList.contains("connectableend");if(!C||!k)return S;const O={source:m?C:o,sourceHandle:m?E:s,target:m?o:C,targetHandle:m?s:E};S.connection=O;const U=R&&A&&(n===Tr.Strict?m&&k==="source"||!m&&k==="target":C!==o||E!==s);S.isValid=U&&h(O),S.toHandle=Vv(C,k,E,p,n,!0)}return S}const Yd={onPointerDown:FO,isValid:Pv};function XO({domNode:t,panZoom:e,getTransform:n,getViewScale:o}){const s=sn(t);function a({translateExtent:u,width:d,height:h,zoomStep:p=1,pannable:m=!0,zoomable:y=!0,inversePan:b=!1}){const x=C=>{if(C.sourceEvent.type!=="wheel"||!e)return;const E=n(),R=C.sourceEvent.ctrlKey&&la()?10:1,A=-C.sourceEvent.deltaY*(C.sourceEvent.deltaMode===1?.05:C.sourceEvent.deltaMode?1:.002)*p,O=E[2]*Math.pow(2,A*R);e.scaleTo(O)};let w=[0,0];const _=C=>{(C.sourceEvent.type==="mousedown"||C.sourceEvent.type==="touchstart")&&(w=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY])},S=C=>{const E=n();if(C.sourceEvent.type!=="mousemove"&&C.sourceEvent.type!=="touchmove"||!e)return;const R=[C.sourceEvent.clientX??C.sourceEvent.touches[0].clientX,C.sourceEvent.clientY??C.sourceEvent.touches[0].clientY],A=[R[0]-w[0],R[1]-w[1]];w=R;const O=o()*Math.max(E[2],Math.log(E[2]))*(b?-1:1),D={x:E[0]-A[0]*O,y:E[1]-A[1]*O},U=[[0,0],[d,h]];e.setViewportConstrained({x:D.x,y:D.y,zoom:E[2]},U,u)},k=tv().on("start",_).on("zoom",m?S:null).on("zoom.wheel",y?x:null);s.call(k,{})}function l(){s.on("zoom",null)}return{update:a,destroy:l,pointer:Mn}}const pc=t=>({x:t.x,y:t.y,zoom:t.k}),qd=({x:t,y:e,zoom:n})=>ac.translate(t,e).scale(n),kr=(t,e)=>t.target.closest(`.${e}`),Bv=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),ZO=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,Gd=(t,e=0,n=ZO,o=()=>{})=>{const s=typeof e=="number"&&e>0;return s||o(),s?t.transition().duration(e).ease(n).on("end",o):t},Hv=t=>{const e=t.ctrlKey&&la()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function KO({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:o,panOnScrollMode:s,panOnScrollSpeed:a,zoomOnPinch:l,onPanZoomStart:u,onPanZoom:d,onPanZoomEnd:h}){return p=>{if(kr(p,e))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const m=n.property("__zoom").k||1;if(p.ctrlKey&&l){const _=Mn(p),S=Hv(p),k=m*Math.pow(2,S);o.scaleTo(n,k,_,p);return}const y=p.deltaMode===1?20:1;let b=s===Po.Vertical?0:p.deltaX*y,x=s===Po.Horizontal?0:p.deltaY*y;!la()&&p.shiftKey&&s!==Po.Vertical&&(b=p.deltaY*y,x=0),o.translateBy(n,-(b/m)*a,-(x/m)*a,{internal:!0});const w=pc(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(d?.(p,w),t.panScrollTimeout=setTimeout(()=>{h?.(p,w),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,u?.(p,w))}}function QO({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(o,s){const a=o.type==="wheel",l=!e&&a&&!o.ctrlKey,u=kr(o,t);if(o.ctrlKey&&a&&u&&o.preventDefault(),l||u)return null;o.preventDefault(),n.call(this,o,s)}}function WO({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return o=>{if(o.sourceEvent?.internal)return;const s=pc(o.transform);t.mouseButton=o.sourceEvent?.button||0,t.isZoomingOrPanning=!0,t.prevViewport=s,o.sourceEvent?.type==="mousedown"&&e(!0),n&&n?.(o.sourceEvent,s)}}function JO({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:o,onPanZoom:s}){return a=>{t.usedRightMouseButton=!!(n&&Bv(e,t.mouseButton??0)),a.sourceEvent?.sync||o([a.transform.x,a.transform.y,a.transform.k]),s&&!a.sourceEvent?.internal&&s?.(a.sourceEvent,pc(a.transform))}}function t5({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:o,onPanZoomEnd:s,onPaneContextMenu:a}){return l=>{if(!l.sourceEvent?.internal&&(t.isZoomingOrPanning=!1,a&&Bv(e,t.mouseButton??0)&&!t.usedRightMouseButton&&l.sourceEvent&&a(l.sourceEvent),t.usedRightMouseButton=!1,o(!1),s)){const u=pc(l.transform);t.prevViewport=u,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{s?.(l.sourceEvent,u)},n?150:0)}}}function e5({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:o,panOnScroll:s,zoomOnDoubleClick:a,userSelectionActive:l,noWheelClassName:u,noPanClassName:d,lib:h,connectionInProgress:p}){return m=>{const y=t||e,b=n&&m.ctrlKey,x=m.type==="wheel";if(m.button===1&&m.type==="mousedown"&&(kr(m,`${h}-flow__node`)||kr(m,`${h}-flow__edge`)))return!0;if(!o&&!y&&!s&&!a&&!n||l||p&&!x||kr(m,u)&&x||kr(m,d)&&(!x||s&&x&&!t)||!n&&m.ctrlKey&&x)return!1;if(!n&&m.type==="touchstart"&&m.touches?.length>1)return m.preventDefault(),!1;if(!y&&!s&&!b&&x||!o&&(m.type==="mousedown"||m.type==="touchstart")||Array.isArray(o)&&!o.includes(m.button)&&m.type==="mousedown")return!1;const w=Array.isArray(o)&&o.includes(m.button)||!m.button||m.button<=1;return(!m.ctrlKey||x)&&w}}function n5({domNode:t,minZoom:e,maxZoom:n,translateExtent:o,viewport:s,onPanZoom:a,onPanZoomStart:l,onPanZoomEnd:u,onDraggingChange:d}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=t.getBoundingClientRect(),m=tv().scaleExtent([e,n]).translateExtent(o),y=sn(t).call(m);k({x:s.x,y:s.y,zoom:Nr(s.zoom,e,n)},[[0,0],[p.width,p.height]],o);const b=y.on("wheel.zoom"),x=y.on("dblclick.zoom");m.wheelDelta(Hv);function w(Y,K){return y?new Promise(W=>{m?.interpolate(K?.interpolate==="linear"?Zs:Ql).transform(Gd(y,K?.duration,K?.ease,()=>W(!0)),Y)}):Promise.resolve(!1)}function _({noWheelClassName:Y,noPanClassName:K,onPaneContextMenu:W,userSelectionActive:B,panOnScroll:H,panOnDrag:j,panOnScrollMode:I,panOnScrollSpeed:z,preventScrolling:$,zoomOnPinch:G,zoomOnScroll:L,zoomOnDoubleClick:F,zoomActivationKeyPressed:et,lib:rt,onTransformChange:ct,connectionInProgress:ht,paneClickDistance:ft,selectionOnDrag:ut}){B&&!h.isZoomingOrPanning&&S();const dt=H&&!et&&!B;m.clickDistance(ut?1/0:!On(ft)||ft<0?0:ft);const Ot=dt?KO({zoomPanValues:h,noWheelClassName:Y,d3Selection:y,d3Zoom:m,panOnScrollMode:I,panOnScrollSpeed:z,zoomOnPinch:G,onPanZoomStart:l,onPanZoom:a,onPanZoomEnd:u}):QO({noWheelClassName:Y,preventScrolling:$,d3ZoomHandler:b});if(y.on("wheel.zoom",Ot,{passive:!1}),!B){const bt=WO({zoomPanValues:h,onDraggingChange:d,onPanZoomStart:l});m.on("start",bt);const Tt=JO({zoomPanValues:h,panOnDrag:j,onPaneContextMenu:!!W,onPanZoom:a,onTransformChange:ct});m.on("zoom",Tt);const Dt=t5({zoomPanValues:h,panOnDrag:j,panOnScroll:H,onPaneContextMenu:W,onPanZoomEnd:u,onDraggingChange:d});m.on("end",Dt)}const At=e5({zoomActivationKeyPressed:et,panOnDrag:j,zoomOnScroll:L,panOnScroll:H,zoomOnDoubleClick:F,zoomOnPinch:G,userSelectionActive:B,noPanClassName:K,noWheelClassName:Y,lib:rt,connectionInProgress:ht});m.filter(At),F?y.on("dblclick.zoom",x):y.on("dblclick.zoom",null)}function S(){m.on("zoom",null)}async function k(Y,K,W){const B=qd(Y),H=m?.constrain()(B,K,W);return H&&await w(H),new Promise(j=>j(H))}async function C(Y,K){const W=qd(Y);return await w(W,K),new Promise(B=>B(W))}function E(Y){if(y){const K=qd(Y),W=y.property("__zoom");(W.k!==Y.zoom||W.x!==Y.x||W.y!==Y.y)&&m?.transform(y,K,null,{sync:!0})}}function R(){const Y=y?Wy(y.node()):{x:0,y:0,k:1};return{x:Y.x,y:Y.y,zoom:Y.k}}function A(Y,K){return y?new Promise(W=>{m?.interpolate(K?.interpolate==="linear"?Zs:Ql).scaleTo(Gd(y,K?.duration,K?.ease,()=>W(!0)),Y)}):Promise.resolve(!1)}function O(Y,K){return y?new Promise(W=>{m?.interpolate(K?.interpolate==="linear"?Zs:Ql).scaleBy(Gd(y,K?.duration,K?.ease,()=>W(!0)),Y)}):Promise.resolve(!1)}function D(Y){m?.scaleExtent(Y)}function U(Y){m?.translateExtent(Y)}function q(Y){const K=!On(Y)||Y<0?0:Y;m?.clickDistance(K)}return{update:_,destroy:S,setViewport:C,setViewportConstrained:k,getViewport:R,scaleTo:A,scaleBy:O,setScaleExtent:D,setTranslateExtent:U,syncViewport:E,setClickDistance:q}}var Or;(function(t){t.Line="line",t.Handle="handle"})(Or||(Or={}));function i5({width:t,prevWidth:e,height:n,prevHeight:o,affectsX:s,affectsY:a}){const l=t-e,u=n-o,d=[l>0?1:l<0?-1:0,u>0?1:u<0?-1:0];return l&&s&&(d[0]=d[0]*-1),u&&a&&(d[1]=d[1]*-1),d}function Uv(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),o=t.includes("left"),s=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:o,affectsY:s}}function Ui(t,e){return Math.max(0,e-t)}function $i(t,e){return Math.max(0,t-e)}function mc(t,e,n){return Math.max(0,e-t,t-n)}function $v(t,e){return t?!e:e}function o5(t,e,n,o,s,a,l,u){let{affectsX:d,affectsY:h}=e;const{isHorizontal:p,isVertical:m}=e,y=p&&m,{xSnapped:b,ySnapped:x}=n,{minWidth:w,maxWidth:_,minHeight:S,maxHeight:k}=o,{x:C,y:E,width:R,height:A,aspectRatio:O}=t;let D=Math.floor(p?b-t.pointerX:0),U=Math.floor(m?x-t.pointerY:0);const q=R+(d?-D:D),Y=A+(h?-U:U),K=-a[0]*R,W=-a[1]*A;let B=mc(q,w,_),H=mc(Y,S,k);if(l){let z=0,$=0;d&&D<0?z=Ui(C+D+K,l[0][0]):!d&&D>0&&(z=$i(C+q+K,l[1][0])),h&&U<0?$=Ui(E+U+W,l[0][1]):!h&&U>0&&($=$i(E+Y+W,l[1][1])),B=Math.max(B,z),H=Math.max(H,$)}if(u){let z=0,$=0;d&&D>0?z=$i(C+D,u[0][0]):!d&&D<0&&(z=Ui(C+q,u[1][0])),h&&U>0?$=$i(E+U,u[0][1]):!h&&U<0&&($=Ui(E+Y,u[1][1])),B=Math.max(B,z),H=Math.max(H,$)}if(s){if(p){const z=mc(q/O,S,k)*O;if(B=Math.max(B,z),l){let $=0;!d&&!h||d&&!h&&y?$=$i(E+W+q/O,l[1][1])*O:$=Ui(E+W+(d?D:-D)/O,l[0][1])*O,B=Math.max(B,$)}if(u){let $=0;!d&&!h||d&&!h&&y?$=Ui(E+q/O,u[1][1])*O:$=$i(E+(d?D:-D)/O,u[0][1])*O,B=Math.max(B,$)}}if(m){const z=mc(Y*O,w,_)/O;if(H=Math.max(H,z),l){let $=0;!d&&!h||h&&!d&&y?$=$i(C+Y*O+K,l[1][0])/O:$=Ui(C+(h?U:-U)*O+K,l[0][0])/O,H=Math.max(H,$)}if(u){let $=0;!d&&!h||h&&!d&&y?$=Ui(C+Y*O,u[1][0])/O:$=$i(C+(h?U:-U)*O,u[0][0])/O,H=Math.max(H,$)}}}U=U+(U<0?H:-H),D=D+(D<0?B:-B),s&&(y?q>Y*O?U=($v(d,h)?-D:D)/O:D=($v(d,h)?-U:U)*O:p?(U=D/O,h=d):(D=U*O,d=h));const j=d?C+D:C,I=h?E+U:E;return{width:R+(d?-D:D),height:A+(h?-U:U),x:a[0]*D*(d?-1:1)+j,y:a[1]*U*(h?-1:1)+I}}const Yv={width:0,height:0,x:0,y:0},r5={...Yv,pointerX:0,pointerY:0,aspectRatio:1};function s5(t){return[[0,0],[t.measured.width,t.measured.height]]}function a5(t,e,n){const o=e.position.x+t.position.x,s=e.position.y+t.position.y,a=t.measured.width??0,l=t.measured.height??0,u=n[0]*a,d=n[1]*l;return[[o-u,s-d],[o+a-u,s+l-d]]}function l5({domNode:t,nodeId:e,getStoreItems:n,onChange:o,onEnd:s}){const a=sn(t);let l={controlDirection:Uv("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function u({controlPosition:h,boundaries:p,keepAspectRatio:m,resizeDirection:y,onResizeStart:b,onResize:x,onResizeEnd:w,shouldResize:_}){let S={...Yv},k={...r5};l={boundaries:p,resizeDirection:y,keepAspectRatio:m,controlDirection:Uv(h)};let C,E=null,R=[],A,O,D,U=!1;const q=Ey().on("start",Y=>{const{nodeLookup:K,transform:W,snapGrid:B,snapToGrid:H,nodeOrigin:j,paneDomNode:I}=n();if(C=K.get(e),!C)return;E=I?.getBoundingClientRect()??null;const{xSnapped:z,ySnapped:$}=ca(Y.sourceEvent,{transform:W,snapGrid:B,snapToGrid:H,containerBounds:E});S={width:C.measured.width??0,height:C.measured.height??0,x:C.position.x??0,y:C.position.y??0},k={...S,pointerX:z,pointerY:$,aspectRatio:S.width/S.height},A=void 0,C.parentId&&(C.extent==="parent"||C.expandParent)&&(A=K.get(C.parentId),O=A&&C.extent==="parent"?s5(A):void 0),R=[],D=void 0;for(const[G,L]of K)if(L.parentId===e&&(R.push({id:G,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){const F=a5(L,C,L.origin??j);D?D=[[Math.min(F[0][0],D[0][0]),Math.min(F[0][1],D[0][1])],[Math.max(F[1][0],D[1][0]),Math.max(F[1][1],D[1][1])]]:D=F}b?.(Y,{...S})}).on("drag",Y=>{const{transform:K,snapGrid:W,snapToGrid:B,nodeOrigin:H}=n(),j=ca(Y.sourceEvent,{transform:K,snapGrid:W,snapToGrid:B,containerBounds:E}),I=[];if(!C)return;const{x:z,y:$,width:G,height:L}=S,F={},et=C.origin??H,{width:rt,height:ct,x:ht,y:ft}=o5(k,l.controlDirection,j,l.boundaries,l.keepAspectRatio,et,O,D),ut=rt!==G,dt=ct!==L,Ot=ht!==z&&ut,At=ft!==$&&dt;if(!Ot&&!At&&!ut&&!dt)return;if((Ot||At||et[0]===1||et[1]===1)&&(F.x=Ot?ht:S.x,F.y=At?ft:S.y,S.x=F.x,S.y=F.y,R.length>0)){const Xt=ht-z,Ft=ft-$;for(const pt of R)pt.position={x:pt.position.x-Xt+et[0]*(rt-G),y:pt.position.y-Ft+et[1]*(ct-L)},I.push(pt)}if((ut||dt)&&(F.width=ut&&(!l.resizeDirection||l.resizeDirection==="horizontal")?rt:S.width,F.height=dt&&(!l.resizeDirection||l.resizeDirection==="vertical")?ct:S.height,S.width=F.width,S.height=F.height),A&&C.expandParent){const Xt=et[0]*(F.width??0);F.x&&F.x<Xt&&(S.x=Xt,k.x=k.x-(F.x-Xt));const Ft=et[1]*(F.height??0);F.y&&F.y<Ft&&(S.y=Ft,k.y=k.y-(F.y-Ft))}const bt=i5({width:S.width,prevWidth:G,height:S.height,prevHeight:L,affectsX:l.controlDirection.affectsX,affectsY:l.controlDirection.affectsY}),Tt={...S,direction:bt};_?.(Y,Tt)!==!1&&(U=!0,x?.(Y,Tt),o(F,I))}).on("end",Y=>{U&&(w?.(Y,{...S}),s?.({...S}),U=!1)});a.call(q)}function d(){a.on(".drag",null)}return{update:u,destroy:d}}var Fd={exports:{}},Xd={},Zd={exports:{}},Kd={};var qv;function c5(){if(qv)return Kd;qv=1;var t=Hs();function e(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:e,o=t.useState,s=t.useEffect,a=t.useLayoutEffect,l=t.useDebugValue;function u(m,y){var b=y(),x=o({inst:{value:b,getSnapshot:y}}),w=x[0].inst,_=x[1];return a(function(){w.value=b,w.getSnapshot=y,d(w)&&_({inst:w})},[m,b,y]),s(function(){return d(w)&&_({inst:w}),m(function(){d(w)&&_({inst:w})})},[m]),l(b),b}function d(m){var y=m.getSnapshot;m=m.value;try{var b=y();return!n(m,b)}catch{return!0}}function h(m,y){return y()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:u;return Kd.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,Kd}var Gv;function u5(){return Gv||(Gv=1,Zd.exports=c5()),Zd.exports}var Fv;function f5(){if(Fv)return Xd;Fv=1;var t=Hs(),e=u5();function n(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var o=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,a=t.useRef,l=t.useEffect,u=t.useMemo,d=t.useDebugValue;return Xd.useSyncExternalStoreWithSelector=function(h,p,m,y,b){var x=a(null);if(x.current===null){var w={hasValue:!1,value:null};x.current=w}else w=x.current;x=u(function(){function S(A){if(!k){if(k=!0,C=A,A=y(A),b!==void 0&&w.hasValue){var O=w.value;if(b(O,A))return E=O}return E=A}if(O=E,o(C,A))return O;var D=y(A);return b!==void 0&&b(O,D)?(C=A,O):(C=A,E=D)}var k=!1,C,E,R=m===void 0?null:m;return[function(){return S(p())},R===null?void 0:function(){return S(R())}]},[p,m,y,b]);var _=s(h,x[0],x[1]);return l(function(){w.hasValue=!0,w.value=_},[_]),d(_),_},Xd}var Xv;function d5(){return Xv||(Xv=1,Fd.exports=f5()),Fd.exports}var h5=d5();const p5=$f(h5),m5={},Zv=t=>{let e;const n=new Set,o=(p,m)=>{const y=typeof p=="function"?p(e):p;if(!Object.is(y,e)){const b=e;e=m??(typeof y!="object"||y===null)?y:Object.assign({},e,y),n.forEach(x=>x(e,b))}},s=()=>e,d={setState:o,getState:s,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(m5?"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."),n.clear()}},h=e=t(o,s,d);return d},g5=t=>t?Zv(t):Zv,{useDebugValue:y5}=ko,{useSyncExternalStoreWithSelector:v5}=p5,b5=t=>t;function Kv(t,e=b5,n){const o=v5(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return y5(o),o}const Qv=(t,e)=>{const n=g5(t),o=(s,a=e)=>Kv(n,s,a);return Object.assign(o,n),o},x5=(t,e)=>t?Qv(t,e):Qv;function fe(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[o,s]of t)if(!Object.is(s,e.get(o)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const o of t)if(!e.has(o))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const o of n)if(!Object.prototype.hasOwnProperty.call(e,o)||!Object.is(t[o],e[o]))return!1;return!0}var Qd=k0();const w5=$f(Qd),gc=N.createContext(null),_5=gc.Provider,Wv=Kn.error001();function Gt(t,e){const n=N.useContext(gc);if(n===null)throw new Error(Wv);return Kv(n,t,e)}function ae(){const t=N.useContext(gc);if(t===null)throw new Error(Wv);return N.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const Jv={display:"none"},S5={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},tb="react-flow__node-desc",eb="react-flow__edge-desc",E5="react-flow__aria-live",C5=t=>t.ariaLiveMessage,T5=t=>t.ariaLabelConfig;function N5({rfId:t}){const e=Gt(C5);return M.jsx("div",{id:`${E5}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:S5,children:e})}function A5({rfId:t,disableKeyboardA11y:e}){const n=Gt(T5);return M.jsxs(M.Fragment,{children:[M.jsx("div",{id:`${tb}-${t}`,style:Jv,children:e?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),M.jsx("div",{id:`${eb}-${t}`,style:Jv,children:n["edge.a11yDescription.default"]}),!e&&M.jsx(N5,{rfId:t})]})}const ua=N.forwardRef(({position:t="top-left",children:e,className:n,style:o,...s},a)=>{const l=`${t}`.split("-");return M.jsx("div",{className:we(["react-flow__panel",n,...l]),style:o,ref:a,...s,children:e})});ua.displayName="Panel";function M5({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:M.jsx(ua,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:M.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const R5=t=>{const e=[],n=[];for(const[,o]of t.nodeLookup)o.selected&&e.push(o.internals.userNode);for(const[,o]of t.edgeLookup)o.selected&&n.push(o);return{selectedNodes:e,selectedEdges:n}},yc=t=>t.id;function k5(t,e){return fe(t.selectedNodes.map(yc),e.selectedNodes.map(yc))&&fe(t.selectedEdges.map(yc),e.selectedEdges.map(yc))}function O5({onSelectionChange:t}){const e=ae(),{selectedNodes:n,selectedEdges:o}=Gt(R5,k5);return N.useEffect(()=>{const s={nodes:n,edges:o};t?.(s),e.getState().onSelectionChangeHandlers.forEach(a=>a(s))},[n,o,t]),null}const D5=t=>!!t.onSelectionChangeHandlers;function j5({onSelectionChange:t}){const e=Gt(D5);return t||e?M.jsx(O5,{onSelectionChange:t}):null}const nb=[0,0],z5={x:0,y:0,zoom:1},ib=[...["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"],"rfId"],V5=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges}),ob={translateExtent:ea,nodeOrigin:nb,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function L5(t){const{setNodes:e,setEdges:n,setMinZoom:o,setMaxZoom:s,setTranslateExtent:a,setNodeExtent:l,reset:u,setDefaultNodesAndEdges:d}=Gt(V5,fe),h=ae();N.useEffect(()=>(d(t.defaultNodes,t.defaultEdges),()=>{p.current=ob,u()}),[]);const p=N.useRef(ob);return N.useEffect(()=>{for(const m of ib){const y=t[m],b=p.current[m];y!==b&&(typeof t[m]>"u"||(m==="nodes"?e(y):m==="edges"?n(y):m==="minZoom"?o(y):m==="maxZoom"?s(y):m==="translateExtent"?a(y):m==="nodeExtent"?l(y):m==="ariaLabelConfig"?h.setState({ariaLabelConfig:xO(y)}):m==="fitView"?h.setState({fitViewQueued:y}):m==="fitViewOptions"?h.setState({fitViewOptions:y}):h.setState({[m]:y})))}p.current=t},ib.map(m=>t[m])),null}function rb(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function I5(t){const[e,n]=N.useState(t==="system"?null:t);return N.useEffect(()=>{if(t!=="system"){n(t);return}const o=rb(),s=()=>n(o?.matches?"dark":"light");return s(),o?.addEventListener("change",s),()=>{o?.removeEventListener("change",s)}},[t]),e!==null?e:rb()?.matches?"dark":"light"}const sb=typeof document<"u"?document:null;function fa(t=null,e={target:sb,actInsideInputWithModifier:!0}){const[n,o]=N.useState(!1),s=N.useRef(!1),a=N.useRef(new Set([])),[l,u]=N.useMemo(()=>{if(t!==null){const h=(Array.isArray(t)?t:[t]).filter(m=>typeof m=="string").map(m=>m.replace("+",`
|
|
19
19
|
`).replace(`
|
|
20
20
|
|
|
21
21
|
`,`
|
|
22
22
|
+`).split(`
|
|
23
|
-
`)),p=h.reduce((m,y)=>m.concat(...y),[]);return[h,p]}return[[],[]]},[t]);return N.useEffect(()=>{const d=e?.target??sb,h=e?.actInsideInputWithModifier??!0;if(t!==null){const p=b=>{if(s.current=b.ctrlKey||b.metaKey||b.shiftKey||b.altKey,(!s.current||s.current&&!h)&&yv(b))return!1;const w=lb(b.code,u);if(a.current.add(b[w]),ab(c,a.current,!1)){const S=b.composedPath?.()?.[0]||b.target,E=S?.nodeName==="BUTTON"||S?.nodeName==="A";e.preventDefault!==!1&&(s.current||!E)&&b.preventDefault(),i(!0)}},m=b=>{const x=lb(b.code,u);ab(c,a.current,!0)?(i(!1),a.current.clear()):a.current.delete(b[x]),b.key==="Meta"&&a.current.clear(),s.current=!1},y=()=>{a.current.clear(),i(!1)};return d?.addEventListener("keydown",p),d?.addEventListener("keyup",m),window.addEventListener("blur",y),window.addEventListener("contextmenu",y),()=>{d?.removeEventListener("keydown",p),d?.removeEventListener("keyup",m),window.removeEventListener("blur",y),window.removeEventListener("contextmenu",y)}}},[t,i]),n}function ab(t,e,n){return t.filter(i=>n||i.length===e.size).some(i=>i.every(s=>e.has(s)))}function lb(t,e){return e.includes(t)?"code":"key"}const kD=()=>{const t=ce();return N.useMemo(()=>({zoomIn:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1.2,{duration:e?.duration}):Promise.resolve(!1)},zoomOut:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1/1.2,{duration:e?.duration}):Promise.resolve(!1)},zoomTo:(e,n)=>{const{panZoom:i}=t.getState();return i?i.scaleTo(e,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(e,n)=>{const{transform:[i,s,a],panZoom:c}=t.getState();return c?(await c.setViewport({x:e.x??i,y:e.y??s,zoom:e.zoom??a},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[e,n,i]=t.getState().transform;return{x:e,y:n,zoom:i}},setCenter:async(e,n,i)=>t.getState().setCenter(e,n,i),fitBounds:async(e,n)=>{const{width:i,height:s,minZoom:a,maxZoom:c,panZoom:u}=t.getState(),d=Hd(e,i,s,a,c,n?.padding??.1);return u?(await u.setViewport(d,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(e,n={})=>{const{transform:i,snapGrid:s,snapToGrid:a,domNode:c}=t.getState();if(!c)return e;const{x:u,y:d}=c.getBoundingClientRect(),h={x:e.x-u,y:e.y-d},p=n.snapGrid??s,m=n.snapToGrid??a;return Da(h,i,m,p)},flowToScreenPosition:e=>{const{transform:n,domNode:i}=t.getState();if(!i)return e;const{x:s,y:a}=i.getBoundingClientRect(),c=kc(e,n);return{x:c.x+s,y:c.y+a}}}),[])};function cb(t,e){const n=[],i=new Map,s=[];for(const a of t)if(a.type==="add"){s.push(a);continue}else if(a.type==="remove"||a.type==="replace")i.set(a.id,[a]);else{const c=i.get(a.id);c?c.push(a):i.set(a.id,[a])}for(const a of e){const c=i.get(a.id);if(!c){n.push(a);continue}if(c[0].type==="remove")continue;if(c[0].type==="replace"){n.push({...c[0].item});continue}const u={...a};for(const d of c)OD(d,u);n.push(u)}return s.length&&s.forEach(a=>{a.index!==void 0?n.splice(a.index,0,{...a.item}):n.push({...a.item})}),n}function OD(t,e){switch(t.type){case"select":{e.selected=t.selected;break}case"position":{typeof t.position<"u"&&(e.position=t.position),typeof t.dragging<"u"&&(e.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(e.measured={...t.dimensions},t.setAttributes&&((t.setAttributes===!0||t.setAttributes==="width")&&(e.width=t.dimensions.width),(t.setAttributes===!0||t.setAttributes==="height")&&(e.height=t.dimensions.height))),typeof t.resizing=="boolean"&&(e.resizing=t.resizing);break}}}function ub(t,e){return cb(t,e)}function DD(t,e){return cb(t,e)}function Er(t,e){return{id:t,type:"select",selected:e}}function fs(t,e=new Set,n=!1){const i=[];for(const[s,a]of t){const c=e.has(s);!(a.selected===void 0&&!c)&&a.selected!==c&&(n&&(a.selected=c),i.push(Er(a.id,c)))}return i}function fb({items:t=[],lookup:e}){const n=[],i=new Map(t.map(s=>[s.id,s]));for(const[s,a]of t.entries()){const c=e.get(a.id),u=c?.internals?.userNode??c;u!==void 0&&u!==a&&n.push({id:a.id,item:a,type:"replace"}),u===void 0&&n.push({item:a,type:"add",index:s})}for(const[s]of e)i.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function db(t){return{id:t.id,type:"remove"}}const hb=t=>nO(t),jD=t=>sv(t);function pb(t){return N.forwardRef(t)}const zD=typeof window<"u"?N.useLayoutEffect:N.useEffect;function mb(t){const[e,n]=N.useState(BigInt(0)),[i]=N.useState(()=>VD(()=>n(s=>s+BigInt(1))));return zD(()=>{const s=i.get();s.length&&(t(s),i.reset())},[e]),i}function VD(t){let e=[];return{get:()=>e,reset:()=>{e=[]},push:n=>{e.push(n),t()}}}const gb=N.createContext(null);function LD({children:t}){const e=ce(),n=N.useCallback(u=>{const{nodes:d=[],setNodes:h,hasDefaultNodes:p,onNodesChange:m,nodeLookup:y,fitViewQueued:b,onNodesChangeMiddlewareMap:x}=e.getState();let w=d;for(const E of u)w=typeof E=="function"?E(w):E;let S=fb({items:w,lookup:y});for(const E of x.values())S=E(S);p&&h(w),S.length>0?m?.(S):b&&window.requestAnimationFrame(()=>{const{fitViewQueued:E,nodes:D,setNodes:T}=e.getState();E&&T(D)})},[]),i=mb(n),s=N.useCallback(u=>{const{edges:d=[],setEdges:h,hasDefaultEdges:p,onEdgesChange:m,edgeLookup:y}=e.getState();let b=d;for(const x of u)b=typeof x=="function"?x(b):x;p?h(b):m&&m(fb({items:b,lookup:y}))},[]),a=mb(s),c=N.useMemo(()=>({nodeQueue:i,edgeQueue:a}),[]);return M.jsx(gb.Provider,{value:c,children:t})}function ID(){const t=N.useContext(gb);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const BD=t=>!!t.panZoom;function Ia(){const t=kD(),e=ce(),n=ID(),i=Zt(BD),s=N.useMemo(()=>{const a=m=>e.getState().nodeLookup.get(m),c=m=>{n.nodeQueue.push(m)},u=m=>{n.edgeQueue.push(m)},d=m=>{const{nodeLookup:y,nodeOrigin:b}=e.getState(),x=hb(m)?m:y.get(m.id),w=x.parentId?pv(x.position,x.measured,x.parentId,y,b):x.position,S={...x,position:w,width:x.measured?.width??x.width,height:x.measured?.height??x.height};return ss(S)},h=(m,y,b={replace:!1})=>{c(x=>x.map(w=>{if(w.id===m){const S=typeof y=="function"?y(w):y;return b.replace&&hb(S)?S:{...w,...S}}return w}))},p=(m,y,b={replace:!1})=>{u(x=>x.map(w=>{if(w.id===m){const S=typeof y=="function"?y(w):y;return b.replace&&jD(S)?S:{...w,...S}}return w}))};return{getNodes:()=>e.getState().nodes.map(m=>({...m})),getNode:m=>a(m)?.internals.userNode,getInternalNode:a,getEdges:()=>{const{edges:m=[]}=e.getState();return m.map(y=>({...y}))},getEdge:m=>e.getState().edgeLookup.get(m),setNodes:c,setEdges:u,addNodes:m=>{const y=Array.isArray(m)?m:[m];n.nodeQueue.push(b=>[...b,...y])},addEdges:m=>{const y=Array.isArray(m)?m:[m];n.edgeQueue.push(b=>[...b,...y])},toObject:()=>{const{nodes:m=[],edges:y=[],transform:b}=e.getState(),[x,w,S]=b;return{nodes:m.map(E=>({...E})),edges:y.map(E=>({...E})),viewport:{x,y:w,zoom:S}}},deleteElements:async({nodes:m=[],edges:y=[]})=>{const{nodes:b,edges:x,onNodesDelete:w,onEdgesDelete:S,triggerNodeChanges:E,triggerEdgeChanges:D,onDelete:T,onBeforeDelete:C}=e.getState(),{nodes:R,edges:A}=await aO({nodesToRemove:m,edgesToRemove:y,nodes:b,edges:x,onBeforeDelete:C}),O=A.length>0,k=R.length>0;if(O){const H=A.map(db);S?.(A),D(H)}if(k){const H=R.map(db);w?.(R),E(H)}return(k||O)&&T?.({nodes:R,edges:A}),{deletedNodes:R,deletedEdges:A}},getIntersectingNodes:(m,y=!0,b)=>{const x=dv(m),w=x?m:d(m),S=b!==void 0;return w?(b||e.getState().nodes).filter(E=>{const D=e.getState().nodeLookup.get(E.id);if(D&&!x&&(E.id===m.id||!D.internals.positionAbsolute))return!1;const T=ss(S?E:D),C=ka(T,w);return y&&C>0||C>=T.width*T.height||C>=w.width*w.height}):[]},isNodeIntersecting:(m,y,b=!0)=>{const w=dv(m)?m:d(m);if(!w)return!1;const S=ka(w,y);return b&&S>0||S>=y.width*y.height||S>=w.width*w.height},updateNode:h,updateNodeData:(m,y,b={replace:!1})=>{h(m,x=>{const w=typeof y=="function"?y(x):y;return b.replace?{...x,data:w}:{...x,data:{...x.data,...w}}},b)},updateEdge:p,updateEdgeData:(m,y,b={replace:!1})=>{p(m,x=>{const w=typeof y=="function"?y(x):y;return b.replace?{...x,data:w}:{...x,data:{...x.data,...w}}},b)},getNodesBounds:m=>{const{nodeLookup:y,nodeOrigin:b}=e.getState();return oO(m,{nodeLookup:y,nodeOrigin:b})},getHandleConnections:({type:m,id:y,nodeId:b})=>Array.from(e.getState().connectionLookup.get(`${b}-${m}${y?`-${y}`:""}`)?.values()??[]),getNodeConnections:({type:m,handleId:y,nodeId:b})=>Array.from(e.getState().connectionLookup.get(`${b}${m?y?`-${m}-${y}`:`-${m}`:""}`)?.values()??[]),fitView:async m=>{const y=e.getState().fitViewResolver??fO();return e.setState({fitViewQueued:!0,fitViewOptions:m,fitViewResolver:y}),n.nodeQueue.push(b=>[...b]),y.promise}}},[]);return N.useMemo(()=>({...s,...t,viewportInitialized:i}),[i])}const yb=t=>t.selected,PD=typeof window<"u"?window:void 0;function HD({deleteKeyCode:t,multiSelectionKeyCode:e}){const n=ce(),{deleteElements:i}=Ia(),s=La(t,{actInsideInputWithModifier:!1}),a=La(e,{target:PD});N.useEffect(()=>{if(s){const{edges:c,nodes:u}=n.getState();i({nodes:u.filter(yb),edges:c.filter(yb)}),n.setState({nodesSelectionActive:!1})}},[s]),N.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])}function UD(t){const e=ce();N.useEffect(()=>{const n=()=>{if(!t.current||!(t.current.checkVisibility?.()??!0))return!1;const i=Ud(t.current);(i.height===0||i.width===0)&&e.getState().onError?.("004",ho.error004()),e.setState({width:i.width||500,height:i.height||500})};if(t.current){n(),window.addEventListener("resize",n);const i=new ResizeObserver(()=>n());return i.observe(t.current),()=>{window.removeEventListener("resize",n),i&&t.current&&i.unobserve(t.current)}}},[])}const Lc={position:"absolute",width:"100%",height:"100%",top:0,left:0},$D=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function qD({onPaneContextMenu:t,zoomOnScroll:e=!0,zoomOnPinch:n=!0,panOnScroll:i=!1,panOnScrollSpeed:s=.5,panOnScrollMode:a=xr.Free,zoomOnDoubleClick:c=!0,panOnDrag:u=!0,defaultViewport:d,translateExtent:h,minZoom:p,maxZoom:m,zoomActivationKeyCode:y,preventScrolling:b=!0,children:x,noWheelClassName:w,noPanClassName:S,onViewportChange:E,isControlledViewport:D,paneClickDistance:T,selectionOnDrag:C}){const R=ce(),A=N.useRef(null),{userSelectionActive:O,lib:k,connectionInProgress:H}=Zt($D,he),$=La(y),q=N.useRef();UD(A);const F=N.useCallback(Q=>{E?.({x:Q[0],y:Q[1],zoom:Q[2]}),D||R.setState({transform:Q})},[E,D]);return N.useEffect(()=>{if(A.current){q.current=FO({domNode:A.current,minZoom:p,maxZoom:m,translateExtent:h,viewport:d,onDraggingChange:j=>R.setState(I=>I.paneDragging===j?I:{paneDragging:j}),onPanZoomStart:(j,I)=>{const{onViewportChangeStart:z,onMoveStart:U}=R.getState();U?.(j,I),z?.(I)},onPanZoom:(j,I)=>{const{onViewportChange:z,onMove:U}=R.getState();U?.(j,I),z?.(I)},onPanZoomEnd:(j,I)=>{const{onViewportChangeEnd:z,onMoveEnd:U}=R.getState();U?.(j,I),z?.(I)}});const{x:Q,y:B,zoom:P}=q.current.getViewport();return R.setState({panZoom:q.current,transform:[Q,B,P],domNode:A.current.closest(".react-flow")}),()=>{q.current?.destroy()}}},[]),N.useEffect(()=>{q.current?.update({onPaneContextMenu:t,zoomOnScroll:e,zoomOnPinch:n,panOnScroll:i,panOnScrollSpeed:s,panOnScrollMode:a,zoomOnDoubleClick:c,panOnDrag:u,zoomActivationKeyPressed:$,preventScrolling:b,noPanClassName:S,userSelectionActive:O,noWheelClassName:w,lib:k,onTransformChange:F,connectionInProgress:H,selectionOnDrag:C,paneClickDistance:T})},[t,e,n,i,s,a,c,u,$,b,S,O,w,k,F,H,C,T]),M.jsx("div",{className:"react-flow__renderer",ref:A,style:Lc,children:x})}const YD=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function GD(){const{userSelectionActive:t,userSelectionRect:e}=Zt(YD,he);return t&&e?M.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}const sh=(t,e)=>n=>{n.target===e.current&&t?.(n)},XD=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,connectionInProgress:t.connection.inProgress,dragging:t.paneDragging});function FD({isSelecting:t,selectionKeyPressed:e,selectionMode:n=Aa.Full,panOnDrag:i,paneClickDistance:s,selectionOnDrag:a,onSelectionStart:c,onSelectionEnd:u,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:p,onPaneMouseEnter:m,onPaneMouseMove:y,onPaneMouseLeave:b,children:x}){const w=ce(),{userSelectionActive:S,elementsSelectable:E,dragging:D,connectionInProgress:T}=Zt(XD,he),C=E&&(t||S),R=N.useRef(null),A=N.useRef(),O=N.useRef(new Set),k=N.useRef(new Set),H=N.useRef(!1),$=z=>{if(H.current||T){H.current=!1;return}d?.(z),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},q=z=>{if(Array.isArray(i)&&i?.includes(2)){z.preventDefault();return}h?.(z)},F=p?z=>p(z):void 0,Q=z=>{H.current&&(z.stopPropagation(),H.current=!1)},B=z=>{const{domNode:U}=w.getState();if(A.current=U?.getBoundingClientRect(),!A.current)return;const Y=z.target===R.current;if(!Y&&!!z.target.closest(".nokey")||!t||!(a&&Y||e)||z.button!==0||!z.isPrimary)return;z.target?.setPointerCapture?.(z.pointerId),H.current=!1;const{x:tt,y:it}=Yn(z.nativeEvent,A.current);w.setState({userSelectionRect:{width:0,height:0,startX:tt,startY:it,x:tt,y:it}}),Y||(z.stopPropagation(),z.preventDefault())},P=z=>{const{userSelectionRect:U,transform:Y,nodeLookup:L,edgeLookup:G,connectionLookup:tt,triggerNodeChanges:it,triggerEdgeChanges:lt,defaultEdgeOptions:ht,resetSelectedElements:ft}=w.getState();if(!A.current||!U)return;const{x:ut,y:dt}=Yn(z.nativeEvent,A.current),{startX:Mt,startY:Nt}=U;if(!H.current){const Ht=e?0:s;if(Math.hypot(ut-Mt,dt-Nt)<=Ht)return;ft(),c?.(z)}H.current=!0;const bt={startX:Mt,startY:Nt,x:ut<Mt?ut:Mt,y:dt<Nt?dt:Nt,width:Math.abs(ut-Mt),height:Math.abs(dt-Nt)},Tt=O.current,Dt=k.current;O.current=new Set(Bd(L,bt,Y,n===Aa.Partial,!0).map(Ht=>Ht.id)),k.current=new Set;const qt=ht?.selectable??!0;for(const Ht of O.current){const pt=tt.get(Ht);if(pt)for(const{edgeId:gt}of pt.values()){const yt=G.get(gt);yt&&(yt.selectable??qt)&&k.current.add(gt)}}if(!mv(Tt,O.current)){const Ht=fs(L,O.current,!0);it(Ht)}if(!mv(Dt,k.current)){const Ht=fs(G,k.current);lt(Ht)}w.setState({userSelectionRect:bt,userSelectionActive:!0,nodesSelectionActive:!1})},j=z=>{z.button===0&&(z.target?.releasePointerCapture?.(z.pointerId),!S&&z.target===R.current&&w.getState().userSelectionRect&&$?.(z),w.setState({userSelectionActive:!1,userSelectionRect:null}),H.current&&(u?.(z),w.setState({nodesSelectionActive:O.current.size>0})))},I=i===!0||Array.isArray(i)&&i.includes(0);return M.jsxs("div",{className:_e(["react-flow__pane",{draggable:I,dragging:D,selection:t}]),onClick:C?void 0:sh($,R),onContextMenu:sh(q,R),onWheel:sh(F,R),onPointerEnter:C?void 0:m,onPointerMove:C?P:y,onPointerUp:C?j:void 0,onPointerDownCapture:C?B:void 0,onClickCapture:C?Q:void 0,onPointerLeave:b,ref:R,style:Lc,children:[x,M.jsx(GD,{})]})}function ah({id:t,store:e,unselect:n=!1,nodeRef:i}){const{addSelectedNodes:s,unselectNodesAndEdges:a,multiSelectionActive:c,nodeLookup:u,onError:d}=e.getState(),h=u.get(t);if(!h){d?.("012",ho.error012(t));return}e.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&c)&&(a({nodes:[h],edges:[]}),requestAnimationFrame(()=>i?.current?.blur())):s([t])}function vb({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:i,nodeId:s,isSelectable:a,nodeClickDistance:c}){const u=ce(),[d,h]=N.useState(!1),p=N.useRef();return N.useEffect(()=>{p.current=jO({getStoreItems:()=>u.getState(),onNodeMouseDown:m=>{ah({id:m,store:u,nodeRef:t})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),N.useEffect(()=>{if(!(e||!t.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:i,domNode:t.current,isSelectable:a,nodeId:s,nodeClickDistance:c}),()=>{p.current?.destroy()}},[n,i,e,a,t,s,c]),d}const ZD=t=>e=>e.selected&&(e.draggable||t&&typeof e.draggable>"u");function bb(){const t=ce();return N.useCallback(n=>{const{nodeExtent:i,snapToGrid:s,snapGrid:a,nodesDraggable:c,onError:u,updateNodePositions:d,nodeLookup:h,nodeOrigin:p}=t.getState(),m=new Map,y=ZD(c),b=s?a[0]:5,x=s?a[1]:5,w=n.direction.x*b*n.factor,S=n.direction.y*x*n.factor;for(const[,E]of h){if(!y(E))continue;let D={x:E.internals.positionAbsolute.x+w,y:E.internals.positionAbsolute.y+S};s&&(D=Oa(D,a));const{position:T,positionAbsolute:C}=av({nodeId:E.id,nextPosition:D,nodeLookup:h,nodeExtent:i,nodeOrigin:p,onError:u});E.position=T,E.internals.positionAbsolute=C,m.set(E.id,E)}d(m)},[])}const lh=N.createContext(null),KD=lh.Provider;lh.Consumer;const xb=()=>N.useContext(lh),QD=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),WD=(t,e,n)=>i=>{const{connectionClickStartHandle:s,connectionMode:a,connection:c}=i,{fromHandle:u,toHandle:d,isValid:h}=c,p=d?.nodeId===t&&d?.id===e&&d?.type===n;return{connectingFrom:u?.nodeId===t&&u?.id===e&&u?.type===n,connectingTo:p,clickConnecting:s?.nodeId===t&&s?.id===e&&s?.type===n,isPossibleEndHandle:a===is.Strict?u?.type!==n:t!==u?.nodeId||e!==u?.id,connectionInProcess:!!u,clickConnectionInProcess:!!s,valid:p&&h}};function JD({type:t="source",position:e=At.Top,isValidConnection:n,isConnectable:i=!0,isConnectableStart:s=!0,isConnectableEnd:a=!0,id:c,onConnect:u,children:d,className:h,onMouseDown:p,onTouchStart:m,...y},b){const x=c||null,w=t==="target",S=ce(),E=xb(),{connectOnClick:D,noPanClassName:T,rfId:C}=Zt(QD,he),{connectingFrom:R,connectingTo:A,clickConnecting:O,isPossibleEndHandle:k,connectionInProcess:H,clickConnectionInProcess:$,valid:q}=Zt(WD(E,x,t),he);E||S.getState().onError?.("010",ho.error010());const F=P=>{const{defaultEdgeOptions:j,onConnect:I,hasDefaultEdges:z}=S.getState(),U={...j,...P};if(z){const{edges:Y,setEdges:L}=S.getState();L(vO(U,Y))}I?.(U),u?.(U)},Q=P=>{if(!E)return;const j=vv(P.nativeEvent);if(s&&(j&&P.button===0||!j)){const I=S.getState();Wd.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:I.autoPanOnConnect,connectionMode:I.connectionMode,connectionRadius:I.connectionRadius,domNode:I.domNode,nodeLookup:I.nodeLookup,lib:I.lib,isTarget:w,handleId:x,nodeId:E,flowId:I.rfId,panBy:I.panBy,cancelConnection:I.cancelConnection,onConnectStart:I.onConnectStart,onConnectEnd:(...z)=>S.getState().onConnectEnd?.(...z),updateConnection:I.updateConnection,onConnect:F,isValidConnection:n||((...z)=>S.getState().isValidConnection?.(...z)??!0),getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:I.autoPanSpeed,dragThreshold:I.connectionDragThreshold})}j?p?.(P):m?.(P)},B=P=>{const{onClickConnectStart:j,onClickConnectEnd:I,connectionClickStartHandle:z,connectionMode:U,isValidConnection:Y,lib:L,rfId:G,nodeLookup:tt,connection:it}=S.getState();if(!E||!z&&!s)return;if(!z){j?.(P.nativeEvent,{nodeId:E,handleId:x,handleType:t}),S.setState({connectionClickStartHandle:{nodeId:E,type:t,id:x}});return}const lt=gv(P.target),ht=n||Y,{connection:ft,isValid:ut}=Wd.isValid(P.nativeEvent,{handle:{nodeId:E,id:x,type:t},connectionMode:U,fromNodeId:z.nodeId,fromHandleId:z.id||null,fromType:z.type,isValidConnection:ht,flowId:G,doc:lt,lib:L,nodeLookup:tt});ut&&ft&&F(ft);const dt=structuredClone(it);delete dt.inProgress,dt.toPosition=dt.toHandle?dt.toHandle.position:null,I?.(P,dt),S.setState({connectionClickStartHandle:null})};return M.jsx("div",{"data-handleid":x,"data-nodeid":E,"data-handlepos":e,"data-id":`${C}-${E}-${x}-${t}`,className:_e(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",T,h,{source:!w,target:w,connectable:i,connectablestart:s,connectableend:a,clickconnecting:O,connectingfrom:R,connectingto:A,valid:q,connectionindicator:i&&(!H||k)&&(H||$?a:s)}]),onMouseDown:Q,onTouchStart:Q,onClick:D?B:void 0,ref:b,...y,children:d})}const ds=N.memo(pb(JD));function t5({data:t,isConnectable:e,sourcePosition:n=At.Bottom}){return M.jsxs(M.Fragment,{children:[t?.label,M.jsx(ds,{type:"source",position:n,isConnectable:e})]})}function e5({data:t,isConnectable:e,targetPosition:n=At.Top,sourcePosition:i=At.Bottom}){return M.jsxs(M.Fragment,{children:[M.jsx(ds,{type:"target",position:n,isConnectable:e}),t?.label,M.jsx(ds,{type:"source",position:i,isConnectable:e})]})}function n5(){return null}function o5({data:t,isConnectable:e,targetPosition:n=At.Top}){return M.jsxs(M.Fragment,{children:[M.jsx(ds,{type:"target",position:n,isConnectable:e}),t?.label]})}const Ic={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},wb={input:t5,default:e5,output:o5,group:n5};function i5(t){return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??t.style?.width,height:t.height??t.initialHeight??t.style?.height}:{width:t.width??t.style?.width,height:t.height??t.style?.height}}const r5=t=>{const{width:e,height:n,x:i,y:s}=Ra(t.nodeLookup,{filter:a=>!!a.selected});return{width:qn(e)?e:null,height:qn(n)?n:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${i}px,${s}px)`}};function s5({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const i=ce(),{width:s,height:a,transformString:c,userSelectionActive:u}=Zt(r5,he),d=bb(),h=N.useRef(null);N.useEffect(()=>{n||h.current?.focus({preventScroll:!0})},[n]);const p=!u&&s!==null&&a!==null;if(vb({nodeRef:h,disabled:!p}),!p)return null;const m=t?b=>{const x=i.getState().nodes.filter(w=>w.selected);t(b,x)}:void 0,y=b=>{Object.prototype.hasOwnProperty.call(Ic,b.key)&&(b.preventDefault(),d({direction:Ic[b.key],factor:b.shiftKey?4:1}))};return M.jsx("div",{className:_e(["react-flow__nodesselection","react-flow__container",e]),style:{transform:c},children:M.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:m,tabIndex:n?void 0:-1,onKeyDown:n?void 0:y,style:{width:s,height:a}})})}const Sb=typeof window<"u"?window:void 0,a5=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function Eb({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:c,paneClickDistance:u,deleteKeyCode:d,selectionKeyCode:h,selectionOnDrag:p,selectionMode:m,onSelectionStart:y,onSelectionEnd:b,multiSelectionKeyCode:x,panActivationKeyCode:w,zoomActivationKeyCode:S,elementsSelectable:E,zoomOnScroll:D,zoomOnPinch:T,panOnScroll:C,panOnScrollSpeed:R,panOnScrollMode:A,zoomOnDoubleClick:O,panOnDrag:k,defaultViewport:H,translateExtent:$,minZoom:q,maxZoom:F,preventScrolling:Q,onSelectionContextMenu:B,noWheelClassName:P,noPanClassName:j,disableKeyboardA11y:I,onViewportChange:z,isControlledViewport:U}){const{nodesSelectionActive:Y,userSelectionActive:L}=Zt(a5,he),G=La(h,{target:Sb}),tt=La(w,{target:Sb}),it=tt||k,lt=tt||C,ht=p&&it!==!0,ft=G||L||ht;return HD({deleteKeyCode:d,multiSelectionKeyCode:x}),M.jsx(qD,{onPaneContextMenu:a,elementsSelectable:E,zoomOnScroll:D,zoomOnPinch:T,panOnScroll:lt,panOnScrollSpeed:R,panOnScrollMode:A,zoomOnDoubleClick:O,panOnDrag:!G&&it,defaultViewport:H,translateExtent:$,minZoom:q,maxZoom:F,zoomActivationKeyCode:S,preventScrolling:Q,noWheelClassName:P,noPanClassName:j,onViewportChange:z,isControlledViewport:U,paneClickDistance:u,selectionOnDrag:ht,children:M.jsxs(FD,{onSelectionStart:y,onSelectionEnd:b,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:it,isSelecting:!!ft,selectionMode:m,selectionKeyPressed:G,paneClickDistance:u,selectionOnDrag:ht,children:[t,Y&&M.jsx(s5,{onSelectionContextMenu:B,noPanClassName:j,disableKeyboardA11y:I})]})})}Eb.displayName="FlowRenderer";const l5=N.memo(Eb),c5=t=>e=>t?Bd(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(n=>n.id):Array.from(e.nodeLookup.keys());function u5(t){return Zt(N.useCallback(c5(t),[t]),he)}const f5=t=>t.updateNodeInternals;function d5(){const t=Zt(f5),[e]=N.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const i=new Map;n.forEach(s=>{const a=s.target.getAttribute("data-id");i.set(a,{id:a,nodeElement:s.target,force:!0})}),t(i)}));return N.useEffect(()=>()=>{e?.disconnect()},[e]),e}function h5({node:t,nodeType:e,hasDimensions:n,resizeObserver:i}){const s=ce(),a=N.useRef(null),c=N.useRef(null),u=N.useRef(t.sourcePosition),d=N.useRef(t.targetPosition),h=N.useRef(e),p=n&&!!t.internals.handleBounds;return N.useEffect(()=>{a.current&&!t.hidden&&(!p||c.current!==a.current)&&(c.current&&i?.unobserve(c.current),i?.observe(a.current),c.current=a.current)},[p,t.hidden]),N.useEffect(()=>()=>{c.current&&(i?.unobserve(c.current),c.current=null)},[]),N.useEffect(()=>{if(a.current){const m=h.current!==e,y=u.current!==t.sourcePosition,b=d.current!==t.targetPosition;(m||y||b)&&(h.current=e,u.current=t.sourcePosition,d.current=t.targetPosition,s.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:a.current,force:!0}]])))}},[t.id,e,t.sourcePosition,t.targetPosition]),a}function p5({id:t,onClick:e,onMouseEnter:n,onMouseMove:i,onMouseLeave:s,onContextMenu:a,onDoubleClick:c,nodesDraggable:u,elementsSelectable:d,nodesConnectable:h,nodesFocusable:p,resizeObserver:m,noDragClassName:y,noPanClassName:b,disableKeyboardA11y:x,rfId:w,nodeTypes:S,nodeClickDistance:E,onError:D}){const{node:T,internals:C,isParent:R}=Zt(ut=>{const dt=ut.nodeLookup.get(t),Mt=ut.parentLookup.has(t);return{node:dt,internals:dt.internals,isParent:Mt}},he);let A=T.type||"default",O=S?.[A]||wb[A];O===void 0&&(D?.("003",ho.error003(A)),A="default",O=S?.default||wb.default);const k=!!(T.draggable||u&&typeof T.draggable>"u"),H=!!(T.selectable||d&&typeof T.selectable>"u"),$=!!(T.connectable||h&&typeof T.connectable>"u"),q=!!(T.focusable||p&&typeof T.focusable>"u"),F=ce(),Q=hv(T),B=h5({node:T,nodeType:A,hasDimensions:Q,resizeObserver:m}),P=vb({nodeRef:B,disabled:T.hidden||!k,noDragClassName:y,handleSelector:T.dragHandle,nodeId:t,isSelectable:H,nodeClickDistance:E}),j=bb();if(T.hidden)return null;const I=Do(T),z=i5(T),U=H||k||e||n||i||s,Y=n?ut=>n(ut,{...C.userNode}):void 0,L=i?ut=>i(ut,{...C.userNode}):void 0,G=s?ut=>s(ut,{...C.userNode}):void 0,tt=a?ut=>a(ut,{...C.userNode}):void 0,it=c?ut=>c(ut,{...C.userNode}):void 0,lt=ut=>{const{selectNodesOnDrag:dt,nodeDragThreshold:Mt}=F.getState();H&&(!dt||!k||Mt>0)&&ah({id:t,store:F,nodeRef:B}),e&&e(ut,{...C.userNode})},ht=ut=>{if(!(yv(ut.nativeEvent)||x)){if(ev.includes(ut.key)&&H){const dt=ut.key==="Escape";ah({id:t,store:F,unselect:dt,nodeRef:B})}else if(k&&T.selected&&Object.prototype.hasOwnProperty.call(Ic,ut.key)){ut.preventDefault();const{ariaLabelConfig:dt}=F.getState();F.setState({ariaLiveMessage:dt["node.a11yDescription.ariaLiveMessage"]({direction:ut.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),j({direction:Ic[ut.key],factor:ut.shiftKey?4:1})}}},ft=()=>{if(x||!B.current?.matches(":focus-visible"))return;const{transform:ut,width:dt,height:Mt,autoPanOnNodeFocus:Nt,setCenter:bt}=F.getState();if(!Nt)return;Bd(new Map([[t,T]]),{x:0,y:0,width:dt,height:Mt},ut,!0).length>0||bt(T.position.x+I.width/2,T.position.y+I.height/2,{zoom:ut[2]})};return M.jsx("div",{className:_e(["react-flow__node",`react-flow__node-${A}`,{[b]:k},T.className,{selected:T.selected,selectable:H,parent:R,draggable:k,dragging:P}]),ref:B,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:U?"all":"none",visibility:Q?"visible":"hidden",...T.style,...z},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:Y,onMouseMove:L,onMouseLeave:G,onContextMenu:tt,onClick:lt,onDoubleClick:it,onKeyDown:q?ht:void 0,tabIndex:q?0:void 0,onFocus:q?ft:void 0,role:T.ariaRole??(q?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${tb}-${w}`,"aria-label":T.ariaLabel,...T.domAttributes,children:M.jsx(KD,{value:t,children:M.jsx(O,{id:t,data:T.data,type:A,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:T.selected??!1,selectable:H,draggable:k,deletable:T.deletable??!0,isConnectable:$,sourcePosition:T.sourcePosition,targetPosition:T.targetPosition,dragging:P,dragHandle:T.dragHandle,zIndex:C.z,parentId:T.parentId,...I})})})}var m5=N.memo(p5);const g5=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function Cb(t){const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:i,elementsSelectable:s,onError:a}=Zt(g5,he),c=u5(t.onlyRenderVisibleElements),u=d5();return M.jsx("div",{className:"react-flow__nodes",style:Lc,children:c.map(d=>M.jsx(m5,{id:d,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:u,nodesDraggable:e,nodesConnectable:n,nodesFocusable:i,elementsSelectable:s,nodeClickDistance:t.nodeClickDistance,onError:a},d))})}Cb.displayName="NodeRenderer";const y5=N.memo(Cb);function v5(t){return Zt(N.useCallback(n=>{if(!t)return n.edges.map(s=>s.id);const i=[];if(n.width&&n.height)for(const s of n.edges){const a=n.nodeLookup.get(s.source),c=n.nodeLookup.get(s.target);a&&c&&mO({sourceNode:a,targetNode:c,width:n.width,height:n.height,transform:n.transform})&&i.push(s.id)}return i},[t]),he)}const b5=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t}};return M.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},x5=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t,fill:t}};return M.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Tb={[Nc.Arrow]:b5,[Nc.ArrowClosed]:x5};function w5(t){const e=ce();return N.useMemo(()=>Object.prototype.hasOwnProperty.call(Tb,t)?Tb[t]:(e.getState().onError?.("009",ho.error009(t)),null),[t])}const S5=({id:t,type:e,color:n,width:i=12.5,height:s=12.5,markerUnits:a="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const d=w5(e);return d?M.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${i}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:u,refX:"0",refY:"0",children:M.jsx(d,{color:n,strokeWidth:c})}):null},_b=({defaultColor:t,rfId:e})=>{const n=Zt(a=>a.edges),i=Zt(a=>a.defaultEdgeOptions),s=N.useMemo(()=>EO(n,{id:e,defaultColor:t,defaultMarkerStart:i?.markerStart,defaultMarkerEnd:i?.markerEnd}),[n,i,e,t]);return s.length?M.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:M.jsx("defs",{children:s.map(a=>M.jsx(S5,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};_b.displayName="MarkerDefinitions";var E5=N.memo(_b);function Nb({x:t,y:e,label:n,labelStyle:i,labelShowBg:s=!0,labelBgStyle:a,labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:d,className:h,...p}){const[m,y]=N.useState({x:1,y:0,width:0,height:0}),b=_e(["react-flow__edge-textwrapper",h]),x=N.useRef(null);return N.useEffect(()=>{if(x.current){const w=x.current.getBBox();y({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?M.jsxs("g",{transform:`translate(${t-m.width/2} ${e-m.height/2})`,className:b,visibility:m.width?"visible":"hidden",...p,children:[s&&M.jsx("rect",{width:m.width+2*c[0],x:-c[0],y:-c[1],height:m.height+2*c[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),M.jsx("text",{className:"react-flow__edge-text",y:m.height/2,dy:"0.3em",ref:x,style:i,children:n}),d]}):null}Nb.displayName="EdgeText";const C5=N.memo(Nb);function Bc({path:t,labelX:e,labelY:n,label:i,labelStyle:s,labelShowBg:a,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,interactionWidth:h=20,...p}){return M.jsxs(M.Fragment,{children:[M.jsx("path",{...p,d:t,fill:"none",className:_e(["react-flow__edge-path",p.className])}),h?M.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,i&&qn(e)&&qn(n)?M.jsx(C5,{x:e,y:n,label:i,labelStyle:s,labelShowBg:a,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d}):null]})}function Ab({pos:t,x1:e,y1:n,x2:i,y2:s}){return t===At.Left||t===At.Right?[.5*(e+i),n]:[e,.5*(n+s)]}function Mb({sourceX:t,sourceY:e,sourcePosition:n=At.Bottom,targetX:i,targetY:s,targetPosition:a=At.Top}){const[c,u]=Ab({pos:n,x1:t,y1:e,x2:i,y2:s}),[d,h]=Ab({pos:a,x1:i,y1:s,x2:t,y2:e}),[p,m,y,b]=xv({sourceX:t,sourceY:e,targetX:i,targetY:s,sourceControlX:c,sourceControlY:u,targetControlX:d,targetControlY:h});return[`M${t},${e} C${c},${u} ${d},${h} ${i},${s}`,p,m,y,b]}function Rb(t){return N.memo(({id:e,sourceX:n,sourceY:i,targetX:s,targetY:a,sourcePosition:c,targetPosition:u,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:S,interactionWidth:E})=>{const[D,T,C]=Mb({sourceX:n,sourceY:i,sourcePosition:c,targetX:s,targetY:a,targetPosition:u}),R=t.isInternal?void 0:e;return M.jsx(Bc,{id:R,path:D,labelX:T,labelY:C,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:S,interactionWidth:E})})}const T5=Rb({isInternal:!1}),kb=Rb({isInternal:!0});T5.displayName="SimpleBezierEdge",kb.displayName="SimpleBezierEdgeInternal";function Ob(t){return N.memo(({id:e,sourceX:n,sourceY:i,targetX:s,targetY:a,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,sourcePosition:b=At.Bottom,targetPosition:x=At.Top,markerEnd:w,markerStart:S,pathOptions:E,interactionWidth:D})=>{const[T,C,R]=$d({sourceX:n,sourceY:i,sourcePosition:b,targetX:s,targetY:a,targetPosition:x,borderRadius:E?.borderRadius,offset:E?.offset,stepPosition:E?.stepPosition}),A=t.isInternal?void 0:e;return M.jsx(Bc,{id:A,path:T,labelX:C,labelY:R,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:S,interactionWidth:D})})}const ch=Ob({isInternal:!1}),Db=Ob({isInternal:!0});ch.displayName="SmoothStepEdge",Db.displayName="SmoothStepEdgeInternal";function jb(t){return N.memo(({id:e,...n})=>{const i=t.isInternal?void 0:e;return M.jsx(ch,{...n,id:i,pathOptions:N.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const _5=jb({isInternal:!1}),zb=jb({isInternal:!0});_5.displayName="StepEdge",zb.displayName="StepEdgeInternal";function Vb(t){return N.memo(({id:e,sourceX:n,sourceY:i,targetX:s,targetY:a,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:x,interactionWidth:w})=>{const[S,E,D]=Cv({sourceX:n,sourceY:i,targetX:s,targetY:a}),T=t.isInternal?void 0:e;return M.jsx(Bc,{id:T,path:S,labelX:E,labelY:D,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:x,interactionWidth:w})})}const N5=Vb({isInternal:!1}),Lb=Vb({isInternal:!0});N5.displayName="StraightEdge",Lb.displayName="StraightEdgeInternal";function Ib(t){return N.memo(({id:e,sourceX:n,sourceY:i,targetX:s,targetY:a,sourcePosition:c=At.Bottom,targetPosition:u=At.Top,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:S,pathOptions:E,interactionWidth:D})=>{const[T,C,R]=Sv({sourceX:n,sourceY:i,sourcePosition:c,targetX:s,targetY:a,targetPosition:u,curvature:E?.curvature}),A=t.isInternal?void 0:e;return M.jsx(Bc,{id:A,path:T,labelX:C,labelY:R,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:S,interactionWidth:D})})}const A5=Ib({isInternal:!1}),Bb=Ib({isInternal:!0});A5.displayName="BezierEdge",Bb.displayName="BezierEdgeInternal";const Pb={default:Bb,straight:Lb,step:zb,smoothstep:Db,simplebezier:kb},Hb={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},M5=(t,e,n)=>n===At.Left?t-e:n===At.Right?t+e:t,R5=(t,e,n)=>n===At.Top?t-e:n===At.Bottom?t+e:t,Ub="react-flow__edgeupdater";function $b({position:t,centerX:e,centerY:n,radius:i=10,onMouseDown:s,onMouseEnter:a,onMouseOut:c,type:u}){return M.jsx("circle",{onMouseDown:s,onMouseEnter:a,onMouseOut:c,className:_e([Ub,`${Ub}-${u}`]),cx:M5(e,i,t),cy:R5(n,i,t),r:i,stroke:"transparent",fill:"transparent"})}function k5({isReconnectable:t,reconnectRadius:e,edge:n,sourceX:i,sourceY:s,targetX:a,targetY:c,sourcePosition:u,targetPosition:d,onReconnect:h,onReconnectStart:p,onReconnectEnd:m,setReconnecting:y,setUpdateHover:b}){const x=ce(),w=(C,R)=>{if(C.button!==0)return;const{autoPanOnConnect:A,domNode:O,connectionMode:k,connectionRadius:H,lib:$,onConnectStart:q,cancelConnection:F,nodeLookup:Q,rfId:B,panBy:P,updateConnection:j}=x.getState(),I=R.type==="target",z=(L,G)=>{y(!1),m?.(L,n,R.type,G)},U=L=>h?.(n,L),Y=(L,G)=>{y(!0),p?.(C,n,R.type),q?.(L,G)};Wd.onPointerDown(C.nativeEvent,{autoPanOnConnect:A,connectionMode:k,connectionRadius:H,domNode:O,handleId:R.id,nodeId:R.nodeId,nodeLookup:Q,isTarget:I,edgeUpdaterType:R.type,lib:$,flowId:B,cancelConnection:F,panBy:P,isValidConnection:(...L)=>x.getState().isValidConnection?.(...L)??!0,onConnect:U,onConnectStart:Y,onConnectEnd:(...L)=>x.getState().onConnectEnd?.(...L),onReconnectEnd:z,updateConnection:j,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,dragThreshold:x.getState().connectionDragThreshold,handleDomNode:C.currentTarget})},S=C=>w(C,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),E=C=>w(C,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),D=()=>b(!0),T=()=>b(!1);return M.jsxs(M.Fragment,{children:[(t===!0||t==="source")&&M.jsx($b,{position:u,centerX:i,centerY:s,radius:e,onMouseDown:S,onMouseEnter:D,onMouseOut:T,type:"source"}),(t===!0||t==="target")&&M.jsx($b,{position:d,centerX:a,centerY:c,radius:e,onMouseDown:E,onMouseEnter:D,onMouseOut:T,type:"target"})]})}function O5({id:t,edgesFocusable:e,edgesReconnectable:n,elementsSelectable:i,onClick:s,onDoubleClick:a,onContextMenu:c,onMouseEnter:u,onMouseMove:d,onMouseLeave:h,reconnectRadius:p,onReconnect:m,onReconnectStart:y,onReconnectEnd:b,rfId:x,edgeTypes:w,noPanClassName:S,onError:E,disableKeyboardA11y:D}){let T=Zt(bt=>bt.edgeLookup.get(t));const C=Zt(bt=>bt.defaultEdgeOptions);T=C?{...C,...T}:T;let R=T.type||"default",A=w?.[R]||Pb[R];A===void 0&&(E?.("011",ho.error011(R)),R="default",A=w?.default||Pb.default);const O=!!(T.focusable||e&&typeof T.focusable>"u"),k=typeof m<"u"&&(T.reconnectable||n&&typeof T.reconnectable>"u"),H=!!(T.selectable||i&&typeof T.selectable>"u"),$=N.useRef(null),[q,F]=N.useState(!1),[Q,B]=N.useState(!1),P=ce(),{zIndex:j,sourceX:I,sourceY:z,targetX:U,targetY:Y,sourcePosition:L,targetPosition:G}=Zt(N.useCallback(bt=>{const Tt=bt.nodeLookup.get(T.source),Dt=bt.nodeLookup.get(T.target);if(!Tt||!Dt)return{zIndex:T.zIndex,...Hb};const qt=SO({id:t,sourceNode:Tt,targetNode:Dt,sourceHandle:T.sourceHandle||null,targetHandle:T.targetHandle||null,connectionMode:bt.connectionMode,onError:E});return{zIndex:pO({selected:T.selected,zIndex:T.zIndex,sourceNode:Tt,targetNode:Dt,elevateOnSelect:bt.elevateEdgesOnSelect,zIndexMode:bt.zIndexMode}),...qt||Hb}},[T.source,T.target,T.sourceHandle,T.targetHandle,T.selected,T.zIndex]),he),tt=N.useMemo(()=>T.markerStart?`url('#${qd(T.markerStart,x)}')`:void 0,[T.markerStart,x]),it=N.useMemo(()=>T.markerEnd?`url('#${qd(T.markerEnd,x)}')`:void 0,[T.markerEnd,x]);if(T.hidden||I===null||z===null||U===null||Y===null)return null;const lt=bt=>{const{addSelectedEdges:Tt,unselectNodesAndEdges:Dt,multiSelectionActive:qt}=P.getState();H&&(P.setState({nodesSelectionActive:!1}),T.selected&&qt?(Dt({nodes:[],edges:[T]}),$.current?.blur()):Tt([t])),s&&s(bt,T)},ht=a?bt=>{a(bt,{...T})}:void 0,ft=c?bt=>{c(bt,{...T})}:void 0,ut=u?bt=>{u(bt,{...T})}:void 0,dt=d?bt=>{d(bt,{...T})}:void 0,Mt=h?bt=>{h(bt,{...T})}:void 0,Nt=bt=>{if(!D&&ev.includes(bt.key)&&H){const{unselectNodesAndEdges:Tt,addSelectedEdges:Dt}=P.getState();bt.key==="Escape"?($.current?.blur(),Tt({edges:[T]})):Dt([t])}};return M.jsx("svg",{style:{zIndex:j},children:M.jsxs("g",{className:_e(["react-flow__edge",`react-flow__edge-${R}`,T.className,S,{selected:T.selected,animated:T.animated,inactive:!H&&!s,updating:q,selectable:H}]),onClick:lt,onDoubleClick:ht,onContextMenu:ft,onMouseEnter:ut,onMouseMove:dt,onMouseLeave:Mt,onKeyDown:O?Nt:void 0,tabIndex:O?0:void 0,role:T.ariaRole??(O?"group":"img"),"aria-roledescription":"edge","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":T.ariaLabel===null?void 0:T.ariaLabel||`Edge from ${T.source} to ${T.target}`,"aria-describedby":O?`${eb}-${x}`:void 0,ref:$,...T.domAttributes,children:[!Q&&M.jsx(A,{id:t,source:T.source,target:T.target,type:T.type,selected:T.selected,animated:T.animated,selectable:H,deletable:T.deletable??!0,label:T.label,labelStyle:T.labelStyle,labelShowBg:T.labelShowBg,labelBgStyle:T.labelBgStyle,labelBgPadding:T.labelBgPadding,labelBgBorderRadius:T.labelBgBorderRadius,sourceX:I,sourceY:z,targetX:U,targetY:Y,sourcePosition:L,targetPosition:G,data:T.data,style:T.style,sourceHandleId:T.sourceHandle,targetHandleId:T.targetHandle,markerStart:tt,markerEnd:it,pathOptions:"pathOptions"in T?T.pathOptions:void 0,interactionWidth:T.interactionWidth}),k&&M.jsx(k5,{edge:T,isReconnectable:k,reconnectRadius:p,onReconnect:m,onReconnectStart:y,onReconnectEnd:b,sourceX:I,sourceY:z,targetX:U,targetY:Y,sourcePosition:L,targetPosition:G,setUpdateHover:F,setReconnecting:B})]})})}var D5=N.memo(O5);const j5=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function qb({defaultMarkerColor:t,onlyRenderVisibleElements:e,rfId:n,edgeTypes:i,noPanClassName:s,onReconnect:a,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:d,onEdgeMouseLeave:h,onEdgeClick:p,reconnectRadius:m,onEdgeDoubleClick:y,onReconnectStart:b,onReconnectEnd:x,disableKeyboardA11y:w}){const{edgesFocusable:S,edgesReconnectable:E,elementsSelectable:D,onError:T}=Zt(j5,he),C=v5(e);return M.jsxs("div",{className:"react-flow__edges",children:[M.jsx(E5,{defaultColor:t,rfId:n}),C.map(R=>M.jsx(D5,{id:R,edgesFocusable:S,edgesReconnectable:E,elementsSelectable:D,noPanClassName:s,onReconnect:a,onContextMenu:c,onMouseEnter:u,onMouseMove:d,onMouseLeave:h,onClick:p,reconnectRadius:m,onDoubleClick:y,onReconnectStart:b,onReconnectEnd:x,rfId:n,onError:T,edgeTypes:i,disableKeyboardA11y:w},R))]})}qb.displayName="EdgeRenderer";const z5=N.memo(qb),V5=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function L5({children:t}){const e=Zt(V5);return M.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:e},children:t})}function I5(t){const e=Ia(),n=N.useRef(!1);N.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const B5=t=>t.panZoom?.syncViewport;function P5(t){const e=Zt(B5),n=ce();return N.useEffect(()=>{t&&(e?.(t),n.setState({transform:[t.x,t.y,t.zoom]}))},[t,e]),null}function H5(t){return t.connection.inProgress?{...t.connection,to:Da(t.connection.to,t.transform)}:{...t.connection}}function U5(t){return H5}function $5(t){const e=U5();return Zt(e,he)}const q5=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function Y5({containerStyle:t,style:e,type:n,component:i}){const{nodesConnectable:s,width:a,height:c,isValid:u,inProgress:d}=Zt(q5,he);return!(a&&s&&d)?null:M.jsx("svg",{style:t,width:a,height:c,className:"react-flow__connectionline react-flow__container",children:M.jsx("g",{className:_e(["react-flow__connection",rv(u)]),children:M.jsx(Yb,{style:e,type:n,CustomComponent:i,isValid:u})})})}const Yb=({style:t,type:e=fi.Bezier,CustomComponent:n,isValid:i})=>{const{inProgress:s,from:a,fromNode:c,fromHandle:u,fromPosition:d,to:h,toNode:p,toHandle:m,toPosition:y,pointer:b}=$5();if(!s)return;if(n)return M.jsx(n,{connectionLineType:e,connectionLineStyle:t,fromNode:c,fromHandle:u,fromX:a.x,fromY:a.y,toX:h.x,toY:h.y,fromPosition:d,toPosition:y,connectionStatus:rv(i),toNode:p,toHandle:m,pointer:b});let x="";const w={sourceX:a.x,sourceY:a.y,sourcePosition:d,targetX:h.x,targetY:h.y,targetPosition:y};switch(e){case fi.Bezier:[x]=Sv(w);break;case fi.SimpleBezier:[x]=Mb(w);break;case fi.Step:[x]=$d({...w,borderRadius:0});break;case fi.SmoothStep:[x]=$d(w);break;default:[x]=Cv(w)}return M.jsx("path",{d:x,fill:"none",className:"react-flow__connection-path",style:t})};Yb.displayName="ConnectionLine";const G5={};function Gb(t=G5){N.useRef(t),ce(),N.useEffect(()=>{},[t])}function X5(){ce(),N.useRef(!1),N.useEffect(()=>{},[])}function Xb({nodeTypes:t,edgeTypes:e,onInit:n,onNodeClick:i,onEdgeClick:s,onNodeDoubleClick:a,onEdgeDoubleClick:c,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:p,onSelectionContextMenu:m,onSelectionStart:y,onSelectionEnd:b,connectionLineType:x,connectionLineStyle:w,connectionLineComponent:S,connectionLineContainerStyle:E,selectionKeyCode:D,selectionOnDrag:T,selectionMode:C,multiSelectionKeyCode:R,panActivationKeyCode:A,zoomActivationKeyCode:O,deleteKeyCode:k,onlyRenderVisibleElements:H,elementsSelectable:$,defaultViewport:q,translateExtent:F,minZoom:Q,maxZoom:B,preventScrolling:P,defaultMarkerColor:j,zoomOnScroll:I,zoomOnPinch:z,panOnScroll:U,panOnScrollSpeed:Y,panOnScrollMode:L,zoomOnDoubleClick:G,panOnDrag:tt,onPaneClick:it,onPaneMouseEnter:lt,onPaneMouseMove:ht,onPaneMouseLeave:ft,onPaneScroll:ut,onPaneContextMenu:dt,paneClickDistance:Mt,nodeClickDistance:Nt,onEdgeContextMenu:bt,onEdgeMouseEnter:Tt,onEdgeMouseMove:Dt,onEdgeMouseLeave:qt,reconnectRadius:Ht,onReconnect:pt,onReconnectStart:gt,onReconnectEnd:yt,noDragClassName:mt,noWheelClassName:Et,noPanClassName:Vt,disableKeyboardA11y:jt,nodeExtent:zt,rfId:ue,viewport:Xt,onViewportChange:xe}){return Gb(t),Gb(e),X5(),I5(n),P5(Xt),M.jsx(l5,{onPaneClick:it,onPaneMouseEnter:lt,onPaneMouseMove:ht,onPaneMouseLeave:ft,onPaneContextMenu:dt,onPaneScroll:ut,paneClickDistance:Mt,deleteKeyCode:k,selectionKeyCode:D,selectionOnDrag:T,selectionMode:C,onSelectionStart:y,onSelectionEnd:b,multiSelectionKeyCode:R,panActivationKeyCode:A,zoomActivationKeyCode:O,elementsSelectable:$,zoomOnScroll:I,zoomOnPinch:z,zoomOnDoubleClick:G,panOnScroll:U,panOnScrollSpeed:Y,panOnScrollMode:L,panOnDrag:tt,defaultViewport:q,translateExtent:F,minZoom:Q,maxZoom:B,onSelectionContextMenu:m,preventScrolling:P,noDragClassName:mt,noWheelClassName:Et,noPanClassName:Vt,disableKeyboardA11y:jt,onViewportChange:xe,isControlledViewport:!!Xt,children:M.jsxs(L5,{children:[M.jsx(z5,{edgeTypes:e,onEdgeClick:s,onEdgeDoubleClick:c,onReconnect:pt,onReconnectStart:gt,onReconnectEnd:yt,onlyRenderVisibleElements:H,onEdgeContextMenu:bt,onEdgeMouseEnter:Tt,onEdgeMouseMove:Dt,onEdgeMouseLeave:qt,reconnectRadius:Ht,defaultMarkerColor:j,noPanClassName:Vt,disableKeyboardA11y:jt,rfId:ue}),M.jsx(Y5,{style:w,type:x,component:S,containerStyle:E}),M.jsx("div",{className:"react-flow__edgelabel-renderer"}),M.jsx(y5,{nodeTypes:t,onNodeClick:i,onNodeDoubleClick:a,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:p,nodeClickDistance:Nt,onlyRenderVisibleElements:H,noPanClassName:Vt,noDragClassName:mt,disableKeyboardA11y:jt,nodeExtent:zt,rfId:ue}),M.jsx("div",{className:"react-flow__viewport-portal"})]})})}Xb.displayName="GraphView";const F5=N.memo(Xb),Fb=({nodes:t,edges:e,defaultNodes:n,defaultEdges:i,width:s,height:a,fitView:c,fitViewOptions:u,minZoom:d=.5,maxZoom:h=2,nodeOrigin:p,nodeExtent:m,zIndexMode:y="basic"}={})=>{const b=new Map,x=new Map,w=new Map,S=new Map,E=i??e??[],D=n??t??[],T=p??[0,0],C=m??Na;Dv(w,S,E);const R=Fd(D,b,x,{nodeOrigin:T,nodeExtent:C,zIndexMode:y});let A=[0,0,1];if(c&&s&&a){const O=Ra(b,{filter:q=>!!((q.width||q.initialWidth)&&(q.height||q.initialHeight))}),{x:k,y:H,zoom:$}=Hd(O,s,a,d,h,u?.padding??.1);A=[k,H,$]}return{rfId:"1",width:s??0,height:a??0,transform:A,nodes:D,nodesInitialized:R,nodeLookup:b,parentLookup:x,edges:E,edgeLookup:S,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:d,maxZoom:h,translateExtent:Na,nodeExtent:C,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:is.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:T,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:c??!1,fitViewOptions:u,fitViewResolver:null,connection:{...ov},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:lO,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:nv,zIndexMode:y,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Z5=({nodes:t,edges:e,defaultNodes:n,defaultEdges:i,width:s,height:a,fitView:c,fitViewOptions:u,minZoom:d,maxZoom:h,nodeOrigin:p,nodeExtent:m,zIndexMode:y})=>dD((b,x)=>{async function w(){const{nodeLookup:S,panZoom:E,fitViewOptions:D,fitViewResolver:T,width:C,height:R,minZoom:A,maxZoom:O}=x();E&&(await sO({nodes:S,width:C,height:R,panZoom:E,minZoom:A,maxZoom:O},D),T?.resolve(!0),b({fitViewResolver:null}))}return{...Fb({nodes:t,edges:e,width:s,height:a,fitView:c,fitViewOptions:u,minZoom:d,maxZoom:h,nodeOrigin:p,nodeExtent:m,defaultNodes:n,defaultEdges:i,zIndexMode:y}),setNodes:S=>{const{nodeLookup:E,parentLookup:D,nodeOrigin:T,elevateNodesOnSelect:C,fitViewQueued:R,zIndexMode:A}=x(),O=Fd(S,E,D,{nodeOrigin:T,nodeExtent:m,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:A});R&&O?(w(),b({nodes:S,nodesInitialized:O,fitViewQueued:!1,fitViewOptions:void 0})):b({nodes:S,nodesInitialized:O})},setEdges:S=>{const{connectionLookup:E,edgeLookup:D}=x();Dv(E,D,S),b({edges:S})},setDefaultNodesAndEdges:(S,E)=>{if(S){const{setNodes:D}=x();D(S),b({hasDefaultNodes:!0})}if(E){const{setEdges:D}=x();D(E),b({hasDefaultEdges:!0})}},updateNodeInternals:S=>{const{triggerNodeChanges:E,nodeLookup:D,parentLookup:T,domNode:C,nodeOrigin:R,nodeExtent:A,debug:O,fitViewQueued:k,zIndexMode:H}=x(),{changes:$,updatedInternals:q}=RO(S,D,T,C,R,A,H);q&&(_O(D,T,{nodeOrigin:R,nodeExtent:A,zIndexMode:H}),k?(w(),b({fitViewQueued:!1,fitViewOptions:void 0})):b({}),$?.length>0&&(O&&console.log("React Flow: trigger node changes",$),E?.($)))},updateNodePositions:(S,E=!1)=>{const D=[];let T=[];const{nodeLookup:C,triggerNodeChanges:R,connection:A,updateConnection:O,onNodesChangeMiddlewareMap:k}=x();for(const[H,$]of S){const q=C.get(H),F=!!(q?.expandParent&&q?.parentId&&$?.position),Q={id:H,type:"position",position:F?{x:Math.max(0,$.position.x),y:Math.max(0,$.position.y)}:$.position,dragging:E};if(q&&A.inProgress&&A.fromNode.id===q.id){const B=Sr(q,A.fromHandle,At.Left,!0);O({...A,from:B})}F&&q.parentId&&D.push({id:H,parentId:q.parentId,rect:{...$.internals.positionAbsolute,width:$.measured.width??0,height:$.measured.height??0}}),T.push(Q)}if(D.length>0){const{parentLookup:H,nodeOrigin:$}=x(),q=Kd(D,C,H,$);T.push(...q)}for(const H of k.values())T=H(T);R(T)},triggerNodeChanges:S=>{const{onNodesChange:E,setNodes:D,nodes:T,hasDefaultNodes:C,debug:R}=x();if(S?.length){if(C){const A=ub(S,T);D(A)}R&&console.log("React Flow: trigger node changes",S),E?.(S)}},triggerEdgeChanges:S=>{const{onEdgesChange:E,setEdges:D,edges:T,hasDefaultEdges:C,debug:R}=x();if(S?.length){if(C){const A=DD(S,T);D(A)}R&&console.log("React Flow: trigger edge changes",S),E?.(S)}},addSelectedNodes:S=>{const{multiSelectionActive:E,edgeLookup:D,nodeLookup:T,triggerNodeChanges:C,triggerEdgeChanges:R}=x();if(E){const A=S.map(O=>Er(O,!0));C(A);return}C(fs(T,new Set([...S]),!0)),R(fs(D))},addSelectedEdges:S=>{const{multiSelectionActive:E,edgeLookup:D,nodeLookup:T,triggerNodeChanges:C,triggerEdgeChanges:R}=x();if(E){const A=S.map(O=>Er(O,!0));R(A);return}R(fs(D,new Set([...S]))),C(fs(T,new Set,!0))},unselectNodesAndEdges:({nodes:S,edges:E}={})=>{const{edges:D,nodes:T,nodeLookup:C,triggerNodeChanges:R,triggerEdgeChanges:A}=x(),O=S||T,k=E||D,H=[];for(const q of O){if(!q.selected)continue;const F=C.get(q.id);F&&(F.selected=!1),H.push(Er(q.id,!1))}const $=[];for(const q of k)q.selected&&$.push(Er(q.id,!1));R(H),A($)},setMinZoom:S=>{const{panZoom:E,maxZoom:D}=x();E?.setScaleExtent([S,D]),b({minZoom:S})},setMaxZoom:S=>{const{panZoom:E,minZoom:D}=x();E?.setScaleExtent([D,S]),b({maxZoom:S})},setTranslateExtent:S=>{x().panZoom?.setTranslateExtent(S),b({translateExtent:S})},resetSelectedElements:()=>{const{edges:S,nodes:E,triggerNodeChanges:D,triggerEdgeChanges:T,elementsSelectable:C}=x();if(!C)return;const R=E.reduce((O,k)=>k.selected?[...O,Er(k.id,!1)]:O,[]),A=S.reduce((O,k)=>k.selected?[...O,Er(k.id,!1)]:O,[]);D(R),T(A)},setNodeExtent:S=>{const{nodes:E,nodeLookup:D,parentLookup:T,nodeOrigin:C,elevateNodesOnSelect:R,nodeExtent:A,zIndexMode:O}=x();S[0][0]===A[0][0]&&S[0][1]===A[0][1]&&S[1][0]===A[1][0]&&S[1][1]===A[1][1]||(Fd(E,D,T,{nodeOrigin:C,nodeExtent:S,elevateNodesOnSelect:R,checkEquality:!1,zIndexMode:O}),b({nodeExtent:S}))},panBy:S=>{const{transform:E,width:D,height:T,panZoom:C,translateExtent:R}=x();return kO({delta:S,panZoom:C,transform:E,translateExtent:R,width:D,height:T})},setCenter:async(S,E,D)=>{const{width:T,height:C,maxZoom:R,panZoom:A}=x();if(!A)return Promise.resolve(!1);const O=typeof D?.zoom<"u"?D.zoom:R;return await A.setViewport({x:T/2-S*O,y:C/2-E*O,zoom:O},{duration:D?.duration,ease:D?.ease,interpolate:D?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{b({connection:{...ov}})},updateConnection:S=>{b({connection:S})},reset:()=>b({...Fb()})}},Object.is);function Zb({initialNodes:t,initialEdges:e,defaultNodes:n,defaultEdges:i,initialWidth:s,initialHeight:a,initialMinZoom:c,initialMaxZoom:u,initialFitViewOptions:d,fitView:h,nodeOrigin:p,nodeExtent:m,zIndexMode:y,children:b}){const[x]=N.useState(()=>Z5({nodes:t,edges:e,defaultNodes:n,defaultEdges:i,width:s,height:a,fitView:h,minZoom:c,maxZoom:u,fitViewOptions:d,nodeOrigin:p,nodeExtent:m,zIndexMode:y}));return M.jsx(pD,{value:x,children:M.jsx(LD,{children:b})})}function K5({children:t,nodes:e,edges:n,defaultNodes:i,defaultEdges:s,width:a,height:c,fitView:u,fitViewOptions:d,minZoom:h,maxZoom:p,nodeOrigin:m,nodeExtent:y,zIndexMode:b}){return N.useContext(zc)?M.jsx(M.Fragment,{children:t}):M.jsx(Zb,{initialNodes:e,initialEdges:n,defaultNodes:i,defaultEdges:s,initialWidth:a,initialHeight:c,fitView:u,initialFitViewOptions:d,initialMinZoom:h,initialMaxZoom:p,nodeOrigin:m,nodeExtent:y,zIndexMode:b,children:t})}const Q5={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function W5({nodes:t,edges:e,defaultNodes:n,defaultEdges:i,className:s,nodeTypes:a,edgeTypes:c,onNodeClick:u,onEdgeClick:d,onInit:h,onMove:p,onMoveStart:m,onMoveEnd:y,onConnect:b,onConnectStart:x,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:E,onNodeMouseEnter:D,onNodeMouseMove:T,onNodeMouseLeave:C,onNodeContextMenu:R,onNodeDoubleClick:A,onNodeDragStart:O,onNodeDrag:k,onNodeDragStop:H,onNodesDelete:$,onEdgesDelete:q,onDelete:F,onSelectionChange:Q,onSelectionDragStart:B,onSelectionDrag:P,onSelectionDragStop:j,onSelectionContextMenu:I,onSelectionStart:z,onSelectionEnd:U,onBeforeDelete:Y,connectionMode:L,connectionLineType:G=fi.Bezier,connectionLineStyle:tt,connectionLineComponent:it,connectionLineContainerStyle:lt,deleteKeyCode:ht="Backspace",selectionKeyCode:ft="Shift",selectionOnDrag:ut=!1,selectionMode:dt=Aa.Full,panActivationKeyCode:Mt="Space",multiSelectionKeyCode:Nt=ja()?"Meta":"Control",zoomActivationKeyCode:bt=ja()?"Meta":"Control",snapToGrid:Tt,snapGrid:Dt,onlyRenderVisibleElements:qt=!1,selectNodesOnDrag:Ht,nodesDraggable:pt,autoPanOnNodeFocus:gt,nodesConnectable:yt,nodesFocusable:mt,nodeOrigin:Et=nb,edgesFocusable:Vt,edgesReconnectable:jt,elementsSelectable:zt=!0,defaultViewport:ue=ND,minZoom:Xt=.5,maxZoom:xe=2,translateExtent:Pe=Na,preventScrolling:Po=!0,nodeExtent:Ae,defaultMarkerColor:So="#b1b1b7",zoomOnScroll:_i=!0,zoomOnPinch:pe=!0,panOnScroll:re=!1,panOnScrollSpeed:ee=.5,panOnScrollMode:Ee=xr.Free,zoomOnDoubleClick:Ni=!0,panOnDrag:Ai=!0,onPaneClick:Mi,onPaneMouseEnter:Jn,onPaneMouseMove:to,onPaneMouseLeave:Eo,onPaneScroll:mn,onPaneContextMenu:Ri,paneClickDistance:eo=1,nodeClickDistance:tn=0,children:ki,onReconnect:Ke,onReconnectStart:no,onReconnectEnd:Oi,onEdgeContextMenu:Di,onEdgeDoubleClick:ji,onEdgeMouseEnter:zi,onEdgeMouseMove:Ho,onEdgeMouseLeave:Uo,reconnectRadius:$o=10,onNodesChange:Vi,onEdgesChange:en,noDragClassName:ve="nodrag",noWheelClassName:Me="nowheel",noPanClassName:gn="nopan",fitView:Co,fitViewOptions:Li,connectOnClick:zr,attributionPosition:Ii,proOptions:oo,defaultEdgeOptions:qo,elevateNodesOnSelect:Mn=!0,elevateEdgesOnSelect:yn=!1,disableKeyboardA11y:Rn=!1,autoPanOnConnect:kn,autoPanOnNodeDrag:me,autoPanSpeed:Bi,connectionRadius:Pi,isValidConnection:vn,onError:On,style:Ds,id:Yo,nodeDragThreshold:Hi,connectionDragThreshold:Ui,viewport:He,onViewportChange:Go,width:io,height:nn,colorMode:Vu="light",debug:vm,onScroll:js,ariaLabelConfig:Lu,zIndexMode:Vr="basic",...bm},on){const Lr=Yo||"1",Iu=RD(Vu),fl=N.useCallback(Xo=>{Xo.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),js?.(Xo)},[js]);return M.jsx("div",{"data-testid":"rf__wrapper",...bm,onScroll:fl,style:{...Ds,...Q5},ref:on,className:_e(["react-flow",s,Iu]),id:Yo,role:"application",children:M.jsxs(K5,{nodes:t,edges:e,width:io,height:nn,fitView:Co,fitViewOptions:Li,minZoom:Xt,maxZoom:xe,nodeOrigin:Et,nodeExtent:Ae,zIndexMode:Vr,children:[M.jsx(F5,{onInit:h,onNodeClick:u,onEdgeClick:d,onNodeMouseEnter:D,onNodeMouseMove:T,onNodeMouseLeave:C,onNodeContextMenu:R,onNodeDoubleClick:A,nodeTypes:a,edgeTypes:c,connectionLineType:G,connectionLineStyle:tt,connectionLineComponent:it,connectionLineContainerStyle:lt,selectionKeyCode:ft,selectionOnDrag:ut,selectionMode:dt,deleteKeyCode:ht,multiSelectionKeyCode:Nt,panActivationKeyCode:Mt,zoomActivationKeyCode:bt,onlyRenderVisibleElements:qt,defaultViewport:ue,translateExtent:Pe,minZoom:Xt,maxZoom:xe,preventScrolling:Po,zoomOnScroll:_i,zoomOnPinch:pe,zoomOnDoubleClick:Ni,panOnScroll:re,panOnScrollSpeed:ee,panOnScrollMode:Ee,panOnDrag:Ai,onPaneClick:Mi,onPaneMouseEnter:Jn,onPaneMouseMove:to,onPaneMouseLeave:Eo,onPaneScroll:mn,onPaneContextMenu:Ri,paneClickDistance:eo,nodeClickDistance:tn,onSelectionContextMenu:I,onSelectionStart:z,onSelectionEnd:U,onReconnect:Ke,onReconnectStart:no,onReconnectEnd:Oi,onEdgeContextMenu:Di,onEdgeDoubleClick:ji,onEdgeMouseEnter:zi,onEdgeMouseMove:Ho,onEdgeMouseLeave:Uo,reconnectRadius:$o,defaultMarkerColor:So,noDragClassName:ve,noWheelClassName:Me,noPanClassName:gn,rfId:Lr,disableKeyboardA11y:Rn,nodeExtent:Ae,viewport:He,onViewportChange:Go}),M.jsx(MD,{nodes:t,edges:e,defaultNodes:n,defaultEdges:i,onConnect:b,onConnectStart:x,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:E,nodesDraggable:pt,autoPanOnNodeFocus:gt,nodesConnectable:yt,nodesFocusable:mt,edgesFocusable:Vt,edgesReconnectable:jt,elementsSelectable:zt,elevateNodesOnSelect:Mn,elevateEdgesOnSelect:yn,minZoom:Xt,maxZoom:xe,nodeExtent:Ae,onNodesChange:Vi,onEdgesChange:en,snapToGrid:Tt,snapGrid:Dt,connectionMode:L,translateExtent:Pe,connectOnClick:zr,defaultEdgeOptions:qo,fitView:Co,fitViewOptions:Li,onNodesDelete:$,onEdgesDelete:q,onDelete:F,onNodeDragStart:O,onNodeDrag:k,onNodeDragStop:H,onSelectionDrag:P,onSelectionDragStart:B,onSelectionDragStop:j,onMove:p,onMoveStart:m,onMoveEnd:y,noPanClassName:gn,nodeOrigin:Et,rfId:Lr,autoPanOnConnect:kn,autoPanOnNodeDrag:me,autoPanSpeed:Bi,onError:On,connectionRadius:Pi,isValidConnection:vn,selectNodesOnDrag:Ht,nodeDragThreshold:Hi,connectionDragThreshold:Ui,onBeforeDelete:Y,debug:vm,ariaLabelConfig:Lu,zIndexMode:Vr}),M.jsx(_D,{onSelectionChange:Q}),ki,M.jsx(wD,{proOptions:oo,position:Ii}),M.jsx(xD,{rfId:Lr,disableKeyboardA11y:Rn})]})})}var J5=pb(W5);function tj(){const t=ce();return N.useCallback(e=>{const{domNode:n,updateNodeInternals:i}=t.getState(),s=Array.isArray(e)?e:[e],a=new Map;s.forEach(c=>{const u=n?.querySelector(`.react-flow__node[data-id="${c}"]`);u&&a.set(c,{id:c,nodeElement:u,force:!0})}),requestAnimationFrame(()=>i(a,{triggerFitView:!1}))},[])}function ej({dimensions:t,lineWidth:e,variant:n,className:i}){return M.jsx("path",{strokeWidth:e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:_e(["react-flow__background-pattern",n,i])})}function nj({radius:t,className:e}){return M.jsx("circle",{cx:t,cy:t,r:t,className:_e(["react-flow__background-pattern","dots",e])})}var jo;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(jo||(jo={}));const oj={[jo.Dots]:1,[jo.Lines]:1,[jo.Cross]:6},ij=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function Kb({id:t,variant:e=jo.Dots,gap:n=20,size:i,lineWidth:s=1,offset:a=0,color:c,bgColor:u,style:d,className:h,patternClassName:p}){const m=N.useRef(null),{transform:y,patternId:b}=Zt(ij,he),x=i||oj[e],w=e===jo.Dots,S=e===jo.Cross,E=Array.isArray(n)?n:[n,n],D=[E[0]*y[2]||1,E[1]*y[2]||1],T=x*y[2],C=Array.isArray(a)?a:[a,a],R=S?[T,T]:D,A=[C[0]*y[2]||1+R[0]/2,C[1]*y[2]||1+R[1]/2],O=`${b}${t||""}`;return M.jsxs("svg",{className:_e(["react-flow__background",h]),style:{...d,...Lc,"--xy-background-color-props":u,"--xy-background-pattern-color-props":c},ref:m,"data-testid":"rf__background",children:[M.jsx("pattern",{id:O,x:y[0]%D[0],y:y[1]%D[1],width:D[0],height:D[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${A[0]},-${A[1]})`,children:w?M.jsx(nj,{radius:T/2,className:p}):M.jsx(ej,{dimensions:R,lineWidth:s,variant:e,className:p})}),M.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${O})`})]})}Kb.displayName="Background";const rj=N.memo(Kb);function sj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:M.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function aj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:M.jsx("path",{d:"M0 0h32v4.2H0z"})})}function lj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:M.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 cj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:M.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 uj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:M.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 Pc({children:t,className:e,...n}){return M.jsx("button",{type:"button",className:_e(["react-flow__controls-button",e]),...n,children:t})}const fj=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function Qb({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:i=!0,fitViewOptions:s,onZoomIn:a,onZoomOut:c,onFitView:u,onInteractiveChange:d,className:h,children:p,position:m="bottom-left",orientation:y="vertical","aria-label":b}){const x=ce(),{isInteractive:w,minZoomReached:S,maxZoomReached:E,ariaLabelConfig:D}=Zt(fj,he),{zoomIn:T,zoomOut:C,fitView:R}=Ia(),A=()=>{T(),a?.()},O=()=>{C(),c?.()},k=()=>{R(s),u?.()},H=()=>{x.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),d?.(!w)},$=y==="horizontal"?"horizontal":"vertical";return M.jsxs(Va,{className:_e(["react-flow__controls",$,h]),position:m,style:t,"data-testid":"rf__controls","aria-label":b??D["controls.ariaLabel"],children:[e&&M.jsxs(M.Fragment,{children:[M.jsx(Pc,{onClick:A,className:"react-flow__controls-zoomin",title:D["controls.zoomIn.ariaLabel"],"aria-label":D["controls.zoomIn.ariaLabel"],disabled:E,children:M.jsx(sj,{})}),M.jsx(Pc,{onClick:O,className:"react-flow__controls-zoomout",title:D["controls.zoomOut.ariaLabel"],"aria-label":D["controls.zoomOut.ariaLabel"],disabled:S,children:M.jsx(aj,{})})]}),n&&M.jsx(Pc,{className:"react-flow__controls-fitview",onClick:k,title:D["controls.fitView.ariaLabel"],"aria-label":D["controls.fitView.ariaLabel"],children:M.jsx(lj,{})}),i&&M.jsx(Pc,{className:"react-flow__controls-interactive",onClick:H,title:D["controls.interactive.ariaLabel"],"aria-label":D["controls.interactive.ariaLabel"],children:w?M.jsx(uj,{}):M.jsx(cj,{})}),p]})}Qb.displayName="Controls",N.memo(Qb);function dj({id:t,x:e,y:n,width:i,height:s,style:a,color:c,strokeColor:u,strokeWidth:d,className:h,borderRadius:p,shapeRendering:m,selected:y,onClick:b}){const{background:x,backgroundColor:w}=a||{},S=c||x||w;return M.jsx("rect",{className:_e(["react-flow__minimap-node",{selected:y},h]),x:e,y:n,rx:p,ry:p,width:i,height:s,style:{fill:S,stroke:u,strokeWidth:d},shapeRendering:m,onClick:b?E=>b(E,t):void 0})}const hj=N.memo(dj),pj=t=>t.nodes.map(e=>e.id),uh=t=>t instanceof Function?t:()=>t;function mj({nodeStrokeColor:t,nodeColor:e,nodeClassName:n="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a=hj,onClick:c}){const u=Zt(pj,he),d=uh(e),h=uh(t),p=uh(n),m=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return M.jsx(M.Fragment,{children:u.map(y=>M.jsx(yj,{id:y,nodeColorFunc:d,nodeStrokeColorFunc:h,nodeClassNameFunc:p,nodeBorderRadius:i,nodeStrokeWidth:s,NodeComponent:a,onClick:c,shapeRendering:m},y))})}function gj({id:t,nodeColorFunc:e,nodeStrokeColorFunc:n,nodeClassNameFunc:i,nodeBorderRadius:s,nodeStrokeWidth:a,shapeRendering:c,NodeComponent:u,onClick:d}){const{node:h,x:p,y:m,width:y,height:b}=Zt(x=>{const w=x.nodeLookup.get(t);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const S=w.internals.userNode,{x:E,y:D}=w.internals.positionAbsolute,{width:T,height:C}=Do(S);return{node:S,x:E,y:D,width:T,height:C}},he);return!h||h.hidden||!hv(h)?null:M.jsx(u,{x:p,y:m,width:y,height:b,style:h.style,selected:!!h.selected,className:i(h),color:e(h),borderRadius:s,strokeColor:n(h),strokeWidth:a,shapeRendering:c,onClick:d,id:h.id})}const yj=N.memo(gj);var vj=N.memo(mj);const bj=200,xj=150,wj=t=>!t.hidden,Sj=t=>{const e={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:e,boundingRect:t.nodeLookup.size>0?fv(Ra(t.nodeLookup,{filter:wj}),e):e,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},Ej="react-flow__minimap-desc";function Wb({style:t,className:e,nodeStrokeColor:n,nodeColor:i,nodeClassName:s="",nodeBorderRadius:a=5,nodeStrokeWidth:c,nodeComponent:u,bgColor:d,maskColor:h,maskStrokeColor:p,maskStrokeWidth:m,position:y="bottom-right",onClick:b,onNodeClick:x,pannable:w=!1,zoomable:S=!1,ariaLabel:E,inversePan:D,zoomStep:T=1,offsetScale:C=5}){const R=ce(),A=N.useRef(null),{boundingRect:O,viewBB:k,rfId:H,panZoom:$,translateExtent:q,flowWidth:F,flowHeight:Q,ariaLabelConfig:B}=Zt(Sj,he),P=t?.width??bj,j=t?.height??xj,I=O.width/P,z=O.height/j,U=Math.max(I,z),Y=U*P,L=U*j,G=C*U,tt=O.x-(Y-O.width)/2-G,it=O.y-(L-O.height)/2-G,lt=Y+G*2,ht=L+G*2,ft=`${Ej}-${H}`,ut=N.useRef(0),dt=N.useRef();ut.current=U,N.useEffect(()=>{if(A.current&&$)return dt.current=PO({domNode:A.current,panZoom:$,getTransform:()=>R.getState().transform,getViewScale:()=>ut.current}),()=>{dt.current?.destroy()}},[$]),N.useEffect(()=>{dt.current?.update({translateExtent:q,width:F,height:Q,inversePan:D,pannable:w,zoomStep:T,zoomable:S})},[w,S,D,T,q,F,Q]);const Mt=b?Tt=>{const[Dt,qt]=dt.current?.pointer(Tt)||[0,0];b(Tt,{x:Dt,y:qt})}:void 0,Nt=x?N.useCallback((Tt,Dt)=>{const qt=R.getState().nodeLookup.get(Dt).internals.userNode;x(Tt,qt)},[]):void 0,bt=E??B["minimap.ariaLabel"];return M.jsx(Va,{position:y,style:{...t,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof m=="number"?m*U:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof c=="number"?c:void 0},className:_e(["react-flow__minimap",e]),"data-testid":"rf__minimap",children:M.jsxs("svg",{width:P,height:j,viewBox:`${tt} ${it} ${lt} ${ht}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ft,ref:A,onClick:Mt,children:[bt&&M.jsx("title",{id:ft,children:bt}),M.jsx(vj,{onClick:Nt,nodeColor:i,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:s,nodeStrokeWidth:c,nodeComponent:u}),M.jsx("path",{className:"react-flow__minimap-mask",d:`M${tt-G},${it-G}h${lt+G*2}v${ht+G*2}h${-lt-G*2}z
|
|
24
|
-
M${k.x},${k.y}h${k.width}v${k.height}h${-k.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Wb.displayName="MiniMap",N.memo(Wb);const Cj=t=>e=>t?`${Math.max(1/e.transform[2],1)}`:void 0,Tj={[us.Line]:"right",[us.Handle]:"bottom-right"};function _j({nodeId:t,position:e,variant:n=us.Handle,className:i,style:s=void 0,children:a,color:c,minWidth:u=10,minHeight:d=10,maxWidth:h=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:m=!1,resizeDirection:y,autoScale:b=!0,shouldResize:x,onResizeStart:w,onResize:S,onResizeEnd:E}){const D=xb(),T=typeof t=="string"?t:D,C=ce(),R=N.useRef(null),A=n===us.Handle,O=Zt(N.useCallback(Cj(A&&b),[A,b]),he),k=N.useRef(null),H=e??Tj[n];N.useEffect(()=>{if(!(!R.current||!T))return k.current||(k.current=tD({domNode:R.current,nodeId:T,getStoreItems:()=>{const{nodeLookup:q,transform:F,snapGrid:Q,snapToGrid:B,nodeOrigin:P,domNode:j}=C.getState();return{nodeLookup:q,transform:F,snapGrid:Q,snapToGrid:B,nodeOrigin:P,paneDomNode:j}},onChange:(q,F)=>{const{triggerNodeChanges:Q,nodeLookup:B,parentLookup:P,nodeOrigin:j}=C.getState(),I=[],z={x:q.x,y:q.y},U=B.get(T);if(U&&U.expandParent&&U.parentId){const Y=U.origin??j,L=q.width??U.measured.width??0,G=q.height??U.measured.height??0,tt={id:U.id,parentId:U.parentId,rect:{width:L,height:G,...pv({x:q.x??U.position.x,y:q.y??U.position.y},{width:L,height:G},U.parentId,B,Y)}},it=Kd([tt],B,P,j);I.push(...it),z.x=q.x?Math.max(Y[0]*L,q.x):void 0,z.y=q.y?Math.max(Y[1]*G,q.y):void 0}if(z.x!==void 0&&z.y!==void 0){const Y={id:T,type:"position",position:{...z}};I.push(Y)}if(q.width!==void 0&&q.height!==void 0){const L={id:T,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:q.width,height:q.height}};I.push(L)}for(const Y of F){const L={...Y,type:"position"};I.push(L)}Q(I)},onEnd:({width:q,height:F})=>{const Q={id:T,type:"dimensions",resizing:!1,dimensions:{width:q,height:F}};C.getState().triggerNodeChanges([Q])}})),k.current.update({controlPosition:H,boundaries:{minWidth:u,minHeight:d,maxWidth:h,maxHeight:p},keepAspectRatio:m,resizeDirection:y,onResizeStart:w,onResize:S,onResizeEnd:E,shouldResize:x}),()=>{k.current?.destroy()}},[H,u,d,h,p,m,w,S,E,x]);const $=H.split("-");return M.jsx("div",{className:_e(["react-flow__resize-control","nodrag",...$,n,i]),ref:R,style:{...s,scale:O,...c&&{[A?"backgroundColor":"borderColor"]:c}},children:a})}N.memo(_j);function Jb(t){if(t.includes("."))return Jb(t.split(".").pop()||t);const e=t.split("_");for(let n=0;n<e.length;n++)if(/^\d{10,}$/.test(e[n])){const i=e.slice(0,n);return i.length>1&&/^[A-Z]/.test(i[0])?i.slice(1).join("_")||i[0]:i.join("_")||t}return t}function Nj(t){return{...t,nodes:t.nodes.map(e=>({...e,label:Jb(e.label||e.id)}))}}function tx(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=tx(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function ex(){for(var t,e,n=0,i="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=tx(t))&&(i&&(i+=" "),i+=e);return i}const Aj=(t,e)=>{const n=new Array(t.length+e.length);for(let i=0;i<t.length;i++)n[i]=t[i];for(let i=0;i<e.length;i++)n[t.length+i]=e[i];return n},Mj=(t,e)=>({classGroupId:t,validator:e}),nx=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Hc="-",ox=[],Rj="arbitrary..",kj=t=>{const e=Dj(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=t;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return Oj(c);const u=c.split(Hc),d=u[0]===""&&u.length>1?1:0;return ix(u,d,e)},getConflictingClassGroupIds:(c,u)=>{if(u){const d=i[c],h=n[c];return d?h?Aj(h,d):d:h||ox}return n[c]||ox}}},ix=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],a=n.nextPart.get(s);if(a){const h=ix(t,e+1,a);if(h)return h}const c=n.validators;if(c===null)return;const u=e===0?t.join(Hc):t.slice(e).join(Hc),d=c.length;for(let h=0;h<d;h++){const p=c[h];if(p.validator(u))return p.classGroupId}},Oj=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),i=e.slice(0,n);return i?Rj+i:void 0})(),Dj=t=>{const{theme:e,classGroups:n}=t;return jj(n,e)},jj=(t,e)=>{const n=nx();for(const i in t){const s=t[i];fh(s,n,i,e)}return n},fh=(t,e,n,i)=>{const s=t.length;for(let a=0;a<s;a++){const c=t[a];zj(c,e,n,i)}},zj=(t,e,n,i)=>{if(typeof t=="string"){Vj(t,e,n);return}if(typeof t=="function"){Lj(t,e,n,i);return}Ij(t,e,n,i)},Vj=(t,e,n)=>{const i=t===""?e:rx(e,t);i.classGroupId=n},Lj=(t,e,n,i)=>{if(Bj(t)){fh(t(i),e,n,i);return}e.validators===null&&(e.validators=[]),e.validators.push(Mj(n,t))},Ij=(t,e,n,i)=>{const s=Object.entries(t),a=s.length;for(let c=0;c<a;c++){const[u,d]=s[c];fh(d,rx(e,u),n,i)}},rx=(t,e)=>{let n=t;const i=e.split(Hc),s=i.length;for(let a=0;a<s;a++){const c=i[a];let u=n.nextPart.get(c);u||(u=nx(),n.nextPart.set(c,u)),n=u}return n},Bj=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Pj=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),i=Object.create(null);const s=(a,c)=>{n[a]=c,e++,e>t&&(e=0,i=n,n=Object.create(null))};return{get(a){let c=n[a];if(c!==void 0)return c;if((c=i[a])!==void 0)return s(a,c),c},set(a,c){a in n?n[a]=c:s(a,c)}}},dh="!",sx=":",Hj=[],ax=(t,e,n,i,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:i,isExternal:s}),Uj=t=>{const{prefix:e,experimentalParseClassName:n}=t;let i=s=>{const a=[];let c=0,u=0,d=0,h;const p=s.length;for(let w=0;w<p;w++){const S=s[w];if(c===0&&u===0){if(S===sx){a.push(s.slice(d,w)),d=w+1;continue}if(S==="/"){h=w;continue}}S==="["?c++:S==="]"?c--:S==="("?u++:S===")"&&u--}const m=a.length===0?s:s.slice(d);let y=m,b=!1;m.endsWith(dh)?(y=m.slice(0,-1),b=!0):m.startsWith(dh)&&(y=m.slice(1),b=!0);const x=h&&h>d?h-d:void 0;return ax(a,b,y,x)};if(e){const s=e+sx,a=i;i=c=>c.startsWith(s)?a(c.slice(s.length)):ax(Hj,!1,c,void 0,!0)}if(n){const s=i;i=a=>n({className:a,parseClassName:s})}return i},$j=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,i)=>{e.set(n,1e6+i)}),n=>{const i=[];let s=[];for(let a=0;a<n.length;a++){const c=n[a],u=c[0]==="[",d=e.has(c);u||d?(s.length>0&&(s.sort(),i.push(...s),s=[]),i.push(c)):s.push(c)}return s.length>0&&(s.sort(),i.push(...s)),i}},qj=t=>({cache:Pj(t.cacheSize),parseClassName:Uj(t),sortModifiers:$j(t),...kj(t)}),Yj=/\s+/,Gj=(t,e)=>{const{parseClassName:n,getClassGroupId:i,getConflictingClassGroupIds:s,sortModifiers:a}=e,c=[],u=t.trim().split(Yj);let d="";for(let h=u.length-1;h>=0;h-=1){const p=u[h],{isExternal:m,modifiers:y,hasImportantModifier:b,baseClassName:x,maybePostfixModifierPosition:w}=n(p);if(m){d=p+(d.length>0?" "+d:d);continue}let S=!!w,E=i(S?x.substring(0,w):x);if(!E){if(!S){d=p+(d.length>0?" "+d:d);continue}if(E=i(x),!E){d=p+(d.length>0?" "+d:d);continue}S=!1}const D=y.length===0?"":y.length===1?y[0]:a(y).join(":"),T=b?D+dh:D,C=T+E;if(c.indexOf(C)>-1)continue;c.push(C);const R=s(E,S);for(let A=0;A<R.length;++A){const O=R[A];c.push(T+O)}d=p+(d.length>0?" "+d:d)}return d},Xj=(...t)=>{let e=0,n,i,s="";for(;e<t.length;)(n=t[e++])&&(i=lx(n))&&(s&&(s+=" "),s+=i);return s},lx=t=>{if(typeof t=="string")return t;let e,n="";for(let i=0;i<t.length;i++)t[i]&&(e=lx(t[i]))&&(n&&(n+=" "),n+=e);return n},Fj=(t,...e)=>{let n,i,s,a;const c=d=>{const h=e.reduce((p,m)=>m(p),t());return n=qj(h),i=n.cache.get,s=n.cache.set,a=u,u(d)},u=d=>{const h=i(d);if(h)return h;const p=Gj(d,n);return s(d,p),p};return a=c,(...d)=>a(Xj(...d))},Zj=[],je=t=>{const e=n=>n[t]||Zj;return e.isThemeGetter=!0,e},cx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ux=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Kj=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Qj=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Wj=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Jj=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ez=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,pi=t=>Kj.test(t),Pt=t=>!!t&&!Number.isNaN(Number(t)),mi=t=>!!t&&Number.isInteger(Number(t)),hh=t=>t.endsWith("%")&&Pt(t.slice(0,-1)),zo=t=>Qj.test(t),fx=()=>!0,nz=t=>Wj.test(t)&&!Jj.test(t),ph=()=>!1,oz=t=>tz.test(t),iz=t=>ez.test(t),rz=t=>!wt(t)&&!Ct(t),sz=t=>gi(t,yx,ph),wt=t=>cx.test(t),Cr=t=>gi(t,vx,nz),dx=t=>gi(t,pz,Pt),az=t=>gi(t,xx,fx),lz=t=>gi(t,bx,ph),hx=t=>gi(t,mx,ph),cz=t=>gi(t,gx,iz),Uc=t=>gi(t,wx,oz),Ct=t=>ux.test(t),Ba=t=>Tr(t,vx),uz=t=>Tr(t,bx),px=t=>Tr(t,mx),fz=t=>Tr(t,yx),dz=t=>Tr(t,gx),$c=t=>Tr(t,wx,!0),hz=t=>Tr(t,xx,!0),gi=(t,e,n)=>{const i=cx.exec(t);return i?i[1]?e(i[1]):n(i[2]):!1},Tr=(t,e,n=!1)=>{const i=ux.exec(t);return i?i[1]?e(i[1]):n:!1},mx=t=>t==="position"||t==="percentage",gx=t=>t==="image"||t==="url",yx=t=>t==="length"||t==="size"||t==="bg-size",vx=t=>t==="length",pz=t=>t==="number",bx=t=>t==="family-name",xx=t=>t==="number"||t==="weight",wx=t=>t==="shadow",mz=Fj(()=>{const t=je("color"),e=je("font"),n=je("text"),i=je("font-weight"),s=je("tracking"),a=je("leading"),c=je("breakpoint"),u=je("container"),d=je("spacing"),h=je("radius"),p=je("shadow"),m=je("inset-shadow"),y=je("text-shadow"),b=je("drop-shadow"),x=je("blur"),w=je("perspective"),S=je("aspect"),E=je("ease"),D=je("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...C(),Ct,wt],A=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],k=()=>[Ct,wt,d],H=()=>[pi,"full","auto",...k()],$=()=>[mi,"none","subgrid",Ct,wt],q=()=>["auto",{span:["full",mi,Ct,wt]},mi,Ct,wt],F=()=>[mi,"auto",Ct,wt],Q=()=>["auto","min","max","fr",Ct,wt],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...k()],I=()=>[pi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],z=()=>[pi,"screen","full","dvw","lvw","svw","min","max","fit",...k()],U=()=>[pi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],Y=()=>[t,Ct,wt],L=()=>[...C(),px,hx,{position:[Ct,wt]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],tt=()=>["auto","cover","contain",fz,sz,{size:[Ct,wt]}],it=()=>[hh,Ba,Cr],lt=()=>["","none","full",h,Ct,wt],ht=()=>["",Pt,Ba,Cr],ft=()=>["solid","dashed","dotted","double"],ut=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],dt=()=>[Pt,hh,px,hx],Mt=()=>["","none",x,Ct,wt],Nt=()=>["none",Pt,Ct,wt],bt=()=>["none",Pt,Ct,wt],Tt=()=>[Pt,Ct,wt],Dt=()=>[pi,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[zo],breakpoint:[zo],color:[fx],container:[zo],"drop-shadow":[zo],ease:["in","out","in-out"],font:[rz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[zo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[zo],shadow:[zo],spacing:["px",Pt],text:[zo],"text-shadow":[zo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",pi,wt,Ct,S]}],container:["container"],columns:[{columns:[Pt,wt,Ct,u]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:H()}],"inset-x":[{"inset-x":H()}],"inset-y":[{"inset-y":H()}],start:[{"inset-s":H(),start:H()}],end:[{"inset-e":H(),end:H()}],"inset-bs":[{"inset-bs":H()}],"inset-be":[{"inset-be":H()}],top:[{top:H()}],right:[{right:H()}],bottom:[{bottom:H()}],left:[{left:H()}],visibility:["visible","invisible","collapse"],z:[{z:[mi,"auto",Ct,wt]}],basis:[{basis:[pi,"full","auto",u,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Pt,pi,"auto","initial","none",wt]}],grow:[{grow:["",Pt,Ct,wt]}],shrink:[{shrink:["",Pt,Ct,wt]}],order:[{order:[mi,"first","last","none",Ct,wt]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:q()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:q()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Q()}],"auto-rows":[{"auto-rows":Q()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:I()}],"inline-size":[{inline:["auto",...z()]}],"min-inline-size":[{"min-inline":["auto",...z()]}],"max-inline-size":[{"max-inline":["none",...z()]}],"block-size":[{block:["auto",...U()]}],"min-block-size":[{"min-block":["auto",...U()]}],"max-block-size":[{"max-block":["none",...U()]}],w:[{w:[u,"screen",...I()]}],"min-w":[{"min-w":[u,"screen","none",...I()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[c]},...I()]}],h:[{h:["screen","lh",...I()]}],"min-h":[{"min-h":["screen","lh","none",...I()]}],"max-h":[{"max-h":["screen","lh",...I()]}],"font-size":[{text:["base",n,Ba,Cr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,hz,az]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",hh,wt]}],"font-family":[{font:[uz,lz,e]}],"font-features":[{"font-features":[wt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ct,wt]}],"line-clamp":[{"line-clamp":[Pt,"none",Ct,dx]}],leading:[{leading:[a,...k()]}],"list-image":[{"list-image":["none",Ct,wt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ct,wt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Y()}],"text-color":[{text:Y()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ft(),"wavy"]}],"text-decoration-thickness":[{decoration:[Pt,"from-font","auto",Ct,Cr]}],"text-decoration-color":[{decoration:Y()}],"underline-offset":[{"underline-offset":[Pt,"auto",Ct,wt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ct,wt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ct,wt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:tt()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},mi,Ct,wt],radial:["",Ct,wt],conic:[mi,Ct,wt]},dz,cz]}],"bg-color":[{bg:Y()}],"gradient-from-pos":[{from:it()}],"gradient-via-pos":[{via:it()}],"gradient-to-pos":[{to:it()}],"gradient-from":[{from:Y()}],"gradient-via":[{via:Y()}],"gradient-to":[{to:Y()}],rounded:[{rounded:lt()}],"rounded-s":[{"rounded-s":lt()}],"rounded-e":[{"rounded-e":lt()}],"rounded-t":[{"rounded-t":lt()}],"rounded-r":[{"rounded-r":lt()}],"rounded-b":[{"rounded-b":lt()}],"rounded-l":[{"rounded-l":lt()}],"rounded-ss":[{"rounded-ss":lt()}],"rounded-se":[{"rounded-se":lt()}],"rounded-ee":[{"rounded-ee":lt()}],"rounded-es":[{"rounded-es":lt()}],"rounded-tl":[{"rounded-tl":lt()}],"rounded-tr":[{"rounded-tr":lt()}],"rounded-br":[{"rounded-br":lt()}],"rounded-bl":[{"rounded-bl":lt()}],"border-w":[{border:ht()}],"border-w-x":[{"border-x":ht()}],"border-w-y":[{"border-y":ht()}],"border-w-s":[{"border-s":ht()}],"border-w-e":[{"border-e":ht()}],"border-w-bs":[{"border-bs":ht()}],"border-w-be":[{"border-be":ht()}],"border-w-t":[{"border-t":ht()}],"border-w-r":[{"border-r":ht()}],"border-w-b":[{"border-b":ht()}],"border-w-l":[{"border-l":ht()}],"divide-x":[{"divide-x":ht()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ht()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ft(),"hidden","none"]}],"divide-style":[{divide:[...ft(),"hidden","none"]}],"border-color":[{border:Y()}],"border-color-x":[{"border-x":Y()}],"border-color-y":[{"border-y":Y()}],"border-color-s":[{"border-s":Y()}],"border-color-e":[{"border-e":Y()}],"border-color-bs":[{"border-bs":Y()}],"border-color-be":[{"border-be":Y()}],"border-color-t":[{"border-t":Y()}],"border-color-r":[{"border-r":Y()}],"border-color-b":[{"border-b":Y()}],"border-color-l":[{"border-l":Y()}],"divide-color":[{divide:Y()}],"outline-style":[{outline:[...ft(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Pt,Ct,wt]}],"outline-w":[{outline:["",Pt,Ba,Cr]}],"outline-color":[{outline:Y()}],shadow:[{shadow:["","none",p,$c,Uc]}],"shadow-color":[{shadow:Y()}],"inset-shadow":[{"inset-shadow":["none",m,$c,Uc]}],"inset-shadow-color":[{"inset-shadow":Y()}],"ring-w":[{ring:ht()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Y()}],"ring-offset-w":[{"ring-offset":[Pt,Cr]}],"ring-offset-color":[{"ring-offset":Y()}],"inset-ring-w":[{"inset-ring":ht()}],"inset-ring-color":[{"inset-ring":Y()}],"text-shadow":[{"text-shadow":["none",y,$c,Uc]}],"text-shadow-color":[{"text-shadow":Y()}],opacity:[{opacity:[Pt,Ct,wt]}],"mix-blend":[{"mix-blend":[...ut(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ut()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Pt]}],"mask-image-linear-from-pos":[{"mask-linear-from":dt()}],"mask-image-linear-to-pos":[{"mask-linear-to":dt()}],"mask-image-linear-from-color":[{"mask-linear-from":Y()}],"mask-image-linear-to-color":[{"mask-linear-to":Y()}],"mask-image-t-from-pos":[{"mask-t-from":dt()}],"mask-image-t-to-pos":[{"mask-t-to":dt()}],"mask-image-t-from-color":[{"mask-t-from":Y()}],"mask-image-t-to-color":[{"mask-t-to":Y()}],"mask-image-r-from-pos":[{"mask-r-from":dt()}],"mask-image-r-to-pos":[{"mask-r-to":dt()}],"mask-image-r-from-color":[{"mask-r-from":Y()}],"mask-image-r-to-color":[{"mask-r-to":Y()}],"mask-image-b-from-pos":[{"mask-b-from":dt()}],"mask-image-b-to-pos":[{"mask-b-to":dt()}],"mask-image-b-from-color":[{"mask-b-from":Y()}],"mask-image-b-to-color":[{"mask-b-to":Y()}],"mask-image-l-from-pos":[{"mask-l-from":dt()}],"mask-image-l-to-pos":[{"mask-l-to":dt()}],"mask-image-l-from-color":[{"mask-l-from":Y()}],"mask-image-l-to-color":[{"mask-l-to":Y()}],"mask-image-x-from-pos":[{"mask-x-from":dt()}],"mask-image-x-to-pos":[{"mask-x-to":dt()}],"mask-image-x-from-color":[{"mask-x-from":Y()}],"mask-image-x-to-color":[{"mask-x-to":Y()}],"mask-image-y-from-pos":[{"mask-y-from":dt()}],"mask-image-y-to-pos":[{"mask-y-to":dt()}],"mask-image-y-from-color":[{"mask-y-from":Y()}],"mask-image-y-to-color":[{"mask-y-to":Y()}],"mask-image-radial":[{"mask-radial":[Ct,wt]}],"mask-image-radial-from-pos":[{"mask-radial-from":dt()}],"mask-image-radial-to-pos":[{"mask-radial-to":dt()}],"mask-image-radial-from-color":[{"mask-radial-from":Y()}],"mask-image-radial-to-color":[{"mask-radial-to":Y()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[Pt]}],"mask-image-conic-from-pos":[{"mask-conic-from":dt()}],"mask-image-conic-to-pos":[{"mask-conic-to":dt()}],"mask-image-conic-from-color":[{"mask-conic-from":Y()}],"mask-image-conic-to-color":[{"mask-conic-to":Y()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:tt()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ct,wt]}],filter:[{filter:["","none",Ct,wt]}],blur:[{blur:Mt()}],brightness:[{brightness:[Pt,Ct,wt]}],contrast:[{contrast:[Pt,Ct,wt]}],"drop-shadow":[{"drop-shadow":["","none",b,$c,Uc]}],"drop-shadow-color":[{"drop-shadow":Y()}],grayscale:[{grayscale:["",Pt,Ct,wt]}],"hue-rotate":[{"hue-rotate":[Pt,Ct,wt]}],invert:[{invert:["",Pt,Ct,wt]}],saturate:[{saturate:[Pt,Ct,wt]}],sepia:[{sepia:["",Pt,Ct,wt]}],"backdrop-filter":[{"backdrop-filter":["","none",Ct,wt]}],"backdrop-blur":[{"backdrop-blur":Mt()}],"backdrop-brightness":[{"backdrop-brightness":[Pt,Ct,wt]}],"backdrop-contrast":[{"backdrop-contrast":[Pt,Ct,wt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Pt,Ct,wt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Pt,Ct,wt]}],"backdrop-invert":[{"backdrop-invert":["",Pt,Ct,wt]}],"backdrop-opacity":[{"backdrop-opacity":[Pt,Ct,wt]}],"backdrop-saturate":[{"backdrop-saturate":[Pt,Ct,wt]}],"backdrop-sepia":[{"backdrop-sepia":["",Pt,Ct,wt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ct,wt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Pt,"initial",Ct,wt]}],ease:[{ease:["linear","initial",E,Ct,wt]}],delay:[{delay:[Pt,Ct,wt]}],animate:[{animate:["none",D,Ct,wt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Ct,wt]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:Nt()}],"rotate-x":[{"rotate-x":Nt()}],"rotate-y":[{"rotate-y":Nt()}],"rotate-z":[{"rotate-z":Nt()}],scale:[{scale:bt()}],"scale-x":[{"scale-x":bt()}],"scale-y":[{"scale-y":bt()}],"scale-z":[{"scale-z":bt()}],"scale-3d":["scale-3d"],skew:[{skew:Tt()}],"skew-x":[{"skew-x":Tt()}],"skew-y":[{"skew-y":Tt()}],transform:[{transform:[Ct,wt,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Dt()}],"translate-x":[{"translate-x":Dt()}],"translate-y":[{"translate-y":Dt()}],"translate-z":[{"translate-z":Dt()}],"translate-none":["translate-none"],accent:[{accent:Y()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Y()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ct,wt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ct,wt]}],fill:[{fill:["none",...Y()]}],"stroke-w":[{stroke:[Pt,Ba,Cr,dx]}],stroke:[{stroke:["none",...Y()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Gn(...t){return mz(ex(t))}function Je({children:t,inputPorts:e=[],outputPorts:n=[],selected:i,className:s,showPortLabels:a,onPortClick:c,glowUnconnected:u}){return M.jsxs("div",{className:Gn("relative rounded-lg border-2 bg-[var(--embed-bg-secondary)] shadow-md transition-all",i?"border-blue-500 shadow-lg":"border-[var(--embed-border-node)]",s),children:[e.map(d=>{const h=`${(d.index+1)*100/(e.length+1)}%`,p=u&&!d.connected;return M.jsxs(dr.Fragment,{children:[p&&M.jsx("div",{className:"absolute h-5 w-5 rounded-full animate-ping",style:{top:h,left:"-7px",transform:"translateY(-50%)",background:"radial-gradient(circle, rgba(96,165,250,0.5) 0%, transparent 70%)"}}),M.jsx(ds,{type:"target",position:At.Left,id:`in-${d.name}`,className:Gn("h-3 w-3 rounded-full border-2 transition-all duration-200",d.connected?"bg-blue-500 border-blue-600":"bg-[var(--embed-bg-tertiary)] border-[var(--embed-border-node)]",p&&"border-blue-400",c&&"cursor-pointer hover:scale-150","hover:bg-blue-300 hover:border-blue-500"),style:{top:h,left:"-6px"},onClick:c?m=>{m.stopPropagation(),c(d.name,"input")}:void 0}),a&&M.jsx("div",{className:"absolute text-[9px] font-mono text-[var(--embed-text-secondary)] pointer-events-none select-none",style:{top:h,left:"10px",transform:"translateY(-50%)"},children:d.name})]},`in-${d.name}`)}),M.jsx("div",{className:"relative px-3 py-2",children:t}),n.map(d=>{const h=`${(d.index+1)*100/(n.length+1)}%`,p=u&&!d.connected;return M.jsxs(dr.Fragment,{children:[p&&M.jsx("div",{className:"absolute h-5 w-5 rounded-full animate-ping",style:{top:h,right:"-7px",transform:"translateY(-50%)",background:"radial-gradient(circle, rgba(74,222,128,0.5) 0%, transparent 70%)"}}),M.jsx(ds,{type:"source",position:At.Right,id:`out-${d.name}`,className:Gn("h-3 w-3 rounded-full border-2 transition-all duration-200",d.connected?"bg-green-500 border-green-600":"bg-[var(--embed-bg-tertiary)] border-[var(--embed-border-node)]",d.value===!0&&"bg-green-500 border-green-600",d.value===!1&&"bg-gray-300 border-gray-400",p&&"border-green-400",c&&"cursor-pointer hover:scale-150","hover:bg-green-300 hover:border-green-500"),style:{top:h,right:"-6px"},onClick:c?m=>{m.stopPropagation(),c(d.name,"output")}:void 0}),a&&M.jsx("div",{className:"absolute text-[9px] font-mono text-[var(--embed-text-secondary)] pointer-events-none select-none",style:{top:h,right:"10px",transform:"translateY(-50%)",textAlign:"right"},children:d.name})]},`out-${d.name}`)})]})}function Sx(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ex(...t){return e=>{let n=!1;const i=t.map(s=>{const a=Sx(s,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<i.length;s++){const a=i[s];typeof a=="function"?a():Sx(t[s],null)}}}}function _r(...t){return N.useCallback(Ex(...t),t)}function gz(t){const e=yz(t),n=N.forwardRef((i,s)=>{const{children:a,...c}=i,u=N.Children.toArray(a),d=u.find(bz);if(d){const h=d.props.children,p=u.map(m=>m===d?N.Children.count(h)>1?N.Children.only(null):N.isValidElement(h)?h.props.children:null:m);return M.jsx(e,{...c,ref:s,children:N.isValidElement(h)?N.cloneElement(h,void 0,p):null})}return M.jsx(e,{...c,ref:s,children:a})});return n.displayName=`${t}.Slot`,n}function yz(t){const e=N.forwardRef((n,i)=>{const{children:s,...a}=n;if(N.isValidElement(s)){const c=wz(s),u=xz(a,s.props);return s.type!==N.Fragment&&(u.ref=i?Ex(i,c):c),N.cloneElement(s,u)}return N.Children.count(s)>1?N.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Cx=Symbol("radix.slottable");function vz(t){const e=({children:n})=>M.jsx(M.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=Cx,e}function bz(t){return N.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Cx}function xz(t,e){const n={...e};for(const i in e){const s=t[i],a=e[i];/^on[A-Z]/.test(i)?s&&a?n[i]=(...u)=>{const d=a(...u);return s(...u),d}:s&&(n[i]=s):i==="style"?n[i]={...s,...a}:i==="className"&&(n[i]=[s,a].filter(Boolean).join(" "))}return{...t,...n}}function wz(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Sz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yi=Sz.reduce((t,e)=>{const n=gz(`Primitive.${e}`),i=N.forwardRef((s,a)=>{const{asChild:c,...u}=s,d=c?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),M.jsx(d,{...u,ref:a})});return i.displayName=`Primitive.${e}`,{...t,[e]:i}},{});function Ez(t,e){t&&rh.flushSync(()=>t.dispatchEvent(e))}var Cz=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Tz="VisuallyHidden",Tx=N.forwardRef((t,e)=>M.jsx(yi.span,{...t,ref:e,style:{...Cz,...t.style}}));Tx.displayName=Tz;var _z=Tx;function _x(t,e=[]){let n=[];function i(a,c){const u=N.createContext(c),d=n.length;n=[...n,c];const h=m=>{const{scope:y,children:b,...x}=m,w=y?.[t]?.[d]||u,S=N.useMemo(()=>x,Object.values(x));return M.jsx(w.Provider,{value:S,children:b})};h.displayName=a+"Provider";function p(m,y){const b=y?.[t]?.[d]||u,x=N.useContext(b);if(x)return x;if(c!==void 0)return c;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[h,p]}const s=()=>{const a=n.map(c=>N.createContext(c));return function(u){const d=u?.[t]||a;return N.useMemo(()=>({[`__scope${t}`]:{...u,[t]:d}}),[u,d])}};return s.scopeName=t,[i,Nz(s,...e)]}function Nz(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const i=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const c=i.reduce((u,{useScope:d,scopeName:h})=>{const m=d(a)[`__scope${h}`];return{...u,...m}},{});return N.useMemo(()=>({[`__scope${e.scopeName}`]:c}),[c])}};return n.scopeName=e.scopeName,n}function Vo(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t?.(s),n===!1||!s.defaultPrevented)return e?.(s)}}var vi=globalThis?.document?N.useLayoutEffect:()=>{},Az=_0[" useInsertionEffect ".trim().toString()]||vi;function Mz({prop:t,defaultProp:e,onChange:n=()=>{},caller:i}){const[s,a,c]=Rz({defaultProp:e,onChange:n}),u=t!==void 0,d=u?t:s;{const p=N.useRef(t!==void 0);N.useEffect(()=>{const m=p.current;m!==u&&console.warn(`${i} is changing from ${m?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=u},[u,i])}const h=N.useCallback(p=>{if(u){const m=kz(p)?p(t):p;m!==t&&c.current?.(m)}else a(p)},[u,t,a,c]);return[d,h]}function Rz({defaultProp:t,onChange:e}){const[n,i]=N.useState(t),s=N.useRef(n),a=N.useRef(e);return Az(()=>{a.current=e},[e]),N.useEffect(()=>{s.current!==n&&(a.current?.(n),s.current=n)},[n,s]),[n,i,a]}function kz(t){return typeof t=="function"}function Oz(t,e){return N.useReducer((n,i)=>e[n][i]??n,t)}var mh=t=>{const{present:e,children:n}=t,i=Dz(e),s=typeof n=="function"?n({present:i.isPresent}):N.Children.only(n),a=_r(i.ref,jz(s));return typeof n=="function"||i.isPresent?N.cloneElement(s,{ref:a}):null};mh.displayName="Presence";function Dz(t){const[e,n]=N.useState(),i=N.useRef(null),s=N.useRef(t),a=N.useRef("none"),c=t?"mounted":"unmounted",[u,d]=Oz(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return N.useEffect(()=>{const h=qc(i.current);a.current=u==="mounted"?h:"none"},[u]),vi(()=>{const h=i.current,p=s.current;if(p!==t){const y=a.current,b=qc(h);t?d("MOUNT"):b==="none"||h?.display==="none"?d("UNMOUNT"):d(p&&y!==b?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,d]),vi(()=>{if(e){let h;const p=e.ownerDocument.defaultView??window,m=b=>{const w=qc(i.current).includes(CSS.escape(b.animationName));if(b.target===e&&w&&(d("ANIMATION_END"),!s.current)){const S=e.style.animationFillMode;e.style.animationFillMode="forwards",h=p.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},y=b=>{b.target===e&&(a.current=qc(i.current))};return e.addEventListener("animationstart",y),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{p.clearTimeout(h),e.removeEventListener("animationstart",y),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[e,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:N.useCallback(h=>{i.current=h?getComputedStyle(h):null,n(h)},[])}}function qc(t){return t?.animationName||"none"}function jz(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var zz=_0[" useId ".trim().toString()]||(()=>{}),Vz=0;function Lz(t){const[e,n]=N.useState(zz());return vi(()=>{n(i=>i??String(Vz++))},[t]),e?`radix-${e}`:""}function Yc(t){const e=N.useRef(t);return N.useEffect(()=>{e.current=t}),N.useMemo(()=>(...n)=>e.current?.(...n),[])}function Iz(t,e=globalThis?.document){const n=Yc(t);N.useEffect(()=>{const i=s=>{s.key==="Escape"&&n(s)};return e.addEventListener("keydown",i,{capture:!0}),()=>e.removeEventListener("keydown",i,{capture:!0})},[n,e])}var Bz="DismissableLayer",gh="dismissableLayer.update",Pz="dismissableLayer.pointerDownOutside",Hz="dismissableLayer.focusOutside",Nx,Ax=N.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Mx=N.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:c,onDismiss:u,...d}=t,h=N.useContext(Ax),[p,m]=N.useState(null),y=p?.ownerDocument??globalThis?.document,[,b]=N.useState({}),x=_r(e,O=>m(O)),w=Array.from(h.layers),[S]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),E=w.indexOf(S),D=p?w.indexOf(p):-1,T=h.layersWithOutsidePointerEventsDisabled.size>0,C=D>=E,R=qz(O=>{const k=O.target,H=[...h.branches].some($=>$.contains(k));!C||H||(s?.(O),c?.(O),O.defaultPrevented||u?.())},y),A=Yz(O=>{const k=O.target;[...h.branches].some($=>$.contains(k))||(a?.(O),c?.(O),O.defaultPrevented||u?.())},y);return Iz(O=>{D===h.layers.size-1&&(i?.(O),!O.defaultPrevented&&u&&(O.preventDefault(),u()))},y),N.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Nx=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),Rx(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=Nx)}},[p,y,n,h]),N.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),Rx())},[p,h]),N.useEffect(()=>{const O=()=>b({});return document.addEventListener(gh,O),()=>document.removeEventListener(gh,O)},[]),M.jsx(yi.div,{...d,ref:x,style:{pointerEvents:T?C?"auto":"none":void 0,...t.style},onFocusCapture:Vo(t.onFocusCapture,A.onFocusCapture),onBlurCapture:Vo(t.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Vo(t.onPointerDownCapture,R.onPointerDownCapture)})});Mx.displayName=Bz;var Uz="DismissableLayerBranch",$z=N.forwardRef((t,e)=>{const n=N.useContext(Ax),i=N.useRef(null),s=_r(e,i);return N.useEffect(()=>{const a=i.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),M.jsx(yi.div,{...t,ref:s})});$z.displayName=Uz;function qz(t,e=globalThis?.document){const n=Yc(t),i=N.useRef(!1),s=N.useRef(()=>{});return N.useEffect(()=>{const a=u=>{if(u.target&&!i.current){let d=function(){kx(Pz,n,h,{discrete:!0})};const h={originalEvent:u};u.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=d,e.addEventListener("click",s.current,{once:!0})):d()}else e.removeEventListener("click",s.current);i.current=!1},c=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(c),e.removeEventListener("pointerdown",a),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>i.current=!0}}function Yz(t,e=globalThis?.document){const n=Yc(t),i=N.useRef(!1);return N.useEffect(()=>{const s=a=>{a.target&&!i.current&&kx(Hz,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function Rx(){const t=new CustomEvent(gh);document.dispatchEvent(t)}function kx(t,e,n,{discrete:i}){const s=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),i?Ez(s,a):s.dispatchEvent(a)}var Gz="Portal",Ox=N.forwardRef((t,e)=>{const{container:n,...i}=t,[s,a]=N.useState(!1);vi(()=>a(!0),[]);const c=n||s&&globalThis?.document?.body;return c?hD.createPortal(M.jsx(yi.div,{...i,ref:e}),c):null});Ox.displayName=Gz;function Xz(t){const[e,n]=N.useState(void 0);return vi(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let c,u;if("borderBoxSize"in a){const d=a.borderBoxSize,h=Array.isArray(d)?d[0]:d;c=h.inlineSize,u=h.blockSize}else c=t.offsetWidth,u=t.offsetHeight;n({width:c,height:u})});return i.observe(t,{box:"border-box"}),()=>i.unobserve(t)}else n(void 0)},[t]),e}const Fz=["top","right","bottom","left"],bi=Math.min,hn=Math.max,Gc=Math.round,Xc=Math.floor,po=t=>({x:t,y:t}),Zz={left:"right",right:"left",bottom:"top",top:"bottom"},Kz={start:"end",end:"start"};function yh(t,e,n){return hn(t,bi(e,n))}function Lo(t,e){return typeof t=="function"?t(e):t}function Io(t){return t.split("-")[0]}function hs(t){return t.split("-")[1]}function vh(t){return t==="x"?"y":"x"}function bh(t){return t==="y"?"height":"width"}const Qz=new Set(["top","bottom"]);function mo(t){return Qz.has(Io(t))?"y":"x"}function xh(t){return vh(mo(t))}function Wz(t,e,n){n===void 0&&(n=!1);const i=hs(t),s=xh(t),a=bh(s);let c=s==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(c=Fc(c)),[c,Fc(c)]}function Jz(t){const e=Fc(t);return[wh(t),e,wh(e)]}function wh(t){return t.replace(/start|end/g,e=>Kz[e])}const Dx=["left","right"],jx=["right","left"],tV=["top","bottom"],eV=["bottom","top"];function nV(t,e,n){switch(t){case"top":case"bottom":return n?e?jx:Dx:e?Dx:jx;case"left":case"right":return e?tV:eV;default:return[]}}function oV(t,e,n,i){const s=hs(t);let a=nV(Io(t),n==="start",i);return s&&(a=a.map(c=>c+"-"+s),e&&(a=a.concat(a.map(wh)))),a}function Fc(t){return t.replace(/left|right|bottom|top/g,e=>Zz[e])}function iV(t){return{top:0,right:0,bottom:0,left:0,...t}}function zx(t){return typeof t!="number"?iV(t):{top:t,right:t,bottom:t,left:t}}function Zc(t){const{x:e,y:n,width:i,height:s}=t;return{width:i,height:s,top:n,left:e,right:e+i,bottom:n+s,x:e,y:n}}function Vx(t,e,n){let{reference:i,floating:s}=t;const a=mo(e),c=xh(e),u=bh(c),d=Io(e),h=a==="y",p=i.x+i.width/2-s.width/2,m=i.y+i.height/2-s.height/2,y=i[u]/2-s[u]/2;let b;switch(d){case"top":b={x:p,y:i.y-s.height};break;case"bottom":b={x:p,y:i.y+i.height};break;case"right":b={x:i.x+i.width,y:m};break;case"left":b={x:i.x-s.width,y:m};break;default:b={x:i.x,y:i.y}}switch(hs(e)){case"start":b[c]-=y*(n&&h?-1:1);break;case"end":b[c]+=y*(n&&h?-1:1);break}return b}async function rV(t,e){var n;e===void 0&&(e={});const{x:i,y:s,platform:a,rects:c,elements:u,strategy:d}=t,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:y=!1,padding:b=0}=Lo(e,t),x=zx(b),S=u[y?m==="floating"?"reference":"floating":m],E=Zc(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(S)))==null||n?S:S.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(u.floating)),boundary:h,rootBoundary:p,strategy:d})),D=m==="floating"?{x:i,y:s,width:c.floating.width,height:c.floating.height}:c.reference,T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u.floating)),C=await(a.isElement==null?void 0:a.isElement(T))?await(a.getScale==null?void 0:a.getScale(T))||{x:1,y:1}:{x:1,y:1},R=Zc(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:D,offsetParent:T,strategy:d}):D);return{top:(E.top-R.top+x.top)/C.y,bottom:(R.bottom-E.bottom+x.bottom)/C.y,left:(E.left-R.left+x.left)/C.x,right:(R.right-E.right+x.right)/C.x}}const sV=async(t,e,n)=>{const{placement:i="bottom",strategy:s="absolute",middleware:a=[],platform:c}=n,u=a.filter(Boolean),d=await(c.isRTL==null?void 0:c.isRTL(e));let h=await c.getElementRects({reference:t,floating:e,strategy:s}),{x:p,y:m}=Vx(h,i,d),y=i,b={},x=0;for(let S=0;S<u.length;S++){var w;const{name:E,fn:D}=u[S],{x:T,y:C,data:R,reset:A}=await D({x:p,y:m,initialPlacement:i,placement:y,strategy:s,middlewareData:b,rects:h,platform:{...c,detectOverflow:(w=c.detectOverflow)!=null?w:rV},elements:{reference:t,floating:e}});p=T??p,m=C??m,b={...b,[E]:{...b[E],...R}},A&&x<=50&&(x++,typeof A=="object"&&(A.placement&&(y=A.placement),A.rects&&(h=A.rects===!0?await c.getElementRects({reference:t,floating:e,strategy:s}):A.rects),{x:p,y:m}=Vx(h,y,d)),S=-1)}return{x:p,y:m,placement:y,strategy:s,middlewareData:b}},aV=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:i,placement:s,rects:a,platform:c,elements:u,middlewareData:d}=e,{element:h,padding:p=0}=Lo(t,e)||{};if(h==null)return{};const m=zx(p),y={x:n,y:i},b=xh(s),x=bh(b),w=await c.getDimensions(h),S=b==="y",E=S?"top":"left",D=S?"bottom":"right",T=S?"clientHeight":"clientWidth",C=a.reference[x]+a.reference[b]-y[b]-a.floating[x],R=y[b]-a.reference[b],A=await(c.getOffsetParent==null?void 0:c.getOffsetParent(h));let O=A?A[T]:0;(!O||!await(c.isElement==null?void 0:c.isElement(A)))&&(O=u.floating[T]||a.floating[x]);const k=C/2-R/2,H=O/2-w[x]/2-1,$=bi(m[E],H),q=bi(m[D],H),F=$,Q=O-w[x]-q,B=O/2-w[x]/2+k,P=yh(F,B,Q),j=!d.arrow&&hs(s)!=null&&B!==P&&a.reference[x]/2-(B<F?$:q)-w[x]/2<0,I=j?B<F?B-F:B-Q:0;return{[b]:y[b]+I,data:{[b]:P,centerOffset:B-P-I,...j&&{alignmentOffset:I}},reset:j}}}),lV=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,i;const{placement:s,middlewareData:a,rects:c,initialPlacement:u,platform:d,elements:h}=e,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:w=!0,...S}=Lo(t,e);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const E=Io(s),D=mo(u),T=Io(u)===u,C=await(d.isRTL==null?void 0:d.isRTL(h.floating)),R=y||(T||!w?[Fc(u)]:Jz(u)),A=x!=="none";!y&&A&&R.push(...oV(u,w,x,C));const O=[u,...R],k=await d.detectOverflow(e,S),H=[];let $=((i=a.flip)==null?void 0:i.overflows)||[];if(p&&H.push(k[E]),m){const B=Wz(s,c,C);H.push(k[B[0]],k[B[1]])}if($=[...$,{placement:s,overflows:H}],!H.every(B=>B<=0)){var q,F;const B=(((q=a.flip)==null?void 0:q.index)||0)+1,P=O[B];if(P&&(!(m==="alignment"?D!==mo(P):!1)||$.every(z=>mo(z.placement)===D?z.overflows[0]>0:!0)))return{data:{index:B,overflows:$},reset:{placement:P}};let j=(F=$.filter(I=>I.overflows[0]<=0).sort((I,z)=>I.overflows[1]-z.overflows[1])[0])==null?void 0:F.placement;if(!j)switch(b){case"bestFit":{var Q;const I=(Q=$.filter(z=>{if(A){const U=mo(z.placement);return U===D||U==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(U=>U>0).reduce((U,Y)=>U+Y,0)]).sort((z,U)=>z[1]-U[1])[0])==null?void 0:Q[0];I&&(j=I);break}case"initialPlacement":j=u;break}if(s!==j)return{reset:{placement:j}}}return{}}}};function Lx(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ix(t){return Fz.some(e=>t[e]>=0)}const cV=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:i}=e,{strategy:s="referenceHidden",...a}=Lo(t,e);switch(s){case"referenceHidden":{const c=await i.detectOverflow(e,{...a,elementContext:"reference"}),u=Lx(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Ix(u)}}}case"escaped":{const c=await i.detectOverflow(e,{...a,altBoundary:!0}),u=Lx(c,n.floating);return{data:{escapedOffsets:u,escaped:Ix(u)}}}default:return{}}}}},Bx=new Set(["left","top"]);async function uV(t,e){const{placement:n,platform:i,elements:s}=t,a=await(i.isRTL==null?void 0:i.isRTL(s.floating)),c=Io(n),u=hs(n),d=mo(n)==="y",h=Bx.has(c)?-1:1,p=a&&d?-1:1,m=Lo(e,t);let{mainAxis:y,crossAxis:b,alignmentAxis:x}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof x=="number"&&(b=u==="end"?x*-1:x),d?{x:b*p,y:y*h}:{x:y*h,y:b*p}}const fV=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;const{x:s,y:a,placement:c,middlewareData:u}=e,d=await uV(e,t);return c===((n=u.offset)==null?void 0:n.placement)&&(i=u.arrow)!=null&&i.alignmentOffset?{}:{x:s+d.x,y:a+d.y,data:{...d,placement:c}}}}},dV=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:i,placement:s,platform:a}=e,{mainAxis:c=!0,crossAxis:u=!1,limiter:d={fn:E=>{let{x:D,y:T}=E;return{x:D,y:T}}},...h}=Lo(t,e),p={x:n,y:i},m=await a.detectOverflow(e,h),y=mo(Io(s)),b=vh(y);let x=p[b],w=p[y];if(c){const E=b==="y"?"top":"left",D=b==="y"?"bottom":"right",T=x+m[E],C=x-m[D];x=yh(T,x,C)}if(u){const E=y==="y"?"top":"left",D=y==="y"?"bottom":"right",T=w+m[E],C=w-m[D];w=yh(T,w,C)}const S=d.fn({...e,[b]:x,[y]:w});return{...S,data:{x:S.x-n,y:S.y-i,enabled:{[b]:c,[y]:u}}}}}},hV=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:i,placement:s,rects:a,middlewareData:c}=e,{offset:u=0,mainAxis:d=!0,crossAxis:h=!0}=Lo(t,e),p={x:n,y:i},m=mo(s),y=vh(m);let b=p[y],x=p[m];const w=Lo(u,e),S=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(d){const T=y==="y"?"height":"width",C=a.reference[y]-a.floating[T]+S.mainAxis,R=a.reference[y]+a.reference[T]-S.mainAxis;b<C?b=C:b>R&&(b=R)}if(h){var E,D;const T=y==="y"?"width":"height",C=Bx.has(Io(s)),R=a.reference[m]-a.floating[T]+(C&&((E=c.offset)==null?void 0:E[m])||0)+(C?0:S.crossAxis),A=a.reference[m]+a.reference[T]+(C?0:((D=c.offset)==null?void 0:D[m])||0)-(C?S.crossAxis:0);x<R?x=R:x>A&&(x=A)}return{[y]:b,[m]:x}}}},pV=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,i;const{placement:s,rects:a,platform:c,elements:u}=e,{apply:d=()=>{},...h}=Lo(t,e),p=await c.detectOverflow(e,h),m=Io(s),y=hs(s),b=mo(s)==="y",{width:x,height:w}=a.floating;let S,E;m==="top"||m==="bottom"?(S=m,E=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(E=m,S=y==="end"?"top":"bottom");const D=w-p.top-p.bottom,T=x-p.left-p.right,C=bi(w-p[S],D),R=bi(x-p[E],T),A=!e.middlewareData.shift;let O=C,k=R;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(k=T),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(O=D),A&&!y){const $=hn(p.left,0),q=hn(p.right,0),F=hn(p.top,0),Q=hn(p.bottom,0);b?k=x-2*($!==0||q!==0?$+q:hn(p.left,p.right)):O=w-2*(F!==0||Q!==0?F+Q:hn(p.top,p.bottom))}await d({...e,availableWidth:k,availableHeight:O});const H=await c.getDimensions(u.floating);return x!==H.width||w!==H.height?{reset:{rects:!0}}:{}}}};function Kc(){return typeof window<"u"}function ps(t){return Px(t)?(t.nodeName||"").toLowerCase():"#document"}function pn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function go(t){var e;return(e=(Px(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Px(t){return Kc()?t instanceof Node||t instanceof pn(t).Node:!1}function Xn(t){return Kc()?t instanceof Element||t instanceof pn(t).Element:!1}function yo(t){return Kc()?t instanceof HTMLElement||t instanceof pn(t).HTMLElement:!1}function Hx(t){return!Kc()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof pn(t).ShadowRoot}const mV=new Set(["inline","contents"]);function Pa(t){const{overflow:e,overflowX:n,overflowY:i,display:s}=Fn(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!mV.has(s)}const gV=new Set(["table","td","th"]);function yV(t){return gV.has(ps(t))}const vV=[":popover-open",":modal"];function Qc(t){return vV.some(e=>{try{return t.matches(e)}catch{return!1}})}const bV=["transform","translate","scale","rotate","perspective"],xV=["transform","translate","scale","rotate","perspective","filter"],wV=["paint","layout","strict","content"];function Sh(t){const e=Eh(),n=Xn(t)?Fn(t):t;return bV.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||xV.some(i=>(n.willChange||"").includes(i))||wV.some(i=>(n.contain||"").includes(i))}function SV(t){let e=xi(t);for(;yo(e)&&!ms(e);){if(Sh(e))return e;if(Qc(e))return null;e=xi(e)}return null}function Eh(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const EV=new Set(["html","body","#document"]);function ms(t){return EV.has(ps(t))}function Fn(t){return pn(t).getComputedStyle(t)}function Wc(t){return Xn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function xi(t){if(ps(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Hx(t)&&t.host||go(t);return Hx(e)?e.host:e}function Ux(t){const e=xi(t);return ms(e)?t.ownerDocument?t.ownerDocument.body:t.body:yo(e)&&Pa(e)?e:Ux(e)}function Ha(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=Ux(t),a=s===((i=t.ownerDocument)==null?void 0:i.body),c=pn(s);if(a){const u=Ch(c);return e.concat(c,c.visualViewport||[],Pa(s)?s:[],u&&n?Ha(u):[])}return e.concat(s,Ha(s,[],n))}function Ch(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function $x(t){const e=Fn(t);let n=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=yo(t),a=s?t.offsetWidth:n,c=s?t.offsetHeight:i,u=Gc(n)!==a||Gc(i)!==c;return u&&(n=a,i=c),{width:n,height:i,$:u}}function Th(t){return Xn(t)?t:t.contextElement}function gs(t){const e=Th(t);if(!yo(e))return po(1);const n=e.getBoundingClientRect(),{width:i,height:s,$:a}=$x(e);let c=(a?Gc(n.width):n.width)/i,u=(a?Gc(n.height):n.height)/s;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const CV=po(0);function qx(t){const e=pn(t);return!Eh()||!e.visualViewport?CV:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function TV(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==pn(t)?!1:e}function Nr(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=Th(t);let c=po(1);e&&(i?Xn(i)&&(c=gs(i)):c=gs(t));const u=TV(a,n,i)?qx(a):po(0);let d=(s.left+u.x)/c.x,h=(s.top+u.y)/c.y,p=s.width/c.x,m=s.height/c.y;if(a){const y=pn(a),b=i&&Xn(i)?pn(i):i;let x=y,w=Ch(x);for(;w&&i&&b!==x;){const S=gs(w),E=w.getBoundingClientRect(),D=Fn(w),T=E.left+(w.clientLeft+parseFloat(D.paddingLeft))*S.x,C=E.top+(w.clientTop+parseFloat(D.paddingTop))*S.y;d*=S.x,h*=S.y,p*=S.x,m*=S.y,d+=T,h+=C,x=pn(w),w=Ch(x)}}return Zc({width:p,height:m,x:d,y:h})}function Jc(t,e){const n=Wc(t).scrollLeft;return e?e.left+n:Nr(go(t)).left+n}function Yx(t,e){const n=t.getBoundingClientRect(),i=n.left+e.scrollLeft-Jc(t,n),s=n.top+e.scrollTop;return{x:i,y:s}}function _V(t){let{elements:e,rect:n,offsetParent:i,strategy:s}=t;const a=s==="fixed",c=go(i),u=e?Qc(e.floating):!1;if(i===c||u&&a)return n;let d={scrollLeft:0,scrollTop:0},h=po(1);const p=po(0),m=yo(i);if((m||!m&&!a)&&((ps(i)!=="body"||Pa(c))&&(d=Wc(i)),yo(i))){const b=Nr(i);h=gs(i),p.x=b.x+i.clientLeft,p.y=b.y+i.clientTop}const y=c&&!m&&!a?Yx(c,d):po(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-d.scrollLeft*h.x+p.x+y.x,y:n.y*h.y-d.scrollTop*h.y+p.y+y.y}}function NV(t){return Array.from(t.getClientRects())}function AV(t){const e=go(t),n=Wc(t),i=t.ownerDocument.body,s=hn(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),a=hn(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let c=-n.scrollLeft+Jc(t);const u=-n.scrollTop;return Fn(i).direction==="rtl"&&(c+=hn(e.clientWidth,i.clientWidth)-s),{width:s,height:a,x:c,y:u}}const Gx=25;function MV(t,e){const n=pn(t),i=go(t),s=n.visualViewport;let a=i.clientWidth,c=i.clientHeight,u=0,d=0;if(s){a=s.width,c=s.height;const p=Eh();(!p||p&&e==="fixed")&&(u=s.offsetLeft,d=s.offsetTop)}const h=Jc(i);if(h<=0){const p=i.ownerDocument,m=p.body,y=getComputedStyle(m),b=p.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,x=Math.abs(i.clientWidth-m.clientWidth-b);x<=Gx&&(a-=x)}else h<=Gx&&(a+=h);return{width:a,height:c,x:u,y:d}}const RV=new Set(["absolute","fixed"]);function kV(t,e){const n=Nr(t,!0,e==="fixed"),i=n.top+t.clientTop,s=n.left+t.clientLeft,a=yo(t)?gs(t):po(1),c=t.clientWidth*a.x,u=t.clientHeight*a.y,d=s*a.x,h=i*a.y;return{width:c,height:u,x:d,y:h}}function Xx(t,e,n){let i;if(e==="viewport")i=MV(t,n);else if(e==="document")i=AV(go(t));else if(Xn(e))i=kV(e,n);else{const s=qx(t);i={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Zc(i)}function Fx(t,e){const n=xi(t);return n===e||!Xn(n)||ms(n)?!1:Fn(n).position==="fixed"||Fx(n,e)}function OV(t,e){const n=e.get(t);if(n)return n;let i=Ha(t,[],!1).filter(u=>Xn(u)&&ps(u)!=="body"),s=null;const a=Fn(t).position==="fixed";let c=a?xi(t):t;for(;Xn(c)&&!ms(c);){const u=Fn(c),d=Sh(c);!d&&u.position==="fixed"&&(s=null),(a?!d&&!s:!d&&u.position==="static"&&!!s&&RV.has(s.position)||Pa(c)&&!d&&Fx(t,c))?i=i.filter(p=>p!==c):s=u,c=xi(c)}return e.set(t,i),i}function DV(t){let{element:e,boundary:n,rootBoundary:i,strategy:s}=t;const c=[...n==="clippingAncestors"?Qc(e)?[]:OV(e,this._c):[].concat(n),i],u=c[0],d=c.reduce((h,p)=>{const m=Xx(e,p,s);return h.top=hn(m.top,h.top),h.right=bi(m.right,h.right),h.bottom=bi(m.bottom,h.bottom),h.left=hn(m.left,h.left),h},Xx(e,u,s));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function jV(t){const{width:e,height:n}=$x(t);return{width:e,height:n}}function zV(t,e,n){const i=yo(e),s=go(e),a=n==="fixed",c=Nr(t,!0,a,e);let u={scrollLeft:0,scrollTop:0};const d=po(0);function h(){d.x=Jc(s)}if(i||!i&&!a)if((ps(e)!=="body"||Pa(s))&&(u=Wc(e)),i){const b=Nr(e,!0,a,e);d.x=b.x+e.clientLeft,d.y=b.y+e.clientTop}else s&&h();a&&!i&&s&&h();const p=s&&!i&&!a?Yx(s,u):po(0),m=c.left+u.scrollLeft-d.x-p.x,y=c.top+u.scrollTop-d.y-p.y;return{x:m,y,width:c.width,height:c.height}}function _h(t){return Fn(t).position==="static"}function Zx(t,e){if(!yo(t)||Fn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return go(t)===n&&(n=n.ownerDocument.body),n}function Kx(t,e){const n=pn(t);if(Qc(t))return n;if(!yo(t)){let s=xi(t);for(;s&&!ms(s);){if(Xn(s)&&!_h(s))return s;s=xi(s)}return n}let i=Zx(t,e);for(;i&&yV(i)&&_h(i);)i=Zx(i,e);return i&&ms(i)&&_h(i)&&!Sh(i)?n:i||SV(t)||n}const VV=async function(t){const e=this.getOffsetParent||Kx,n=this.getDimensions,i=await n(t.floating);return{reference:zV(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function LV(t){return Fn(t).direction==="rtl"}const IV={convertOffsetParentRelativeRectToViewportRelativeRect:_V,getDocumentElement:go,getClippingRect:DV,getOffsetParent:Kx,getElementRects:VV,getClientRects:NV,getDimensions:jV,getScale:gs,isElement:Xn,isRTL:LV};function Qx(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function BV(t,e){let n=null,i;const s=go(t);function a(){var u;clearTimeout(i),(u=n)==null||u.disconnect(),n=null}function c(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),a();const h=t.getBoundingClientRect(),{left:p,top:m,width:y,height:b}=h;if(u||e(),!y||!b)return;const x=Xc(m),w=Xc(s.clientWidth-(p+y)),S=Xc(s.clientHeight-(m+b)),E=Xc(p),T={rootMargin:-x+"px "+-w+"px "+-S+"px "+-E+"px",threshold:hn(0,bi(1,d))||1};let C=!0;function R(A){const O=A[0].intersectionRatio;if(O!==d){if(!C)return c();O?c(!1,O):i=setTimeout(()=>{c(!1,1e-7)},1e3)}O===1&&!Qx(h,t.getBoundingClientRect())&&c(),C=!1}try{n=new IntersectionObserver(R,{...T,root:s.ownerDocument})}catch{n=new IntersectionObserver(R,T)}n.observe(t)}return c(!0),a}function PV(t,e,n,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=i,h=Th(t),p=s||a?[...h?Ha(h):[],...Ha(e)]:[];p.forEach(E=>{s&&E.addEventListener("scroll",n,{passive:!0}),a&&E.addEventListener("resize",n)});const m=h&&u?BV(h,n):null;let y=-1,b=null;c&&(b=new ResizeObserver(E=>{let[D]=E;D&&D.target===h&&b&&(b.unobserve(e),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var T;(T=b)==null||T.observe(e)})),n()}),h&&!d&&b.observe(h),b.observe(e));let x,w=d?Nr(t):null;d&&S();function S(){const E=Nr(t);w&&!Qx(w,E)&&n(),w=E,x=requestAnimationFrame(S)}return n(),()=>{var E;p.forEach(D=>{s&&D.removeEventListener("scroll",n),a&&D.removeEventListener("resize",n)}),m?.(),(E=b)==null||E.disconnect(),b=null,d&&cancelAnimationFrame(x)}}const HV=fV,UV=dV,$V=lV,qV=pV,YV=cV,Wx=aV,GV=hV,XV=(t,e,n)=>{const i=new Map,s={platform:IV,...n},a={...s.platform,_c:i};return sV(t,e,{...s,platform:a})};var FV=typeof document<"u",ZV=function(){},tu=FV?N.useLayoutEffect:ZV;function eu(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,i,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(i=n;i--!==0;)if(!eu(t[i],e[i]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(e,s[i]))return!1;for(i=n;i--!==0;){const a=s[i];if(!(a==="_owner"&&t.$$typeof)&&!eu(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function Jx(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function tw(t,e){const n=Jx(t);return Math.round(e*n)/n}function Nh(t){const e=N.useRef(t);return tu(()=>{e.current=t}),e}function KV(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:i=[],platform:s,elements:{reference:a,floating:c}={},transform:u=!0,whileElementsMounted:d,open:h}=t,[p,m]=N.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[y,b]=N.useState(i);eu(y,i)||b(i);const[x,w]=N.useState(null),[S,E]=N.useState(null),D=N.useCallback(z=>{z!==A.current&&(A.current=z,w(z))},[]),T=N.useCallback(z=>{z!==O.current&&(O.current=z,E(z))},[]),C=a||x,R=c||S,A=N.useRef(null),O=N.useRef(null),k=N.useRef(p),H=d!=null,$=Nh(d),q=Nh(s),F=Nh(h),Q=N.useCallback(()=>{if(!A.current||!O.current)return;const z={placement:e,strategy:n,middleware:y};q.current&&(z.platform=q.current),XV(A.current,O.current,z).then(U=>{const Y={...U,isPositioned:F.current!==!1};B.current&&!eu(k.current,Y)&&(k.current=Y,rh.flushSync(()=>{m(Y)}))})},[y,e,n,q,F]);tu(()=>{h===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,m(z=>({...z,isPositioned:!1})))},[h]);const B=N.useRef(!1);tu(()=>(B.current=!0,()=>{B.current=!1}),[]),tu(()=>{if(C&&(A.current=C),R&&(O.current=R),C&&R){if($.current)return $.current(C,R,Q);Q()}},[C,R,Q,$,H]);const P=N.useMemo(()=>({reference:A,floating:O,setReference:D,setFloating:T}),[D,T]),j=N.useMemo(()=>({reference:C,floating:R}),[C,R]),I=N.useMemo(()=>{const z={position:n,left:0,top:0};if(!j.floating)return z;const U=tw(j.floating,p.x),Y=tw(j.floating,p.y);return u?{...z,transform:"translate("+U+"px, "+Y+"px)",...Jx(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:Y}},[n,u,j.floating,p.x,p.y]);return N.useMemo(()=>({...p,update:Q,refs:P,elements:j,floatingStyles:I}),[p,Q,P,j,I])}const QV=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:i,padding:s}=typeof t=="function"?t(n):t;return i&&e(i)?i.current!=null?Wx({element:i.current,padding:s}).fn(n):{}:i?Wx({element:i,padding:s}).fn(n):{}}}},WV=(t,e)=>({...HV(t),options:[t,e]}),JV=(t,e)=>({...UV(t),options:[t,e]}),t4=(t,e)=>({...GV(t),options:[t,e]}),e4=(t,e)=>({...$V(t),options:[t,e]}),n4=(t,e)=>({...qV(t),options:[t,e]}),o4=(t,e)=>({...YV(t),options:[t,e]}),i4=(t,e)=>({...QV(t),options:[t,e]});var r4="Arrow",ew=N.forwardRef((t,e)=>{const{children:n,width:i=10,height:s=5,...a}=t;return M.jsx(yi.svg,{...a,ref:e,width:i,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:M.jsx("polygon",{points:"0,0 30,0 15,10"})})});ew.displayName=r4;var s4=ew,Ah="Popper",[nw,ow]=_x(Ah),[a4,iw]=nw(Ah),rw=t=>{const{__scopePopper:e,children:n}=t,[i,s]=N.useState(null);return M.jsx(a4,{scope:e,anchor:i,onAnchorChange:s,children:n})};rw.displayName=Ah;var sw="PopperAnchor",aw=N.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:i,...s}=t,a=iw(sw,n),c=N.useRef(null),u=_r(e,c),d=N.useRef(null);return N.useEffect(()=>{const h=d.current;d.current=i?.current||c.current,h!==d.current&&a.onAnchorChange(d.current)}),i?null:M.jsx(yi.div,{...s,ref:u})});aw.displayName=sw;var Mh="PopperContent",[l4,c4]=nw(Mh),lw=N.forwardRef((t,e)=>{const{__scopePopper:n,side:i="bottom",sideOffset:s=0,align:a="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:h=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:x,...w}=t,S=iw(Mh,n),[E,D]=N.useState(null),T=_r(e,ft=>D(ft)),[C,R]=N.useState(null),A=Xz(C),O=A?.width??0,k=A?.height??0,H=i+(a!=="center"?"-"+a:""),$=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},q=Array.isArray(h)?h:[h],F=q.length>0,Q={padding:$,boundary:q.filter(f4),altBoundary:F},{refs:B,floatingStyles:P,placement:j,isPositioned:I,middlewareData:z}=KV({strategy:"fixed",placement:H,whileElementsMounted:(...ft)=>PV(...ft,{animationFrame:b==="always"}),elements:{reference:S.anchor},middleware:[WV({mainAxis:s+k,alignmentAxis:c}),d&&JV({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?t4():void 0,...Q}),d&&e4({...Q}),n4({...Q,apply:({elements:ft,rects:ut,availableWidth:dt,availableHeight:Mt})=>{const{width:Nt,height:bt}=ut.reference,Tt=ft.floating.style;Tt.setProperty("--radix-popper-available-width",`${dt}px`),Tt.setProperty("--radix-popper-available-height",`${Mt}px`),Tt.setProperty("--radix-popper-anchor-width",`${Nt}px`),Tt.setProperty("--radix-popper-anchor-height",`${bt}px`)}}),C&&i4({element:C,padding:u}),d4({arrowWidth:O,arrowHeight:k}),y&&o4({strategy:"referenceHidden",...Q})]}),[U,Y]=fw(j),L=Yc(x);vi(()=>{I&&L?.()},[I,L]);const G=z.arrow?.x,tt=z.arrow?.y,it=z.arrow?.centerOffset!==0,[lt,ht]=N.useState();return vi(()=>{E&&ht(window.getComputedStyle(E).zIndex)},[E]),M.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...P,transform:I?P.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:lt,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(" "),...z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:M.jsx(l4,{scope:n,placedSide:U,onArrowChange:R,arrowX:G,arrowY:tt,shouldHideArrow:it,children:M.jsx(yi.div,{"data-side":U,"data-align":Y,...w,ref:T,style:{...w.style,animation:I?void 0:"none"}})})})});lw.displayName=Mh;var cw="PopperArrow",u4={top:"bottom",right:"left",bottom:"top",left:"right"},uw=N.forwardRef(function(e,n){const{__scopePopper:i,...s}=e,a=c4(cw,i),c=u4[a.placedSide];return M.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:M.jsx(s4,{...s,ref:n,style:{...s.style,display:"block"}})})});uw.displayName=cw;function f4(t){return t!==null}var d4=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:i,middlewareData:s}=e,c=s.arrow?.centerOffset!==0,u=c?0:t.arrowWidth,d=c?0:t.arrowHeight,[h,p]=fw(n),m={start:"0%",center:"50%",end:"100%"}[p],y=(s.arrow?.x??0)+u/2,b=(s.arrow?.y??0)+d/2;let x="",w="";return h==="bottom"?(x=c?m:`${y}px`,w=`${-d}px`):h==="top"?(x=c?m:`${y}px`,w=`${i.floating.height+d}px`):h==="right"?(x=`${-d}px`,w=c?m:`${b}px`):h==="left"&&(x=`${i.floating.width+d}px`,w=c?m:`${b}px`),{data:{x,y:w}}}});function fw(t){const[e,n="center"]=t.split("-");return[e,n]}var h4=rw,p4=aw,m4=lw,g4=uw,[nu]=_x("Tooltip",[ow]),ou=ow(),dw="TooltipProvider",y4=700,Rh="tooltip.open",[v4,kh]=nu(dw),hw=t=>{const{__scopeTooltip:e,delayDuration:n=y4,skipDelayDuration:i=300,disableHoverableContent:s=!1,children:a}=t,c=N.useRef(!0),u=N.useRef(!1),d=N.useRef(0);return N.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),M.jsx(v4,{scope:e,isOpenDelayedRef:c,delayDuration:n,onOpen:N.useCallback(()=>{window.clearTimeout(d.current),c.current=!1},[]),onClose:N.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>c.current=!0,i)},[i]),isPointerInTransitRef:u,onPointerInTransitChange:N.useCallback(h=>{u.current=h},[]),disableHoverableContent:s,children:a})};hw.displayName=dw;var Ua="Tooltip",[b4,$a]=nu(Ua),pw=t=>{const{__scopeTooltip:e,children:n,open:i,defaultOpen:s,onOpenChange:a,disableHoverableContent:c,delayDuration:u}=t,d=kh(Ua,t.__scopeTooltip),h=ou(e),[p,m]=N.useState(null),y=Lz(),b=N.useRef(0),x=c??d.disableHoverableContent,w=u??d.delayDuration,S=N.useRef(!1),[E,D]=Mz({prop:i,defaultProp:s??!1,onChange:O=>{O?(d.onOpen(),document.dispatchEvent(new CustomEvent(Rh))):d.onClose(),a?.(O)},caller:Ua}),T=N.useMemo(()=>E?S.current?"delayed-open":"instant-open":"closed",[E]),C=N.useCallback(()=>{window.clearTimeout(b.current),b.current=0,S.current=!1,D(!0)},[D]),R=N.useCallback(()=>{window.clearTimeout(b.current),b.current=0,D(!1)},[D]),A=N.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{S.current=!0,D(!0),b.current=0},w)},[w,D]);return N.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),M.jsx(h4,{...h,children:M.jsx(b4,{scope:e,contentId:y,open:E,stateAttribute:T,trigger:p,onTriggerChange:m,onTriggerEnter:N.useCallback(()=>{d.isOpenDelayedRef.current?A():C()},[d.isOpenDelayedRef,A,C]),onTriggerLeave:N.useCallback(()=>{x?R():(window.clearTimeout(b.current),b.current=0)},[R,x]),onOpen:C,onClose:R,disableHoverableContent:x,children:n})})};pw.displayName=Ua;var Oh="TooltipTrigger",mw=N.forwardRef((t,e)=>{const{__scopeTooltip:n,...i}=t,s=$a(Oh,n),a=kh(Oh,n),c=ou(n),u=N.useRef(null),d=_r(e,u,s.onTriggerChange),h=N.useRef(!1),p=N.useRef(!1),m=N.useCallback(()=>h.current=!1,[]);return N.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),M.jsx(p4,{asChild:!0,...c,children:M.jsx(yi.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:d,onPointerMove:Vo(t.onPointerMove,y=>{y.pointerType!=="touch"&&!p.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),p.current=!0)}),onPointerLeave:Vo(t.onPointerLeave,()=>{s.onTriggerLeave(),p.current=!1}),onPointerDown:Vo(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Vo(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:Vo(t.onBlur,s.onClose),onClick:Vo(t.onClick,s.onClose)})})});mw.displayName=Oh;var Dh="TooltipPortal",[x4,w4]=nu(Dh,{forceMount:void 0}),gw=t=>{const{__scopeTooltip:e,forceMount:n,children:i,container:s}=t,a=$a(Dh,e);return M.jsx(x4,{scope:e,forceMount:n,children:M.jsx(mh,{present:n||a.open,children:M.jsx(Ox,{asChild:!0,container:s,children:i})})})};gw.displayName=Dh;var ys="TooltipContent",yw=N.forwardRef((t,e)=>{const n=w4(ys,t.__scopeTooltip),{forceMount:i=n.forceMount,side:s="top",...a}=t,c=$a(ys,t.__scopeTooltip);return M.jsx(mh,{present:i||c.open,children:c.disableHoverableContent?M.jsx(vw,{side:s,...a,ref:e}):M.jsx(S4,{side:s,...a,ref:e})})}),S4=N.forwardRef((t,e)=>{const n=$a(ys,t.__scopeTooltip),i=kh(ys,t.__scopeTooltip),s=N.useRef(null),a=_r(e,s),[c,u]=N.useState(null),{trigger:d,onClose:h}=n,p=s.current,{onPointerInTransitChange:m}=i,y=N.useCallback(()=>{u(null),m(!1)},[m]),b=N.useCallback((x,w)=>{const S=x.currentTarget,E={x:x.clientX,y:x.clientY},D=_4(E,S.getBoundingClientRect()),T=N4(E,D),C=A4(w.getBoundingClientRect()),R=R4([...T,...C]);u(R),m(!0)},[m]);return N.useEffect(()=>()=>y(),[y]),N.useEffect(()=>{if(d&&p){const x=S=>b(S,p),w=S=>b(S,d);return d.addEventListener("pointerleave",x),p.addEventListener("pointerleave",w),()=>{d.removeEventListener("pointerleave",x),p.removeEventListener("pointerleave",w)}}},[d,p,b,y]),N.useEffect(()=>{if(c){const x=w=>{const S=w.target,E={x:w.clientX,y:w.clientY},D=d?.contains(S)||p?.contains(S),T=!M4(E,c);D?y():T&&(y(),h())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[d,p,c,h,y]),M.jsx(vw,{...t,ref:a})}),[E4,C4]=nu(Ua,{isInside:!1}),T4=vz("TooltipContent"),vw=N.forwardRef((t,e)=>{const{__scopeTooltip:n,children:i,"aria-label":s,onEscapeKeyDown:a,onPointerDownOutside:c,...u}=t,d=$a(ys,n),h=ou(n),{onClose:p}=d;return N.useEffect(()=>(document.addEventListener(Rh,p),()=>document.removeEventListener(Rh,p)),[p]),N.useEffect(()=>{if(d.trigger){const m=y=>{y.target?.contains(d.trigger)&&p()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[d.trigger,p]),M.jsx(Mx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:m=>m.preventDefault(),onDismiss:p,children:M.jsxs(m4,{"data-state":d.stateAttribute,...h,...u,ref:e,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[M.jsx(T4,{children:i}),M.jsx(E4,{scope:n,isInside:!0,children:M.jsx(_z,{id:d.contentId,role:"tooltip",children:s||i})})]})})});yw.displayName=ys;var bw="TooltipArrow",xw=N.forwardRef((t,e)=>{const{__scopeTooltip:n,...i}=t,s=ou(n);return C4(bw,n).isInside?null:M.jsx(g4,{...s,...i,ref:e})});xw.displayName=bw;function _4(t,e){const n=Math.abs(e.top-t.y),i=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),a=Math.abs(e.left-t.x);switch(Math.min(n,i,s,a)){case a:return"left";case s:return"right";case n:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function N4(t,e,n=5){const i=[];switch(e){case"top":i.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":i.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":i.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":i.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return i}function A4(t){const{top:e,right:n,bottom:i,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:i},{x:s,y:i}]}function M4(t,e){const{x:n,y:i}=t;let s=!1;for(let a=0,c=e.length-1;a<e.length;c=a++){const u=e[a],d=e[c],h=u.x,p=u.y,m=d.x,y=d.y;p>i!=y>i&&n<(m-h)*(i-p)/(y-p)+h&&(s=!s)}return s}function R4(t){const e=t.slice();return e.sort((n,i)=>n.x<i.x?-1:n.x>i.x?1:n.y<i.y?-1:n.y>i.y?1:0),k4(e)}function k4(t){if(t.length<=1)return t.slice();const e=[];for(let i=0;i<t.length;i++){const s=t[i];for(;e.length>=2;){const a=e[e.length-1],c=e[e.length-2];if((a.x-c.x)*(s.y-c.y)>=(a.y-c.y)*(s.x-c.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let i=t.length-1;i>=0;i--){const s=t[i];for(;n.length>=2;){const a=n[n.length-1],c=n[n.length-2];if((a.x-c.x)*(s.y-c.y)>=(a.y-c.y)*(s.x-c.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var O4=hw,D4=pw,j4=mw,z4=gw,V4=yw,L4=xw;function ww({delayDuration:t=0,...e}){return M.jsx(O4,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function Sw({...t}){return M.jsx(D4,{"data-slot":"tooltip",...t})}function Ew({...t}){return M.jsx(j4,{"data-slot":"tooltip-trigger",...t})}function Cw({className:t,sideOffset:e=0,children:n,...i}){return M.jsx(z4,{children:M.jsxs(V4,{"data-slot":"tooltip-content",sideOffset:e,className:Gn("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...i,children:[n,M.jsx(L4,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function vs(){return M.jsx(ww,{delayDuration:200,children:M.jsxs(Sw,{children:[M.jsx(Ew,{asChild:!0,children:M.jsxs("div",{className:"absolute -top-2 -right-2 flex h-6 w-6 items-center justify-center cursor-pointer group",children:[M.jsx("span",{className:"absolute inset-0 rounded-full bg-blue-400/30 animate-[ping_2s_cubic-bezier(0,0,0.2,1)_infinite]"}),M.jsx("span",{className:"relative flex h-5 w-5 items-center justify-center rounded-full bg-blue-500 group-hover:bg-blue-400 transition-colors shadow-sm shadow-blue-500/30",children:M.jsxs("svg",{className:"h-3 w-3 text-white",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[M.jsx("circle",{cx:"6.5",cy:"6.5",r:"4.5"}),M.jsx("line",{x1:"10",y1:"10",x2:"14",y2:"14"})]})})]})}),M.jsx(Cw,{side:"top",sideOffset:4,children:"Double-click to inspect"})]})})}function I4({data:t}){const e=t.width??8,n=(1<<Math.min(e,31))-1,i=t.numericValue??0,[s,a]=N.useState(!1),[c,u]=N.useState(""),d=N.useCallback(x=>{const w=Math.max(0,Math.min(n,x));t.onValueChange?.(w)},[t,n]),h=N.useCallback(x=>{x.stopPropagation(),u(i.toString()),a(!0)},[i]),p=N.useCallback(()=>{const x=parseInt(c,10);isNaN(x)||d(x),a(!1)},[c,d]),m=N.useCallback(x=>{x.stopPropagation(),x.key==="Enter"?p():x.key==="Escape"&&a(!1)},[p]),y=Math.ceil(e/4),b=i.toString(16).toUpperCase().padStart(y,"0");return M.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[M.jsxs("div",{className:"flex items-center gap-1",children:[M.jsx("button",{onClick:x=>{x.stopPropagation(),d(i-1)},"aria-label":"Decrease value",className:"w-6 h-6 flex items-center justify-center rounded bg-[var(--embed-bg-tertiary)] hover:opacity-80 text-[var(--embed-text-secondary)] text-sm font-bold active:scale-90 transition-all",children:"-"}),s?M.jsx("input",{type:"text",value:c,onChange:x=>u(x.target.value),onBlur:p,onKeyDown:m,onClick:x=>x.stopPropagation(),autoFocus:!0,className:"w-14 h-7 text-center text-xs font-mono bg-white border border-blue-400 rounded outline-none text-gray-800"}):M.jsxs("button",{onClick:h,"aria-label":`Current value: ${i}. Click to edit`,className:"w-14 h-7 flex items-center justify-center rounded bg-[var(--embed-bg-tertiary)] text-emerald-400 font-mono text-sm font-bold hover:opacity-80 transition-colors cursor-text",children:["0x",b]}),M.jsx("button",{onClick:x=>{x.stopPropagation(),d(i+1)},"aria-label":"Increase value",className:"w-6 h-6 flex items-center justify-center rounded bg-[var(--embed-bg-tertiary)] hover:opacity-80 text-[var(--embed-text-secondary)] text-sm font-bold active:scale-90 transition-all",children:"+"})]}),M.jsxs("div",{className:"text-[10px] text-[var(--embed-text-secondary)] font-mono",children:["= ",i]})]})}function B4({data:t,selected:e}){const n=t.value??!1,i=t.componentRef==="Input",s=N.useCallback(c=>{c.stopPropagation(),t.onToggle?.()},[t]),a=t.outputNames.map((c,u)=>({name:c,index:u,type:"output",value:i?(t.numericValue??0)!==0:n}));return M.jsx(Je,{outputPorts:a,selected:e,className:"min-w-[80px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"relative flex flex-col items-center gap-2",children:[t.isComposite&&M.jsx(vs,{}),M.jsx("div",{className:"px-2 py-1 rounded text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),i?M.jsx(I4,{data:t}):M.jsxs(M.Fragment,{children:[M.jsx("button",{onClick:s,role:"switch","aria-checked":n,"aria-label":t.label||t.componentRef,className:Gn("group relative h-9 w-16 rounded-full transition-all duration-300 ease-in-out","focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2 focus-visible:ring-offset-gray-900 hover:shadow-md active:scale-95",n?"bg-gradient-to-r from-emerald-500 to-green-500 shadow-sm":"bg-gradient-to-r from-gray-300 to-gray-400 shadow-sm"),children:M.jsxs("span",{className:Gn("absolute top-0.5 flex items-center justify-center","h-8 w-8 rounded-full bg-white","shadow-lg transition-all duration-300 ease-out",n?"translate-x-[1.875rem]":"translate-x-0.5"),children:[M.jsx("span",{className:"absolute inset-1 rounded-full bg-gradient-to-br from-white to-gray-50"}),M.jsx("span",{className:Gn("relative z-10 h-2 w-2 rounded-full transition-all duration-300",n?"bg-gradient-to-br from-emerald-400 to-green-500":"bg-gradient-to-br from-gray-300 to-gray-400")})]})}),M.jsx("div",{className:Gn("text-xs font-semibold tracking-wide transition-colors duration-300",n?"text-emerald-400":"text-[var(--embed-text-secondary)]"),children:n?"ON":"OFF"})]})]})})}function P4({data:t,selected:e}){const n=t.numericValue??0,i=t.width??8,s=(1<<Math.min(i,31))-1,[a,c]=N.useState(!1),[u,d]=N.useState(n.toString()),[h,p]=N.useState("dec"),m=N.useCallback(S=>{S.stopPropagation(),d(n.toString()),c(!0)},[n]),y=N.useCallback(S=>{if(S.key==="Enter"){S.preventDefault(),S.stopPropagation();const E=u.trim();let D=E.toLowerCase().startsWith("0x")?parseInt(E,16):parseInt(E,10);isNaN(D)&&(D=0),D=Math.max(0,Math.min(s,D)),t.onValueChange?.(D),c(!1)}else S.key==="Escape"&&(S.preventDefault(),c(!1))},[u,s,t]),b=N.useCallback(S=>{S.stopPropagation(),p(E=>E==="dec"?"hex":"dec")},[]),x=t.outputNames.map((S,E)=>({name:S,index:E,type:"output",value:!0})),w=h==="hex"?`0x${n.toString(16).toUpperCase().padStart(Math.ceil(i/4),"0")}`:n.toString();return M.jsx(Je,{outputPorts:x,selected:e,className:"min-w-[100px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),M.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a?M.jsx("input",{type:"text",value:u,onChange:S=>d(S.target.value),onKeyDown:y,onBlur:()=>c(!1),className:"w-24 px-2 py-1 text-center font-mono text-sm border-2 border-blue-500 rounded focus:outline-none",autoFocus:!0,onClick:S=>S.stopPropagation()}):M.jsx("div",{onClick:m,className:"px-3 py-1 bg-gradient-to-r from-indigo-500 to-purple-500 text-white rounded cursor-pointer hover:shadow-md transition-all font-mono text-sm",title:"Click to edit value",children:w}),M.jsx("button",{onClick:b,className:"text-xs text-[var(--embed-text-secondary)] hover:text-[var(--embed-text-primary)] transition-colors",children:h==="dec"?"DEC":"HEX"})]}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-muted)]",children:[i,"-bit"]})]})})}function H4({data:t,selected:e}){const n=t.arguments?.init,i=Array.isArray(n)?n.length:0,s=t.inputNames.map((c,u)=>({name:c,index:u,type:"input"})),a=t.outputNames.map((c,u)=>({name:c,index:u,type:"output"}));return M.jsx(Je,{inputPorts:s,outputPorts:a,selected:e,className:"min-w-[120px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"EthFrame"}),M.jsx("div",{className:"px-3 py-2 text-xs font-semibold rounded-md bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-primary)]",children:"ETH"}),M.jsx("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:i>0?`${i} bytes`:"no frame"})]})})}function U4({data:t,selected:e}){const n=t.value??!1,i=t.numericValue??0,s=t.inputNames.map((u,d)=>({name:u,index:d,type:"input"})),a=u=>u.toString(16).toUpperCase().padStart(2,"0"),c=()=>{if(t.componentRef==="HexDisplay"){const u=a(i);return M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 rounded text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),M.jsx("div",{className:"flex items-center justify-center px-4 py-2 bg-black rounded border-2 border-gray-600",children:M.jsx("span",{className:"text-2xl font-mono font-bold text-green-400",children:u})}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:["Dec: ",i]})]})}else if(t.componentRef==="SevenSegment"){const u=(i&15).toString(16).toUpperCase();return M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 rounded text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),M.jsx("div",{className:"flex items-center justify-center px-3 py-2 bg-black rounded border-2 border-gray-600",children:M.jsx("span",{className:"text-xl font-mono font-bold text-red-500",children:u})}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:["Dec: ",i&15]})]})}else return M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 rounded text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),M.jsx("div",{className:Gn("h-10 w-10 rounded-full border-2 transition-all",n?"border-green-600 bg-green-400 shadow-lg shadow-green-500/50":"border-gray-500 bg-[var(--embed-bg-tertiary)]"),children:n&&M.jsx("div",{className:"h-full w-full rounded-full bg-gradient-to-br from-green-300 to-green-500"})}),M.jsx("div",{className:Gn("text-xs font-semibold",n?"text-green-400":"text-[var(--embed-text-secondary)]"),children:n?"ON":"OFF"})]})};return M.jsx(Je,{inputPorts:s,selected:e,className:"min-w-[80px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"relative",children:[t.isComposite&&M.jsx(vs,{}),c()]})})}function $4({data:t,selected:e}){const n=t.arguments?.width??8,i=t.arguments?.height??8,s=n*i,a=t.__pixels??new Array(s).fill(0),c=n<=8?16:n<=16?8:4,u=n<=8?2:n<=16?1:0;return M.jsx(Je,{selected:e,inputPorts:t.inputNames.map((d,h)=>({name:d,index:h,type:"input"})),outputPorts:t.outputNames.map((d,h)=>({name:d,index:h,type:"output"})),className:"min-w-[160px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"Screen"}),M.jsx("svg",{width:n*c+(n-1)*u,height:i*c+(i-1)*u,className:"border-2 border-gray-700 rounded bg-black",style:{imageRendering:"pixelated"},children:a.slice(0,s).map((d,h)=>{const p=h%n,m=Math.floor(h/n);return M.jsx("rect",{x:p*(c+u),y:m*(c+u),width:c,height:c,fill:d!==0?"#00ff00":"#1a1a1a"},h)})}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:[n,"×",i," pixels"]})]})})}function q4({data:t,selected:e}){const n=t.__pixels??new Array(64).fill(0),i=8,s=16,a=2;return M.jsx(Je,{selected:e,inputPorts:t.inputNames.map((c,u)=>({name:c,index:u,type:"input"})),outputPorts:t.outputNames.map((c,u)=>({name:c,index:u,type:"output"})),className:"min-w-[160px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"RasterDisplay"}),M.jsx("svg",{width:i*s+(i-1)*a,height:i*s+(i-1)*a,className:"border-2 border-gray-700 rounded bg-black",style:{imageRendering:"pixelated"},children:n.map((c,u)=>{const d=u%i,h=Math.floor(u/i);return M.jsx("rect",{x:d*(s+a),y:h*(s+a),width:s,height:s,fill:c!==0?"#00ff00":"#1a1a1a"},u)})}),M.jsx("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:"8×8 raster scan"})]})})}function Y4({data:t,selected:e}){const n=N.useRef(null),i=t.__consoleText??"";N.useEffect(()=>{n.current&&(n.current.scrollTop=n.current.scrollHeight)},[i]);const s=i?i.split(`
|
|
25
|
-
`).length:0,a=
|
|
26
|
-
`).length:0,a=
|
|
23
|
+
`)),p=h.reduce((m,y)=>m.concat(...y),[]);return[h,p]}return[[],[]]},[t]);return N.useEffect(()=>{const d=e?.target??sb,h=e?.actInsideInputWithModifier??!0;if(t!==null){const p=b=>{if(s.current=b.ctrlKey||b.metaKey||b.shiftKey||b.altKey,(!s.current||s.current&&!h)&&yv(b))return!1;const w=lb(b.code,u);if(a.current.add(b[w]),ab(l,a.current,!1)){const _=b.composedPath?.()?.[0]||b.target,S=_?.nodeName==="BUTTON"||_?.nodeName==="A";e.preventDefault!==!1&&(s.current||!S)&&b.preventDefault(),o(!0)}},m=b=>{const x=lb(b.code,u);ab(l,a.current,!0)?(o(!1),a.current.clear()):a.current.delete(b[x]),b.key==="Meta"&&a.current.clear(),s.current=!1},y=()=>{a.current.clear(),o(!1)};return d?.addEventListener("keydown",p),d?.addEventListener("keyup",m),window.addEventListener("blur",y),window.addEventListener("contextmenu",y),()=>{d?.removeEventListener("keydown",p),d?.removeEventListener("keyup",m),window.removeEventListener("blur",y),window.removeEventListener("contextmenu",y)}}},[t,o]),n}function ab(t,e,n){return t.filter(o=>n||o.length===e.size).some(o=>o.every(s=>e.has(s)))}function lb(t,e){return e.includes(t)?"code":"key"}const P5=()=>{const t=ae();return N.useMemo(()=>({zoomIn:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1.2,{duration:e?.duration}):Promise.resolve(!1)},zoomOut:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1/1.2,{duration:e?.duration}):Promise.resolve(!1)},zoomTo:(e,n)=>{const{panZoom:o}=t.getState();return o?o.scaleTo(e,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(e,n)=>{const{transform:[o,s,a],panZoom:l}=t.getState();return l?(await l.setViewport({x:e.x??o,y:e.y??s,zoom:e.zoom??a},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[e,n,o]=t.getState().transform;return{x:e,y:n,zoom:o}},setCenter:async(e,n,o)=>t.getState().setCenter(e,n,o),fitBounds:async(e,n)=>{const{width:o,height:s,minZoom:a,maxZoom:l,panZoom:u}=t.getState(),d=Dd(e,o,s,a,l,n?.padding??.1);return u?(await u.setViewport(d,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(e,n={})=>{const{transform:o,snapGrid:s,snapToGrid:a,domNode:l}=t.getState();if(!l)return e;const{x:u,y:d}=l.getBoundingClientRect(),h={x:e.x-u,y:e.y-d},p=n.snapGrid??s,m=n.snapToGrid??a;return aa(h,o,m,p)},flowToScreenPosition:e=>{const{transform:n,domNode:o}=t.getState();if(!o)return e;const{x:s,y:a}=o.getBoundingClientRect(),l=dc(e,n);return{x:l.x+s,y:l.y+a}}}),[])};function cb(t,e){const n=[],o=new Map,s=[];for(const a of t)if(a.type==="add"){s.push(a);continue}else if(a.type==="remove"||a.type==="replace")o.set(a.id,[a]);else{const l=o.get(a.id);l?l.push(a):o.set(a.id,[a])}for(const a of e){const l=o.get(a.id);if(!l){n.push(a);continue}if(l[0].type==="remove")continue;if(l[0].type==="replace"){n.push({...l[0].item});continue}const u={...a};for(const d of l)B5(d,u);n.push(u)}return s.length&&s.forEach(a=>{a.index!==void 0?n.splice(a.index,0,{...a.item}):n.push({...a.item})}),n}function B5(t,e){switch(t.type){case"select":{e.selected=t.selected;break}case"position":{typeof t.position<"u"&&(e.position=t.position),typeof t.dragging<"u"&&(e.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(e.measured={...t.dimensions},t.setAttributes&&((t.setAttributes===!0||t.setAttributes==="width")&&(e.width=t.dimensions.width),(t.setAttributes===!0||t.setAttributes==="height")&&(e.height=t.dimensions.height))),typeof t.resizing=="boolean"&&(e.resizing=t.resizing);break}}}function ub(t,e){return cb(t,e)}function H5(t,e){return cb(t,e)}function Uo(t,e){return{id:t,type:"select",selected:e}}function Dr(t,e=new Set,n=!1){const o=[];for(const[s,a]of t){const l=e.has(s);!(a.selected===void 0&&!l)&&a.selected!==l&&(n&&(a.selected=l),o.push(Uo(a.id,l)))}return o}function fb({items:t=[],lookup:e}){const n=[],o=new Map(t.map(s=>[s.id,s]));for(const[s,a]of t.entries()){const l=e.get(a.id),u=l?.internals?.userNode??l;u!==void 0&&u!==a&&n.push({id:a.id,item:a,type:"replace"}),u===void 0&&n.push({item:a,type:"add",index:s})}for(const[s]of e)o.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function db(t){return{id:t.id,type:"remove"}}const hb=t=>uO(t),U5=t=>sv(t);function pb(t){return N.forwardRef(t)}const $5=typeof window<"u"?N.useLayoutEffect:N.useEffect;function mb(t){const[e,n]=N.useState(BigInt(0)),[o]=N.useState(()=>Y5(()=>n(s=>s+BigInt(1))));return $5(()=>{const s=o.get();s.length&&(t(s),o.reset())},[e]),o}function Y5(t){let e=[];return{get:()=>e,reset:()=>{e=[]},push:n=>{e.push(n),t()}}}const gb=N.createContext(null);function q5({children:t}){const e=ae(),n=N.useCallback(u=>{const{nodes:d=[],setNodes:h,hasDefaultNodes:p,onNodesChange:m,nodeLookup:y,fitViewQueued:b,onNodesChangeMiddlewareMap:x}=e.getState();let w=d;for(const S of u)w=typeof S=="function"?S(w):S;let _=fb({items:w,lookup:y});for(const S of x.values())_=S(_);p&&h(w),_.length>0?m?.(_):b&&window.requestAnimationFrame(()=>{const{fitViewQueued:S,nodes:k,setNodes:C}=e.getState();S&&C(k)})},[]),o=mb(n),s=N.useCallback(u=>{const{edges:d=[],setEdges:h,hasDefaultEdges:p,onEdgesChange:m,edgeLookup:y}=e.getState();let b=d;for(const x of u)b=typeof x=="function"?x(b):x;p?h(b):m&&m(fb({items:b,lookup:y}))},[]),a=mb(s),l=N.useMemo(()=>({nodeQueue:o,edgeQueue:a}),[]);return M.jsx(gb.Provider,{value:l,children:t})}function G5(){const t=N.useContext(gb);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const F5=t=>!!t.panZoom;function da(){const t=P5(),e=ae(),n=G5(),o=Gt(F5),s=N.useMemo(()=>{const a=m=>e.getState().nodeLookup.get(m),l=m=>{n.nodeQueue.push(m)},u=m=>{n.edgeQueue.push(m)},d=m=>{const{nodeLookup:y,nodeOrigin:b}=e.getState(),x=hb(m)?m:y.get(m.id),w=x.parentId?pv(x.position,x.measured,x.parentId,y,b):x.position,_={...x,position:w,width:x.measured?.width??x.width,height:x.measured?.height??x.height};return Ar(_)},h=(m,y,b={replace:!1})=>{l(x=>x.map(w=>{if(w.id===m){const _=typeof y=="function"?y(w):y;return b.replace&&hb(_)?_:{...w,..._}}return w}))},p=(m,y,b={replace:!1})=>{u(x=>x.map(w=>{if(w.id===m){const _=typeof y=="function"?y(w):y;return b.replace&&U5(_)?_:{...w,..._}}return w}))};return{getNodes:()=>e.getState().nodes.map(m=>({...m})),getNode:m=>a(m)?.internals.userNode,getInternalNode:a,getEdges:()=>{const{edges:m=[]}=e.getState();return m.map(y=>({...y}))},getEdge:m=>e.getState().edgeLookup.get(m),setNodes:l,setEdges:u,addNodes:m=>{const y=Array.isArray(m)?m:[m];n.nodeQueue.push(b=>[...b,...y])},addEdges:m=>{const y=Array.isArray(m)?m:[m];n.edgeQueue.push(b=>[...b,...y])},toObject:()=>{const{nodes:m=[],edges:y=[],transform:b}=e.getState(),[x,w,_]=b;return{nodes:m.map(S=>({...S})),edges:y.map(S=>({...S})),viewport:{x,y:w,zoom:_}}},deleteElements:async({nodes:m=[],edges:y=[]})=>{const{nodes:b,edges:x,onNodesDelete:w,onEdgesDelete:_,triggerNodeChanges:S,triggerEdgeChanges:k,onDelete:C,onBeforeDelete:E}=e.getState(),{nodes:R,edges:A}=await mO({nodesToRemove:m,edgesToRemove:y,nodes:b,edges:x,onBeforeDelete:E}),O=A.length>0,D=R.length>0;if(O){const U=A.map(db);_?.(A),k(U)}if(D){const U=R.map(db);w?.(R),S(U)}return(D||O)&&C?.({nodes:R,edges:A}),{deletedNodes:R,deletedEdges:A}},getIntersectingNodes:(m,y=!0,b)=>{const x=dv(m),w=x?m:d(m),_=b!==void 0;return w?(b||e.getState().nodes).filter(S=>{const k=e.getState().nodeLookup.get(S.id);if(k&&!x&&(S.id===m.id||!k.internals.positionAbsolute))return!1;const C=Ar(_?S:k),E=ra(C,w);return y&&E>0||E>=C.width*C.height||E>=w.width*w.height}):[]},isNodeIntersecting:(m,y,b=!0)=>{const w=dv(m)?m:d(m);if(!w)return!1;const _=ra(w,y);return b&&_>0||_>=y.width*y.height||_>=w.width*w.height},updateNode:h,updateNodeData:(m,y,b={replace:!1})=>{h(m,x=>{const w=typeof y=="function"?y(x):y;return b.replace?{...x,data:w}:{...x,data:{...x.data,...w}}},b)},updateEdge:p,updateEdgeData:(m,y,b={replace:!1})=>{p(m,x=>{const w=typeof y=="function"?y(x):y;return b.replace?{...x,data:w}:{...x,data:{...x.data,...w}}},b)},getNodesBounds:m=>{const{nodeLookup:y,nodeOrigin:b}=e.getState();return fO(m,{nodeLookup:y,nodeOrigin:b})},getHandleConnections:({type:m,id:y,nodeId:b})=>Array.from(e.getState().connectionLookup.get(`${b}-${m}${y?`-${y}`:""}`)?.values()??[]),getNodeConnections:({type:m,handleId:y,nodeId:b})=>Array.from(e.getState().connectionLookup.get(`${b}${m?y?`-${m}-${y}`:`-${m}`:""}`)?.values()??[]),fitView:async m=>{const y=e.getState().fitViewResolver??bO();return e.setState({fitViewQueued:!0,fitViewOptions:m,fitViewResolver:y}),n.nodeQueue.push(b=>[...b]),y.promise}}},[]);return N.useMemo(()=>({...s,...t,viewportInitialized:o}),[o])}const yb=t=>t.selected,X5=typeof window<"u"?window:void 0;function Z5({deleteKeyCode:t,multiSelectionKeyCode:e}){const n=ae(),{deleteElements:o}=da(),s=fa(t,{actInsideInputWithModifier:!1}),a=fa(e,{target:X5});N.useEffect(()=>{if(s){const{edges:l,nodes:u}=n.getState();o({nodes:u.filter(yb),edges:l.filter(yb)}),n.setState({nodesSelectionActive:!1})}},[s]),N.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])}function K5(t){const e=ae();N.useEffect(()=>{const n=()=>{if(!t.current||!(t.current.checkVisibility?.()??!0))return!1;const o=jd(t.current);(o.height===0||o.width===0)&&e.getState().onError?.("004",Kn.error004()),e.setState({width:o.width||500,height:o.height||500})};if(t.current){n(),window.addEventListener("resize",n);const o=new ResizeObserver(()=>n());return o.observe(t.current),()=>{window.removeEventListener("resize",n),o&&t.current&&o.unobserve(t.current)}}},[])}const vc={position:"absolute",width:"100%",height:"100%",top:0,left:0},Q5=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function W5({onPaneContextMenu:t,zoomOnScroll:e=!0,zoomOnPinch:n=!0,panOnScroll:o=!1,panOnScrollSpeed:s=.5,panOnScrollMode:a=Po.Free,zoomOnDoubleClick:l=!0,panOnDrag:u=!0,defaultViewport:d,translateExtent:h,minZoom:p,maxZoom:m,zoomActivationKeyCode:y,preventScrolling:b=!0,children:x,noWheelClassName:w,noPanClassName:_,onViewportChange:S,isControlledViewport:k,paneClickDistance:C,selectionOnDrag:E}){const R=ae(),A=N.useRef(null),{userSelectionActive:O,lib:D,connectionInProgress:U}=Gt(Q5,fe),q=fa(y),Y=N.useRef();K5(A);const K=N.useCallback(W=>{S?.({x:W[0],y:W[1],zoom:W[2]}),k||R.setState({transform:W})},[S,k]);return N.useEffect(()=>{if(A.current){Y.current=n5({domNode:A.current,minZoom:p,maxZoom:m,translateExtent:h,viewport:d,onDraggingChange:j=>R.setState(I=>I.paneDragging===j?I:{paneDragging:j}),onPanZoomStart:(j,I)=>{const{onViewportChangeStart:z,onMoveStart:$}=R.getState();$?.(j,I),z?.(I)},onPanZoom:(j,I)=>{const{onViewportChange:z,onMove:$}=R.getState();$?.(j,I),z?.(I)},onPanZoomEnd:(j,I)=>{const{onViewportChangeEnd:z,onMoveEnd:$}=R.getState();$?.(j,I),z?.(I)}});const{x:W,y:B,zoom:H}=Y.current.getViewport();return R.setState({panZoom:Y.current,transform:[W,B,H],domNode:A.current.closest(".react-flow")}),()=>{Y.current?.destroy()}}},[]),N.useEffect(()=>{Y.current?.update({onPaneContextMenu:t,zoomOnScroll:e,zoomOnPinch:n,panOnScroll:o,panOnScrollSpeed:s,panOnScrollMode:a,zoomOnDoubleClick:l,panOnDrag:u,zoomActivationKeyPressed:q,preventScrolling:b,noPanClassName:_,userSelectionActive:O,noWheelClassName:w,lib:D,onTransformChange:K,connectionInProgress:U,selectionOnDrag:E,paneClickDistance:C})},[t,e,n,o,s,a,l,u,q,b,_,O,w,D,K,U,E,C]),M.jsx("div",{className:"react-flow__renderer",ref:A,style:vc,children:x})}const J5=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function tD(){const{userSelectionActive:t,userSelectionRect:e}=Gt(J5,fe);return t&&e?M.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}const Wd=(t,e)=>n=>{n.target===e.current&&t?.(n)},eD=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,connectionInProgress:t.connection.inProgress,dragging:t.paneDragging});function nD({isSelecting:t,selectionKeyPressed:e,selectionMode:n=na.Full,panOnDrag:o,paneClickDistance:s,selectionOnDrag:a,onSelectionStart:l,onSelectionEnd:u,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:p,onPaneMouseEnter:m,onPaneMouseMove:y,onPaneMouseLeave:b,children:x}){const w=ae(),{userSelectionActive:_,elementsSelectable:S,dragging:k,connectionInProgress:C}=Gt(eD,fe),E=S&&(t||_),R=N.useRef(null),A=N.useRef(),O=N.useRef(new Set),D=N.useRef(new Set),U=N.useRef(!1),q=z=>{if(U.current||C){U.current=!1;return}d?.(z),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},Y=z=>{if(Array.isArray(o)&&o?.includes(2)){z.preventDefault();return}h?.(z)},K=p?z=>p(z):void 0,W=z=>{U.current&&(z.stopPropagation(),U.current=!1)},B=z=>{const{domNode:$}=w.getState();if(A.current=$?.getBoundingClientRect(),!A.current)return;const G=z.target===R.current;if(!G&&!!z.target.closest(".nokey")||!t||!(a&&G||e)||z.button!==0||!z.isPrimary)return;z.target?.setPointerCapture?.(z.pointerId),U.current=!1;const{x:et,y:rt}=Dn(z.nativeEvent,A.current);w.setState({userSelectionRect:{width:0,height:0,startX:et,startY:rt,x:et,y:rt}}),G||(z.stopPropagation(),z.preventDefault())},H=z=>{const{userSelectionRect:$,transform:G,nodeLookup:L,edgeLookup:F,connectionLookup:et,triggerNodeChanges:rt,triggerEdgeChanges:ct,defaultEdgeOptions:ht,resetSelectedElements:ft}=w.getState();if(!A.current||!$)return;const{x:ut,y:dt}=Dn(z.nativeEvent,A.current),{startX:Ot,startY:At}=$;if(!U.current){const Ft=e?0:s;if(Math.hypot(ut-Ot,dt-At)<=Ft)return;ft(),l?.(z)}U.current=!0;const bt={startX:Ot,startY:At,x:ut<Ot?ut:Ot,y:dt<At?dt:At,width:Math.abs(ut-Ot),height:Math.abs(dt-At)},Tt=O.current,Dt=D.current;O.current=new Set(kd(L,bt,G,n===na.Partial,!0).map(Ft=>Ft.id)),D.current=new Set;const Xt=ht?.selectable??!0;for(const Ft of O.current){const pt=et.get(Ft);if(pt)for(const{edgeId:yt}of pt.values()){const vt=F.get(yt);vt&&(vt.selectable??Xt)&&D.current.add(yt)}}if(!mv(Tt,O.current)){const Ft=Dr(L,O.current,!0);rt(Ft)}if(!mv(Dt,D.current)){const Ft=Dr(F,D.current);ct(Ft)}w.setState({userSelectionRect:bt,userSelectionActive:!0,nodesSelectionActive:!1})},j=z=>{z.button===0&&(z.target?.releasePointerCapture?.(z.pointerId),!_&&z.target===R.current&&w.getState().userSelectionRect&&q?.(z),w.setState({userSelectionActive:!1,userSelectionRect:null}),U.current&&(u?.(z),w.setState({nodesSelectionActive:O.current.size>0})))},I=o===!0||Array.isArray(o)&&o.includes(0);return M.jsxs("div",{className:we(["react-flow__pane",{draggable:I,dragging:k,selection:t}]),onClick:E?void 0:Wd(q,R),onContextMenu:Wd(Y,R),onWheel:Wd(K,R),onPointerEnter:E?void 0:m,onPointerMove:E?H:y,onPointerUp:E?j:void 0,onPointerDownCapture:E?B:void 0,onClickCapture:E?W:void 0,onPointerLeave:b,ref:R,style:vc,children:[x,M.jsx(tD,{})]})}function Jd({id:t,store:e,unselect:n=!1,nodeRef:o}){const{addSelectedNodes:s,unselectNodesAndEdges:a,multiSelectionActive:l,nodeLookup:u,onError:d}=e.getState(),h=u.get(t);if(!h){d?.("012",Kn.error012(t));return}e.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&l)&&(a({nodes:[h],edges:[]}),requestAnimationFrame(()=>o?.current?.blur())):s([t])}function vb({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:o,nodeId:s,isSelectable:a,nodeClickDistance:l}){const u=ae(),[d,h]=N.useState(!1),p=N.useRef();return N.useEffect(()=>{p.current=UO({getStoreItems:()=>u.getState(),onNodeMouseDown:m=>{Jd({id:m,store:u,nodeRef:t})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),N.useEffect(()=>{if(!(e||!t.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:o,domNode:t.current,isSelectable:a,nodeId:s,nodeClickDistance:l}),()=>{p.current?.destroy()}},[n,o,e,a,t,s,l]),d}const iD=t=>e=>e.selected&&(e.draggable||t&&typeof e.draggable>"u");function bb(){const t=ae();return N.useCallback(n=>{const{nodeExtent:o,snapToGrid:s,snapGrid:a,nodesDraggable:l,onError:u,updateNodePositions:d,nodeLookup:h,nodeOrigin:p}=t.getState(),m=new Map,y=iD(l),b=s?a[0]:5,x=s?a[1]:5,w=n.direction.x*b*n.factor,_=n.direction.y*x*n.factor;for(const[,S]of h){if(!y(S))continue;let k={x:S.internals.positionAbsolute.x+w,y:S.internals.positionAbsolute.y+_};s&&(k=sa(k,a));const{position:C,positionAbsolute:E}=av({nodeId:S.id,nextPosition:k,nodeLookup:h,nodeExtent:o,nodeOrigin:p,onError:u});S.position=C,S.internals.positionAbsolute=E,m.set(S.id,S)}d(m)},[])}const th=N.createContext(null),oD=th.Provider;th.Consumer;const xb=()=>N.useContext(th),rD=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),sD=(t,e,n)=>o=>{const{connectionClickStartHandle:s,connectionMode:a,connection:l}=o,{fromHandle:u,toHandle:d,isValid:h}=l,p=d?.nodeId===t&&d?.id===e&&d?.type===n;return{connectingFrom:u?.nodeId===t&&u?.id===e&&u?.type===n,connectingTo:p,clickConnecting:s?.nodeId===t&&s?.id===e&&s?.type===n,isPossibleEndHandle:a===Tr.Strict?u?.type!==n:t!==u?.nodeId||e!==u?.id,connectionInProcess:!!u,clickConnectionInProcess:!!s,valid:p&&h}};function aD({type:t="source",position:e=Nt.Top,isValidConnection:n,isConnectable:o=!0,isConnectableStart:s=!0,isConnectableEnd:a=!0,id:l,onConnect:u,children:d,className:h,onMouseDown:p,onTouchStart:m,...y},b){const x=l||null,w=t==="target",_=ae(),S=xb(),{connectOnClick:k,noPanClassName:C,rfId:E}=Gt(rD,fe),{connectingFrom:R,connectingTo:A,clickConnecting:O,isPossibleEndHandle:D,connectionInProcess:U,clickConnectionInProcess:q,valid:Y}=Gt(sD(S,x,t),fe);S||_.getState().onError?.("010",Kn.error010());const K=H=>{const{defaultEdgeOptions:j,onConnect:I,hasDefaultEdges:z}=_.getState(),$={...j,...H};if(z){const{edges:G,setEdges:L}=_.getState();L(TO($,G))}I?.($),u?.($)},W=H=>{if(!S)return;const j=vv(H.nativeEvent);if(s&&(j&&H.button===0||!j)){const I=_.getState();Yd.onPointerDown(H.nativeEvent,{handleDomNode:H.currentTarget,autoPanOnConnect:I.autoPanOnConnect,connectionMode:I.connectionMode,connectionRadius:I.connectionRadius,domNode:I.domNode,nodeLookup:I.nodeLookup,lib:I.lib,isTarget:w,handleId:x,nodeId:S,flowId:I.rfId,panBy:I.panBy,cancelConnection:I.cancelConnection,onConnectStart:I.onConnectStart,onConnectEnd:(...z)=>_.getState().onConnectEnd?.(...z),updateConnection:I.updateConnection,onConnect:K,isValidConnection:n||((...z)=>_.getState().isValidConnection?.(...z)??!0),getTransform:()=>_.getState().transform,getFromHandle:()=>_.getState().connection.fromHandle,autoPanSpeed:I.autoPanSpeed,dragThreshold:I.connectionDragThreshold})}j?p?.(H):m?.(H)},B=H=>{const{onClickConnectStart:j,onClickConnectEnd:I,connectionClickStartHandle:z,connectionMode:$,isValidConnection:G,lib:L,rfId:F,nodeLookup:et,connection:rt}=_.getState();if(!S||!z&&!s)return;if(!z){j?.(H.nativeEvent,{nodeId:S,handleId:x,handleType:t}),_.setState({connectionClickStartHandle:{nodeId:S,type:t,id:x}});return}const ct=gv(H.target),ht=n||G,{connection:ft,isValid:ut}=Yd.isValid(H.nativeEvent,{handle:{nodeId:S,id:x,type:t},connectionMode:$,fromNodeId:z.nodeId,fromHandleId:z.id||null,fromType:z.type,isValidConnection:ht,flowId:F,doc:ct,lib:L,nodeLookup:et});ut&&ft&&K(ft);const dt=structuredClone(rt);delete dt.inProgress,dt.toPosition=dt.toHandle?dt.toHandle.position:null,I?.(H,dt),_.setState({connectionClickStartHandle:null})};return M.jsx("div",{"data-handleid":x,"data-nodeid":S,"data-handlepos":e,"data-id":`${E}-${S}-${x}-${t}`,className:we(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",C,h,{source:!w,target:w,connectable:o,connectablestart:s,connectableend:a,clickconnecting:O,connectingfrom:R,connectingto:A,valid:Y,connectionindicator:o&&(!U||D)&&(U||q?a:s)}]),onMouseDown:W,onTouchStart:W,onClick:k?B:void 0,ref:b,...y,children:d})}const jr=N.memo(pb(aD));function lD({data:t,isConnectable:e,sourcePosition:n=Nt.Bottom}){return M.jsxs(M.Fragment,{children:[t?.label,M.jsx(jr,{type:"source",position:n,isConnectable:e})]})}function cD({data:t,isConnectable:e,targetPosition:n=Nt.Top,sourcePosition:o=Nt.Bottom}){return M.jsxs(M.Fragment,{children:[M.jsx(jr,{type:"target",position:n,isConnectable:e}),t?.label,M.jsx(jr,{type:"source",position:o,isConnectable:e})]})}function uD(){return null}function fD({data:t,isConnectable:e,targetPosition:n=Nt.Top}){return M.jsxs(M.Fragment,{children:[M.jsx(jr,{type:"target",position:n,isConnectable:e}),t?.label]})}const bc={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},wb={input:lD,default:cD,output:fD,group:uD};function dD(t){return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??t.style?.width,height:t.height??t.initialHeight??t.style?.height}:{width:t.width??t.style?.width,height:t.height??t.style?.height}}const hD=t=>{const{width:e,height:n,x:o,y:s}=oa(t.nodeLookup,{filter:a=>!!a.selected});return{width:On(e)?e:null,height:On(n)?n:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${o}px,${s}px)`}};function pD({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const o=ae(),{width:s,height:a,transformString:l,userSelectionActive:u}=Gt(hD,fe),d=bb(),h=N.useRef(null);N.useEffect(()=>{n||h.current?.focus({preventScroll:!0})},[n]);const p=!u&&s!==null&&a!==null;if(vb({nodeRef:h,disabled:!p}),!p)return null;const m=t?b=>{const x=o.getState().nodes.filter(w=>w.selected);t(b,x)}:void 0,y=b=>{Object.prototype.hasOwnProperty.call(bc,b.key)&&(b.preventDefault(),d({direction:bc[b.key],factor:b.shiftKey?4:1}))};return M.jsx("div",{className:we(["react-flow__nodesselection","react-flow__container",e]),style:{transform:l},children:M.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:m,tabIndex:n?void 0:-1,onKeyDown:n?void 0:y,style:{width:s,height:a}})})}const _b=typeof window<"u"?window:void 0,mD=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function Sb({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:l,paneClickDistance:u,deleteKeyCode:d,selectionKeyCode:h,selectionOnDrag:p,selectionMode:m,onSelectionStart:y,onSelectionEnd:b,multiSelectionKeyCode:x,panActivationKeyCode:w,zoomActivationKeyCode:_,elementsSelectable:S,zoomOnScroll:k,zoomOnPinch:C,panOnScroll:E,panOnScrollSpeed:R,panOnScrollMode:A,zoomOnDoubleClick:O,panOnDrag:D,defaultViewport:U,translateExtent:q,minZoom:Y,maxZoom:K,preventScrolling:W,onSelectionContextMenu:B,noWheelClassName:H,noPanClassName:j,disableKeyboardA11y:I,onViewportChange:z,isControlledViewport:$}){const{nodesSelectionActive:G,userSelectionActive:L}=Gt(mD,fe),F=fa(h,{target:_b}),et=fa(w,{target:_b}),rt=et||D,ct=et||E,ht=p&&rt!==!0,ft=F||L||ht;return Z5({deleteKeyCode:d,multiSelectionKeyCode:x}),M.jsx(W5,{onPaneContextMenu:a,elementsSelectable:S,zoomOnScroll:k,zoomOnPinch:C,panOnScroll:ct,panOnScrollSpeed:R,panOnScrollMode:A,zoomOnDoubleClick:O,panOnDrag:!F&&rt,defaultViewport:U,translateExtent:q,minZoom:Y,maxZoom:K,zoomActivationKeyCode:_,preventScrolling:W,noWheelClassName:H,noPanClassName:j,onViewportChange:z,isControlledViewport:$,paneClickDistance:u,selectionOnDrag:ht,children:M.jsxs(nD,{onSelectionStart:y,onSelectionEnd:b,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:o,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:l,panOnDrag:rt,isSelecting:!!ft,selectionMode:m,selectionKeyPressed:F,paneClickDistance:u,selectionOnDrag:ht,children:[t,G&&M.jsx(pD,{onSelectionContextMenu:B,noPanClassName:j,disableKeyboardA11y:I})]})})}Sb.displayName="FlowRenderer";const gD=N.memo(Sb),yD=t=>e=>t?kd(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(n=>n.id):Array.from(e.nodeLookup.keys());function vD(t){return Gt(N.useCallback(yD(t),[t]),fe)}const bD=t=>t.updateNodeInternals;function xD(){const t=Gt(bD),[e]=N.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const o=new Map;n.forEach(s=>{const a=s.target.getAttribute("data-id");o.set(a,{id:a,nodeElement:s.target,force:!0})}),t(o)}));return N.useEffect(()=>()=>{e?.disconnect()},[e]),e}function wD({node:t,nodeType:e,hasDimensions:n,resizeObserver:o}){const s=ae(),a=N.useRef(null),l=N.useRef(null),u=N.useRef(t.sourcePosition),d=N.useRef(t.targetPosition),h=N.useRef(e),p=n&&!!t.internals.handleBounds;return N.useEffect(()=>{a.current&&!t.hidden&&(!p||l.current!==a.current)&&(l.current&&o?.unobserve(l.current),o?.observe(a.current),l.current=a.current)},[p,t.hidden]),N.useEffect(()=>()=>{l.current&&(o?.unobserve(l.current),l.current=null)},[]),N.useEffect(()=>{if(a.current){const m=h.current!==e,y=u.current!==t.sourcePosition,b=d.current!==t.targetPosition;(m||y||b)&&(h.current=e,u.current=t.sourcePosition,d.current=t.targetPosition,s.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:a.current,force:!0}]])))}},[t.id,e,t.sourcePosition,t.targetPosition]),a}function _D({id:t,onClick:e,onMouseEnter:n,onMouseMove:o,onMouseLeave:s,onContextMenu:a,onDoubleClick:l,nodesDraggable:u,elementsSelectable:d,nodesConnectable:h,nodesFocusable:p,resizeObserver:m,noDragClassName:y,noPanClassName:b,disableKeyboardA11y:x,rfId:w,nodeTypes:_,nodeClickDistance:S,onError:k}){const{node:C,internals:E,isParent:R}=Gt(ut=>{const dt=ut.nodeLookup.get(t),Ot=ut.parentLookup.has(t);return{node:dt,internals:dt.internals,isParent:Ot}},fe);let A=C.type||"default",O=_?.[A]||wb[A];O===void 0&&(k?.("003",Kn.error003(A)),A="default",O=_?.default||wb.default);const D=!!(C.draggable||u&&typeof C.draggable>"u"),U=!!(C.selectable||d&&typeof C.selectable>"u"),q=!!(C.connectable||h&&typeof C.connectable>"u"),Y=!!(C.focusable||p&&typeof C.focusable>"u"),K=ae(),W=hv(C),B=wD({node:C,nodeType:A,hasDimensions:W,resizeObserver:m}),H=vb({nodeRef:B,disabled:C.hidden||!D,noDragClassName:y,handleSelector:C.dragHandle,nodeId:t,isSelectable:U,nodeClickDistance:S}),j=bb();if(C.hidden)return null;const I=hi(C),z=dD(C),$=U||D||e||n||o||s,G=n?ut=>n(ut,{...E.userNode}):void 0,L=o?ut=>o(ut,{...E.userNode}):void 0,F=s?ut=>s(ut,{...E.userNode}):void 0,et=a?ut=>a(ut,{...E.userNode}):void 0,rt=l?ut=>l(ut,{...E.userNode}):void 0,ct=ut=>{const{selectNodesOnDrag:dt,nodeDragThreshold:Ot}=K.getState();U&&(!dt||!D||Ot>0)&&Jd({id:t,store:K,nodeRef:B}),e&&e(ut,{...E.userNode})},ht=ut=>{if(!(yv(ut.nativeEvent)||x)){if(ev.includes(ut.key)&&U){const dt=ut.key==="Escape";Jd({id:t,store:K,unselect:dt,nodeRef:B})}else if(D&&C.selected&&Object.prototype.hasOwnProperty.call(bc,ut.key)){ut.preventDefault();const{ariaLabelConfig:dt}=K.getState();K.setState({ariaLiveMessage:dt["node.a11yDescription.ariaLiveMessage"]({direction:ut.key.replace("Arrow","").toLowerCase(),x:~~E.positionAbsolute.x,y:~~E.positionAbsolute.y})}),j({direction:bc[ut.key],factor:ut.shiftKey?4:1})}}},ft=()=>{if(x||!B.current?.matches(":focus-visible"))return;const{transform:ut,width:dt,height:Ot,autoPanOnNodeFocus:At,setCenter:bt}=K.getState();if(!At)return;kd(new Map([[t,C]]),{x:0,y:0,width:dt,height:Ot},ut,!0).length>0||bt(C.position.x+I.width/2,C.position.y+I.height/2,{zoom:ut[2]})};return M.jsx("div",{className:we(["react-flow__node",`react-flow__node-${A}`,{[b]:D},C.className,{selected:C.selected,selectable:U,parent:R,draggable:D,dragging:H}]),ref:B,style:{zIndex:E.z,transform:`translate(${E.positionAbsolute.x}px,${E.positionAbsolute.y}px)`,pointerEvents:$?"all":"none",visibility:W?"visible":"hidden",...C.style,...z},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:G,onMouseMove:L,onMouseLeave:F,onContextMenu:et,onClick:ct,onDoubleClick:rt,onKeyDown:Y?ht:void 0,tabIndex:Y?0:void 0,onFocus:Y?ft:void 0,role:C.ariaRole??(Y?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${tb}-${w}`,"aria-label":C.ariaLabel,...C.domAttributes,children:M.jsx(oD,{value:t,children:M.jsx(O,{id:t,data:C.data,type:A,positionAbsoluteX:E.positionAbsolute.x,positionAbsoluteY:E.positionAbsolute.y,selected:C.selected??!1,selectable:U,draggable:D,deletable:C.deletable??!0,isConnectable:q,sourcePosition:C.sourcePosition,targetPosition:C.targetPosition,dragging:H,dragHandle:C.dragHandle,zIndex:E.z,parentId:C.parentId,...I})})})}var SD=N.memo(_D);const ED=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function Eb(t){const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:s,onError:a}=Gt(ED,fe),l=vD(t.onlyRenderVisibleElements),u=xD();return M.jsx("div",{className:"react-flow__nodes",style:vc,children:l.map(d=>M.jsx(SD,{id:d,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:u,nodesDraggable:e,nodesConnectable:n,nodesFocusable:o,elementsSelectable:s,nodeClickDistance:t.nodeClickDistance,onError:a},d))})}Eb.displayName="NodeRenderer";const CD=N.memo(Eb);function TD(t){return Gt(N.useCallback(n=>{if(!t)return n.edges.map(s=>s.id);const o=[];if(n.width&&n.height)for(const s of n.edges){const a=n.nodeLookup.get(s.source),l=n.nodeLookup.get(s.target);a&&l&&SO({sourceNode:a,targetNode:l,width:n.width,height:n.height,transform:n.transform})&&o.push(s.id)}return o},[t]),fe)}const ND=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t}};return M.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},AD=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t,fill:t}};return M.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Cb={[lc.Arrow]:ND,[lc.ArrowClosed]:AD};function MD(t){const e=ae();return N.useMemo(()=>Object.prototype.hasOwnProperty.call(Cb,t)?Cb[t]:(e.getState().onError?.("009",Kn.error009(t)),null),[t])}const RD=({id:t,type:e,color:n,width:o=12.5,height:s=12.5,markerUnits:a="strokeWidth",strokeWidth:l,orient:u="auto-start-reverse"})=>{const d=MD(e);return d?M.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${o}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:u,refX:"0",refY:"0",children:M.jsx(d,{color:n,strokeWidth:l})}):null},Tb=({defaultColor:t,rfId:e})=>{const n=Gt(a=>a.edges),o=Gt(a=>a.defaultEdgeOptions),s=N.useMemo(()=>kO(n,{id:e,defaultColor:t,defaultMarkerStart:o?.markerStart,defaultMarkerEnd:o?.markerEnd}),[n,o,e,t]);return s.length?M.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:M.jsx("defs",{children:s.map(a=>M.jsx(RD,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};Tb.displayName="MarkerDefinitions";var kD=N.memo(Tb);function Nb({x:t,y:e,label:n,labelStyle:o,labelShowBg:s=!0,labelBgStyle:a,labelBgPadding:l=[2,4],labelBgBorderRadius:u=2,children:d,className:h,...p}){const[m,y]=N.useState({x:1,y:0,width:0,height:0}),b=we(["react-flow__edge-textwrapper",h]),x=N.useRef(null);return N.useEffect(()=>{if(x.current){const w=x.current.getBBox();y({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?M.jsxs("g",{transform:`translate(${t-m.width/2} ${e-m.height/2})`,className:b,visibility:m.width?"visible":"hidden",...p,children:[s&&M.jsx("rect",{width:m.width+2*l[0],x:-l[0],y:-l[1],height:m.height+2*l[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),M.jsx("text",{className:"react-flow__edge-text",y:m.height/2,dy:"0.3em",ref:x,style:o,children:n}),d]}):null}Nb.displayName="EdgeText";const OD=N.memo(Nb);function xc({path:t,labelX:e,labelY:n,label:o,labelStyle:s,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d,interactionWidth:h=20,...p}){return M.jsxs(M.Fragment,{children:[M.jsx("path",{...p,d:t,fill:"none",className:we(["react-flow__edge-path",p.className])}),h?M.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,o&&On(e)&&On(n)?M.jsx(OD,{x:e,y:n,label:o,labelStyle:s,labelShowBg:a,labelBgStyle:l,labelBgPadding:u,labelBgBorderRadius:d}):null]})}function Ab({pos:t,x1:e,y1:n,x2:o,y2:s}){return t===Nt.Left||t===Nt.Right?[.5*(e+o),n]:[e,.5*(n+s)]}function Mb({sourceX:t,sourceY:e,sourcePosition:n=Nt.Bottom,targetX:o,targetY:s,targetPosition:a=Nt.Top}){const[l,u]=Ab({pos:n,x1:t,y1:e,x2:o,y2:s}),[d,h]=Ab({pos:a,x1:o,y1:s,x2:t,y2:e}),[p,m,y,b]=xv({sourceX:t,sourceY:e,targetX:o,targetY:s,sourceControlX:l,sourceControlY:u,targetControlX:d,targetControlY:h});return[`M${t},${e} C${l},${u} ${d},${h} ${o},${s}`,p,m,y,b]}function Rb(t){return N.memo(({id:e,sourceX:n,sourceY:o,targetX:s,targetY:a,sourcePosition:l,targetPosition:u,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:_,interactionWidth:S})=>{const[k,C,E]=Mb({sourceX:n,sourceY:o,sourcePosition:l,targetX:s,targetY:a,targetPosition:u}),R=t.isInternal?void 0:e;return M.jsx(xc,{id:R,path:k,labelX:C,labelY:E,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:_,interactionWidth:S})})}const DD=Rb({isInternal:!1}),kb=Rb({isInternal:!0});DD.displayName="SimpleBezierEdge",kb.displayName="SimpleBezierEdgeInternal";function Ob(t){return N.memo(({id:e,sourceX:n,sourceY:o,targetX:s,targetY:a,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,sourcePosition:b=Nt.Bottom,targetPosition:x=Nt.Top,markerEnd:w,markerStart:_,pathOptions:S,interactionWidth:k})=>{const[C,E,R]=zd({sourceX:n,sourceY:o,sourcePosition:b,targetX:s,targetY:a,targetPosition:x,borderRadius:S?.borderRadius,offset:S?.offset,stepPosition:S?.stepPosition}),A=t.isInternal?void 0:e;return M.jsx(xc,{id:A,path:C,labelX:E,labelY:R,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:_,interactionWidth:k})})}const eh=Ob({isInternal:!1}),Db=Ob({isInternal:!0});eh.displayName="SmoothStepEdge",Db.displayName="SmoothStepEdgeInternal";function jb(t){return N.memo(({id:e,...n})=>{const o=t.isInternal?void 0:e;return M.jsx(eh,{...n,id:o,pathOptions:N.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const jD=jb({isInternal:!1}),zb=jb({isInternal:!0});jD.displayName="StepEdge",zb.displayName="StepEdgeInternal";function Vb(t){return N.memo(({id:e,sourceX:n,sourceY:o,targetX:s,targetY:a,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:x,interactionWidth:w})=>{const[_,S,k]=Ev({sourceX:n,sourceY:o,targetX:s,targetY:a}),C=t.isInternal?void 0:e;return M.jsx(xc,{id:C,path:_,labelX:S,labelY:k,label:l,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:x,interactionWidth:w})})}const zD=Vb({isInternal:!1}),Lb=Vb({isInternal:!0});zD.displayName="StraightEdge",Lb.displayName="StraightEdgeInternal";function Ib(t){return N.memo(({id:e,sourceX:n,sourceY:o,targetX:s,targetY:a,sourcePosition:l=Nt.Bottom,targetPosition:u=Nt.Top,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:_,pathOptions:S,interactionWidth:k})=>{const[C,E,R]=_v({sourceX:n,sourceY:o,sourcePosition:l,targetX:s,targetY:a,targetPosition:u,curvature:S?.curvature}),A=t.isInternal?void 0:e;return M.jsx(xc,{id:A,path:C,labelX:E,labelY:R,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:_,interactionWidth:k})})}const VD=Ib({isInternal:!1}),Pb=Ib({isInternal:!0});VD.displayName="BezierEdge",Pb.displayName="BezierEdgeInternal";const Bb={default:Pb,straight:Lb,step:zb,smoothstep:Db,simplebezier:kb},Hb={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},LD=(t,e,n)=>n===Nt.Left?t-e:n===Nt.Right?t+e:t,ID=(t,e,n)=>n===Nt.Top?t-e:n===Nt.Bottom?t+e:t,Ub="react-flow__edgeupdater";function $b({position:t,centerX:e,centerY:n,radius:o=10,onMouseDown:s,onMouseEnter:a,onMouseOut:l,type:u}){return M.jsx("circle",{onMouseDown:s,onMouseEnter:a,onMouseOut:l,className:we([Ub,`${Ub}-${u}`]),cx:LD(e,o,t),cy:ID(n,o,t),r:o,stroke:"transparent",fill:"transparent"})}function PD({isReconnectable:t,reconnectRadius:e,edge:n,sourceX:o,sourceY:s,targetX:a,targetY:l,sourcePosition:u,targetPosition:d,onReconnect:h,onReconnectStart:p,onReconnectEnd:m,setReconnecting:y,setUpdateHover:b}){const x=ae(),w=(E,R)=>{if(E.button!==0)return;const{autoPanOnConnect:A,domNode:O,connectionMode:D,connectionRadius:U,lib:q,onConnectStart:Y,cancelConnection:K,nodeLookup:W,rfId:B,panBy:H,updateConnection:j}=x.getState(),I=R.type==="target",z=(L,F)=>{y(!1),m?.(L,n,R.type,F)},$=L=>h?.(n,L),G=(L,F)=>{y(!0),p?.(E,n,R.type),Y?.(L,F)};Yd.onPointerDown(E.nativeEvent,{autoPanOnConnect:A,connectionMode:D,connectionRadius:U,domNode:O,handleId:R.id,nodeId:R.nodeId,nodeLookup:W,isTarget:I,edgeUpdaterType:R.type,lib:q,flowId:B,cancelConnection:K,panBy:H,isValidConnection:(...L)=>x.getState().isValidConnection?.(...L)??!0,onConnect:$,onConnectStart:G,onConnectEnd:(...L)=>x.getState().onConnectEnd?.(...L),onReconnectEnd:z,updateConnection:j,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,dragThreshold:x.getState().connectionDragThreshold,handleDomNode:E.currentTarget})},_=E=>w(E,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),S=E=>w(E,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),k=()=>b(!0),C=()=>b(!1);return M.jsxs(M.Fragment,{children:[(t===!0||t==="source")&&M.jsx($b,{position:u,centerX:o,centerY:s,radius:e,onMouseDown:_,onMouseEnter:k,onMouseOut:C,type:"source"}),(t===!0||t==="target")&&M.jsx($b,{position:d,centerX:a,centerY:l,radius:e,onMouseDown:S,onMouseEnter:k,onMouseOut:C,type:"target"})]})}function BD({id:t,edgesFocusable:e,edgesReconnectable:n,elementsSelectable:o,onClick:s,onDoubleClick:a,onContextMenu:l,onMouseEnter:u,onMouseMove:d,onMouseLeave:h,reconnectRadius:p,onReconnect:m,onReconnectStart:y,onReconnectEnd:b,rfId:x,edgeTypes:w,noPanClassName:_,onError:S,disableKeyboardA11y:k}){let C=Gt(bt=>bt.edgeLookup.get(t));const E=Gt(bt=>bt.defaultEdgeOptions);C=E?{...E,...C}:C;let R=C.type||"default",A=w?.[R]||Bb[R];A===void 0&&(S?.("011",Kn.error011(R)),R="default",A=w?.default||Bb.default);const O=!!(C.focusable||e&&typeof C.focusable>"u"),D=typeof m<"u"&&(C.reconnectable||n&&typeof C.reconnectable>"u"),U=!!(C.selectable||o&&typeof C.selectable>"u"),q=N.useRef(null),[Y,K]=N.useState(!1),[W,B]=N.useState(!1),H=ae(),{zIndex:j,sourceX:I,sourceY:z,targetX:$,targetY:G,sourcePosition:L,targetPosition:F}=Gt(N.useCallback(bt=>{const Tt=bt.nodeLookup.get(C.source),Dt=bt.nodeLookup.get(C.target);if(!Tt||!Dt)return{zIndex:C.zIndex,...Hb};const Xt=RO({id:t,sourceNode:Tt,targetNode:Dt,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:bt.connectionMode,onError:S});return{zIndex:_O({selected:C.selected,zIndex:C.zIndex,sourceNode:Tt,targetNode:Dt,elevateOnSelect:bt.elevateEdgesOnSelect,zIndexMode:bt.zIndexMode}),...Xt||Hb}},[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),fe),et=N.useMemo(()=>C.markerStart?`url('#${Vd(C.markerStart,x)}')`:void 0,[C.markerStart,x]),rt=N.useMemo(()=>C.markerEnd?`url('#${Vd(C.markerEnd,x)}')`:void 0,[C.markerEnd,x]);if(C.hidden||I===null||z===null||$===null||G===null)return null;const ct=bt=>{const{addSelectedEdges:Tt,unselectNodesAndEdges:Dt,multiSelectionActive:Xt}=H.getState();U&&(H.setState({nodesSelectionActive:!1}),C.selected&&Xt?(Dt({nodes:[],edges:[C]}),q.current?.blur()):Tt([t])),s&&s(bt,C)},ht=a?bt=>{a(bt,{...C})}:void 0,ft=l?bt=>{l(bt,{...C})}:void 0,ut=u?bt=>{u(bt,{...C})}:void 0,dt=d?bt=>{d(bt,{...C})}:void 0,Ot=h?bt=>{h(bt,{...C})}:void 0,At=bt=>{if(!k&&ev.includes(bt.key)&&U){const{unselectNodesAndEdges:Tt,addSelectedEdges:Dt}=H.getState();bt.key==="Escape"?(q.current?.blur(),Tt({edges:[C]})):Dt([t])}};return M.jsx("svg",{style:{zIndex:j},children:M.jsxs("g",{className:we(["react-flow__edge",`react-flow__edge-${R}`,C.className,_,{selected:C.selected,animated:C.animated,inactive:!U&&!s,updating:Y,selectable:U}]),onClick:ct,onDoubleClick:ht,onContextMenu:ft,onMouseEnter:ut,onMouseMove:dt,onMouseLeave:Ot,onKeyDown:O?At:void 0,tabIndex:O?0:void 0,role:C.ariaRole??(O?"group":"img"),"aria-roledescription":"edge","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":C.ariaLabel===null?void 0:C.ariaLabel||`Edge from ${C.source} to ${C.target}`,"aria-describedby":O?`${eb}-${x}`:void 0,ref:q,...C.domAttributes,children:[!W&&M.jsx(A,{id:t,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,selectable:U,deletable:C.deletable??!0,label:C.label,labelStyle:C.labelStyle,labelShowBg:C.labelShowBg,labelBgStyle:C.labelBgStyle,labelBgPadding:C.labelBgPadding,labelBgBorderRadius:C.labelBgBorderRadius,sourceX:I,sourceY:z,targetX:$,targetY:G,sourcePosition:L,targetPosition:F,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:et,markerEnd:rt,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),D&&M.jsx(PD,{edge:C,isReconnectable:D,reconnectRadius:p,onReconnect:m,onReconnectStart:y,onReconnectEnd:b,sourceX:I,sourceY:z,targetX:$,targetY:G,sourcePosition:L,targetPosition:F,setUpdateHover:K,setReconnecting:B})]})})}var HD=N.memo(BD);const UD=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function Yb({defaultMarkerColor:t,onlyRenderVisibleElements:e,rfId:n,edgeTypes:o,noPanClassName:s,onReconnect:a,onEdgeContextMenu:l,onEdgeMouseEnter:u,onEdgeMouseMove:d,onEdgeMouseLeave:h,onEdgeClick:p,reconnectRadius:m,onEdgeDoubleClick:y,onReconnectStart:b,onReconnectEnd:x,disableKeyboardA11y:w}){const{edgesFocusable:_,edgesReconnectable:S,elementsSelectable:k,onError:C}=Gt(UD,fe),E=TD(e);return M.jsxs("div",{className:"react-flow__edges",children:[M.jsx(kD,{defaultColor:t,rfId:n}),E.map(R=>M.jsx(HD,{id:R,edgesFocusable:_,edgesReconnectable:S,elementsSelectable:k,noPanClassName:s,onReconnect:a,onContextMenu:l,onMouseEnter:u,onMouseMove:d,onMouseLeave:h,onClick:p,reconnectRadius:m,onDoubleClick:y,onReconnectStart:b,onReconnectEnd:x,rfId:n,onError:C,edgeTypes:o,disableKeyboardA11y:w},R))]})}Yb.displayName="EdgeRenderer";const $D=N.memo(Yb),YD=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function qD({children:t}){const e=Gt(YD);return M.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:e},children:t})}function GD(t){const e=da(),n=N.useRef(!1);N.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const FD=t=>t.panZoom?.syncViewport;function XD(t){const e=Gt(FD),n=ae();return N.useEffect(()=>{t&&(e?.(t),n.setState({transform:[t.x,t.y,t.zoom]}))},[t,e]),null}function ZD(t){return t.connection.inProgress?{...t.connection,to:aa(t.connection.to,t.transform)}:{...t.connection}}function KD(t){return ZD}function QD(t){const e=KD();return Gt(e,fe)}const WD=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function JD({containerStyle:t,style:e,type:n,component:o}){const{nodesConnectable:s,width:a,height:l,isValid:u,inProgress:d}=Gt(WD,fe);return!(a&&s&&d)?null:M.jsx("svg",{style:t,width:a,height:l,className:"react-flow__connectionline react-flow__container",children:M.jsx("g",{className:we(["react-flow__connection",rv(u)]),children:M.jsx(qb,{style:e,type:n,CustomComponent:o,isValid:u})})})}const qb=({style:t,type:e=Hi.Bezier,CustomComponent:n,isValid:o})=>{const{inProgress:s,from:a,fromNode:l,fromHandle:u,fromPosition:d,to:h,toNode:p,toHandle:m,toPosition:y,pointer:b}=QD();if(!s)return;if(n)return M.jsx(n,{connectionLineType:e,connectionLineStyle:t,fromNode:l,fromHandle:u,fromX:a.x,fromY:a.y,toX:h.x,toY:h.y,fromPosition:d,toPosition:y,connectionStatus:rv(o),toNode:p,toHandle:m,pointer:b});let x="";const w={sourceX:a.x,sourceY:a.y,sourcePosition:d,targetX:h.x,targetY:h.y,targetPosition:y};switch(e){case Hi.Bezier:[x]=_v(w);break;case Hi.SimpleBezier:[x]=Mb(w);break;case Hi.Step:[x]=zd({...w,borderRadius:0});break;case Hi.SmoothStep:[x]=zd(w);break;default:[x]=Ev(w)}return M.jsx("path",{d:x,fill:"none",className:"react-flow__connection-path",style:t})};qb.displayName="ConnectionLine";const tj={};function Gb(t=tj){N.useRef(t),ae(),N.useEffect(()=>{},[t])}function ej(){ae(),N.useRef(!1),N.useEffect(()=>{},[])}function Fb({nodeTypes:t,edgeTypes:e,onInit:n,onNodeClick:o,onEdgeClick:s,onNodeDoubleClick:a,onEdgeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:p,onSelectionContextMenu:m,onSelectionStart:y,onSelectionEnd:b,connectionLineType:x,connectionLineStyle:w,connectionLineComponent:_,connectionLineContainerStyle:S,selectionKeyCode:k,selectionOnDrag:C,selectionMode:E,multiSelectionKeyCode:R,panActivationKeyCode:A,zoomActivationKeyCode:O,deleteKeyCode:D,onlyRenderVisibleElements:U,elementsSelectable:q,defaultViewport:Y,translateExtent:K,minZoom:W,maxZoom:B,preventScrolling:H,defaultMarkerColor:j,zoomOnScroll:I,zoomOnPinch:z,panOnScroll:$,panOnScrollSpeed:G,panOnScrollMode:L,zoomOnDoubleClick:F,panOnDrag:et,onPaneClick:rt,onPaneMouseEnter:ct,onPaneMouseMove:ht,onPaneMouseLeave:ft,onPaneScroll:ut,onPaneContextMenu:dt,paneClickDistance:Ot,nodeClickDistance:At,onEdgeContextMenu:bt,onEdgeMouseEnter:Tt,onEdgeMouseMove:Dt,onEdgeMouseLeave:Xt,reconnectRadius:Ft,onReconnect:pt,onReconnectStart:yt,onReconnectEnd:vt,noDragClassName:mt,noWheelClassName:Ct,noPanClassName:It,disableKeyboardA11y:zt,nodeExtent:Vt,rfId:ve,viewport:Wt,onViewportChange:je}){return Gb(t),Gb(e),ej(),GD(n),XD(Wt),M.jsx(gD,{onPaneClick:rt,onPaneMouseEnter:ct,onPaneMouseMove:ht,onPaneMouseLeave:ft,onPaneContextMenu:dt,onPaneScroll:ut,paneClickDistance:Ot,deleteKeyCode:D,selectionKeyCode:k,selectionOnDrag:C,selectionMode:E,onSelectionStart:y,onSelectionEnd:b,multiSelectionKeyCode:R,panActivationKeyCode:A,zoomActivationKeyCode:O,elementsSelectable:q,zoomOnScroll:I,zoomOnPinch:z,zoomOnDoubleClick:F,panOnScroll:$,panOnScrollSpeed:G,panOnScrollMode:L,panOnDrag:et,defaultViewport:Y,translateExtent:K,minZoom:W,maxZoom:B,onSelectionContextMenu:m,preventScrolling:H,noDragClassName:mt,noWheelClassName:Ct,noPanClassName:It,disableKeyboardA11y:zt,onViewportChange:je,isControlledViewport:!!Wt,children:M.jsxs(qD,{children:[M.jsx($D,{edgeTypes:e,onEdgeClick:s,onEdgeDoubleClick:l,onReconnect:pt,onReconnectStart:yt,onReconnectEnd:vt,onlyRenderVisibleElements:U,onEdgeContextMenu:bt,onEdgeMouseEnter:Tt,onEdgeMouseMove:Dt,onEdgeMouseLeave:Xt,reconnectRadius:Ft,defaultMarkerColor:j,noPanClassName:It,disableKeyboardA11y:zt,rfId:ve}),M.jsx(JD,{style:w,type:x,component:_,containerStyle:S}),M.jsx("div",{className:"react-flow__edgelabel-renderer"}),M.jsx(CD,{nodeTypes:t,onNodeClick:o,onNodeDoubleClick:a,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:p,nodeClickDistance:At,onlyRenderVisibleElements:U,noPanClassName:It,noDragClassName:mt,disableKeyboardA11y:zt,nodeExtent:Vt,rfId:ve}),M.jsx("div",{className:"react-flow__viewport-portal"})]})})}Fb.displayName="GraphView";const nj=N.memo(Fb),Xb=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,width:s,height:a,fitView:l,fitViewOptions:u,minZoom:d=.5,maxZoom:h=2,nodeOrigin:p,nodeExtent:m,zIndexMode:y="basic"}={})=>{const b=new Map,x=new Map,w=new Map,_=new Map,S=o??e??[],k=n??t??[],C=p??[0,0],E=m??ea;Dv(w,_,S);const R=Bd(k,b,x,{nodeOrigin:C,nodeExtent:E,zIndexMode:y});let A=[0,0,1];if(l&&s&&a){const O=oa(b,{filter:Y=>!!((Y.width||Y.initialWidth)&&(Y.height||Y.initialHeight))}),{x:D,y:U,zoom:q}=Dd(O,s,a,d,h,u?.padding??.1);A=[D,U,q]}return{rfId:"1",width:s??0,height:a??0,transform:A,nodes:k,nodesInitialized:R,nodeLookup:b,parentLookup:x,edges:S,edgeLookup:_,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:o!==void 0,panZoom:null,minZoom:d,maxZoom:h,translateExtent:ea,nodeExtent:E,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Tr.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:C,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:l??!1,fitViewOptions:u,fitViewResolver:null,connection:{...iv},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:gO,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:nv,zIndexMode:y,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},ij=({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,width:s,height:a,fitView:l,fitViewOptions:u,minZoom:d,maxZoom:h,nodeOrigin:p,nodeExtent:m,zIndexMode:y})=>x5((b,x)=>{async function w(){const{nodeLookup:_,panZoom:S,fitViewOptions:k,fitViewResolver:C,width:E,height:R,minZoom:A,maxZoom:O}=x();S&&(await pO({nodes:_,width:E,height:R,panZoom:S,minZoom:A,maxZoom:O},k),C?.resolve(!0),b({fitViewResolver:null}))}return{...Xb({nodes:t,edges:e,width:s,height:a,fitView:l,fitViewOptions:u,minZoom:d,maxZoom:h,nodeOrigin:p,nodeExtent:m,defaultNodes:n,defaultEdges:o,zIndexMode:y}),setNodes:_=>{const{nodeLookup:S,parentLookup:k,nodeOrigin:C,elevateNodesOnSelect:E,fitViewQueued:R,zIndexMode:A}=x(),O=Bd(_,S,k,{nodeOrigin:C,nodeExtent:m,elevateNodesOnSelect:E,checkEquality:!0,zIndexMode:A});R&&O?(w(),b({nodes:_,nodesInitialized:O,fitViewQueued:!1,fitViewOptions:void 0})):b({nodes:_,nodesInitialized:O})},setEdges:_=>{const{connectionLookup:S,edgeLookup:k}=x();Dv(S,k,_),b({edges:_})},setDefaultNodesAndEdges:(_,S)=>{if(_){const{setNodes:k}=x();k(_),b({hasDefaultNodes:!0})}if(S){const{setEdges:k}=x();k(S),b({hasDefaultEdges:!0})}},updateNodeInternals:_=>{const{triggerNodeChanges:S,nodeLookup:k,parentLookup:C,domNode:E,nodeOrigin:R,nodeExtent:A,debug:O,fitViewQueued:D,zIndexMode:U}=x(),{changes:q,updatedInternals:Y}=IO(_,k,C,E,R,A,U);Y&&(jO(k,C,{nodeOrigin:R,nodeExtent:A,zIndexMode:U}),D?(w(),b({fitViewQueued:!1,fitViewOptions:void 0})):b({}),q?.length>0&&(O&&console.log("React Flow: trigger node changes",q),S?.(q)))},updateNodePositions:(_,S=!1)=>{const k=[];let C=[];const{nodeLookup:E,triggerNodeChanges:R,connection:A,updateConnection:O,onNodesChangeMiddlewareMap:D}=x();for(const[U,q]of _){const Y=E.get(U),K=!!(Y?.expandParent&&Y?.parentId&&q?.position),W={id:U,type:"position",position:K?{x:Math.max(0,q.position.x),y:Math.max(0,q.position.y)}:q.position,dragging:S};if(Y&&A.inProgress&&A.fromNode.id===Y.id){const B=Ho(Y,A.fromHandle,Nt.Left,!0);O({...A,from:B})}K&&Y.parentId&&k.push({id:U,parentId:Y.parentId,rect:{...q.internals.positionAbsolute,width:q.measured.width??0,height:q.measured.height??0}}),C.push(W)}if(k.length>0){const{parentLookup:U,nodeOrigin:q}=x(),Y=Ud(k,E,U,q);C.push(...Y)}for(const U of D.values())C=U(C);R(C)},triggerNodeChanges:_=>{const{onNodesChange:S,setNodes:k,nodes:C,hasDefaultNodes:E,debug:R}=x();if(_?.length){if(E){const A=ub(_,C);k(A)}R&&console.log("React Flow: trigger node changes",_),S?.(_)}},triggerEdgeChanges:_=>{const{onEdgesChange:S,setEdges:k,edges:C,hasDefaultEdges:E,debug:R}=x();if(_?.length){if(E){const A=H5(_,C);k(A)}R&&console.log("React Flow: trigger edge changes",_),S?.(_)}},addSelectedNodes:_=>{const{multiSelectionActive:S,edgeLookup:k,nodeLookup:C,triggerNodeChanges:E,triggerEdgeChanges:R}=x();if(S){const A=_.map(O=>Uo(O,!0));E(A);return}E(Dr(C,new Set([..._]),!0)),R(Dr(k))},addSelectedEdges:_=>{const{multiSelectionActive:S,edgeLookup:k,nodeLookup:C,triggerNodeChanges:E,triggerEdgeChanges:R}=x();if(S){const A=_.map(O=>Uo(O,!0));R(A);return}R(Dr(k,new Set([..._]))),E(Dr(C,new Set,!0))},unselectNodesAndEdges:({nodes:_,edges:S}={})=>{const{edges:k,nodes:C,nodeLookup:E,triggerNodeChanges:R,triggerEdgeChanges:A}=x(),O=_||C,D=S||k,U=[];for(const Y of O){if(!Y.selected)continue;const K=E.get(Y.id);K&&(K.selected=!1),U.push(Uo(Y.id,!1))}const q=[];for(const Y of D)Y.selected&&q.push(Uo(Y.id,!1));R(U),A(q)},setMinZoom:_=>{const{panZoom:S,maxZoom:k}=x();S?.setScaleExtent([_,k]),b({minZoom:_})},setMaxZoom:_=>{const{panZoom:S,minZoom:k}=x();S?.setScaleExtent([k,_]),b({maxZoom:_})},setTranslateExtent:_=>{x().panZoom?.setTranslateExtent(_),b({translateExtent:_})},resetSelectedElements:()=>{const{edges:_,nodes:S,triggerNodeChanges:k,triggerEdgeChanges:C,elementsSelectable:E}=x();if(!E)return;const R=S.reduce((O,D)=>D.selected?[...O,Uo(D.id,!1)]:O,[]),A=_.reduce((O,D)=>D.selected?[...O,Uo(D.id,!1)]:O,[]);k(R),C(A)},setNodeExtent:_=>{const{nodes:S,nodeLookup:k,parentLookup:C,nodeOrigin:E,elevateNodesOnSelect:R,nodeExtent:A,zIndexMode:O}=x();_[0][0]===A[0][0]&&_[0][1]===A[0][1]&&_[1][0]===A[1][0]&&_[1][1]===A[1][1]||(Bd(S,k,C,{nodeOrigin:E,nodeExtent:_,elevateNodesOnSelect:R,checkEquality:!1,zIndexMode:O}),b({nodeExtent:_}))},panBy:_=>{const{transform:S,width:k,height:C,panZoom:E,translateExtent:R}=x();return PO({delta:_,panZoom:E,transform:S,translateExtent:R,width:k,height:C})},setCenter:async(_,S,k)=>{const{width:C,height:E,maxZoom:R,panZoom:A}=x();if(!A)return Promise.resolve(!1);const O=typeof k?.zoom<"u"?k.zoom:R;return await A.setViewport({x:C/2-_*O,y:E/2-S*O,zoom:O},{duration:k?.duration,ease:k?.ease,interpolate:k?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{b({connection:{...iv}})},updateConnection:_=>{b({connection:_})},reset:()=>b({...Xb()})}},Object.is);function Zb({initialNodes:t,initialEdges:e,defaultNodes:n,defaultEdges:o,initialWidth:s,initialHeight:a,initialMinZoom:l,initialMaxZoom:u,initialFitViewOptions:d,fitView:h,nodeOrigin:p,nodeExtent:m,zIndexMode:y,children:b}){const[x]=N.useState(()=>ij({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,width:s,height:a,fitView:h,minZoom:l,maxZoom:u,fitViewOptions:d,nodeOrigin:p,nodeExtent:m,zIndexMode:y}));return M.jsx(_5,{value:x,children:M.jsx(q5,{children:b})})}function oj({children:t,nodes:e,edges:n,defaultNodes:o,defaultEdges:s,width:a,height:l,fitView:u,fitViewOptions:d,minZoom:h,maxZoom:p,nodeOrigin:m,nodeExtent:y,zIndexMode:b}){return N.useContext(gc)?M.jsx(M.Fragment,{children:t}):M.jsx(Zb,{initialNodes:e,initialEdges:n,defaultNodes:o,defaultEdges:s,initialWidth:a,initialHeight:l,fitView:u,initialFitViewOptions:d,initialMinZoom:h,initialMaxZoom:p,nodeOrigin:m,nodeExtent:y,zIndexMode:b,children:t})}const rj={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function sj({nodes:t,edges:e,defaultNodes:n,defaultEdges:o,className:s,nodeTypes:a,edgeTypes:l,onNodeClick:u,onEdgeClick:d,onInit:h,onMove:p,onMoveStart:m,onMoveEnd:y,onConnect:b,onConnectStart:x,onConnectEnd:w,onClickConnectStart:_,onClickConnectEnd:S,onNodeMouseEnter:k,onNodeMouseMove:C,onNodeMouseLeave:E,onNodeContextMenu:R,onNodeDoubleClick:A,onNodeDragStart:O,onNodeDrag:D,onNodeDragStop:U,onNodesDelete:q,onEdgesDelete:Y,onDelete:K,onSelectionChange:W,onSelectionDragStart:B,onSelectionDrag:H,onSelectionDragStop:j,onSelectionContextMenu:I,onSelectionStart:z,onSelectionEnd:$,onBeforeDelete:G,connectionMode:L,connectionLineType:F=Hi.Bezier,connectionLineStyle:et,connectionLineComponent:rt,connectionLineContainerStyle:ct,deleteKeyCode:ht="Backspace",selectionKeyCode:ft="Shift",selectionOnDrag:ut=!1,selectionMode:dt=na.Full,panActivationKeyCode:Ot="Space",multiSelectionKeyCode:At=la()?"Meta":"Control",zoomActivationKeyCode:bt=la()?"Meta":"Control",snapToGrid:Tt,snapGrid:Dt,onlyRenderVisibleElements:Xt=!1,selectNodesOnDrag:Ft,nodesDraggable:pt,autoPanOnNodeFocus:yt,nodesConnectable:vt,nodesFocusable:mt,nodeOrigin:Ct=nb,edgesFocusable:It,edgesReconnectable:zt,elementsSelectable:Vt=!0,defaultViewport:ve=z5,minZoom:Wt=.5,maxZoom:je=2,translateExtent:xn=ea,preventScrolling:Pa=!0,nodeExtent:Hn,defaultMarkerColor:tr="#b1b1b7",zoomOnScroll:Ba=!0,zoomOnPinch:Re=!0,panOnScroll:me=!1,panOnScrollSpeed:le=.5,panOnScrollMode:ze=Po.Free,zoomOnDoubleClick:um=!0,panOnDrag:fm=!0,onPaneClick:dm,onPaneMouseEnter:es,onPaneMouseMove:ns,onPaneMouseLeave:is,onPaneScroll:xi,onPaneContextMenu:os,paneClickDistance:er=1,nodeClickDistance:hm=0,children:yu,onReconnect:Ha,onReconnectStart:nr,onReconnectEnd:pm,onEdgeContextMenu:vu,onEdgeDoubleClick:bu,onEdgeMouseEnter:xu,onEdgeMouseMove:Ua,onEdgeMouseLeave:$a,reconnectRadius:wu=10,onNodesChange:_u,onEdgesChange:ri,noDragClassName:ke="nodrag",noWheelClassName:Ye="nowheel",noPanClassName:wi="nopan",fitView:rs,fitViewOptions:Su,connectOnClick:mm,attributionPosition:Eu,proOptions:ir,defaultEdgeOptions:Ya,elevateNodesOnSelect:no=!0,elevateEdgesOnSelect:io=!1,disableKeyboardA11y:oo=!1,autoPanOnConnect:ro,autoPanOnNodeDrag:Se,autoPanSpeed:Cu,connectionRadius:Tu,isValidConnection:_i,onError:so,style:gm,id:qa,nodeDragThreshold:Nu,connectionDragThreshold:ym,viewport:ss,onViewportChange:as,width:Un,height:Ke,colorMode:Au="light",debug:vm,onScroll:ls,ariaLabelConfig:Mu,zIndexMode:or="basic",...bm},Qe){const rr=qa||"1",Ru=I5(Au),Ga=N.useCallback(Si=>{Si.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),ls?.(Si)},[ls]);return M.jsx("div",{"data-testid":"rf__wrapper",...bm,onScroll:Ga,style:{...gm,...rj},ref:Qe,className:we(["react-flow",s,Ru]),id:qa,role:"application",children:M.jsxs(oj,{nodes:t,edges:e,width:Un,height:Ke,fitView:rs,fitViewOptions:Su,minZoom:Wt,maxZoom:je,nodeOrigin:Ct,nodeExtent:Hn,zIndexMode:or,children:[M.jsx(nj,{onInit:h,onNodeClick:u,onEdgeClick:d,onNodeMouseEnter:k,onNodeMouseMove:C,onNodeMouseLeave:E,onNodeContextMenu:R,onNodeDoubleClick:A,nodeTypes:a,edgeTypes:l,connectionLineType:F,connectionLineStyle:et,connectionLineComponent:rt,connectionLineContainerStyle:ct,selectionKeyCode:ft,selectionOnDrag:ut,selectionMode:dt,deleteKeyCode:ht,multiSelectionKeyCode:At,panActivationKeyCode:Ot,zoomActivationKeyCode:bt,onlyRenderVisibleElements:Xt,defaultViewport:ve,translateExtent:xn,minZoom:Wt,maxZoom:je,preventScrolling:Pa,zoomOnScroll:Ba,zoomOnPinch:Re,zoomOnDoubleClick:um,panOnScroll:me,panOnScrollSpeed:le,panOnScrollMode:ze,panOnDrag:fm,onPaneClick:dm,onPaneMouseEnter:es,onPaneMouseMove:ns,onPaneMouseLeave:is,onPaneScroll:xi,onPaneContextMenu:os,paneClickDistance:er,nodeClickDistance:hm,onSelectionContextMenu:I,onSelectionStart:z,onSelectionEnd:$,onReconnect:Ha,onReconnectStart:nr,onReconnectEnd:pm,onEdgeContextMenu:vu,onEdgeDoubleClick:bu,onEdgeMouseEnter:xu,onEdgeMouseMove:Ua,onEdgeMouseLeave:$a,reconnectRadius:wu,defaultMarkerColor:tr,noDragClassName:ke,noWheelClassName:Ye,noPanClassName:wi,rfId:rr,disableKeyboardA11y:oo,nodeExtent:Hn,viewport:ss,onViewportChange:as}),M.jsx(L5,{nodes:t,edges:e,defaultNodes:n,defaultEdges:o,onConnect:b,onConnectStart:x,onConnectEnd:w,onClickConnectStart:_,onClickConnectEnd:S,nodesDraggable:pt,autoPanOnNodeFocus:yt,nodesConnectable:vt,nodesFocusable:mt,edgesFocusable:It,edgesReconnectable:zt,elementsSelectable:Vt,elevateNodesOnSelect:no,elevateEdgesOnSelect:io,minZoom:Wt,maxZoom:je,nodeExtent:Hn,onNodesChange:_u,onEdgesChange:ri,snapToGrid:Tt,snapGrid:Dt,connectionMode:L,translateExtent:xn,connectOnClick:mm,defaultEdgeOptions:Ya,fitView:rs,fitViewOptions:Su,onNodesDelete:q,onEdgesDelete:Y,onDelete:K,onNodeDragStart:O,onNodeDrag:D,onNodeDragStop:U,onSelectionDrag:H,onSelectionDragStart:B,onSelectionDragStop:j,onMove:p,onMoveStart:m,onMoveEnd:y,noPanClassName:wi,nodeOrigin:Ct,rfId:rr,autoPanOnConnect:ro,autoPanOnNodeDrag:Se,autoPanSpeed:Cu,onError:so,connectionRadius:Tu,isValidConnection:_i,selectNodesOnDrag:Ft,nodeDragThreshold:Nu,connectionDragThreshold:ym,onBeforeDelete:G,debug:vm,ariaLabelConfig:Mu,zIndexMode:or}),M.jsx(j5,{onSelectionChange:W}),yu,M.jsx(M5,{proOptions:ir,position:Eu}),M.jsx(A5,{rfId:rr,disableKeyboardA11y:oo})]})})}var aj=pb(sj);function lj(){const t=ae();return N.useCallback(e=>{const{domNode:n,updateNodeInternals:o}=t.getState(),s=Array.isArray(e)?e:[e],a=new Map;s.forEach(l=>{const u=n?.querySelector(`.react-flow__node[data-id="${l}"]`);u&&a.set(l,{id:l,nodeElement:u,force:!0})}),requestAnimationFrame(()=>o(a,{triggerFitView:!1}))},[])}function cj({dimensions:t,lineWidth:e,variant:n,className:o}){return M.jsx("path",{strokeWidth:e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:we(["react-flow__background-pattern",n,o])})}function uj({radius:t,className:e}){return M.jsx("circle",{cx:t,cy:t,r:t,className:we(["react-flow__background-pattern","dots",e])})}var pi;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(pi||(pi={}));const fj={[pi.Dots]:1,[pi.Lines]:1,[pi.Cross]:6},dj=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function Kb({id:t,variant:e=pi.Dots,gap:n=20,size:o,lineWidth:s=1,offset:a=0,color:l,bgColor:u,style:d,className:h,patternClassName:p}){const m=N.useRef(null),{transform:y,patternId:b}=Gt(dj,fe),x=o||fj[e],w=e===pi.Dots,_=e===pi.Cross,S=Array.isArray(n)?n:[n,n],k=[S[0]*y[2]||1,S[1]*y[2]||1],C=x*y[2],E=Array.isArray(a)?a:[a,a],R=_?[C,C]:k,A=[E[0]*y[2]||1+R[0]/2,E[1]*y[2]||1+R[1]/2],O=`${b}${t||""}`;return M.jsxs("svg",{className:we(["react-flow__background",h]),style:{...d,...vc,"--xy-background-color-props":u,"--xy-background-pattern-color-props":l},ref:m,"data-testid":"rf__background",children:[M.jsx("pattern",{id:O,x:y[0]%k[0],y:y[1]%k[1],width:k[0],height:k[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${A[0]},-${A[1]})`,children:w?M.jsx(uj,{radius:C/2,className:p}):M.jsx(cj,{dimensions:R,lineWidth:s,variant:e,className:p})}),M.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${O})`})]})}Kb.displayName="Background";const hj=N.memo(Kb);function pj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:M.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function mj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:M.jsx("path",{d:"M0 0h32v4.2H0z"})})}function gj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:M.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 yj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:M.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 vj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:M.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 wc({children:t,className:e,...n}){return M.jsx("button",{type:"button",className:we(["react-flow__controls-button",e]),...n,children:t})}const bj=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function Qb({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:o=!0,fitViewOptions:s,onZoomIn:a,onZoomOut:l,onFitView:u,onInteractiveChange:d,className:h,children:p,position:m="bottom-left",orientation:y="vertical","aria-label":b}){const x=ae(),{isInteractive:w,minZoomReached:_,maxZoomReached:S,ariaLabelConfig:k}=Gt(bj,fe),{zoomIn:C,zoomOut:E,fitView:R}=da(),A=()=>{C(),a?.()},O=()=>{E(),l?.()},D=()=>{R(s),u?.()},U=()=>{x.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),d?.(!w)},q=y==="horizontal"?"horizontal":"vertical";return M.jsxs(ua,{className:we(["react-flow__controls",q,h]),position:m,style:t,"data-testid":"rf__controls","aria-label":b??k["controls.ariaLabel"],children:[e&&M.jsxs(M.Fragment,{children:[M.jsx(wc,{onClick:A,className:"react-flow__controls-zoomin",title:k["controls.zoomIn.ariaLabel"],"aria-label":k["controls.zoomIn.ariaLabel"],disabled:S,children:M.jsx(pj,{})}),M.jsx(wc,{onClick:O,className:"react-flow__controls-zoomout",title:k["controls.zoomOut.ariaLabel"],"aria-label":k["controls.zoomOut.ariaLabel"],disabled:_,children:M.jsx(mj,{})})]}),n&&M.jsx(wc,{className:"react-flow__controls-fitview",onClick:D,title:k["controls.fitView.ariaLabel"],"aria-label":k["controls.fitView.ariaLabel"],children:M.jsx(gj,{})}),o&&M.jsx(wc,{className:"react-flow__controls-interactive",onClick:U,title:k["controls.interactive.ariaLabel"],"aria-label":k["controls.interactive.ariaLabel"],children:w?M.jsx(vj,{}):M.jsx(yj,{})}),p]})}Qb.displayName="Controls",N.memo(Qb);function xj({id:t,x:e,y:n,width:o,height:s,style:a,color:l,strokeColor:u,strokeWidth:d,className:h,borderRadius:p,shapeRendering:m,selected:y,onClick:b}){const{background:x,backgroundColor:w}=a||{},_=l||x||w;return M.jsx("rect",{className:we(["react-flow__minimap-node",{selected:y},h]),x:e,y:n,rx:p,ry:p,width:o,height:s,style:{fill:_,stroke:u,strokeWidth:d},shapeRendering:m,onClick:b?S=>b(S,t):void 0})}const wj=N.memo(xj),_j=t=>t.nodes.map(e=>e.id),nh=t=>t instanceof Function?t:()=>t;function Sj({nodeStrokeColor:t,nodeColor:e,nodeClassName:n="",nodeBorderRadius:o=5,nodeStrokeWidth:s,nodeComponent:a=wj,onClick:l}){const u=Gt(_j,fe),d=nh(e),h=nh(t),p=nh(n),m=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return M.jsx(M.Fragment,{children:u.map(y=>M.jsx(Cj,{id:y,nodeColorFunc:d,nodeStrokeColorFunc:h,nodeClassNameFunc:p,nodeBorderRadius:o,nodeStrokeWidth:s,NodeComponent:a,onClick:l,shapeRendering:m},y))})}function Ej({id:t,nodeColorFunc:e,nodeStrokeColorFunc:n,nodeClassNameFunc:o,nodeBorderRadius:s,nodeStrokeWidth:a,shapeRendering:l,NodeComponent:u,onClick:d}){const{node:h,x:p,y:m,width:y,height:b}=Gt(x=>{const w=x.nodeLookup.get(t);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const _=w.internals.userNode,{x:S,y:k}=w.internals.positionAbsolute,{width:C,height:E}=hi(_);return{node:_,x:S,y:k,width:C,height:E}},fe);return!h||h.hidden||!hv(h)?null:M.jsx(u,{x:p,y:m,width:y,height:b,style:h.style,selected:!!h.selected,className:o(h),color:e(h),borderRadius:s,strokeColor:n(h),strokeWidth:a,shapeRendering:l,onClick:d,id:h.id})}const Cj=N.memo(Ej);var Tj=N.memo(Sj);const Nj=200,Aj=150,Mj=t=>!t.hidden,Rj=t=>{const e={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:e,boundingRect:t.nodeLookup.size>0?fv(oa(t.nodeLookup,{filter:Mj}),e):e,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},kj="react-flow__minimap-desc";function Wb({style:t,className:e,nodeStrokeColor:n,nodeColor:o,nodeClassName:s="",nodeBorderRadius:a=5,nodeStrokeWidth:l,nodeComponent:u,bgColor:d,maskColor:h,maskStrokeColor:p,maskStrokeWidth:m,position:y="bottom-right",onClick:b,onNodeClick:x,pannable:w=!1,zoomable:_=!1,ariaLabel:S,inversePan:k,zoomStep:C=1,offsetScale:E=5}){const R=ae(),A=N.useRef(null),{boundingRect:O,viewBB:D,rfId:U,panZoom:q,translateExtent:Y,flowWidth:K,flowHeight:W,ariaLabelConfig:B}=Gt(Rj,fe),H=t?.width??Nj,j=t?.height??Aj,I=O.width/H,z=O.height/j,$=Math.max(I,z),G=$*H,L=$*j,F=E*$,et=O.x-(G-O.width)/2-F,rt=O.y-(L-O.height)/2-F,ct=G+F*2,ht=L+F*2,ft=`${kj}-${U}`,ut=N.useRef(0),dt=N.useRef();ut.current=$,N.useEffect(()=>{if(A.current&&q)return dt.current=XO({domNode:A.current,panZoom:q,getTransform:()=>R.getState().transform,getViewScale:()=>ut.current}),()=>{dt.current?.destroy()}},[q]),N.useEffect(()=>{dt.current?.update({translateExtent:Y,width:K,height:W,inversePan:k,pannable:w,zoomStep:C,zoomable:_})},[w,_,k,C,Y,K,W]);const Ot=b?Tt=>{const[Dt,Xt]=dt.current?.pointer(Tt)||[0,0];b(Tt,{x:Dt,y:Xt})}:void 0,At=x?N.useCallback((Tt,Dt)=>{const Xt=R.getState().nodeLookup.get(Dt).internals.userNode;x(Tt,Xt)},[]):void 0,bt=S??B["minimap.ariaLabel"];return M.jsx(ua,{position:y,style:{...t,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof m=="number"?m*$:void 0,"--xy-minimap-node-background-color-props":typeof o=="string"?o:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof l=="number"?l:void 0},className:we(["react-flow__minimap",e]),"data-testid":"rf__minimap",children:M.jsxs("svg",{width:H,height:j,viewBox:`${et} ${rt} ${ct} ${ht}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ft,ref:A,onClick:Ot,children:[bt&&M.jsx("title",{id:ft,children:bt}),M.jsx(Tj,{onClick:At,nodeColor:o,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:s,nodeStrokeWidth:l,nodeComponent:u}),M.jsx("path",{className:"react-flow__minimap-mask",d:`M${et-F},${rt-F}h${ct+F*2}v${ht+F*2}h${-ct-F*2}z
|
|
24
|
+
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Wb.displayName="MiniMap",N.memo(Wb);const Oj=t=>e=>t?`${Math.max(1/e.transform[2],1)}`:void 0,Dj={[Or.Line]:"right",[Or.Handle]:"bottom-right"};function jj({nodeId:t,position:e,variant:n=Or.Handle,className:o,style:s=void 0,children:a,color:l,minWidth:u=10,minHeight:d=10,maxWidth:h=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:m=!1,resizeDirection:y,autoScale:b=!0,shouldResize:x,onResizeStart:w,onResize:_,onResizeEnd:S}){const k=xb(),C=typeof t=="string"?t:k,E=ae(),R=N.useRef(null),A=n===Or.Handle,O=Gt(N.useCallback(Oj(A&&b),[A,b]),fe),D=N.useRef(null),U=e??Dj[n];N.useEffect(()=>{if(!(!R.current||!C))return D.current||(D.current=l5({domNode:R.current,nodeId:C,getStoreItems:()=>{const{nodeLookup:Y,transform:K,snapGrid:W,snapToGrid:B,nodeOrigin:H,domNode:j}=E.getState();return{nodeLookup:Y,transform:K,snapGrid:W,snapToGrid:B,nodeOrigin:H,paneDomNode:j}},onChange:(Y,K)=>{const{triggerNodeChanges:W,nodeLookup:B,parentLookup:H,nodeOrigin:j}=E.getState(),I=[],z={x:Y.x,y:Y.y},$=B.get(C);if($&&$.expandParent&&$.parentId){const G=$.origin??j,L=Y.width??$.measured.width??0,F=Y.height??$.measured.height??0,et={id:$.id,parentId:$.parentId,rect:{width:L,height:F,...pv({x:Y.x??$.position.x,y:Y.y??$.position.y},{width:L,height:F},$.parentId,B,G)}},rt=Ud([et],B,H,j);I.push(...rt),z.x=Y.x?Math.max(G[0]*L,Y.x):void 0,z.y=Y.y?Math.max(G[1]*F,Y.y):void 0}if(z.x!==void 0&&z.y!==void 0){const G={id:C,type:"position",position:{...z}};I.push(G)}if(Y.width!==void 0&&Y.height!==void 0){const L={id:C,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:Y.width,height:Y.height}};I.push(L)}for(const G of K){const L={...G,type:"position"};I.push(L)}W(I)},onEnd:({width:Y,height:K})=>{const W={id:C,type:"dimensions",resizing:!1,dimensions:{width:Y,height:K}};E.getState().triggerNodeChanges([W])}})),D.current.update({controlPosition:U,boundaries:{minWidth:u,minHeight:d,maxWidth:h,maxHeight:p},keepAspectRatio:m,resizeDirection:y,onResizeStart:w,onResize:_,onResizeEnd:S,shouldResize:x}),()=>{D.current?.destroy()}},[U,u,d,h,p,m,w,_,S,x]);const q=U.split("-");return M.jsx("div",{className:we(["react-flow__resize-control","nodrag",...q,n,o]),ref:R,style:{...s,scale:O,...l&&{[A?"backgroundColor":"borderColor"]:l}},children:a})}N.memo(jj);function Jb(t){if(t.includes("."))return Jb(t.split(".").pop()||t);const e=t.split("_");for(let n=0;n<e.length;n++)if(/^\d{10,}$/.test(e[n])){const o=e.slice(0,n);return o.length>1&&/^[A-Z]/.test(o[0])?o.slice(1).join("_")||o[0]:o.join("_")||t}return t}function zj(t){return{...t,nodes:t.nodes.map(e=>({...e,label:Jb(e.label||e.id)}))}}function tx(t){var e,n,o="";if(typeof t=="string"||typeof t=="number")o+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=tx(t[e]))&&(o&&(o+=" "),o+=n)}else for(n in t)t[n]&&(o&&(o+=" "),o+=n);return o}function ex(){for(var t,e,n=0,o="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=tx(t))&&(o&&(o+=" "),o+=e);return o}const Vj=(t,e)=>{const n=new Array(t.length+e.length);for(let o=0;o<t.length;o++)n[o]=t[o];for(let o=0;o<e.length;o++)n[t.length+o]=e[o];return n},Lj=(t,e)=>({classGroupId:t,validator:e}),nx=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),_c="-",ix=[],Ij="arbitrary..",Pj=t=>{const e=Hj(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:o}=t;return{getClassGroupId:l=>{if(l.startsWith("[")&&l.endsWith("]"))return Bj(l);const u=l.split(_c),d=u[0]===""&&u.length>1?1:0;return ox(u,d,e)},getConflictingClassGroupIds:(l,u)=>{if(u){const d=o[l],h=n[l];return d?h?Vj(h,d):d:h||ix}return n[l]||ix}}},ox=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],a=n.nextPart.get(s);if(a){const h=ox(t,e+1,a);if(h)return h}const l=n.validators;if(l===null)return;const u=e===0?t.join(_c):t.slice(e).join(_c),d=l.length;for(let h=0;h<d;h++){const p=l[h];if(p.validator(u))return p.classGroupId}},Bj=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),o=e.slice(0,n);return o?Ij+o:void 0})(),Hj=t=>{const{theme:e,classGroups:n}=t;return Uj(n,e)},Uj=(t,e)=>{const n=nx();for(const o in t){const s=t[o];ih(s,n,o,e)}return n},ih=(t,e,n,o)=>{const s=t.length;for(let a=0;a<s;a++){const l=t[a];$j(l,e,n,o)}},$j=(t,e,n,o)=>{if(typeof t=="string"){Yj(t,e,n);return}if(typeof t=="function"){qj(t,e,n,o);return}Gj(t,e,n,o)},Yj=(t,e,n)=>{const o=t===""?e:rx(e,t);o.classGroupId=n},qj=(t,e,n,o)=>{if(Fj(t)){ih(t(o),e,n,o);return}e.validators===null&&(e.validators=[]),e.validators.push(Lj(n,t))},Gj=(t,e,n,o)=>{const s=Object.entries(t),a=s.length;for(let l=0;l<a;l++){const[u,d]=s[l];ih(d,rx(e,u),n,o)}},rx=(t,e)=>{let n=t;const o=e.split(_c),s=o.length;for(let a=0;a<s;a++){const l=o[a];let u=n.nextPart.get(l);u||(u=nx(),n.nextPart.set(l,u)),n=u}return n},Fj=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Xj=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),o=Object.create(null);const s=(a,l)=>{n[a]=l,e++,e>t&&(e=0,o=n,n=Object.create(null))};return{get(a){let l=n[a];if(l!==void 0)return l;if((l=o[a])!==void 0)return s(a,l),l},set(a,l){a in n?n[a]=l:s(a,l)}}},oh="!",sx=":",Zj=[],ax=(t,e,n,o,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:o,isExternal:s}),Kj=t=>{const{prefix:e,experimentalParseClassName:n}=t;let o=s=>{const a=[];let l=0,u=0,d=0,h;const p=s.length;for(let w=0;w<p;w++){const _=s[w];if(l===0&&u===0){if(_===sx){a.push(s.slice(d,w)),d=w+1;continue}if(_==="/"){h=w;continue}}_==="["?l++:_==="]"?l--:_==="("?u++:_===")"&&u--}const m=a.length===0?s:s.slice(d);let y=m,b=!1;m.endsWith(oh)?(y=m.slice(0,-1),b=!0):m.startsWith(oh)&&(y=m.slice(1),b=!0);const x=h&&h>d?h-d:void 0;return ax(a,b,y,x)};if(e){const s=e+sx,a=o;o=l=>l.startsWith(s)?a(l.slice(s.length)):ax(Zj,!1,l,void 0,!0)}if(n){const s=o;o=a=>n({className:a,parseClassName:s})}return o},Qj=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,o)=>{e.set(n,1e6+o)}),n=>{const o=[];let s=[];for(let a=0;a<n.length;a++){const l=n[a],u=l[0]==="[",d=e.has(l);u||d?(s.length>0&&(s.sort(),o.push(...s),s=[]),o.push(l)):s.push(l)}return s.length>0&&(s.sort(),o.push(...s)),o}},Wj=t=>({cache:Xj(t.cacheSize),parseClassName:Kj(t),sortModifiers:Qj(t),...Pj(t)}),Jj=/\s+/,tz=(t,e)=>{const{parseClassName:n,getClassGroupId:o,getConflictingClassGroupIds:s,sortModifiers:a}=e,l=[],u=t.trim().split(Jj);let d="";for(let h=u.length-1;h>=0;h-=1){const p=u[h],{isExternal:m,modifiers:y,hasImportantModifier:b,baseClassName:x,maybePostfixModifierPosition:w}=n(p);if(m){d=p+(d.length>0?" "+d:d);continue}let _=!!w,S=o(_?x.substring(0,w):x);if(!S){if(!_){d=p+(d.length>0?" "+d:d);continue}if(S=o(x),!S){d=p+(d.length>0?" "+d:d);continue}_=!1}const k=y.length===0?"":y.length===1?y[0]:a(y).join(":"),C=b?k+oh:k,E=C+S;if(l.indexOf(E)>-1)continue;l.push(E);const R=s(S,_);for(let A=0;A<R.length;++A){const O=R[A];l.push(C+O)}d=p+(d.length>0?" "+d:d)}return d},ez=(...t)=>{let e=0,n,o,s="";for(;e<t.length;)(n=t[e++])&&(o=lx(n))&&(s&&(s+=" "),s+=o);return s},lx=t=>{if(typeof t=="string")return t;let e,n="";for(let o=0;o<t.length;o++)t[o]&&(e=lx(t[o]))&&(n&&(n+=" "),n+=e);return n},nz=(t,...e)=>{let n,o,s,a;const l=d=>{const h=e.reduce((p,m)=>m(p),t());return n=Wj(h),o=n.cache.get,s=n.cache.set,a=u,u(d)},u=d=>{const h=o(d);if(h)return h;const p=tz(d,n);return s(d,p),p};return a=l,(...d)=>a(ez(...d))},iz=[],Ae=t=>{const e=n=>n[t]||iz;return e.isThemeGetter=!0,e},cx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ux=/^\((?:(\w[\w-]*):)?(.+)\)$/i,oz=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,rz=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,sz=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,az=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,lz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,cz=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Yi=t=>oz.test(t),Bt=t=>!!t&&!Number.isNaN(Number(t)),qi=t=>!!t&&Number.isInteger(Number(t)),rh=t=>t.endsWith("%")&&Bt(t.slice(0,-1)),mi=t=>rz.test(t),fx=()=>!0,uz=t=>sz.test(t)&&!az.test(t),sh=()=>!1,fz=t=>lz.test(t),dz=t=>cz.test(t),hz=t=>!wt(t)&&!St(t),pz=t=>Gi(t,yx,sh),wt=t=>cx.test(t),$o=t=>Gi(t,vx,uz),dx=t=>Gi(t,_z,Bt),mz=t=>Gi(t,xx,fx),gz=t=>Gi(t,bx,sh),hx=t=>Gi(t,mx,sh),yz=t=>Gi(t,gx,dz),Sc=t=>Gi(t,wx,fz),St=t=>ux.test(t),ha=t=>Yo(t,vx),vz=t=>Yo(t,bx),px=t=>Yo(t,mx),bz=t=>Yo(t,yx),xz=t=>Yo(t,gx),Ec=t=>Yo(t,wx,!0),wz=t=>Yo(t,xx,!0),Gi=(t,e,n)=>{const o=cx.exec(t);return o?o[1]?e(o[1]):n(o[2]):!1},Yo=(t,e,n=!1)=>{const o=ux.exec(t);return o?o[1]?e(o[1]):n:!1},mx=t=>t==="position"||t==="percentage",gx=t=>t==="image"||t==="url",yx=t=>t==="length"||t==="size"||t==="bg-size",vx=t=>t==="length",_z=t=>t==="number",bx=t=>t==="family-name",xx=t=>t==="number"||t==="weight",wx=t=>t==="shadow",Sz=nz(()=>{const t=Ae("color"),e=Ae("font"),n=Ae("text"),o=Ae("font-weight"),s=Ae("tracking"),a=Ae("leading"),l=Ae("breakpoint"),u=Ae("container"),d=Ae("spacing"),h=Ae("radius"),p=Ae("shadow"),m=Ae("inset-shadow"),y=Ae("text-shadow"),b=Ae("drop-shadow"),x=Ae("blur"),w=Ae("perspective"),_=Ae("aspect"),S=Ae("ease"),k=Ae("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],E=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...E(),St,wt],A=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],D=()=>[St,wt,d],U=()=>[Yi,"full","auto",...D()],q=()=>[qi,"none","subgrid",St,wt],Y=()=>["auto",{span:["full",qi,St,wt]},qi,St,wt],K=()=>[qi,"auto",St,wt],W=()=>["auto","min","max","fr",St,wt],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],H=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...D()],I=()=>[Yi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],z=()=>[Yi,"screen","full","dvw","lvw","svw","min","max","fit",...D()],$=()=>[Yi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...D()],G=()=>[t,St,wt],L=()=>[...E(),px,hx,{position:[St,wt]}],F=()=>["no-repeat",{repeat:["","x","y","space","round"]}],et=()=>["auto","cover","contain",bz,pz,{size:[St,wt]}],rt=()=>[rh,ha,$o],ct=()=>["","none","full",h,St,wt],ht=()=>["",Bt,ha,$o],ft=()=>["solid","dashed","dotted","double"],ut=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],dt=()=>[Bt,rh,px,hx],Ot=()=>["","none",x,St,wt],At=()=>["none",Bt,St,wt],bt=()=>["none",Bt,St,wt],Tt=()=>[Bt,St,wt],Dt=()=>[Yi,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[mi],breakpoint:[mi],color:[fx],container:[mi],"drop-shadow":[mi],ease:["in","out","in-out"],font:[hz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[mi],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[mi],shadow:[mi],spacing:["px",Bt],text:[mi],"text-shadow":[mi],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Yi,wt,St,_]}],container:["container"],columns:[{columns:[Bt,wt,St,u]}],"break-after":[{"break-after":C()}],"break-before":[{"break-before":C()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:U()}],"inset-x":[{"inset-x":U()}],"inset-y":[{"inset-y":U()}],start:[{"inset-s":U(),start:U()}],end:[{"inset-e":U(),end:U()}],"inset-bs":[{"inset-bs":U()}],"inset-be":[{"inset-be":U()}],top:[{top:U()}],right:[{right:U()}],bottom:[{bottom:U()}],left:[{left:U()}],visibility:["visible","invisible","collapse"],z:[{z:[qi,"auto",St,wt]}],basis:[{basis:[Yi,"full","auto",u,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Bt,Yi,"auto","initial","none",wt]}],grow:[{grow:["",Bt,St,wt]}],shrink:[{shrink:["",Bt,St,wt]}],order:[{order:[qi,"first","last","none",St,wt]}],"grid-cols":[{"grid-cols":q()}],"col-start-end":[{col:Y()}],"col-start":[{"col-start":K()}],"col-end":[{"col-end":K()}],"grid-rows":[{"grid-rows":q()}],"row-start-end":[{row:Y()}],"row-start":[{"row-start":K()}],"row-end":[{"row-end":K()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":W()}],"auto-rows":[{"auto-rows":W()}],gap:[{gap:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...H(),"normal"]}],"justify-self":[{"justify-self":["auto",...H()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...H(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...H(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...H(),"baseline"]}],"place-self":[{"place-self":["auto",...H()]}],p:[{p:D()}],px:[{px:D()}],py:[{py:D()}],ps:[{ps:D()}],pe:[{pe:D()}],pbs:[{pbs:D()}],pbe:[{pbe:D()}],pt:[{pt:D()}],pr:[{pr:D()}],pb:[{pb:D()}],pl:[{pl:D()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":D()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":D()}],"space-y-reverse":["space-y-reverse"],size:[{size:I()}],"inline-size":[{inline:["auto",...z()]}],"min-inline-size":[{"min-inline":["auto",...z()]}],"max-inline-size":[{"max-inline":["none",...z()]}],"block-size":[{block:["auto",...$()]}],"min-block-size":[{"min-block":["auto",...$()]}],"max-block-size":[{"max-block":["none",...$()]}],w:[{w:[u,"screen",...I()]}],"min-w":[{"min-w":[u,"screen","none",...I()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[l]},...I()]}],h:[{h:["screen","lh",...I()]}],"min-h":[{"min-h":["screen","lh","none",...I()]}],"max-h":[{"max-h":["screen","lh",...I()]}],"font-size":[{text:["base",n,ha,$o]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[o,wz,mz]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",rh,wt]}],"font-family":[{font:[vz,gz,e]}],"font-features":[{"font-features":[wt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,St,wt]}],"line-clamp":[{"line-clamp":[Bt,"none",St,dx]}],leading:[{leading:[a,...D()]}],"list-image":[{"list-image":["none",St,wt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",St,wt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:G()}],"text-color":[{text:G()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ft(),"wavy"]}],"text-decoration-thickness":[{decoration:[Bt,"from-font","auto",St,$o]}],"text-decoration-color":[{decoration:G()}],"underline-offset":[{"underline-offset":[Bt,"auto",St,wt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:D()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",St,wt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",St,wt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:F()}],"bg-size":[{bg:et()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},qi,St,wt],radial:["",St,wt],conic:[qi,St,wt]},xz,yz]}],"bg-color":[{bg:G()}],"gradient-from-pos":[{from:rt()}],"gradient-via-pos":[{via:rt()}],"gradient-to-pos":[{to:rt()}],"gradient-from":[{from:G()}],"gradient-via":[{via:G()}],"gradient-to":[{to:G()}],rounded:[{rounded:ct()}],"rounded-s":[{"rounded-s":ct()}],"rounded-e":[{"rounded-e":ct()}],"rounded-t":[{"rounded-t":ct()}],"rounded-r":[{"rounded-r":ct()}],"rounded-b":[{"rounded-b":ct()}],"rounded-l":[{"rounded-l":ct()}],"rounded-ss":[{"rounded-ss":ct()}],"rounded-se":[{"rounded-se":ct()}],"rounded-ee":[{"rounded-ee":ct()}],"rounded-es":[{"rounded-es":ct()}],"rounded-tl":[{"rounded-tl":ct()}],"rounded-tr":[{"rounded-tr":ct()}],"rounded-br":[{"rounded-br":ct()}],"rounded-bl":[{"rounded-bl":ct()}],"border-w":[{border:ht()}],"border-w-x":[{"border-x":ht()}],"border-w-y":[{"border-y":ht()}],"border-w-s":[{"border-s":ht()}],"border-w-e":[{"border-e":ht()}],"border-w-bs":[{"border-bs":ht()}],"border-w-be":[{"border-be":ht()}],"border-w-t":[{"border-t":ht()}],"border-w-r":[{"border-r":ht()}],"border-w-b":[{"border-b":ht()}],"border-w-l":[{"border-l":ht()}],"divide-x":[{"divide-x":ht()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ht()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ft(),"hidden","none"]}],"divide-style":[{divide:[...ft(),"hidden","none"]}],"border-color":[{border:G()}],"border-color-x":[{"border-x":G()}],"border-color-y":[{"border-y":G()}],"border-color-s":[{"border-s":G()}],"border-color-e":[{"border-e":G()}],"border-color-bs":[{"border-bs":G()}],"border-color-be":[{"border-be":G()}],"border-color-t":[{"border-t":G()}],"border-color-r":[{"border-r":G()}],"border-color-b":[{"border-b":G()}],"border-color-l":[{"border-l":G()}],"divide-color":[{divide:G()}],"outline-style":[{outline:[...ft(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Bt,St,wt]}],"outline-w":[{outline:["",Bt,ha,$o]}],"outline-color":[{outline:G()}],shadow:[{shadow:["","none",p,Ec,Sc]}],"shadow-color":[{shadow:G()}],"inset-shadow":[{"inset-shadow":["none",m,Ec,Sc]}],"inset-shadow-color":[{"inset-shadow":G()}],"ring-w":[{ring:ht()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:G()}],"ring-offset-w":[{"ring-offset":[Bt,$o]}],"ring-offset-color":[{"ring-offset":G()}],"inset-ring-w":[{"inset-ring":ht()}],"inset-ring-color":[{"inset-ring":G()}],"text-shadow":[{"text-shadow":["none",y,Ec,Sc]}],"text-shadow-color":[{"text-shadow":G()}],opacity:[{opacity:[Bt,St,wt]}],"mix-blend":[{"mix-blend":[...ut(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ut()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Bt]}],"mask-image-linear-from-pos":[{"mask-linear-from":dt()}],"mask-image-linear-to-pos":[{"mask-linear-to":dt()}],"mask-image-linear-from-color":[{"mask-linear-from":G()}],"mask-image-linear-to-color":[{"mask-linear-to":G()}],"mask-image-t-from-pos":[{"mask-t-from":dt()}],"mask-image-t-to-pos":[{"mask-t-to":dt()}],"mask-image-t-from-color":[{"mask-t-from":G()}],"mask-image-t-to-color":[{"mask-t-to":G()}],"mask-image-r-from-pos":[{"mask-r-from":dt()}],"mask-image-r-to-pos":[{"mask-r-to":dt()}],"mask-image-r-from-color":[{"mask-r-from":G()}],"mask-image-r-to-color":[{"mask-r-to":G()}],"mask-image-b-from-pos":[{"mask-b-from":dt()}],"mask-image-b-to-pos":[{"mask-b-to":dt()}],"mask-image-b-from-color":[{"mask-b-from":G()}],"mask-image-b-to-color":[{"mask-b-to":G()}],"mask-image-l-from-pos":[{"mask-l-from":dt()}],"mask-image-l-to-pos":[{"mask-l-to":dt()}],"mask-image-l-from-color":[{"mask-l-from":G()}],"mask-image-l-to-color":[{"mask-l-to":G()}],"mask-image-x-from-pos":[{"mask-x-from":dt()}],"mask-image-x-to-pos":[{"mask-x-to":dt()}],"mask-image-x-from-color":[{"mask-x-from":G()}],"mask-image-x-to-color":[{"mask-x-to":G()}],"mask-image-y-from-pos":[{"mask-y-from":dt()}],"mask-image-y-to-pos":[{"mask-y-to":dt()}],"mask-image-y-from-color":[{"mask-y-from":G()}],"mask-image-y-to-color":[{"mask-y-to":G()}],"mask-image-radial":[{"mask-radial":[St,wt]}],"mask-image-radial-from-pos":[{"mask-radial-from":dt()}],"mask-image-radial-to-pos":[{"mask-radial-to":dt()}],"mask-image-radial-from-color":[{"mask-radial-from":G()}],"mask-image-radial-to-color":[{"mask-radial-to":G()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":E()}],"mask-image-conic-pos":[{"mask-conic":[Bt]}],"mask-image-conic-from-pos":[{"mask-conic-from":dt()}],"mask-image-conic-to-pos":[{"mask-conic-to":dt()}],"mask-image-conic-from-color":[{"mask-conic-from":G()}],"mask-image-conic-to-color":[{"mask-conic-to":G()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:F()}],"mask-size":[{mask:et()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",St,wt]}],filter:[{filter:["","none",St,wt]}],blur:[{blur:Ot()}],brightness:[{brightness:[Bt,St,wt]}],contrast:[{contrast:[Bt,St,wt]}],"drop-shadow":[{"drop-shadow":["","none",b,Ec,Sc]}],"drop-shadow-color":[{"drop-shadow":G()}],grayscale:[{grayscale:["",Bt,St,wt]}],"hue-rotate":[{"hue-rotate":[Bt,St,wt]}],invert:[{invert:["",Bt,St,wt]}],saturate:[{saturate:[Bt,St,wt]}],sepia:[{sepia:["",Bt,St,wt]}],"backdrop-filter":[{"backdrop-filter":["","none",St,wt]}],"backdrop-blur":[{"backdrop-blur":Ot()}],"backdrop-brightness":[{"backdrop-brightness":[Bt,St,wt]}],"backdrop-contrast":[{"backdrop-contrast":[Bt,St,wt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Bt,St,wt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Bt,St,wt]}],"backdrop-invert":[{"backdrop-invert":["",Bt,St,wt]}],"backdrop-opacity":[{"backdrop-opacity":[Bt,St,wt]}],"backdrop-saturate":[{"backdrop-saturate":[Bt,St,wt]}],"backdrop-sepia":[{"backdrop-sepia":["",Bt,St,wt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":D()}],"border-spacing-x":[{"border-spacing-x":D()}],"border-spacing-y":[{"border-spacing-y":D()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",St,wt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Bt,"initial",St,wt]}],ease:[{ease:["linear","initial",S,St,wt]}],delay:[{delay:[Bt,St,wt]}],animate:[{animate:["none",k,St,wt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,St,wt]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:At()}],"rotate-x":[{"rotate-x":At()}],"rotate-y":[{"rotate-y":At()}],"rotate-z":[{"rotate-z":At()}],scale:[{scale:bt()}],"scale-x":[{"scale-x":bt()}],"scale-y":[{"scale-y":bt()}],"scale-z":[{"scale-z":bt()}],"scale-3d":["scale-3d"],skew:[{skew:Tt()}],"skew-x":[{"skew-x":Tt()}],"skew-y":[{"skew-y":Tt()}],transform:[{transform:[St,wt,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Dt()}],"translate-x":[{"translate-x":Dt()}],"translate-y":[{"translate-y":Dt()}],"translate-z":[{"translate-z":Dt()}],"translate-none":["translate-none"],accent:[{accent:G()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:G()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",St,wt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":D()}],"scroll-mx":[{"scroll-mx":D()}],"scroll-my":[{"scroll-my":D()}],"scroll-ms":[{"scroll-ms":D()}],"scroll-me":[{"scroll-me":D()}],"scroll-mbs":[{"scroll-mbs":D()}],"scroll-mbe":[{"scroll-mbe":D()}],"scroll-mt":[{"scroll-mt":D()}],"scroll-mr":[{"scroll-mr":D()}],"scroll-mb":[{"scroll-mb":D()}],"scroll-ml":[{"scroll-ml":D()}],"scroll-p":[{"scroll-p":D()}],"scroll-px":[{"scroll-px":D()}],"scroll-py":[{"scroll-py":D()}],"scroll-ps":[{"scroll-ps":D()}],"scroll-pe":[{"scroll-pe":D()}],"scroll-pbs":[{"scroll-pbs":D()}],"scroll-pbe":[{"scroll-pbe":D()}],"scroll-pt":[{"scroll-pt":D()}],"scroll-pr":[{"scroll-pr":D()}],"scroll-pb":[{"scroll-pb":D()}],"scroll-pl":[{"scroll-pl":D()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",St,wt]}],fill:[{fill:["none",...G()]}],"stroke-w":[{stroke:[Bt,ha,$o,dx]}],stroke:[{stroke:["none",...G()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function jn(...t){return Sz(ex(t))}function Ze({children:t,inputPorts:e=[],outputPorts:n=[],selected:o,className:s,showPortLabels:a,onPortClick:l,glowUnconnected:u}){return M.jsxs("div",{className:jn("relative rounded-lg border-2 bg-[var(--embed-bg-secondary)] shadow-md transition-all",o?"border-blue-500 shadow-lg":"border-[var(--embed-border-node)]",s),children:[e.map(d=>{const h=`${(d.index+1)*100/(e.length+1)}%`,p=u&&!d.connected;return M.jsxs(ko.Fragment,{children:[p&&M.jsx("div",{className:"absolute h-5 w-5 rounded-full animate-ping",style:{top:h,left:"-7px",transform:"translateY(-50%)",background:"radial-gradient(circle, rgba(96,165,250,0.5) 0%, transparent 70%)"}}),M.jsx(jr,{type:"target",position:Nt.Left,id:`in-${d.name}`,className:jn("h-3 w-3 rounded-full border-2 transition-all duration-200",d.connected?"bg-blue-500 border-blue-600":"bg-[var(--embed-bg-tertiary)] border-[var(--embed-border-node)]",p&&"border-blue-400",l&&"cursor-pointer hover:scale-150","hover:bg-blue-300 hover:border-blue-500"),style:{top:h,left:"-6px"},onClick:l?m=>{m.stopPropagation(),l(d.name,"input")}:void 0}),a&&M.jsx("div",{className:"absolute text-[9px] font-mono text-[var(--embed-text-secondary)] pointer-events-none select-none",style:{top:h,left:"10px",transform:"translateY(-50%)"},children:d.name})]},`in-${d.name}`)}),M.jsx("div",{className:"relative px-3 py-2",children:t}),n.map(d=>{const h=`${(d.index+1)*100/(n.length+1)}%`,p=u&&!d.connected;return M.jsxs(ko.Fragment,{children:[p&&M.jsx("div",{className:"absolute h-5 w-5 rounded-full animate-ping",style:{top:h,right:"-7px",transform:"translateY(-50%)",background:"radial-gradient(circle, rgba(74,222,128,0.5) 0%, transparent 70%)"}}),M.jsx(jr,{type:"source",position:Nt.Right,id:`out-${d.name}`,className:jn("h-3 w-3 rounded-full border-2 transition-all duration-200",d.connected?"bg-green-500 border-green-600":"bg-[var(--embed-bg-tertiary)] border-[var(--embed-border-node)]",d.value===!0&&"bg-green-500 border-green-600",d.value===!1&&"bg-gray-300 border-gray-400",p&&"border-green-400",l&&"cursor-pointer hover:scale-150","hover:bg-green-300 hover:border-green-500"),style:{top:h,right:"-6px"},onClick:l?m=>{m.stopPropagation(),l(d.name,"output")}:void 0}),a&&M.jsx("div",{className:"absolute text-[9px] font-mono text-[var(--embed-text-secondary)] pointer-events-none select-none",style:{top:h,right:"10px",transform:"translateY(-50%)",textAlign:"right"},children:d.name})]},`out-${d.name}`)})]})}function _x(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Sx(...t){return e=>{let n=!1;const o=t.map(s=>{const a=_x(s,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<o.length;s++){const a=o[s];typeof a=="function"?a():_x(t[s],null)}}}}function qo(...t){return N.useCallback(Sx(...t),t)}function Ez(t){const e=Cz(t),n=N.forwardRef((o,s)=>{const{children:a,...l}=o,u=N.Children.toArray(a),d=u.find(Nz);if(d){const h=d.props.children,p=u.map(m=>m===d?N.Children.count(h)>1?N.Children.only(null):N.isValidElement(h)?h.props.children:null:m);return M.jsx(e,{...l,ref:s,children:N.isValidElement(h)?N.cloneElement(h,void 0,p):null})}return M.jsx(e,{...l,ref:s,children:a})});return n.displayName=`${t}.Slot`,n}function Cz(t){const e=N.forwardRef((n,o)=>{const{children:s,...a}=n;if(N.isValidElement(s)){const l=Mz(s),u=Az(a,s.props);return s.type!==N.Fragment&&(u.ref=o?Sx(o,l):l),N.cloneElement(s,u)}return N.Children.count(s)>1?N.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Ex=Symbol("radix.slottable");function Tz(t){const e=({children:n})=>M.jsx(M.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=Ex,e}function Nz(t){return N.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Ex}function Az(t,e){const n={...e};for(const o in e){const s=t[o],a=e[o];/^on[A-Z]/.test(o)?s&&a?n[o]=(...u)=>{const d=a(...u);return s(...u),d}:s&&(n[o]=s):o==="style"?n[o]={...s,...a}:o==="className"&&(n[o]=[s,a].filter(Boolean).join(" "))}return{...t,...n}}function Mz(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Rz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Fi=Rz.reduce((t,e)=>{const n=Ez(`Primitive.${e}`),o=N.forwardRef((s,a)=>{const{asChild:l,...u}=s,d=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),M.jsx(d,{...u,ref:a})});return o.displayName=`Primitive.${e}`,{...t,[e]:o}},{});function kz(t,e){t&&Qd.flushSync(()=>t.dispatchEvent(e))}var Oz=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Dz="VisuallyHidden",Cx=N.forwardRef((t,e)=>M.jsx(Fi.span,{...t,ref:e,style:{...Oz,...t.style}}));Cx.displayName=Dz;var jz=Cx;function Tx(t,e=[]){let n=[];function o(a,l){const u=N.createContext(l),d=n.length;n=[...n,l];const h=m=>{const{scope:y,children:b,...x}=m,w=y?.[t]?.[d]||u,_=N.useMemo(()=>x,Object.values(x));return M.jsx(w.Provider,{value:_,children:b})};h.displayName=a+"Provider";function p(m,y){const b=y?.[t]?.[d]||u,x=N.useContext(b);if(x)return x;if(l!==void 0)return l;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[h,p]}const s=()=>{const a=n.map(l=>N.createContext(l));return function(u){const d=u?.[t]||a;return N.useMemo(()=>({[`__scope${t}`]:{...u,[t]:d}}),[u,d])}};return s.scopeName=t,[o,zz(s,...e)]}function zz(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const o=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const l=o.reduce((u,{useScope:d,scopeName:h})=>{const m=d(a)[`__scope${h}`];return{...u,...m}},{});return N.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}function gi(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t?.(s),n===!1||!s.defaultPrevented)return e?.(s)}}var Xi=globalThis?.document?N.useLayoutEffect:()=>{},Vz=T0[" useInsertionEffect ".trim().toString()]||Xi;function Lz({prop:t,defaultProp:e,onChange:n=()=>{},caller:o}){const[s,a,l]=Iz({defaultProp:e,onChange:n}),u=t!==void 0,d=u?t:s;{const p=N.useRef(t!==void 0);N.useEffect(()=>{const m=p.current;m!==u&&console.warn(`${o} is changing from ${m?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=u},[u,o])}const h=N.useCallback(p=>{if(u){const m=Pz(p)?p(t):p;m!==t&&l.current?.(m)}else a(p)},[u,t,a,l]);return[d,h]}function Iz({defaultProp:t,onChange:e}){const[n,o]=N.useState(t),s=N.useRef(n),a=N.useRef(e);return Vz(()=>{a.current=e},[e]),N.useEffect(()=>{s.current!==n&&(a.current?.(n),s.current=n)},[n,s]),[n,o,a]}function Pz(t){return typeof t=="function"}function Bz(t,e){return N.useReducer((n,o)=>e[n][o]??n,t)}var ah=t=>{const{present:e,children:n}=t,o=Hz(e),s=typeof n=="function"?n({present:o.isPresent}):N.Children.only(n),a=qo(o.ref,Uz(s));return typeof n=="function"||o.isPresent?N.cloneElement(s,{ref:a}):null};ah.displayName="Presence";function Hz(t){const[e,n]=N.useState(),o=N.useRef(null),s=N.useRef(t),a=N.useRef("none"),l=t?"mounted":"unmounted",[u,d]=Bz(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return N.useEffect(()=>{const h=Cc(o.current);a.current=u==="mounted"?h:"none"},[u]),Xi(()=>{const h=o.current,p=s.current;if(p!==t){const y=a.current,b=Cc(h);t?d("MOUNT"):b==="none"||h?.display==="none"?d("UNMOUNT"):d(p&&y!==b?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,d]),Xi(()=>{if(e){let h;const p=e.ownerDocument.defaultView??window,m=b=>{const w=Cc(o.current).includes(CSS.escape(b.animationName));if(b.target===e&&w&&(d("ANIMATION_END"),!s.current)){const _=e.style.animationFillMode;e.style.animationFillMode="forwards",h=p.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=_)})}},y=b=>{b.target===e&&(a.current=Cc(o.current))};return e.addEventListener("animationstart",y),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{p.clearTimeout(h),e.removeEventListener("animationstart",y),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[e,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:N.useCallback(h=>{o.current=h?getComputedStyle(h):null,n(h)},[])}}function Cc(t){return t?.animationName||"none"}function Uz(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var $z=T0[" useId ".trim().toString()]||(()=>{}),Yz=0;function qz(t){const[e,n]=N.useState($z());return Xi(()=>{n(o=>o??String(Yz++))},[t]),e?`radix-${e}`:""}function Tc(t){const e=N.useRef(t);return N.useEffect(()=>{e.current=t}),N.useMemo(()=>(...n)=>e.current?.(...n),[])}function Gz(t,e=globalThis?.document){const n=Tc(t);N.useEffect(()=>{const o=s=>{s.key==="Escape"&&n(s)};return e.addEventListener("keydown",o,{capture:!0}),()=>e.removeEventListener("keydown",o,{capture:!0})},[n,e])}var Fz="DismissableLayer",lh="dismissableLayer.update",Xz="dismissableLayer.pointerDownOutside",Zz="dismissableLayer.focusOutside",Nx,Ax=N.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Mx=N.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:l,onDismiss:u,...d}=t,h=N.useContext(Ax),[p,m]=N.useState(null),y=p?.ownerDocument??globalThis?.document,[,b]=N.useState({}),x=qo(e,O=>m(O)),w=Array.from(h.layers),[_]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),S=w.indexOf(_),k=p?w.indexOf(p):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,E=k>=S,R=Wz(O=>{const D=O.target,U=[...h.branches].some(q=>q.contains(D));!E||U||(s?.(O),l?.(O),O.defaultPrevented||u?.())},y),A=Jz(O=>{const D=O.target;[...h.branches].some(q=>q.contains(D))||(a?.(O),l?.(O),O.defaultPrevented||u?.())},y);return Gz(O=>{k===h.layers.size-1&&(o?.(O),!O.defaultPrevented&&u&&(O.preventDefault(),u()))},y),N.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Nx=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),Rx(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=Nx)}},[p,y,n,h]),N.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),Rx())},[p,h]),N.useEffect(()=>{const O=()=>b({});return document.addEventListener(lh,O),()=>document.removeEventListener(lh,O)},[]),M.jsx(Fi.div,{...d,ref:x,style:{pointerEvents:C?E?"auto":"none":void 0,...t.style},onFocusCapture:gi(t.onFocusCapture,A.onFocusCapture),onBlurCapture:gi(t.onBlurCapture,A.onBlurCapture),onPointerDownCapture:gi(t.onPointerDownCapture,R.onPointerDownCapture)})});Mx.displayName=Fz;var Kz="DismissableLayerBranch",Qz=N.forwardRef((t,e)=>{const n=N.useContext(Ax),o=N.useRef(null),s=qo(e,o);return N.useEffect(()=>{const a=o.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),M.jsx(Fi.div,{...t,ref:s})});Qz.displayName=Kz;function Wz(t,e=globalThis?.document){const n=Tc(t),o=N.useRef(!1),s=N.useRef(()=>{});return N.useEffect(()=>{const a=u=>{if(u.target&&!o.current){let d=function(){kx(Xz,n,h,{discrete:!0})};const h={originalEvent:u};u.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=d,e.addEventListener("click",s.current,{once:!0})):d()}else e.removeEventListener("click",s.current);o.current=!1},l=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(l),e.removeEventListener("pointerdown",a),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>o.current=!0}}function Jz(t,e=globalThis?.document){const n=Tc(t),o=N.useRef(!1);return N.useEffect(()=>{const s=a=>{a.target&&!o.current&&kx(Zz,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function Rx(){const t=new CustomEvent(lh);document.dispatchEvent(t)}function kx(t,e,n,{discrete:o}){const s=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),o?kz(s,a):s.dispatchEvent(a)}var t4="Portal",Ox=N.forwardRef((t,e)=>{const{container:n,...o}=t,[s,a]=N.useState(!1);Xi(()=>a(!0),[]);const l=n||s&&globalThis?.document?.body;return l?w5.createPortal(M.jsx(Fi.div,{...o,ref:e}),l):null});Ox.displayName=t4;function e4(t){const[e,n]=N.useState(void 0);return Xi(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const o=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let l,u;if("borderBoxSize"in a){const d=a.borderBoxSize,h=Array.isArray(d)?d[0]:d;l=h.inlineSize,u=h.blockSize}else l=t.offsetWidth,u=t.offsetHeight;n({width:l,height:u})});return o.observe(t,{box:"border-box"}),()=>o.unobserve(t)}else n(void 0)},[t]),e}const n4=["top","right","bottom","left"],Zi=Math.min,an=Math.max,Nc=Math.round,Ac=Math.floor,Qn=t=>({x:t,y:t}),i4={left:"right",right:"left",bottom:"top",top:"bottom"},o4={start:"end",end:"start"};function ch(t,e,n){return an(t,Zi(e,n))}function yi(t,e){return typeof t=="function"?t(e):t}function vi(t){return t.split("-")[0]}function zr(t){return t.split("-")[1]}function uh(t){return t==="x"?"y":"x"}function fh(t){return t==="y"?"height":"width"}const r4=new Set(["top","bottom"]);function Wn(t){return r4.has(vi(t))?"y":"x"}function dh(t){return uh(Wn(t))}function s4(t,e,n){n===void 0&&(n=!1);const o=zr(t),s=dh(t),a=fh(s);let l=s==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(l=Mc(l)),[l,Mc(l)]}function a4(t){const e=Mc(t);return[hh(t),e,hh(e)]}function hh(t){return t.replace(/start|end/g,e=>o4[e])}const Dx=["left","right"],jx=["right","left"],l4=["top","bottom"],c4=["bottom","top"];function u4(t,e,n){switch(t){case"top":case"bottom":return n?e?jx:Dx:e?Dx:jx;case"left":case"right":return e?l4:c4;default:return[]}}function f4(t,e,n,o){const s=zr(t);let a=u4(vi(t),n==="start",o);return s&&(a=a.map(l=>l+"-"+s),e&&(a=a.concat(a.map(hh)))),a}function Mc(t){return t.replace(/left|right|bottom|top/g,e=>i4[e])}function d4(t){return{top:0,right:0,bottom:0,left:0,...t}}function zx(t){return typeof t!="number"?d4(t):{top:t,right:t,bottom:t,left:t}}function Rc(t){const{x:e,y:n,width:o,height:s}=t;return{width:o,height:s,top:n,left:e,right:e+o,bottom:n+s,x:e,y:n}}function Vx(t,e,n){let{reference:o,floating:s}=t;const a=Wn(e),l=dh(e),u=fh(l),d=vi(e),h=a==="y",p=o.x+o.width/2-s.width/2,m=o.y+o.height/2-s.height/2,y=o[u]/2-s[u]/2;let b;switch(d){case"top":b={x:p,y:o.y-s.height};break;case"bottom":b={x:p,y:o.y+o.height};break;case"right":b={x:o.x+o.width,y:m};break;case"left":b={x:o.x-s.width,y:m};break;default:b={x:o.x,y:o.y}}switch(zr(e)){case"start":b[l]-=y*(n&&h?-1:1);break;case"end":b[l]+=y*(n&&h?-1:1);break}return b}async function h4(t,e){var n;e===void 0&&(e={});const{x:o,y:s,platform:a,rects:l,elements:u,strategy:d}=t,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:y=!1,padding:b=0}=yi(e,t),x=zx(b),_=u[y?m==="floating"?"reference":"floating":m],S=Rc(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(_)))==null||n?_:_.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(u.floating)),boundary:h,rootBoundary:p,strategy:d})),k=m==="floating"?{x:o,y:s,width:l.floating.width,height:l.floating.height}:l.reference,C=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u.floating)),E=await(a.isElement==null?void 0:a.isElement(C))?await(a.getScale==null?void 0:a.getScale(C))||{x:1,y:1}:{x:1,y:1},R=Rc(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:k,offsetParent:C,strategy:d}):k);return{top:(S.top-R.top+x.top)/E.y,bottom:(R.bottom-S.bottom+x.bottom)/E.y,left:(S.left-R.left+x.left)/E.x,right:(R.right-S.right+x.right)/E.x}}const p4=async(t,e,n)=>{const{placement:o="bottom",strategy:s="absolute",middleware:a=[],platform:l}=n,u=a.filter(Boolean),d=await(l.isRTL==null?void 0:l.isRTL(e));let h=await l.getElementRects({reference:t,floating:e,strategy:s}),{x:p,y:m}=Vx(h,o,d),y=o,b={},x=0;for(let _=0;_<u.length;_++){var w;const{name:S,fn:k}=u[_],{x:C,y:E,data:R,reset:A}=await k({x:p,y:m,initialPlacement:o,placement:y,strategy:s,middlewareData:b,rects:h,platform:{...l,detectOverflow:(w=l.detectOverflow)!=null?w:h4},elements:{reference:t,floating:e}});p=C??p,m=E??m,b={...b,[S]:{...b[S],...R}},A&&x<=50&&(x++,typeof A=="object"&&(A.placement&&(y=A.placement),A.rects&&(h=A.rects===!0?await l.getElementRects({reference:t,floating:e,strategy:s}):A.rects),{x:p,y:m}=Vx(h,y,d)),_=-1)}return{x:p,y:m,placement:y,strategy:s,middlewareData:b}},m4=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:o,placement:s,rects:a,platform:l,elements:u,middlewareData:d}=e,{element:h,padding:p=0}=yi(t,e)||{};if(h==null)return{};const m=zx(p),y={x:n,y:o},b=dh(s),x=fh(b),w=await l.getDimensions(h),_=b==="y",S=_?"top":"left",k=_?"bottom":"right",C=_?"clientHeight":"clientWidth",E=a.reference[x]+a.reference[b]-y[b]-a.floating[x],R=y[b]-a.reference[b],A=await(l.getOffsetParent==null?void 0:l.getOffsetParent(h));let O=A?A[C]:0;(!O||!await(l.isElement==null?void 0:l.isElement(A)))&&(O=u.floating[C]||a.floating[x]);const D=E/2-R/2,U=O/2-w[x]/2-1,q=Zi(m[S],U),Y=Zi(m[k],U),K=q,W=O-w[x]-Y,B=O/2-w[x]/2+D,H=ch(K,B,W),j=!d.arrow&&zr(s)!=null&&B!==H&&a.reference[x]/2-(B<K?q:Y)-w[x]/2<0,I=j?B<K?B-K:B-W:0;return{[b]:y[b]+I,data:{[b]:H,centerOffset:B-H-I,...j&&{alignmentOffset:I}},reset:j}}}),g4=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,o;const{placement:s,middlewareData:a,rects:l,initialPlacement:u,platform:d,elements:h}=e,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:w=!0,..._}=yi(t,e);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const S=vi(s),k=Wn(u),C=vi(u)===u,E=await(d.isRTL==null?void 0:d.isRTL(h.floating)),R=y||(C||!w?[Mc(u)]:a4(u)),A=x!=="none";!y&&A&&R.push(...f4(u,w,x,E));const O=[u,...R],D=await d.detectOverflow(e,_),U=[];let q=((o=a.flip)==null?void 0:o.overflows)||[];if(p&&U.push(D[S]),m){const B=s4(s,l,E);U.push(D[B[0]],D[B[1]])}if(q=[...q,{placement:s,overflows:U}],!U.every(B=>B<=0)){var Y,K;const B=(((Y=a.flip)==null?void 0:Y.index)||0)+1,H=O[B];if(H&&(!(m==="alignment"?k!==Wn(H):!1)||q.every(z=>Wn(z.placement)===k?z.overflows[0]>0:!0)))return{data:{index:B,overflows:q},reset:{placement:H}};let j=(K=q.filter(I=>I.overflows[0]<=0).sort((I,z)=>I.overflows[1]-z.overflows[1])[0])==null?void 0:K.placement;if(!j)switch(b){case"bestFit":{var W;const I=(W=q.filter(z=>{if(A){const $=Wn(z.placement);return $===k||$==="y"}return!0}).map(z=>[z.placement,z.overflows.filter($=>$>0).reduce(($,G)=>$+G,0)]).sort((z,$)=>z[1]-$[1])[0])==null?void 0:W[0];I&&(j=I);break}case"initialPlacement":j=u;break}if(s!==j)return{reset:{placement:j}}}return{}}}};function Lx(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ix(t){return n4.some(e=>t[e]>=0)}const y4=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:o}=e,{strategy:s="referenceHidden",...a}=yi(t,e);switch(s){case"referenceHidden":{const l=await o.detectOverflow(e,{...a,elementContext:"reference"}),u=Lx(l,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Ix(u)}}}case"escaped":{const l=await o.detectOverflow(e,{...a,altBoundary:!0}),u=Lx(l,n.floating);return{data:{escapedOffsets:u,escaped:Ix(u)}}}default:return{}}}}},Px=new Set(["left","top"]);async function v4(t,e){const{placement:n,platform:o,elements:s}=t,a=await(o.isRTL==null?void 0:o.isRTL(s.floating)),l=vi(n),u=zr(n),d=Wn(n)==="y",h=Px.has(l)?-1:1,p=a&&d?-1:1,m=yi(e,t);let{mainAxis:y,crossAxis:b,alignmentAxis:x}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof x=="number"&&(b=u==="end"?x*-1:x),d?{x:b*p,y:y*h}:{x:y*h,y:b*p}}const b4=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,o;const{x:s,y:a,placement:l,middlewareData:u}=e,d=await v4(e,t);return l===((n=u.offset)==null?void 0:n.placement)&&(o=u.arrow)!=null&&o.alignmentOffset?{}:{x:s+d.x,y:a+d.y,data:{...d,placement:l}}}}},x4=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:o,placement:s,platform:a}=e,{mainAxis:l=!0,crossAxis:u=!1,limiter:d={fn:S=>{let{x:k,y:C}=S;return{x:k,y:C}}},...h}=yi(t,e),p={x:n,y:o},m=await a.detectOverflow(e,h),y=Wn(vi(s)),b=uh(y);let x=p[b],w=p[y];if(l){const S=b==="y"?"top":"left",k=b==="y"?"bottom":"right",C=x+m[S],E=x-m[k];x=ch(C,x,E)}if(u){const S=y==="y"?"top":"left",k=y==="y"?"bottom":"right",C=w+m[S],E=w-m[k];w=ch(C,w,E)}const _=d.fn({...e,[b]:x,[y]:w});return{..._,data:{x:_.x-n,y:_.y-o,enabled:{[b]:l,[y]:u}}}}}},w4=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:o,placement:s,rects:a,middlewareData:l}=e,{offset:u=0,mainAxis:d=!0,crossAxis:h=!0}=yi(t,e),p={x:n,y:o},m=Wn(s),y=uh(m);let b=p[y],x=p[m];const w=yi(u,e),_=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(d){const C=y==="y"?"height":"width",E=a.reference[y]-a.floating[C]+_.mainAxis,R=a.reference[y]+a.reference[C]-_.mainAxis;b<E?b=E:b>R&&(b=R)}if(h){var S,k;const C=y==="y"?"width":"height",E=Px.has(vi(s)),R=a.reference[m]-a.floating[C]+(E&&((S=l.offset)==null?void 0:S[m])||0)+(E?0:_.crossAxis),A=a.reference[m]+a.reference[C]+(E?0:((k=l.offset)==null?void 0:k[m])||0)-(E?_.crossAxis:0);x<R?x=R:x>A&&(x=A)}return{[y]:b,[m]:x}}}},_4=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,o;const{placement:s,rects:a,platform:l,elements:u}=e,{apply:d=()=>{},...h}=yi(t,e),p=await l.detectOverflow(e,h),m=vi(s),y=zr(s),b=Wn(s)==="y",{width:x,height:w}=a.floating;let _,S;m==="top"||m==="bottom"?(_=m,S=y===(await(l.isRTL==null?void 0:l.isRTL(u.floating))?"start":"end")?"left":"right"):(S=m,_=y==="end"?"top":"bottom");const k=w-p.top-p.bottom,C=x-p.left-p.right,E=Zi(w-p[_],k),R=Zi(x-p[S],C),A=!e.middlewareData.shift;let O=E,D=R;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(D=C),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(O=k),A&&!y){const q=an(p.left,0),Y=an(p.right,0),K=an(p.top,0),W=an(p.bottom,0);b?D=x-2*(q!==0||Y!==0?q+Y:an(p.left,p.right)):O=w-2*(K!==0||W!==0?K+W:an(p.top,p.bottom))}await d({...e,availableWidth:D,availableHeight:O});const U=await l.getDimensions(u.floating);return x!==U.width||w!==U.height?{reset:{rects:!0}}:{}}}};function kc(){return typeof window<"u"}function Vr(t){return Bx(t)?(t.nodeName||"").toLowerCase():"#document"}function ln(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Jn(t){var e;return(e=(Bx(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Bx(t){return kc()?t instanceof Node||t instanceof ln(t).Node:!1}function zn(t){return kc()?t instanceof Element||t instanceof ln(t).Element:!1}function ti(t){return kc()?t instanceof HTMLElement||t instanceof ln(t).HTMLElement:!1}function Hx(t){return!kc()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof ln(t).ShadowRoot}const S4=new Set(["inline","contents"]);function pa(t){const{overflow:e,overflowX:n,overflowY:o,display:s}=Vn(t);return/auto|scroll|overlay|hidden|clip/.test(e+o+n)&&!S4.has(s)}const E4=new Set(["table","td","th"]);function C4(t){return E4.has(Vr(t))}const T4=[":popover-open",":modal"];function Oc(t){return T4.some(e=>{try{return t.matches(e)}catch{return!1}})}const N4=["transform","translate","scale","rotate","perspective"],A4=["transform","translate","scale","rotate","perspective","filter"],M4=["paint","layout","strict","content"];function ph(t){const e=mh(),n=zn(t)?Vn(t):t;return N4.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||A4.some(o=>(n.willChange||"").includes(o))||M4.some(o=>(n.contain||"").includes(o))}function R4(t){let e=Ki(t);for(;ti(e)&&!Lr(e);){if(ph(e))return e;if(Oc(e))return null;e=Ki(e)}return null}function mh(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const k4=new Set(["html","body","#document"]);function Lr(t){return k4.has(Vr(t))}function Vn(t){return ln(t).getComputedStyle(t)}function Dc(t){return zn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ki(t){if(Vr(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Hx(t)&&t.host||Jn(t);return Hx(e)?e.host:e}function Ux(t){const e=Ki(t);return Lr(e)?t.ownerDocument?t.ownerDocument.body:t.body:ti(e)&&pa(e)?e:Ux(e)}function ma(t,e,n){var o;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=Ux(t),a=s===((o=t.ownerDocument)==null?void 0:o.body),l=ln(s);if(a){const u=gh(l);return e.concat(l,l.visualViewport||[],pa(s)?s:[],u&&n?ma(u):[])}return e.concat(s,ma(s,[],n))}function gh(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function $x(t){const e=Vn(t);let n=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const s=ti(t),a=s?t.offsetWidth:n,l=s?t.offsetHeight:o,u=Nc(n)!==a||Nc(o)!==l;return u&&(n=a,o=l),{width:n,height:o,$:u}}function yh(t){return zn(t)?t:t.contextElement}function Ir(t){const e=yh(t);if(!ti(e))return Qn(1);const n=e.getBoundingClientRect(),{width:o,height:s,$:a}=$x(e);let l=(a?Nc(n.width):n.width)/o,u=(a?Nc(n.height):n.height)/s;return(!l||!Number.isFinite(l))&&(l=1),(!u||!Number.isFinite(u))&&(u=1),{x:l,y:u}}const O4=Qn(0);function Yx(t){const e=ln(t);return!mh()||!e.visualViewport?O4:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function D4(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==ln(t)?!1:e}function Go(t,e,n,o){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=yh(t);let l=Qn(1);e&&(o?zn(o)&&(l=Ir(o)):l=Ir(t));const u=D4(a,n,o)?Yx(a):Qn(0);let d=(s.left+u.x)/l.x,h=(s.top+u.y)/l.y,p=s.width/l.x,m=s.height/l.y;if(a){const y=ln(a),b=o&&zn(o)?ln(o):o;let x=y,w=gh(x);for(;w&&o&&b!==x;){const _=Ir(w),S=w.getBoundingClientRect(),k=Vn(w),C=S.left+(w.clientLeft+parseFloat(k.paddingLeft))*_.x,E=S.top+(w.clientTop+parseFloat(k.paddingTop))*_.y;d*=_.x,h*=_.y,p*=_.x,m*=_.y,d+=C,h+=E,x=ln(w),w=gh(x)}}return Rc({width:p,height:m,x:d,y:h})}function jc(t,e){const n=Dc(t).scrollLeft;return e?e.left+n:Go(Jn(t)).left+n}function qx(t,e){const n=t.getBoundingClientRect(),o=n.left+e.scrollLeft-jc(t,n),s=n.top+e.scrollTop;return{x:o,y:s}}function j4(t){let{elements:e,rect:n,offsetParent:o,strategy:s}=t;const a=s==="fixed",l=Jn(o),u=e?Oc(e.floating):!1;if(o===l||u&&a)return n;let d={scrollLeft:0,scrollTop:0},h=Qn(1);const p=Qn(0),m=ti(o);if((m||!m&&!a)&&((Vr(o)!=="body"||pa(l))&&(d=Dc(o)),ti(o))){const b=Go(o);h=Ir(o),p.x=b.x+o.clientLeft,p.y=b.y+o.clientTop}const y=l&&!m&&!a?qx(l,d):Qn(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-d.scrollLeft*h.x+p.x+y.x,y:n.y*h.y-d.scrollTop*h.y+p.y+y.y}}function z4(t){return Array.from(t.getClientRects())}function V4(t){const e=Jn(t),n=Dc(t),o=t.ownerDocument.body,s=an(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),a=an(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let l=-n.scrollLeft+jc(t);const u=-n.scrollTop;return Vn(o).direction==="rtl"&&(l+=an(e.clientWidth,o.clientWidth)-s),{width:s,height:a,x:l,y:u}}const Gx=25;function L4(t,e){const n=ln(t),o=Jn(t),s=n.visualViewport;let a=o.clientWidth,l=o.clientHeight,u=0,d=0;if(s){a=s.width,l=s.height;const p=mh();(!p||p&&e==="fixed")&&(u=s.offsetLeft,d=s.offsetTop)}const h=jc(o);if(h<=0){const p=o.ownerDocument,m=p.body,y=getComputedStyle(m),b=p.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,x=Math.abs(o.clientWidth-m.clientWidth-b);x<=Gx&&(a-=x)}else h<=Gx&&(a+=h);return{width:a,height:l,x:u,y:d}}const I4=new Set(["absolute","fixed"]);function P4(t,e){const n=Go(t,!0,e==="fixed"),o=n.top+t.clientTop,s=n.left+t.clientLeft,a=ti(t)?Ir(t):Qn(1),l=t.clientWidth*a.x,u=t.clientHeight*a.y,d=s*a.x,h=o*a.y;return{width:l,height:u,x:d,y:h}}function Fx(t,e,n){let o;if(e==="viewport")o=L4(t,n);else if(e==="document")o=V4(Jn(t));else if(zn(e))o=P4(e,n);else{const s=Yx(t);o={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Rc(o)}function Xx(t,e){const n=Ki(t);return n===e||!zn(n)||Lr(n)?!1:Vn(n).position==="fixed"||Xx(n,e)}function B4(t,e){const n=e.get(t);if(n)return n;let o=ma(t,[],!1).filter(u=>zn(u)&&Vr(u)!=="body"),s=null;const a=Vn(t).position==="fixed";let l=a?Ki(t):t;for(;zn(l)&&!Lr(l);){const u=Vn(l),d=ph(l);!d&&u.position==="fixed"&&(s=null),(a?!d&&!s:!d&&u.position==="static"&&!!s&&I4.has(s.position)||pa(l)&&!d&&Xx(t,l))?o=o.filter(p=>p!==l):s=u,l=Ki(l)}return e.set(t,o),o}function H4(t){let{element:e,boundary:n,rootBoundary:o,strategy:s}=t;const l=[...n==="clippingAncestors"?Oc(e)?[]:B4(e,this._c):[].concat(n),o],u=l[0],d=l.reduce((h,p)=>{const m=Fx(e,p,s);return h.top=an(m.top,h.top),h.right=Zi(m.right,h.right),h.bottom=Zi(m.bottom,h.bottom),h.left=an(m.left,h.left),h},Fx(e,u,s));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function U4(t){const{width:e,height:n}=$x(t);return{width:e,height:n}}function $4(t,e,n){const o=ti(e),s=Jn(e),a=n==="fixed",l=Go(t,!0,a,e);let u={scrollLeft:0,scrollTop:0};const d=Qn(0);function h(){d.x=jc(s)}if(o||!o&&!a)if((Vr(e)!=="body"||pa(s))&&(u=Dc(e)),o){const b=Go(e,!0,a,e);d.x=b.x+e.clientLeft,d.y=b.y+e.clientTop}else s&&h();a&&!o&&s&&h();const p=s&&!o&&!a?qx(s,u):Qn(0),m=l.left+u.scrollLeft-d.x-p.x,y=l.top+u.scrollTop-d.y-p.y;return{x:m,y,width:l.width,height:l.height}}function vh(t){return Vn(t).position==="static"}function Zx(t,e){if(!ti(t)||Vn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Jn(t)===n&&(n=n.ownerDocument.body),n}function Kx(t,e){const n=ln(t);if(Oc(t))return n;if(!ti(t)){let s=Ki(t);for(;s&&!Lr(s);){if(zn(s)&&!vh(s))return s;s=Ki(s)}return n}let o=Zx(t,e);for(;o&&C4(o)&&vh(o);)o=Zx(o,e);return o&&Lr(o)&&vh(o)&&!ph(o)?n:o||R4(t)||n}const Y4=async function(t){const e=this.getOffsetParent||Kx,n=this.getDimensions,o=await n(t.floating);return{reference:$4(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function q4(t){return Vn(t).direction==="rtl"}const G4={convertOffsetParentRelativeRectToViewportRelativeRect:j4,getDocumentElement:Jn,getClippingRect:H4,getOffsetParent:Kx,getElementRects:Y4,getClientRects:z4,getDimensions:U4,getScale:Ir,isElement:zn,isRTL:q4};function Qx(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function F4(t,e){let n=null,o;const s=Jn(t);function a(){var u;clearTimeout(o),(u=n)==null||u.disconnect(),n=null}function l(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),a();const h=t.getBoundingClientRect(),{left:p,top:m,width:y,height:b}=h;if(u||e(),!y||!b)return;const x=Ac(m),w=Ac(s.clientWidth-(p+y)),_=Ac(s.clientHeight-(m+b)),S=Ac(p),C={rootMargin:-x+"px "+-w+"px "+-_+"px "+-S+"px",threshold:an(0,Zi(1,d))||1};let E=!0;function R(A){const O=A[0].intersectionRatio;if(O!==d){if(!E)return l();O?l(!1,O):o=setTimeout(()=>{l(!1,1e-7)},1e3)}O===1&&!Qx(h,t.getBoundingClientRect())&&l(),E=!1}try{n=new IntersectionObserver(R,{...C,root:s.ownerDocument})}catch{n=new IntersectionObserver(R,C)}n.observe(t)}return l(!0),a}function X4(t,e,n,o){o===void 0&&(o={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=o,h=yh(t),p=s||a?[...h?ma(h):[],...ma(e)]:[];p.forEach(S=>{s&&S.addEventListener("scroll",n,{passive:!0}),a&&S.addEventListener("resize",n)});const m=h&&u?F4(h,n):null;let y=-1,b=null;l&&(b=new ResizeObserver(S=>{let[k]=S;k&&k.target===h&&b&&(b.unobserve(e),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var C;(C=b)==null||C.observe(e)})),n()}),h&&!d&&b.observe(h),b.observe(e));let x,w=d?Go(t):null;d&&_();function _(){const S=Go(t);w&&!Qx(w,S)&&n(),w=S,x=requestAnimationFrame(_)}return n(),()=>{var S;p.forEach(k=>{s&&k.removeEventListener("scroll",n),a&&k.removeEventListener("resize",n)}),m?.(),(S=b)==null||S.disconnect(),b=null,d&&cancelAnimationFrame(x)}}const Z4=b4,K4=x4,Q4=g4,W4=_4,J4=y4,Wx=m4,tV=w4,eV=(t,e,n)=>{const o=new Map,s={platform:G4,...n},a={...s.platform,_c:o};return p4(t,e,{...s,platform:a})};var nV=typeof document<"u",iV=function(){},zc=nV?N.useLayoutEffect:iV;function Vc(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,o,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(o=n;o--!==0;)if(!Vc(t[o],e[o]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(o=n;o--!==0;)if(!{}.hasOwnProperty.call(e,s[o]))return!1;for(o=n;o--!==0;){const a=s[o];if(!(a==="_owner"&&t.$$typeof)&&!Vc(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function Jx(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function tw(t,e){const n=Jx(t);return Math.round(e*n)/n}function bh(t){const e=N.useRef(t);return zc(()=>{e.current=t}),e}function oV(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:o=[],platform:s,elements:{reference:a,floating:l}={},transform:u=!0,whileElementsMounted:d,open:h}=t,[p,m]=N.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[y,b]=N.useState(o);Vc(y,o)||b(o);const[x,w]=N.useState(null),[_,S]=N.useState(null),k=N.useCallback(z=>{z!==A.current&&(A.current=z,w(z))},[]),C=N.useCallback(z=>{z!==O.current&&(O.current=z,S(z))},[]),E=a||x,R=l||_,A=N.useRef(null),O=N.useRef(null),D=N.useRef(p),U=d!=null,q=bh(d),Y=bh(s),K=bh(h),W=N.useCallback(()=>{if(!A.current||!O.current)return;const z={placement:e,strategy:n,middleware:y};Y.current&&(z.platform=Y.current),eV(A.current,O.current,z).then($=>{const G={...$,isPositioned:K.current!==!1};B.current&&!Vc(D.current,G)&&(D.current=G,Qd.flushSync(()=>{m(G)}))})},[y,e,n,Y,K]);zc(()=>{h===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,m(z=>({...z,isPositioned:!1})))},[h]);const B=N.useRef(!1);zc(()=>(B.current=!0,()=>{B.current=!1}),[]),zc(()=>{if(E&&(A.current=E),R&&(O.current=R),E&&R){if(q.current)return q.current(E,R,W);W()}},[E,R,W,q,U]);const H=N.useMemo(()=>({reference:A,floating:O,setReference:k,setFloating:C}),[k,C]),j=N.useMemo(()=>({reference:E,floating:R}),[E,R]),I=N.useMemo(()=>{const z={position:n,left:0,top:0};if(!j.floating)return z;const $=tw(j.floating,p.x),G=tw(j.floating,p.y);return u?{...z,transform:"translate("+$+"px, "+G+"px)",...Jx(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:$,top:G}},[n,u,j.floating,p.x,p.y]);return N.useMemo(()=>({...p,update:W,refs:H,elements:j,floatingStyles:I}),[p,W,H,j,I])}const rV=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:o,padding:s}=typeof t=="function"?t(n):t;return o&&e(o)?o.current!=null?Wx({element:o.current,padding:s}).fn(n):{}:o?Wx({element:o,padding:s}).fn(n):{}}}},sV=(t,e)=>({...Z4(t),options:[t,e]}),aV=(t,e)=>({...K4(t),options:[t,e]}),lV=(t,e)=>({...tV(t),options:[t,e]}),cV=(t,e)=>({...Q4(t),options:[t,e]}),uV=(t,e)=>({...W4(t),options:[t,e]}),fV=(t,e)=>({...J4(t),options:[t,e]}),dV=(t,e)=>({...rV(t),options:[t,e]});var hV="Arrow",ew=N.forwardRef((t,e)=>{const{children:n,width:o=10,height:s=5,...a}=t;return M.jsx(Fi.svg,{...a,ref:e,width:o,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:M.jsx("polygon",{points:"0,0 30,0 15,10"})})});ew.displayName=hV;var pV=ew,xh="Popper",[nw,iw]=Tx(xh),[mV,ow]=nw(xh),rw=t=>{const{__scopePopper:e,children:n}=t,[o,s]=N.useState(null);return M.jsx(mV,{scope:e,anchor:o,onAnchorChange:s,children:n})};rw.displayName=xh;var sw="PopperAnchor",aw=N.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:o,...s}=t,a=ow(sw,n),l=N.useRef(null),u=qo(e,l),d=N.useRef(null);return N.useEffect(()=>{const h=d.current;d.current=o?.current||l.current,h!==d.current&&a.onAnchorChange(d.current)}),o?null:M.jsx(Fi.div,{...s,ref:u})});aw.displayName=sw;var wh="PopperContent",[gV,yV]=nw(wh),lw=N.forwardRef((t,e)=>{const{__scopePopper:n,side:o="bottom",sideOffset:s=0,align:a="center",alignOffset:l=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:h=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:x,...w}=t,_=ow(wh,n),[S,k]=N.useState(null),C=qo(e,ft=>k(ft)),[E,R]=N.useState(null),A=e4(E),O=A?.width??0,D=A?.height??0,U=o+(a!=="center"?"-"+a:""),q=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},Y=Array.isArray(h)?h:[h],K=Y.length>0,W={padding:q,boundary:Y.filter(bV),altBoundary:K},{refs:B,floatingStyles:H,placement:j,isPositioned:I,middlewareData:z}=oV({strategy:"fixed",placement:U,whileElementsMounted:(...ft)=>X4(...ft,{animationFrame:b==="always"}),elements:{reference:_.anchor},middleware:[sV({mainAxis:s+D,alignmentAxis:l}),d&&aV({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?lV():void 0,...W}),d&&cV({...W}),uV({...W,apply:({elements:ft,rects:ut,availableWidth:dt,availableHeight:Ot})=>{const{width:At,height:bt}=ut.reference,Tt=ft.floating.style;Tt.setProperty("--radix-popper-available-width",`${dt}px`),Tt.setProperty("--radix-popper-available-height",`${Ot}px`),Tt.setProperty("--radix-popper-anchor-width",`${At}px`),Tt.setProperty("--radix-popper-anchor-height",`${bt}px`)}}),E&&dV({element:E,padding:u}),xV({arrowWidth:O,arrowHeight:D}),y&&fV({strategy:"referenceHidden",...W})]}),[$,G]=fw(j),L=Tc(x);Xi(()=>{I&&L?.()},[I,L]);const F=z.arrow?.x,et=z.arrow?.y,rt=z.arrow?.centerOffset!==0,[ct,ht]=N.useState();return Xi(()=>{S&&ht(window.getComputedStyle(S).zIndex)},[S]),M.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...H,transform:I?H.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ct,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(" "),...z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:M.jsx(gV,{scope:n,placedSide:$,onArrowChange:R,arrowX:F,arrowY:et,shouldHideArrow:rt,children:M.jsx(Fi.div,{"data-side":$,"data-align":G,...w,ref:C,style:{...w.style,animation:I?void 0:"none"}})})})});lw.displayName=wh;var cw="PopperArrow",vV={top:"bottom",right:"left",bottom:"top",left:"right"},uw=N.forwardRef(function(e,n){const{__scopePopper:o,...s}=e,a=yV(cw,o),l=vV[a.placedSide];return M.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[l]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:M.jsx(pV,{...s,ref:n,style:{...s.style,display:"block"}})})});uw.displayName=cw;function bV(t){return t!==null}var xV=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:o,middlewareData:s}=e,l=s.arrow?.centerOffset!==0,u=l?0:t.arrowWidth,d=l?0:t.arrowHeight,[h,p]=fw(n),m={start:"0%",center:"50%",end:"100%"}[p],y=(s.arrow?.x??0)+u/2,b=(s.arrow?.y??0)+d/2;let x="",w="";return h==="bottom"?(x=l?m:`${y}px`,w=`${-d}px`):h==="top"?(x=l?m:`${y}px`,w=`${o.floating.height+d}px`):h==="right"?(x=`${-d}px`,w=l?m:`${b}px`):h==="left"&&(x=`${o.floating.width+d}px`,w=l?m:`${b}px`),{data:{x,y:w}}}});function fw(t){const[e,n="center"]=t.split("-");return[e,n]}var wV=rw,_V=aw,SV=lw,EV=uw,[Lc]=Tx("Tooltip",[iw]),Ic=iw(),dw="TooltipProvider",CV=700,_h="tooltip.open",[TV,Sh]=Lc(dw),hw=t=>{const{__scopeTooltip:e,delayDuration:n=CV,skipDelayDuration:o=300,disableHoverableContent:s=!1,children:a}=t,l=N.useRef(!0),u=N.useRef(!1),d=N.useRef(0);return N.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),M.jsx(TV,{scope:e,isOpenDelayedRef:l,delayDuration:n,onOpen:N.useCallback(()=>{window.clearTimeout(d.current),l.current=!1},[]),onClose:N.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>l.current=!0,o)},[o]),isPointerInTransitRef:u,onPointerInTransitChange:N.useCallback(h=>{u.current=h},[]),disableHoverableContent:s,children:a})};hw.displayName=dw;var ga="Tooltip",[NV,ya]=Lc(ga),pw=t=>{const{__scopeTooltip:e,children:n,open:o,defaultOpen:s,onOpenChange:a,disableHoverableContent:l,delayDuration:u}=t,d=Sh(ga,t.__scopeTooltip),h=Ic(e),[p,m]=N.useState(null),y=qz(),b=N.useRef(0),x=l??d.disableHoverableContent,w=u??d.delayDuration,_=N.useRef(!1),[S,k]=Lz({prop:o,defaultProp:s??!1,onChange:O=>{O?(d.onOpen(),document.dispatchEvent(new CustomEvent(_h))):d.onClose(),a?.(O)},caller:ga}),C=N.useMemo(()=>S?_.current?"delayed-open":"instant-open":"closed",[S]),E=N.useCallback(()=>{window.clearTimeout(b.current),b.current=0,_.current=!1,k(!0)},[k]),R=N.useCallback(()=>{window.clearTimeout(b.current),b.current=0,k(!1)},[k]),A=N.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{_.current=!0,k(!0),b.current=0},w)},[w,k]);return N.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),M.jsx(wV,{...h,children:M.jsx(NV,{scope:e,contentId:y,open:S,stateAttribute:C,trigger:p,onTriggerChange:m,onTriggerEnter:N.useCallback(()=>{d.isOpenDelayedRef.current?A():E()},[d.isOpenDelayedRef,A,E]),onTriggerLeave:N.useCallback(()=>{x?R():(window.clearTimeout(b.current),b.current=0)},[R,x]),onOpen:E,onClose:R,disableHoverableContent:x,children:n})})};pw.displayName=ga;var Eh="TooltipTrigger",mw=N.forwardRef((t,e)=>{const{__scopeTooltip:n,...o}=t,s=ya(Eh,n),a=Sh(Eh,n),l=Ic(n),u=N.useRef(null),d=qo(e,u,s.onTriggerChange),h=N.useRef(!1),p=N.useRef(!1),m=N.useCallback(()=>h.current=!1,[]);return N.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),M.jsx(_V,{asChild:!0,...l,children:M.jsx(Fi.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...o,ref:d,onPointerMove:gi(t.onPointerMove,y=>{y.pointerType!=="touch"&&!p.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),p.current=!0)}),onPointerLeave:gi(t.onPointerLeave,()=>{s.onTriggerLeave(),p.current=!1}),onPointerDown:gi(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:gi(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:gi(t.onBlur,s.onClose),onClick:gi(t.onClick,s.onClose)})})});mw.displayName=Eh;var Ch="TooltipPortal",[AV,MV]=Lc(Ch,{forceMount:void 0}),gw=t=>{const{__scopeTooltip:e,forceMount:n,children:o,container:s}=t,a=ya(Ch,e);return M.jsx(AV,{scope:e,forceMount:n,children:M.jsx(ah,{present:n||a.open,children:M.jsx(Ox,{asChild:!0,container:s,children:o})})})};gw.displayName=Ch;var Pr="TooltipContent",yw=N.forwardRef((t,e)=>{const n=MV(Pr,t.__scopeTooltip),{forceMount:o=n.forceMount,side:s="top",...a}=t,l=ya(Pr,t.__scopeTooltip);return M.jsx(ah,{present:o||l.open,children:l.disableHoverableContent?M.jsx(vw,{side:s,...a,ref:e}):M.jsx(RV,{side:s,...a,ref:e})})}),RV=N.forwardRef((t,e)=>{const n=ya(Pr,t.__scopeTooltip),o=Sh(Pr,t.__scopeTooltip),s=N.useRef(null),a=qo(e,s),[l,u]=N.useState(null),{trigger:d,onClose:h}=n,p=s.current,{onPointerInTransitChange:m}=o,y=N.useCallback(()=>{u(null),m(!1)},[m]),b=N.useCallback((x,w)=>{const _=x.currentTarget,S={x:x.clientX,y:x.clientY},k=jV(S,_.getBoundingClientRect()),C=zV(S,k),E=VV(w.getBoundingClientRect()),R=IV([...C,...E]);u(R),m(!0)},[m]);return N.useEffect(()=>()=>y(),[y]),N.useEffect(()=>{if(d&&p){const x=_=>b(_,p),w=_=>b(_,d);return d.addEventListener("pointerleave",x),p.addEventListener("pointerleave",w),()=>{d.removeEventListener("pointerleave",x),p.removeEventListener("pointerleave",w)}}},[d,p,b,y]),N.useEffect(()=>{if(l){const x=w=>{const _=w.target,S={x:w.clientX,y:w.clientY},k=d?.contains(_)||p?.contains(_),C=!LV(S,l);k?y():C&&(y(),h())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[d,p,l,h,y]),M.jsx(vw,{...t,ref:a})}),[kV,OV]=Lc(ga,{isInside:!1}),DV=Tz("TooltipContent"),vw=N.forwardRef((t,e)=>{const{__scopeTooltip:n,children:o,"aria-label":s,onEscapeKeyDown:a,onPointerDownOutside:l,...u}=t,d=ya(Pr,n),h=Ic(n),{onClose:p}=d;return N.useEffect(()=>(document.addEventListener(_h,p),()=>document.removeEventListener(_h,p)),[p]),N.useEffect(()=>{if(d.trigger){const m=y=>{y.target?.contains(d.trigger)&&p()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[d.trigger,p]),M.jsx(Mx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:l,onFocusOutside:m=>m.preventDefault(),onDismiss:p,children:M.jsxs(SV,{"data-state":d.stateAttribute,...h,...u,ref:e,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[M.jsx(DV,{children:o}),M.jsx(kV,{scope:n,isInside:!0,children:M.jsx(jz,{id:d.contentId,role:"tooltip",children:s||o})})]})})});yw.displayName=Pr;var bw="TooltipArrow",xw=N.forwardRef((t,e)=>{const{__scopeTooltip:n,...o}=t,s=Ic(n);return OV(bw,n).isInside?null:M.jsx(EV,{...s,...o,ref:e})});xw.displayName=bw;function jV(t,e){const n=Math.abs(e.top-t.y),o=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),a=Math.abs(e.left-t.x);switch(Math.min(n,o,s,a)){case a:return"left";case s:return"right";case n:return"top";case o:return"bottom";default:throw new Error("unreachable")}}function zV(t,e,n=5){const o=[];switch(e){case"top":o.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":o.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":o.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":o.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return o}function VV(t){const{top:e,right:n,bottom:o,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:o},{x:s,y:o}]}function LV(t,e){const{x:n,y:o}=t;let s=!1;for(let a=0,l=e.length-1;a<e.length;l=a++){const u=e[a],d=e[l],h=u.x,p=u.y,m=d.x,y=d.y;p>o!=y>o&&n<(m-h)*(o-p)/(y-p)+h&&(s=!s)}return s}function IV(t){const e=t.slice();return e.sort((n,o)=>n.x<o.x?-1:n.x>o.x?1:n.y<o.y?-1:n.y>o.y?1:0),PV(e)}function PV(t){if(t.length<=1)return t.slice();const e=[];for(let o=0;o<t.length;o++){const s=t[o];for(;e.length>=2;){const a=e[e.length-1],l=e[e.length-2];if((a.x-l.x)*(s.y-l.y)>=(a.y-l.y)*(s.x-l.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let o=t.length-1;o>=0;o--){const s=t[o];for(;n.length>=2;){const a=n[n.length-1],l=n[n.length-2];if((a.x-l.x)*(s.y-l.y)>=(a.y-l.y)*(s.x-l.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var BV=hw,HV=pw,UV=mw,$V=gw,YV=yw,qV=xw;function ww({delayDuration:t=0,...e}){return M.jsx(BV,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function _w({...t}){return M.jsx(HV,{"data-slot":"tooltip",...t})}function Sw({...t}){return M.jsx(UV,{"data-slot":"tooltip-trigger",...t})}function Ew({className:t,sideOffset:e=0,children:n,...o}){return M.jsx($V,{children:M.jsxs(YV,{"data-slot":"tooltip-content",sideOffset:e,className:jn("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...o,children:[n,M.jsx(qV,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function Br(){return M.jsx(ww,{delayDuration:200,children:M.jsxs(_w,{children:[M.jsx(Sw,{asChild:!0,children:M.jsxs("div",{className:"absolute -top-2 -right-2 flex h-6 w-6 items-center justify-center cursor-pointer group",children:[M.jsx("span",{className:"absolute inset-0 rounded-full bg-blue-400/30 animate-[ping_2s_cubic-bezier(0,0,0.2,1)_infinite]"}),M.jsx("span",{className:"relative flex h-5 w-5 items-center justify-center rounded-full bg-blue-500 group-hover:bg-blue-400 transition-colors shadow-sm shadow-blue-500/30",children:M.jsxs("svg",{className:"h-3 w-3 text-white",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[M.jsx("circle",{cx:"6.5",cy:"6.5",r:"4.5"}),M.jsx("line",{x1:"10",y1:"10",x2:"14",y2:"14"})]})})]})}),M.jsx(Ew,{side:"top",sideOffset:4,children:"Double-click to inspect"})]})})}function GV({data:t}){const e=t.width??8,n=(1<<Math.min(e,31))-1,o=t.numericValue??0,[s,a]=N.useState(!1),[l,u]=N.useState(""),d=N.useCallback(x=>{const w=Math.max(0,Math.min(n,x));t.onValueChange?.(w)},[t,n]),h=N.useCallback(x=>{x.stopPropagation(),u(o.toString()),a(!0)},[o]),p=N.useCallback(()=>{const x=parseInt(l,10);isNaN(x)||d(x),a(!1)},[l,d]),m=N.useCallback(x=>{x.stopPropagation(),x.key==="Enter"?p():x.key==="Escape"&&a(!1)},[p]),y=Math.ceil(e/4),b=o.toString(16).toUpperCase().padStart(y,"0");return M.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[M.jsxs("div",{className:"flex items-center gap-1",children:[M.jsx("button",{onClick:x=>{x.stopPropagation(),d(o-1)},"aria-label":"Decrease value",className:"w-6 h-6 flex items-center justify-center rounded bg-[var(--embed-bg-tertiary)] hover:opacity-80 text-[var(--embed-text-secondary)] text-sm font-bold active:scale-90 transition-all",children:"-"}),s?M.jsx("input",{type:"text",value:l,onChange:x=>u(x.target.value),onBlur:p,onKeyDown:m,onClick:x=>x.stopPropagation(),autoFocus:!0,className:"w-14 h-7 text-center text-xs font-mono bg-white border border-blue-400 rounded outline-none text-gray-800"}):M.jsxs("button",{onClick:h,"aria-label":`Current value: ${o}. Click to edit`,className:"w-14 h-7 flex items-center justify-center rounded bg-[var(--embed-bg-tertiary)] text-emerald-400 font-mono text-sm font-bold hover:opacity-80 transition-colors cursor-text",children:["0x",b]}),M.jsx("button",{onClick:x=>{x.stopPropagation(),d(o+1)},"aria-label":"Increase value",className:"w-6 h-6 flex items-center justify-center rounded bg-[var(--embed-bg-tertiary)] hover:opacity-80 text-[var(--embed-text-secondary)] text-sm font-bold active:scale-90 transition-all",children:"+"})]}),M.jsxs("div",{className:"text-[10px] text-[var(--embed-text-secondary)] font-mono",children:["= ",o]})]})}function FV({data:t,selected:e}){const n=t.value??!1,o=t.componentRef==="Input",s=N.useCallback(l=>{l.stopPropagation(),t.onToggle?.()},[t]),a=t.outputNames.map((l,u)=>({name:l,index:u,type:"output",value:o?(t.numericValue??0)!==0:n}));return M.jsx(Ze,{outputPorts:a,selected:e,className:"min-w-[80px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"relative flex flex-col items-center gap-2",children:[t.isComposite&&M.jsx(Br,{}),M.jsx("div",{className:"px-2 py-1 rounded text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),o?M.jsx(GV,{data:t}):M.jsxs(M.Fragment,{children:[M.jsx("button",{onClick:s,role:"switch","aria-checked":n,"aria-label":t.label||t.componentRef,className:jn("group relative h-9 w-16 rounded-full transition-all duration-300 ease-in-out","focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2 focus-visible:ring-offset-gray-900 hover:shadow-md active:scale-95",n?"bg-gradient-to-r from-emerald-500 to-green-500 shadow-sm":"bg-gradient-to-r from-gray-300 to-gray-400 shadow-sm"),children:M.jsxs("span",{className:jn("absolute top-0.5 flex items-center justify-center","h-8 w-8 rounded-full bg-white","shadow-lg transition-all duration-300 ease-out",n?"translate-x-[1.875rem]":"translate-x-0.5"),children:[M.jsx("span",{className:"absolute inset-1 rounded-full bg-gradient-to-br from-white to-gray-50"}),M.jsx("span",{className:jn("relative z-10 h-2 w-2 rounded-full transition-all duration-300",n?"bg-gradient-to-br from-emerald-400 to-green-500":"bg-gradient-to-br from-gray-300 to-gray-400")})]})}),M.jsx("div",{className:jn("text-xs font-semibold tracking-wide transition-colors duration-300",n?"text-emerald-400":"text-[var(--embed-text-secondary)]"),children:n?"ON":"OFF"})]})]})})}function XV({data:t,selected:e}){const n=t.numericValue??0,o=t.width??8,s=(1<<Math.min(o,31))-1,[a,l]=N.useState(!1),[u,d]=N.useState(n.toString()),[h,p]=N.useState("dec"),m=N.useCallback(_=>{_.stopPropagation(),d(n.toString()),l(!0)},[n]),y=N.useCallback(_=>{if(_.key==="Enter"){_.preventDefault(),_.stopPropagation();const S=u.trim();let k=S.toLowerCase().startsWith("0x")?parseInt(S,16):parseInt(S,10);isNaN(k)&&(k=0),k=Math.max(0,Math.min(s,k)),t.onValueChange?.(k),l(!1)}else _.key==="Escape"&&(_.preventDefault(),l(!1))},[u,s,t]),b=N.useCallback(_=>{_.stopPropagation(),p(S=>S==="dec"?"hex":"dec")},[]),x=t.outputNames.map((_,S)=>({name:_,index:S,type:"output",value:!0})),w=h==="hex"?`0x${n.toString(16).toUpperCase().padStart(Math.ceil(o/4),"0")}`:n.toString();return M.jsx(Ze,{outputPorts:x,selected:e,className:"min-w-[100px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),M.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a?M.jsx("input",{type:"text",value:u,onChange:_=>d(_.target.value),onKeyDown:y,onBlur:()=>l(!1),className:"w-24 px-2 py-1 text-center font-mono text-sm border-2 border-blue-500 rounded focus:outline-none",autoFocus:!0,onClick:_=>_.stopPropagation()}):M.jsx("div",{onClick:m,className:"px-3 py-1 bg-gradient-to-r from-indigo-500 to-purple-500 text-white rounded cursor-pointer hover:shadow-md transition-all font-mono text-sm",title:"Click to edit value",children:w}),M.jsx("button",{onClick:b,className:"text-xs text-[var(--embed-text-secondary)] hover:text-[var(--embed-text-primary)] transition-colors",children:h==="dec"?"DEC":"HEX"})]}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-muted)]",children:[o,"-bit"]})]})})}function ZV({data:t,selected:e}){const n=t.arguments?.init,o=Array.isArray(n)?n.length:0,s=t.inputNames.map((l,u)=>({name:l,index:u,type:"input"})),a=t.outputNames.map((l,u)=>({name:l,index:u,type:"output"}));return M.jsx(Ze,{inputPorts:s,outputPorts:a,selected:e,className:"min-w-[120px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"EthFrame"}),M.jsx("div",{className:"px-3 py-2 text-xs font-semibold rounded-md bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-primary)]",children:"ETH"}),M.jsx("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:o>0?`${o} bytes`:"no frame"})]})})}function KV({data:t,selected:e}){const n=t.value??!1,o=t.numericValue??0,s=t.inputNames.map((u,d)=>({name:u,index:d,type:"input"})),a=u=>u.toString(16).toUpperCase().padStart(2,"0"),l=()=>{if(t.componentRef==="HexDisplay"){const u=a(o);return M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 rounded text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),M.jsx("div",{className:"flex items-center justify-center px-4 py-2 bg-black rounded border-2 border-gray-600",children:M.jsx("span",{className:"text-2xl font-mono font-bold text-green-400",children:u})}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:["Dec: ",o]})]})}else if(t.componentRef==="SevenSegment"){const u=(o&15).toString(16).toUpperCase();return M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 rounded text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),M.jsx("div",{className:"flex items-center justify-center px-3 py-2 bg-black rounded border-2 border-gray-600",children:M.jsx("span",{className:"text-xl font-mono font-bold text-red-500",children:u})}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:["Dec: ",o&15]})]})}else return M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 rounded text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),M.jsx("div",{className:jn("h-10 w-10 rounded-full border-2 transition-all",n?"border-green-600 bg-green-400 shadow-lg shadow-green-500/50":"border-gray-500 bg-[var(--embed-bg-tertiary)]"),children:n&&M.jsx("div",{className:"h-full w-full rounded-full bg-gradient-to-br from-green-300 to-green-500"})}),M.jsx("div",{className:jn("text-xs font-semibold",n?"text-green-400":"text-[var(--embed-text-secondary)]"),children:n?"ON":"OFF"})]})};return M.jsx(Ze,{inputPorts:s,selected:e,className:"min-w-[80px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"relative",children:[t.isComposite&&M.jsx(Br,{}),l()]})})}function QV({data:t,selected:e}){const n=t.arguments?.width??8,o=t.arguments?.height??8,s=n*o,a=t.__pixels??new Array(s).fill(0),l=n<=8?16:n<=16?8:4,u=n<=8?2:n<=16?1:0;return M.jsx(Ze,{selected:e,inputPorts:t.inputNames.map((d,h)=>({name:d,index:h,type:"input"})),outputPorts:t.outputNames.map((d,h)=>({name:d,index:h,type:"output"})),className:"min-w-[160px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"Screen"}),M.jsx("svg",{width:n*l+(n-1)*u,height:o*l+(o-1)*u,className:"border-2 border-gray-700 rounded bg-black",style:{imageRendering:"pixelated"},children:a.slice(0,s).map((d,h)=>{const p=h%n,m=Math.floor(h/n);return M.jsx("rect",{x:p*(l+u),y:m*(l+u),width:l,height:l,fill:d!==0?"#00ff00":"#1a1a1a"},h)})}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:[n,"×",o," pixels"]})]})})}function WV({data:t,selected:e}){const n=t.__pixels??new Array(64).fill(0),o=8,s=16,a=2;return M.jsx(Ze,{selected:e,inputPorts:t.inputNames.map((l,u)=>({name:l,index:u,type:"input"})),outputPorts:t.outputNames.map((l,u)=>({name:l,index:u,type:"output"})),className:"min-w-[160px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"RasterDisplay"}),M.jsx("svg",{width:o*s+(o-1)*a,height:o*s+(o-1)*a,className:"border-2 border-gray-700 rounded bg-black",style:{imageRendering:"pixelated"},children:n.map((l,u)=>{const d=u%o,h=Math.floor(u/o);return M.jsx("rect",{x:d*(s+a),y:h*(s+a),width:s,height:s,fill:l!==0?"#00ff00":"#1a1a1a"},u)})}),M.jsx("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:"8×8 raster scan"})]})})}function JV({data:t,selected:e}){const n=N.useRef(null),o=t.__consoleText??"";N.useEffect(()=>{n.current&&(n.current.scrollTop=n.current.scrollHeight)},[o]);const s=o?o.split(`
|
|
25
|
+
`).length:0,a=o.length;return M.jsx(Ze,{selected:e,inputPorts:t.inputNames.map((l,u)=>({name:l,index:u,type:"input"})),outputPorts:t.outputNames.map((l,u)=>({name:l,index:u,type:"output"})),className:"min-w-[200px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"Console"}),M.jsx("pre",{ref:n,className:"w-full h-32 overflow-auto rounded border-2 border-gray-700 bg-black text-green-400 font-mono text-xs p-2 whitespace-pre-wrap break-all",style:{minWidth:"180px",maxHeight:"200px"},children:o||M.jsx("span",{className:"text-[var(--embed-text-muted)]",children:"// output appears here"})}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:[a," chars, ",s," lines"]})]})})}function tL({data:t,selected:e}){const n=N.useRef(null),o=t.__uartText??"";N.useEffect(()=>{n.current&&(n.current.scrollTop=n.current.scrollHeight)},[o]);const s=o?o.split(`
|
|
26
|
+
`).length:0,a=o.length;return M.jsx(Ze,{selected:e,inputPorts:t.inputNames.map((l,u)=>({name:l,index:u,type:"input"})),outputPorts:t.outputNames.map((l,u)=>({name:l,index:u,type:"output"})),className:"min-w-[200px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"UART TX"}),M.jsx("pre",{ref:n,className:"w-full h-32 overflow-auto rounded border-2 border-gray-700 bg-black text-green-400 font-mono text-xs p-2 whitespace-pre-wrap break-all",style:{minWidth:"180px",maxHeight:"200px"},children:o||M.jsx("span",{className:"text-[var(--embed-text-muted)]",children:"// UART output appears here"})}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:[a," chars, ",s," lines"]})]})})}const eL=new Set(["And","Or","Not","Nand","Nor","Xor","Xnor","Buffer"]);function nL(t,e){if(!e||Object.keys(e).length===0)return t;const n=e.width??e.input_count;return n!==void 0?`${t}(${n})`:t}function iL({data:t,selected:e}){const n=t.value??!1,o=t.inputNames.map((l,u)=>({name:l,index:u,type:"input"})),s=t.outputNames.map((l,u)=>({name:l,index:u,type:"output",value:n})),a=()=>{const u=(()=>{switch(t.componentRef){case"And":return"&";case"Or":return"≥1";case"Not":return"¬";case"Nand":return"⊼";case"Nor":return"⊽";case"Xor":return"⊕";case"Xnor":return"⊙";case"Buffer":return"▷";case"DFlipFlop":return"D";case"Register":return"REG";case"RAM":return"RAM";default:return nL(t.componentRef,t.arguments)}})(),d=eL.has(t.componentRef);return M.jsx("div",{className:`flex items-center justify-center rounded-md bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-primary)] ${d?"h-12 w-12 text-2xl font-bold":"h-auto w-auto px-3 py-2 text-xs font-semibold"}`,children:u})};return M.jsx(Ze,{inputPorts:o,outputPorts:s,selected:e,className:"min-w-[60px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"relative flex flex-col items-center gap-1",children:[t.isComposite&&M.jsx(Br,{}),M.jsx("div",{className:"text-xs font-medium text-[var(--embed-text-secondary)]",children:t.label||t.componentRef}),M.jsx("div",{className:"flex items-center justify-center",children:a()}),t.isComposite&&M.jsx("div",{className:"text-[9px] text-[var(--embed-text-muted)] italic",children:"double-click to inspect"})]})})}function oL({data:t,selected:e}){const n=typeof t.arguments?.initial=="number"?t.arguments.initial:0,o=t.inputNames.map((a,l)=>({name:a,index:l,type:"input"})),s=t.outputNames.map((a,l)=>({name:a,index:l,type:"output"}));return M.jsx(Ze,{inputPorts:o,outputPorts:s,selected:e,className:"min-w-[100px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"relative flex flex-col items-center gap-2",children:[t.isComposite&&M.jsx(Br,{}),M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"Register"}),M.jsx("div",{className:"px-3 py-2 text-xs font-semibold rounded-md bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-primary)]",children:"REG"}),M.jsxs("div",{className:"flex flex-col items-center gap-1",children:[M.jsx("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:"Initial:"}),M.jsx("div",{className:"px-2 py-1 bg-blue-500/20 text-blue-400 rounded font-mono text-xs",children:n})]})]})})}function rL({data:t,selected:e}){const n=t.arguments?.init,o=()=>n?Array.isArray(n)?`[${n.length} values]`:typeof n=="object"?`{${Object.keys(n).length} entries}`:"empty":"empty",s=t.inputNames.map((l,u)=>({name:l,index:u,type:"input"})),a=t.outputNames.map((l,u)=>({name:l,index:u,type:"output"}));return M.jsx(Ze,{inputPorts:s,outputPorts:a,selected:e,className:"min-w-[100px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"relative flex flex-col items-center gap-2",children:[t.isComposite&&M.jsx(Br,{}),M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"RAM"}),M.jsx("div",{className:"px-3 py-2 text-xs font-semibold rounded-md bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-primary)]",children:"RAM"}),M.jsxs("div",{className:"flex flex-col items-center gap-1",children:[M.jsx("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:"Init:"}),M.jsx("div",{className:"px-2 py-1 bg-purple-500/20 text-purple-400 rounded font-mono text-xs",children:o()})]})]})})}function sL({data:t,selected:e}){const n=t.arguments?.init,o=()=>n?Array.isArray(n)?`[${n.length} values]`:typeof n=="object"?`{${Object.keys(n).length} entries}`:"empty":"empty",s=t.inputNames.map((l,u)=>({name:l,index:u,type:"input"})),a=t.outputNames.map((l,u)=>({name:l,index:u,type:"output"}));return M.jsx(Ze,{inputPorts:s,outputPorts:a,selected:e,className:"min-w-[100px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"relative flex flex-col items-center gap-2",children:[t.isComposite&&M.jsx(Br,{}),M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"ROM"}),M.jsx("div",{className:"px-3 py-2 text-xs font-semibold rounded-md bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-primary)]",children:"ROM"}),M.jsx("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:o()})]})})}function aL({data:t,selected:e}){const n=t.__nicState,o=n?.txCount??0,s=n?.rxCount??0,a=n?.draining??!1;return M.jsx(Ze,{selected:e,inputPorts:t.inputNames.map((l,u)=>({name:l,index:u,type:"input"})),outputPorts:t.outputNames.map((l,u)=>({name:l,index:u,type:"output"})),className:"min-w-[160px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"NIC"}),M.jsxs("div",{className:"w-full rounded border border-[var(--embed-border-node)] bg-[var(--embed-bg-tertiary)] p-2 text-xs font-mono space-y-1",children:[M.jsxs("div",{className:"flex justify-between",children:[M.jsx("span",{className:"text-[var(--embed-text-secondary)]",children:"TX FIFO:"}),M.jsxs("span",{className:"text-blue-400",children:[o," words"]})]}),M.jsxs("div",{className:"flex justify-between",children:[M.jsx("span",{className:"text-[var(--embed-text-secondary)]",children:"RX FIFO:"}),M.jsxs("span",{className:"text-green-400",children:[s," words"]})]}),a&&M.jsx("div",{className:"text-center text-yellow-400 font-bold",children:"TRANSMITTING"})]})]})})}const lL=[{value:"c",label:"C"},{value:"cpp",label:"C++"},{value:"rust",label:"Rust"},{value:"asm",label:"ASM"}],Cw={c:`void main() {
|
|
27
27
|
volatile int *uart = (volatile int *)0x80000000;
|
|
28
28
|
const char *msg = "Hello from C!\\n";
|
|
29
29
|
while (*msg) *uart = *msg++;
|
|
30
30
|
while (1);
|
|
31
|
-
}`,cpp:`extern "C" void
|
|
31
|
+
}`,cpp:`extern "C" void main() {
|
|
32
32
|
volatile int *uart = (volatile int *)0x80000000;
|
|
33
33
|
const char *msg = "Hello from C++!\\n";
|
|
34
34
|
while (*msg) *uart = *msg++;
|
|
@@ -37,7 +37,7 @@ ${n.join(`
|
|
|
37
37
|
#![no_main]
|
|
38
38
|
|
|
39
39
|
#[no_mangle]
|
|
40
|
-
pub extern "C" fn
|
|
40
|
+
pub extern "C" fn main() -> ! {
|
|
41
41
|
let uart = 0x80000000 as *mut u32;
|
|
42
42
|
for &b in b"Hello from Rust!\\n" {
|
|
43
43
|
unsafe { core::ptr::write_volatile(uart, b as u32); }
|
|
@@ -46,34 +46,34 @@ pub extern "C" fn _start() -> ! {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
#[panic_handler]
|
|
49
|
-
fn panic(_: &core::panic::PanicInfo) -> ! { loop {} }`,asm:`.global
|
|
49
|
+
fn panic(_: &core::panic::PanicInfo) -> ! { loop {} }`,asm:`.global main
|
|
50
50
|
.text
|
|
51
|
-
|
|
51
|
+
main:
|
|
52
52
|
# Write 'H' to UART
|
|
53
53
|
li t0, 0x80000000
|
|
54
54
|
li a0, 72
|
|
55
55
|
sw a0, 0(t0)
|
|
56
|
-
1: j 1b`};function
|
|
56
|
+
1: j 1b`};function cL({data:t,selected:e}){const[n,o]=N.useState(!1),[s,a]=N.useState(!1),[l,u]=N.useState("c"),[d,h]=N.useState(""),[p,m]=N.useState("idle"),[y,b]=N.useState(""),[x,w]=N.useState(null),[_,S]=N.useState(0),k=N.useRef(null),C=t.inputNames.map((H,j)=>({name:H,index:j,type:"input"})),E=t.outputNames.map((H,j)=>({name:H,index:j,type:"output"})),R=N.useCallback((H,j)=>{const I=new Map;for(let z=0;z<H.length;z++)H[z]!==0&&I.set(z,H[z]);w(j),S(H.length),t.onLoadMemory?.(I)},[t.onLoadMemory]),A=N.useCallback(async H=>{const j=await H.arrayBuffer();R(new Uint8Array(j),H.name)},[R]),O=N.useCallback(H=>{H.preventDefault(),H.stopPropagation(),o(!1);const j=H.dataTransfer.files[0];j&&A(j)},[A]),D=N.useCallback(H=>{H.preventDefault(),H.stopPropagation(),o(!0)},[]),U=N.useCallback(H=>{H.preventDefault(),H.stopPropagation(),o(!1)},[]),q=N.useCallback(H=>{H.stopPropagation(),k.current?.click()},[]),Y=N.useCallback(H=>{const j=H.target.files?.[0];j&&A(j),H.target.value=""},[A]),K=N.useCallback(H=>{H.stopPropagation(),w(null),S(0),t.onLoadMemory?.(new Map)},[t.onLoadMemory]),W=N.useCallback(async()=>{const H=d||Cw[l]||"";if(H.trim()){m("compiling"),b("");try{const I=await(await fetch("/api/compile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:H,language:l})})).json();if(!I.success){m("error"),b(I.stderr||I.error||"Compilation failed");return}const z=I.binary??"",$=atob(z),G=new Uint8Array($.length);for(let L=0;L<$.length;L++)G[L]=$.charCodeAt(L);R(G,`program.${l}`),m("success"),setTimeout(()=>m("idle"),2e3)}catch(j){m("error"),b(j instanceof Error?j.message:"Network error")}}},[d,l,R]),B=N.useCallback(H=>{H.stopPropagation(),a(j=>!j)},[]);return M.jsxs(M.Fragment,{children:[M.jsx("input",{ref:k,type:"file",accept:".bin,.elf",onChange:Y,className:"hidden"}),M.jsx(Ze,{inputPorts:C,outputPorts:E,selected:e,className:"min-w-[140px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"InstrMem"}),M.jsx("div",{className:"px-3 py-2 text-xs font-semibold rounded-md bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-primary)]",children:"IMEM"}),M.jsx("div",{className:`
|
|
57
57
|
flex flex-col items-center gap-1 p-2 rounded border-2 border-dashed cursor-pointer transition-all w-full
|
|
58
58
|
${n?"border-blue-500 bg-blue-500/10":x?"border-green-500/50 bg-green-500/10":"border-[var(--embed-border)] hover:border-blue-400 hover:bg-blue-500/5"}
|
|
59
|
-
`,onDrop:O,onDragOver:
|
|
59
|
+
`,onDrop:O,onDragOver:D,onDragLeave:U,onClick:q,title:x?"Click to replace":"Drop .bin or click",children:x?M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"text-xs text-green-400 font-medium truncate max-w-[120px]",children:x}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-muted)]",children:[_," bytes"]}),M.jsx("button",{onClick:K,className:"text-xs text-red-400 hover:text-red-300 hover:underline",children:"Clear"})]}):M.jsxs(M.Fragment,{children:[M.jsx("div",{className:"text-xs text-[var(--embed-text-muted)]",children:"Drop .bin"}),M.jsx("div",{className:"text-xs text-[var(--embed-text-muted)]",children:"or click"})]})}),M.jsx("button",{onClick:B,className:`
|
|
60
60
|
w-full px-2 py-1 text-xs rounded transition-colors
|
|
61
61
|
${s?"bg-violet-500/20 text-violet-400":"bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-muted)] hover:bg-violet-500/10 hover:text-violet-400"}
|
|
62
|
-
`,children:s?"Hide Code":"Code"}),s&&M.jsxs("div",{className:"flex flex-col gap-2 w-full min-w-[280px] nodrag",onClick:
|
|
62
|
+
`,children:s?"Hide Code":"Code"}),s&&M.jsxs("div",{className:"flex flex-col gap-2 w-full min-w-[280px] nodrag",onClick:H=>H.stopPropagation(),children:[M.jsx("div",{className:"flex gap-1",children:lL.map(H=>M.jsx("button",{onClick:()=>u(H.value),className:`
|
|
63
63
|
px-2 py-0.5 text-xs rounded transition-colors
|
|
64
|
-
${
|
|
65
|
-
`,children:
|
|
64
|
+
${l===H.value?"bg-violet-500/30 text-violet-300":"bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-muted)] hover:bg-[var(--embed-bg-tertiary)]/80"}
|
|
65
|
+
`,children:H.label},H.value))}),M.jsx("textarea",{value:d,onChange:H=>h(H.target.value),placeholder:Cw[l],className:"w-full h-32 p-2 text-xs font-mono rounded border border-[var(--embed-border)] bg-[var(--embed-bg-code)] text-[var(--embed-text-primary)] resize-y",spellCheck:!1}),M.jsx("button",{onClick:W,disabled:p==="compiling",className:`
|
|
66
66
|
w-full px-3 py-1.5 text-xs font-medium rounded transition-colors
|
|
67
67
|
${p==="compiling"?"bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-muted)] cursor-wait":p==="success"?"bg-green-600 text-white":"bg-violet-600 hover:bg-violet-500 text-white"}
|
|
68
|
-
`,children:p==="compiling"?"Compiling...":p==="success"?"Loaded!":"Compile & Load"}),p==="error"&&y&&M.jsx("div",{className:"p-2 text-xs font-mono rounded bg-red-500/10 text-red-400 max-h-24 overflow-y-auto whitespace-pre-wrap",children:y})]})]})})]})}const _w={inputNode:B4,numericInputNode:P4,outputNode:U4,logicGateNode:Z4,registerNode:K4,ramNode:Q4,romNode:W4,rv32iInstrMemNode:eL,ethFrameInputNode:H4,consoleNode:Y4,uartTxNode:G4,nicFifoNode:J4,screenNode:$4,rasterDisplayNode:q4},Nw={orthogonal:ch},jh={TRUE:"#22c55e",FALSE:"#94a3b8",UNDEFINED:"#cbd5e1"};function Ar(t){return t.nodeId===""?`.${t.portName}`:`${t.nodeId}.${t.portName}`}function nL(t,e,n,i){const s={Switch:"inputNode",Input:"numericInputNode",Led:"outputNode",And:"logicGateNode",Or:"logicGateNode",Not:"logicGateNode",Nand:"logicGateNode",Nor:"logicGateNode",Xor:"logicGateNode",Xnor:"logicGateNode",Buffer:"logicGateNode",DFlipFlop:"logicGateNode",Register:"registerNode",RAM:"ramNode",ROM:"romNode",HexDisplay:"outputNode",SevenSegment:"outputNode",Screen:"screenNode",RasterDisplay:"rasterDisplayNode",Console:"consoleNode",UART_TX:"uartTxNode",NIC_FIFO:"nicFifoNode",Constant:"logicGateNode",RV32I_InstrMem:"rv32iInstrMemNode",DualPortROM:"rv32iInstrMemNode",Eth_FrameInput:"ethFrameInputNode"};return s[t]?s[t]:i?"logicGateNode":e===0&&n>0?"inputNode":e>0&&n===0?"outputNode":e>0&&n>0?"logicGateNode":"default"}function oL(t,e,n,i,s){const a=[];for(const c of t.nodes){const u=e.components[c.id];if(!u){console.warn(`[projection] node '${c.id}' (${c.componentRef}) has no layout metadata, skipping render`);continue}const d=n.resolveCircuit(c.componentRef);if(!d)continue;const h=c.inputs.length,p=c.outputs.length,m=c.inputs.map(A=>A.name),y=c.outputs.map(A=>A.name),b=d.implementation.kind==="composite",x=nL(c.componentRef,h,p,b);let w,S,E,D,T,C,R;if(c.componentRef==="Switch"||c.componentRef==="Led"){let A=!1;if(i){if(c.componentRef==="Led"&&c.inputs.length>0){const O=Ar({nodeId:c.id,portName:c.inputs[0].name}),k=i.get(O);k!==void 0&&(w=!!k,A=!0)}else if(c.componentRef==="Switch"&&c.outputs.length>0){const O=Ar({nodeId:c.id,portName:c.outputs[0].name}),k=i.get(O);k!==void 0&&(w=!!k,A=!0)}}!A&&"value"in c.arguments&&(w=!!c.arguments.value)}else if(c.componentRef==="Input"){E=typeof c.arguments.width=="number"?c.arguments.width:8;let A=!1;if(i&&c.outputs.length>0){const O=Ar({nodeId:c.id,portName:c.outputs[0].name}),k=i.get(O);k!==void 0&&typeof k=="number"&&(S=k,A=!0)}A||(S=typeof c.arguments.value=="number"?c.arguments.value:0)}else if(c.componentRef==="HexDisplay"||c.componentRef==="SevenSegment"){if(i&&c.inputs.length>0){const A=Ar({nodeId:c.id,portName:c.inputs[0].name}),O=i.get(A);S=typeof O=="number"?O:0}}else if(c.componentRef==="Screen"){const A=c.arguments.width??8,O=c.arguments.height??8,k=A*O;if(D=new Array(k).fill(0),s&&i){const H=Array.from(t.connections).find($=>$.target.nodeId===c.id&&$.target.portName==="dataIn");if(H){const $=t.nodes.find(q=>q.id===H.source.nodeId);if($?.componentRef==="DualPortRAM"){const q=s.currentState.get($.id);if(q instanceof Map)for(let F=0;F<k;F++)D[F]=q.get(F)??0}else if($?.componentRef==="Mux"){const q=Ar({nodeId:$.id,portName:"sel"}),Q=i.get(q)===0?"in0":"in1",B=Array.from(t.connections).find(P=>P.target.nodeId===$.id&&P.target.portName===Q);if(B){const P=t.nodes.find(j=>j.id===B.source.nodeId);if(P?.componentRef==="DualPortRAM"){const j=s.currentState.get(P.id);if(j instanceof Map)for(let I=0;I<k;I++)D[I]=j.get(I)??0}}}}}}else if(c.componentRef==="RasterDisplay"){const A=c.arguments.width??8,O=c.arguments.height??8,k=A*O;if(D=new Array(k).fill(0),s){const H=s.currentState.get(c.id);if(H instanceof Map)for(let $=0;$<k;$++)D[$]=H.get($)??0}}else if(c.componentRef==="Console"){if(s){const A=s.currentState.get(c.id);typeof A=="string"&&(T=A)}}else if(c.componentRef==="UART_TX"){if(s){const A=s.currentState.get(c.id);typeof A=="string"&&(C=A)}}else if(c.componentRef==="NIC_FIFO"&&s){const A=s.currentState.get(c.id);if(A instanceof Map){const O=A,k=O.get(8192)??0,H=O.get(8193)??0,$=O.get(8210)??0,q=(O.get(8196)??0)!==0;R={txCount:k-H,rxCount:$,draining:q}}}a.push({id:c.id,type:x,position:u.position,data:{nodeId:c.id,componentRef:c.componentRef,label:c.label,value:w,numericValue:S,width:E,inputCount:h,outputCount:p,inputNames:m,outputNames:y,isComposite:b,arguments:c.arguments,__pixels:D,__consoleText:T,__uartText:C,__nicState:R},selectable:!0,deletable:!1})}if(s){const c=new Set(a.map(d=>d.id));let u=0;for(const[d,h]of s.currentState.entries())if(!c.has(d)&&typeof h=="string"){const p=d.split("."),m=p.length>1?p.slice(-2).join("."):d,y=d.toLowerCase().includes("uart");a.push({id:`__virtual_console_${u}`,type:y?"uartTxNode":"consoleNode",position:{x:600,y:50+u*250},data:{nodeId:d,componentRef:y?"UART_TX":"Console",label:y?`UART (${m})`:`Console (${m})`,value:void 0,numericValue:void 0,width:void 0,inputCount:y?4:2,outputCount:1,inputNames:y?["addr","write_data","mem_read","mem_write"]:["data","we"],outputNames:y?["read_data"]:["text"],__consoleText:y?void 0:h,__uartText:y?h:void 0},selected:!1,selectable:!1,deletable:!1}),u++}}return a}function iL(t,e){const n=[];for(const i of t.connections){let s=jh.UNDEFINED;if(e){const a=e.get(Ar(i.source))??e.get(Ar(i.target));a!==void 0&&(s=(typeof a=="boolean"?a:a!==0)?jh.TRUE:jh.FALSE)}n.push({id:i.id,type:"orthogonal",source:i.source.nodeId,target:i.target.nodeId,sourceHandle:`out-${i.source.portName}`,targetHandle:`in-${i.target.portName}`,style:{stroke:s,strokeWidth:2},animated:!1,selectable:!1,deletable:!1})}return n}function rL(t,e,n,i,s){return t?{nodes:oL(t,e,n,i,s),edges:iL(t,i)}:{nodes:[],edges:[]}}var Aw=Object.defineProperty,sL=(t,e,n)=>e in t?Aw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,aL=(t,e)=>{for(var n in e)Aw(t,n,{get:e[n],enumerable:!0})},lL=(t,e,n)=>sL(t,e+"",n),Mw={};aL(Mw,{Graph:()=>_n,alg:()=>Vh,json:()=>Dw,version:()=>fL});var cL=Object.defineProperty,Rw=(t,e)=>{for(var n in e)cL(t,n,{get:e[n],enumerable:!0})},_n=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,e){return t.forEach(n=>{e!==void 0?this.setNode(n,e):this.setNode(n)}),this}setNode(t,e){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let e=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(n=>{this.setParent(n)}),delete this._children[t]),Object.keys(this._in[t]).forEach(e),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e===void 0)e="\0";else{e+="";for(let n=e;n!==void 0;n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}parent(t){if(this._isCompound){let e=this._parent[t];if(e!=="\0")return e}}children(t="\0"){if(this._isCompound){let e=this._children[t];if(e)return Object.keys(e)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let e=this._preds[t];if(e)return Object.keys(e)}successors(t){let e=this._sucs[t];if(e)return Object.keys(e)}neighbors(t){let e=this.predecessors(t);if(e){let n=new Set(e);for(let i of this.successors(t))n.add(i);return Array.from(n.values())}}isLeaf(t){let e;return this.isDirected()?e=this.successors(t):e=this.neighbors(t),e.length===0}filterNodes(t){let e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph()),Object.entries(this._nodes).forEach(([s,a])=>{t(s)&&e.setNode(s,a)}),Object.values(this._edgeObjs).forEach(s=>{e.hasNode(s.v)&&e.hasNode(s.w)&&e.setEdge(s,this.edge(s))});let n={},i=s=>{let a=this.parent(s);return!a||e.hasNode(a)?(n[s]=a??void 0,a??void 0):a in n?n[a]:i(a)};return this._isCompound&&e.nodes().forEach(s=>e.setParent(s,i(s))),e}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,e){return t.reduce((n,i)=>(e!==void 0?this.setEdge(n,i,e):this.setEdge(n,i),i)),this}setEdge(t,e,n,i){let s,a,c,u,d=!1;typeof t=="object"&&t!==null&&"v"in t?(s=t.v,a=t.w,c=t.name,arguments.length===2&&(u=e,d=!0)):(s=t,a=e,c=i,arguments.length>2&&(u=n,d=!0)),s=""+s,a=""+a,c!==void 0&&(c=""+c);let h=qa(this._isDirected,s,a,c);if(h in this._edgeLabels)return d&&(this._edgeLabels[h]=u),this;if(c!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(a),this._edgeLabels[h]=d?u:this._defaultEdgeLabelFn(s,a,c);let p=uL(this._isDirected,s,a,c);return s=p.v,a=p.w,Object.freeze(p),this._edgeObjs[h]=p,kw(this._preds[a],s),kw(this._sucs[s],a),this._in[a][h]=p,this._out[s][h]=p,this._edgeCount++,this}edge(t,e,n){let i=arguments.length===1?zh(this._isDirected,t):qa(this._isDirected,t,e,n);return this._edgeLabels[i]}edgeAsObj(t,e,n){let i=arguments.length===1?this.edge(t):this.edge(t,e,n);return typeof i!="object"?{label:i}:i}hasEdge(t,e,n){return(arguments.length===1?zh(this._isDirected,t):qa(this._isDirected,t,e,n))in this._edgeLabels}removeEdge(t,e,n){let i=arguments.length===1?zh(this._isDirected,t):qa(this._isDirected,t,e,n),s=this._edgeObjs[i];if(s){let a=s.v,c=s.w;delete this._edgeLabels[i],delete this._edgeObjs[i],Ow(this._preds[c],a),Ow(this._sucs[a],c),delete this._in[c][i],delete this._out[a][i],this._edgeCount--}return this}inEdges(t,e){return this.isDirected()?this.filterEdges(this._in[t],t,e):this.nodeEdges(t,e)}outEdges(t,e){return this.isDirected()?this.filterEdges(this._out[t],t,e):this.nodeEdges(t,e)}nodeEdges(t,e){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,e)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,e,n){if(!t)return;let i=Object.values(t);return n?i.filter(s=>s.v===e&&s.w===n||s.v===n&&s.w===e):i}};function kw(t,e){t[e]?t[e]++:t[e]=1}function Ow(t,e){t[e]!==void 0&&!--t[e]&&delete t[e]}function qa(t,e,n,i){let s=""+e,a=""+n;if(!t&&s>a){let c=s;s=a,a=c}return s+""+a+""+(i===void 0?"\0":i)}function uL(t,e,n,i){let s=""+e,a=""+n;if(!t&&s>a){let u=s;s=a,a=u}let c={v:s,w:a};return i&&(c.name=i),c}function zh(t,e){return qa(t,e.v,e.w,e.name)}var fL="4.0.1",Dw={};Rw(Dw,{read:()=>mL,write:()=>dL});function dL(t){let e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:hL(t),edges:pL(t)},n=t.graph();return n!==void 0&&(e.value=structuredClone(n)),e}function hL(t){return t.nodes().map(e=>{let n=t.node(e),i=t.parent(e),s={v:e};return n!==void 0&&(s.value=n),i!==void 0&&(s.parent=i),s})}function pL(t){return t.edges().map(e=>{let n=t.edge(e),i={v:e.v,w:e.w};return e.name!==void 0&&(i.name=e.name),n!==void 0&&(i.value=n),i})}function mL(t){let e=new _n(t.options);return t.value!==void 0&&e.setGraph(t.value),t.nodes.forEach(n=>{e.setNode(n.v,n.value),n.parent&&e.setParent(n.v,n.parent)}),t.edges.forEach(n=>{e.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),e}var Vh={};Rw(Vh,{CycleException:()=>ru,bellmanFord:()=>jw,components:()=>vL,dijkstra:()=>iu,dijkstraAll:()=>wL,findCycles:()=>SL,floydWarshall:()=>CL,isAcyclic:()=>_L,postorder:()=>AL,preorder:()=>ML,prim:()=>RL,shortestPaths:()=>kL,tarjan:()=>Vw,topsort:()=>Lw});var gL=()=>1;function jw(t,e,n,i){return yL(t,String(e),n||gL,i||function(s){return t.outEdges(s)})}function yL(t,e,n,i){let s={},a,c=0,u=t.nodes(),d=function(m){let y=n(m);s[m.v].distance+y<s[m.w].distance&&(s[m.w]={distance:s[m.v].distance+y,predecessor:m.v},a=!0)},h=function(){u.forEach(function(m){i(m).forEach(function(y){let b=y.v===m?y.v:y.w,x=b===y.v?y.w:y.v;d({v:b,w:x})})})};u.forEach(function(m){let y=m===e?0:Number.POSITIVE_INFINITY;s[m]={distance:y,predecessor:""}});let p=u.length;for(let m=1;m<p&&(a=!1,c++,h(),!!a);m++);if(c===p-1&&(a=!1,h(),a))throw new Error("The graph contains a negative weight cycle");return s}function vL(t){let e={},n=[],i;function s(a){a in e||(e[a]=!0,i.push(a),t.successors(a).forEach(s),t.predecessors(a).forEach(s))}return t.nodes().forEach(function(a){i=[],s(a),i.length&&n.push(i)}),n}var zw=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(t=>t.key)}has(t){return t in this._keyIndices}priority(t){let e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){let n=this._keyIndices,i=String(t);if(!(i in n)){let s=this._arr,a=s.length;return n[i]=a,s.push({key:i,priority:e}),this._decrease(a),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){let n=this._keyIndices[t];if(n===void 0)throw new Error(`Key not found: ${t}`);let i=this._arr[n].priority;if(e>i)throw new Error(`New priority is greater than current priority. Key: ${t} Old: ${i} New: ${e}`);this._arr[n].priority=e,this._decrease(n)}_heapify(t){let e=this._arr,n=2*t,i=n+1,s=t;n<e.length&&(s=e[n].priority<e[s].priority?n:s,i<e.length&&(s=e[i].priority<e[s].priority?i:s),s!==t&&(this._swap(t,s),this._heapify(s)))}_decrease(t){let e=this._arr,n=e[t].priority,i;for(;t!==0&&(i=t>>1,!(e[i].priority<n));)this._swap(t,i),t=i}_swap(t,e){let n=this._arr,i=this._keyIndices,s=n[t],a=n[e];n[t]=a,n[e]=s,i[a.key]=t,i[s.key]=e}},bL=()=>1;function iu(t,e,n,i){let s=function(a){return t.outEdges(a)};return xL(t,String(e),n||bL,i||s)}function xL(t,e,n,i){let s={},a=new zw,c,u,d=function(h){let p=h.v!==c?h.v:h.w,m=s[p],y=n(h),b=u.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+h+" Weight: "+y);b<m.distance&&(m.distance=b,m.predecessor=c,a.decrease(p,b))};for(t.nodes().forEach(function(h){let p=h===e?0:Number.POSITIVE_INFINITY;s[h]={distance:p,predecessor:""},a.add(h,p)});a.size()>0&&(c=a.removeMin(),u=s[c],u.distance!==Number.POSITIVE_INFINITY);)i(c).forEach(d);return s}function wL(t,e,n){return t.nodes().reduce(function(i,s){return i[s]=iu(t,s,e,n),i},{})}function Vw(t){let e=0,n=[],i={},s=[];function a(c){let u=i[c]={onStack:!0,lowlink:e,index:e++};if(n.push(c),t.successors(c).forEach(function(d){d in i?i[d].onStack&&(u.lowlink=Math.min(u.lowlink,i[d].index)):(a(d),u.lowlink=Math.min(u.lowlink,i[d].lowlink))}),u.lowlink===u.index){let d=[],h;do h=n.pop(),i[h].onStack=!1,d.push(h);while(c!==h);s.push(d)}}return t.nodes().forEach(function(c){c in i||a(c)}),s}function SL(t){return Vw(t).filter(function(e){return e.length>1||e.length===1&&t.hasEdge(e[0],e[0])})}var EL=()=>1;function CL(t,e,n){return TL(t,e||EL,n||function(i){return t.outEdges(i)})}function TL(t,e,n){let i={},s=t.nodes();return s.forEach(function(a){i[a]={},i[a][a]={distance:0,predecessor:""},s.forEach(function(c){a!==c&&(i[a][c]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(a).forEach(function(c){let u=c.v===a?c.w:c.v,d=e(c);i[a][u]={distance:d,predecessor:a}})}),s.forEach(function(a){let c=i[a];s.forEach(function(u){let d=i[u];s.forEach(function(h){let p=d[a],m=c[h],y=d[h],b=p.distance+m.distance;b<y.distance&&(y.distance=b,y.predecessor=m.predecessor)})})}),i}var ru=class extends Error{constructor(...t){super(...t)}};function Lw(t){let e={},n={},i=[];function s(a){if(a in n)throw new ru;a in e||(n[a]=!0,e[a]=!0,t.predecessors(a).forEach(s),delete n[a],i.push(a))}if(t.sinks().forEach(s),Object.keys(e).length!==t.nodeCount())throw new ru;return i}function _L(t){try{Lw(t)}catch(e){if(e instanceof ru)return!1;throw e}return!0}function NL(t,e,n,i,s){Array.isArray(e)||(e=[e]);let a=(u=>{var d;return(d=t.isDirected()?t.successors(u):t.neighbors(u))!=null?d:[]}),c={};return e.forEach(function(u){if(!t.hasNode(u))throw new Error("Graph does not have node: "+u);s=Iw(t,u,n==="post",c,a,i,s)}),s}function Iw(t,e,n,i,s,a,c){return e in i||(i[e]=!0,n||(c=a(c,e)),s(e).forEach(function(u){c=Iw(t,u,n,i,s,a,c)}),n&&(c=a(c,e))),c}function Bw(t,e,n){return NL(t,e,n,function(i,s){return i.push(s),i},[])}function AL(t,e){return Bw(t,e,"post")}function ML(t,e){return Bw(t,e,"pre")}function RL(t,e){let n=new _n,i={},s=new zw,a;function c(d){let h=d.v===a?d.w:d.v,p=s.priority(h);if(p!==void 0){let m=e(d);m<p&&(i[h]=a,s.decrease(h,m))}}if(t.nodeCount()===0)return n;t.nodes().forEach(function(d){s.add(d,Number.POSITIVE_INFINITY),n.setNode(d)}),s.decrease(t.nodes()[0],0);let u=!1;for(;s.size()>0;){if(a=s.removeMin(),a in i)n.setEdge(a,i[a]);else{if(u)throw new Error("Input graph is not connected: "+t);u=!0}t.nodeEdges(a).forEach(c)}return n}function kL(t,e,n,i){return OL(t,e,n,i??(s=>{let a=t.outEdges(s);return a??[]}))}function OL(t,e,n,i){if(n===void 0)return iu(t,e,n,i);let s=!1,a=t.nodes();for(let c=0;c<a.length;c++){let u=i(a[c]);for(let d=0;d<u.length;d++){let h=u[d],p=h.v===a[c]?h.v:h.w,m=p===h.v?h.w:h.v;n({v:p,w:m})<0&&(s=!0)}if(s)return jw(t,e,n,i)}return iu(t,e,n,i)}function bs(t,e,n,i){let s=i;for(;t.hasNode(s);)s=Lh(i);return n.dummy=e,t.setNode(s,n),s}function DL(t){let e=new _n().setGraph(t.graph());return t.nodes().forEach(n=>e.setNode(n,t.node(n))),t.edges().forEach(n=>{let i=e.edge(n.v,n.w)||{weight:0,minlen:1},s=t.edge(n);e.setEdge(n.v,n.w,{weight:i.weight+s.weight,minlen:Math.max(i.minlen,s.minlen)})}),e}function Pw(t){let e=new _n({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(n=>{t.children(n).length||e.setNode(n,t.node(n))}),t.edges().forEach(n=>{e.setEdge(n,t.edge(n))}),e}function Hw(t,e){let n=t.x,i=t.y,s=e.x-n,a=e.y-i,c=t.width/2,u=t.height/2;if(!s&&!a)throw new Error("Not possible to find intersection inside of the rectangle");let d,h;return Math.abs(a)*c>Math.abs(s)*u?(a<0&&(u=-u),d=u*s/a,h=u):(s<0&&(c=-c),d=c,h=c*a/s),{x:n+d,y:i+h}}function Ya(t){let e=Ga(qw(t)+1).map(()=>[]);return t.nodes().forEach(n=>{let i=t.node(n),s=i.rank;s!==void 0&&(e[s]||(e[s]=[]),e[s][i.order]=n)}),e}function jL(t){let e=t.nodes().map(i=>{let s=t.node(i).rank;return s===void 0?Number.MAX_VALUE:s}),n=vo(Math.min,e);t.nodes().forEach(i=>{let s=t.node(i);Object.hasOwn(s,"rank")&&(s.rank-=n)})}function zL(t){let e=t.nodes().map(c=>t.node(c).rank).filter(c=>c!==void 0),n=vo(Math.min,e),i=[];t.nodes().forEach(c=>{let u=t.node(c).rank-n;i[u]||(i[u]=[]),i[u].push(c)});let s=0,a=t.graph().nodeRankFactor;Array.from(i).forEach((c,u)=>{c===void 0&&u%a!==0?--s:c!==void 0&&s&&c.forEach(d=>t.node(d).rank+=s)})}function Uw(t,e,n,i){let s={width:0,height:0};return arguments.length>=4&&(s.rank=n,s.order=i),bs(t,"border",s,e)}function VL(t,e=$w){let n=[];for(let i=0;i<t.length;i+=e){let s=t.slice(i,i+e);n.push(s)}return n}var $w=65535;function vo(t,e){if(e.length>$w){let n=VL(e);return t(...n.map(i=>t(...i)))}else return t(...e)}function qw(t){let e=t.nodes().map(n=>{let i=t.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return vo(Math.max,e)}function LL(t,e){let n={lhs:[],rhs:[]};return t.forEach(i=>{e(i)?n.lhs.push(i):n.rhs.push(i)}),n}function Yw(t,e){let n=Date.now();try{return e()}finally{console.log(t+" time: "+(Date.now()-n)+"ms")}}function Gw(t,e){return e()}var IL=0;function Lh(t){let e=++IL;return t+(""+e)}function Ga(t,e,n=1){e==null&&(e=t,t=0);let i=a=>a<e;n<0&&(i=a=>e<a);let s=[];for(let a=t;i(a);a+=n)s.push(a);return s}function su(t,e){let n={};for(let i of e)t[i]!==void 0&&(n[i]=t[i]);return n}function au(t,e){let n;return typeof e=="string"?n=i=>i[e]:n=e,Object.entries(t).reduce((i,[s,a])=>(i[s]=n(a,s),i),{})}function BL(t,e){return t.reduce((n,i,s)=>(n[i]=e[s],n),{})}var lu="\0",PL="3.0.0",HL=class{constructor(){lL(this,"_sentinel");let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,e=t._prev;if(e!==t)return Xw(e),e}enqueue(t){let e=this._sentinel;t._prev&&t._next&&Xw(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e}toString(){let t=[],e=this._sentinel,n=e._prev;for(;n!==e;)t.push(JSON.stringify(n,UL)),n=n._prev;return"["+t.join(", ")+"]"}};function Xw(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function UL(t,e){if(t!=="_next"&&t!=="_prev")return e}var $L=HL,qL=()=>1;function YL(t,e){if(t.nodeCount()<=1)return[];let n=XL(t,e||qL);return GL(n.graph,n.buckets,n.zeroIdx).flatMap(i=>t.outEdges(i.v,i.w)||[])}function GL(t,e,n){var i;let s=[],a=e[e.length-1],c=e[0],u;for(;t.nodeCount();){for(;u=c.dequeue();)Ih(t,e,n,u);for(;u=a.dequeue();)Ih(t,e,n,u);if(t.nodeCount()){for(let d=e.length-2;d>0;--d)if(u=(i=e[d])==null?void 0:i.dequeue(),u){s=s.concat(Ih(t,e,n,u,!0)||[]);break}}}return s}function Ih(t,e,n,i,s){let a=[],c=s?a:void 0;return(t.inEdges(i.v)||[]).forEach(u=>{let d=t.edge(u),h=t.node(u.v);s&&a.push({v:u.v,w:u.w}),h.out-=d,Bh(e,n,h)}),(t.outEdges(i.v)||[]).forEach(u=>{let d=t.edge(u),h=u.w,p=t.node(h);p.in-=d,Bh(e,n,p)}),t.removeNode(i.v),c}function XL(t,e){let n=new _n,i=0,s=0;t.nodes().forEach(u=>{n.setNode(u,{v:u,in:0,out:0})}),t.edges().forEach(u=>{let d=n.edge(u.v,u.w)||0,h=e(u),p=d+h;n.setEdge(u.v,u.w,p);let m=n.node(u.v),y=n.node(u.w);s=Math.max(s,m.out+=h),i=Math.max(i,y.in+=h)});let a=FL(s+i+3).map(()=>new $L),c=i+1;return n.nodes().forEach(u=>{Bh(a,c,n.node(u))}),{graph:n,buckets:a,zeroIdx:c}}function Bh(t,e,n){var i,s,a;n.out?n.in?(a=t[n.out-n.in+e])==null||a.enqueue(n):(s=t[t.length-1])==null||s.enqueue(n):(i=t[0])==null||i.enqueue(n)}function FL(t){let e=[];for(let n=0;n<t;n++)e.push(n);return e}function ZL(t){(t.graph().acyclicer==="greedy"?YL(t,e(t)):KL(t)).forEach(n=>{let i=t.edge(n);t.removeEdge(n),i.forwardName=n.name,i.reversed=!0,t.setEdge(n.w,n.v,i,Lh("rev"))});function e(n){return i=>n.edge(i).weight}}function KL(t){let e=[],n={},i={};function s(a){Object.hasOwn(i,a)||(i[a]=!0,n[a]=!0,t.outEdges(a).forEach(c=>{Object.hasOwn(n,c.w)?e.push(c):s(c.w)}),delete n[a])}return t.nodes().forEach(s),e}function QL(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.reversed){t.removeEdge(e);let i=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,i)}})}function WL(t){t.graph().dummyChains=[],t.edges().forEach(e=>JL(t,e))}function JL(t,e){let n=e.v,i=t.node(n).rank,s=e.w,a=t.node(s).rank,c=e.name,u=t.edge(e),d=u.labelRank;if(a===i+1)return;t.removeEdge(e);let h,p,m;for(m=0,++i;i<a;++m,++i)u.points=[],p={width:0,height:0,edgeLabel:u,edgeObj:e,rank:i},h=bs(t,"edge",p,"_d"),i===d&&(p.width=u.width,p.height=u.height,p.dummy="edge-label",p.labelpos=u.labelpos),t.setEdge(n,h,{weight:u.weight},c),m===0&&t.graph().dummyChains.push(h),n=h;t.setEdge(n,s,{weight:u.weight},c)}function tI(t){t.graph().dummyChains.forEach(e=>{let n=t.node(e),i=n.edgeLabel,s;for(t.setEdge(n.edgeObj,i);n.dummy;)s=t.successors(e)[0],t.removeNode(e),i.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),e=s,n=t.node(e)})}function Ph(t){let e={};function n(i){let s=t.node(i);if(Object.hasOwn(e,i))return s.rank;e[i]=!0;let a=t.outEdges(i),c=a?a.map(d=>d==null?Number.POSITIVE_INFINITY:n(d.w)-t.edge(d).minlen):[],u=vo(Math.min,c);return u===Number.POSITIVE_INFINITY&&(u=0),s.rank=u}t.sources().forEach(n)}function xs(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}var Fw=eI;function eI(t){let e=new _n({directed:!1}),n=t.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let i=n[0],s=t.nodeCount();e.setNode(i,{});let a,c;for(;nI(e,t)<s&&(a=oI(e,t),!!a);)c=e.hasNode(a.v)?xs(t,a):-xs(t,a),iI(e,t,c);return e}function nI(t,e){function n(i){let s=e.nodeEdges(i);s&&s.forEach(a=>{let c=a.v,u=i===c?a.w:c;!t.hasNode(u)&&!xs(e,a)&&(t.setNode(u,{}),t.setEdge(i,u,{}),n(u))})}return t.nodes().forEach(n),t.nodeCount()}function oI(t,e){return e.edges().reduce((n,i)=>{let s=Number.POSITIVE_INFINITY;return t.hasNode(i.v)!==t.hasNode(i.w)&&(s=xs(e,i)),s<n[0]?[s,i]:n},[Number.POSITIVE_INFINITY,null])[1]}function iI(t,e,n){t.nodes().forEach(i=>e.node(i).rank+=n)}var{preorder:rI,postorder:sI}=Vh,aI=Mr;Mr.initLowLimValues=Uh,Mr.initCutValues=Hh,Mr.calcCutValue=Zw,Mr.leaveEdge=Qw,Mr.enterEdge=Ww,Mr.exchangeEdges=Jw;function Mr(t){t=DL(t),Ph(t);let e=Fw(t);Uh(e),Hh(e,t);let n,i;for(;n=Qw(e);)i=Ww(e,t,n),Jw(e,t,n,i)}function Hh(t,e){let n=sI(t,t.nodes());n=n.slice(0,n.length-1),n.forEach(i=>lI(t,e,i))}function lI(t,e,n){let i=t.node(n).parent,s=t.edge(n,i);s.cutvalue=Zw(t,e,n)}function Zw(t,e,n){let i=t.node(n).parent,s=!0,a=e.edge(n,i),c=0;a||(s=!1,a=e.edge(i,n)),c=a.weight;let u=e.nodeEdges(n);return u&&u.forEach(d=>{let h=d.v===n,p=h?d.w:d.v;if(p!==i){let m=h===s,y=e.edge(d).weight;if(c+=m?y:-y,uI(t,n,p)){let b=t.edge(n,p).cutvalue;c+=m?-b:b}}}),c}function Uh(t,e){arguments.length<2&&(e=t.nodes()[0]),Kw(t,{},1,e)}function Kw(t,e,n,i,s){let a=n,c=t.node(i);e[i]=!0;let u=t.neighbors(i);return u&&u.forEach(d=>{Object.hasOwn(e,d)||(n=Kw(t,e,n,d,i))}),c.low=a,c.lim=n++,s?c.parent=s:delete c.parent,n}function Qw(t){return t.edges().find(e=>t.edge(e).cutvalue<0)}function Ww(t,e,n){let i=n.v,s=n.w;e.hasEdge(i,s)||(i=n.w,s=n.v);let a=t.node(i),c=t.node(s),u=a,d=!1;return a.lim>c.lim&&(u=c,d=!0),e.edges().filter(h=>d===t1(t,t.node(h.v),u)&&d!==t1(t,t.node(h.w),u)).reduce((h,p)=>xs(e,p)<xs(e,h)?p:h)}function Jw(t,e,n,i){let s=n.v,a=n.w;t.removeEdge(s,a),t.setEdge(i.v,i.w,{}),Uh(t),Hh(t,e),cI(t,e)}function cI(t,e){let n=t.nodes().find(s=>!t.node(s).parent);if(!n)return;let i=rI(t,[n]);i=i.slice(1),i.forEach(s=>{let a=t.node(s).parent,c=e.edge(s,a),u=!1;c||(c=e.edge(a,s),u=!0),e.node(s).rank=e.node(a).rank+(u?c.minlen:-c.minlen)})}function uI(t,e,n){return t.hasEdge(e,n)}function t1(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}var fI=dI;function dI(t){let e=t.graph().ranker;if(typeof e=="function")return e(t);switch(e){case"network-simplex":e1(t);break;case"tight-tree":pI(t);break;case"longest-path":hI(t);break;case"none":break;default:e1(t)}}var hI=Ph;function pI(t){Ph(t),Fw(t)}function e1(t){aI(t)}var mI=gI;function gI(t){let e=vI(t);t.graph().dummyChains.forEach(n=>{let i=t.node(n),s=i.edgeObj,a=yI(t,e,s.v,s.w),c=a.path,u=a.lca,d=0,h=c[d],p=!0;for(;n!==s.w;){if(i=t.node(n),p){for(;(h=c[d])!==u&&t.node(h).maxRank<i.rank;)d++;h===u&&(p=!1)}if(!p){for(;d<c.length-1&&t.node(c[d+1]).minRank<=i.rank;)d++;h=c[d]}h!==void 0&&t.setParent(n,h),n=t.successors(n)[0]}})}function yI(t,e,n,i){let s=[],a=[],c=Math.min(e[n].low,e[i].low),u=Math.max(e[n].lim,e[i].lim),d;d=n;do d=t.parent(d),s.push(d);while(d&&(e[d].low>c||u>e[d].lim));let h=d,p=i;for(;(p=t.parent(p))!==h;)a.push(p);return{path:s.concat(a.reverse()),lca:h}}function vI(t){let e={},n=0;function i(s){let a=n;t.children(s).forEach(i),e[s]={low:a,lim:n++}}return t.children(lu).forEach(i),e}function bI(t){let e=bs(t,"root",{},"_root"),n=xI(t),i=Object.values(n),s=vo(Math.max,i)-1,a=2*s+1;t.graph().nestingRoot=e,t.edges().forEach(u=>t.edge(u).minlen*=a);let c=wI(t)+1;t.children(lu).forEach(u=>n1(t,e,a,c,s,n,u)),t.graph().nodeRankFactor=a}function n1(t,e,n,i,s,a,c){var u;let d=t.children(c);if(!d.length){c!==e&&t.setEdge(e,c,{weight:0,minlen:n});return}let h=Uw(t,"_bt"),p=Uw(t,"_bb"),m=t.node(c);t.setParent(h,c),m.borderTop=h,t.setParent(p,c),m.borderBottom=p,d.forEach(y=>{var b;n1(t,e,n,i,s,a,y);let x=t.node(y),w=x.borderTop?x.borderTop:y,S=x.borderBottom?x.borderBottom:y,E=x.borderTop?i:2*i,D=w!==S?1:s-((b=a[c])!=null?b:0)+1;t.setEdge(h,w,{weight:E,minlen:D,nestingEdge:!0}),t.setEdge(S,p,{weight:E,minlen:D,nestingEdge:!0})}),t.parent(c)||t.setEdge(e,h,{weight:0,minlen:s+((u=a[c])!=null?u:0)})}function xI(t){let e={};function n(i,s){let a=t.children(i);a&&a.length&&a.forEach(c=>n(c,s+1)),e[i]=s}return t.children(lu).forEach(i=>n(i,1)),e}function wI(t){return t.edges().reduce((e,n)=>e+t.edge(n).weight,0)}function SI(t){let e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(n=>{t.edge(n).nestingEdge&&t.removeEdge(n)})}var EI=CI;function CI(t){function e(n){let i=t.children(n),s=t.node(n);if(i.length&&i.forEach(e),Object.hasOwn(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(let a=s.minRank,c=s.maxRank+1;a<c;++a)o1(t,"borderLeft","_bl",n,s,a),o1(t,"borderRight","_br",n,s,a)}}t.children(lu).forEach(e)}function o1(t,e,n,i,s,a){let c={width:0,height:0,rank:a,borderType:e},u=s[e][a-1],d=bs(t,"border",c,n);s[e][a]=d,t.setParent(d,i),u&&t.setEdge(u,d,{weight:1})}function TI(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="lr"||n==="rl")&&i1(t)}function _I(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="bt"||n==="rl")&&NI(t),(n==="lr"||n==="rl")&&(AI(t),i1(t))}function i1(t){t.nodes().forEach(e=>r1(t.node(e))),t.edges().forEach(e=>r1(t.edge(e)))}function r1(t){let e=t.width;t.width=t.height,t.height=e}function NI(t){t.nodes().forEach(e=>$h(t.node(e))),t.edges().forEach(e=>{var n;let i=t.edge(e);(n=i.points)==null||n.forEach($h),Object.hasOwn(i,"y")&&$h(i)})}function $h(t){t.y=-t.y}function AI(t){t.nodes().forEach(e=>qh(t.node(e))),t.edges().forEach(e=>{var n;let i=t.edge(e);(n=i.points)==null||n.forEach(qh),Object.hasOwn(i,"x")&&qh(i)})}function qh(t){let e=t.x;t.x=t.y,t.y=e}function MI(t){let e={},n=t.nodes().filter(u=>!t.children(u).length),i=n.map(u=>t.node(u).rank),s=vo(Math.max,i),a=Ga(s+1).map(()=>[]);function c(u){if(e[u])return;e[u]=!0;let d=t.node(u);a[d.rank].push(u);let h=t.successors(u);h&&h.forEach(c)}return n.sort((u,d)=>t.node(u).rank-t.node(d).rank).forEach(c),a}function RI(t,e){let n=0;for(let i=1;i<e.length;++i)n+=kI(t,e[i-1],e[i]);return n}function kI(t,e,n){let i=BL(n,n.map((h,p)=>p)),s=e.flatMap(h=>{let p=t.outEdges(h);return p?p.map(m=>({pos:i[m.w],weight:t.edge(m).weight})).sort((m,y)=>m.pos-y.pos):[]}),a=1;for(;a<n.length;)a<<=1;let c=2*a-1;a-=1;let u=new Array(c).fill(0),d=0;return s.forEach(h=>{let p=h.pos+a;u[p]+=h.weight;let m=0;for(;p>0;)p%2&&(m+=u[p+1]),p=p-1>>1,u[p]+=h.weight;d+=h.weight*m}),d}function OI(t,e=[]){return e.map(n=>{let i=t.inEdges(n);if(!i||!i.length)return{v:n};{let s=i.reduce((a,c)=>{let u=t.edge(c),d=t.node(c.v);return{sum:a.sum+u.weight*d.order,weight:a.weight+u.weight}},{sum:0,weight:0});return{v:n,barycenter:s.sum/s.weight,weight:s.weight}}})}function DI(t,e){let n={};t.forEach((s,a)=>{let c={indegree:0,in:[],out:[],vs:[s.v],i:a};s.barycenter!==void 0&&(c.barycenter=s.barycenter,c.weight=s.weight),n[s.v]=c}),e.edges().forEach(s=>{let a=n[s.v],c=n[s.w];a!==void 0&&c!==void 0&&(c.indegree++,a.out.push(c))});let i=Object.values(n).filter(s=>!s.indegree);return jI(i)}function jI(t){let e=[];function n(s){return a=>{a.merged||(a.barycenter===void 0||s.barycenter===void 0||a.barycenter>=s.barycenter)&&zI(s,a)}}function i(s){return a=>{a.in.push(s),--a.indegree===0&&t.push(a)}}for(;t.length;){let s=t.pop();e.push(s),s.in.reverse().forEach(n(s)),s.out.forEach(i(s))}return e.filter(s=>!s.merged).map(s=>su(s,["vs","i","barycenter","weight"]))}function zI(t,e){let n=0,i=0;t.weight&&(n+=t.barycenter*t.weight,i+=t.weight),e.weight&&(n+=e.barycenter*e.weight,i+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=n/i,t.weight=i,t.i=Math.min(e.i,t.i),e.merged=!0}function VI(t,e){let n=LL(t,p=>Object.hasOwn(p,"barycenter")),i=n.lhs,s=n.rhs.sort((p,m)=>m.i-p.i),a=[],c=0,u=0,d=0;i.sort(LI(!!e)),d=s1(a,s,d),i.forEach(p=>{d+=p.vs.length,a.push(p.vs),c+=p.barycenter*p.weight,u+=p.weight,d=s1(a,s,d)});let h={vs:a.flat(1)};return u&&(h.barycenter=c/u,h.weight=u),h}function s1(t,e,n){let i;for(;e.length&&(i=e[e.length-1]).i<=n;)e.pop(),t.push(i.vs),n++;return n}function LI(t){return(e,n)=>e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i}function a1(t,e,n,i){let s=t.children(e),a=t.node(e),c=a?a.borderLeft:void 0,u=a?a.borderRight:void 0,d={};c&&(s=s.filter(y=>y!==c&&y!==u));let h=OI(t,s);h.forEach(y=>{if(t.children(y.v).length){let b=a1(t,y.v,n,i);d[y.v]=b,Object.hasOwn(b,"barycenter")&&BI(y,b)}});let p=DI(h,n);II(p,d);let m=VI(p,i);if(c&&u){m.vs=[c,m.vs,u].flat(1);let y=t.predecessors(c);if(y&&y.length){let b=t.node(y[0]),x=t.predecessors(u),w=t.node(x[0]);Object.hasOwn(m,"barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+b.order+w.order)/(m.weight+2),m.weight+=2}}return m}function II(t,e){t.forEach(n=>{n.vs=n.vs.flatMap(i=>e[i]?e[i].vs:i)})}function BI(t,e){t.barycenter!==void 0?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)}function PI(t,e,n,i){i||(i=t.nodes());let s=HI(t),a=new _n({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(c=>t.node(c));return i.forEach(c=>{let u=t.node(c),d=t.parent(c);if(u.rank===e||u.minRank<=e&&e<=u.maxRank){a.setNode(c),a.setParent(c,d||s);let h=t[n](c);h&&h.forEach(p=>{let m=p.v===c?p.w:p.v,y=a.edge(m,c),b=y!==void 0?y.weight:0;a.setEdge(m,c,{weight:t.edge(p).weight+b})}),Object.hasOwn(u,"minRank")&&a.setNode(c,{borderLeft:u.borderLeft[e],borderRight:u.borderRight[e]})}}),a}function HI(t){let e;for(;t.hasNode(e=Lh("_root")););return e}function UI(t,e,n){let i={},s;n.forEach(a=>{let c=t.parent(a),u,d;for(;c;){if(u=t.parent(c),u?(d=i[u],i[u]=c):(d=s,s=c),d&&d!==c){e.setEdge(d,c);return}c=u}})}function l1(t,e={}){if(typeof e.customOrder=="function"){e.customOrder(t,l1);return}let n=qw(t),i=c1(t,Ga(1,n+1),"inEdges"),s=c1(t,Ga(n-1,-1,-1),"outEdges"),a=MI(t);if(u1(t,a),e.disableOptimalOrderHeuristic)return;let c=Number.POSITIVE_INFINITY,u,d=e.constraints||[];for(let h=0,p=0;p<4;++h,++p){$I(h%2?i:s,h%4>=2,d),a=Ya(t);let m=RI(t,a);m<c?(p=0,u=Object.assign({},a),c=m):m===c&&(u=structuredClone(a))}u1(t,u)}function c1(t,e,n){let i=new Map,s=(a,c)=>{i.has(a)||i.set(a,[]),i.get(a).push(c)};for(let a of t.nodes()){let c=t.node(a);if(typeof c.rank=="number"&&s(c.rank,a),typeof c.minRank=="number"&&typeof c.maxRank=="number")for(let u=c.minRank;u<=c.maxRank;u++)u!==c.rank&&s(u,a)}return e.map(function(a){return PI(t,a,n,i.get(a)||[])})}function $I(t,e,n){let i=new _n;t.forEach(function(s){n.forEach(u=>i.setEdge(u.left,u.right));let a=s.graph().root,c=a1(s,a,i,e);c.vs.forEach((u,d)=>s.node(u).order=d),UI(s,i,c.vs)})}function u1(t,e){Object.values(e).forEach(n=>n.forEach((i,s)=>t.node(i).order=s))}function qI(t,e){let n={};function i(s,a){let c=0,u=0,d=s.length,h=a[a.length-1];return a.forEach((p,m)=>{let y=GI(t,p),b=y?t.node(y).order:d;(y||p===h)&&(a.slice(u,m+1).forEach(x=>{let w=t.predecessors(x);w&&w.forEach(S=>{let E=t.node(S),D=E.order;(D<c||b<D)&&!(E.dummy&&t.node(x).dummy)&&f1(n,S,x)})}),u=m+1,c=b)}),a}return e.length&&e.reduce(i),n}function YI(t,e){let n={};function i(a,c,u,d,h){Ga(c,u).forEach(p=>{let m=a[p];if(m!==void 0&&t.node(m).dummy){let y=t.predecessors(m);y&&y.forEach(b=>{if(b===void 0)return;let x=t.node(b);x.dummy&&(x.order<d||x.order>h)&&f1(n,b,m)})}})}function s(a,c){let u=-1,d=-1,h=0;return c.forEach((p,m)=>{if(t.node(p).dummy==="border"){let y=t.predecessors(p);if(y&&y.length){let b=y[0];if(b===void 0)return;d=t.node(b).order,i(c,h,m,u,d),h=m,u=d}}i(c,h,c.length,d,a.length)}),c}return e.length&&e.reduce(s),n}function GI(t,e){if(t.node(e).dummy){let n=t.predecessors(e);if(n)return n.find(i=>t.node(i).dummy)}}function f1(t,e,n){if(e>n){let s=e;e=n,n=s}let i=t[e];i||(t[e]=i={}),i[n]=!0}function XI(t,e,n){if(e>n){let s=e;e=n,n=s}let i=t[e];return i!==void 0&&Object.hasOwn(i,n)}function FI(t,e,n,i){let s={},a={},c={};return e.forEach(u=>{u.forEach((d,h)=>{s[d]=d,a[d]=d,c[d]=h})}),e.forEach(u=>{let d=-1;u.forEach(h=>{let p=i(h);if(p&&p.length){let m=p.sort((b,x)=>{let w=c[b],S=c[x];return(w!==void 0?w:0)-(S!==void 0?S:0)}),y=(m.length-1)/2;for(let b=Math.floor(y),x=Math.ceil(y);b<=x;++b){let w=m[b];if(w===void 0)continue;let S=c[w];if(S!==void 0&&a[h]===h&&d<S&&!XI(n,h,w)){let E=s[w];E!==void 0&&(a[w]=h,a[h]=s[h]=E,d=S)}}}})}),{root:s,align:a}}function ZI(t,e,n,i,s=!1){let a={},c=KI(t,e,n,s),u=s?"borderLeft":"borderRight";function d(b,x){let w=c.nodes().slice(),S={},E=w.pop();for(;E;){if(S[E])b(E);else{S[E]=!0,w.push(E);for(let D of x(E))w.push(D)}E=w.pop()}}function h(b){let x=c.inEdges(b);x?a[b]=x.reduce((w,S)=>{var E;let D=(E=a[S.v])!=null?E:0,T=c.edge(S);return Math.max(w,D+(T!==void 0?T:0))},0):a[b]=0}function p(b){let x=c.outEdges(b),w=Number.POSITIVE_INFINITY;x&&(w=x.reduce((E,D)=>{let T=a[D.w],C=c.edge(D);return Math.min(E,(T!==void 0?T:0)-(C!==void 0?C:0))},Number.POSITIVE_INFINITY));let S=t.node(b);w!==Number.POSITIVE_INFINITY&&S.borderType!==u&&(a[b]=Math.max(a[b]!==void 0?a[b]:0,w))}function m(b){return c.predecessors(b)||[]}function y(b){return c.successors(b)||[]}return d(h,m),d(p,y),Object.keys(i).forEach(b=>{var x;let w=n[b];w!==void 0&&(a[b]=(x=a[w])!=null?x:0)}),a}function KI(t,e,n,i){let s=new _n,a=t.graph(),c=e6(a.nodesep,a.edgesep,i);return e.forEach(u=>{let d;u.forEach(h=>{let p=n[h];if(p!==void 0){if(s.setNode(p),d!==void 0){let m=n[d];if(m!==void 0){let y=s.edge(m,p);s.setEdge(m,p,Math.max(c(t,h,d),y||0))}}d=h}})}),s}function QI(t,e){return Object.values(e).reduce((n,i)=>{let s=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;Object.entries(i).forEach(([u,d])=>{let h=n6(t,u)/2;s=Math.max(d+h,s),a=Math.min(d-h,a)});let c=s-a;return c<n[0]&&(n=[c,i]),n},[Number.POSITIVE_INFINITY,null])[1]}function WI(t,e){let n=Object.values(e),i=vo(Math.min,n),s=vo(Math.max,n);["u","d"].forEach(a=>{["l","r"].forEach(c=>{let u=a+c,d=t[u];if(!d||d===e)return;let h=Object.values(d),p=i-vo(Math.min,h);c!=="l"&&(p=s-vo(Math.max,h)),p&&(t[u]=au(d,m=>m+p))})})}function JI(t,e=void 0){let n=t.ul;return n?au(n,(i,s)=>{var a,c;if(e){let d=e.toLowerCase(),h=t[d];if(h&&h[s]!==void 0)return h[s]}let u=Object.values(t).map(d=>{let h=d[s];return h!==void 0?h:0}).sort((d,h)=>d-h);return(((a=u[1])!=null?a:0)+((c=u[2])!=null?c:0))/2}):{}}function t6(t){let e=Ya(t),n=Object.assign(qI(t,e),YI(t,e)),i={},s;["u","d"].forEach(c=>{s=c==="u"?e:Object.values(e).reverse(),["l","r"].forEach(u=>{u==="r"&&(s=s.map(p=>Object.values(p).reverse()));let d=FI(t,s,n,p=>(c==="u"?t.predecessors(p):t.successors(p))||[]),h=ZI(t,s,d.root,d.align,u==="r");u==="r"&&(h=au(h,p=>-p)),i[c+u]=h})});let a=QI(t,i);return WI(i,a),JI(i,t.graph().align)}function e6(t,e,n){return(i,s,a)=>{let c=i.node(s),u=i.node(a),d=0,h;if(d+=c.width/2,Object.hasOwn(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":h=-c.width/2;break;case"r":h=c.width/2;break}if(h&&(d+=n?h:-h),h=void 0,d+=(c.dummy?e:t)/2,d+=(u.dummy?e:t)/2,d+=u.width/2,Object.hasOwn(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":h=u.width/2;break;case"r":h=-u.width/2;break}return h&&(d+=n?h:-h),d}}function n6(t,e){return t.node(e).width}function o6(t){t=Pw(t),i6(t),Object.entries(t6(t)).forEach(([e,n])=>t.node(e).x=n)}function i6(t){let e=Ya(t),n=t.graph(),i=n.ranksep,s=n.rankalign,a=0;e.forEach(c=>{let u=c.reduce((d,h)=>{var p;let m=(p=t.node(h).height)!=null?p:0;return d>m?d:m},0);c.forEach(d=>{let h=t.node(d);s==="top"?h.y=a+h.height/2:s==="bottom"?h.y=a+u-h.height/2:h.y=a+u/2}),a+=u+i})}function r6(t,e={}){let n=e.debugTiming?Yw:Gw;return n("layout",()=>{let i=n(" buildLayoutGraph",()=>m6(t));return n(" runLayout",()=>s6(i,n,e)),n(" updateInputGraph",()=>a6(t,i)),i})}function s6(t,e,n){e(" makeSpaceForEdgeLabels",()=>g6(t)),e(" removeSelfEdges",()=>T6(t)),e(" acyclic",()=>ZL(t)),e(" nestingGraph.run",()=>bI(t)),e(" rank",()=>fI(Pw(t))),e(" injectEdgeLabelProxies",()=>y6(t)),e(" removeEmptyRanks",()=>zL(t)),e(" nestingGraph.cleanup",()=>SI(t)),e(" normalizeRanks",()=>jL(t)),e(" assignRankMinMax",()=>v6(t)),e(" removeEdgeLabelProxies",()=>b6(t)),e(" normalize.run",()=>WL(t)),e(" parentDummyChains",()=>mI(t)),e(" addBorderSegments",()=>EI(t)),e(" order",()=>l1(t,n)),e(" insertSelfEdges",()=>_6(t)),e(" adjustCoordinateSystem",()=>TI(t)),e(" position",()=>o6(t)),e(" positionSelfEdges",()=>N6(t)),e(" removeBorderNodes",()=>C6(t)),e(" normalize.undo",()=>tI(t)),e(" fixupEdgeLabelCoords",()=>S6(t)),e(" undoCoordinateSystem",()=>_I(t)),e(" translateGraph",()=>x6(t)),e(" assignNodeIntersects",()=>w6(t)),e(" reversePoints",()=>E6(t)),e(" acyclic.undo",()=>QL(t))}function a6(t,e){t.nodes().forEach(n=>{let i=t.node(n),s=e.node(n);i&&(i.x=s.x,i.y=s.y,i.order=s.order,i.rank=s.rank,e.children(n).length&&(i.width=s.width,i.height=s.height))}),t.edges().forEach(n=>{let i=t.edge(n),s=e.edge(n);i.points=s.points,Object.hasOwn(s,"x")&&(i.x=s.x,i.y=s.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}var l6=["nodesep","edgesep","ranksep","marginx","marginy"],c6={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},u6=["acyclicer","ranker","rankdir","align","rankalign"],f6=["width","height","rank"],d1={width:0,height:0},d6=["minlen","weight","width","height","labeloffset"],h6={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},p6=["labelpos"];function m6(t){let e=new _n({multigraph:!0,compound:!0}),n=Gh(t.graph());return e.setGraph(Object.assign({},c6,Yh(n,l6),su(n,u6))),t.nodes().forEach(i=>{let s=Gh(t.node(i)),a=Yh(s,f6);Object.keys(d1).forEach(u=>{a[u]===void 0&&(a[u]=d1[u])}),e.setNode(i,a);let c=t.parent(i);c!==void 0&&e.setParent(i,c)}),t.edges().forEach(i=>{let s=Gh(t.edge(i));e.setEdge(i,Object.assign({},h6,Yh(s,d6),su(s,p6)))}),e}function g6(t){let e=t.graph();e.ranksep/=2,t.edges().forEach(n=>{let i=t.edge(n);i.minlen*=2,i.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?i.width+=i.labeloffset:i.height+=i.labeloffset)})}function y6(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.width&&n.height){let i=t.node(e.v),s={rank:(t.node(e.w).rank-i.rank)/2+i.rank,e};bs(t,"edge-proxy",s,"_ep")}})}function v6(t){let e=0;t.nodes().forEach(n=>{let i=t.node(n);i.borderTop&&(i.minRank=t.node(i.borderTop).rank,i.maxRank=t.node(i.borderBottom).rank,e=Math.max(e,i.maxRank))}),t.graph().maxRank=e}function b6(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="edge-proxy"){let i=n;t.edge(i.e).labelRank=n.rank,t.removeNode(e)}})}function x6(t){let e=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,s=0,a=t.graph(),c=a.marginx||0,u=a.marginy||0;function d(h){let p=h.x,m=h.y,y=h.width,b=h.height;e=Math.min(e,p-y/2),n=Math.max(n,p+y/2),i=Math.min(i,m-b/2),s=Math.max(s,m+b/2)}t.nodes().forEach(h=>d(t.node(h))),t.edges().forEach(h=>{let p=t.edge(h);Object.hasOwn(p,"x")&&d(p)}),e-=c,i-=u,t.nodes().forEach(h=>{let p=t.node(h);p.x-=e,p.y-=i}),t.edges().forEach(h=>{let p=t.edge(h);p.points.forEach(m=>{m.x-=e,m.y-=i}),Object.hasOwn(p,"x")&&(p.x-=e),Object.hasOwn(p,"y")&&(p.y-=i)}),a.width=n-e+c,a.height=s-i+u}function w6(t){t.edges().forEach(e=>{let n=t.edge(e),i=t.node(e.v),s=t.node(e.w),a,c;n.points?(a=n.points[0],c=n.points[n.points.length-1]):(n.points=[],a=s,c=i),n.points.unshift(Hw(i,a)),n.points.push(Hw(s,c))})}function S6(t){t.edges().forEach(e=>{let n=t.edge(e);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function E6(t){t.edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}function C6(t){t.nodes().forEach(e=>{if(t.children(e).length){let n=t.node(e),i=t.node(n.borderTop),s=t.node(n.borderBottom),a=t.node(n.borderLeft[n.borderLeft.length-1]),c=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(c.x-a.x),n.height=Math.abs(s.y-i.y),n.x=a.x+n.width/2,n.y=i.y+n.height/2}}),t.nodes().forEach(e=>{t.node(e).dummy==="border"&&t.removeNode(e)})}function T6(t){t.edges().forEach(e=>{if(e.v===e.w){let n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}})}function _6(t){Ya(t).forEach(e=>{let n=0;e.forEach((i,s)=>{let a=t.node(i);a.order=s+n,(a.selfEdges||[]).forEach(c=>{bs(t,"selfedge",{width:c.label.width,height:c.label.height,rank:a.rank,order:s+ ++n,e:c.e,label:c.label},"_se")}),delete a.selfEdges})})}function N6(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="selfedge"){let i=n,s=t.node(i.e.v),a=s.x+s.width/2,c=s.y,u=n.x-a,d=s.height/2;t.setEdge(i.e,i.label),t.removeNode(e),i.label.points=[{x:a+2*u/3,y:c-d},{x:a+5*u/6,y:c-d},{x:a+u,y:c},{x:a+5*u/6,y:c+d},{x:a+2*u/3,y:c+d}],i.label.x=n.x,i.label.y=n.y}})}function Yh(t,e){return au(su(t,e),Number)}function Gh(t){let e={};return t&&Object.entries(t).forEach(([n,i])=>{typeof n=="string"&&(n=n.toLowerCase()),e[n]=i}),e}function A6(t){let e=Ya(t),n=new _n({compound:!0,multigraph:!0}).setGraph({});return t.nodes().forEach(i=>{n.setNode(i,{label:i}),n.setParent(i,"layer"+t.node(i).rank)}),t.edges().forEach(i=>n.setEdge(i.v,i.w,{},i.name)),e.forEach((i,s)=>{let a="layer"+s;n.setNode(a,{rank:"same"}),i.reduce((c,u)=>(n.setEdge(c,u,{style:"invis"}),u))}),n}var M6={graphlib:Mw,version:PL,layout:r6,debug:A6,util:{time:Yw,notime:Gw}},h1=M6;const R6={Switch:{width:140,height:110},Button:{width:120,height:80},Input:{width:140,height:80},Led:{width:100,height:110},Output:{width:100,height:80},HexDisplay:{width:100,height:80},SevenSegment:{width:100,height:80},Screen:{width:200,height:200},RasterDisplay:{width:200,height:200},Console:{width:380,height:220},Register:{width:120,height:80},RAM:{width:120,height:80},ROM:{width:120,height:80},DualPortRAM:{width:140,height:100}},k6={width:160,height:80};function O6(t){return R6[t]??k6}function D6(t,e){const a=new h1.graphlib.Graph;a.setGraph({rankdir:"LR",nodesep:60,ranksep:90,marginx:20,marginy:20}),a.setDefaultEdgeLabel(()=>({}));const c=new Set;for(const d of t.nodes){const h=O6(d.componentRef);a.setNode(d.id,{width:h.width,height:h.height}),c.add(d.id)}for(const d of t.connections)!c.has(d.source.nodeId)||!c.has(d.target.nodeId)||a.setEdge(d.source.nodeId,d.target.nodeId);h1.layout(a);const u={components:{},connections:{}};for(const d of t.nodes){const h=a.node(d.id);h&&(u.components[d.id]={id:d.id,position:{x:h.x-h.width/2,y:h.y-h.height/2}})}return u}function j6(t,e){return N.useMemo(()=>t?{metadata:D6(t),isLayoutReady:!0}:{metadata:{components:{},connections:{}},isLayoutReady:!1},[t,e?.direction,e?.nodeSpacing,e?.rankSpacing])}const p1="(pointer: coarse) and (max-width: 1024px)";function z6(){const[t,e]=N.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(p1).matches);return N.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const n=window.matchMedia(p1),i=s=>e(s.matches);return e(n.matches),n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[]),t}function m1(){const[t,e]=N.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark")?"dark":"light");return N.useEffect(()=>{const n=document.documentElement,i=new MutationObserver(()=>{e(n.classList.contains("dark")?"dark":"light")});return i.observe(n,{attributes:!0,attributeFilter:["class"]}),()=>i.disconnect()},[]),t}const Xh=N.createContext({});function Fh(t){const e=N.useRef(null);return e.current===null&&(e.current=t()),e.current}const g1=typeof window<"u",y1=g1?N.useLayoutEffect:N.useEffect,cu=N.createContext(null);function Zh(t,e){t.indexOf(e)===-1&&t.push(e)}function uu(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const bo=(t,e,n)=>n>e?e:n<t?t:n;let Kh=()=>{};const Bo={},v1=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function b1(t){return typeof t=="object"&&t!==null}const x1=t=>/^0[^.\s]+$/u.test(t);function w1(t){let e;return()=>(e===void 0&&(e=t()),e)}const Nn=t=>t,V6=(t,e)=>n=>e(t(n)),Xa=(...t)=>t.reduce(V6),Fa=(t,e,n)=>{const i=e-t;return i===0?1:(n-t)/i};class Qh{constructor(){this.subscriptions=[]}add(e){return Zh(this.subscriptions,e),()=>uu(this.subscriptions,e)}notify(e,n,i){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,i);else for(let a=0;a<s;a++){const c=this.subscriptions[a];c&&c(e,n,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Zn=t=>t*1e3,An=t=>t/1e3;function S1(t,e){return e?t*(1e3/e):0}const E1=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,L6=1e-7,I6=12;function B6(t,e,n,i,s){let a,c,u=0;do c=e+(n-e)/2,a=E1(c,i,s)-t,a>0?n=c:e=c;while(Math.abs(a)>L6&&++u<I6);return c}function Za(t,e,n,i){if(t===e&&n===i)return Nn;const s=a=>B6(a,0,1,t,n);return a=>a===0||a===1?a:E1(s(a),e,i)}const C1=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,T1=t=>e=>1-t(1-e),_1=Za(.33,1.53,.69,.99),Wh=T1(_1),N1=C1(Wh),A1=t=>(t*=2)<1?.5*Wh(t):.5*(2-Math.pow(2,-10*(t-1))),Jh=t=>1-Math.sin(Math.acos(t)),M1=T1(Jh),R1=C1(Jh),P6=Za(.42,0,1,1),H6=Za(0,0,.58,1),k1=Za(.42,0,.58,1),U6=t=>Array.isArray(t)&&typeof t[0]!="number",O1=t=>Array.isArray(t)&&typeof t[0]=="number",$6={linear:Nn,easeIn:P6,easeInOut:k1,easeOut:H6,circIn:Jh,circInOut:R1,circOut:M1,backIn:Wh,backInOut:N1,backOut:_1,anticipate:A1},q6=t=>typeof t=="string",D1=t=>{if(O1(t)){Kh(t.length===4);const[e,n,i,s]=t;return Za(e,n,i,s)}else if(q6(t))return $6[t];return t},fu=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Y6(t,e){let n=new Set,i=new Set,s=!1,a=!1;const c=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function d(p){c.has(p)&&(h.schedule(p),t()),p(u)}const h={schedule:(p,m=!1,y=!1)=>{const x=y&&s?n:i;return m&&c.add(p),x.has(p)||x.add(p),p},cancel:p=>{i.delete(p),c.delete(p)},process:p=>{if(u=p,s){a=!0;return}s=!0,[n,i]=[i,n],n.forEach(d),n.clear(),s=!1,a&&(a=!1,h.process(p))}};return h}const G6=40;function j1(t,e){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,c=fu.reduce((T,C)=>(T[C]=Y6(a),T),{}),{setup:u,read:d,resolveKeyframes:h,preUpdate:p,update:m,preRender:y,render:b,postRender:x}=c,w=()=>{const T=Bo.useManualTiming?s.timestamp:performance.now();n=!1,Bo.useManualTiming||(s.delta=i?1e3/60:Math.max(Math.min(T-s.timestamp,G6),1)),s.timestamp=T,s.isProcessing=!0,u.process(s),d.process(s),h.process(s),p.process(s),m.process(s),y.process(s),b.process(s),x.process(s),s.isProcessing=!1,n&&e&&(i=!1,t(w))},S=()=>{n=!0,i=!0,s.isProcessing||t(w)};return{schedule:fu.reduce((T,C)=>{const R=c[C];return T[C]=(A,O=!1,k=!1)=>(n||S(),R.schedule(A,O,k)),T},{}),cancel:T=>{for(let C=0;C<fu.length;C++)c[fu[C]].cancel(T)},state:s,steps:c}}const{schedule:ae,cancel:wi,state:Be,steps:tp}=j1(typeof requestAnimationFrame<"u"?requestAnimationFrame:Nn,!0);let du;function X6(){du=void 0}const Fe={now:()=>(du===void 0&&Fe.set(Be.isProcessing||Bo.useManualTiming?Be.timestamp:performance.now()),du),set:t=>{du=t,queueMicrotask(X6)}},z1=t=>e=>typeof e=="string"&&e.startsWith(t),V1=z1("--"),F6=z1("var(--"),ep=t=>F6(t)?Z6.test(t.split("/*")[0].trim()):!1,Z6=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function L1(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const ws={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Ka={...ws,transform:t=>bo(0,1,t)},hu={...ws,default:1},Qa=t=>Math.round(t*1e5)/1e5,np=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function K6(t){return t==null}const Q6=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,op=(t,e)=>n=>!!(typeof n=="string"&&Q6.test(n)&&n.startsWith(t)||e&&!K6(n)&&Object.prototype.hasOwnProperty.call(n,e)),I1=(t,e,n)=>i=>{if(typeof i!="string")return i;const[s,a,c,u]=i.match(np);return{[t]:parseFloat(s),[e]:parseFloat(a),[n]:parseFloat(c),alpha:u!==void 0?parseFloat(u):1}},W6=t=>bo(0,255,t),ip={...ws,transform:t=>Math.round(W6(t))},Rr={test:op("rgb","red"),parse:I1("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+ip.transform(t)+", "+ip.transform(e)+", "+ip.transform(n)+", "+Qa(Ka.transform(i))+")"};function J6(t){let e="",n="",i="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),i=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),i=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,i+=i,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}}const rp={test:op("#"),parse:J6,transform:Rr.transform},Wa=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Si=Wa("deg"),xo=Wa("%"),St=Wa("px"),t8=Wa("vh"),e8=Wa("vw"),B1={...xo,parse:t=>xo.parse(t)/100,transform:t=>xo.transform(t*100)},Ss={test:op("hsl","hue"),parse:I1("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+xo.transform(Qa(e))+", "+xo.transform(Qa(n))+", "+Qa(Ka.transform(i))+")"},Ne={test:t=>Rr.test(t)||rp.test(t)||Ss.test(t),parse:t=>Rr.test(t)?Rr.parse(t):Ss.test(t)?Ss.parse(t):rp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Rr.transform(t):Ss.transform(t),getAnimatableNone:t=>{const e=Ne.parse(t);return e.alpha=0,Ne.transform(e)}},n8=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function o8(t){return isNaN(t)&&typeof t=="string"&&(t.match(np)?.length||0)+(t.match(n8)?.length||0)>0}const P1="number",H1="color",i8="var",r8="var(",U1="${}",s8=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ja(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},s=[];let a=0;const u=e.replace(s8,d=>(Ne.test(d)?(i.color.push(a),s.push(H1),n.push(Ne.parse(d))):d.startsWith(r8)?(i.var.push(a),s.push(i8),n.push(d)):(i.number.push(a),s.push(P1),n.push(parseFloat(d))),++a,U1)).split(U1);return{values:n,split:u,indexes:i,types:s}}function $1(t){return Ja(t).values}function q1(t){const{split:e,types:n}=Ja(t),i=e.length;return s=>{let a="";for(let c=0;c<i;c++)if(a+=e[c],s[c]!==void 0){const u=n[c];u===P1?a+=Qa(s[c]):u===H1?a+=Ne.transform(s[c]):a+=s[c]}return a}}const a8=t=>typeof t=="number"?0:Ne.test(t)?Ne.getAnimatableNone(t):t;function l8(t){const e=$1(t);return q1(t)(e.map(a8))}const Kn={test:o8,parse:$1,createTransformer:q1,getAnimatableNone:l8};function sp(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<.16666666666666666?t+(e-t)*6*n:n<.5?e:n<.6666666666666666?t+(e-t)*(.6666666666666666-n)*6:t}function c8({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,e/=100,n/=100;let s=0,a=0,c=0;if(!e)s=a=c=n;else{const u=n<.5?n*(1+e):n+e-n*e,d=2*n-u;s=sp(d,u,t+.3333333333333333),a=sp(d,u,t),c=sp(d,u,t-.3333333333333333)}return{red:Math.round(s*255),green:Math.round(a*255),blue:Math.round(c*255),alpha:i}}function pu(t,e){return n=>n>0?e:t}const ye=(t,e,n)=>t+(e-t)*n,ap=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},u8=[rp,Rr,Ss],f8=t=>u8.find(e=>e.test(t));function Y1(t){const e=f8(t);if(!e)return!1;let n=e.parse(t);return e===Ss&&(n=c8(n)),n}const G1=(t,e)=>{const n=Y1(t),i=Y1(e);if(!n||!i)return pu(t,e);const s={...n};return a=>(s.red=ap(n.red,i.red,a),s.green=ap(n.green,i.green,a),s.blue=ap(n.blue,i.blue,a),s.alpha=ye(n.alpha,i.alpha,a),Rr.transform(s))},lp=new Set(["none","hidden"]);function d8(t,e){return lp.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function h8(t,e){return n=>ye(t,e,n)}function cp(t){return typeof t=="number"?h8:typeof t=="string"?ep(t)?pu:Ne.test(t)?G1:g8:Array.isArray(t)?X1:typeof t=="object"?Ne.test(t)?G1:p8:pu}function X1(t,e){const n=[...t],i=n.length,s=t.map((a,c)=>cp(a)(a,e[c]));return a=>{for(let c=0;c<i;c++)n[c]=s[c](a);return n}}function p8(t,e){const n={...t,...e},i={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(i[s]=cp(t[s])(t[s],e[s]));return s=>{for(const a in i)n[a]=i[a](s);return n}}function m8(t,e){const n=[],i={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const a=e.types[s],c=t.indexes[a][i[a]],u=t.values[c]??0;n[s]=u,i[a]++}return n}const g8=(t,e)=>{const n=Kn.createTransformer(e),i=Ja(t),s=Ja(e);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?lp.has(t)&&!s.values.length||lp.has(e)&&!i.values.length?d8(t,e):Xa(X1(m8(i,s),s.values),n):pu(t,e)};function F1(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?ye(t,e,n):cp(t)(t,e)}const y8=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>ae.update(e,n),stop:()=>wi(e),now:()=>Be.isProcessing?Be.timestamp:Fe.now()}},Z1=(t,e,n=10)=>{let i="";const s=Math.max(Math.round(e/n),2);for(let a=0;a<s;a++)i+=Math.round(t(a/(s-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},mu=2e4;function up(t){let e=0;const n=50;let i=t.next(e);for(;!i.done&&e<mu;)e+=n,i=t.next(e);return e>=mu?1/0:e}function v8(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(up(i),mu);return{type:"keyframes",ease:a=>i.next(s*a).value/e,duration:An(s)}}const b8=5;function K1(t,e,n){const i=Math.max(e-b8,0);return S1(n-t(i),e-i)}const be={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},fp=.001;function x8({duration:t=be.duration,bounce:e=be.bounce,velocity:n=be.velocity,mass:i=be.mass}){let s,a,c=1-e;c=bo(be.minDamping,be.maxDamping,c),t=bo(be.minDuration,be.maxDuration,An(t)),c<1?(s=h=>{const p=h*c,m=p*t,y=p-n,b=dp(h,c),x=Math.exp(-m);return fp-y/b*x},a=h=>{const m=h*c*t,y=m*n+n,b=Math.pow(c,2)*Math.pow(h,2)*t,x=Math.exp(-m),w=dp(Math.pow(h,2),c);return(-s(h)+fp>0?-1:1)*((y-b)*x)/w}):(s=h=>{const p=Math.exp(-h*t),m=(h-n)*t+1;return-fp+p*m},a=h=>{const p=Math.exp(-h*t),m=(n-h)*(t*t);return p*m});const u=5/t,d=S8(s,a,u);if(t=Zn(t),isNaN(d))return{stiffness:be.stiffness,damping:be.damping,duration:t};{const h=Math.pow(d,2)*i;return{stiffness:h,damping:c*2*Math.sqrt(i*h),duration:t}}}const w8=12;function S8(t,e,n){let i=n;for(let s=1;s<w8;s++)i=i-t(i)/e(i);return i}function dp(t,e){return t*Math.sqrt(1-e*e)}const E8=["duration","bounce"],C8=["stiffness","damping","mass"];function Q1(t,e){return e.some(n=>t[n]!==void 0)}function T8(t){let e={velocity:be.velocity,stiffness:be.stiffness,damping:be.damping,mass:be.mass,isResolvedFromDuration:!1,...t};if(!Q1(t,C8)&&Q1(t,E8))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(n*1.2),s=i*i,a=2*bo(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:be.mass,stiffness:s,damping:a}}else{const n=x8({...t,velocity:0});e={...e,...n,mass:be.mass},e.isResolvedFromDuration=!0}return e}function gu(t=be.visualDuration,e=be.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:s}=n;const a=n.keyframes[0],c=n.keyframes[n.keyframes.length-1],u={done:!1,value:a},{stiffness:d,damping:h,mass:p,duration:m,velocity:y,isResolvedFromDuration:b}=T8({...n,velocity:-An(n.velocity||0)}),x=y||0,w=h/(2*Math.sqrt(d*p)),S=c-a,E=An(Math.sqrt(d/p)),D=Math.abs(S)<5;i||(i=D?be.restSpeed.granular:be.restSpeed.default),s||(s=D?be.restDelta.granular:be.restDelta.default);let T;if(w<1){const R=dp(E,w);T=A=>{const O=Math.exp(-w*E*A);return c-O*((x+w*E*S)/R*Math.sin(R*A)+S*Math.cos(R*A))}}else if(w===1)T=R=>c-Math.exp(-E*R)*(S+(x+E*S)*R);else{const R=E*Math.sqrt(w*w-1);T=A=>{const O=Math.exp(-w*E*A),k=Math.min(R*A,300);return c-O*((x+w*E*S)*Math.sinh(k)+R*S*Math.cosh(k))/R}}const C={calculatedDuration:b&&m||null,next:R=>{const A=T(R);if(b)u.done=R>=m;else{let O=R===0?x:0;w<1&&(O=R===0?Zn(x):K1(T,R,A));const k=Math.abs(O)<=i,H=Math.abs(c-A)<=s;u.done=k&&H}return u.value=u.done?c:A,u},toString:()=>{const R=Math.min(up(C),mu),A=Z1(O=>C.next(R*O).value,R,30);return R+"ms "+A},toTransition:()=>{}};return C}gu.applyToOptions=t=>{const e=v8(t,100,gu);return t.ease=e.ease,t.duration=Zn(e.duration),t.type="keyframes",t};function hp({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:a=500,modifyTarget:c,min:u,max:d,restDelta:h=.5,restSpeed:p}){const m=t[0],y={done:!1,value:m},b=k=>u!==void 0&&k<u||d!==void 0&&k>d,x=k=>u===void 0?d:d===void 0||Math.abs(u-k)<Math.abs(d-k)?u:d;let w=n*e;const S=m+w,E=c===void 0?S:c(S);E!==S&&(w=E-m);const D=k=>-w*Math.exp(-k/i),T=k=>E+D(k),C=k=>{const H=D(k),$=T(k);y.done=Math.abs(H)<=h,y.value=y.done?E:$};let R,A;const O=k=>{b(y.value)&&(R=k,A=gu({keyframes:[y.value,x(y.value)],velocity:K1(T,k,y.value),damping:s,stiffness:a,restDelta:h,restSpeed:p}))};return O(0),{calculatedDuration:null,next:k=>{let H=!1;return!A&&R===void 0&&(H=!0,C(k),O(k)),R!==void 0&&k>=R?A.next(k-R):(!H&&C(k),y)}}}function _8(t,e,n){const i=[],s=n||Bo.mix||F1,a=t.length-1;for(let c=0;c<a;c++){let u=s(t[c],t[c+1]);if(e){const d=Array.isArray(e)?e[c]||Nn:e;u=Xa(d,u)}i.push(u)}return i}function N8(t,e,{clamp:n=!0,ease:i,mixer:s}={}){const a=t.length;if(Kh(a===e.length),a===1)return()=>e[0];if(a===2&&e[0]===e[1])return()=>e[1];const c=t[0]===t[1];t[0]>t[a-1]&&(t=[...t].reverse(),e=[...e].reverse());const u=_8(e,i,s),d=u.length,h=p=>{if(c&&p<t[0])return e[0];let m=0;if(d>1)for(;m<t.length-2&&!(p<t[m+1]);m++);const y=Fa(t[m],t[m+1],p);return u[m](y)};return n?p=>h(bo(t[0],t[a-1],p)):h}function A8(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=Fa(0,e,i);t.push(ye(n,1,s))}}function M8(t){const e=[0];return A8(e,t.length-1),e}function R8(t,e){return t.map(n=>n*e)}function k8(t,e){return t.map(()=>e||k1).splice(0,t.length-1)}function tl({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=U6(i)?i.map(D1):D1(i),a={done:!1,value:e[0]},c=R8(n&&n.length===e.length?n:M8(e),t),u=N8(c,e,{ease:Array.isArray(s)?s:k8(e,s)});return{calculatedDuration:t,next:d=>(a.value=u(d),a.done=d>=t,a)}}const O8=t=>t!==null;function pp(t,{repeat:e,repeatType:n="loop"},i,s=1){const a=t.filter(O8),u=s<0||e&&n!=="loop"&&e%2===1?0:a.length-1;return!u||i===void 0?a[u]:i}const D8={decay:hp,inertia:hp,tween:tl,keyframes:tl,spring:gu};function W1(t){typeof t.type=="string"&&(t.type=D8[t.type])}class mp{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const j8=t=>t/100;class gp extends mp{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==Fe.now()&&this.tick(Fe.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;W1(e);const{type:n=tl,repeat:i=0,repeatDelay:s=0,repeatType:a,velocity:c=0}=e;let{keyframes:u}=e;const d=n||tl;d!==tl&&typeof u[0]!="number"&&(this.mixKeyframes=Xa(j8,F1(u[0],u[1])),u=[0,100]);const h=d({...e,keyframes:u});a==="mirror"&&(this.mirroredGenerator=d({...e,keyframes:[...u].reverse(),velocity:-c})),h.calculatedDuration===null&&(h.calculatedDuration=up(h));const{calculatedDuration:p}=h;this.calculatedDuration=p,this.resolvedDuration=p+s,this.totalDuration=this.resolvedDuration*(i+1)-s,this.generator=h}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:i,totalDuration:s,mixKeyframes:a,mirroredGenerator:c,resolvedDuration:u,calculatedDuration:d}=this;if(this.startTime===null)return i.next(0);const{delay:h=0,keyframes:p,repeat:m,repeatType:y,repeatDelay:b,type:x,onUpdate:w,finalKeyframe:S}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const E=this.currentTime-h*(this.playbackSpeed>=0?1:-1),D=this.playbackSpeed>=0?E<0:E>s;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let T=this.currentTime,C=i;if(m){const k=Math.min(this.currentTime,s)/u;let H=Math.floor(k),$=k%1;!$&&k>=1&&($=1),$===1&&H--,H=Math.min(H,m+1),H%2&&(y==="reverse"?($=1-$,b&&($-=b/u)):y==="mirror"&&(C=c)),T=bo(0,1,$)*u}const R=D?{done:!1,value:p[0]}:C.next(T);a&&(R.value=a(R.value));let{done:A}=R;!D&&d!==null&&(A=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return O&&x!==hp&&(R.value=pp(p,this.options,S,this.speed)),w&&w(R.value),O&&this.finish(),R}then(e,n){return this.finished.then(e,n)}get duration(){return An(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+An(e)}get time(){return An(this.currentTime)}set time(e){e=Zn(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(Fe.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=An(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=y8,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),this.options.onPlay?.();const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=n??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Fe.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function z8(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const kr=t=>t*180/Math.PI,yp=t=>{const e=kr(Math.atan2(t[1],t[0]));return vp(e)},V8={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:yp,rotateZ:yp,skewX:t=>kr(Math.atan(t[1])),skewY:t=>kr(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},vp=t=>(t=t%360,t<0&&(t+=360),t),J1=yp,tS=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),eS=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),L8={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:tS,scaleY:eS,scale:t=>(tS(t)+eS(t))/2,rotateX:t=>vp(kr(Math.atan2(t[6],t[5]))),rotateY:t=>vp(kr(Math.atan2(-t[2],t[0]))),rotateZ:J1,rotate:J1,skewX:t=>kr(Math.atan(t[4])),skewY:t=>kr(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function bp(t){return t.includes("scale")?1:0}function xp(t,e){if(!t||t==="none")return bp(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,s;if(n)i=L8,s=n;else{const u=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=V8,s=u}if(!s)return bp(e);const a=i[e],c=s[1].split(",").map(B8);return typeof a=="function"?a(c):c[a]}const I8=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return xp(n,e)};function B8(t){return parseFloat(t.trim())}const Es=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Cs=new Set(Es),nS=t=>t===ws||t===St,P8=new Set(["x","y","z"]),H8=Es.filter(t=>!P8.has(t));function U8(t){const e=[];return H8.forEach(n=>{const i=t.getValue(n);i!==void 0&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e}const Ei={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>xp(e,"x"),y:(t,{transform:e})=>xp(e,"y")};Ei.translateX=Ei.x,Ei.translateY=Ei.y;const Or=new Set;let wp=!1,Sp=!1,Ep=!1;function oS(){if(Sp){const t=Array.from(Or).filter(i=>i.needsMeasurement),e=new Set(t.map(i=>i.element)),n=new Map;e.forEach(i=>{const s=U8(i);s.length&&(n.set(i,s),i.render())}),t.forEach(i=>i.measureInitialState()),e.forEach(i=>{i.render();const s=n.get(i);s&&s.forEach(([a,c])=>{i.getValue(a)?.set(c)})}),t.forEach(i=>i.measureEndState()),t.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}Sp=!1,wp=!1,Or.forEach(t=>t.complete(Ep)),Or.clear()}function iS(){Or.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Sp=!0)})}function $8(){Ep=!0,iS(),oS(),Ep=!1}class Cp{constructor(e,n,i,s,a,c=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=i,this.motionValue=s,this.element=a,this.isAsync=c}scheduleResolve(){this.state="scheduled",this.isAsync?(Or.add(this),wp||(wp=!0,ae.read(iS),ae.resolveKeyframes(oS))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:i,motionValue:s}=this;if(e[0]===null){const a=s?.get(),c=e[e.length-1];if(a!==void 0)e[0]=a;else if(i&&n){const u=i.readValue(n,c);u!=null&&(e[0]=u)}e[0]===void 0&&(e[0]=c),s&&a===void 0&&s.set(e[0])}z8(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Or.delete(this)}cancel(){this.state==="scheduled"&&(Or.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const q8=t=>t.startsWith("--");function Y8(t,e,n){q8(e)?t.style.setProperty(e,n):t.style[e]=n}const G8={};function rS(t,e){const n=w1(t);return()=>G8[e]??n()}const X8=rS(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),sS=rS(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),el=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,aS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:el([0,.65,.55,1]),circOut:el([.55,0,1,.45]),backIn:el([.31,.01,.66,-.59]),backOut:el([.33,1.53,.69,.99])};function lS(t,e){if(t)return typeof t=="function"?sS()?Z1(t,e):"ease-out":O1(t)?el(t):Array.isArray(t)?t.map(n=>lS(n,e)||aS.easeOut):aS[t]}function F8(t,e,n,{delay:i=0,duration:s=300,repeat:a=0,repeatType:c="loop",ease:u="easeOut",times:d}={},h=void 0){const p={[e]:n};d&&(p.offset=d);const m=lS(u,s);Array.isArray(m)&&(p.easing=m);const y={delay:i,duration:s,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:a+1,direction:c==="reverse"?"alternate":"normal"};return h&&(y.pseudoElement=h),t.animate(p,y)}function cS(t){return typeof t=="function"&&"applyToOptions"in t}function Z8({type:t,...e}){return cS(t)&&sS()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class uS extends mp{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:i,keyframes:s,pseudoElement:a,allowFlatten:c=!1,finalKeyframe:u,onComplete:d}=e;this.isPseudoElement=!!a,this.allowFlatten=c,this.options=e,Kh(typeof e.type!="string");const h=Z8(e);this.animation=F8(n,i,s,h,a),h.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const p=pp(s,this.options,u,this.speed);this.updateMotionValue?this.updateMotionValue(p):Y8(n,i,p),this.animation.cancel()}d?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return An(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+An(e)}get time(){return An(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Zn(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&X8()?(this.animation.timeline=e,Nn):n(this)}}const fS={anticipate:A1,backInOut:N1,circInOut:R1};function K8(t){return t in fS}function Q8(t){typeof t.ease=="string"&&K8(t.ease)&&(t.ease=fS[t.ease])}const Tp=10;class W8 extends uS{constructor(e){Q8(e),W1(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:i,onComplete:s,element:a,...c}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const u=new gp({...c,autoplay:!1}),d=Math.max(Tp,Fe.now()-this.startTime),h=bo(0,Tp,d-Tp);n.setWithVelocity(u.sample(Math.max(0,d-h)).value,u.sample(d).value,h),u.stop()}}const dS=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Kn.test(t)||t==="0")&&!t.startsWith("url("));function J8(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function tB(t,e,n,i){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const a=t[t.length-1],c=dS(s,e),u=dS(a,e);return!c||!u?!1:J8(t)||(n==="spring"||cS(n))&&i}function _p(t){t.duration=0,t.type="keyframes"}const eB=new Set(["opacity","clipPath","filter","transform"]),nB=w1(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function oB(t){const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:a,type:c}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:d,transformTemplate:h}=e.owner.getProps();return nB()&&n&&eB.has(n)&&(n!=="transform"||!h)&&!d&&!i&&s!=="mirror"&&a!==0&&c!=="inertia"}const iB=40;class rB extends mp{constructor({autoplay:e=!0,delay:n=0,type:i="keyframes",repeat:s=0,repeatDelay:a=0,repeatType:c="loop",keyframes:u,name:d,motionValue:h,element:p,...m}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Fe.now();const y={autoplay:e,delay:n,type:i,repeat:s,repeatDelay:a,repeatType:c,name:d,motionValue:h,element:p,...m},b=p?.KeyframeResolver||Cp;this.keyframeResolver=new b(u,(x,w,S)=>this.onKeyframesResolved(x,w,y,!S),d,h,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,i,s){this.keyframeResolver=void 0;const{name:a,type:c,velocity:u,delay:d,isHandoff:h,onUpdate:p}=i;this.resolvedAt=Fe.now(),tB(e,a,c,u)||((Bo.instantAnimations||!d)&&p?.(pp(e,i,n)),e[0]=e[e.length-1],_p(i),i.repeat=0);const y={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>iB?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:e},b=!h&&oB(y),x=y.motionValue?.owner?.current,w=b?new W8({...y,element:x}):new gp(y);w.finished.then(()=>{this.notifyFinished()}).catch(Nn),this.pendingTimeline&&(this.stopTimeline=w.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=w}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),$8()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function hS(t,e,n,i=0,s=1){const a=Array.from(t).sort((h,p)=>h.sortNodePosition(p)).indexOf(e),c=t.size,u=(c-1)*i;return typeof n=="function"?n(a,c):s===1?a*i:u-a*i}const sB=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function aB(t){const e=sB.exec(t);if(!e)return[,];const[,n,i,s]=e;return[`--${n??i}`,s]}function pS(t,e,n=1){const[i,s]=aB(t);if(!i)return;const a=window.getComputedStyle(e).getPropertyValue(i);if(a){const c=a.trim();return v1(c)?parseFloat(c):c}return ep(s)?pS(s,e,n+1):s}const lB={type:"spring",stiffness:500,damping:25,restSpeed:10},cB=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),uB={type:"keyframes",duration:.8},fB={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},dB=(t,{keyframes:e})=>e.length>2?uB:Cs.has(t)?t.startsWith("scale")?cB(e[1]):lB:fB,hB=t=>t!==null;function pB(t,{repeat:e,repeatType:n="loop"},i){const s=t.filter(hB),a=e&&n!=="loop"&&e%2===1?0:s.length-1;return s[a]}function mS(t,e){if(t?.inherit&&e){const{inherit:n,...i}=t;return{...e,...i}}return t}function Np(t,e){const n=t?.[e]??t?.default??t;return n!==t?mS(n,t):n}function mB({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:s,repeat:a,repeatType:c,repeatDelay:u,from:d,elapsed:h,...p}){return!!Object.keys(p).length}const Ap=(t,e,n,i={},s,a)=>c=>{const u=Np(i,t)||{},d=u.delay||i.delay||0;let{elapsed:h=0}=i;h=h-Zn(d);const p={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...u,delay:-h,onUpdate:y=>{e.set(y),u.onUpdate&&u.onUpdate(y)},onComplete:()=>{c(),u.onComplete&&u.onComplete()},name:t,motionValue:e,element:a?void 0:s};mB(u)||Object.assign(p,dB(t,p)),p.duration&&(p.duration=Zn(p.duration)),p.repeatDelay&&(p.repeatDelay=Zn(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let m=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(_p(p),p.delay===0&&(m=!0)),(Bo.instantAnimations||Bo.skipAnimations||s?.shouldSkipAnimations)&&(m=!0,_p(p),p.delay=0),p.allowFlatten=!u.type&&!u.ease,m&&!a&&e.get()!==void 0){const y=pB(p.keyframes,u);if(y!==void 0){ae.update(()=>{p.onUpdate(y),p.onComplete()});return}}return u.isSync?new gp(p):new rB(p)};function gS(t){const e=[{},{}];return t?.values.forEach((n,i)=>{e[0][i]=n.get(),e[1][i]=n.getVelocity()}),e}function Mp(t,e,n,i){if(typeof e=="function"){const[s,a]=gS(i);e=e(n!==void 0?n:t.custom,s,a)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,a]=gS(i);e=e(n!==void 0?n:t.custom,s,a)}return e}function Ts(t,e,n){const i=t.getProps();return Mp(i,e,n!==void 0?n:i.custom,t)}const yS=new Set(["width","height","top","left","right","bottom",...Es]),vS=30,gB=t=>!isNaN(parseFloat(t));class yB{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{const s=Fe.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=Fe.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=gB(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Qh);const i=this.events[e].add(n);return e==="change"?()=>{i(),ae.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Fe.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>vS)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,vS);return S1(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function _s(t,e){return new yB(t,e)}const Rp=t=>Array.isArray(t);function vB(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,_s(n))}function bB(t){return Rp(t)?t[t.length-1]||0:t}function xB(t,e){const n=Ts(t,e);let{transitionEnd:i={},transition:s={},...a}=n||{};a={...a,...i};for(const c in a){const u=bB(a[c]);vB(t,c,u)}}const Xe=t=>!!(t&&t.getVelocity);function wB(t){return!!(Xe(t)&&t.add)}function kp(t,e){const n=t.getValue("willChange");if(wB(n))return n.add(e);if(!n&&Bo.WillChange){const i=new Bo.WillChange("auto");t.addValue("willChange",i),i.add(e)}}function Op(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const bS="data-"+Op("framerAppearId");function xS(t){return t.props[bS]}function SB({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,i}function wS(t,e,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:a,transitionEnd:c,...u}=e;const d=t.getDefaultTransition();a=a?mS(a,d):d;const h=a?.reduceMotion;i&&(a=i);const p=[],m=s&&t.animationState&&t.animationState.getState()[s];for(const y in u){const b=t.getValue(y,t.latestValues[y]??null),x=u[y];if(x===void 0||m&&SB(m,y))continue;const w={delay:n,...Np(a||{},y)},S=b.get();if(S!==void 0&&!b.isAnimating&&!Array.isArray(x)&&x===S&&!w.velocity)continue;let E=!1;if(window.MotionHandoffAnimation){const C=xS(t);if(C){const R=window.MotionHandoffAnimation(C,y,ae);R!==null&&(w.startTime=R,E=!0)}}kp(t,y);const D=h??t.shouldReduceMotion;b.start(Ap(y,b,x,D&&yS.has(y)?{type:!1}:w,t,E));const T=b.animation;T&&p.push(T)}if(c){const y=()=>ae.update(()=>{c&&xB(t,c)});p.length?Promise.all(p).then(y):y()}return p}function Dp(t,e,n={}){const i=Ts(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const a=i?()=>Promise.all(wS(t,i,n)):()=>Promise.resolve(),c=t.variantChildren&&t.variantChildren.size?(d=0)=>{const{delayChildren:h=0,staggerChildren:p,staggerDirection:m}=s;return EB(t,e,d,h,p,m,n)}:()=>Promise.resolve(),{when:u}=s;if(u){const[d,h]=u==="beforeChildren"?[a,c]:[c,a];return d().then(()=>h())}else return Promise.all([a(),c(n.delay)])}function EB(t,e,n=0,i=0,s=0,a=1,c){const u=[];for(const d of t.variantChildren)d.notify("AnimationStart",e),u.push(Dp(d,e,{...c,delay:n+(typeof i=="function"?0:i)+hS(t.variantChildren,d,i,s,a)}).then(()=>d.notify("AnimationComplete",e)));return Promise.all(u)}function CB(t,e,n={}){t.notify("AnimationStart",e);let i;if(Array.isArray(e)){const s=e.map(a=>Dp(t,a,n));i=Promise.all(s)}else if(typeof e=="string")i=Dp(t,e,n);else{const s=typeof e=="function"?Ts(t,e,n.custom):e;i=Promise.all(wS(t,s,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}const TB={test:t=>t==="auto",parse:t=>t},SS=t=>e=>e.test(t),ES=[ws,St,xo,Si,e8,t8,TB],CS=t=>ES.find(SS(t));function _B(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||x1(t):!0}const NB=new Set(["brightness","contrast","saturate","opacity"]);function AB(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[i]=n.match(np)||[];if(!i)return t;const s=n.replace(i,"");let a=NB.has(e)?1:0;return i!==n&&(a*=100),e+"("+a+s+")"}const MB=/\b([a-z-]*)\(.*?\)/gu,jp={...Kn,getAnimatableNone:t=>{const e=t.match(MB);return e?e.map(AB).join(" "):t}},zp={...Kn,getAnimatableNone:t=>{const e=Kn.parse(t);return Kn.createTransformer(t)(e.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},TS={...ws,transform:Math.round},Vp={borderWidth:St,borderTopWidth:St,borderRightWidth:St,borderBottomWidth:St,borderLeftWidth:St,borderRadius:St,borderTopLeftRadius:St,borderTopRightRadius:St,borderBottomRightRadius:St,borderBottomLeftRadius:St,width:St,maxWidth:St,height:St,maxHeight:St,top:St,right:St,bottom:St,left:St,inset:St,insetBlock:St,insetBlockStart:St,insetBlockEnd:St,insetInline:St,insetInlineStart:St,insetInlineEnd:St,padding:St,paddingTop:St,paddingRight:St,paddingBottom:St,paddingLeft:St,paddingBlock:St,paddingBlockStart:St,paddingBlockEnd:St,paddingInline:St,paddingInlineStart:St,paddingInlineEnd:St,margin:St,marginTop:St,marginRight:St,marginBottom:St,marginLeft:St,marginBlock:St,marginBlockStart:St,marginBlockEnd:St,marginInline:St,marginInlineStart:St,marginInlineEnd:St,fontSize:St,backgroundPositionX:St,backgroundPositionY:St,...{rotate:Si,rotateX:Si,rotateY:Si,rotateZ:Si,scale:hu,scaleX:hu,scaleY:hu,scaleZ:hu,skew:Si,skewX:Si,skewY:Si,distance:St,translateX:St,translateY:St,translateZ:St,x:St,y:St,z:St,perspective:St,transformPerspective:St,opacity:Ka,originX:B1,originY:B1,originZ:St},zIndex:TS,fillOpacity:Ka,strokeOpacity:Ka,numOctaves:TS},RB={...Vp,color:Ne,backgroundColor:Ne,outlineColor:Ne,fill:Ne,stroke:Ne,borderColor:Ne,borderTopColor:Ne,borderRightColor:Ne,borderBottomColor:Ne,borderLeftColor:Ne,filter:jp,WebkitFilter:jp,mask:zp,WebkitMask:zp},_S=t=>RB[t],kB=new Set([jp,zp]);function NS(t,e){let n=_S(t);return kB.has(n)||(n=Kn),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const OB=new Set(["auto","none","0"]);function DB(t,e,n){let i=0,s;for(;i<t.length&&!s;){const a=t[i];typeof a=="string"&&!OB.has(a)&&Ja(a).values.length&&(s=t[i]),i++}if(s&&n)for(const a of e)t[a]=NS(n,s)}class jB extends Cp{constructor(e,n,i,s,a){super(e,n,i,s,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let p=0;p<e.length;p++){let m=e[p];if(typeof m=="string"&&(m=m.trim(),ep(m))){const y=pS(m,n.current);y!==void 0&&(e[p]=y),p===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!yS.has(i)||e.length!==2)return;const[s,a]=e,c=CS(s),u=CS(a),d=L1(s),h=L1(a);if(d!==h&&Ei[i]){this.needsMeasurement=!0;return}if(c!==u)if(nS(c)&&nS(u))for(let p=0;p<e.length;p++){const m=e[p];typeof m=="string"&&(e[p]=parseFloat(m))}else Ei[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,i=[];for(let s=0;s<e.length;s++)(e[s]===null||_B(e[s]))&&i.push(s);i.length&&DB(e,i,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:i}=this;if(!e||!e.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ei[i](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(i,s).jump(s,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:i}=this;if(!e||!e.current)return;const s=e.getValue(n);s&&s.jump(this.measuredOrigin,!1);const a=i.length-1,c=i[a];i[a]=Ei[n](e.measureViewportBox(),window.getComputedStyle(e.current)),c!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=c),this.removedTransforms?.length&&this.removedTransforms.forEach(([u,d])=>{e.getValue(u).set(d)}),this.resolveNoneKeyframes()}}const zB=new Set(["opacity","clipPath","filter","transform"]);function AS(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let i=document;const s=n?.[t]??i.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t).filter(i=>i!=null)}const MS=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Lp(t){return b1(t)&&"offsetHeight"in t}const{schedule:Ip}=j1(queueMicrotask,!1),Qn={x:!1,y:!1};function RS(){return Qn.x||Qn.y}function VB(t){return t==="x"||t==="y"?Qn[t]?null:(Qn[t]=!0,()=>{Qn[t]=!1}):Qn.x||Qn.y?null:(Qn.x=Qn.y=!0,()=>{Qn.x=Qn.y=!1})}function kS(t,e){const n=AS(t),i=new AbortController,s={passive:!0,...e,signal:i.signal};return[n,s,()=>i.abort()]}function LB(t){return!(t.pointerType==="touch"||RS())}function IB(t,e,n={}){const[i,s,a]=kS(t,n);return i.forEach(c=>{let u=!1,d=!1,h;const p=()=>{c.removeEventListener("pointerleave",x)},m=S=>{h&&(h(S),h=void 0),p()},y=S=>{u=!1,window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y),d&&(d=!1,m(S))},b=()=>{u=!0,window.addEventListener("pointerup",y,s),window.addEventListener("pointercancel",y,s)},x=S=>{if(S.pointerType!=="touch"){if(u){d=!0;return}m(S)}},w=S=>{if(!LB(S))return;d=!1;const E=e(c,S);typeof E=="function"&&(h=E,c.addEventListener("pointerleave",x,s))};c.addEventListener("pointerenter",w,s),c.addEventListener("pointerdown",b,s)}),a}const OS=(t,e)=>e?t===e?!0:OS(t,e.parentElement):!1,Bp=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,BB=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function PB(t){return BB.has(t.tagName)||t.isContentEditable===!0}const HB=new Set(["INPUT","SELECT","TEXTAREA"]);function UB(t){return HB.has(t.tagName)||t.isContentEditable===!0}const yu=new WeakSet;function DS(t){return e=>{e.key==="Enter"&&t(e)}}function Pp(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const $B=(t,e)=>{const n=t.currentTarget;if(!n)return;const i=DS(()=>{if(yu.has(n))return;Pp(n,"down");const s=DS(()=>{Pp(n,"up")}),a=()=>Pp(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",a,e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)};function jS(t){return Bp(t)&&!RS()}const zS=new WeakSet;function qB(t,e,n={}){const[i,s,a]=kS(t,n),c=u=>{const d=u.currentTarget;if(!jS(u)||zS.has(u))return;yu.add(d),n.stopPropagation&&zS.add(u);const h=e(d,u),p=(b,x)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",y),yu.has(d)&&yu.delete(d),jS(b)&&typeof h=="function"&&h(b,{success:x})},m=b=>{p(b,d===window||d===document||n.useGlobalTarget||OS(d,b.target))},y=b=>{p(b,!1)};window.addEventListener("pointerup",m,s),window.addEventListener("pointercancel",y,s)};return i.forEach(u=>{(n.useGlobalTarget?window:u).addEventListener("pointerdown",c,s),Lp(u)&&(u.addEventListener("focus",h=>$B(h,s)),!PB(u)&&!u.hasAttribute("tabindex")&&(u.tabIndex=0))}),a}function Hp(t){return b1(t)&&"ownerSVGElement"in t}const vu=new WeakMap;let bu;const VS=(t,e,n)=>(i,s)=>s&&s[0]?s[0][t+"Size"]:Hp(i)&&"getBBox"in i?i.getBBox()[e]:i[n],YB=VS("inline","width","offsetWidth"),GB=VS("block","height","offsetHeight");function XB({target:t,borderBoxSize:e}){vu.get(t)?.forEach(n=>{n(t,{get width(){return YB(t,e)},get height(){return GB(t,e)}})})}function FB(t){t.forEach(XB)}function ZB(){typeof ResizeObserver>"u"||(bu=new ResizeObserver(FB))}function KB(t,e){bu||ZB();const n=AS(t);return n.forEach(i=>{let s=vu.get(i);s||(s=new Set,vu.set(i,s)),s.add(e),bu?.observe(i)}),()=>{n.forEach(i=>{const s=vu.get(i);s?.delete(e),s?.size||bu?.unobserve(i)})}}const xu=new Set;let Ns;function QB(){Ns=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};xu.forEach(e=>e(t))},window.addEventListener("resize",Ns)}function WB(t){return xu.add(t),Ns||QB(),()=>{xu.delete(t),!xu.size&&typeof Ns=="function"&&(window.removeEventListener("resize",Ns),Ns=void 0)}}function LS(t,e){return typeof t=="function"?WB(t):KB(t,e)}function JB(t){return Hp(t)&&t.tagName==="svg"}const tP=[...ES,Ne,Kn],eP=t=>tP.find(SS(t)),IS=()=>({translate:0,scale:1,origin:0,originPoint:0}),As=()=>({x:IS(),y:IS()}),BS=()=>({min:0,max:0}),ze=()=>({x:BS(),y:BS()}),nP=new WeakMap;function wu(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function nl(t){return typeof t=="string"||Array.isArray(t)}const Up=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],$p=["initial",...Up];function Su(t){return wu(t.animate)||$p.some(e=>nl(t[e]))}function PS(t){return!!(Su(t)||t.variants)}function oP(t,e,n){for(const i in e){const s=e[i],a=n[i];if(Xe(s))t.addValue(i,s);else if(Xe(a))t.addValue(i,_s(s,{owner:t}));else if(a!==s)if(t.hasValue(i)){const c=t.getValue(i);c.liveStyle===!0?c.jump(s):c.hasAnimated||c.set(s)}else{const c=t.getStaticValue(i);t.addValue(i,_s(c!==void 0?c:s,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const qp={current:null},HS={current:!1},iP=typeof window<"u";function rP(){if(HS.current=!0,!!iP)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>qp.current=t.matches;t.addEventListener("change",e),e()}else qp.current=!1}const US=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Eu={};function $S(t){Eu=t}function sP(){return Eu}class aP{scrapeMotionValuesFromProps(e,n,i){return{}}constructor({parent:e,props:n,presenceContext:i,reducedMotionConfig:s,skipAnimations:a,blockInitialAnimation:c,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Cp,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const b=Fe.now();this.renderScheduledAt<b&&(this.renderScheduledAt=b,ae.render(this.render,!1,!0))};const{latestValues:h,renderState:p}=u;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=p,this.parent=e,this.props=n,this.presenceContext=i,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=a,this.options=d,this.blockInitialAnimation=!!c,this.isControllingVariants=Su(n),this.isVariantNode=PS(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:m,...y}=this.scrapeMotionValuesFromProps(n,{},this);for(const b in y){const x=y[b];h[b]!==void 0&&Xe(x)&&x.set(h[b])}}mount(e){if(this.hasBeenMounted)for(const n in this.initialValues)this.values.get(n)?.jump(this.initialValues[n]),this.latestValues[n]=this.initialValues[n];this.current=e,nP.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,i)=>this.bindToMotionValue(i,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(HS.current||rP(),this.shouldReduceMotion=qp.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),wi(this.notifyUpdate),wi(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&zB.has(e)&&this.current instanceof HTMLElement){const{factory:c,keyframes:u,times:d,ease:h,duration:p}=n.accelerate,m=new uS({element:this.current,name:e,keyframes:u,times:d,ease:h,duration:Zn(p)}),y=c(m);this.valueSubscriptions.set(e,()=>{y(),m.cancel()});return}const i=Cs.has(e);i&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",c=>{this.latestValues[e]=c,this.props.onUpdate&&ae.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;typeof window<"u"&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),a&&a(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Eu){const n=Eu[e];if(!n)continue;const{isEnabled:i,Feature:s}=n;if(!this.features[e]&&s&&i(this.props)&&(this.features[e]=new s(this)),this.features[e]){const a=this.features[e];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ze()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i<US.length;i++){const s=US[i];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const a="on"+s,c=e[a];c&&(this.propEventSubscriptions[s]=this.on(s,c))}this.prevMotionValues=oP(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const i=this.values.get(e);n!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return i===void 0&&n!==void 0&&(i=_s(n===null?void 0:n,{owner:this}),this.addValue(e,i)),i}readValue(e,n){let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(v1(i)||x1(i))?i=parseFloat(i):!eP(i)&&Kn.test(n)&&(i=NS(e,n)),this.setBaseTarget(e,Xe(i)?i.get():i)),Xe(i)?i.get():i}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const a=Mp(this.props,n,this.presenceContext?.custom);a&&(i=a[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Xe(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Qh),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){Ip.render(this.render)}}class qS extends aP{constructor(){super(...arguments),this.KeyframeResolver=jB}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const i=e.style;return i?i[n]:void 0}removeValueFromRenderState(e,{vars:n,style:i}){delete n[e],delete i[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Xe(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Ci{constructor(e){this.isMounted=!1,this.node=e}update(){}}function YS({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function lP({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function cP(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function Yp(t){return t===void 0||t===1}function Gp({scale:t,scaleX:e,scaleY:n}){return!Yp(t)||!Yp(e)||!Yp(n)}function Dr(t){return Gp(t)||GS(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function GS(t){return XS(t.x)||XS(t.y)}function XS(t){return t&&t!=="0%"}function Cu(t,e,n){const i=t-n,s=e*i;return n+s}function FS(t,e,n,i,s){return s!==void 0&&(t=Cu(t,s,i)),Cu(t,n,i)+e}function Xp(t,e=0,n=1,i,s){t.min=FS(t.min,e,n,i,s),t.max=FS(t.max,e,n,i,s)}function ZS(t,{x:e,y:n}){Xp(t.x,e.translate,e.scale,e.originPoint),Xp(t.y,n.translate,n.scale,n.originPoint)}const KS=.999999999999,QS=1.0000000000001;function uP(t,e,n,i=!1){const s=n.length;if(!s)return;e.x=e.y=1;let a,c;for(let u=0;u<s;u++){a=n[u],c=a.projectionDelta;const{visualElement:d}=a.options;d&&d.props.style&&d.props.style.display==="contents"||(i&&a.options.layoutScroll&&a.scroll&&a!==a.root&&Rs(t,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),c&&(e.x*=c.x.scale,e.y*=c.y.scale,ZS(t,c)),i&&Dr(a.latestValues)&&Rs(t,a.latestValues))}e.x<QS&&e.x>KS&&(e.x=1),e.y<QS&&e.y>KS&&(e.y=1)}function Ms(t,e){t.min=t.min+e,t.max=t.max+e}function WS(t,e,n,i,s=.5){const a=ye(t.min,t.max,s);Xp(t,e,n,a,i)}function Rs(t,e){WS(t.x,e.x,e.scaleX,e.scale,e.originX),WS(t.y,e.y,e.scaleY,e.scale,e.originY)}function JS(t,e){return YS(cP(t.getBoundingClientRect(),e))}function fP(t,e,n){const i=JS(t,n),{scroll:s}=e;return s&&(Ms(i.x,s.offset.x),Ms(i.y,s.offset.y)),i}const dP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},hP=Es.length;function pP(t,e,n){let i="",s=!0;for(let a=0;a<hP;a++){const c=Es[a],u=t[c];if(u===void 0)continue;let d=!0;if(typeof u=="number")d=u===(c.startsWith("scale")?1:0);else{const h=parseFloat(u);d=c.startsWith("scale")?h===1:h===0}if(!d||n){const h=MS(u,Vp[c]);if(!d){s=!1;const p=dP[c]||c;i+=`${p}(${h}) `}n&&(e[c]=h)}}return i=i.trim(),n?i=n(e,s?"":i):s&&(i="none"),i}function Fp(t,e,n){const{style:i,vars:s,transformOrigin:a}=t;let c=!1,u=!1;for(const d in e){const h=e[d];if(Cs.has(d)){c=!0;continue}else if(V1(d)){s[d]=h;continue}else{const p=MS(h,Vp[d]);d.startsWith("origin")?(u=!0,a[d]=p):i[d]=p}}if(e.transform||(c||n?i.transform=pP(e,t.transform,n):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:h="50%",originZ:p=0}=a;i.transformOrigin=`${d} ${h} ${p}`}}function tE(t,{style:e,vars:n},i,s){const a=t.style;let c;for(c in e)a[c]=e[c];s?.applyProjectionStyles(a,i);for(c in n)a.setProperty(c,n[c])}function eE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ol={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(St.test(t))t=parseFloat(t);else return t;const n=eE(t,e.target.x),i=eE(t,e.target.y);return`${n}% ${i}%`}},mP={correct:(t,{treeScale:e,projectionDelta:n})=>{const i=t,s=Kn.parse(t);if(s.length>5)return i;const a=Kn.createTransformer(t),c=typeof s[0]!="number"?1:0,u=n.x.scale*e.x,d=n.y.scale*e.y;s[0+c]/=u,s[1+c]/=d;const h=ye(u,d,.5);return typeof s[2+c]=="number"&&(s[2+c]/=h),typeof s[3+c]=="number"&&(s[3+c]/=h),a(s)}},Zp={borderRadius:{...ol,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ol,borderTopRightRadius:ol,borderBottomLeftRadius:ol,borderBottomRightRadius:ol,boxShadow:mP};function nE(t,{layout:e,layoutId:n}){return Cs.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Zp[t]||t==="opacity")}function Kp(t,e,n){const i=t.style,s=e?.style,a={};if(!i)return a;for(const c in i)(Xe(i[c])||s&&Xe(s[c])||nE(c,t)||n?.getValue(c)?.liveStyle!==void 0)&&(a[c]=i[c]);return a}function gP(t){return window.getComputedStyle(t)}class yP extends qS{constructor(){super(...arguments),this.type="html",this.renderInstance=tE}readValueFromInstance(e,n){if(Cs.has(n))return this.projection?.isProjecting?bp(n):I8(e,n);{const i=gP(e),s=(V1(n)?i.getPropertyValue(n):i[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return JS(e,n)}build(e,n,i){Fp(e,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,i){return Kp(e,n,i)}}const vP={offset:"stroke-dashoffset",array:"stroke-dasharray"},bP={offset:"strokeDashoffset",array:"strokeDasharray"};function xP(t,e,n=1,i=0,s=!0){t.pathLength=1;const a=s?vP:bP;t[a.offset]=`${-i}`,t[a.array]=`${e} ${n}`}const wP=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function oE(t,{attrX:e,attrY:n,attrScale:i,pathLength:s,pathSpacing:a=1,pathOffset:c=0,...u},d,h,p){if(Fp(t,u,h),d){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:m,style:y}=t;m.transform&&(y.transform=m.transform,delete m.transform),(y.transform||m.transformOrigin)&&(y.transformOrigin=m.transformOrigin??"50% 50%",delete m.transformOrigin),y.transform&&(y.transformBox=p?.transformBox??"fill-box",delete m.transformBox);for(const b of wP)m[b]!==void 0&&(y[b]=m[b],delete m[b]);e!==void 0&&(m.x=e),n!==void 0&&(m.y=n),i!==void 0&&(m.scale=i),s!==void 0&&xP(m,s,a,c,!1)}const iE=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),rE=t=>typeof t=="string"&&t.toLowerCase()==="svg";function SP(t,e,n,i){tE(t,e,void 0,i);for(const s in e.attrs)t.setAttribute(iE.has(s)?s:Op(s),e.attrs[s])}function sE(t,e,n){const i=Kp(t,e,n);for(const s in t)if(Xe(t[s])||Xe(e[s])){const a=Es.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;i[a]=t[s]}return i}class EP extends qS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ze}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Cs.has(n)){const i=_S(n);return i&&i.default||0}return n=iE.has(n)?n:Op(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,i){return sE(e,n,i)}build(e,n,i){oE(e,n,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(e,n,i,s){SP(e,n,i,s)}mount(e){this.isSVGTag=rE(e.tagName),super.mount(e)}}const CP=$p.length;function aE(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?aE(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<CP;n++){const i=$p[n],s=t.props[i];(nl(s)||s===!1)&&(e[i]=s)}return e}function lE(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}const TP=[...Up].reverse(),_P=Up.length;function NP(t){return e=>Promise.all(e.map(({animation:n,options:i})=>CB(t,n,i)))}function AP(t){let e=NP(t),n=cE(),i=!0;const s=d=>(h,p)=>{const m=Ts(t,p,d==="exit"?t.presenceContext?.custom:void 0);if(m){const{transition:y,transitionEnd:b,...x}=m;h={...h,...x,...b}}return h};function a(d){e=d(t)}function c(d){const{props:h}=t,p=aE(t.parent)||{},m=[],y=new Set;let b={},x=1/0;for(let S=0;S<_P;S++){const E=TP[S],D=n[E],T=h[E]!==void 0?h[E]:p[E],C=nl(T),R=E===d?D.isActive:null;R===!1&&(x=S);let A=T===p[E]&&T!==h[E]&&C;if(A&&i&&t.manuallyAnimateOnMount&&(A=!1),D.protectedKeys={...b},!D.isActive&&R===null||!T&&!D.prevProp||wu(T)||typeof T=="boolean")continue;if(E==="exit"&&D.isActive&&R!==!0){D.prevResolvedValues&&(b={...b,...D.prevResolvedValues});continue}const O=MP(D.prevProp,T);let k=O||E===d&&D.isActive&&!A&&C||S>x&&C,H=!1;const $=Array.isArray(T)?T:[T];let q=$.reduce(s(E),{});R===!1&&(q={});const{prevResolvedValues:F={}}=D,Q={...F,...q},B=I=>{k=!0,y.has(I)&&(H=!0,y.delete(I)),D.needsAnimating[I]=!0;const z=t.getValue(I);z&&(z.liveStyle=!1)};for(const I in Q){const z=q[I],U=F[I];if(b.hasOwnProperty(I))continue;let Y=!1;Rp(z)&&Rp(U)?Y=!lE(z,U):Y=z!==U,Y?z!=null?B(I):y.add(I):z!==void 0&&y.has(I)?B(I):D.protectedKeys[I]=!0}D.prevProp=T,D.prevResolvedValues=q,D.isActive&&(b={...b,...q}),i&&t.blockInitialAnimation&&(k=!1);const P=A&&O;k&&(!P||H)&&m.push(...$.map(I=>{const z={type:E};if(typeof I=="string"&&i&&!P&&t.manuallyAnimateOnMount&&t.parent){const{parent:U}=t,Y=Ts(U,I);if(U.enteringChildren&&Y){const{delayChildren:L}=Y.transition||{};z.delay=hS(U.enteringChildren,t,L)}}return{animation:I,options:z}}))}if(y.size){const S={};if(typeof h.initial!="boolean"){const E=Ts(t,Array.isArray(h.initial)?h.initial[0]:h.initial);E&&E.transition&&(S.transition=E.transition)}y.forEach(E=>{const D=t.getBaseTarget(E),T=t.getValue(E);T&&(T.liveStyle=!0),S[E]=D??null}),m.push({animation:S})}let w=!!m.length;return i&&(h.initial===!1||h.initial===h.animate)&&!t.manuallyAnimateOnMount&&(w=!1),i=!1,w?e(m):Promise.resolve()}function u(d,h){if(n[d].isActive===h)return Promise.resolve();t.variantChildren?.forEach(m=>m.animationState?.setActive(d,h)),n[d].isActive=h;const p=c(d);for(const m in n)n[m].protectedKeys={};return p}return{animateChanges:c,setActive:u,setAnimateFunction:a,getState:()=>n,reset:()=>{n=cE()}}}function MP(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!lE(e,t):!1}function jr(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function cE(){return{animate:jr(!0),whileInView:jr(),whileHover:jr(),whileTap:jr(),whileDrag:jr(),whileFocus:jr(),exit:jr()}}function uE(t,e){t.min=e.min,t.max=e.max}function Wn(t,e){uE(t.x,e.x),uE(t.y,e.y)}function fE(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const dE=1e-4,RP=1-dE,kP=1+dE,hE=.01,OP=0-hE,DP=0+hE;function Ze(t){return t.max-t.min}function jP(t,e,n){return Math.abs(t-e)<=n}function pE(t,e,n,i=.5){t.origin=i,t.originPoint=ye(e.min,e.max,t.origin),t.scale=Ze(n)/Ze(e),t.translate=ye(n.min,n.max,t.origin)-t.originPoint,(t.scale>=RP&&t.scale<=kP||isNaN(t.scale))&&(t.scale=1),(t.translate>=OP&&t.translate<=DP||isNaN(t.translate))&&(t.translate=0)}function il(t,e,n,i){pE(t.x,e.x,n.x,i?i.originX:void 0),pE(t.y,e.y,n.y,i?i.originY:void 0)}function mE(t,e,n){t.min=n.min+e.min,t.max=t.min+Ze(e)}function zP(t,e,n){mE(t.x,e.x,n.x),mE(t.y,e.y,n.y)}function gE(t,e,n){t.min=e.min-n.min,t.max=t.min+Ze(e)}function Tu(t,e,n){gE(t.x,e.x,n.x),gE(t.y,e.y,n.y)}function yE(t,e,n,i,s){return t-=e,t=Cu(t,1/n,i),s!==void 0&&(t=Cu(t,1/s,i)),t}function VP(t,e=0,n=1,i=.5,s,a=t,c=t){if(xo.test(e)&&(e=parseFloat(e),e=ye(c.min,c.max,e/100)-c.min),typeof e!="number")return;let u=ye(a.min,a.max,i);t===a&&(u-=e),t.min=yE(t.min,e,n,u,s),t.max=yE(t.max,e,n,u,s)}function vE(t,e,[n,i,s],a,c){VP(t,e[n],e[i],e[s],e.scale,a,c)}const LP=["x","scaleX","originX"],IP=["y","scaleY","originY"];function bE(t,e,n,i){vE(t.x,e,LP,n?n.x:void 0,i?i.x:void 0),vE(t.y,e,IP,n?n.y:void 0,i?i.y:void 0)}function xE(t){return t.translate===0&&t.scale===1}function wE(t){return xE(t.x)&&xE(t.y)}function SE(t,e){return t.min===e.min&&t.max===e.max}function BP(t,e){return SE(t.x,e.x)&&SE(t.y,e.y)}function EE(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function CE(t,e){return EE(t.x,e.x)&&EE(t.y,e.y)}function TE(t){return Ze(t.x)/Ze(t.y)}function _E(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function wo(t){return[t("x"),t("y")]}function PP(t,e,n){let i="";const s=t.x.translate/e.x,a=t.y.translate/e.y,c=n?.z||0;if((s||a||c)&&(i=`translate3d(${s}px, ${a}px, ${c}px) `),(e.x!==1||e.y!==1)&&(i+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:h,rotate:p,rotateX:m,rotateY:y,skewX:b,skewY:x}=n;h&&(i=`perspective(${h}px) ${i}`),p&&(i+=`rotate(${p}deg) `),m&&(i+=`rotateX(${m}deg) `),y&&(i+=`rotateY(${y}deg) `),b&&(i+=`skewX(${b}deg) `),x&&(i+=`skewY(${x}deg) `)}const u=t.x.scale*e.x,d=t.y.scale*e.y;return(u!==1||d!==1)&&(i+=`scale(${u}, ${d})`),i||"none"}const NE=["TopLeft","TopRight","BottomLeft","BottomRight"],HP=NE.length,AE=t=>typeof t=="string"?parseFloat(t):t,ME=t=>typeof t=="number"||St.test(t);function UP(t,e,n,i,s,a){s?(t.opacity=ye(0,n.opacity??1,$P(i)),t.opacityExit=ye(e.opacity??1,0,qP(i))):a&&(t.opacity=ye(e.opacity??1,n.opacity??1,i));for(let c=0;c<HP;c++){const u=`border${NE[c]}Radius`;let d=RE(e,u),h=RE(n,u);if(d===void 0&&h===void 0)continue;d||(d=0),h||(h=0),d===0||h===0||ME(d)===ME(h)?(t[u]=Math.max(ye(AE(d),AE(h),i),0),(xo.test(h)||xo.test(d))&&(t[u]+="%")):t[u]=h}(e.rotate||n.rotate)&&(t.rotate=ye(e.rotate||0,n.rotate||0,i))}function RE(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const $P=kE(0,.5,M1),qP=kE(.5,.95,Nn);function kE(t,e,n){return i=>i<t?0:i>e?1:n(Fa(t,e,i))}function YP(t,e,n){const i=Xe(t)?t:_s(t);return i.start(Ap("",i,e,n)),i.animation}function rl(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}const GP=(t,e)=>t.depth-e.depth;class XP{constructor(){this.children=[],this.isDirty=!1}add(e){Zh(this.children,e),this.isDirty=!0}remove(e){uu(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(GP),this.isDirty=!1,this.children.forEach(e)}}function FP(t,e){const n=Fe.now(),i=({timestamp:s})=>{const a=s-n;a>=e&&(wi(i),t(a-e))};return ae.setup(i,!0),()=>wi(i)}function _u(t){return Xe(t)?t.get():t}class ZP{constructor(){this.members=[]}add(e){Zh(this.members,e);for(let n=this.members.length-1;n>=0;n--){const i=this.members[n];if(i===e||i===this.lead||i===this.prevLead)continue;const s=i.instance;s&&s.isConnected===!1&&i.isPresent!==!1&&!i.snapshot&&uu(this.members,i)}e.scheduleRender()}remove(e){if(uu(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let i;for(let s=n;s>=0;s--){const a=this.members[s],c=a.instance;if(a.isPresent!==!1&&(!c||c.isConnected!==!1)){i=a;break}}return i?(this.promote(i),!0):!1}promote(e,n){const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.instance&&i.scheduleRender(),e.scheduleRender();const s=i.options.layoutDependency,a=e.options.layoutDependency;if(!(s!==void 0&&a!==void 0&&s===a)){const d=i.instance;d&&d.isConnected===!1&&!i.snapshot||(e.resumeFrom=i,n&&(e.resumeFrom.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0))}const{crossfade:u}=e.options;u===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:i}=e;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Nu={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Qp=["","X","Y","Z"],KP=1e3;let QP=0;function Wp(t,e,n,i){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),i&&(i[t]=0))}function OE(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=xS(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:a}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",ae,!(s||a))}const{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&OE(i)}function DE({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:i,resetTransform:s}){return class{constructor(c={},u=e?.()){this.id=QP++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(tH),this.nodes.forEach(iH),this.nodes.forEach(rH),this.nodes.forEach(eH)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=c,this.root=u?u.root||u:this,this.path=u?[...u.path,u]:[],this.parent=u,this.depth=u?u.depth+1:0;for(let d=0;d<this.path.length;d++)this.path[d].shouldResetTransform=!0;this.root===this&&(this.nodes=new XP)}addEventListener(c,u){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new Qh),this.eventHandlers.get(c).add(u)}notifyListeners(c,...u){const d=this.eventHandlers.get(c);d&&d.notify(...u)}hasListeners(c){return this.eventHandlers.has(c)}mount(c){if(this.instance)return;this.isSVG=Hp(c)&&!JB(c),this.instance=c;const{layoutId:u,layout:d,visualElement:h}=this.options;if(h&&!h.current&&h.mount(c),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(d||u)&&(this.isLayoutDirty=!0),t){let p,m=0;const y=()=>this.root.updateBlockedByResize=!1;ae.read(()=>{m=window.innerWidth}),t(c,()=>{const b=window.innerWidth;b!==m&&(m=b,this.root.updateBlockedByResize=!0,p&&p(),p=FP(y,250),Nu.hasAnimatedSinceResize&&(Nu.hasAnimatedSinceResize=!1,this.nodes.forEach(VE)))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&h&&(u||d)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:m,hasRelativeLayoutChanged:y,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||h.getDefaultTransition()||uH,{onLayoutAnimationStart:w,onLayoutAnimationComplete:S}=h.getProps(),E=!this.targetLayout||!CE(this.targetLayout,b),D=!m&&y;if(this.options.layoutRoot||this.resumeFrom||D||m&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...Np(x,"layout"),onPlay:w,onComplete:S};(h.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(p,D)}else m||VE(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const c=this.getStack();c&&c.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),wi(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(sH),this.animationId++)}getTransformTemplate(){const{visualElement:c}=this.options;return c&&c.getProps().transformTemplate}willUpdate(c=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&OE(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const m=this.path[p];m.shouldResetTransform=!0,m.updateScroll("snapshot"),m.options.layoutRoot&&m.willUpdate(!1)}const{layoutId:u,layout:d}=this.options;if(u===void 0&&!d)return;const h=this.getTransformTemplate();this.prevTransformTemplateValue=h?h(this.latestValues,""):void 0,this.updateSnapshot(),c&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(jE);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(zE);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(oH),this.nodes.forEach(WP),this.nodes.forEach(JP)):this.nodes.forEach(zE),this.clearAllSnapshots();const u=Fe.now();Be.delta=bo(0,16.666666666666668,u-Be.timestamp),Be.timestamp=u,Be.isProcessing=!0,tp.update.process(Be),tp.preRender.process(Be),tp.render.process(Be),Be.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Ip.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(nH),this.sharedNodes.forEach(aH)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ae.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ae.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Ze(this.snapshot.measuredBox.x)&&!Ze(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let d=0;d<this.path.length;d++)this.path[d].updateScroll();const c=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=ze(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:u}=this.options;u&&u.notify("LayoutMeasure",this.layout.layoutBox,c?c.layoutBox:void 0)}updateScroll(c="measure"){let u=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===c&&(u=!1),u&&this.instance){const d=i(this.instance);this.scroll={animationId:this.root.animationId,phase:c,isRoot:d,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:d}}}resetTransform(){if(!s)return;const c=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,u=this.projectionDelta&&!wE(this.projectionDelta),d=this.getTransformTemplate(),h=d?d(this.latestValues,""):void 0,p=h!==this.prevTransformTemplateValue;c&&this.instance&&(u||Dr(this.latestValues)||p)&&(s(this.instance,h),this.shouldResetTransform=!1,this.scheduleRender())}measure(c=!0){const u=this.measurePageBox();let d=this.removeElementScroll(u);return c&&(d=this.removeTransform(d)),fH(d),{animationId:this.root.animationId,measuredBox:u,layoutBox:d,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:c}=this.options;if(!c)return ze();const u=c.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(dH))){const{scroll:h}=this.root;h&&(Ms(u.x,h.offset.x),Ms(u.y,h.offset.y))}return u}removeElementScroll(c){const u=ze();if(Wn(u,c),this.scroll?.wasRoot)return u;for(let d=0;d<this.path.length;d++){const h=this.path[d],{scroll:p,options:m}=h;h!==this.root&&p&&m.layoutScroll&&(p.wasRoot&&Wn(u,c),Ms(u.x,p.offset.x),Ms(u.y,p.offset.y))}return u}applyTransform(c,u=!1){const d=ze();Wn(d,c);for(let h=0;h<this.path.length;h++){const p=this.path[h];!u&&p.options.layoutScroll&&p.scroll&&p!==p.root&&Rs(d,{x:-p.scroll.offset.x,y:-p.scroll.offset.y}),Dr(p.latestValues)&&Rs(d,p.latestValues)}return Dr(this.latestValues)&&Rs(d,this.latestValues),d}removeTransform(c){const u=ze();Wn(u,c);for(let d=0;d<this.path.length;d++){const h=this.path[d];if(!h.instance||!Dr(h.latestValues))continue;Gp(h.latestValues)&&h.updateSnapshot();const p=ze(),m=h.measurePageBox();Wn(p,m),bE(u,h.latestValues,h.snapshot?h.snapshot.layoutBox:void 0,p)}return Dr(this.latestValues)&&bE(u,this.latestValues),u}setTargetDelta(c){this.targetDelta=c,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(c){this.options={...this.options,...c,crossfade:c.crossfade!==void 0?c.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Be.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(c=!1){const u=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=u.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=u.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=u.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==u;if(!(c||d&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:m}=this.options;if(!this.layout||!(p||m))return;this.resolvedRelativeTargetAt=Be.timestamp;const y=this.getClosestProjectingParent();y&&this.linkedParentVersion!==y.layoutVersion&&!y.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(y&&y.layout?this.createRelativeTarget(y,this.layout.layoutBox,y.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ze(),this.targetWithTransforms=ze()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),zP(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Wn(this.target,this.layout.layoutBox),ZS(this.target,this.targetDelta)):Wn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,y&&!!y.resumingFrom==!!this.resumingFrom&&!y.options.layoutScroll&&y.target&&this.animationProgress!==1?this.createRelativeTarget(y,this.target,y.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Gp(this.parent.latestValues)||GS(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(c,u,d){this.relativeParent=c,this.linkedParentVersion=c.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ze(),this.relativeTargetOrigin=ze(),Tu(this.relativeTargetOrigin,u,d),Wn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const c=this.getLead(),u=!!this.resumingFrom||this!==c;let d=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(d=!1),u&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===Be.timestamp&&(d=!1),d)return;const{layout:h,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(h||p))return;Wn(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,y=this.treeScale.y;uP(this.layoutCorrected,this.treeScale,this.path,u),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=ze());const{target:b}=c;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(fE(this.prevProjectionDelta.x,this.projectionDelta.x),fE(this.prevProjectionDelta.y,this.projectionDelta.y)),il(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==y||!_E(this.projectionDelta.x,this.prevProjectionDelta.x)||!_E(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(c=!0){if(this.options.visualElement?.scheduleRender(),c){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=As(),this.projectionDelta=As(),this.projectionDeltaWithTransform=As()}setAnimationOrigin(c,u=!1){const d=this.snapshot,h=d?d.latestValues:{},p={...this.latestValues},m=As();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!u;const y=ze(),b=d?d.source:void 0,x=this.layout?this.layout.source:void 0,w=b!==x,S=this.getStack(),E=!S||S.members.length<=1,D=!!(w&&!E&&this.options.crossfade===!0&&!this.path.some(cH));this.animationProgress=0;let T;this.mixTargetDelta=C=>{const R=C/1e3;LE(m.x,c.x,R),LE(m.y,c.y,R),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Tu(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),lH(this.relativeTarget,this.relativeTargetOrigin,y,R),T&&BP(this.relativeTarget,T)&&(this.isProjectionDirty=!1),T||(T=ze()),Wn(T,this.relativeTarget)),w&&(this.animationValues=p,UP(p,h,this.latestValues,R,D,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(c){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(wi(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ae.update(()=>{Nu.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=_s(0)),this.motionValue.jump(0,!1),this.currentAnimation=YP(this.motionValue,[0,1e3],{...c,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),c.onUpdate&&c.onUpdate(u)},onStop:()=>{},onComplete:()=>{c.onComplete&&c.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const c=this.getStack();c&&c.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(KP),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const c=this.getLead();let{targetWithTransforms:u,target:d,layout:h,latestValues:p}=c;if(!(!u||!d||!h)){if(this!==c&&this.layout&&h&&UE(this.options.animationType,this.layout.layoutBox,h.layoutBox)){d=this.target||ze();const m=Ze(this.layout.layoutBox.x);d.x.min=c.target.x.min,d.x.max=d.x.min+m;const y=Ze(this.layout.layoutBox.y);d.y.min=c.target.y.min,d.y.max=d.y.min+y}Wn(u,d),Rs(u,p),il(this.projectionDeltaWithTransform,this.layoutCorrected,u,p)}}registerSharedNode(c,u){this.sharedNodes.has(c)||this.sharedNodes.set(c,new ZP),this.sharedNodes.get(c).add(u);const h=u.options.initialPromotionConfig;u.promote({transition:h?h.transition:void 0,preserveFollowOpacity:h&&h.shouldPreserveFollowOpacity?h.shouldPreserveFollowOpacity(u):void 0})}isLead(){const c=this.getStack();return c?c.lead===this:!0}getLead(){const{layoutId:c}=this.options;return c?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:c}=this.options;return c?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:c}=this.options;if(c)return this.root.sharedNodes.get(c)}promote({needsReset:c,transition:u,preserveFollowOpacity:d}={}){const h=this.getStack();h&&h.promote(this,d),c&&(this.projectionDelta=void 0,this.needsReset=!0),u&&this.setOptions({transition:u})}relegate(){const c=this.getStack();return c?c.relegate(this):!1}resetSkewAndRotation(){const{visualElement:c}=this.options;if(!c)return;let u=!1;const{latestValues:d}=c;if((d.z||d.rotate||d.rotateX||d.rotateY||d.rotateZ||d.skewX||d.skewY)&&(u=!0),!u)return;const h={};d.z&&Wp("z",c,h,this.animationValues);for(let p=0;p<Qp.length;p++)Wp(`rotate${Qp[p]}`,c,h,this.animationValues),Wp(`skew${Qp[p]}`,c,h,this.animationValues);c.render();for(const p in h)c.setStaticValue(p,h[p]),this.animationValues&&(this.animationValues[p]=h[p]);c.scheduleRender()}applyProjectionStyles(c,u){if(!this.instance||this.isSVG)return;if(!this.isVisible){c.visibility="hidden";return}const d=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,c.visibility="",c.opacity="",c.pointerEvents=_u(u?.pointerEvents)||"",c.transform=d?d(this.latestValues,""):"none";return}const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){this.options.layoutId&&(c.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,c.pointerEvents=_u(u?.pointerEvents)||""),this.hasProjected&&!Dr(this.latestValues)&&(c.transform=d?d({},""):"none",this.hasProjected=!1);return}c.visibility="";const p=h.animationValues||h.latestValues;this.applyTransformsToTarget();let m=PP(this.projectionDeltaWithTransform,this.treeScale,p);d&&(m=d(p,m)),c.transform=m;const{x:y,y:b}=this.projectionDelta;c.transformOrigin=`${y.origin*100}% ${b.origin*100}% 0`,h.animationValues?c.opacity=h===this?p.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:p.opacityExit:c.opacity=h===this?p.opacity!==void 0?p.opacity:"":p.opacityExit!==void 0?p.opacityExit:0;for(const x in Zp){if(p[x]===void 0)continue;const{correct:w,applyTo:S,isCSSVariable:E}=Zp[x],D=m==="none"?p[x]:w(p[x],h);if(S){const T=S.length;for(let C=0;C<T;C++)c[S[C]]=D}else E?this.options.visualElement.renderState.vars[x]=D:c[x]=D}this.options.layoutId&&(c.pointerEvents=h===this?_u(u?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(c=>c.currentAnimation?.stop()),this.root.nodes.forEach(jE),this.root.sharedNodes.clear()}}}function WP(t){t.updateLayout()}function JP(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,a=e.source!==t.layout.source;s==="size"?wo(p=>{const m=a?e.measuredBox[p]:e.layoutBox[p],y=Ze(m);m.min=n[p].min,m.max=m.min+y}):UE(s,e.layoutBox,n)&&wo(p=>{const m=a?e.measuredBox[p]:e.layoutBox[p],y=Ze(n[p]);m.max=m.min+y,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+y)});const c=As();il(c,n,e.layoutBox);const u=As();a?il(u,t.applyTransform(i,!0),e.measuredBox):il(u,n,e.layoutBox);const d=!wE(c);let h=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:m,layout:y}=p;if(m&&y){const b=ze();Tu(b,e.layoutBox,m.layoutBox);const x=ze();Tu(x,n,y.layoutBox),CE(b,x)||(h=!0),p.options.layoutRoot&&(t.relativeTarget=x,t.relativeTargetOrigin=b,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:u,layoutDelta:c,hasLayoutChanged:d,hasRelativeLayoutChanged:h})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function tH(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function eH(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function nH(t){t.clearSnapshot()}function jE(t){t.clearMeasurements()}function zE(t){t.isLayoutDirty=!1}function oH(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function VE(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function iH(t){t.resolveTargetDelta()}function rH(t){t.calcProjection()}function sH(t){t.resetSkewAndRotation()}function aH(t){t.removeLeadSnapshot()}function LE(t,e,n){t.translate=ye(e.translate,0,n),t.scale=ye(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function IE(t,e,n,i){t.min=ye(e.min,n.min,i),t.max=ye(e.max,n.max,i)}function lH(t,e,n,i){IE(t.x,e.x,n.x,i),IE(t.y,e.y,n.y,i)}function cH(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const uH={duration:.45,ease:[.4,0,.1,1]},BE=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),PE=BE("applewebkit/")&&!BE("chrome/")?Math.round:Nn;function HE(t){t.min=PE(t.min),t.max=PE(t.max)}function fH(t){HE(t.x),HE(t.y)}function UE(t,e,n){return t==="position"||t==="preserve-aspect"&&!jP(TE(e),TE(n),.2)}function dH(t){return t!==t.root&&t.scroll?.wasRoot}const hH=DE({attachResizeListener:(t,e)=>rl(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Jp={current:void 0},$E=DE({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Jp.current){const t=new hH({});t.mount(window),t.setOptions({layoutScroll:!0}),Jp.current=t}return Jp.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),tm=N.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function qE(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function pH(...t){return e=>{let n=!1;const i=t.map(s=>{const a=qE(s,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<i.length;s++){const a=i[s];typeof a=="function"?a():qE(t[s],null)}}}}function mH(...t){return N.useCallback(pH(...t),t)}class gH extends N.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const i=n.offsetParent,s=Lp(i)&&i.offsetWidth||0,a=Lp(i)&&i.offsetHeight||0,c=this.props.sizeRef.current;c.height=n.offsetHeight||0,c.width=n.offsetWidth||0,c.top=n.offsetTop,c.left=n.offsetLeft,c.right=s-c.width-c.left,c.bottom=a-c.height-c.top}return null}componentDidUpdate(){}render(){return this.props.children}}function yH({children:t,isPresent:e,anchorX:n,anchorY:i,root:s,pop:a}){const c=N.useId(),u=N.useRef(null),d=N.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:h}=N.useContext(tm),p=t.props?.ref??t?.ref,m=mH(u,p);return N.useInsertionEffect(()=>{const{width:y,height:b,top:x,left:w,right:S,bottom:E}=d.current;if(e||a===!1||!u.current||!y||!b)return;const D=n==="left"?`left: ${w}`:`right: ${S}`,T=i==="bottom"?`bottom: ${E}`:`top: ${x}`;u.current.dataset.motionPopId=c;const C=document.createElement("style");h&&(C.nonce=h);const R=s??document.head;return R.appendChild(C),C.sheet&&C.sheet.insertRule(`
|
|
69
|
-
[data-motion-pop-id="${
|
|
68
|
+
`,children:p==="compiling"?"Compiling...":p==="success"?"Loaded!":"Compile & Load"}),p==="error"&&y&&M.jsx("div",{className:"p-2 text-xs font-mono rounded bg-red-500/10 text-red-400 max-h-24 overflow-y-auto whitespace-pre-wrap",children:y})]})]})})]})}const Tw={inputNode:FV,numericInputNode:XV,outputNode:KV,logicGateNode:iL,registerNode:oL,ramNode:rL,romNode:sL,rv32iInstrMemNode:cL,ethFrameInputNode:ZV,consoleNode:JV,uartTxNode:tL,nicFifoNode:aL,screenNode:QV,rasterDisplayNode:WV},Nw={orthogonal:eh},Th={TRUE:"#22c55e",FALSE:"#94a3b8",UNDEFINED:"#cbd5e1"};function Fo(t){return t.nodeId===""?`.${t.portName}`:`${t.nodeId}.${t.portName}`}function uL(t,e,n,o){const s={Switch:"inputNode",Input:"numericInputNode",Led:"outputNode",And:"logicGateNode",Or:"logicGateNode",Not:"logicGateNode",Nand:"logicGateNode",Nor:"logicGateNode",Xor:"logicGateNode",Xnor:"logicGateNode",Buffer:"logicGateNode",DFlipFlop:"logicGateNode",Register:"registerNode",RAM:"ramNode",ROM:"romNode",HexDisplay:"outputNode",SevenSegment:"outputNode",Screen:"screenNode",RasterDisplay:"rasterDisplayNode",Console:"consoleNode",UART_TX:"uartTxNode",NIC_FIFO:"nicFifoNode",Constant:"logicGateNode",RV32I_InstrMem:"rv32iInstrMemNode",DualPortROM:"rv32iInstrMemNode",Eth_FrameInput:"ethFrameInputNode"};return s[t]?s[t]:o?"logicGateNode":e===0&&n>0?"inputNode":e>0&&n===0?"outputNode":e>0&&n>0?"logicGateNode":"default"}function fL(t,e,n,o,s){const a=[];for(const l of t.nodes){const u=e.components[l.id];if(!u){console.warn(`[projection] node '${l.id}' (${l.componentRef}) has no layout metadata, skipping render`);continue}const d=n.resolveCircuit(l.componentRef);if(!d)continue;const h=l.inputs.length,p=l.outputs.length,m=l.inputs.map(A=>A.name),y=l.outputs.map(A=>A.name),b=d.implementation.kind==="composite",x=uL(l.componentRef,h,p,b);let w,_,S,k,C,E,R;if(l.componentRef==="Switch"||l.componentRef==="Led"){let A=!1;if(o){if(l.componentRef==="Led"&&l.inputs.length>0){const O=Fo({nodeId:l.id,portName:l.inputs[0].name}),D=o.get(O);D!==void 0&&(w=!!D,A=!0)}else if(l.componentRef==="Switch"&&l.outputs.length>0){const O=Fo({nodeId:l.id,portName:l.outputs[0].name}),D=o.get(O);D!==void 0&&(w=!!D,A=!0)}}!A&&"value"in l.arguments&&(w=!!l.arguments.value)}else if(l.componentRef==="Input"){S=typeof l.arguments.width=="number"?l.arguments.width:8;let A=!1;if(o&&l.outputs.length>0){const O=Fo({nodeId:l.id,portName:l.outputs[0].name}),D=o.get(O);D!==void 0&&typeof D=="number"&&(_=D,A=!0)}A||(_=typeof l.arguments.value=="number"?l.arguments.value:0)}else if(l.componentRef==="HexDisplay"||l.componentRef==="SevenSegment"){if(o&&l.inputs.length>0){const A=Fo({nodeId:l.id,portName:l.inputs[0].name}),O=o.get(A);_=typeof O=="number"?O:0}}else if(l.componentRef==="Screen"){const A=l.arguments.width??8,O=l.arguments.height??8,D=A*O;if(k=new Array(D).fill(0),s&&o){const U=Array.from(t.connections).find(q=>q.target.nodeId===l.id&&q.target.portName==="dataIn");if(U){const q=t.nodes.find(Y=>Y.id===U.source.nodeId);if(q?.componentRef==="DualPortRAM"){const Y=s.currentState.get(q.id);if(Y instanceof Map)for(let K=0;K<D;K++)k[K]=Y.get(K)??0}else if(q?.componentRef==="Mux"){const Y=Fo({nodeId:q.id,portName:"sel"}),W=o.get(Y)===0?"in0":"in1",B=Array.from(t.connections).find(H=>H.target.nodeId===q.id&&H.target.portName===W);if(B){const H=t.nodes.find(j=>j.id===B.source.nodeId);if(H?.componentRef==="DualPortRAM"){const j=s.currentState.get(H.id);if(j instanceof Map)for(let I=0;I<D;I++)k[I]=j.get(I)??0}}}}}}else if(l.componentRef==="RasterDisplay"){const A=l.arguments.width??8,O=l.arguments.height??8,D=A*O;if(k=new Array(D).fill(0),s){const U=s.currentState.get(l.id);if(U instanceof Map)for(let q=0;q<D;q++)k[q]=U.get(q)??0}}else if(l.componentRef==="Console"){if(s){const A=s.currentState.get(l.id);typeof A=="string"&&(C=A)}}else if(l.componentRef==="UART_TX"){if(s){const A=s.currentState.get(l.id);typeof A=="string"&&(E=A)}}else if(l.componentRef==="NIC_FIFO"&&s){const A=s.currentState.get(l.id);if(A instanceof Map){const O=A,D=O.get(8192)??0,U=O.get(8193)??0,q=O.get(8210)??0,Y=(O.get(8196)??0)!==0;R={txCount:D-U,rxCount:q,draining:Y}}}a.push({id:l.id,type:x,position:u.position,data:{nodeId:l.id,componentRef:l.componentRef,label:l.label,value:w,numericValue:_,width:S,inputCount:h,outputCount:p,inputNames:m,outputNames:y,isComposite:b,arguments:l.arguments,__pixels:k,__consoleText:C,__uartText:E,__nicState:R},selectable:!0,deletable:!1})}if(s){const l=new Set(a.map(d=>d.id));let u=0;for(const[d,h]of s.currentState.entries())if(!l.has(d)&&typeof h=="string"){const p=d.split("."),m=p.length>1?p.slice(-2).join("."):d,y=d.toLowerCase().includes("uart");a.push({id:`__virtual_console_${u}`,type:y?"uartTxNode":"consoleNode",position:{x:600,y:50+u*250},data:{nodeId:d,componentRef:y?"UART_TX":"Console",label:y?`UART (${m})`:`Console (${m})`,value:void 0,numericValue:void 0,width:void 0,inputCount:y?4:2,outputCount:1,inputNames:y?["addr","write_data","mem_read","mem_write"]:["data","we"],outputNames:y?["read_data"]:["text"],__consoleText:y?void 0:h,__uartText:y?h:void 0},selected:!1,selectable:!1,deletable:!1}),u++}}return a}function dL(t,e){const n=[];for(const o of t.connections){let s=Th.UNDEFINED;if(e){const a=e.get(Fo(o.source))??e.get(Fo(o.target));a!==void 0&&(s=(typeof a=="boolean"?a:a!==0)?Th.TRUE:Th.FALSE)}n.push({id:o.id,type:"orthogonal",source:o.source.nodeId,target:o.target.nodeId,sourceHandle:`out-${o.source.portName}`,targetHandle:`in-${o.target.portName}`,style:{stroke:s,strokeWidth:2},animated:!1,selectable:!1,deletable:!1})}return n}function hL(t,e,n,o,s){return t?{nodes:fL(t,e,n,o,s),edges:dL(t,o)}:{nodes:[],edges:[]}}var Aw=Object.defineProperty,pL=(t,e,n)=>e in t?Aw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,mL=(t,e)=>{for(var n in e)Aw(t,n,{get:e[n],enumerable:!0})},gL=(t,e,n)=>pL(t,e+"",n),Mw={};mL(Mw,{Graph:()=>yn,alg:()=>Ah,json:()=>Dw,version:()=>bL});var yL=Object.defineProperty,Rw=(t,e)=>{for(var n in e)yL(t,n,{get:e[n],enumerable:!0})},yn=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,e){return t.forEach(n=>{e!==void 0?this.setNode(n,e):this.setNode(n)}),this}setNode(t,e){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let e=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(n=>{this.setParent(n)}),delete this._children[t]),Object.keys(this._in[t]).forEach(e),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e===void 0)e="\0";else{e+="";for(let n=e;n!==void 0;n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}parent(t){if(this._isCompound){let e=this._parent[t];if(e!=="\0")return e}}children(t="\0"){if(this._isCompound){let e=this._children[t];if(e)return Object.keys(e)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let e=this._preds[t];if(e)return Object.keys(e)}successors(t){let e=this._sucs[t];if(e)return Object.keys(e)}neighbors(t){let e=this.predecessors(t);if(e){let n=new Set(e);for(let o of this.successors(t))n.add(o);return Array.from(n.values())}}isLeaf(t){let e;return this.isDirected()?e=this.successors(t):e=this.neighbors(t),e.length===0}filterNodes(t){let e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph()),Object.entries(this._nodes).forEach(([s,a])=>{t(s)&&e.setNode(s,a)}),Object.values(this._edgeObjs).forEach(s=>{e.hasNode(s.v)&&e.hasNode(s.w)&&e.setEdge(s,this.edge(s))});let n={},o=s=>{let a=this.parent(s);return!a||e.hasNode(a)?(n[s]=a??void 0,a??void 0):a in n?n[a]:o(a)};return this._isCompound&&e.nodes().forEach(s=>e.setParent(s,o(s))),e}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,e){return t.reduce((n,o)=>(e!==void 0?this.setEdge(n,o,e):this.setEdge(n,o),o)),this}setEdge(t,e,n,o){let s,a,l,u,d=!1;typeof t=="object"&&t!==null&&"v"in t?(s=t.v,a=t.w,l=t.name,arguments.length===2&&(u=e,d=!0)):(s=t,a=e,l=o,arguments.length>2&&(u=n,d=!0)),s=""+s,a=""+a,l!==void 0&&(l=""+l);let h=va(this._isDirected,s,a,l);if(h in this._edgeLabels)return d&&(this._edgeLabels[h]=u),this;if(l!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(a),this._edgeLabels[h]=d?u:this._defaultEdgeLabelFn(s,a,l);let p=vL(this._isDirected,s,a,l);return s=p.v,a=p.w,Object.freeze(p),this._edgeObjs[h]=p,kw(this._preds[a],s),kw(this._sucs[s],a),this._in[a][h]=p,this._out[s][h]=p,this._edgeCount++,this}edge(t,e,n){let o=arguments.length===1?Nh(this._isDirected,t):va(this._isDirected,t,e,n);return this._edgeLabels[o]}edgeAsObj(t,e,n){let o=arguments.length===1?this.edge(t):this.edge(t,e,n);return typeof o!="object"?{label:o}:o}hasEdge(t,e,n){return(arguments.length===1?Nh(this._isDirected,t):va(this._isDirected,t,e,n))in this._edgeLabels}removeEdge(t,e,n){let o=arguments.length===1?Nh(this._isDirected,t):va(this._isDirected,t,e,n),s=this._edgeObjs[o];if(s){let a=s.v,l=s.w;delete this._edgeLabels[o],delete this._edgeObjs[o],Ow(this._preds[l],a),Ow(this._sucs[a],l),delete this._in[l][o],delete this._out[a][o],this._edgeCount--}return this}inEdges(t,e){return this.isDirected()?this.filterEdges(this._in[t],t,e):this.nodeEdges(t,e)}outEdges(t,e){return this.isDirected()?this.filterEdges(this._out[t],t,e):this.nodeEdges(t,e)}nodeEdges(t,e){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,e)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,e,n){if(!t)return;let o=Object.values(t);return n?o.filter(s=>s.v===e&&s.w===n||s.v===n&&s.w===e):o}};function kw(t,e){t[e]?t[e]++:t[e]=1}function Ow(t,e){t[e]!==void 0&&!--t[e]&&delete t[e]}function va(t,e,n,o){let s=""+e,a=""+n;if(!t&&s>a){let l=s;s=a,a=l}return s+""+a+""+(o===void 0?"\0":o)}function vL(t,e,n,o){let s=""+e,a=""+n;if(!t&&s>a){let u=s;s=a,a=u}let l={v:s,w:a};return o&&(l.name=o),l}function Nh(t,e){return va(t,e.v,e.w,e.name)}var bL="4.0.1",Dw={};Rw(Dw,{read:()=>SL,write:()=>xL});function xL(t){let e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:wL(t),edges:_L(t)},n=t.graph();return n!==void 0&&(e.value=structuredClone(n)),e}function wL(t){return t.nodes().map(e=>{let n=t.node(e),o=t.parent(e),s={v:e};return n!==void 0&&(s.value=n),o!==void 0&&(s.parent=o),s})}function _L(t){return t.edges().map(e=>{let n=t.edge(e),o={v:e.v,w:e.w};return e.name!==void 0&&(o.name=e.name),n!==void 0&&(o.value=n),o})}function SL(t){let e=new yn(t.options);return t.value!==void 0&&e.setGraph(t.value),t.nodes.forEach(n=>{e.setNode(n.v,n.value),n.parent&&e.setParent(n.v,n.parent)}),t.edges.forEach(n=>{e.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),e}var Ah={};Rw(Ah,{CycleException:()=>Bc,bellmanFord:()=>jw,components:()=>TL,dijkstra:()=>Pc,dijkstraAll:()=>ML,findCycles:()=>RL,floydWarshall:()=>OL,isAcyclic:()=>jL,postorder:()=>VL,preorder:()=>LL,prim:()=>IL,shortestPaths:()=>PL,tarjan:()=>Vw,topsort:()=>Lw});var EL=()=>1;function jw(t,e,n,o){return CL(t,String(e),n||EL,o||function(s){return t.outEdges(s)})}function CL(t,e,n,o){let s={},a,l=0,u=t.nodes(),d=function(m){let y=n(m);s[m.v].distance+y<s[m.w].distance&&(s[m.w]={distance:s[m.v].distance+y,predecessor:m.v},a=!0)},h=function(){u.forEach(function(m){o(m).forEach(function(y){let b=y.v===m?y.v:y.w,x=b===y.v?y.w:y.v;d({v:b,w:x})})})};u.forEach(function(m){let y=m===e?0:Number.POSITIVE_INFINITY;s[m]={distance:y,predecessor:""}});let p=u.length;for(let m=1;m<p&&(a=!1,l++,h(),!!a);m++);if(l===p-1&&(a=!1,h(),a))throw new Error("The graph contains a negative weight cycle");return s}function TL(t){let e={},n=[],o;function s(a){a in e||(e[a]=!0,o.push(a),t.successors(a).forEach(s),t.predecessors(a).forEach(s))}return t.nodes().forEach(function(a){o=[],s(a),o.length&&n.push(o)}),n}var zw=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(t=>t.key)}has(t){return t in this._keyIndices}priority(t){let e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){let n=this._keyIndices,o=String(t);if(!(o in n)){let s=this._arr,a=s.length;return n[o]=a,s.push({key:o,priority:e}),this._decrease(a),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){let n=this._keyIndices[t];if(n===void 0)throw new Error(`Key not found: ${t}`);let o=this._arr[n].priority;if(e>o)throw new Error(`New priority is greater than current priority. Key: ${t} Old: ${o} New: ${e}`);this._arr[n].priority=e,this._decrease(n)}_heapify(t){let e=this._arr,n=2*t,o=n+1,s=t;n<e.length&&(s=e[n].priority<e[s].priority?n:s,o<e.length&&(s=e[o].priority<e[s].priority?o:s),s!==t&&(this._swap(t,s),this._heapify(s)))}_decrease(t){let e=this._arr,n=e[t].priority,o;for(;t!==0&&(o=t>>1,!(e[o].priority<n));)this._swap(t,o),t=o}_swap(t,e){let n=this._arr,o=this._keyIndices,s=n[t],a=n[e];n[t]=a,n[e]=s,o[a.key]=t,o[s.key]=e}},NL=()=>1;function Pc(t,e,n,o){let s=function(a){return t.outEdges(a)};return AL(t,String(e),n||NL,o||s)}function AL(t,e,n,o){let s={},a=new zw,l,u,d=function(h){let p=h.v!==l?h.v:h.w,m=s[p],y=n(h),b=u.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+h+" Weight: "+y);b<m.distance&&(m.distance=b,m.predecessor=l,a.decrease(p,b))};for(t.nodes().forEach(function(h){let p=h===e?0:Number.POSITIVE_INFINITY;s[h]={distance:p,predecessor:""},a.add(h,p)});a.size()>0&&(l=a.removeMin(),u=s[l],u.distance!==Number.POSITIVE_INFINITY);)o(l).forEach(d);return s}function ML(t,e,n){return t.nodes().reduce(function(o,s){return o[s]=Pc(t,s,e,n),o},{})}function Vw(t){let e=0,n=[],o={},s=[];function a(l){let u=o[l]={onStack:!0,lowlink:e,index:e++};if(n.push(l),t.successors(l).forEach(function(d){d in o?o[d].onStack&&(u.lowlink=Math.min(u.lowlink,o[d].index)):(a(d),u.lowlink=Math.min(u.lowlink,o[d].lowlink))}),u.lowlink===u.index){let d=[],h;do h=n.pop(),o[h].onStack=!1,d.push(h);while(l!==h);s.push(d)}}return t.nodes().forEach(function(l){l in o||a(l)}),s}function RL(t){return Vw(t).filter(function(e){return e.length>1||e.length===1&&t.hasEdge(e[0],e[0])})}var kL=()=>1;function OL(t,e,n){return DL(t,e||kL,n||function(o){return t.outEdges(o)})}function DL(t,e,n){let o={},s=t.nodes();return s.forEach(function(a){o[a]={},o[a][a]={distance:0,predecessor:""},s.forEach(function(l){a!==l&&(o[a][l]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(a).forEach(function(l){let u=l.v===a?l.w:l.v,d=e(l);o[a][u]={distance:d,predecessor:a}})}),s.forEach(function(a){let l=o[a];s.forEach(function(u){let d=o[u];s.forEach(function(h){let p=d[a],m=l[h],y=d[h],b=p.distance+m.distance;b<y.distance&&(y.distance=b,y.predecessor=m.predecessor)})})}),o}var Bc=class extends Error{constructor(...t){super(...t)}};function Lw(t){let e={},n={},o=[];function s(a){if(a in n)throw new Bc;a in e||(n[a]=!0,e[a]=!0,t.predecessors(a).forEach(s),delete n[a],o.push(a))}if(t.sinks().forEach(s),Object.keys(e).length!==t.nodeCount())throw new Bc;return o}function jL(t){try{Lw(t)}catch(e){if(e instanceof Bc)return!1;throw e}return!0}function zL(t,e,n,o,s){Array.isArray(e)||(e=[e]);let a=(u=>{var d;return(d=t.isDirected()?t.successors(u):t.neighbors(u))!=null?d:[]}),l={};return e.forEach(function(u){if(!t.hasNode(u))throw new Error("Graph does not have node: "+u);s=Iw(t,u,n==="post",l,a,o,s)}),s}function Iw(t,e,n,o,s,a,l){return e in o||(o[e]=!0,n||(l=a(l,e)),s(e).forEach(function(u){l=Iw(t,u,n,o,s,a,l)}),n&&(l=a(l,e))),l}function Pw(t,e,n){return zL(t,e,n,function(o,s){return o.push(s),o},[])}function VL(t,e){return Pw(t,e,"post")}function LL(t,e){return Pw(t,e,"pre")}function IL(t,e){let n=new yn,o={},s=new zw,a;function l(d){let h=d.v===a?d.w:d.v,p=s.priority(h);if(p!==void 0){let m=e(d);m<p&&(o[h]=a,s.decrease(h,m))}}if(t.nodeCount()===0)return n;t.nodes().forEach(function(d){s.add(d,Number.POSITIVE_INFINITY),n.setNode(d)}),s.decrease(t.nodes()[0],0);let u=!1;for(;s.size()>0;){if(a=s.removeMin(),a in o)n.setEdge(a,o[a]);else{if(u)throw new Error("Input graph is not connected: "+t);u=!0}t.nodeEdges(a).forEach(l)}return n}function PL(t,e,n,o){return BL(t,e,n,o??(s=>{let a=t.outEdges(s);return a??[]}))}function BL(t,e,n,o){if(n===void 0)return Pc(t,e,n,o);let s=!1,a=t.nodes();for(let l=0;l<a.length;l++){let u=o(a[l]);for(let d=0;d<u.length;d++){let h=u[d],p=h.v===a[l]?h.v:h.w,m=p===h.v?h.w:h.v;n({v:p,w:m})<0&&(s=!0)}if(s)return jw(t,e,n,o)}return Pc(t,e,n,o)}function Hr(t,e,n,o){let s=o;for(;t.hasNode(s);)s=Mh(o);return n.dummy=e,t.setNode(s,n),s}function HL(t){let e=new yn().setGraph(t.graph());return t.nodes().forEach(n=>e.setNode(n,t.node(n))),t.edges().forEach(n=>{let o=e.edge(n.v,n.w)||{weight:0,minlen:1},s=t.edge(n);e.setEdge(n.v,n.w,{weight:o.weight+s.weight,minlen:Math.max(o.minlen,s.minlen)})}),e}function Bw(t){let e=new yn({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(n=>{t.children(n).length||e.setNode(n,t.node(n))}),t.edges().forEach(n=>{e.setEdge(n,t.edge(n))}),e}function Hw(t,e){let n=t.x,o=t.y,s=e.x-n,a=e.y-o,l=t.width/2,u=t.height/2;if(!s&&!a)throw new Error("Not possible to find intersection inside of the rectangle");let d,h;return Math.abs(a)*l>Math.abs(s)*u?(a<0&&(u=-u),d=u*s/a,h=u):(s<0&&(l=-l),d=l,h=l*a/s),{x:n+d,y:o+h}}function ba(t){let e=xa(Yw(t)+1).map(()=>[]);return t.nodes().forEach(n=>{let o=t.node(n),s=o.rank;s!==void 0&&(e[s]||(e[s]=[]),e[s][o.order]=n)}),e}function UL(t){let e=t.nodes().map(o=>{let s=t.node(o).rank;return s===void 0?Number.MAX_VALUE:s}),n=ei(Math.min,e);t.nodes().forEach(o=>{let s=t.node(o);Object.hasOwn(s,"rank")&&(s.rank-=n)})}function $L(t){let e=t.nodes().map(l=>t.node(l).rank).filter(l=>l!==void 0),n=ei(Math.min,e),o=[];t.nodes().forEach(l=>{let u=t.node(l).rank-n;o[u]||(o[u]=[]),o[u].push(l)});let s=0,a=t.graph().nodeRankFactor;Array.from(o).forEach((l,u)=>{l===void 0&&u%a!==0?--s:l!==void 0&&s&&l.forEach(d=>t.node(d).rank+=s)})}function Uw(t,e,n,o){let s={width:0,height:0};return arguments.length>=4&&(s.rank=n,s.order=o),Hr(t,"border",s,e)}function YL(t,e=$w){let n=[];for(let o=0;o<t.length;o+=e){let s=t.slice(o,o+e);n.push(s)}return n}var $w=65535;function ei(t,e){if(e.length>$w){let n=YL(e);return t(...n.map(o=>t(...o)))}else return t(...e)}function Yw(t){let e=t.nodes().map(n=>{let o=t.node(n).rank;return o===void 0?Number.MIN_VALUE:o});return ei(Math.max,e)}function qL(t,e){let n={lhs:[],rhs:[]};return t.forEach(o=>{e(o)?n.lhs.push(o):n.rhs.push(o)}),n}function qw(t,e){let n=Date.now();try{return e()}finally{console.log(t+" time: "+(Date.now()-n)+"ms")}}function Gw(t,e){return e()}var GL=0;function Mh(t){let e=++GL;return t+(""+e)}function xa(t,e,n=1){e==null&&(e=t,t=0);let o=a=>a<e;n<0&&(o=a=>e<a);let s=[];for(let a=t;o(a);a+=n)s.push(a);return s}function Hc(t,e){let n={};for(let o of e)t[o]!==void 0&&(n[o]=t[o]);return n}function Uc(t,e){let n;return typeof e=="string"?n=o=>o[e]:n=e,Object.entries(t).reduce((o,[s,a])=>(o[s]=n(a,s),o),{})}function FL(t,e){return t.reduce((n,o,s)=>(n[o]=e[s],n),{})}var $c="\0",XL="3.0.0",ZL=class{constructor(){gL(this,"_sentinel");let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,e=t._prev;if(e!==t)return Fw(e),e}enqueue(t){let e=this._sentinel;t._prev&&t._next&&Fw(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e}toString(){let t=[],e=this._sentinel,n=e._prev;for(;n!==e;)t.push(JSON.stringify(n,KL)),n=n._prev;return"["+t.join(", ")+"]"}};function Fw(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function KL(t,e){if(t!=="_next"&&t!=="_prev")return e}var QL=ZL,WL=()=>1;function JL(t,e){if(t.nodeCount()<=1)return[];let n=e6(t,e||WL);return t6(n.graph,n.buckets,n.zeroIdx).flatMap(o=>t.outEdges(o.v,o.w)||[])}function t6(t,e,n){var o;let s=[],a=e[e.length-1],l=e[0],u;for(;t.nodeCount();){for(;u=l.dequeue();)Rh(t,e,n,u);for(;u=a.dequeue();)Rh(t,e,n,u);if(t.nodeCount()){for(let d=e.length-2;d>0;--d)if(u=(o=e[d])==null?void 0:o.dequeue(),u){s=s.concat(Rh(t,e,n,u,!0)||[]);break}}}return s}function Rh(t,e,n,o,s){let a=[],l=s?a:void 0;return(t.inEdges(o.v)||[]).forEach(u=>{let d=t.edge(u),h=t.node(u.v);s&&a.push({v:u.v,w:u.w}),h.out-=d,kh(e,n,h)}),(t.outEdges(o.v)||[]).forEach(u=>{let d=t.edge(u),h=u.w,p=t.node(h);p.in-=d,kh(e,n,p)}),t.removeNode(o.v),l}function e6(t,e){let n=new yn,o=0,s=0;t.nodes().forEach(u=>{n.setNode(u,{v:u,in:0,out:0})}),t.edges().forEach(u=>{let d=n.edge(u.v,u.w)||0,h=e(u),p=d+h;n.setEdge(u.v,u.w,p);let m=n.node(u.v),y=n.node(u.w);s=Math.max(s,m.out+=h),o=Math.max(o,y.in+=h)});let a=n6(s+o+3).map(()=>new QL),l=o+1;return n.nodes().forEach(u=>{kh(a,l,n.node(u))}),{graph:n,buckets:a,zeroIdx:l}}function kh(t,e,n){var o,s,a;n.out?n.in?(a=t[n.out-n.in+e])==null||a.enqueue(n):(s=t[t.length-1])==null||s.enqueue(n):(o=t[0])==null||o.enqueue(n)}function n6(t){let e=[];for(let n=0;n<t;n++)e.push(n);return e}function i6(t){(t.graph().acyclicer==="greedy"?JL(t,e(t)):o6(t)).forEach(n=>{let o=t.edge(n);t.removeEdge(n),o.forwardName=n.name,o.reversed=!0,t.setEdge(n.w,n.v,o,Mh("rev"))});function e(n){return o=>n.edge(o).weight}}function o6(t){let e=[],n={},o={};function s(a){Object.hasOwn(o,a)||(o[a]=!0,n[a]=!0,t.outEdges(a).forEach(l=>{Object.hasOwn(n,l.w)?e.push(l):s(l.w)}),delete n[a])}return t.nodes().forEach(s),e}function r6(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.reversed){t.removeEdge(e);let o=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,o)}})}function s6(t){t.graph().dummyChains=[],t.edges().forEach(e=>a6(t,e))}function a6(t,e){let n=e.v,o=t.node(n).rank,s=e.w,a=t.node(s).rank,l=e.name,u=t.edge(e),d=u.labelRank;if(a===o+1)return;t.removeEdge(e);let h,p,m;for(m=0,++o;o<a;++m,++o)u.points=[],p={width:0,height:0,edgeLabel:u,edgeObj:e,rank:o},h=Hr(t,"edge",p,"_d"),o===d&&(p.width=u.width,p.height=u.height,p.dummy="edge-label",p.labelpos=u.labelpos),t.setEdge(n,h,{weight:u.weight},l),m===0&&t.graph().dummyChains.push(h),n=h;t.setEdge(n,s,{weight:u.weight},l)}function l6(t){t.graph().dummyChains.forEach(e=>{let n=t.node(e),o=n.edgeLabel,s;for(t.setEdge(n.edgeObj,o);n.dummy;)s=t.successors(e)[0],t.removeNode(e),o.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(o.x=n.x,o.y=n.y,o.width=n.width,o.height=n.height),e=s,n=t.node(e)})}function Oh(t){let e={};function n(o){let s=t.node(o);if(Object.hasOwn(e,o))return s.rank;e[o]=!0;let a=t.outEdges(o),l=a?a.map(d=>d==null?Number.POSITIVE_INFINITY:n(d.w)-t.edge(d).minlen):[],u=ei(Math.min,l);return u===Number.POSITIVE_INFINITY&&(u=0),s.rank=u}t.sources().forEach(n)}function Ur(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}var Xw=c6;function c6(t){let e=new yn({directed:!1}),n=t.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let o=n[0],s=t.nodeCount();e.setNode(o,{});let a,l;for(;u6(e,t)<s&&(a=f6(e,t),!!a);)l=e.hasNode(a.v)?Ur(t,a):-Ur(t,a),d6(e,t,l);return e}function u6(t,e){function n(o){let s=e.nodeEdges(o);s&&s.forEach(a=>{let l=a.v,u=o===l?a.w:l;!t.hasNode(u)&&!Ur(e,a)&&(t.setNode(u,{}),t.setEdge(o,u,{}),n(u))})}return t.nodes().forEach(n),t.nodeCount()}function f6(t,e){return e.edges().reduce((n,o)=>{let s=Number.POSITIVE_INFINITY;return t.hasNode(o.v)!==t.hasNode(o.w)&&(s=Ur(e,o)),s<n[0]?[s,o]:n},[Number.POSITIVE_INFINITY,null])[1]}function d6(t,e,n){t.nodes().forEach(o=>e.node(o).rank+=n)}var{preorder:h6,postorder:p6}=Ah,m6=Xo;Xo.initLowLimValues=jh,Xo.initCutValues=Dh,Xo.calcCutValue=Zw,Xo.leaveEdge=Qw,Xo.enterEdge=Ww,Xo.exchangeEdges=Jw;function Xo(t){t=HL(t),Oh(t);let e=Xw(t);jh(e),Dh(e,t);let n,o;for(;n=Qw(e);)o=Ww(e,t,n),Jw(e,t,n,o)}function Dh(t,e){let n=p6(t,t.nodes());n=n.slice(0,n.length-1),n.forEach(o=>g6(t,e,o))}function g6(t,e,n){let o=t.node(n).parent,s=t.edge(n,o);s.cutvalue=Zw(t,e,n)}function Zw(t,e,n){let o=t.node(n).parent,s=!0,a=e.edge(n,o),l=0;a||(s=!1,a=e.edge(o,n)),l=a.weight;let u=e.nodeEdges(n);return u&&u.forEach(d=>{let h=d.v===n,p=h?d.w:d.v;if(p!==o){let m=h===s,y=e.edge(d).weight;if(l+=m?y:-y,v6(t,n,p)){let b=t.edge(n,p).cutvalue;l+=m?-b:b}}}),l}function jh(t,e){arguments.length<2&&(e=t.nodes()[0]),Kw(t,{},1,e)}function Kw(t,e,n,o,s){let a=n,l=t.node(o);e[o]=!0;let u=t.neighbors(o);return u&&u.forEach(d=>{Object.hasOwn(e,d)||(n=Kw(t,e,n,d,o))}),l.low=a,l.lim=n++,s?l.parent=s:delete l.parent,n}function Qw(t){return t.edges().find(e=>t.edge(e).cutvalue<0)}function Ww(t,e,n){let o=n.v,s=n.w;e.hasEdge(o,s)||(o=n.w,s=n.v);let a=t.node(o),l=t.node(s),u=a,d=!1;return a.lim>l.lim&&(u=l,d=!0),e.edges().filter(h=>d===t1(t,t.node(h.v),u)&&d!==t1(t,t.node(h.w),u)).reduce((h,p)=>Ur(e,p)<Ur(e,h)?p:h)}function Jw(t,e,n,o){let s=n.v,a=n.w;t.removeEdge(s,a),t.setEdge(o.v,o.w,{}),jh(t),Dh(t,e),y6(t,e)}function y6(t,e){let n=t.nodes().find(s=>!t.node(s).parent);if(!n)return;let o=h6(t,[n]);o=o.slice(1),o.forEach(s=>{let a=t.node(s).parent,l=e.edge(s,a),u=!1;l||(l=e.edge(a,s),u=!0),e.node(s).rank=e.node(a).rank+(u?l.minlen:-l.minlen)})}function v6(t,e,n){return t.hasEdge(e,n)}function t1(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}var b6=x6;function x6(t){let e=t.graph().ranker;if(typeof e=="function")return e(t);switch(e){case"network-simplex":e1(t);break;case"tight-tree":_6(t);break;case"longest-path":w6(t);break;case"none":break;default:e1(t)}}var w6=Oh;function _6(t){Oh(t),Xw(t)}function e1(t){m6(t)}var S6=E6;function E6(t){let e=T6(t);t.graph().dummyChains.forEach(n=>{let o=t.node(n),s=o.edgeObj,a=C6(t,e,s.v,s.w),l=a.path,u=a.lca,d=0,h=l[d],p=!0;for(;n!==s.w;){if(o=t.node(n),p){for(;(h=l[d])!==u&&t.node(h).maxRank<o.rank;)d++;h===u&&(p=!1)}if(!p){for(;d<l.length-1&&t.node(l[d+1]).minRank<=o.rank;)d++;h=l[d]}h!==void 0&&t.setParent(n,h),n=t.successors(n)[0]}})}function C6(t,e,n,o){let s=[],a=[],l=Math.min(e[n].low,e[o].low),u=Math.max(e[n].lim,e[o].lim),d;d=n;do d=t.parent(d),s.push(d);while(d&&(e[d].low>l||u>e[d].lim));let h=d,p=o;for(;(p=t.parent(p))!==h;)a.push(p);return{path:s.concat(a.reverse()),lca:h}}function T6(t){let e={},n=0;function o(s){let a=n;t.children(s).forEach(o),e[s]={low:a,lim:n++}}return t.children($c).forEach(o),e}function N6(t){let e=Hr(t,"root",{},"_root"),n=A6(t),o=Object.values(n),s=ei(Math.max,o)-1,a=2*s+1;t.graph().nestingRoot=e,t.edges().forEach(u=>t.edge(u).minlen*=a);let l=M6(t)+1;t.children($c).forEach(u=>n1(t,e,a,l,s,n,u)),t.graph().nodeRankFactor=a}function n1(t,e,n,o,s,a,l){var u;let d=t.children(l);if(!d.length){l!==e&&t.setEdge(e,l,{weight:0,minlen:n});return}let h=Uw(t,"_bt"),p=Uw(t,"_bb"),m=t.node(l);t.setParent(h,l),m.borderTop=h,t.setParent(p,l),m.borderBottom=p,d.forEach(y=>{var b;n1(t,e,n,o,s,a,y);let x=t.node(y),w=x.borderTop?x.borderTop:y,_=x.borderBottom?x.borderBottom:y,S=x.borderTop?o:2*o,k=w!==_?1:s-((b=a[l])!=null?b:0)+1;t.setEdge(h,w,{weight:S,minlen:k,nestingEdge:!0}),t.setEdge(_,p,{weight:S,minlen:k,nestingEdge:!0})}),t.parent(l)||t.setEdge(e,h,{weight:0,minlen:s+((u=a[l])!=null?u:0)})}function A6(t){let e={};function n(o,s){let a=t.children(o);a&&a.length&&a.forEach(l=>n(l,s+1)),e[o]=s}return t.children($c).forEach(o=>n(o,1)),e}function M6(t){return t.edges().reduce((e,n)=>e+t.edge(n).weight,0)}function R6(t){let e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(n=>{t.edge(n).nestingEdge&&t.removeEdge(n)})}var k6=O6;function O6(t){function e(n){let o=t.children(n),s=t.node(n);if(o.length&&o.forEach(e),Object.hasOwn(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(let a=s.minRank,l=s.maxRank+1;a<l;++a)i1(t,"borderLeft","_bl",n,s,a),i1(t,"borderRight","_br",n,s,a)}}t.children($c).forEach(e)}function i1(t,e,n,o,s,a){let l={width:0,height:0,rank:a,borderType:e},u=s[e][a-1],d=Hr(t,"border",l,n);s[e][a]=d,t.setParent(d,o),u&&t.setEdge(u,d,{weight:1})}function D6(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="lr"||n==="rl")&&o1(t)}function j6(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="bt"||n==="rl")&&z6(t),(n==="lr"||n==="rl")&&(V6(t),o1(t))}function o1(t){t.nodes().forEach(e=>r1(t.node(e))),t.edges().forEach(e=>r1(t.edge(e)))}function r1(t){let e=t.width;t.width=t.height,t.height=e}function z6(t){t.nodes().forEach(e=>zh(t.node(e))),t.edges().forEach(e=>{var n;let o=t.edge(e);(n=o.points)==null||n.forEach(zh),Object.hasOwn(o,"y")&&zh(o)})}function zh(t){t.y=-t.y}function V6(t){t.nodes().forEach(e=>Vh(t.node(e))),t.edges().forEach(e=>{var n;let o=t.edge(e);(n=o.points)==null||n.forEach(Vh),Object.hasOwn(o,"x")&&Vh(o)})}function Vh(t){let e=t.x;t.x=t.y,t.y=e}function L6(t){let e={},n=t.nodes().filter(u=>!t.children(u).length),o=n.map(u=>t.node(u).rank),s=ei(Math.max,o),a=xa(s+1).map(()=>[]);function l(u){if(e[u])return;e[u]=!0;let d=t.node(u);a[d.rank].push(u);let h=t.successors(u);h&&h.forEach(l)}return n.sort((u,d)=>t.node(u).rank-t.node(d).rank).forEach(l),a}function I6(t,e){let n=0;for(let o=1;o<e.length;++o)n+=P6(t,e[o-1],e[o]);return n}function P6(t,e,n){let o=FL(n,n.map((h,p)=>p)),s=e.flatMap(h=>{let p=t.outEdges(h);return p?p.map(m=>({pos:o[m.w],weight:t.edge(m).weight})).sort((m,y)=>m.pos-y.pos):[]}),a=1;for(;a<n.length;)a<<=1;let l=2*a-1;a-=1;let u=new Array(l).fill(0),d=0;return s.forEach(h=>{let p=h.pos+a;u[p]+=h.weight;let m=0;for(;p>0;)p%2&&(m+=u[p+1]),p=p-1>>1,u[p]+=h.weight;d+=h.weight*m}),d}function B6(t,e=[]){return e.map(n=>{let o=t.inEdges(n);if(!o||!o.length)return{v:n};{let s=o.reduce((a,l)=>{let u=t.edge(l),d=t.node(l.v);return{sum:a.sum+u.weight*d.order,weight:a.weight+u.weight}},{sum:0,weight:0});return{v:n,barycenter:s.sum/s.weight,weight:s.weight}}})}function H6(t,e){let n={};t.forEach((s,a)=>{let l={indegree:0,in:[],out:[],vs:[s.v],i:a};s.barycenter!==void 0&&(l.barycenter=s.barycenter,l.weight=s.weight),n[s.v]=l}),e.edges().forEach(s=>{let a=n[s.v],l=n[s.w];a!==void 0&&l!==void 0&&(l.indegree++,a.out.push(l))});let o=Object.values(n).filter(s=>!s.indegree);return U6(o)}function U6(t){let e=[];function n(s){return a=>{a.merged||(a.barycenter===void 0||s.barycenter===void 0||a.barycenter>=s.barycenter)&&$6(s,a)}}function o(s){return a=>{a.in.push(s),--a.indegree===0&&t.push(a)}}for(;t.length;){let s=t.pop();e.push(s),s.in.reverse().forEach(n(s)),s.out.forEach(o(s))}return e.filter(s=>!s.merged).map(s=>Hc(s,["vs","i","barycenter","weight"]))}function $6(t,e){let n=0,o=0;t.weight&&(n+=t.barycenter*t.weight,o+=t.weight),e.weight&&(n+=e.barycenter*e.weight,o+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=n/o,t.weight=o,t.i=Math.min(e.i,t.i),e.merged=!0}function Y6(t,e){let n=qL(t,p=>Object.hasOwn(p,"barycenter")),o=n.lhs,s=n.rhs.sort((p,m)=>m.i-p.i),a=[],l=0,u=0,d=0;o.sort(q6(!!e)),d=s1(a,s,d),o.forEach(p=>{d+=p.vs.length,a.push(p.vs),l+=p.barycenter*p.weight,u+=p.weight,d=s1(a,s,d)});let h={vs:a.flat(1)};return u&&(h.barycenter=l/u,h.weight=u),h}function s1(t,e,n){let o;for(;e.length&&(o=e[e.length-1]).i<=n;)e.pop(),t.push(o.vs),n++;return n}function q6(t){return(e,n)=>e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i}function a1(t,e,n,o){let s=t.children(e),a=t.node(e),l=a?a.borderLeft:void 0,u=a?a.borderRight:void 0,d={};l&&(s=s.filter(y=>y!==l&&y!==u));let h=B6(t,s);h.forEach(y=>{if(t.children(y.v).length){let b=a1(t,y.v,n,o);d[y.v]=b,Object.hasOwn(b,"barycenter")&&F6(y,b)}});let p=H6(h,n);G6(p,d);let m=Y6(p,o);if(l&&u){m.vs=[l,m.vs,u].flat(1);let y=t.predecessors(l);if(y&&y.length){let b=t.node(y[0]),x=t.predecessors(u),w=t.node(x[0]);Object.hasOwn(m,"barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+b.order+w.order)/(m.weight+2),m.weight+=2}}return m}function G6(t,e){t.forEach(n=>{n.vs=n.vs.flatMap(o=>e[o]?e[o].vs:o)})}function F6(t,e){t.barycenter!==void 0?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)}function X6(t,e,n,o){o||(o=t.nodes());let s=Z6(t),a=new yn({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(l=>t.node(l));return o.forEach(l=>{let u=t.node(l),d=t.parent(l);if(u.rank===e||u.minRank<=e&&e<=u.maxRank){a.setNode(l),a.setParent(l,d||s);let h=t[n](l);h&&h.forEach(p=>{let m=p.v===l?p.w:p.v,y=a.edge(m,l),b=y!==void 0?y.weight:0;a.setEdge(m,l,{weight:t.edge(p).weight+b})}),Object.hasOwn(u,"minRank")&&a.setNode(l,{borderLeft:u.borderLeft[e],borderRight:u.borderRight[e]})}}),a}function Z6(t){let e;for(;t.hasNode(e=Mh("_root")););return e}function K6(t,e,n){let o={},s;n.forEach(a=>{let l=t.parent(a),u,d;for(;l;){if(u=t.parent(l),u?(d=o[u],o[u]=l):(d=s,s=l),d&&d!==l){e.setEdge(d,l);return}l=u}})}function l1(t,e={}){if(typeof e.customOrder=="function"){e.customOrder(t,l1);return}let n=Yw(t),o=c1(t,xa(1,n+1),"inEdges"),s=c1(t,xa(n-1,-1,-1),"outEdges"),a=L6(t);if(u1(t,a),e.disableOptimalOrderHeuristic)return;let l=Number.POSITIVE_INFINITY,u,d=e.constraints||[];for(let h=0,p=0;p<4;++h,++p){Q6(h%2?o:s,h%4>=2,d),a=ba(t);let m=I6(t,a);m<l?(p=0,u=Object.assign({},a),l=m):m===l&&(u=structuredClone(a))}u1(t,u)}function c1(t,e,n){let o=new Map,s=(a,l)=>{o.has(a)||o.set(a,[]),o.get(a).push(l)};for(let a of t.nodes()){let l=t.node(a);if(typeof l.rank=="number"&&s(l.rank,a),typeof l.minRank=="number"&&typeof l.maxRank=="number")for(let u=l.minRank;u<=l.maxRank;u++)u!==l.rank&&s(u,a)}return e.map(function(a){return X6(t,a,n,o.get(a)||[])})}function Q6(t,e,n){let o=new yn;t.forEach(function(s){n.forEach(u=>o.setEdge(u.left,u.right));let a=s.graph().root,l=a1(s,a,o,e);l.vs.forEach((u,d)=>s.node(u).order=d),K6(s,o,l.vs)})}function u1(t,e){Object.values(e).forEach(n=>n.forEach((o,s)=>t.node(o).order=s))}function W6(t,e){let n={};function o(s,a){let l=0,u=0,d=s.length,h=a[a.length-1];return a.forEach((p,m)=>{let y=t8(t,p),b=y?t.node(y).order:d;(y||p===h)&&(a.slice(u,m+1).forEach(x=>{let w=t.predecessors(x);w&&w.forEach(_=>{let S=t.node(_),k=S.order;(k<l||b<k)&&!(S.dummy&&t.node(x).dummy)&&f1(n,_,x)})}),u=m+1,l=b)}),a}return e.length&&e.reduce(o),n}function J6(t,e){let n={};function o(a,l,u,d,h){xa(l,u).forEach(p=>{let m=a[p];if(m!==void 0&&t.node(m).dummy){let y=t.predecessors(m);y&&y.forEach(b=>{if(b===void 0)return;let x=t.node(b);x.dummy&&(x.order<d||x.order>h)&&f1(n,b,m)})}})}function s(a,l){let u=-1,d=-1,h=0;return l.forEach((p,m)=>{if(t.node(p).dummy==="border"){let y=t.predecessors(p);if(y&&y.length){let b=y[0];if(b===void 0)return;d=t.node(b).order,o(l,h,m,u,d),h=m,u=d}}o(l,h,l.length,d,a.length)}),l}return e.length&&e.reduce(s),n}function t8(t,e){if(t.node(e).dummy){let n=t.predecessors(e);if(n)return n.find(o=>t.node(o).dummy)}}function f1(t,e,n){if(e>n){let s=e;e=n,n=s}let o=t[e];o||(t[e]=o={}),o[n]=!0}function e8(t,e,n){if(e>n){let s=e;e=n,n=s}let o=t[e];return o!==void 0&&Object.hasOwn(o,n)}function n8(t,e,n,o){let s={},a={},l={};return e.forEach(u=>{u.forEach((d,h)=>{s[d]=d,a[d]=d,l[d]=h})}),e.forEach(u=>{let d=-1;u.forEach(h=>{let p=o(h);if(p&&p.length){let m=p.sort((b,x)=>{let w=l[b],_=l[x];return(w!==void 0?w:0)-(_!==void 0?_:0)}),y=(m.length-1)/2;for(let b=Math.floor(y),x=Math.ceil(y);b<=x;++b){let w=m[b];if(w===void 0)continue;let _=l[w];if(_!==void 0&&a[h]===h&&d<_&&!e8(n,h,w)){let S=s[w];S!==void 0&&(a[w]=h,a[h]=s[h]=S,d=_)}}}})}),{root:s,align:a}}function i8(t,e,n,o,s=!1){let a={},l=o8(t,e,n,s),u=s?"borderLeft":"borderRight";function d(b,x){let w=l.nodes().slice(),_={},S=w.pop();for(;S;){if(_[S])b(S);else{_[S]=!0,w.push(S);for(let k of x(S))w.push(k)}S=w.pop()}}function h(b){let x=l.inEdges(b);x?a[b]=x.reduce((w,_)=>{var S;let k=(S=a[_.v])!=null?S:0,C=l.edge(_);return Math.max(w,k+(C!==void 0?C:0))},0):a[b]=0}function p(b){let x=l.outEdges(b),w=Number.POSITIVE_INFINITY;x&&(w=x.reduce((S,k)=>{let C=a[k.w],E=l.edge(k);return Math.min(S,(C!==void 0?C:0)-(E!==void 0?E:0))},Number.POSITIVE_INFINITY));let _=t.node(b);w!==Number.POSITIVE_INFINITY&&_.borderType!==u&&(a[b]=Math.max(a[b]!==void 0?a[b]:0,w))}function m(b){return l.predecessors(b)||[]}function y(b){return l.successors(b)||[]}return d(h,m),d(p,y),Object.keys(o).forEach(b=>{var x;let w=n[b];w!==void 0&&(a[b]=(x=a[w])!=null?x:0)}),a}function o8(t,e,n,o){let s=new yn,a=t.graph(),l=c8(a.nodesep,a.edgesep,o);return e.forEach(u=>{let d;u.forEach(h=>{let p=n[h];if(p!==void 0){if(s.setNode(p),d!==void 0){let m=n[d];if(m!==void 0){let y=s.edge(m,p);s.setEdge(m,p,Math.max(l(t,h,d),y||0))}}d=h}})}),s}function r8(t,e){return Object.values(e).reduce((n,o)=>{let s=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;Object.entries(o).forEach(([u,d])=>{let h=u8(t,u)/2;s=Math.max(d+h,s),a=Math.min(d-h,a)});let l=s-a;return l<n[0]&&(n=[l,o]),n},[Number.POSITIVE_INFINITY,null])[1]}function s8(t,e){let n=Object.values(e),o=ei(Math.min,n),s=ei(Math.max,n);["u","d"].forEach(a=>{["l","r"].forEach(l=>{let u=a+l,d=t[u];if(!d||d===e)return;let h=Object.values(d),p=o-ei(Math.min,h);l!=="l"&&(p=s-ei(Math.max,h)),p&&(t[u]=Uc(d,m=>m+p))})})}function a8(t,e=void 0){let n=t.ul;return n?Uc(n,(o,s)=>{var a,l;if(e){let d=e.toLowerCase(),h=t[d];if(h&&h[s]!==void 0)return h[s]}let u=Object.values(t).map(d=>{let h=d[s];return h!==void 0?h:0}).sort((d,h)=>d-h);return(((a=u[1])!=null?a:0)+((l=u[2])!=null?l:0))/2}):{}}function l8(t){let e=ba(t),n=Object.assign(W6(t,e),J6(t,e)),o={},s;["u","d"].forEach(l=>{s=l==="u"?e:Object.values(e).reverse(),["l","r"].forEach(u=>{u==="r"&&(s=s.map(p=>Object.values(p).reverse()));let d=n8(t,s,n,p=>(l==="u"?t.predecessors(p):t.successors(p))||[]),h=i8(t,s,d.root,d.align,u==="r");u==="r"&&(h=Uc(h,p=>-p)),o[l+u]=h})});let a=r8(t,o);return s8(o,a),a8(o,t.graph().align)}function c8(t,e,n){return(o,s,a)=>{let l=o.node(s),u=o.node(a),d=0,h;if(d+=l.width/2,Object.hasOwn(l,"labelpos"))switch(l.labelpos.toLowerCase()){case"l":h=-l.width/2;break;case"r":h=l.width/2;break}if(h&&(d+=n?h:-h),h=void 0,d+=(l.dummy?e:t)/2,d+=(u.dummy?e:t)/2,d+=u.width/2,Object.hasOwn(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":h=u.width/2;break;case"r":h=-u.width/2;break}return h&&(d+=n?h:-h),d}}function u8(t,e){return t.node(e).width}function f8(t){t=Bw(t),d8(t),Object.entries(l8(t)).forEach(([e,n])=>t.node(e).x=n)}function d8(t){let e=ba(t),n=t.graph(),o=n.ranksep,s=n.rankalign,a=0;e.forEach(l=>{let u=l.reduce((d,h)=>{var p;let m=(p=t.node(h).height)!=null?p:0;return d>m?d:m},0);l.forEach(d=>{let h=t.node(d);s==="top"?h.y=a+h.height/2:s==="bottom"?h.y=a+u-h.height/2:h.y=a+u/2}),a+=u+o})}function h8(t,e={}){let n=e.debugTiming?qw:Gw;return n("layout",()=>{let o=n(" buildLayoutGraph",()=>S8(t));return n(" runLayout",()=>p8(o,n,e)),n(" updateInputGraph",()=>m8(t,o)),o})}function p8(t,e,n){e(" makeSpaceForEdgeLabels",()=>E8(t)),e(" removeSelfEdges",()=>D8(t)),e(" acyclic",()=>i6(t)),e(" nestingGraph.run",()=>N6(t)),e(" rank",()=>b6(Bw(t))),e(" injectEdgeLabelProxies",()=>C8(t)),e(" removeEmptyRanks",()=>$L(t)),e(" nestingGraph.cleanup",()=>R6(t)),e(" normalizeRanks",()=>UL(t)),e(" assignRankMinMax",()=>T8(t)),e(" removeEdgeLabelProxies",()=>N8(t)),e(" normalize.run",()=>s6(t)),e(" parentDummyChains",()=>S6(t)),e(" addBorderSegments",()=>k6(t)),e(" order",()=>l1(t,n)),e(" insertSelfEdges",()=>j8(t)),e(" adjustCoordinateSystem",()=>D6(t)),e(" position",()=>f8(t)),e(" positionSelfEdges",()=>z8(t)),e(" removeBorderNodes",()=>O8(t)),e(" normalize.undo",()=>l6(t)),e(" fixupEdgeLabelCoords",()=>R8(t)),e(" undoCoordinateSystem",()=>j6(t)),e(" translateGraph",()=>A8(t)),e(" assignNodeIntersects",()=>M8(t)),e(" reversePoints",()=>k8(t)),e(" acyclic.undo",()=>r6(t))}function m8(t,e){t.nodes().forEach(n=>{let o=t.node(n),s=e.node(n);o&&(o.x=s.x,o.y=s.y,o.order=s.order,o.rank=s.rank,e.children(n).length&&(o.width=s.width,o.height=s.height))}),t.edges().forEach(n=>{let o=t.edge(n),s=e.edge(n);o.points=s.points,Object.hasOwn(s,"x")&&(o.x=s.x,o.y=s.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}var g8=["nodesep","edgesep","ranksep","marginx","marginy"],y8={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},v8=["acyclicer","ranker","rankdir","align","rankalign"],b8=["width","height","rank"],d1={width:0,height:0},x8=["minlen","weight","width","height","labeloffset"],w8={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},_8=["labelpos"];function S8(t){let e=new yn({multigraph:!0,compound:!0}),n=Ih(t.graph());return e.setGraph(Object.assign({},y8,Lh(n,g8),Hc(n,v8))),t.nodes().forEach(o=>{let s=Ih(t.node(o)),a=Lh(s,b8);Object.keys(d1).forEach(u=>{a[u]===void 0&&(a[u]=d1[u])}),e.setNode(o,a);let l=t.parent(o);l!==void 0&&e.setParent(o,l)}),t.edges().forEach(o=>{let s=Ih(t.edge(o));e.setEdge(o,Object.assign({},w8,Lh(s,x8),Hc(s,_8)))}),e}function E8(t){let e=t.graph();e.ranksep/=2,t.edges().forEach(n=>{let o=t.edge(n);o.minlen*=2,o.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?o.width+=o.labeloffset:o.height+=o.labeloffset)})}function C8(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.width&&n.height){let o=t.node(e.v),s={rank:(t.node(e.w).rank-o.rank)/2+o.rank,e};Hr(t,"edge-proxy",s,"_ep")}})}function T8(t){let e=0;t.nodes().forEach(n=>{let o=t.node(n);o.borderTop&&(o.minRank=t.node(o.borderTop).rank,o.maxRank=t.node(o.borderBottom).rank,e=Math.max(e,o.maxRank))}),t.graph().maxRank=e}function N8(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="edge-proxy"){let o=n;t.edge(o.e).labelRank=n.rank,t.removeNode(e)}})}function A8(t){let e=Number.POSITIVE_INFINITY,n=0,o=Number.POSITIVE_INFINITY,s=0,a=t.graph(),l=a.marginx||0,u=a.marginy||0;function d(h){let p=h.x,m=h.y,y=h.width,b=h.height;e=Math.min(e,p-y/2),n=Math.max(n,p+y/2),o=Math.min(o,m-b/2),s=Math.max(s,m+b/2)}t.nodes().forEach(h=>d(t.node(h))),t.edges().forEach(h=>{let p=t.edge(h);Object.hasOwn(p,"x")&&d(p)}),e-=l,o-=u,t.nodes().forEach(h=>{let p=t.node(h);p.x-=e,p.y-=o}),t.edges().forEach(h=>{let p=t.edge(h);p.points.forEach(m=>{m.x-=e,m.y-=o}),Object.hasOwn(p,"x")&&(p.x-=e),Object.hasOwn(p,"y")&&(p.y-=o)}),a.width=n-e+l,a.height=s-o+u}function M8(t){t.edges().forEach(e=>{let n=t.edge(e),o=t.node(e.v),s=t.node(e.w),a,l;n.points?(a=n.points[0],l=n.points[n.points.length-1]):(n.points=[],a=s,l=o),n.points.unshift(Hw(o,a)),n.points.push(Hw(s,l))})}function R8(t){t.edges().forEach(e=>{let n=t.edge(e);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function k8(t){t.edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}function O8(t){t.nodes().forEach(e=>{if(t.children(e).length){let n=t.node(e),o=t.node(n.borderTop),s=t.node(n.borderBottom),a=t.node(n.borderLeft[n.borderLeft.length-1]),l=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(l.x-a.x),n.height=Math.abs(s.y-o.y),n.x=a.x+n.width/2,n.y=o.y+n.height/2}}),t.nodes().forEach(e=>{t.node(e).dummy==="border"&&t.removeNode(e)})}function D8(t){t.edges().forEach(e=>{if(e.v===e.w){let n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}})}function j8(t){ba(t).forEach(e=>{let n=0;e.forEach((o,s)=>{let a=t.node(o);a.order=s+n,(a.selfEdges||[]).forEach(l=>{Hr(t,"selfedge",{width:l.label.width,height:l.label.height,rank:a.rank,order:s+ ++n,e:l.e,label:l.label},"_se")}),delete a.selfEdges})})}function z8(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="selfedge"){let o=n,s=t.node(o.e.v),a=s.x+s.width/2,l=s.y,u=n.x-a,d=s.height/2;t.setEdge(o.e,o.label),t.removeNode(e),o.label.points=[{x:a+2*u/3,y:l-d},{x:a+5*u/6,y:l-d},{x:a+u,y:l},{x:a+5*u/6,y:l+d},{x:a+2*u/3,y:l+d}],o.label.x=n.x,o.label.y=n.y}})}function Lh(t,e){return Uc(Hc(t,e),Number)}function Ih(t){let e={};return t&&Object.entries(t).forEach(([n,o])=>{typeof n=="string"&&(n=n.toLowerCase()),e[n]=o}),e}function V8(t){let e=ba(t),n=new yn({compound:!0,multigraph:!0}).setGraph({});return t.nodes().forEach(o=>{n.setNode(o,{label:o}),n.setParent(o,"layer"+t.node(o).rank)}),t.edges().forEach(o=>n.setEdge(o.v,o.w,{},o.name)),e.forEach((o,s)=>{let a="layer"+s;n.setNode(a,{rank:"same"}),o.reduce((l,u)=>(n.setEdge(l,u,{style:"invis"}),u))}),n}var L8={graphlib:Mw,version:XL,layout:h8,debug:V8,util:{time:qw,notime:Gw}},h1=L8;const I8={Switch:{width:140,height:110},Button:{width:120,height:80},Input:{width:140,height:80},Led:{width:100,height:110},Output:{width:100,height:80},HexDisplay:{width:100,height:80},SevenSegment:{width:100,height:80},Screen:{width:200,height:200},RasterDisplay:{width:200,height:200},Console:{width:380,height:220},Register:{width:120,height:80},RAM:{width:120,height:80},ROM:{width:120,height:80},DualPortRAM:{width:140,height:100}},P8={width:160,height:80};function B8(t){return I8[t]??P8}function H8(t,e){const a=new h1.graphlib.Graph;a.setGraph({rankdir:"LR",nodesep:60,ranksep:90,marginx:20,marginy:20}),a.setDefaultEdgeLabel(()=>({}));const l=new Set;for(const d of t.nodes){const h=B8(d.componentRef);a.setNode(d.id,{width:h.width,height:h.height}),l.add(d.id)}for(const d of t.connections)!l.has(d.source.nodeId)||!l.has(d.target.nodeId)||a.setEdge(d.source.nodeId,d.target.nodeId);h1.layout(a);const u={components:{},connections:{}};for(const d of t.nodes){const h=a.node(d.id);h&&(u.components[d.id]={id:d.id,position:{x:h.x-h.width/2,y:h.y-h.height/2}})}return u}function U8(t,e){return N.useMemo(()=>t?{metadata:H8(t),isLayoutReady:!0}:{metadata:{components:{},connections:{}},isLayoutReady:!1},[t,e?.direction,e?.nodeSpacing,e?.rankSpacing])}const p1="(pointer: coarse) and (max-width: 1024px)";function $8(){const[t,e]=N.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(p1).matches);return N.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const n=window.matchMedia(p1),o=s=>e(s.matches);return e(n.matches),n.addEventListener("change",o),()=>n.removeEventListener("change",o)},[]),t}function m1(){const[t,e]=N.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark")?"dark":"light");return N.useEffect(()=>{const n=document.documentElement,o=new MutationObserver(()=>{e(n.classList.contains("dark")?"dark":"light")});return o.observe(n,{attributes:!0,attributeFilter:["class"]}),()=>o.disconnect()},[]),t}const Ph=N.createContext({});function Bh(t){const e=N.useRef(null);return e.current===null&&(e.current=t()),e.current}const g1=typeof window<"u",y1=g1?N.useLayoutEffect:N.useEffect,Yc=N.createContext(null);function Hh(t,e){t.indexOf(e)===-1&&t.push(e)}function qc(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const ni=(t,e,n)=>n>e?e:n<t?t:n;let Uh=()=>{};const bi={},v1=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function b1(t){return typeof t=="object"&&t!==null}const x1=t=>/^0[^.\s]+$/u.test(t);function w1(t){let e;return()=>(e===void 0&&(e=t()),e)}const vn=t=>t,Y8=(t,e)=>n=>e(t(n)),wa=(...t)=>t.reduce(Y8),_a=(t,e,n)=>{const o=e-t;return o===0?1:(n-t)/o};class $h{constructor(){this.subscriptions=[]}add(e){return Hh(this.subscriptions,e),()=>qc(this.subscriptions,e)}notify(e,n,o){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,o);else for(let a=0;a<s;a++){const l=this.subscriptions[a];l&&l(e,n,o)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Ln=t=>t*1e3,bn=t=>t/1e3;function _1(t,e){return e?t*(1e3/e):0}const S1=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,q8=1e-7,G8=12;function F8(t,e,n,o,s){let a,l,u=0;do l=e+(n-e)/2,a=S1(l,o,s)-t,a>0?n=l:e=l;while(Math.abs(a)>q8&&++u<G8);return l}function Sa(t,e,n,o){if(t===e&&n===o)return vn;const s=a=>F8(a,0,1,t,n);return a=>a===0||a===1?a:S1(s(a),e,o)}const E1=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,C1=t=>e=>1-t(1-e),T1=Sa(.33,1.53,.69,.99),Yh=C1(T1),N1=E1(Yh),A1=t=>(t*=2)<1?.5*Yh(t):.5*(2-Math.pow(2,-10*(t-1))),qh=t=>1-Math.sin(Math.acos(t)),M1=C1(qh),R1=E1(qh),X8=Sa(.42,0,1,1),Z8=Sa(0,0,.58,1),k1=Sa(.42,0,.58,1),K8=t=>Array.isArray(t)&&typeof t[0]!="number",O1=t=>Array.isArray(t)&&typeof t[0]=="number",Q8={linear:vn,easeIn:X8,easeInOut:k1,easeOut:Z8,circIn:qh,circInOut:R1,circOut:M1,backIn:Yh,backInOut:N1,backOut:T1,anticipate:A1},W8=t=>typeof t=="string",D1=t=>{if(O1(t)){Uh(t.length===4);const[e,n,o,s]=t;return Sa(e,n,o,s)}else if(W8(t))return Q8[t];return t},Gc=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function J8(t,e){let n=new Set,o=new Set,s=!1,a=!1;const l=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function d(p){l.has(p)&&(h.schedule(p),t()),p(u)}const h={schedule:(p,m=!1,y=!1)=>{const x=y&&s?n:o;return m&&l.add(p),x.has(p)||x.add(p),p},cancel:p=>{o.delete(p),l.delete(p)},process:p=>{if(u=p,s){a=!0;return}s=!0,[n,o]=[o,n],n.forEach(d),n.clear(),s=!1,a&&(a=!1,h.process(p))}};return h}const tI=40;function j1(t,e){let n=!1,o=!0;const s={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,l=Gc.reduce((C,E)=>(C[E]=J8(a),C),{}),{setup:u,read:d,resolveKeyframes:h,preUpdate:p,update:m,preRender:y,render:b,postRender:x}=l,w=()=>{const C=bi.useManualTiming?s.timestamp:performance.now();n=!1,bi.useManualTiming||(s.delta=o?1e3/60:Math.max(Math.min(C-s.timestamp,tI),1)),s.timestamp=C,s.isProcessing=!0,u.process(s),d.process(s),h.process(s),p.process(s),m.process(s),y.process(s),b.process(s),x.process(s),s.isProcessing=!1,n&&e&&(o=!1,t(w))},_=()=>{n=!0,o=!0,s.isProcessing||t(w)};return{schedule:Gc.reduce((C,E)=>{const R=l[E];return C[E]=(A,O=!1,D=!1)=>(n||_(),R.schedule(A,O,D)),C},{}),cancel:C=>{for(let E=0;E<Gc.length;E++)l[Gc[E]].cancel(C)},state:s,steps:l}}const{schedule:re,cancel:Qi,state:Le,steps:Gh}=j1(typeof requestAnimationFrame<"u"?requestAnimationFrame:vn,!0);let Fc;function eI(){Fc=void 0}const qe={now:()=>(Fc===void 0&&qe.set(Le.isProcessing||bi.useManualTiming?Le.timestamp:performance.now()),Fc),set:t=>{Fc=t,queueMicrotask(eI)}},z1=t=>e=>typeof e=="string"&&e.startsWith(t),V1=z1("--"),nI=z1("var(--"),Fh=t=>nI(t)?iI.test(t.split("/*")[0].trim()):!1,iI=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function L1(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const $r={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Ea={...$r,transform:t=>ni(0,1,t)},Xc={...$r,default:1},Ca=t=>Math.round(t*1e5)/1e5,Xh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function oI(t){return t==null}const rI=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Zh=(t,e)=>n=>!!(typeof n=="string"&&rI.test(n)&&n.startsWith(t)||e&&!oI(n)&&Object.prototype.hasOwnProperty.call(n,e)),I1=(t,e,n)=>o=>{if(typeof o!="string")return o;const[s,a,l,u]=o.match(Xh);return{[t]:parseFloat(s),[e]:parseFloat(a),[n]:parseFloat(l),alpha:u!==void 0?parseFloat(u):1}},sI=t=>ni(0,255,t),Kh={...$r,transform:t=>Math.round(sI(t))},Zo={test:Zh("rgb","red"),parse:I1("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:o=1})=>"rgba("+Kh.transform(t)+", "+Kh.transform(e)+", "+Kh.transform(n)+", "+Ca(Ea.transform(o))+")"};function aI(t){let e="",n="",o="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),o=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),o=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,o+=o,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(o,16),alpha:s?parseInt(s,16)/255:1}}const Qh={test:Zh("#"),parse:aI,transform:Zo.transform},Ta=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Wi=Ta("deg"),ii=Ta("%"),_t=Ta("px"),lI=Ta("vh"),cI=Ta("vw"),P1={...ii,parse:t=>ii.parse(t)/100,transform:t=>ii.transform(t*100)},Yr={test:Zh("hsl","hue"),parse:I1("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:o=1})=>"hsla("+Math.round(t)+", "+ii.transform(Ca(e))+", "+ii.transform(Ca(n))+", "+Ca(Ea.transform(o))+")"},_e={test:t=>Zo.test(t)||Qh.test(t)||Yr.test(t),parse:t=>Zo.test(t)?Zo.parse(t):Yr.test(t)?Yr.parse(t):Qh.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Zo.transform(t):Yr.transform(t),getAnimatableNone:t=>{const e=_e.parse(t);return e.alpha=0,_e.transform(e)}},uI=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function fI(t){return isNaN(t)&&typeof t=="string"&&(t.match(Xh)?.length||0)+(t.match(uI)?.length||0)>0}const B1="number",H1="color",dI="var",hI="var(",U1="${}",pI=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Na(t){const e=t.toString(),n=[],o={color:[],number:[],var:[]},s=[];let a=0;const u=e.replace(pI,d=>(_e.test(d)?(o.color.push(a),s.push(H1),n.push(_e.parse(d))):d.startsWith(hI)?(o.var.push(a),s.push(dI),n.push(d)):(o.number.push(a),s.push(B1),n.push(parseFloat(d))),++a,U1)).split(U1);return{values:n,split:u,indexes:o,types:s}}function $1(t){return Na(t).values}function Y1(t){const{split:e,types:n}=Na(t),o=e.length;return s=>{let a="";for(let l=0;l<o;l++)if(a+=e[l],s[l]!==void 0){const u=n[l];u===B1?a+=Ca(s[l]):u===H1?a+=_e.transform(s[l]):a+=s[l]}return a}}const mI=t=>typeof t=="number"?0:_e.test(t)?_e.getAnimatableNone(t):t;function gI(t){const e=$1(t);return Y1(t)(e.map(mI))}const In={test:fI,parse:$1,createTransformer:Y1,getAnimatableNone:gI};function Wh(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<.16666666666666666?t+(e-t)*6*n:n<.5?e:n<.6666666666666666?t+(e-t)*(.6666666666666666-n)*6:t}function yI({hue:t,saturation:e,lightness:n,alpha:o}){t/=360,e/=100,n/=100;let s=0,a=0,l=0;if(!e)s=a=l=n;else{const u=n<.5?n*(1+e):n+e-n*e,d=2*n-u;s=Wh(d,u,t+.3333333333333333),a=Wh(d,u,t),l=Wh(d,u,t-.3333333333333333)}return{red:Math.round(s*255),green:Math.round(a*255),blue:Math.round(l*255),alpha:o}}function Zc(t,e){return n=>n>0?e:t}const he=(t,e,n)=>t+(e-t)*n,Jh=(t,e,n)=>{const o=t*t,s=n*(e*e-o)+o;return s<0?0:Math.sqrt(s)},vI=[Qh,Zo,Yr],bI=t=>vI.find(e=>e.test(t));function q1(t){const e=bI(t);if(!e)return!1;let n=e.parse(t);return e===Yr&&(n=yI(n)),n}const G1=(t,e)=>{const n=q1(t),o=q1(e);if(!n||!o)return Zc(t,e);const s={...n};return a=>(s.red=Jh(n.red,o.red,a),s.green=Jh(n.green,o.green,a),s.blue=Jh(n.blue,o.blue,a),s.alpha=he(n.alpha,o.alpha,a),Zo.transform(s))},tp=new Set(["none","hidden"]);function xI(t,e){return tp.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function wI(t,e){return n=>he(t,e,n)}function ep(t){return typeof t=="number"?wI:typeof t=="string"?Fh(t)?Zc:_e.test(t)?G1:EI:Array.isArray(t)?F1:typeof t=="object"?_e.test(t)?G1:_I:Zc}function F1(t,e){const n=[...t],o=n.length,s=t.map((a,l)=>ep(a)(a,e[l]));return a=>{for(let l=0;l<o;l++)n[l]=s[l](a);return n}}function _I(t,e){const n={...t,...e},o={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(o[s]=ep(t[s])(t[s],e[s]));return s=>{for(const a in o)n[a]=o[a](s);return n}}function SI(t,e){const n=[],o={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const a=e.types[s],l=t.indexes[a][o[a]],u=t.values[l]??0;n[s]=u,o[a]++}return n}const EI=(t,e)=>{const n=In.createTransformer(e),o=Na(t),s=Na(e);return o.indexes.var.length===s.indexes.var.length&&o.indexes.color.length===s.indexes.color.length&&o.indexes.number.length>=s.indexes.number.length?tp.has(t)&&!s.values.length||tp.has(e)&&!o.values.length?xI(t,e):wa(F1(SI(o,s),s.values),n):Zc(t,e)};function X1(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?he(t,e,n):ep(t)(t,e)}const CI=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>re.update(e,n),stop:()=>Qi(e),now:()=>Le.isProcessing?Le.timestamp:qe.now()}},Z1=(t,e,n=10)=>{let o="";const s=Math.max(Math.round(e/n),2);for(let a=0;a<s;a++)o+=Math.round(t(a/(s-1))*1e4)/1e4+", ";return`linear(${o.substring(0,o.length-2)})`},Kc=2e4;function np(t){let e=0;const n=50;let o=t.next(e);for(;!o.done&&e<Kc;)e+=n,o=t.next(e);return e>=Kc?1/0:e}function TI(t,e=100,n){const o=n({...t,keyframes:[0,e]}),s=Math.min(np(o),Kc);return{type:"keyframes",ease:a=>o.next(s*a).value/e,duration:bn(s)}}const NI=5;function K1(t,e,n){const o=Math.max(e-NI,0);return _1(n-t(o),e-o)}const pe={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},ip=.001;function AI({duration:t=pe.duration,bounce:e=pe.bounce,velocity:n=pe.velocity,mass:o=pe.mass}){let s,a,l=1-e;l=ni(pe.minDamping,pe.maxDamping,l),t=ni(pe.minDuration,pe.maxDuration,bn(t)),l<1?(s=h=>{const p=h*l,m=p*t,y=p-n,b=op(h,l),x=Math.exp(-m);return ip-y/b*x},a=h=>{const m=h*l*t,y=m*n+n,b=Math.pow(l,2)*Math.pow(h,2)*t,x=Math.exp(-m),w=op(Math.pow(h,2),l);return(-s(h)+ip>0?-1:1)*((y-b)*x)/w}):(s=h=>{const p=Math.exp(-h*t),m=(h-n)*t+1;return-ip+p*m},a=h=>{const p=Math.exp(-h*t),m=(n-h)*(t*t);return p*m});const u=5/t,d=RI(s,a,u);if(t=Ln(t),isNaN(d))return{stiffness:pe.stiffness,damping:pe.damping,duration:t};{const h=Math.pow(d,2)*o;return{stiffness:h,damping:l*2*Math.sqrt(o*h),duration:t}}}const MI=12;function RI(t,e,n){let o=n;for(let s=1;s<MI;s++)o=o-t(o)/e(o);return o}function op(t,e){return t*Math.sqrt(1-e*e)}const kI=["duration","bounce"],OI=["stiffness","damping","mass"];function Q1(t,e){return e.some(n=>t[n]!==void 0)}function DI(t){let e={velocity:pe.velocity,stiffness:pe.stiffness,damping:pe.damping,mass:pe.mass,isResolvedFromDuration:!1,...t};if(!Q1(t,OI)&&Q1(t,kI))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,o=2*Math.PI/(n*1.2),s=o*o,a=2*ni(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:pe.mass,stiffness:s,damping:a}}else{const n=AI({...t,velocity:0});e={...e,...n,mass:pe.mass},e.isResolvedFromDuration=!0}return e}function Qc(t=pe.visualDuration,e=pe.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:o,restDelta:s}=n;const a=n.keyframes[0],l=n.keyframes[n.keyframes.length-1],u={done:!1,value:a},{stiffness:d,damping:h,mass:p,duration:m,velocity:y,isResolvedFromDuration:b}=DI({...n,velocity:-bn(n.velocity||0)}),x=y||0,w=h/(2*Math.sqrt(d*p)),_=l-a,S=bn(Math.sqrt(d/p)),k=Math.abs(_)<5;o||(o=k?pe.restSpeed.granular:pe.restSpeed.default),s||(s=k?pe.restDelta.granular:pe.restDelta.default);let C;if(w<1){const R=op(S,w);C=A=>{const O=Math.exp(-w*S*A);return l-O*((x+w*S*_)/R*Math.sin(R*A)+_*Math.cos(R*A))}}else if(w===1)C=R=>l-Math.exp(-S*R)*(_+(x+S*_)*R);else{const R=S*Math.sqrt(w*w-1);C=A=>{const O=Math.exp(-w*S*A),D=Math.min(R*A,300);return l-O*((x+w*S*_)*Math.sinh(D)+R*_*Math.cosh(D))/R}}const E={calculatedDuration:b&&m||null,next:R=>{const A=C(R);if(b)u.done=R>=m;else{let O=R===0?x:0;w<1&&(O=R===0?Ln(x):K1(C,R,A));const D=Math.abs(O)<=o,U=Math.abs(l-A)<=s;u.done=D&&U}return u.value=u.done?l:A,u},toString:()=>{const R=Math.min(np(E),Kc),A=Z1(O=>E.next(R*O).value,R,30);return R+"ms "+A},toTransition:()=>{}};return E}Qc.applyToOptions=t=>{const e=TI(t,100,Qc);return t.ease=e.ease,t.duration=Ln(e.duration),t.type="keyframes",t};function rp({keyframes:t,velocity:e=0,power:n=.8,timeConstant:o=325,bounceDamping:s=10,bounceStiffness:a=500,modifyTarget:l,min:u,max:d,restDelta:h=.5,restSpeed:p}){const m=t[0],y={done:!1,value:m},b=D=>u!==void 0&&D<u||d!==void 0&&D>d,x=D=>u===void 0?d:d===void 0||Math.abs(u-D)<Math.abs(d-D)?u:d;let w=n*e;const _=m+w,S=l===void 0?_:l(_);S!==_&&(w=S-m);const k=D=>-w*Math.exp(-D/o),C=D=>S+k(D),E=D=>{const U=k(D),q=C(D);y.done=Math.abs(U)<=h,y.value=y.done?S:q};let R,A;const O=D=>{b(y.value)&&(R=D,A=Qc({keyframes:[y.value,x(y.value)],velocity:K1(C,D,y.value),damping:s,stiffness:a,restDelta:h,restSpeed:p}))};return O(0),{calculatedDuration:null,next:D=>{let U=!1;return!A&&R===void 0&&(U=!0,E(D),O(D)),R!==void 0&&D>=R?A.next(D-R):(!U&&E(D),y)}}}function jI(t,e,n){const o=[],s=n||bi.mix||X1,a=t.length-1;for(let l=0;l<a;l++){let u=s(t[l],t[l+1]);if(e){const d=Array.isArray(e)?e[l]||vn:e;u=wa(d,u)}o.push(u)}return o}function zI(t,e,{clamp:n=!0,ease:o,mixer:s}={}){const a=t.length;if(Uh(a===e.length),a===1)return()=>e[0];if(a===2&&e[0]===e[1])return()=>e[1];const l=t[0]===t[1];t[0]>t[a-1]&&(t=[...t].reverse(),e=[...e].reverse());const u=jI(e,o,s),d=u.length,h=p=>{if(l&&p<t[0])return e[0];let m=0;if(d>1)for(;m<t.length-2&&!(p<t[m+1]);m++);const y=_a(t[m],t[m+1],p);return u[m](y)};return n?p=>h(ni(t[0],t[a-1],p)):h}function VI(t,e){const n=t[t.length-1];for(let o=1;o<=e;o++){const s=_a(0,e,o);t.push(he(n,1,s))}}function LI(t){const e=[0];return VI(e,t.length-1),e}function II(t,e){return t.map(n=>n*e)}function PI(t,e){return t.map(()=>e||k1).splice(0,t.length-1)}function Aa({duration:t=300,keyframes:e,times:n,ease:o="easeInOut"}){const s=K8(o)?o.map(D1):D1(o),a={done:!1,value:e[0]},l=II(n&&n.length===e.length?n:LI(e),t),u=zI(l,e,{ease:Array.isArray(s)?s:PI(e,s)});return{calculatedDuration:t,next:d=>(a.value=u(d),a.done=d>=t,a)}}const BI=t=>t!==null;function sp(t,{repeat:e,repeatType:n="loop"},o,s=1){const a=t.filter(BI),u=s<0||e&&n!=="loop"&&e%2===1?0:a.length-1;return!u||o===void 0?a[u]:o}const HI={decay:rp,inertia:rp,tween:Aa,keyframes:Aa,spring:Qc};function W1(t){typeof t.type=="string"&&(t.type=HI[t.type])}class ap{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const UI=t=>t/100;class lp extends ap{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==qe.now()&&this.tick(qe.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;W1(e);const{type:n=Aa,repeat:o=0,repeatDelay:s=0,repeatType:a,velocity:l=0}=e;let{keyframes:u}=e;const d=n||Aa;d!==Aa&&typeof u[0]!="number"&&(this.mixKeyframes=wa(UI,X1(u[0],u[1])),u=[0,100]);const h=d({...e,keyframes:u});a==="mirror"&&(this.mirroredGenerator=d({...e,keyframes:[...u].reverse(),velocity:-l})),h.calculatedDuration===null&&(h.calculatedDuration=np(h));const{calculatedDuration:p}=h;this.calculatedDuration=p,this.resolvedDuration=p+s,this.totalDuration=this.resolvedDuration*(o+1)-s,this.generator=h}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:o,totalDuration:s,mixKeyframes:a,mirroredGenerator:l,resolvedDuration:u,calculatedDuration:d}=this;if(this.startTime===null)return o.next(0);const{delay:h=0,keyframes:p,repeat:m,repeatType:y,repeatDelay:b,type:x,onUpdate:w,finalKeyframe:_}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const S=this.currentTime-h*(this.playbackSpeed>=0?1:-1),k=this.playbackSpeed>=0?S<0:S>s;this.currentTime=Math.max(S,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let C=this.currentTime,E=o;if(m){const D=Math.min(this.currentTime,s)/u;let U=Math.floor(D),q=D%1;!q&&D>=1&&(q=1),q===1&&U--,U=Math.min(U,m+1),U%2&&(y==="reverse"?(q=1-q,b&&(q-=b/u)):y==="mirror"&&(E=l)),C=ni(0,1,q)*u}const R=k?{done:!1,value:p[0]}:E.next(C);a&&(R.value=a(R.value));let{done:A}=R;!k&&d!==null&&(A=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return O&&x!==rp&&(R.value=sp(p,this.options,_,this.speed)),w&&w(R.value),O&&this.finish(),R}then(e,n){return this.finished.then(e,n)}get duration(){return bn(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+bn(e)}get time(){return bn(this.currentTime)}set time(e){e=Ln(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(qe.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=bn(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=CI,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),this.options.onPlay?.();const o=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=o):this.holdTime!==null?this.startTime=o-this.holdTime:this.startTime||(this.startTime=n??o),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(qe.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function $I(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const Ko=t=>t*180/Math.PI,cp=t=>{const e=Ko(Math.atan2(t[1],t[0]));return up(e)},YI={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:cp,rotateZ:cp,skewX:t=>Ko(Math.atan(t[1])),skewY:t=>Ko(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},up=t=>(t=t%360,t<0&&(t+=360),t),J1=cp,t_=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),e_=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),qI={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:t_,scaleY:e_,scale:t=>(t_(t)+e_(t))/2,rotateX:t=>up(Ko(Math.atan2(t[6],t[5]))),rotateY:t=>up(Ko(Math.atan2(-t[2],t[0]))),rotateZ:J1,rotate:J1,skewX:t=>Ko(Math.atan(t[4])),skewY:t=>Ko(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function fp(t){return t.includes("scale")?1:0}function dp(t,e){if(!t||t==="none")return fp(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let o,s;if(n)o=qI,s=n;else{const u=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);o=YI,s=u}if(!s)return fp(e);const a=o[e],l=s[1].split(",").map(FI);return typeof a=="function"?a(l):l[a]}const GI=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return dp(n,e)};function FI(t){return parseFloat(t.trim())}const qr=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Gr=new Set(qr),n_=t=>t===$r||t===_t,XI=new Set(["x","y","z"]),ZI=qr.filter(t=>!XI.has(t));function KI(t){const e=[];return ZI.forEach(n=>{const o=t.getValue(n);o!==void 0&&(e.push([n,o.get()]),o.set(n.startsWith("scale")?1:0))}),e}const Ji={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>dp(e,"x"),y:(t,{transform:e})=>dp(e,"y")};Ji.translateX=Ji.x,Ji.translateY=Ji.y;const Qo=new Set;let hp=!1,pp=!1,mp=!1;function i_(){if(pp){const t=Array.from(Qo).filter(o=>o.needsMeasurement),e=new Set(t.map(o=>o.element)),n=new Map;e.forEach(o=>{const s=KI(o);s.length&&(n.set(o,s),o.render())}),t.forEach(o=>o.measureInitialState()),e.forEach(o=>{o.render();const s=n.get(o);s&&s.forEach(([a,l])=>{o.getValue(a)?.set(l)})}),t.forEach(o=>o.measureEndState()),t.forEach(o=>{o.suspendedScrollY!==void 0&&window.scrollTo(0,o.suspendedScrollY)})}pp=!1,hp=!1,Qo.forEach(t=>t.complete(mp)),Qo.clear()}function o_(){Qo.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(pp=!0)})}function QI(){mp=!0,o_(),i_(),mp=!1}class gp{constructor(e,n,o,s,a,l=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=o,this.motionValue=s,this.element=a,this.isAsync=l}scheduleResolve(){this.state="scheduled",this.isAsync?(Qo.add(this),hp||(hp=!0,re.read(o_),re.resolveKeyframes(i_))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:o,motionValue:s}=this;if(e[0]===null){const a=s?.get(),l=e[e.length-1];if(a!==void 0)e[0]=a;else if(o&&n){const u=o.readValue(n,l);u!=null&&(e[0]=u)}e[0]===void 0&&(e[0]=l),s&&a===void 0&&s.set(e[0])}$I(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Qo.delete(this)}cancel(){this.state==="scheduled"&&(Qo.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const WI=t=>t.startsWith("--");function JI(t,e,n){WI(e)?t.style.setProperty(e,n):t.style[e]=n}const tP={};function r_(t,e){const n=w1(t);return()=>tP[e]??n()}const eP=r_(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),s_=r_(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ma=([t,e,n,o])=>`cubic-bezier(${t}, ${e}, ${n}, ${o})`,a_={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ma([0,.65,.55,1]),circOut:Ma([.55,0,1,.45]),backIn:Ma([.31,.01,.66,-.59]),backOut:Ma([.33,1.53,.69,.99])};function l_(t,e){if(t)return typeof t=="function"?s_()?Z1(t,e):"ease-out":O1(t)?Ma(t):Array.isArray(t)?t.map(n=>l_(n,e)||a_.easeOut):a_[t]}function nP(t,e,n,{delay:o=0,duration:s=300,repeat:a=0,repeatType:l="loop",ease:u="easeOut",times:d}={},h=void 0){const p={[e]:n};d&&(p.offset=d);const m=l_(u,s);Array.isArray(m)&&(p.easing=m);const y={delay:o,duration:s,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:a+1,direction:l==="reverse"?"alternate":"normal"};return h&&(y.pseudoElement=h),t.animate(p,y)}function c_(t){return typeof t=="function"&&"applyToOptions"in t}function iP({type:t,...e}){return c_(t)&&s_()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class u_ extends ap{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:o,keyframes:s,pseudoElement:a,allowFlatten:l=!1,finalKeyframe:u,onComplete:d}=e;this.isPseudoElement=!!a,this.allowFlatten=l,this.options=e,Uh(typeof e.type!="string");const h=iP(e);this.animation=nP(n,o,s,h,a),h.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const p=sp(s,this.options,u,this.speed);this.updateMotionValue?this.updateMotionValue(p):JI(n,o,p),this.animation.cancel()}d?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return bn(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+bn(e)}get time(){return bn(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Ln(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&eP()?(this.animation.timeline=e,vn):n(this)}}const f_={anticipate:A1,backInOut:N1,circInOut:R1};function oP(t){return t in f_}function rP(t){typeof t.ease=="string"&&oP(t.ease)&&(t.ease=f_[t.ease])}const yp=10;class sP extends u_{constructor(e){rP(e),W1(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:o,onComplete:s,element:a,...l}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const u=new lp({...l,autoplay:!1}),d=Math.max(yp,qe.now()-this.startTime),h=ni(0,yp,d-yp);n.setWithVelocity(u.sample(Math.max(0,d-h)).value,u.sample(d).value,h),u.stop()}}const d_=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(In.test(t)||t==="0")&&!t.startsWith("url("));function aP(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function lP(t,e,n,o){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const a=t[t.length-1],l=d_(s,e),u=d_(a,e);return!l||!u?!1:aP(t)||(n==="spring"||c_(n))&&o}function vp(t){t.duration=0,t.type="keyframes"}const cP=new Set(["opacity","clipPath","filter","transform"]),uP=w1(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function fP(t){const{motionValue:e,name:n,repeatDelay:o,repeatType:s,damping:a,type:l}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:d,transformTemplate:h}=e.owner.getProps();return uP()&&n&&cP.has(n)&&(n!=="transform"||!h)&&!d&&!o&&s!=="mirror"&&a!==0&&l!=="inertia"}const dP=40;class hP extends ap{constructor({autoplay:e=!0,delay:n=0,type:o="keyframes",repeat:s=0,repeatDelay:a=0,repeatType:l="loop",keyframes:u,name:d,motionValue:h,element:p,...m}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=qe.now();const y={autoplay:e,delay:n,type:o,repeat:s,repeatDelay:a,repeatType:l,name:d,motionValue:h,element:p,...m},b=p?.KeyframeResolver||gp;this.keyframeResolver=new b(u,(x,w,_)=>this.onKeyframesResolved(x,w,y,!_),d,h,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,o,s){this.keyframeResolver=void 0;const{name:a,type:l,velocity:u,delay:d,isHandoff:h,onUpdate:p}=o;this.resolvedAt=qe.now(),lP(e,a,l,u)||((bi.instantAnimations||!d)&&p?.(sp(e,o,n)),e[0]=e[e.length-1],vp(o),o.repeat=0);const y={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>dP?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...o,keyframes:e},b=!h&&fP(y),x=y.motionValue?.owner?.current,w=b?new sP({...y,element:x}):new lp(y);w.finished.then(()=>{this.notifyFinished()}).catch(vn),this.pendingTimeline&&(this.stopTimeline=w.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=w}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),QI()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function h_(t,e,n,o=0,s=1){const a=Array.from(t).sort((h,p)=>h.sortNodePosition(p)).indexOf(e),l=t.size,u=(l-1)*o;return typeof n=="function"?n(a,l):s===1?a*o:u-a*o}const pP=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function mP(t){const e=pP.exec(t);if(!e)return[,];const[,n,o,s]=e;return[`--${n??o}`,s]}function p_(t,e,n=1){const[o,s]=mP(t);if(!o)return;const a=window.getComputedStyle(e).getPropertyValue(o);if(a){const l=a.trim();return v1(l)?parseFloat(l):l}return Fh(s)?p_(s,e,n+1):s}const gP={type:"spring",stiffness:500,damping:25,restSpeed:10},yP=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),vP={type:"keyframes",duration:.8},bP={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},xP=(t,{keyframes:e})=>e.length>2?vP:Gr.has(t)?t.startsWith("scale")?yP(e[1]):gP:bP,wP=t=>t!==null;function _P(t,{repeat:e,repeatType:n="loop"},o){const s=t.filter(wP),a=e&&n!=="loop"&&e%2===1?0:s.length-1;return s[a]}function m_(t,e){if(t?.inherit&&e){const{inherit:n,...o}=t;return{...e,...o}}return t}function bp(t,e){const n=t?.[e]??t?.default??t;return n!==t?m_(n,t):n}function SP({when:t,delay:e,delayChildren:n,staggerChildren:o,staggerDirection:s,repeat:a,repeatType:l,repeatDelay:u,from:d,elapsed:h,...p}){return!!Object.keys(p).length}const xp=(t,e,n,o={},s,a)=>l=>{const u=bp(o,t)||{},d=u.delay||o.delay||0;let{elapsed:h=0}=o;h=h-Ln(d);const p={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...u,delay:-h,onUpdate:y=>{e.set(y),u.onUpdate&&u.onUpdate(y)},onComplete:()=>{l(),u.onComplete&&u.onComplete()},name:t,motionValue:e,element:a?void 0:s};SP(u)||Object.assign(p,xP(t,p)),p.duration&&(p.duration=Ln(p.duration)),p.repeatDelay&&(p.repeatDelay=Ln(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let m=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(vp(p),p.delay===0&&(m=!0)),(bi.instantAnimations||bi.skipAnimations||s?.shouldSkipAnimations)&&(m=!0,vp(p),p.delay=0),p.allowFlatten=!u.type&&!u.ease,m&&!a&&e.get()!==void 0){const y=_P(p.keyframes,u);if(y!==void 0){re.update(()=>{p.onUpdate(y),p.onComplete()});return}}return u.isSync?new lp(p):new hP(p)};function g_(t){const e=[{},{}];return t?.values.forEach((n,o)=>{e[0][o]=n.get(),e[1][o]=n.getVelocity()}),e}function wp(t,e,n,o){if(typeof e=="function"){const[s,a]=g_(o);e=e(n!==void 0?n:t.custom,s,a)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,a]=g_(o);e=e(n!==void 0?n:t.custom,s,a)}return e}function Fr(t,e,n){const o=t.getProps();return wp(o,e,n!==void 0?n:o.custom,t)}const y_=new Set(["width","height","top","left","right","bottom",...qr]),v_=30,EP=t=>!isNaN(parseFloat(t));class CP{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=o=>{const s=qe.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(o),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=qe.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=EP(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new $h);const o=this.events[e].add(n);return e==="change"?()=>{o(),re.read(()=>{this.events.change.getSize()||this.stop()})}:o}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,o){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-o}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=qe.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>v_)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,v_);return _1(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function Xr(t,e){return new CP(t,e)}const _p=t=>Array.isArray(t);function TP(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Xr(n))}function NP(t){return _p(t)?t[t.length-1]||0:t}function AP(t,e){const n=Fr(t,e);let{transitionEnd:o={},transition:s={},...a}=n||{};a={...a,...o};for(const l in a){const u=NP(a[l]);TP(t,l,u)}}const $e=t=>!!(t&&t.getVelocity);function MP(t){return!!($e(t)&&t.add)}function Sp(t,e){const n=t.getValue("willChange");if(MP(n))return n.add(e);if(!n&&bi.WillChange){const o=new bi.WillChange("auto");t.addValue("willChange",o),o.add(e)}}function Ep(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const b_="data-"+Ep("framerAppearId");function x_(t){return t.props[b_]}function RP({protectedKeys:t,needsAnimating:e},n){const o=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,o}function w_(t,e,{delay:n=0,transitionOverride:o,type:s}={}){let{transition:a,transitionEnd:l,...u}=e;const d=t.getDefaultTransition();a=a?m_(a,d):d;const h=a?.reduceMotion;o&&(a=o);const p=[],m=s&&t.animationState&&t.animationState.getState()[s];for(const y in u){const b=t.getValue(y,t.latestValues[y]??null),x=u[y];if(x===void 0||m&&RP(m,y))continue;const w={delay:n,...bp(a||{},y)},_=b.get();if(_!==void 0&&!b.isAnimating&&!Array.isArray(x)&&x===_&&!w.velocity)continue;let S=!1;if(window.MotionHandoffAnimation){const E=x_(t);if(E){const R=window.MotionHandoffAnimation(E,y,re);R!==null&&(w.startTime=R,S=!0)}}Sp(t,y);const k=h??t.shouldReduceMotion;b.start(xp(y,b,x,k&&y_.has(y)?{type:!1}:w,t,S));const C=b.animation;C&&p.push(C)}if(l){const y=()=>re.update(()=>{l&&AP(t,l)});p.length?Promise.all(p).then(y):y()}return p}function Cp(t,e,n={}){const o=Fr(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=o||{};n.transitionOverride&&(s=n.transitionOverride);const a=o?()=>Promise.all(w_(t,o,n)):()=>Promise.resolve(),l=t.variantChildren&&t.variantChildren.size?(d=0)=>{const{delayChildren:h=0,staggerChildren:p,staggerDirection:m}=s;return kP(t,e,d,h,p,m,n)}:()=>Promise.resolve(),{when:u}=s;if(u){const[d,h]=u==="beforeChildren"?[a,l]:[l,a];return d().then(()=>h())}else return Promise.all([a(),l(n.delay)])}function kP(t,e,n=0,o=0,s=0,a=1,l){const u=[];for(const d of t.variantChildren)d.notify("AnimationStart",e),u.push(Cp(d,e,{...l,delay:n+(typeof o=="function"?0:o)+h_(t.variantChildren,d,o,s,a)}).then(()=>d.notify("AnimationComplete",e)));return Promise.all(u)}function OP(t,e,n={}){t.notify("AnimationStart",e);let o;if(Array.isArray(e)){const s=e.map(a=>Cp(t,a,n));o=Promise.all(s)}else if(typeof e=="string")o=Cp(t,e,n);else{const s=typeof e=="function"?Fr(t,e,n.custom):e;o=Promise.all(w_(t,s,n))}return o.then(()=>{t.notify("AnimationComplete",e)})}const DP={test:t=>t==="auto",parse:t=>t},__=t=>e=>e.test(t),S_=[$r,_t,ii,Wi,cI,lI,DP],E_=t=>S_.find(__(t));function jP(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||x1(t):!0}const zP=new Set(["brightness","contrast","saturate","opacity"]);function VP(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[o]=n.match(Xh)||[];if(!o)return t;const s=n.replace(o,"");let a=zP.has(e)?1:0;return o!==n&&(a*=100),e+"("+a+s+")"}const LP=/\b([a-z-]*)\(.*?\)/gu,Tp={...In,getAnimatableNone:t=>{const e=t.match(LP);return e?e.map(VP).join(" "):t}},Np={...In,getAnimatableNone:t=>{const e=In.parse(t);return In.createTransformer(t)(e.map(o=>typeof o=="number"?0:typeof o=="object"?{...o,alpha:1}:o))}},C_={...$r,transform:Math.round},Ap={borderWidth:_t,borderTopWidth:_t,borderRightWidth:_t,borderBottomWidth:_t,borderLeftWidth:_t,borderRadius:_t,borderTopLeftRadius:_t,borderTopRightRadius:_t,borderBottomRightRadius:_t,borderBottomLeftRadius:_t,width:_t,maxWidth:_t,height:_t,maxHeight:_t,top:_t,right:_t,bottom:_t,left:_t,inset:_t,insetBlock:_t,insetBlockStart:_t,insetBlockEnd:_t,insetInline:_t,insetInlineStart:_t,insetInlineEnd:_t,padding:_t,paddingTop:_t,paddingRight:_t,paddingBottom:_t,paddingLeft:_t,paddingBlock:_t,paddingBlockStart:_t,paddingBlockEnd:_t,paddingInline:_t,paddingInlineStart:_t,paddingInlineEnd:_t,margin:_t,marginTop:_t,marginRight:_t,marginBottom:_t,marginLeft:_t,marginBlock:_t,marginBlockStart:_t,marginBlockEnd:_t,marginInline:_t,marginInlineStart:_t,marginInlineEnd:_t,fontSize:_t,backgroundPositionX:_t,backgroundPositionY:_t,...{rotate:Wi,rotateX:Wi,rotateY:Wi,rotateZ:Wi,scale:Xc,scaleX:Xc,scaleY:Xc,scaleZ:Xc,skew:Wi,skewX:Wi,skewY:Wi,distance:_t,translateX:_t,translateY:_t,translateZ:_t,x:_t,y:_t,z:_t,perspective:_t,transformPerspective:_t,opacity:Ea,originX:P1,originY:P1,originZ:_t},zIndex:C_,fillOpacity:Ea,strokeOpacity:Ea,numOctaves:C_},IP={...Ap,color:_e,backgroundColor:_e,outlineColor:_e,fill:_e,stroke:_e,borderColor:_e,borderTopColor:_e,borderRightColor:_e,borderBottomColor:_e,borderLeftColor:_e,filter:Tp,WebkitFilter:Tp,mask:Np,WebkitMask:Np},T_=t=>IP[t],PP=new Set([Tp,Np]);function N_(t,e){let n=T_(t);return PP.has(n)||(n=In),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const BP=new Set(["auto","none","0"]);function HP(t,e,n){let o=0,s;for(;o<t.length&&!s;){const a=t[o];typeof a=="string"&&!BP.has(a)&&Na(a).values.length&&(s=t[o]),o++}if(s&&n)for(const a of e)t[a]=N_(n,s)}class UP extends gp{constructor(e,n,o,s,a){super(e,n,o,s,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:o}=this;if(!n||!n.current)return;super.readKeyframes();for(let p=0;p<e.length;p++){let m=e[p];if(typeof m=="string"&&(m=m.trim(),Fh(m))){const y=p_(m,n.current);y!==void 0&&(e[p]=y),p===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!y_.has(o)||e.length!==2)return;const[s,a]=e,l=E_(s),u=E_(a),d=L1(s),h=L1(a);if(d!==h&&Ji[o]){this.needsMeasurement=!0;return}if(l!==u)if(n_(l)&&n_(u))for(let p=0;p<e.length;p++){const m=e[p];typeof m=="string"&&(e[p]=parseFloat(m))}else Ji[o]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,o=[];for(let s=0;s<e.length;s++)(e[s]===null||jP(e[s]))&&o.push(s);o.length&&HP(e,o,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:o}=this;if(!e||!e.current)return;o==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ji[o](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(o,s).jump(s,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:o}=this;if(!e||!e.current)return;const s=e.getValue(n);s&&s.jump(this.measuredOrigin,!1);const a=o.length-1,l=o[a];o[a]=Ji[n](e.measureViewportBox(),window.getComputedStyle(e.current)),l!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=l),this.removedTransforms?.length&&this.removedTransforms.forEach(([u,d])=>{e.getValue(u).set(d)}),this.resolveNoneKeyframes()}}const $P=new Set(["opacity","clipPath","filter","transform"]);function A_(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let o=document;const s=n?.[t]??o.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t).filter(o=>o!=null)}const M_=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Mp(t){return b1(t)&&"offsetHeight"in t}const{schedule:Rp}=j1(queueMicrotask,!1),Pn={x:!1,y:!1};function R_(){return Pn.x||Pn.y}function YP(t){return t==="x"||t==="y"?Pn[t]?null:(Pn[t]=!0,()=>{Pn[t]=!1}):Pn.x||Pn.y?null:(Pn.x=Pn.y=!0,()=>{Pn.x=Pn.y=!1})}function k_(t,e){const n=A_(t),o=new AbortController,s={passive:!0,...e,signal:o.signal};return[n,s,()=>o.abort()]}function qP(t){return!(t.pointerType==="touch"||R_())}function GP(t,e,n={}){const[o,s,a]=k_(t,n);return o.forEach(l=>{let u=!1,d=!1,h;const p=()=>{l.removeEventListener("pointerleave",x)},m=_=>{h&&(h(_),h=void 0),p()},y=_=>{u=!1,window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y),d&&(d=!1,m(_))},b=()=>{u=!0,window.addEventListener("pointerup",y,s),window.addEventListener("pointercancel",y,s)},x=_=>{if(_.pointerType!=="touch"){if(u){d=!0;return}m(_)}},w=_=>{if(!qP(_))return;d=!1;const S=e(l,_);typeof S=="function"&&(h=S,l.addEventListener("pointerleave",x,s))};l.addEventListener("pointerenter",w,s),l.addEventListener("pointerdown",b,s)}),a}const O_=(t,e)=>e?t===e?!0:O_(t,e.parentElement):!1,kp=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,FP=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function XP(t){return FP.has(t.tagName)||t.isContentEditable===!0}const ZP=new Set(["INPUT","SELECT","TEXTAREA"]);function KP(t){return ZP.has(t.tagName)||t.isContentEditable===!0}const Wc=new WeakSet;function D_(t){return e=>{e.key==="Enter"&&t(e)}}function Op(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const QP=(t,e)=>{const n=t.currentTarget;if(!n)return;const o=D_(()=>{if(Wc.has(n))return;Op(n,"down");const s=D_(()=>{Op(n,"up")}),a=()=>Op(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",a,e)});n.addEventListener("keydown",o,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",o),e)};function j_(t){return kp(t)&&!R_()}const z_=new WeakSet;function WP(t,e,n={}){const[o,s,a]=k_(t,n),l=u=>{const d=u.currentTarget;if(!j_(u)||z_.has(u))return;Wc.add(d),n.stopPropagation&&z_.add(u);const h=e(d,u),p=(b,x)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",y),Wc.has(d)&&Wc.delete(d),j_(b)&&typeof h=="function"&&h(b,{success:x})},m=b=>{p(b,d===window||d===document||n.useGlobalTarget||O_(d,b.target))},y=b=>{p(b,!1)};window.addEventListener("pointerup",m,s),window.addEventListener("pointercancel",y,s)};return o.forEach(u=>{(n.useGlobalTarget?window:u).addEventListener("pointerdown",l,s),Mp(u)&&(u.addEventListener("focus",h=>QP(h,s)),!XP(u)&&!u.hasAttribute("tabindex")&&(u.tabIndex=0))}),a}function Dp(t){return b1(t)&&"ownerSVGElement"in t}const Jc=new WeakMap;let tu;const V_=(t,e,n)=>(o,s)=>s&&s[0]?s[0][t+"Size"]:Dp(o)&&"getBBox"in o?o.getBBox()[e]:o[n],JP=V_("inline","width","offsetWidth"),tB=V_("block","height","offsetHeight");function eB({target:t,borderBoxSize:e}){Jc.get(t)?.forEach(n=>{n(t,{get width(){return JP(t,e)},get height(){return tB(t,e)}})})}function nB(t){t.forEach(eB)}function iB(){typeof ResizeObserver>"u"||(tu=new ResizeObserver(nB))}function oB(t,e){tu||iB();const n=A_(t);return n.forEach(o=>{let s=Jc.get(o);s||(s=new Set,Jc.set(o,s)),s.add(e),tu?.observe(o)}),()=>{n.forEach(o=>{const s=Jc.get(o);s?.delete(e),s?.size||tu?.unobserve(o)})}}const eu=new Set;let Zr;function rB(){Zr=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};eu.forEach(e=>e(t))},window.addEventListener("resize",Zr)}function sB(t){return eu.add(t),Zr||rB(),()=>{eu.delete(t),!eu.size&&typeof Zr=="function"&&(window.removeEventListener("resize",Zr),Zr=void 0)}}function L_(t,e){return typeof t=="function"?sB(t):oB(t,e)}function aB(t){return Dp(t)&&t.tagName==="svg"}const lB=[...S_,_e,In],cB=t=>lB.find(__(t)),I_=()=>({translate:0,scale:1,origin:0,originPoint:0}),Kr=()=>({x:I_(),y:I_()}),P_=()=>({min:0,max:0}),Me=()=>({x:P_(),y:P_()}),uB=new WeakMap;function nu(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Ra(t){return typeof t=="string"||Array.isArray(t)}const jp=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],zp=["initial",...jp];function iu(t){return nu(t.animate)||zp.some(e=>Ra(t[e]))}function B_(t){return!!(iu(t)||t.variants)}function fB(t,e,n){for(const o in e){const s=e[o],a=n[o];if($e(s))t.addValue(o,s);else if($e(a))t.addValue(o,Xr(s,{owner:t}));else if(a!==s)if(t.hasValue(o)){const l=t.getValue(o);l.liveStyle===!0?l.jump(s):l.hasAnimated||l.set(s)}else{const l=t.getStaticValue(o);t.addValue(o,Xr(l!==void 0?l:s,{owner:t}))}}for(const o in n)e[o]===void 0&&t.removeValue(o);return e}const Vp={current:null},H_={current:!1},dB=typeof window<"u";function hB(){if(H_.current=!0,!!dB)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Vp.current=t.matches;t.addEventListener("change",e),e()}else Vp.current=!1}const U_=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let ou={};function $_(t){ou=t}function pB(){return ou}class mB{scrapeMotionValuesFromProps(e,n,o){return{}}constructor({parent:e,props:n,presenceContext:o,reducedMotionConfig:s,skipAnimations:a,blockInitialAnimation:l,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=gp,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const b=qe.now();this.renderScheduledAt<b&&(this.renderScheduledAt=b,re.render(this.render,!1,!0))};const{latestValues:h,renderState:p}=u;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=p,this.parent=e,this.props=n,this.presenceContext=o,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=a,this.options=d,this.blockInitialAnimation=!!l,this.isControllingVariants=iu(n),this.isVariantNode=B_(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:m,...y}=this.scrapeMotionValuesFromProps(n,{},this);for(const b in y){const x=y[b];h[b]!==void 0&&$e(x)&&x.set(h[b])}}mount(e){if(this.hasBeenMounted)for(const n in this.initialValues)this.values.get(n)?.jump(this.initialValues[n]),this.latestValues[n]=this.initialValues[n];this.current=e,uB.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,o)=>this.bindToMotionValue(o,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(H_.current||hB(),this.shouldReduceMotion=Vp.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),Qi(this.notifyUpdate),Qi(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&$P.has(e)&&this.current instanceof HTMLElement){const{factory:l,keyframes:u,times:d,ease:h,duration:p}=n.accelerate,m=new u_({element:this.current,name:e,keyframes:u,times:d,ease:h,duration:Ln(p)}),y=l(m);this.valueSubscriptions.set(e,()=>{y(),m.cancel()});return}const o=Gr.has(e);o&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",l=>{this.latestValues[e]=l,this.props.onUpdate&&re.preRender(this.notifyUpdate),o&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;typeof window<"u"&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),a&&a(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in ou){const n=ou[e];if(!n)continue;const{isEnabled:o,Feature:s}=n;if(!this.features[e]&&s&&o(this.props)&&(this.features[e]=new s(this)),this.features[e]){const a=this.features[e];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Me()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let o=0;o<U_.length;o++){const s=U_[o];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const a="on"+s,l=e[a];l&&(this.propEventSubscriptions[s]=this.on(s,l))}this.prevMotionValues=fB(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const o=this.values.get(e);n!==o&&(o&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let o=this.values.get(e);return o===void 0&&n!==void 0&&(o=Xr(n===null?void 0:n,{owner:this}),this.addValue(e,o)),o}readValue(e,n){let o=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return o!=null&&(typeof o=="string"&&(v1(o)||x1(o))?o=parseFloat(o):!cB(o)&&In.test(n)&&(o=N_(e,n)),this.setBaseTarget(e,$e(o)?o.get():o)),$e(o)?o.get():o}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let o;if(typeof n=="string"||typeof n=="object"){const a=wp(this.props,n,this.presenceContext?.custom);a&&(o=a[e])}if(n&&o!==void 0)return o;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!$e(s)?s:this.initialValues[e]!==void 0&&o===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new $h),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){Rp.render(this.render)}}class Y_ extends mB{constructor(){super(...arguments),this.KeyframeResolver=UP}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const o=e.style;return o?o[n]:void 0}removeValueFromRenderState(e,{vars:n,style:o}){delete n[e],delete o[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;$e(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class to{constructor(e){this.isMounted=!1,this.node=e}update(){}}function q_({top:t,left:e,right:n,bottom:o}){return{x:{min:e,max:n},y:{min:t,max:o}}}function gB({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function yB(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),o=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:o.y,right:o.x}}function Lp(t){return t===void 0||t===1}function Ip({scale:t,scaleX:e,scaleY:n}){return!Lp(t)||!Lp(e)||!Lp(n)}function Wo(t){return Ip(t)||G_(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function G_(t){return F_(t.x)||F_(t.y)}function F_(t){return t&&t!=="0%"}function ru(t,e,n){const o=t-n,s=e*o;return n+s}function X_(t,e,n,o,s){return s!==void 0&&(t=ru(t,s,o)),ru(t,n,o)+e}function Pp(t,e=0,n=1,o,s){t.min=X_(t.min,e,n,o,s),t.max=X_(t.max,e,n,o,s)}function Z_(t,{x:e,y:n}){Pp(t.x,e.translate,e.scale,e.originPoint),Pp(t.y,n.translate,n.scale,n.originPoint)}const K_=.999999999999,Q_=1.0000000000001;function vB(t,e,n,o=!1){const s=n.length;if(!s)return;e.x=e.y=1;let a,l;for(let u=0;u<s;u++){a=n[u],l=a.projectionDelta;const{visualElement:d}=a.options;d&&d.props.style&&d.props.style.display==="contents"||(o&&a.options.layoutScroll&&a.scroll&&a!==a.root&&Wr(t,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),l&&(e.x*=l.x.scale,e.y*=l.y.scale,Z_(t,l)),o&&Wo(a.latestValues)&&Wr(t,a.latestValues))}e.x<Q_&&e.x>K_&&(e.x=1),e.y<Q_&&e.y>K_&&(e.y=1)}function Qr(t,e){t.min=t.min+e,t.max=t.max+e}function W_(t,e,n,o,s=.5){const a=he(t.min,t.max,s);Pp(t,e,n,a,o)}function Wr(t,e){W_(t.x,e.x,e.scaleX,e.scale,e.originX),W_(t.y,e.y,e.scaleY,e.scale,e.originY)}function J_(t,e){return q_(yB(t.getBoundingClientRect(),e))}function bB(t,e,n){const o=J_(t,n),{scroll:s}=e;return s&&(Qr(o.x,s.offset.x),Qr(o.y,s.offset.y)),o}const xB={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},wB=qr.length;function _B(t,e,n){let o="",s=!0;for(let a=0;a<wB;a++){const l=qr[a],u=t[l];if(u===void 0)continue;let d=!0;if(typeof u=="number")d=u===(l.startsWith("scale")?1:0);else{const h=parseFloat(u);d=l.startsWith("scale")?h===1:h===0}if(!d||n){const h=M_(u,Ap[l]);if(!d){s=!1;const p=xB[l]||l;o+=`${p}(${h}) `}n&&(e[l]=h)}}return o=o.trim(),n?o=n(e,s?"":o):s&&(o="none"),o}function Bp(t,e,n){const{style:o,vars:s,transformOrigin:a}=t;let l=!1,u=!1;for(const d in e){const h=e[d];if(Gr.has(d)){l=!0;continue}else if(V1(d)){s[d]=h;continue}else{const p=M_(h,Ap[d]);d.startsWith("origin")?(u=!0,a[d]=p):o[d]=p}}if(e.transform||(l||n?o.transform=_B(e,t.transform,n):o.transform&&(o.transform="none")),u){const{originX:d="50%",originY:h="50%",originZ:p=0}=a;o.transformOrigin=`${d} ${h} ${p}`}}function tS(t,{style:e,vars:n},o,s){const a=t.style;let l;for(l in e)a[l]=e[l];s?.applyProjectionStyles(a,o);for(l in n)a.setProperty(l,n[l])}function eS(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ka={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(_t.test(t))t=parseFloat(t);else return t;const n=eS(t,e.target.x),o=eS(t,e.target.y);return`${n}% ${o}%`}},SB={correct:(t,{treeScale:e,projectionDelta:n})=>{const o=t,s=In.parse(t);if(s.length>5)return o;const a=In.createTransformer(t),l=typeof s[0]!="number"?1:0,u=n.x.scale*e.x,d=n.y.scale*e.y;s[0+l]/=u,s[1+l]/=d;const h=he(u,d,.5);return typeof s[2+l]=="number"&&(s[2+l]/=h),typeof s[3+l]=="number"&&(s[3+l]/=h),a(s)}},Hp={borderRadius:{...ka,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ka,borderTopRightRadius:ka,borderBottomLeftRadius:ka,borderBottomRightRadius:ka,boxShadow:SB};function nS(t,{layout:e,layoutId:n}){return Gr.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Hp[t]||t==="opacity")}function Up(t,e,n){const o=t.style,s=e?.style,a={};if(!o)return a;for(const l in o)($e(o[l])||s&&$e(s[l])||nS(l,t)||n?.getValue(l)?.liveStyle!==void 0)&&(a[l]=o[l]);return a}function EB(t){return window.getComputedStyle(t)}class CB extends Y_{constructor(){super(...arguments),this.type="html",this.renderInstance=tS}readValueFromInstance(e,n){if(Gr.has(n))return this.projection?.isProjecting?fp(n):GI(e,n);{const o=EB(e),s=(V1(n)?o.getPropertyValue(n):o[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return J_(e,n)}build(e,n,o){Bp(e,n,o.transformTemplate)}scrapeMotionValuesFromProps(e,n,o){return Up(e,n,o)}}const TB={offset:"stroke-dashoffset",array:"stroke-dasharray"},NB={offset:"strokeDashoffset",array:"strokeDasharray"};function AB(t,e,n=1,o=0,s=!0){t.pathLength=1;const a=s?TB:NB;t[a.offset]=`${-o}`,t[a.array]=`${e} ${n}`}const MB=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function iS(t,{attrX:e,attrY:n,attrScale:o,pathLength:s,pathSpacing:a=1,pathOffset:l=0,...u},d,h,p){if(Bp(t,u,h),d){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:m,style:y}=t;m.transform&&(y.transform=m.transform,delete m.transform),(y.transform||m.transformOrigin)&&(y.transformOrigin=m.transformOrigin??"50% 50%",delete m.transformOrigin),y.transform&&(y.transformBox=p?.transformBox??"fill-box",delete m.transformBox);for(const b of MB)m[b]!==void 0&&(y[b]=m[b],delete m[b]);e!==void 0&&(m.x=e),n!==void 0&&(m.y=n),o!==void 0&&(m.scale=o),s!==void 0&&AB(m,s,a,l,!1)}const oS=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),rS=t=>typeof t=="string"&&t.toLowerCase()==="svg";function RB(t,e,n,o){tS(t,e,void 0,o);for(const s in e.attrs)t.setAttribute(oS.has(s)?s:Ep(s),e.attrs[s])}function sS(t,e,n){const o=Up(t,e,n);for(const s in t)if($e(t[s])||$e(e[s])){const a=qr.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;o[a]=t[s]}return o}class kB extends Y_{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Me}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Gr.has(n)){const o=T_(n);return o&&o.default||0}return n=oS.has(n)?n:Ep(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,o){return sS(e,n,o)}build(e,n,o){iS(e,n,this.isSVGTag,o.transformTemplate,o.style)}renderInstance(e,n,o,s){RB(e,n,o,s)}mount(e){this.isSVGTag=rS(e.tagName),super.mount(e)}}const OB=zp.length;function aS(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?aS(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<OB;n++){const o=zp[n],s=t.props[o];(Ra(s)||s===!1)&&(e[o]=s)}return e}function lS(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let o=0;o<n;o++)if(e[o]!==t[o])return!1;return!0}const DB=[...jp].reverse(),jB=jp.length;function zB(t){return e=>Promise.all(e.map(({animation:n,options:o})=>OP(t,n,o)))}function VB(t){let e=zB(t),n=cS(),o=!0;const s=d=>(h,p)=>{const m=Fr(t,p,d==="exit"?t.presenceContext?.custom:void 0);if(m){const{transition:y,transitionEnd:b,...x}=m;h={...h,...x,...b}}return h};function a(d){e=d(t)}function l(d){const{props:h}=t,p=aS(t.parent)||{},m=[],y=new Set;let b={},x=1/0;for(let _=0;_<jB;_++){const S=DB[_],k=n[S],C=h[S]!==void 0?h[S]:p[S],E=Ra(C),R=S===d?k.isActive:null;R===!1&&(x=_);let A=C===p[S]&&C!==h[S]&&E;if(A&&o&&t.manuallyAnimateOnMount&&(A=!1),k.protectedKeys={...b},!k.isActive&&R===null||!C&&!k.prevProp||nu(C)||typeof C=="boolean")continue;if(S==="exit"&&k.isActive&&R!==!0){k.prevResolvedValues&&(b={...b,...k.prevResolvedValues});continue}const O=LB(k.prevProp,C);let D=O||S===d&&k.isActive&&!A&&E||_>x&&E,U=!1;const q=Array.isArray(C)?C:[C];let Y=q.reduce(s(S),{});R===!1&&(Y={});const{prevResolvedValues:K={}}=k,W={...K,...Y},B=I=>{D=!0,y.has(I)&&(U=!0,y.delete(I)),k.needsAnimating[I]=!0;const z=t.getValue(I);z&&(z.liveStyle=!1)};for(const I in W){const z=Y[I],$=K[I];if(b.hasOwnProperty(I))continue;let G=!1;_p(z)&&_p($)?G=!lS(z,$):G=z!==$,G?z!=null?B(I):y.add(I):z!==void 0&&y.has(I)?B(I):k.protectedKeys[I]=!0}k.prevProp=C,k.prevResolvedValues=Y,k.isActive&&(b={...b,...Y}),o&&t.blockInitialAnimation&&(D=!1);const H=A&&O;D&&(!H||U)&&m.push(...q.map(I=>{const z={type:S};if(typeof I=="string"&&o&&!H&&t.manuallyAnimateOnMount&&t.parent){const{parent:$}=t,G=Fr($,I);if($.enteringChildren&&G){const{delayChildren:L}=G.transition||{};z.delay=h_($.enteringChildren,t,L)}}return{animation:I,options:z}}))}if(y.size){const _={};if(typeof h.initial!="boolean"){const S=Fr(t,Array.isArray(h.initial)?h.initial[0]:h.initial);S&&S.transition&&(_.transition=S.transition)}y.forEach(S=>{const k=t.getBaseTarget(S),C=t.getValue(S);C&&(C.liveStyle=!0),_[S]=k??null}),m.push({animation:_})}let w=!!m.length;return o&&(h.initial===!1||h.initial===h.animate)&&!t.manuallyAnimateOnMount&&(w=!1),o=!1,w?e(m):Promise.resolve()}function u(d,h){if(n[d].isActive===h)return Promise.resolve();t.variantChildren?.forEach(m=>m.animationState?.setActive(d,h)),n[d].isActive=h;const p=l(d);for(const m in n)n[m].protectedKeys={};return p}return{animateChanges:l,setActive:u,setAnimateFunction:a,getState:()=>n,reset:()=>{n=cS()}}}function LB(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!lS(e,t):!1}function Jo(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function cS(){return{animate:Jo(!0),whileInView:Jo(),whileHover:Jo(),whileTap:Jo(),whileDrag:Jo(),whileFocus:Jo(),exit:Jo()}}function uS(t,e){t.min=e.min,t.max=e.max}function Bn(t,e){uS(t.x,e.x),uS(t.y,e.y)}function fS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const dS=1e-4,IB=1-dS,PB=1+dS,hS=.01,BB=0-hS,HB=0+hS;function Ge(t){return t.max-t.min}function UB(t,e,n){return Math.abs(t-e)<=n}function pS(t,e,n,o=.5){t.origin=o,t.originPoint=he(e.min,e.max,t.origin),t.scale=Ge(n)/Ge(e),t.translate=he(n.min,n.max,t.origin)-t.originPoint,(t.scale>=IB&&t.scale<=PB||isNaN(t.scale))&&(t.scale=1),(t.translate>=BB&&t.translate<=HB||isNaN(t.translate))&&(t.translate=0)}function Oa(t,e,n,o){pS(t.x,e.x,n.x,o?o.originX:void 0),pS(t.y,e.y,n.y,o?o.originY:void 0)}function mS(t,e,n){t.min=n.min+e.min,t.max=t.min+Ge(e)}function $B(t,e,n){mS(t.x,e.x,n.x),mS(t.y,e.y,n.y)}function gS(t,e,n){t.min=e.min-n.min,t.max=t.min+Ge(e)}function su(t,e,n){gS(t.x,e.x,n.x),gS(t.y,e.y,n.y)}function yS(t,e,n,o,s){return t-=e,t=ru(t,1/n,o),s!==void 0&&(t=ru(t,1/s,o)),t}function YB(t,e=0,n=1,o=.5,s,a=t,l=t){if(ii.test(e)&&(e=parseFloat(e),e=he(l.min,l.max,e/100)-l.min),typeof e!="number")return;let u=he(a.min,a.max,o);t===a&&(u-=e),t.min=yS(t.min,e,n,u,s),t.max=yS(t.max,e,n,u,s)}function vS(t,e,[n,o,s],a,l){YB(t,e[n],e[o],e[s],e.scale,a,l)}const qB=["x","scaleX","originX"],GB=["y","scaleY","originY"];function bS(t,e,n,o){vS(t.x,e,qB,n?n.x:void 0,o?o.x:void 0),vS(t.y,e,GB,n?n.y:void 0,o?o.y:void 0)}function xS(t){return t.translate===0&&t.scale===1}function wS(t){return xS(t.x)&&xS(t.y)}function _S(t,e){return t.min===e.min&&t.max===e.max}function FB(t,e){return _S(t.x,e.x)&&_S(t.y,e.y)}function SS(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function ES(t,e){return SS(t.x,e.x)&&SS(t.y,e.y)}function CS(t){return Ge(t.x)/Ge(t.y)}function TS(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function oi(t){return[t("x"),t("y")]}function XB(t,e,n){let o="";const s=t.x.translate/e.x,a=t.y.translate/e.y,l=n?.z||0;if((s||a||l)&&(o=`translate3d(${s}px, ${a}px, ${l}px) `),(e.x!==1||e.y!==1)&&(o+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:h,rotate:p,rotateX:m,rotateY:y,skewX:b,skewY:x}=n;h&&(o=`perspective(${h}px) ${o}`),p&&(o+=`rotate(${p}deg) `),m&&(o+=`rotateX(${m}deg) `),y&&(o+=`rotateY(${y}deg) `),b&&(o+=`skewX(${b}deg) `),x&&(o+=`skewY(${x}deg) `)}const u=t.x.scale*e.x,d=t.y.scale*e.y;return(u!==1||d!==1)&&(o+=`scale(${u}, ${d})`),o||"none"}const NS=["TopLeft","TopRight","BottomLeft","BottomRight"],ZB=NS.length,AS=t=>typeof t=="string"?parseFloat(t):t,MS=t=>typeof t=="number"||_t.test(t);function KB(t,e,n,o,s,a){s?(t.opacity=he(0,n.opacity??1,QB(o)),t.opacityExit=he(e.opacity??1,0,WB(o))):a&&(t.opacity=he(e.opacity??1,n.opacity??1,o));for(let l=0;l<ZB;l++){const u=`border${NS[l]}Radius`;let d=RS(e,u),h=RS(n,u);if(d===void 0&&h===void 0)continue;d||(d=0),h||(h=0),d===0||h===0||MS(d)===MS(h)?(t[u]=Math.max(he(AS(d),AS(h),o),0),(ii.test(h)||ii.test(d))&&(t[u]+="%")):t[u]=h}(e.rotate||n.rotate)&&(t.rotate=he(e.rotate||0,n.rotate||0,o))}function RS(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const QB=kS(0,.5,M1),WB=kS(.5,.95,vn);function kS(t,e,n){return o=>o<t?0:o>e?1:n(_a(t,e,o))}function JB(t,e,n){const o=$e(t)?t:Xr(t);return o.start(xp("",o,e,n)),o.animation}function Da(t,e,n,o={passive:!0}){return t.addEventListener(e,n,o),()=>t.removeEventListener(e,n)}const tH=(t,e)=>t.depth-e.depth;class eH{constructor(){this.children=[],this.isDirty=!1}add(e){Hh(this.children,e),this.isDirty=!0}remove(e){qc(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(tH),this.isDirty=!1,this.children.forEach(e)}}function nH(t,e){const n=qe.now(),o=({timestamp:s})=>{const a=s-n;a>=e&&(Qi(o),t(a-e))};return re.setup(o,!0),()=>Qi(o)}function au(t){return $e(t)?t.get():t}class iH{constructor(){this.members=[]}add(e){Hh(this.members,e);for(let n=this.members.length-1;n>=0;n--){const o=this.members[n];if(o===e||o===this.lead||o===this.prevLead)continue;const s=o.instance;s&&s.isConnected===!1&&o.isPresent!==!1&&!o.snapshot&&qc(this.members,o)}e.scheduleRender()}remove(e){if(qc(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let o;for(let s=n;s>=0;s--){const a=this.members[s],l=a.instance;if(a.isPresent!==!1&&(!l||l.isConnected!==!1)){o=a;break}}return o?(this.promote(o),!0):!1}promote(e,n){const o=this.lead;if(e!==o&&(this.prevLead=o,this.lead=e,e.show(),o)){o.instance&&o.scheduleRender(),e.scheduleRender();const s=o.options.layoutDependency,a=e.options.layoutDependency;if(!(s!==void 0&&a!==void 0&&s===a)){const d=o.instance;d&&d.isConnected===!1&&!o.snapshot||(e.resumeFrom=o,n&&(e.resumeFrom.preserveOpacity=!0),o.snapshot&&(e.snapshot=o.snapshot,e.snapshot.latestValues=o.animationValues||o.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0))}const{crossfade:u}=e.options;u===!1&&o.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:o}=e;n.onExitComplete&&n.onExitComplete(),o&&o.options.onExitComplete&&o.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const lu={hasAnimatedSinceResize:!0,hasEverUpdated:!1},$p=["","X","Y","Z"],oH=1e3;let rH=0;function Yp(t,e,n,o){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),o&&(o[t]=0))}function OS(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=x_(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:a}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",re,!(s||a))}const{parent:o}=t;o&&!o.hasCheckedOptimisedAppear&&OS(o)}function DS({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:o,resetTransform:s}){return class{constructor(l={},u=e?.()){this.id=rH++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(lH),this.nodes.forEach(dH),this.nodes.forEach(hH),this.nodes.forEach(cH)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=l,this.root=u?u.root||u:this,this.path=u?[...u.path,u]:[],this.parent=u,this.depth=u?u.depth+1:0;for(let d=0;d<this.path.length;d++)this.path[d].shouldResetTransform=!0;this.root===this&&(this.nodes=new eH)}addEventListener(l,u){return this.eventHandlers.has(l)||this.eventHandlers.set(l,new $h),this.eventHandlers.get(l).add(u)}notifyListeners(l,...u){const d=this.eventHandlers.get(l);d&&d.notify(...u)}hasListeners(l){return this.eventHandlers.has(l)}mount(l){if(this.instance)return;this.isSVG=Dp(l)&&!aB(l),this.instance=l;const{layoutId:u,layout:d,visualElement:h}=this.options;if(h&&!h.current&&h.mount(l),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(d||u)&&(this.isLayoutDirty=!0),t){let p,m=0;const y=()=>this.root.updateBlockedByResize=!1;re.read(()=>{m=window.innerWidth}),t(l,()=>{const b=window.innerWidth;b!==m&&(m=b,this.root.updateBlockedByResize=!0,p&&p(),p=nH(y,250),lu.hasAnimatedSinceResize&&(lu.hasAnimatedSinceResize=!1,this.nodes.forEach(VS)))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&h&&(u||d)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:m,hasRelativeLayoutChanged:y,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||h.getDefaultTransition()||vH,{onLayoutAnimationStart:w,onLayoutAnimationComplete:_}=h.getProps(),S=!this.targetLayout||!ES(this.targetLayout,b),k=!m&&y;if(this.options.layoutRoot||this.resumeFrom||k||m&&(S||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const C={...bp(x,"layout"),onPlay:w,onComplete:_};(h.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C),this.setAnimationOrigin(p,k)}else m||VS(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const l=this.getStack();l&&l.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Qi(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(pH),this.animationId++)}getTransformTemplate(){const{visualElement:l}=this.options;return l&&l.getProps().transformTemplate}willUpdate(l=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&OS(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const m=this.path[p];m.shouldResetTransform=!0,m.updateScroll("snapshot"),m.options.layoutRoot&&m.willUpdate(!1)}const{layoutId:u,layout:d}=this.options;if(u===void 0&&!d)return;const h=this.getTransformTemplate();this.prevTransformTemplateValue=h?h(this.latestValues,""):void 0,this.updateSnapshot(),l&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(jS);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(zS);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(fH),this.nodes.forEach(sH),this.nodes.forEach(aH)):this.nodes.forEach(zS),this.clearAllSnapshots();const u=qe.now();Le.delta=ni(0,16.666666666666668,u-Le.timestamp),Le.timestamp=u,Le.isProcessing=!0,Gh.update.process(Le),Gh.preRender.process(Le),Gh.render.process(Le),Le.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Rp.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(uH),this.sharedNodes.forEach(mH)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,re.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){re.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Ge(this.snapshot.measuredBox.x)&&!Ge(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let d=0;d<this.path.length;d++)this.path[d].updateScroll();const l=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=Me(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:u}=this.options;u&&u.notify("LayoutMeasure",this.layout.layoutBox,l?l.layoutBox:void 0)}updateScroll(l="measure"){let u=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===l&&(u=!1),u&&this.instance){const d=o(this.instance);this.scroll={animationId:this.root.animationId,phase:l,isRoot:d,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:d}}}resetTransform(){if(!s)return;const l=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,u=this.projectionDelta&&!wS(this.projectionDelta),d=this.getTransformTemplate(),h=d?d(this.latestValues,""):void 0,p=h!==this.prevTransformTemplateValue;l&&this.instance&&(u||Wo(this.latestValues)||p)&&(s(this.instance,h),this.shouldResetTransform=!1,this.scheduleRender())}measure(l=!0){const u=this.measurePageBox();let d=this.removeElementScroll(u);return l&&(d=this.removeTransform(d)),bH(d),{animationId:this.root.animationId,measuredBox:u,layoutBox:d,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:l}=this.options;if(!l)return Me();const u=l.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(xH))){const{scroll:h}=this.root;h&&(Qr(u.x,h.offset.x),Qr(u.y,h.offset.y))}return u}removeElementScroll(l){const u=Me();if(Bn(u,l),this.scroll?.wasRoot)return u;for(let d=0;d<this.path.length;d++){const h=this.path[d],{scroll:p,options:m}=h;h!==this.root&&p&&m.layoutScroll&&(p.wasRoot&&Bn(u,l),Qr(u.x,p.offset.x),Qr(u.y,p.offset.y))}return u}applyTransform(l,u=!1){const d=Me();Bn(d,l);for(let h=0;h<this.path.length;h++){const p=this.path[h];!u&&p.options.layoutScroll&&p.scroll&&p!==p.root&&Wr(d,{x:-p.scroll.offset.x,y:-p.scroll.offset.y}),Wo(p.latestValues)&&Wr(d,p.latestValues)}return Wo(this.latestValues)&&Wr(d,this.latestValues),d}removeTransform(l){const u=Me();Bn(u,l);for(let d=0;d<this.path.length;d++){const h=this.path[d];if(!h.instance||!Wo(h.latestValues))continue;Ip(h.latestValues)&&h.updateSnapshot();const p=Me(),m=h.measurePageBox();Bn(p,m),bS(u,h.latestValues,h.snapshot?h.snapshot.layoutBox:void 0,p)}return Wo(this.latestValues)&&bS(u,this.latestValues),u}setTargetDelta(l){this.targetDelta=l,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(l){this.options={...this.options,...l,crossfade:l.crossfade!==void 0?l.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Le.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(l=!1){const u=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=u.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=u.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=u.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==u;if(!(l||d&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:m}=this.options;if(!this.layout||!(p||m))return;this.resolvedRelativeTargetAt=Le.timestamp;const y=this.getClosestProjectingParent();y&&this.linkedParentVersion!==y.layoutVersion&&!y.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(y&&y.layout?this.createRelativeTarget(y,this.layout.layoutBox,y.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=Me(),this.targetWithTransforms=Me()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),$B(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Bn(this.target,this.layout.layoutBox),Z_(this.target,this.targetDelta)):Bn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,y&&!!y.resumingFrom==!!this.resumingFrom&&!y.options.layoutScroll&&y.target&&this.animationProgress!==1?this.createRelativeTarget(y,this.target,y.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Ip(this.parent.latestValues)||G_(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(l,u,d){this.relativeParent=l,this.linkedParentVersion=l.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=Me(),this.relativeTargetOrigin=Me(),su(this.relativeTargetOrigin,u,d),Bn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const l=this.getLead(),u=!!this.resumingFrom||this!==l;let d=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(d=!1),u&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===Le.timestamp&&(d=!1),d)return;const{layout:h,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(h||p))return;Bn(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,y=this.treeScale.y;vB(this.layoutCorrected,this.treeScale,this.path,u),l.layout&&!l.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(l.target=l.layout.layoutBox,l.targetWithTransforms=Me());const{target:b}=l;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(fS(this.prevProjectionDelta.x,this.projectionDelta.x),fS(this.prevProjectionDelta.y,this.projectionDelta.y)),Oa(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==y||!TS(this.projectionDelta.x,this.prevProjectionDelta.x)||!TS(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(l=!0){if(this.options.visualElement?.scheduleRender(),l){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=Kr(),this.projectionDelta=Kr(),this.projectionDeltaWithTransform=Kr()}setAnimationOrigin(l,u=!1){const d=this.snapshot,h=d?d.latestValues:{},p={...this.latestValues},m=Kr();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!u;const y=Me(),b=d?d.source:void 0,x=this.layout?this.layout.source:void 0,w=b!==x,_=this.getStack(),S=!_||_.members.length<=1,k=!!(w&&!S&&this.options.crossfade===!0&&!this.path.some(yH));this.animationProgress=0;let C;this.mixTargetDelta=E=>{const R=E/1e3;LS(m.x,l.x,R),LS(m.y,l.y,R),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(su(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),gH(this.relativeTarget,this.relativeTargetOrigin,y,R),C&&FB(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=Me()),Bn(C,this.relativeTarget)),w&&(this.animationValues=p,KB(p,h,this.latestValues,R,k,S)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(l){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(Qi(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=re.update(()=>{lu.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Xr(0)),this.motionValue.jump(0,!1),this.currentAnimation=JB(this.motionValue,[0,1e3],{...l,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),l.onUpdate&&l.onUpdate(u)},onStop:()=>{},onComplete:()=>{l.onComplete&&l.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const l=this.getStack();l&&l.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(oH),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const l=this.getLead();let{targetWithTransforms:u,target:d,layout:h,latestValues:p}=l;if(!(!u||!d||!h)){if(this!==l&&this.layout&&h&&US(this.options.animationType,this.layout.layoutBox,h.layoutBox)){d=this.target||Me();const m=Ge(this.layout.layoutBox.x);d.x.min=l.target.x.min,d.x.max=d.x.min+m;const y=Ge(this.layout.layoutBox.y);d.y.min=l.target.y.min,d.y.max=d.y.min+y}Bn(u,d),Wr(u,p),Oa(this.projectionDeltaWithTransform,this.layoutCorrected,u,p)}}registerSharedNode(l,u){this.sharedNodes.has(l)||this.sharedNodes.set(l,new iH),this.sharedNodes.get(l).add(u);const h=u.options.initialPromotionConfig;u.promote({transition:h?h.transition:void 0,preserveFollowOpacity:h&&h.shouldPreserveFollowOpacity?h.shouldPreserveFollowOpacity(u):void 0})}isLead(){const l=this.getStack();return l?l.lead===this:!0}getLead(){const{layoutId:l}=this.options;return l?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:l}=this.options;return l?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:l}=this.options;if(l)return this.root.sharedNodes.get(l)}promote({needsReset:l,transition:u,preserveFollowOpacity:d}={}){const h=this.getStack();h&&h.promote(this,d),l&&(this.projectionDelta=void 0,this.needsReset=!0),u&&this.setOptions({transition:u})}relegate(){const l=this.getStack();return l?l.relegate(this):!1}resetSkewAndRotation(){const{visualElement:l}=this.options;if(!l)return;let u=!1;const{latestValues:d}=l;if((d.z||d.rotate||d.rotateX||d.rotateY||d.rotateZ||d.skewX||d.skewY)&&(u=!0),!u)return;const h={};d.z&&Yp("z",l,h,this.animationValues);for(let p=0;p<$p.length;p++)Yp(`rotate${$p[p]}`,l,h,this.animationValues),Yp(`skew${$p[p]}`,l,h,this.animationValues);l.render();for(const p in h)l.setStaticValue(p,h[p]),this.animationValues&&(this.animationValues[p]=h[p]);l.scheduleRender()}applyProjectionStyles(l,u){if(!this.instance||this.isSVG)return;if(!this.isVisible){l.visibility="hidden";return}const d=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,l.visibility="",l.opacity="",l.pointerEvents=au(u?.pointerEvents)||"",l.transform=d?d(this.latestValues,""):"none";return}const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){this.options.layoutId&&(l.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,l.pointerEvents=au(u?.pointerEvents)||""),this.hasProjected&&!Wo(this.latestValues)&&(l.transform=d?d({},""):"none",this.hasProjected=!1);return}l.visibility="";const p=h.animationValues||h.latestValues;this.applyTransformsToTarget();let m=XB(this.projectionDeltaWithTransform,this.treeScale,p);d&&(m=d(p,m)),l.transform=m;const{x:y,y:b}=this.projectionDelta;l.transformOrigin=`${y.origin*100}% ${b.origin*100}% 0`,h.animationValues?l.opacity=h===this?p.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:p.opacityExit:l.opacity=h===this?p.opacity!==void 0?p.opacity:"":p.opacityExit!==void 0?p.opacityExit:0;for(const x in Hp){if(p[x]===void 0)continue;const{correct:w,applyTo:_,isCSSVariable:S}=Hp[x],k=m==="none"?p[x]:w(p[x],h);if(_){const C=_.length;for(let E=0;E<C;E++)l[_[E]]=k}else S?this.options.visualElement.renderState.vars[x]=k:l[x]=k}this.options.layoutId&&(l.pointerEvents=h===this?au(u?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(l=>l.currentAnimation?.stop()),this.root.nodes.forEach(jS),this.root.sharedNodes.clear()}}}function sH(t){t.updateLayout()}function aH(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:o}=t.layout,{animationType:s}=t.options,a=e.source!==t.layout.source;s==="size"?oi(p=>{const m=a?e.measuredBox[p]:e.layoutBox[p],y=Ge(m);m.min=n[p].min,m.max=m.min+y}):US(s,e.layoutBox,n)&&oi(p=>{const m=a?e.measuredBox[p]:e.layoutBox[p],y=Ge(n[p]);m.max=m.min+y,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+y)});const l=Kr();Oa(l,n,e.layoutBox);const u=Kr();a?Oa(u,t.applyTransform(o,!0),e.measuredBox):Oa(u,n,e.layoutBox);const d=!wS(l);let h=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:m,layout:y}=p;if(m&&y){const b=Me();su(b,e.layoutBox,m.layoutBox);const x=Me();su(x,n,y.layoutBox),ES(b,x)||(h=!0),p.options.layoutRoot&&(t.relativeTarget=x,t.relativeTargetOrigin=b,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:u,layoutDelta:l,hasLayoutChanged:d,hasRelativeLayoutChanged:h})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function lH(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function cH(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function uH(t){t.clearSnapshot()}function jS(t){t.clearMeasurements()}function zS(t){t.isLayoutDirty=!1}function fH(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function VS(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function dH(t){t.resolveTargetDelta()}function hH(t){t.calcProjection()}function pH(t){t.resetSkewAndRotation()}function mH(t){t.removeLeadSnapshot()}function LS(t,e,n){t.translate=he(e.translate,0,n),t.scale=he(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function IS(t,e,n,o){t.min=he(e.min,n.min,o),t.max=he(e.max,n.max,o)}function gH(t,e,n,o){IS(t.x,e.x,n.x,o),IS(t.y,e.y,n.y,o)}function yH(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const vH={duration:.45,ease:[.4,0,.1,1]},PS=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),BS=PS("applewebkit/")&&!PS("chrome/")?Math.round:vn;function HS(t){t.min=BS(t.min),t.max=BS(t.max)}function bH(t){HS(t.x),HS(t.y)}function US(t,e,n){return t==="position"||t==="preserve-aspect"&&!UB(CS(e),CS(n),.2)}function xH(t){return t!==t.root&&t.scroll?.wasRoot}const wH=DS({attachResizeListener:(t,e)=>Da(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),qp={current:void 0},$S=DS({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!qp.current){const t=new wH({});t.mount(window),t.setOptions({layoutScroll:!0}),qp.current=t}return qp.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Gp=N.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function YS(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function _H(...t){return e=>{let n=!1;const o=t.map(s=>{const a=YS(s,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<o.length;s++){const a=o[s];typeof a=="function"?a():YS(t[s],null)}}}}function SH(...t){return N.useCallback(_H(...t),t)}class EH extends N.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const o=n.offsetParent,s=Mp(o)&&o.offsetWidth||0,a=Mp(o)&&o.offsetHeight||0,l=this.props.sizeRef.current;l.height=n.offsetHeight||0,l.width=n.offsetWidth||0,l.top=n.offsetTop,l.left=n.offsetLeft,l.right=s-l.width-l.left,l.bottom=a-l.height-l.top}return null}componentDidUpdate(){}render(){return this.props.children}}function CH({children:t,isPresent:e,anchorX:n,anchorY:o,root:s,pop:a}){const l=N.useId(),u=N.useRef(null),d=N.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:h}=N.useContext(Gp),p=t.props?.ref??t?.ref,m=SH(u,p);return N.useInsertionEffect(()=>{const{width:y,height:b,top:x,left:w,right:_,bottom:S}=d.current;if(e||a===!1||!u.current||!y||!b)return;const k=n==="left"?`left: ${w}`:`right: ${_}`,C=o==="bottom"?`bottom: ${S}`:`top: ${x}`;u.current.dataset.motionPopId=l;const E=document.createElement("style");h&&(E.nonce=h);const R=s??document.head;return R.appendChild(E),E.sheet&&E.sheet.insertRule(`
|
|
69
|
+
[data-motion-pop-id="${l}"] {
|
|
70
70
|
position: absolute !important;
|
|
71
71
|
width: ${y}px !important;
|
|
72
72
|
height: ${b}px !important;
|
|
73
|
-
${
|
|
74
|
-
${
|
|
73
|
+
${k}px !important;
|
|
74
|
+
${C}px !important;
|
|
75
75
|
}
|
|
76
|
-
`),()=>{R.contains(C)&&R.removeChild(C)}},[e]),M.jsx(gH,{isPresent:e,childRef:u,sizeRef:d,pop:a,children:a===!1?t:N.cloneElement(t,{ref:m})})}const vH=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:s,presenceAffectsLayout:a,mode:c,anchorX:u,anchorY:d,root:h})=>{const p=Fh(bH),m=N.useId();let y=!0,b=N.useMemo(()=>(y=!1,{id:m,initial:e,isPresent:n,custom:s,onExitComplete:x=>{p.set(x,!0);for(const w of p.values())if(!w)return;i&&i()},register:x=>(p.set(x,!1),()=>p.delete(x))}),[n,p,i]);return a&&y&&(b={...b}),N.useMemo(()=>{p.forEach((x,w)=>p.set(w,!1))},[n]),N.useEffect(()=>{!n&&!p.size&&i&&i()},[n]),t=M.jsx(yH,{pop:c==="popLayout",isPresent:n,anchorX:u,anchorY:d,root:h,children:t}),M.jsx(cu.Provider,{value:b,children:t})};function bH(){return new Map}function YE(t=!0){const e=N.useContext(cu);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:s}=e,a=N.useId();N.useEffect(()=>{if(t)return s(a)},[t]);const c=N.useCallback(()=>t&&i&&i(a),[a,i,t]);return!n&&i?[!1,c]:[!0]}const Au=t=>t.key||"";function GE(t){const e=[];return N.Children.forEach(t,n=>{N.isValidElement(n)&&e.push(n)}),e}const XE=({children:t,custom:e,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:a="sync",propagate:c=!1,anchorX:u="left",anchorY:d="top",root:h})=>{const[p,m]=YE(c),y=N.useMemo(()=>GE(t),[t]),b=c&&!p?[]:y.map(Au),x=N.useRef(!0),w=N.useRef(y),S=Fh(()=>new Map),E=N.useRef(new Set),[D,T]=N.useState(y),[C,R]=N.useState(y);y1(()=>{x.current=!1,w.current=y;for(let k=0;k<C.length;k++){const H=Au(C[k]);b.includes(H)?(S.delete(H),E.current.delete(H)):S.get(H)!==!0&&S.set(H,!1)}},[C,b.length,b.join("-")]);const A=[];if(y!==D){let k=[...y];for(let H=0;H<C.length;H++){const $=C[H],q=Au($);b.includes(q)||(k.splice(H,0,$),A.push($))}return a==="wait"&&A.length&&(k=A),R(GE(k)),T(y),null}const{forceRender:O}=N.useContext(Xh);return M.jsx(M.Fragment,{children:C.map(k=>{const H=Au(k),$=c&&!p?!1:y===C||b.includes(H),q=()=>{if(E.current.has(H))return;if(E.current.add(H),S.has(H))S.set(H,!0);else return;let F=!0;S.forEach(Q=>{Q||(F=!1)}),F&&(O?.(),R(w.current),c&&m?.(),i&&i())};return M.jsx(vH,{isPresent:$,initial:!x.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:a,root:h,onExitComplete:$?void 0:q,anchorX:u,anchorY:d,children:k},H)})})},FE=N.createContext({strict:!1}),ZE={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let KE=!1;function xH(){if(KE)return;const t={};for(const e in ZE)t[e]={isEnabled:n=>ZE[e].some(i=>!!n[i])};$S(t),KE=!0}function QE(){return xH(),sP()}function wH(t){const e=QE();for(const n in t)e[n]={...e[n],...t[n]};$S(e)}const SH=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Mu(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||SH.has(t)}let WE=t=>!Mu(t);function EH(t){typeof t=="function"&&(WE=e=>e.startsWith("on")?!Mu(e):t(e))}try{EH(require("@emotion/is-prop-valid").default)}catch{}function CH(t,e,n){const i={};for(const s in t)s==="values"&&typeof t.values=="object"||(WE(s)||n===!0&&Mu(s)||!e&&!Mu(s)||t.draggable&&s.startsWith("onDrag"))&&(i[s]=t[s]);return i}const Ru=N.createContext({});function TH(t,e){if(Su(t)){const{initial:n,animate:i}=t;return{initial:n===!1||nl(n)?n:void 0,animate:nl(i)?i:void 0}}return t.inherit!==!1?e:{}}function _H(t){const{initial:e,animate:n}=TH(t,N.useContext(Ru));return N.useMemo(()=>({initial:e,animate:n}),[JE(e),JE(n)])}function JE(t){return Array.isArray(t)?t.join(" "):t}const em=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function tC(t,e,n){for(const i in e)!Xe(e[i])&&!nE(i,n)&&(t[i]=e[i])}function NH({transformTemplate:t},e){return N.useMemo(()=>{const n=em();return Fp(n,e,t),Object.assign({},n.vars,n.style)},[e])}function AH(t,e){const n=t.style||{},i={};return tC(i,n,t),Object.assign(i,NH(t,e)),i}function MH(t,e){const n={},i=AH(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=i,n}const eC=()=>({...em(),attrs:{}});function RH(t,e,n,i){const s=N.useMemo(()=>{const a=eC();return oE(a,e,rE(i),t.transformTemplate,t.style),{...a.attrs,style:{...a.style}}},[e]);if(t.style){const a={};tC(a,t.style,t),s.style={...a,...s.style}}return s}const kH=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function nm(t){return typeof t!="string"||t.includes("-")?!1:!!(kH.indexOf(t)>-1||/[A-Z]/u.test(t))}function OH(t,e,n,{latestValues:i},s,a=!1,c){const d=(c??nm(t)?RH:MH)(e,i,s,t),h=CH(e,typeof t=="string",a),p=t!==N.Fragment?{...h,...d,ref:n}:{},{children:m}=e,y=N.useMemo(()=>Xe(m)?m.get():m,[m]);return N.createElement(t,{...p,children:y})}function DH({scrapeMotionValuesFromProps:t,createRenderState:e},n,i,s){return{latestValues:jH(n,i,s,t),renderState:e()}}function jH(t,e,n,i){const s={},a=i(t,{});for(const y in a)s[y]=_u(a[y]);let{initial:c,animate:u}=t;const d=Su(t),h=PS(t);e&&h&&!d&&t.inherit!==!1&&(c===void 0&&(c=e.initial),u===void 0&&(u=e.animate));let p=n?n.initial===!1:!1;p=p||c===!1;const m=p?u:c;if(m&&typeof m!="boolean"&&!wu(m)){const y=Array.isArray(m)?m:[m];for(let b=0;b<y.length;b++){const x=Mp(t,y[b]);if(x){const{transitionEnd:w,transition:S,...E}=x;for(const D in E){let T=E[D];if(Array.isArray(T)){const C=p?T.length-1:0;T=T[C]}T!==null&&(s[D]=T)}for(const D in w)s[D]=w[D]}}}return s}const nC=t=>(e,n)=>{const i=N.useContext(Ru),s=N.useContext(cu),a=()=>DH(t,e,i,s);return n?a():Fh(a)},zH=nC({scrapeMotionValuesFromProps:Kp,createRenderState:em}),VH=nC({scrapeMotionValuesFromProps:sE,createRenderState:eC}),LH=Symbol.for("motionComponentSymbol");function IH(t,e,n){const i=N.useRef(n);N.useInsertionEffect(()=>{i.current=n});const s=N.useRef(null);return N.useCallback(a=>{a&&t.onMount?.(a),e&&(a?e.mount(a):e.unmount());const c=i.current;if(typeof c=="function")if(a){const u=c(a);typeof u=="function"&&(s.current=u)}else s.current?(s.current(),s.current=null):c(a);else c&&(c.current=a)},[e])}const oC=N.createContext({});function ks(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function BH(t,e,n,i,s,a){const{visualElement:c}=N.useContext(Ru),u=N.useContext(FE),d=N.useContext(cu),h=N.useContext(tm),p=h.reducedMotion,m=h.skipAnimations,y=N.useRef(null),b=N.useRef(!1);i=i||u.renderer,!y.current&&i&&(y.current=i(t,{visualState:e,parent:c,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:p,skipAnimations:m,isSVG:a}),b.current&&y.current&&(y.current.manuallyAnimateOnMount=!0));const x=y.current,w=N.useContext(oC);x&&!x.projection&&s&&(x.type==="html"||x.type==="svg")&&PH(y.current,n,s,w);const S=N.useRef(!1);N.useInsertionEffect(()=>{x&&S.current&&x.update(n,d)});const E=n[bS],D=N.useRef(!!E&&!window.MotionHandoffIsComplete?.(E)&&window.MotionHasOptimisedAnimation?.(E));return y1(()=>{b.current=!0,x&&(S.current=!0,window.MotionIsMounted=!0,x.updateFeatures(),x.scheduleRenderMicrotask(),D.current&&x.animationState&&x.animationState.animateChanges())}),N.useEffect(()=>{x&&(!D.current&&x.animationState&&x.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(E)}),D.current=!1),x.enteringChildren=void 0)}),x}function PH(t,e,n,i){const{layoutId:s,layout:a,drag:c,dragConstraints:u,layoutScroll:d,layoutRoot:h,layoutCrossfade:p}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:iC(t.parent)),t.projection.setOptions({layoutId:s,layout:a,alwaysMeasureLayout:!!c||u&&ks(u),visualElement:t,animationType:typeof a=="string"?a:"both",initialPromotionConfig:i,crossfade:p,layoutScroll:d,layoutRoot:h})}function iC(t){if(t)return t.options.allowProjection!==!1?t.projection:iC(t.parent)}function om(t,{forwardMotionProps:e=!1,type:n}={},i,s){i&&wH(i);const a=n?n==="svg":nm(t),c=a?VH:zH;function u(h,p){let m;const y={...N.useContext(tm),...h,layoutId:HH(h)},{isStatic:b}=y,x=_H(h),w=c(h,b);if(!b&&g1){UH();const S=$H(y);m=S.MeasureLayout,x.visualElement=BH(t,w,y,s,S.ProjectionNode,a)}return M.jsxs(Ru.Provider,{value:x,children:[m&&x.visualElement?M.jsx(m,{visualElement:x.visualElement,...y}):null,OH(t,h,IH(w,x.visualElement,p),w,b,e,a)]})}u.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const d=N.forwardRef(u);return d[LH]=t,d}function HH({layoutId:t}){const e=N.useContext(Xh).id;return e&&t!==void 0?e+"-"+t:t}function UH(t,e){N.useContext(FE).strict}function $H(t){const e=QE(),{drag:n,layout:i}=e;if(!n&&!i)return{};const s={...n,...i};return{MeasureLayout:n?.isEnabled(t)||i?.isEnabled(t)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function qH(t,e){if(typeof Proxy>"u")return om;const n=new Map,i=(a,c)=>om(a,c,t,e),s=(a,c)=>i(a,c);return new Proxy(s,{get:(a,c)=>c==="create"?i:(n.has(c)||n.set(c,om(c,void 0,t,e)),n.get(c))})}const YH=(t,e)=>e.isSVG??nm(t)?new EP(e):new yP(e,{allowProjection:t!==N.Fragment});class GH extends Ci{constructor(e){super(e),e.animationState||(e.animationState=AP(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();wu(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let XH=0;class FH extends Ci{constructor(){super(...arguments),this.id=XH++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const ZH={animation:{Feature:GH},exit:{Feature:FH}};function sl(t){return{point:{x:t.pageX,y:t.pageY}}}const KH=t=>e=>Bp(e)&&t(e,sl(e));function al(t,e,n,i){return rl(t,e,KH(n),i)}const rC=({current:t})=>t?t.ownerDocument.defaultView:null,sC=(t,e)=>Math.abs(t-e);function QH(t,e){const n=sC(t.x,e.x),i=sC(t.y,e.y);return Math.sqrt(n**2+i**2)}const aC=new Set(["auto","scroll"]);class lC{constructor(e,n,{transformPagePoint:i,contextWindow:s=window,dragSnapToOrigin:a=!1,distanceThreshold:c=3,element:u}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=b=>{this.handleScroll(b.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=rm(this.lastMoveEventInfo,this.history),x=this.startEvent!==null,w=QH(b.offset,{x:0,y:0})>=this.distanceThreshold;if(!x&&!w)return;const{point:S}=b,{timestamp:E}=Be;this.history.push({...S,timestamp:E});const{onStart:D,onMove:T}=this.handlers;x||(D&&D(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,b)},this.handlePointerMove=(b,x)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=im(x,this.transformPagePoint),ae.update(this.updatePoint,!0)},this.handlePointerUp=(b,x)=>{this.end();const{onEnd:w,onSessionEnd:S,resumeAnimation:E}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&E&&E(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=rm(b.type==="pointercancel"?this.lastMoveEventInfo:im(x,this.transformPagePoint),this.history);this.startEvent&&w&&w(b,D),S&&S(b,D)},!Bp(e))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=i,this.distanceThreshold=c,this.contextWindow=s||window;const d=sl(e),h=im(d,this.transformPagePoint),{point:p}=h,{timestamp:m}=Be;this.history=[{...p,timestamp:m}];const{onSessionStart:y}=n;y&&y(e,rm(h,this.history)),this.removeListeners=Xa(al(this.contextWindow,"pointermove",this.handlePointerMove),al(this.contextWindow,"pointerup",this.handlePointerUp),al(this.contextWindow,"pointercancel",this.handlePointerUp)),u&&this.startScrollTracking(u)}startScrollTracking(e){let n=e.parentElement;for(;n;){const i=getComputedStyle(n);(aC.has(i.overflowX)||aC.has(i.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const i=e===window,s=i?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a={x:s.x-n.x,y:s.y-n.y};a.x===0&&a.y===0||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(e,s),ae.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),wi(this.updatePoint)}}function im(t,e){return e?{point:e(t.point)}:t}function cC(t,e){return{x:t.x-e.x,y:t.y-e.y}}function rm({point:t},e){return{point:t,delta:cC(t,uC(e)),offset:cC(t,WH(e)),velocity:JH(e,.1)}}function WH(t){return t[0]}function uC(t){return t[t.length-1]}function JH(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const s=uC(t);for(;n>=0&&(i=t[n],!(s.timestamp-i.timestamp>Zn(e)));)n--;if(!i)return{x:0,y:0};i===t[0]&&t.length>2&&s.timestamp-i.timestamp>Zn(e)*2&&(i=t[1]);const a=An(s.timestamp-i.timestamp);if(a===0)return{x:0,y:0};const c={x:(s.x-i.x)/a,y:(s.y-i.y)/a};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function tU(t,{min:e,max:n},i){return e!==void 0&&t<e?t=i?ye(e,t,i.min):Math.max(t,e):n!==void 0&&t>n&&(t=i?ye(n,t,i.max):Math.min(t,n)),t}function fC(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function eU(t,{top:e,left:n,bottom:i,right:s}){return{x:fC(t.x,n,s),y:fC(t.y,e,i)}}function dC(t,e){let n=e.min-t.min,i=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,i]=[i,n]),{min:n,max:i}}function nU(t,e){return{x:dC(t.x,e.x),y:dC(t.y,e.y)}}function oU(t,e){let n=.5;const i=Ze(t),s=Ze(e);return s>i?n=Fa(e.min,e.max-i,t.min):i>s&&(n=Fa(t.min,t.max-s,e.min)),bo(0,1,n)}function iU(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const sm=.35;function rU(t=sm){return t===!1?t=0:t===!0&&(t=sm),{x:hC(t,"left","right"),y:hC(t,"top","bottom")}}function hC(t,e,n){return{min:pC(t,e),max:pC(t,n)}}function pC(t,e){return typeof t=="number"?t:t[e]||0}const sU=new WeakMap;class aU{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ze(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:i}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const a=m=>{n&&this.snapToCursor(sl(m).point),this.stopAnimation()},c=(m,y)=>{const{drag:b,dragPropagation:x,onDragStart:w}=this.getProps();if(b&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=VB(b),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=y,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),wo(E=>{let D=this.getAxisMotionValue(E).get()||0;if(xo.test(D)){const{projection:T}=this.visualElement;if(T&&T.layout){const C=T.layout.layoutBox[E];C&&(D=Ze(C)*(parseFloat(D)/100))}}this.originPoint[E]=D}),w&&ae.update(()=>w(m,y),!1,!0),kp(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},u=(m,y)=>{this.latestPointerEvent=m,this.latestPanInfo=y;const{dragPropagation:b,dragDirectionLock:x,onDirectionLock:w,onDrag:S}=this.getProps();if(!b&&!this.openDragLock)return;const{offset:E}=y;if(x&&this.currentDirection===null){this.currentDirection=cU(E),this.currentDirection!==null&&w&&w(this.currentDirection);return}this.updateAxis("x",y.point,E),this.updateAxis("y",y.point,E),this.visualElement.render(),S&&ae.update(()=>S(m,y),!1,!0)},d=(m,y)=>{this.latestPointerEvent=m,this.latestPanInfo=y,this.stop(m,y),this.latestPointerEvent=null,this.latestPanInfo=null},h=()=>{const{dragSnapToOrigin:m}=this.getProps();(m||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:p}=this.getProps();this.panSession=new lC(e,{onSessionStart:a,onStart:c,onMove:u,onSessionEnd:d,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:i,contextWindow:rC(this.visualElement),element:this.visualElement.current})}stop(e,n){const i=e||this.latestPointerEvent,s=n||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!s||!i)return;const{velocity:c}=s;this.startAnimation(c);const{onDragEnd:u}=this.getProps();u&&ae.postRender(()=>u(i,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,i){const{drag:s}=this.getProps();if(!i||!ku(e,s,this.currentDirection))return;const a=this.getAxisMotionValue(e);let c=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(c=tU(c,this.constraints[e],this.elastic[e])),a.set(c)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,s=this.constraints;e&&ks(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&i?this.constraints=eU(i.layoutBox,e):this.constraints=!1,this.elastic=rU(n),s!==this.constraints&&!ks(e)&&i&&this.constraints&&!this.hasMutatedConstraints&&wo(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=iU(i.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!ks(e))return!1;const i=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const a=fP(i,s.root,this.visualElement.getTransformPagePoint());let c=nU(s.layout.layoutBox,a);if(n){const u=n(lP(c));this.hasMutatedConstraints=!!u,u&&(c=YS(u))}return c}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:s,dragTransition:a,dragSnapToOrigin:c,onDragTransitionEnd:u}=this.getProps(),d=this.constraints||{},h=wo(p=>{if(!ku(p,n,this.currentDirection))return;let m=d&&d[p]||{};c&&(m={min:0,max:0});const y=s?200:1e6,b=s?40:1e7,x={type:"inertia",velocity:i?e[p]:0,bounceStiffness:y,bounceDamping:b,timeConstant:750,restDelta:1,restSpeed:10,...a,...m};return this.startAxisValueAnimation(p,x)});return Promise.all(h).then(u)}startAxisValueAnimation(e,n){const i=this.getAxisMotionValue(e);return kp(this.visualElement,e),i.start(Ap(e,i,0,n,this.visualElement,!1))}stopAnimation(){wo(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),s=i[n];return s||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){wo(n=>{const{drag:i}=this.getProps();if(!ku(n,i,this.currentDirection))return;const{projection:s}=this.visualElement,a=this.getAxisMotionValue(n);if(s&&s.layout){const{min:c,max:u}=s.layout.layoutBox[n],d=a.get()||0;a.set(e[n]-ye(c,u,.5)+d)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!ks(n)||!i||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};wo(c=>{const u=this.getAxisMotionValue(c);if(u&&this.constraints!==!1){const d=u.get();s[c]=oU({min:d,max:d},this.constraints[c])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.constraints=!1,this.resolveConstraints(),wo(c=>{if(!ku(c,e,null))return;const u=this.getAxisMotionValue(c),{min:d,max:h}=this.constraints[c];u.set(ye(d,h,s[c]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;sU.set(this.visualElement,this);const e=this.visualElement.current,n=al(e,"pointerdown",h=>{const{drag:p,dragListener:m=!0}=this.getProps(),y=h.target,b=y!==e&&UB(y);p&&m&&!b&&this.start(h)});let i;const s=()=>{const{dragConstraints:h}=this.getProps();ks(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),i||(i=lU(e,h.current,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,c=a.addEventListener("measure",s);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),ae.read(s);const u=rl(window,"resize",()=>this.scalePositionWithinConstraints()),d=a.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(wo(m=>{const y=this.getAxisMotionValue(m);y&&(this.originPoint[m]+=h[m].translate,y.set(y.get()+h[m].translate))}),this.visualElement.render())}));return()=>{u(),n(),c(),d&&d(),i&&i()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:s=!1,dragConstraints:a=!1,dragElastic:c=sm,dragMomentum:u=!0}=e;return{...e,drag:n,dragDirectionLock:i,dragPropagation:s,dragConstraints:a,dragElastic:c,dragMomentum:u}}}function mC(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function lU(t,e,n){const i=LS(t,mC(n)),s=LS(e,mC(n));return()=>{i(),s()}}function ku(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function cU(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class uU extends Ci{constructor(e){super(e),this.removeGroupControls=Nn,this.removeListeners=Nn,this.controls=new aU(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Nn}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const am=t=>(e,n)=>{t&&ae.update(()=>t(e,n),!1,!0)};class fU extends Ci{constructor(){super(...arguments),this.removePointerDownListener=Nn}onPointerDown(e){this.session=new lC(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:rC(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:s}=this.node.getProps();return{onSessionStart:am(e),onStart:am(n),onMove:am(i),onEnd:(a,c)=>{delete this.session,s&&ae.postRender(()=>s(a,c))}}}mount(){this.removePointerDownListener=al(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let lm=!1;class dU extends N.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:s}=this.props,{projection:a}=e;a&&(n.group&&n.group.add(a),i&&i.register&&s&&i.register(a),lm&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Nu.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:i,drag:s,isPresent:a}=this.props,{projection:c}=i;return c&&(c.isPresent=a,e.layoutDependency!==n&&c.setOptions({...c.options,layoutDependency:n}),lm=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==a?c.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?c.promote():c.relegate()||ae.postRender(()=>{const u=c.getStack();(!u||!u.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Ip.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:s}=e;lm=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),i&&i.deregister&&i.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function gC(t){const[e,n]=YE(),i=N.useContext(Xh);return M.jsx(dU,{...t,layoutGroup:i,switchLayoutGroup:N.useContext(oC),isPresent:e,safeToRemove:n})}const hU={pan:{Feature:fU},drag:{Feature:uU,ProjectionNode:$E,MeasureLayout:gC}};function yC(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,a=i[s];a&&ae.postRender(()=>a(e,sl(e)))}class pU extends Ci{mount(){const{current:e}=this.node;e&&(this.unmount=IB(e,(n,i)=>(yC(this.node,i,"Start"),s=>yC(this.node,s,"End"))))}unmount(){}}class mU extends Ci{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Xa(rl(this.node.current,"focus",()=>this.onFocus()),rl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function vC(t,e,n){const{props:i}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),a=i[s];a&&ae.postRender(()=>a(e,sl(e)))}class gU extends Ci{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:i}=this.node.props;this.unmount=qB(e,(s,a)=>(vC(this.node,a,"Start"),(c,{success:u})=>vC(this.node,c,u?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:i?.tap===!1})}unmount(){}}const cm=new WeakMap,um=new WeakMap,yU=t=>{const e=cm.get(t.target);e&&e(t)},vU=t=>{t.forEach(yU)};function bU({root:t,...e}){const n=t||document;um.has(n)||um.set(n,{});const i=um.get(n),s=JSON.stringify(e);return i[s]||(i[s]=new IntersectionObserver(vU,{root:t,...e})),i[s]}function xU(t,e,n){const i=bU(e);return cm.set(t,n),i.observe(t),()=>{cm.delete(t),i.unobserve(t)}}const wU={some:0,all:1};class SU extends Ci{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:i,amount:s="some",once:a}=e,c={root:n?n.current:void 0,rootMargin:i,threshold:typeof s=="number"?s:wU[s]},u=d=>{const{isIntersecting:h}=d;if(this.isInView===h||(this.isInView=h,a&&!h&&this.hasEnteredView))return;h&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",h);const{onViewportEnter:p,onViewportLeave:m}=this.node.getProps(),y=h?p:m;y&&y(d)};return xU(this.node.current,c,u)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(EU(e,n))&&this.startObserver()}unmount(){}}function EU({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const CU={...ZH,...{inView:{Feature:SU},tap:{Feature:gU},focus:{Feature:mU},hover:{Feature:pU}},...hU,...{layout:{ProjectionNode:$E,MeasureLayout:gC}}},Ou=qH(CU,YH),bC="__boundary_in_",xC="__boundary_out_";function TU(t){const e=[],n=[];for(const i of t.inputs){const s=`${bC}${i.name}`,a=i.portType.kind==="bus";e.push({id:s,label:i.name,componentRef:a?"Input":"Switch",arguments:a?{value:0,width:i.portType.width}:{value:!1},inputs:[],outputs:[{id:`${s}_out`,name:"out",portType:i.portType}],clocks:[]})}for(const i of t.outputs){const s=`${xC}${i.name}`,a=i.portType.kind==="bus";e.push({id:s,label:i.name,componentRef:a?"HexDisplay":"Led",arguments:{},inputs:[{id:`${s}_in`,name:"in",portType:i.portType}],outputs:[],clocks:[]})}for(const i of t.connections){const s={...i.source},a={...i.target};i.source.nodeId===""&&(s.nodeId=`${bC}${i.source.portName}`,s.portName="out"),i.target.nodeId===""&&(a.nodeId=`${xC}${i.target.portName}`,a.portName="in"),n.push({...i,source:s,target:a})}return{...t,name:`__drilldown_${t.name}`,nodes:[...e,...t.nodes],connections:n,implementation:{kind:"primitive"}}}const Le="__top__";function _U(t,e,n=!1,i){const s=[],a=[],c={path:"",componentName:t.name,children:[],primitives:[]};function u(p,m,y,b=new Set){for(const x of p.nodes){const w=m+x.id,S=e.resolveCircuit(x.componentRef);if(!S)throw new Error(`Unknown component: ${x.componentRef} (referenced by node ${w})`);if(S.implementation.kind==="primitive")s.push({id:w,primitiveType:x.componentRef,arguments:x.arguments,inputs:x.inputs.map(E=>({...E,nodeId:w})),outputs:x.outputs.map(E=>({...E,nodeId:w})),clocks:x.clocks.map(E=>({...E,nodeId:w})),dependents:[],inputSources:[]}),y.primitives.push(w);else if(S.implementation.kind==="composite"){if(b.has(x.componentRef))throw new Error(`Recursive circuit definition detected: '${x.componentRef}' references itself (cycle: ${[...b,x.componentRef].join(" → ")})`);const E={path:w,componentName:x.componentRef,children:[],primitives:[]};y.children.push(E);const D=new Set(b);D.add(x.componentRef),u(S,w+".",E,D)}else console.warn(`Intrinsic component ${x.componentRef} treated as primitive during elaboration`),s.push({id:w,primitiveType:x.componentRef,arguments:x.arguments,inputs:x.inputs.map(E=>({...E,nodeId:w})),outputs:x.outputs.map(E=>({...E,nodeId:w})),clocks:x.clocks.map(E=>({...E,nodeId:w})),dependents:[],inputSources:[]}),y.primitives.push(w)}for(const x of p.connections){const w=x.source.nodeId===""?m===""?Le:m.slice(0,-1):m+x.source.nodeId,S=x.target.nodeId===""?m===""?Le:m.slice(0,-1):m+x.target.nodeId;a.push({id:`${w}.${x.source.portName}->${S}.${x.target.portName}`,source:{nodeId:w,portName:x.source.portName},target:{nodeId:S,portName:x.target.portName},portType:x.portType})}}if(t.implementation.kind==="primitive"&&t.nodes.length===0){const p=t.name;s.push({id:p,primitiveType:t.name,arguments:{},inputs:t.inputs.map(m=>({id:`${p}.${m.name}`,name:m.name,portType:m.portType,nodeId:p})),outputs:t.outputs.map(m=>({id:`${p}.${m.name}`,name:m.name,portType:m.portType,nodeId:p})),clocks:t.clocks.map(m=>({id:`${p}.${m.name}`,name:m.name,nodeId:p})),dependents:[],inputSources:[]}),c.primitives.push(p);for(const m of t.inputs)a.push({id:`${Le}.${m.name}->${p}.${m.name}`,source:{nodeId:Le,portName:m.name},target:{nodeId:p,portName:m.name},portType:m.portType});for(const m of t.outputs)a.push({id:`${p}.${m.name}->${Le}.${m.name}`,source:{nodeId:p,portName:m.name},target:{nodeId:Le,portName:m.name},portType:m.portType})}else u(t,"",c,new Set([t.name]));const d=NU(t,a,s,e,"",n),h={nodes:s,connections:d,hierarchy:c,topLevelInputs:t.inputs,topLevelOutputs:t.outputs,nodeMap:new Map};return MU(h),h}function NU(t,e,n,i,s,a=!1){const c=new Map,u=new Set;function d(m,y,b=new Set){for(const x of m.nodes){const w=y+x.id,S=i.resolveCircuit(x.componentRef);if(S&&S.implementation.kind==="composite"){if(b.has(x.componentRef))continue;u.add(w),a&&console.log(`
|
|
77
|
-
=== Tracing composite: ${w} (${x.componentRef}) ===`),
|
|
78
|
-
=== Port Forwarding Map (${
|
|
79
|
-
=== Eliminating ${p.length} passthrough connections ===`);const m=[],y=new Set;for(const b of h)if(u.has(b.source.nodeId)&&b.source.nodeId===b.target.nodeId){y.add(b.id),a&&console.log(` PASSTHROUGH: ${b.source.nodeId}.${b.source.portName} -> ${b.target.portName}`);const w=h.filter(E=>E.target.nodeId===b.source.nodeId&&E.target.portName===b.source.portName&&!y.has(E.id)),S=h.filter(E=>E.source.nodeId===b.target.nodeId&&E.source.portName===b.target.portName&&!y.has(E.id));for(const E of w)for(const D of S){const T={id:`${E.source.nodeId}.${E.source.portName}->${D.target.nodeId}.${D.target.portName}`,source:E.source,target:D.target,portType:b.portType};m.push(T),y.add(E.id),y.add(D.id),a&&console.log(` DIRECT: ${T.source.nodeId}.${T.source.portName} -> ${T.target.nodeId}.${T.target.portName}`)}}else y.has(b.id)||m.push(b);return wC(m,n,u,a)}return wC(h,n,u,a)}function wC(t,e,n,i){const s=new Set(e.map(p=>p.id)),a=p=>p.nodeId===Le||s.has(p.nodeId),c=new Map;for(const p of t){const m=`${p.source.nodeId}.${p.source.portName}`;c.has(m)||c.set(m,[]),c.get(m).push(p)}const u=p=>{const m=[],y=new Set,b=[p];for(;b.length>0;){const x=b.pop(),w=`${x.nodeId}.${x.portName}`;if(!y.has(w)){if(y.add(w),a(x)){m.push(x);continue}for(const S of c.get(w)??[])b.push(S.target)}}return m},d=[],h=new Set;for(const p of t){if(!a(p.source))continue;const m=a(p.target)?[p.target]:u(p.target);for(const y of m){if(p.source.nodeId===y.nodeId&&p.source.portName===y.portName)continue;const x=`${p.source.nodeId}.${p.source.portName}->${y.nodeId}.${y.portName}`;h.has(x)||(h.add(x),i&&console.log(` RESOLVED: ${p.source.nodeId}.${p.source.portName} -> ${y.nodeId}.${y.portName}`),d.push({id:x,source:p.source,target:y,portType:p.portType}))}}return d}function AU(t,e,n,i,s=!1){for(const a of t.connections){if(a.source.nodeId===""&&a.target.nodeId!==""){const c=`${e}.${a.source.portName}`,u=Du(e,a.target,t,i);n.has(c)||n.set(c,[]);for(const d of u)n.get(c).push(d),s&&console.log(` INPUT: ${a.source.portName} -> ${d.nodeId}.${d.portName}`)}if(a.source.nodeId!==""&&a.target.nodeId===""){const c=`${e}.${a.target.portName}`,u=Du(e,a.source,t,i);n.has(c)||n.set(c,[]);for(const d of u)n.get(c).push(d),s&&console.log(` OUTPUT: ${a.target.portName} <- ${d.nodeId}.${d.portName}`)}if(a.source.nodeId===""&&a.target.nodeId===""){s&&console.log(` PASSTHROUGH: ${a.source.portName} -> ${a.target.portName}`);const c=`${e}.${a.source.portName}`;n.has(c)||n.set(c,[]),n.get(c).push({nodeId:e,portName:a.target.portName}),s&&console.log(` -> Added passthrough forwarding: ${c} -> ${e}.${a.target.portName}`)}}}function Du(t,e,n,i,s=new Set){if(e.nodeId==="")return[{nodeId:t,portName:e.portName}];const a=t+"."+e.nodeId,c=n.nodes.find(p=>p.id===e.nodeId);if(!c)return[{nodeId:a,portName:e.portName}];const u=i.resolveCircuit(c.componentRef);if(!u||u.implementation.kind!=="composite")return[{nodeId:a,portName:e.portName}];if(s.has(c.componentRef))return[{nodeId:a,portName:e.portName}];const d=new Set(s);d.add(c.componentRef);const h=[];for(const p of u.connections){if(p.target.nodeId===""&&p.target.portName===e.portName){const m=Du(a,p.source,u,i,d);h.push(...m)}if(p.source.nodeId===""&&p.source.portName===e.portName){const m=Du(a,p.target,u,i,d);h.push(...m)}}return h.length>0?h:[{nodeId:a,portName:e.portName}]}function MU(t){t.nodeMap=new Map(t.nodes.map(e=>[e.id,e]));for(const e of t.nodes)e.dependents=[],e.inputSources=[];for(const e of t.connections){const n=e.source.nodeId,i=e.target.nodeId;if(i===Le)continue;const s=t.nodeMap.get(n);s&&!s.dependents.includes(i)&&s.dependents.push(i);const a=t.nodeMap.get(i);a&&a.inputSources.push({portName:e.target.portName,sourceNodeId:n,sourcePortName:e.source.portName})}}function RU(t,e){return`${t}.${e}`}function SC(t,e,n){const i=new Map,s=new Map,a=new Map;for(const c of t.nodes){const u=e.resolveCircuit(c.primitiveType);if(u){if(u.implementation.kind==="primitive"&&u.state.length>0){const d=u.state.map(p=>kU(p,c.id,c.arguments,c.primitiveType,n)),h=u.state.length===1?d[0]:Object.fromEntries(u.state.map((p,m)=>[p.name,d[m]]));i.set(c.id,h),s.set(c.id,h)}for(const d of c.clocks)a.set(RU(c.id,d.name),{value:!1,edge:"none"})}}return{currentState:i,nextState:s,clocks:a,cycleCount:0}}function kU(t,e,n,i,s){const a=t.stateType.kind,c=n[t.name];if(a==="memory"){const d=new Map,h=t.initialValue;if(h?.data){if(h.data instanceof Map)for(const[p,m]of h.data)d.set(p,m);else if(typeof h.data=="object")for(const[p,m]of Object.entries(h.data)){const y=parseInt(p,10);!isNaN(y)&&typeof m=="number"&&d.set(y,m)}}if(c!==void 0){if(Array.isArray(c))c.forEach((p,m)=>{typeof p=="number"&&d.set(m,p)});else if(c instanceof Map)for(const[p,m]of c)d.set(p,m);else if(typeof c=="object"&&c!==null)for(const[p,m]of Object.entries(c)){const y=parseInt(p,10);!isNaN(y)&&typeof m=="number"&&d.set(y,m)}}if(s){const p=DU(e,s,i);if(p)for(const[m,y]of p.entries())d.set(m,y)}return d}if(c!==void 0&&(typeof c=="number"||typeof c=="boolean"))return c;const u=t.initialValue;return u}function OU(t){const n=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(n,"i")}function DU(t,e,n){for(const[i,s]of e){const a=OU(i);if(a.test(t)||n&&a.test(n))return s}}const fm={And:0,Or:1,Not:2,Nand:3,Nor:4,Xor:5,Xnor:6,Buffer:7,Switch:10,Led:11,Output:12,Button:13,Input:14,Constant:15,Splitter:20,Splitter8to8:21,Combiner8to8:22,Probe:23,BitSlice:24,AddressCombiner:25,Concat:26,BusAnd:40,BusOr:41,BusNot:42,BusXor:43,Incrementer:50,Adder:51,Multiplier:52,Comparator:53,LeftShifter:54,RightShifter:55,Subtractor:56,SignedAdder:57,SignedComparator:58,SignedMultiplier:59,Mux:70,Decoder:71,SevenSegment:80,HexDisplay:81,Screen:82,RasterDisplay:83,DFlipFlop:90,Register:91,ROM:100,RAM:101,DualPortRAM:102,Console:110},jU=Object.entries(fm).reduce((t,[e,n])=>(t[n]=e,t),[]);class zU{queue;pending;head=0;tail=0;capacity;constructor(e){this.capacity=e,this.queue=new Uint32Array(e),this.pending=new Uint8Array(e)}enqueue(e){this.pending[e]||(this.pending[e]=1,this.queue[this.tail%this.capacity]=e,this.tail++)}enqueueAll(e){for(let n=0;n<e.length;n++)this.enqueue(e[n])}dequeue(){const e=this.queue[this.head%this.capacity];return this.pending[e]=0,this.head++,e}isEmpty(){return this.head===this.tail}size(){return this.tail-this.head}toArray(){const e=[];for(let n=this.head;n<this.tail;n++)e.push(this.queue[n%this.capacity]);return e}clear(){this.head=0,this.tail=0,this.pending.fill(0)}}function EC(t){return{values:new Int32Array(t),changed:new Uint8Array(t),initialized:new Uint8Array(t)}}function CC(t,e){const n=t.circuit.inputSourcePort[t.portStart+e];return n>=0?t.values.values[n]:0}function TC(t,e,n){const i=t.portStart+t.inputCount+e;t.values.values[i]=n,t.values.initialized[i]=1}const VU=Math.max(...Object.values(fm))+1,ll=new Array(VU).fill(null);function _C(t){return new Proxy(t,{get(e,n){if(typeof n=="string"&&/^\d+$/.test(n))return e.get(Number(n))??0;const i=e[n];return typeof i=="function"?i.bind(e):i},set(e,n,i){return typeof n=="string"&&/^\d+$/.test(n)?(e.set(Number(n),i),!0):!1}})}let LU=200;const NC=new Map;function IU(t){const e=fm[t];if(e!==void 0)return e;const n=NC.get(t);if(n!==void 0)return n;const i=LU++;return NC.set(t,i),jU[i]=t,i}function BU(t,e,n,i){const s=t.length,a=e.length;return!i||i.length===0?function(u){const d={},h=u.circuit.flatCircuit.nodes[u.nodeIndex]?.arguments;if(h)for(const m in h)d[m]=h[m];for(let m=0;m<s;m++)d[t[m]]=CC(u,m);const p=n(d);for(let m=0;m<a;m++){const y=p[e[m]];y!==void 0&&TC(u,m,y)}}:function(u){const d={},h=u.circuit.flatCircuit.nodes[u.nodeIndex]?.arguments;if(h)for(const m in h)d[m]=h[m];for(let m=0;m<s;m++)d[t[m]]=CC(u,m);if(u.state){const m=u.state.currentState[u.nodeIndex];if(m!=null&&typeof m=="object"&&!Array.isArray(m)&&!(m instanceof Map)){const y=m;for(const b of i){const x=y[b];d[b]=x instanceof Map?_C(x):x}}else m!=null&&(d[i[0]]=m instanceof Map?_C(m):m)}const p=n(d);for(let m=0;m<a;m++){const y=p[e[m]];y!==void 0&&TC(u,m,y)}}}function PU(t){const e=IU(t);if(ll[e]!=null)return e;const n=nc(t);if(!n)return console.warn(`[eval-bridge] No eval-registry entry for '${t}' — getAllCircuitEvals:`,[...WN().keys()]),e;for(;ll.length<=e;)ll.push(null);return ll[e]=BU(n.inputNames,n.outputNames,n.evalFn,n.stateKeys),e}const dm=new Map;function HU(t){if(dm.has(t))return dm.get(t);const e=nc(t);if(!e?.onTickFn)return;const n={inputNames:e.inputNames,stateKeys:e.stateKeys??[],fn:e.onTickFn};return dm.set(t,n),n}function UU(t,e){const n=t.nodes.length,i=new Map,s=new Array(n);for(let $=0;$<n;$++){const q=t.nodes[$];i.set(q.id,$),s[$]=q.id}let a=0;const c=new Uint32Array(n),u=new Uint8Array(n),d=new Uint8Array(n);for(let $=0;$<n;$++){const q=t.nodes[$];c[$]=a,u[$]=q.inputs.length,d[$]=q.outputs.length,a+=q.inputs.length+q.outputs.length}const h=t.topLevelInputs.length,p=t.topLevelOutputs.length,m=a+h+p,y=new Map,b=new Array(m),x=new Uint8Array(m),w=new Uint8Array(m),S=new Array(m);let E=a;for(const $ of t.topLevelInputs){const q=`${Le}.${$.name}`;y.set(q,E),b[E]=q,x[E]=1,w[E]=$.portType.kind==="bus"?1:0,E++}for(const $ of t.topLevelOutputs){const q=`${Le}.${$.name}`;y.set(q,E),b[E]=q,x[E]=0,w[E]=$.portType.kind==="bus"?1:0,E++}for(let $=0;$<n;$++){const q=t.nodes[$];let F=c[$];for(const Q of q.inputs){const B=`${q.id}.${Q.name}`;y.set(B,F),b[F]=B,x[F]=0,w[F]=Q.portType.kind==="bus"?1:0,S[F]=Q.name,F++}for(const Q of q.outputs){const B=`${q.id}.${Q.name}`;y.set(B,F),b[F]=B,x[F]=1;let P=Q.portType.kind==="bus";if(!P){const j=q.arguments.width;if(typeof j=="number"&&j>1&&(P=!0),!P&&q.primitiveType==="Mux"){for(const I of q.inputs)if(I.name!=="sel"&&I.portType.kind==="bus"){P=!0;break}}}w[F]=P?1:0,F++}}const D=new Uint16Array(n);for(let $=0;$<n;$++){const q=t.nodes[$];D[$]=PU(q.primitiveType)}const T=new Array(n);for(let $=0;$<n;$++){const F=t.nodes[$].dependents.map(Q=>i.get(Q)).filter(Q=>Q!==void 0);T[$]=new Uint32Array(F)}const C=new Int32Array(a),R=new Int32Array(a);C.fill(-1),R.fill(-1);for(let $=0;$<n;$++){const q=t.nodes[$],F=c[$];for(let Q=0;Q<q.inputSources.length;Q++){const B=q.inputSources[Q],P=q.inputs.findIndex(I=>I.name===B.portName);if(P===-1)continue;const j=F+P;if(B.sourceNodeId===Le){C[j]=-1;const I=`${Le}.${B.sourcePortName}`;R[j]=y.get(I)??-1}else{const I=i.get(B.sourceNodeId);if(I===void 0)continue;const z=t.nodes[I],U=z.outputs.findIndex(Y=>Y.name===B.sourcePortName);if(U===-1)continue;C[j]=I,R[j]=c[I]+z.inputs.length+U}}}const A=new Uint8Array(n),O=new Uint8Array(n),k=new Uint8Array(n),H=new Uint8Array(n);for(let $=0;$<n;$++){const q=t.nodes[$];A[$]=q.inputs.length===0?1:0;const F=e.resolveCircuit(q.primitiveType);F?.state&&F.state.length>0&&(k[$]=1,O[$]=1);for(const Q of q.inputSources)if(Q.sourceNodeId===Le){H[$]=1;break}}return{nodeCount:n,portCount:m,nodeIdToIndex:i,indexToNodeId:s,portKeyToIndex:y,indexToPortKey:b,primitiveTypeIndex:D,nodePortStart:c,nodeInputCount:u,nodeOutputCount:d,dependents:T,inputSourceNode:C,inputSourcePort:R,inputPortNames:S,portIsOutput:x,portIsBus:w,isSourceNode:A,isStateOutputNode:O,hasState:k,readsTopLevelInput:H,flatCircuit:t}}function hm(t,e){const n=new Array(t.nodeCount),i=new Array(t.nodeCount);for(const[s,a]of e.currentState){const c=t.nodeIdToIndex.get(s);c!==void 0&&(n[c]=a)}for(const[s,a]of e.nextState){const c=t.nodeIdToIndex.get(s);c!==void 0&&(i[c]=a)}return{currentState:n,nextState:i,clocks:e.clocks,cycleCount:e.cycleCount}}function pm(t,e){const n=new Map,i=new Map;for(let s=0;s<t.nodeCount;s++){const a=t.indexToNodeId[s];e.currentState[s]!==void 0&&n.set(a,e.currentState[s]),e.nextState[s]!==void 0&&i.set(a,e.nextState[s])}return{currentState:n,nextState:i,clocks:e.clocks,cycleCount:e.cycleCount}}const AC=1e4,mm=new WeakMap;function $U(t){const e=new Map(t),n=new Proxy(e,{get(i,s){if(typeof s=="string"&&/^\d+$/.test(s))return i.get(Number(s))??0;const a=i[s];return typeof a=="function"?a.bind(i):a},set(i,s,a){return typeof s=="string"&&/^\d+$/.test(s)?(i.set(Number(s),a),!0):!1}});return mm.set(n,e),n}const qU=new Int32Array(64),YU=new Uint8Array(64);function cl(t,e,n,i,s){let a=0;if(s)for(const[u,d]of s){const h=t.portKeyToIndex.get(u);h!==void 0&&(n.values[h]=typeof d=="boolean"?d?1:0:d,n.initialized[h]=1)}const c={circuit:t,values:n,state:i,queue:e,nodeIndex:0,portStart:0,inputCount:0,outputCount:0};for(;!e.isEmpty();){if(++a>AC)throw new Error(`Propagation did not stabilize after ${AC} iterations. Possible unstable feedback loop in circuit.`);const u=e.dequeue(),d=t.nodePortStart[u],h=t.nodeInputCount[u],p=t.nodeOutputCount[u],m=d+h;c.nodeIndex=u,c.portStart=d,c.inputCount=h,c.outputCount=p;const y=p<=64?qU:new Int32Array(p),b=p<=64?YU:new Uint8Array(p);for(let E=0;E<p;E++)y[E]=n.values[m+E],b[E]=n.initialized[m+E];const x=t.primitiveTypeIndex[u],w=ll[x];w?w(c):GU(t,u);let S=!1;for(let E=0;E<p;E++){const D=m+E;if(n.values[D]!==y[E]||n.initialized[D]&&!b[E]){S=!0;break}}S&&e.enqueueAll(t.dependents[u])}return a}function GU(t,e,n,i,s){const a=t.flatCircuit.nodes[e];throw new Error(`Primitive '${a.primitiveType}' has no registered evaluator. Either import '@simten/core/std' to register the standard library, or register the primitive's eval lambda explicitly via registerEvalFunction(). If you constructed a Circuit IR by hand (rather than via circuit()), you must register its evaluator yourself.`)}function ju(t,e){for(let n=0;n<t.nodeCount;n++)(t.isSourceNode[n]||t.isStateOutputNode[n]||t.readsTopLevelInput[n])&&(e.enqueue(n),t.isSourceNode[n],t.isStateOutputNode[n],t.readsTopLevelInput[n])}function XU(t,e){for(let n=0;n<t.nodeCount;n++)t.isStateOutputNode[n]&&e.enqueue(n)}function FU(t,e){for(const[n,i]of e.clocks)i.edge="rising",i.value=!0}function ZU(t,e,n,i){for(let s=0;s<t.nodeCount;s++){if(!t.hasState[s])continue;const a=t.flatCircuit.nodes[s],c=HU(a.primitiveType);if(!c)continue;const u=new Map,d=t.nodePortStart[s],h=t.nodeInputCount[s];for(let w=0;w<h;w++){const S=d+w,E=t.inputSourceNode[S],D=t.inputSourcePort[S],T=t.inputPortNames[S];if(E===-1){if(i&&D>=0){const C=t.indexToPortKey[D],R=i.get(C);R!==void 0&&u.set(T,R)}}else if(D>=0){const C=e.values[D];u.set(T,C)}}if(a.arguments)for(const[w,S]of Object.entries(a.arguments))u.set(`__${w}`,S);const p={};for(const w of a.clocks){const S=`${a.id}.${w.name}`,E=n.clocks.get(S);E&&(p[w.name]=E.edge)}const m=n.currentState[s],y={};for(const[w,S]of u)y[w]=S;if(m!=null&&typeof m=="object"&&!(m instanceof Map))for(const w of c.stateKeys)y[w]=m[w];else m!=null&&c.stateKeys.length===1&&(m instanceof Map?y[c.stateKeys[0]]=$U(m):y[c.stateKeys[0]]=m);const b=c.fn(y);let x=c.stateKeys.length===1?b[c.stateKeys[0]]:b;x!=null&&typeof x=="object"&&mm.has(x)&&(x=mm.get(x)),n.nextState[s]=x}}function KU(t){for(let e=0;e<t.currentState.length;e++){const n=t.nextState[e];n!==void 0&&(n instanceof Map?(t.currentState[e]=new Map(n),t.nextState[e]=new Map(n)):(t.currentState[e]=n,t.nextState[e]=n))}t.cycleCount++}function ul(t,e,n){const i=new Map;if(n)for(const[s,a]of n)i.set(s,a);for(let s=0;s<t.portCount;s++){const a=t.indexToPortKey[s],c=t.portIsOutput[s]===1,u=t.portIsBus[s]===0;let d,h;if(c)d=e.values[s],h=e.initialized[s]!==0;else{const m=t.inputSourcePort[s];m>=0?(d=e.values[m],h=e.initialized[m]!==0):(d=0,h=!1)}h||(d=0);const p=d>1||d<0;i.set(a,u&&!p?d!==0:d)}return i}function QU(t,e,n){for(const[i,s]of n){const a=t.portKeyToIndex.get(i);a!==void 0&&(e.values[a]=typeof s=="boolean"?s?1:0:s,e.initialized[a]=1)}}function zu(t,e,n){for(const i of t.flatCircuit.connections)if(i.target.nodeId===Le||i.target.nodeId===""){const s=`${i.source.nodeId}.${i.source.portName}`,a=t.portKeyToIndex.get(s);if(a!==void 0){const c=`${i.target.nodeId||Le}.${i.target.portName}`,u=t.portIsBus[a]===0,d=e.values[a];n.set(c,u?d!==0:d)}}}class WU{flatCircuit=null;options=null;numericCircuit=null;numericSeqState=null;numericValues=null;eventQueue=null;topLevelInputs=new Map;cachedFlatSeqState=null;cachedPortValues=null;cacheValid=!1;totalTicks=0;totalEvaluations=0;initialize(e,n){this.flatCircuit=e,this.options=n,this.numericCircuit=UU(e,n.componentLibrary);const i=SC(e,n.componentLibrary);this.numericSeqState=hm(this.numericCircuit,i),this.numericValues=EC(this.numericCircuit.portCount),this.eventQueue=new zU(this.numericCircuit.nodeCount),this.topLevelInputs=new Map;for(const s of e.topLevelInputs){const a=`${Le}.${s.name}`,c=s.portType.kind==="bit"?!1:0;this.topLevelInputs.set(a,c)}this.eventQueue.clear(),ju(this.numericCircuit,this.eventQueue),cl(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState,this.topLevelInputs),this.totalTicks=0,this.totalEvaluations=0,this.cacheValid=!1}setNode(e,n){if(!this.flatCircuit||!this.numericCircuit)return;const i=`${Le}.${e}`;if(this.topLevelInputs.has(i)){this.topLevelInputs.set(i,n),this.cacheValid=!1;return}const s=this.flatCircuit.nodes.find(c=>c.id===e)??this.flatCircuit.nodes.find(c=>c.id.endsWith("."+e));if(!s)return;const a=this.numericCircuit.nodeIdToIndex.get(s.id);if(a!==void 0&&this.numericSeqState&&this.numericSeqState.currentState[a]!==void 0){this.numericSeqState.currentState[a]=n,this.cacheValid=!1,this.cachedFlatSeqState=null,n instanceof Map&&this.options&&(this.options.initialMemory||(this.options.initialMemory=new Map),this.options.initialMemory.set(s.id,n));return}(typeof n=="boolean"||typeof n=="number"||typeof n=="string")&&(s.arguments={...s.arguments,value:n},this.cacheValid=!1)}tick(){if(!this.numericCircuit||!this.numericSeqState||!this.numericValues||!this.eventQueue)throw new Error("Simulator not initialized");this.eventQueue.clear(),ju(this.numericCircuit,this.eventQueue);const e=cl(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState,this.topLevelInputs);FU(this.numericCircuit,this.numericSeqState),ZU(this.numericCircuit,this.numericValues,this.numericSeqState,this.topLevelInputs),KU(this.numericSeqState),this.eventQueue.clear(),XU(this.numericCircuit,this.eventQueue);const n=cl(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState,this.topLevelInputs),i=ul(this.numericCircuit,this.numericValues,this.topLevelInputs);zu(this.numericCircuit,this.numericValues,i),this.cachedPortValues=i,this.cachedFlatSeqState=null,this.cacheValid=!0;const s=e+n;this.totalTicks++,this.totalEvaluations+=s;const a=pm(this.numericCircuit,this.numericSeqState);return{portValues:i,sequentialState:a,metrics:{phase1Evals:e,phase2Evals:n,totalEvals:s}}}runCombinational(){if(!this.numericCircuit||!this.numericValues||!this.eventQueue)throw new Error("Simulator not initialized");if(this.cacheValid&&this.cachedPortValues)return{portValues:this.cachedPortValues,metrics:{totalEvals:0}};this.eventQueue.clear(),ju(this.numericCircuit,this.eventQueue);try{cl(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState??void 0,this.topLevelInputs)}catch(n){return{portValues:ul(this.numericCircuit,this.numericValues,this.topLevelInputs),metrics:{totalEvals:0},error:n instanceof Error?n.message:"Unknown error"}}const e=ul(this.numericCircuit,this.numericValues,this.topLevelInputs);return zu(this.numericCircuit,this.numericValues,e),this.cachedPortValues=e,this.cacheValid=!0,{portValues:e,metrics:{totalEvals:0}}}getOutput(e,n){if(!this.numericCircuit||!this.numericValues)return;const i=this.getPortValues(),s=`${e}.${n}`;return i.get(s)}getPortValues(){return!this.numericCircuit||!this.numericValues?new Map:(this.cacheValid||(this.cachedPortValues=ul(this.numericCircuit,this.numericValues,this.topLevelInputs),zu(this.numericCircuit,this.numericValues,this.cachedPortValues),this.cacheValid=!0),this.cachedPortValues)}getState(){return!this.numericCircuit||!this.numericSeqState?null:((!this.cacheValid||!this.cachedFlatSeqState)&&(this.cachedFlatSeqState=pm(this.numericCircuit,this.numericSeqState)),this.cachedFlatSeqState)}snapshot(){if(!this.numericSeqState||!this.numericCircuit||!this.numericValues)throw new Error("No sequential state to snapshot");const e=ul(this.numericCircuit,this.numericValues,this.topLevelInputs);zu(this.numericCircuit,this.numericValues,e);const n=pm(this.numericCircuit,this.numericSeqState);return{portValues:e,sequentialState:n,cycleCount:this.numericSeqState.cycleCount}}restore(e){!this.numericCircuit||!this.numericValues||(this.numericSeqState=hm(this.numericCircuit,e.sequentialState),QU(this.numericCircuit,this.numericValues,e.portValues),this.cacheValid=!1)}reset(){if(!this.flatCircuit||!this.options||!this.numericCircuit)return;const e=SC(this.flatCircuit,this.options.componentLibrary,this.options.initialMemory);this.numericSeqState=hm(this.numericCircuit,e),this.numericValues=EC(this.numericCircuit.portCount),this.eventQueue.clear(),ju(this.numericCircuit,this.eventQueue),cl(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState,this.topLevelInputs),this.totalTicks=0,this.totalEvaluations=0,this.cacheValid=!1}getMetrics(){return{totalTicks:this.totalTicks,totalEvaluations:this.totalEvaluations,avgEvalsPerTick:this.totalTicks>0?this.totalEvaluations/this.totalTicks:0,nodeCount:this.flatCircuit?.nodes.length??0}}}function JU(t,e){const n=new WU;return n.initialize(t,e),n}function t9(t,e){const n=_U(t,e);return JU(n,{componentLibrary:e})}const e9=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n9=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,i)=>i?i.toUpperCase():n.toLowerCase()),MC=t=>{const e=n9(t);return e.charAt(0).toUpperCase()+e.slice(1)},RC=(...t)=>t.filter((e,n,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===n).join(" ").trim(),o9=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var i9={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const r9=N.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:s="",children:a,iconNode:c,...u},d)=>N.createElement("svg",{ref:d,...i9,width:e,height:e,stroke:t,strokeWidth:i?Number(n)*24/Number(e):n,className:RC("lucide",s),...!a&&!o9(u)&&{"aria-hidden":"true"},...u},[...c.map(([h,p])=>N.createElement(h,p)),...Array.isArray(a)?a:[a]]));const Ti=(t,e)=>{const n=N.forwardRef(({className:i,...s},a)=>N.createElement(r9,{ref:a,iconNode:e,className:RC(`lucide-${e9(MC(t))}`,`lucide-${t}`,i),...s}));return n.displayName=MC(t),n};const s9=Ti("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const a9=Ti("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const l9=Ti("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);const c9=Ti("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);const u9=Ti("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);const f9=Ti("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);const d9=Ti("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const h9=Ti("skip-forward",[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]]),kC=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,OC=ex,p9=((t,e)=>n=>{var i;if(e?.variants==null)return OC(t,n?.class,n?.className);const{variants:s,defaultVariants:a}=e,c=Object.keys(s).map(h=>{const p=n?.[h],m=a?.[h];if(p===null)return null;const y=kC(p)||kC(m);return s[h][y]}),u=n&&Object.entries(n).reduce((h,p)=>{let[m,y]=p;return y===void 0||(h[m]=y),h},{}),d=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((h,p)=>{let{class:m,className:y,...b}=p;return Object.entries(b).every(x=>{let[w,S]=x;return Array.isArray(S)?S.includes({...a,...u}[w]):{...a,...u}[w]===S})?[...h,m,y]:h},[]);return OC(t,c,d,n?.class,n?.className)})("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),DC=N.forwardRef(({className:t,variant:e,size:n,...i},s)=>M.jsx("button",{className:Gn(p9({variant:e,size:n,className:t})),ref:s,...i}));DC.displayName="Button";function Os({label:t,icon:e,onClick:n,disabled:i}){return M.jsxs(Sw,{children:[M.jsx(Ew,{asChild:!0,children:M.jsx(DC,{variant:"ghost",size:"icon",onClick:n,disabled:i,"aria-label":t,className:"h-7 w-7 text-muted-foreground disabled:opacity-40 [&_svg]:size-3.5",children:M.jsx(e,{})})}),M.jsx(Cw,{side:"bottom",children:t})]})}function jC({cycle:t,historyLength:e,historyIndex:n,isRunning:i,isViewingPast:s,onStep:a,onRun:c,onPause:u,onReset:d,onStepBack:h,onStepForward:p,onSeek:m,onSpeedChange:y,speed:b=1,maxSpeed:x=100,showScrubber:w,floating:S,chromeless:E}){const D=S?"absolute top-3 left-1/2 -translate-x-1/2 z-10":"",T=E?"flex items-center gap-1.5":"flex items-center gap-1.5 border-t border-border bg-card/95 px-3 py-1.5";return M.jsx(ww,{children:M.jsx("div",{className:D,children:M.jsxs("div",{className:T,children:[M.jsx(Os,{label:"Tick",icon:h9,onClick:a,disabled:i||s}),i?M.jsx(Os,{label:"Pause",icon:u9,onClick:u}):M.jsx(Os,{label:"Run",icon:f9,onClick:c,disabled:s}),M.jsx(Os,{label:"Reset",icon:d9,onClick:d}),y&&M.jsxs("div",{className:"flex items-center gap-2 border-l border-border pl-2 ml-0.5",children:[M.jsx(l9,{className:"h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":!0}),M.jsx("input",{type:"range",min:"1",max:x,value:b,onChange:C=>y(Number(C.target.value)),className:"w-20 h-1 rounded-lg appearance-none cursor-pointer accent-blue-600",disabled:s,"aria-label":"Simulation speed"}),M.jsxs("span",{className:"min-w-[55px] text-[10px] text-muted-foreground font-mono tabular-nums",children:[b," tick/s"]})]}),M.jsx("div",{className:"border-l border-border pl-1.5 ml-0.5",children:M.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["Cycle ",M.jsx("span",{className:"font-mono font-semibold text-foreground",children:t})]})}),e>1&&M.jsxs("div",{className:"flex items-center gap-0.5 border-l border-border pl-1.5 ml-0.5",children:[M.jsx(Os,{label:"Step back",icon:s9,onClick:h,disabled:n<=0||i}),M.jsx("span",{className:"min-w-[40px] text-center text-[11px] text-muted-foreground",children:s?M.jsxs("span",{className:"font-mono text-amber-600 dark:text-amber-400",children:[n+1,"/",e]}):M.jsxs("span",{className:"font-mono",children:[e,"/",e]})}),M.jsx(Os,{label:"Step forward",icon:a9,onClick:p,disabled:!s||i})]}),w&&m&&e>1&&M.jsxs("div",{className:"flex items-center gap-2 border-l border-border pl-2 ml-0.5",children:[M.jsx(c9,{className:"h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":!0}),M.jsx("input",{type:"range",min:"0",max:e-1,value:n,onChange:C=>m(Number(C.target.value)),className:"w-24 h-1 rounded-lg appearance-none cursor-pointer accent-blue-600",disabled:i,"aria-label":"Cycle scrubber"})]})]})})})}function m9({frame:t,componentLibrary:e,onPushLevel:n,theme:i="dark"}){const s=N.useMemo(()=>TU(t.componentDef),[t.componentDef]),a=N.useMemo(()=>vd(s,e.resolveCircuit),[s,e]),c=N.useCallback(P=>{if(!P.isComposite)return;const j=e.resolveCircuit(P.componentRef);j&&j.implementation.kind==="composite"&&j.nodes.length>0&&n(P.componentRef,j,P.label??P.componentRef)},[e,n]),u=sd(),[d,h]=N.useState(new Map),[p,m]=N.useState(!1),y=N.useRef(null),[b,x]=N.useState(0),[w,S]=N.useState(!1),E=N.useRef([]),[D,T]=N.useState(0),[C,R]=N.useState(-1),A=N.useRef("");A.current||(A.current=`drill-${typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2)}`);const O=A.current;N.useEffect(()=>()=>{p&&u.dispose(O).catch(()=>{})},[u,O,p]),N.useEffect(()=>{const P=[],j=new Set;for(const z of e.getAllPrimitiveNames()){const U=e.resolveCircuit(z);U&&!j.has(z)&&(j.add(z),P.push(U))}const I=z=>{for(const U of z.nodes){if(j.has(U.componentRef))continue;const Y=e.resolveCircuit(U.componentRef);Y&&(j.add(U.componentRef),P.push(Y),Y.implementation.kind==="composite"&&I(Y))}};I(s),u.compileIR(s,P,O,{snapshot:a}).then(z=>{if("error"in z){try{const Y=t9(s,e);Y.runCombinational(),y.current=Y,m(!1);const L=new Map;for(const[G,tt]of Y.getPortValues())L.set(G,tt);h(L)}catch(Y){console.warn("[InspectorCanvas] Both sandbox and local failed:",Y)}return}m(!0);const U=new Map;for(const[Y,L]of Object.entries(z.portValues))U.set(Y,L);h(U),E.current=z.snapshotId!==void 0?[{snapshotId:z.snapshotId,cycle:0}]:[],T(E.current.length),R(E.current.length===0?-1:0),x(0)})},[s,e,u,O,a]);const k=N.useCallback(P=>{const j=`${P}.out`,I=d.get(j);u.setNode(P,!I,O).then(z=>{if("error"in z)return;const U=new Map;for(const[Y,L]of Object.entries(z.portValues))U.set(Y,L);h(U)})},[u,d]),H=N.useCallback((P,j)=>{u.setNode(P,j,O).then(I=>{if("error"in I)return;const z=new Map;for(const[U,Y]of Object.entries(I.portValues))z.set(U,Y);h(z)})},[u]),$=N.useCallback(()=>{u.tick(void 0,O,{snapshot:a}).then(P=>{if("error"in P)return;const j=new Map;for(const[I,z]of Object.entries(P.portValues))j.set(I,z);if(h(j),x(P.cycle),P.snapshotId!==void 0){const I=E.current.slice(0,C+1);I.push({snapshotId:P.snapshotId,cycle:P.cycle}),E.current=I,T(I.length),R(I.length-1)}})},[u,O,a,C]),q=N.useCallback(()=>{S(!1),u.reset(O).then(P=>{if("error"in P)return;const j=new Map;for(const[I,z]of Object.entries(P.portValues))j.set(I,z);h(j),x(0),E.current=[],T(0),R(-1),a&&u.snapshot(O).then(I=>{"error"in I||I.snapshotId===void 0||(E.current=[{snapshotId:I.snapshotId,cycle:0}],T(1),R(0))})})},[u,O,a]),F=N.useCallback(P=>{const j=E.current[P];j&&u.restore(j.snapshotId,O).then(I=>{if("error"in I)return;const z=new Map;for(const[U,Y]of Object.entries(I.portValues))z.set(U,Y);h(z),x(j.cycle),R(P)})},[u,O]),Q=N.useCallback(()=>{S(!1),C>0&&F(C-1)},[C,F]),B=N.useCallback(()=>{C<D-1?F(C+1):$()},[C,D,F,$]);return N.useEffect(()=>{if(!w)return;const P=window.setInterval(()=>{$()},200);return()=>window.clearInterval(P)},[w,$]),M.jsxs("div",{className:"relative h-full w-full",children:[a&&M.jsx(jC,{floating:!0,cycle:b,historyLength:D,historyIndex:C,isRunning:w,isViewingPast:C>=0&&C<D-1,onStep:$,onRun:()=>S(!0),onPause:()=>S(!1),onReset:q,onStepBack:Q,onStepForward:B}),M.jsx(zC,{circuit:s,componentLibrary:e,portValues:d,sequentialState:null,onToggleNode:k,onSetNodeValue:H,onNodeDoubleClick:c,nodeTypes:_w,edgeTypes:Nw,theme:i,showControls:!0,height:"100%",panOnMobile:!0})]})}function g9({stack:t,onNavigate:e,theme:n="dark"}){const s=t[t.length-1]?.componentDef.metadata?.description,a=n==="dark";return M.jsxs("div",{className:"flex items-center gap-1 text-sm min-w-0",children:[t.map((c,u)=>M.jsxs(dr.Fragment,{children:[u>0&&M.jsx("span",{className:`${a?"text-gray-500":"text-gray-400"} shrink-0`,children:">"}),u<t.length-1?M.jsxs("button",{onClick:()=>e(u),className:`${a?"text-blue-400 hover:text-blue-300":"text-blue-600 hover:text-blue-800"} hover:underline font-medium shrink-0`,children:[c.nodeLabel," (",c.componentName,")"]}):M.jsxs("span",{className:`font-semibold shrink-0 ${a?"text-gray-100":"text-gray-900"}`,children:[c.nodeLabel," (",c.componentName,")"]})]},u)),s&&M.jsxs(M.Fragment,{children:[M.jsx("span",{className:`${a?"text-gray-600":"text-gray-300"} shrink-0`,children:"—"}),M.jsx("span",{className:`${a?"text-gray-400":"text-gray-500"} text-xs italic truncate`,children:s})]})]})}const y9={enterIn:{opacity:0},enterOut:{opacity:0},center:{opacity:1},exitIn:{opacity:0},exitOut:{opacity:0}};function v9({stack:t,componentLibrary:e,theme:n="dark",onClose:i,onPopLevel:s,onPushLevel:a,onNavigate:c}){const u=t.length>0,d=N.useRef(0),[h,p]=N.useState("in");N.useEffect(()=>{t.length>d.current?p("in"):t.length<d.current&&p("out"),d.current=t.length},[t.length]),N.useEffect(()=>{if(!u)return;const x=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=x}},[u]);const m=N.useCallback(x=>{x.target===x.currentTarget&&i()},[i]),y=N.useCallback(x=>{x.key==="Escape"&&(x.stopPropagation(),t.length>1?s():i())},[t.length,s,i]),b=u?t[t.length-1]:null;return M.jsx(XE,{children:u&&b&&M.jsxs(M.Fragment,{children:[M.jsx(Ou.div,{className:"fixed inset-0 z-50 bg-black/50",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25},onClick:m,onKeyDown:y,tabIndex:-1},"inspector-backdrop"),M.jsx(Ou.div,{className:"fixed inset-0 z-50 flex items-center justify-center p-8 pointer-events-none",children:M.jsxs(Ou.div,{className:`flex h-[80vh] w-full max-w-5xl flex-col rounded-lg shadow-xl pointer-events-auto overflow-hidden ${n==="dark"?"bg-gray-900":"bg-white"}`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[M.jsxs("div",{className:`flex items-center justify-between border-b px-4 py-3 ${n==="dark"?"border-gray-700":"border-gray-200"}`,children:[M.jsx(g9,{stack:t,onNavigate:c,theme:n}),M.jsx("button",{onClick:i,className:`rounded p-1 ${n==="dark"?"text-gray-400 hover:bg-gray-800 hover:text-gray-300":"text-gray-400 hover:bg-gray-100 hover:text-gray-600"}`,"aria-label":"Close inspector",children:M.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:M.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),M.jsx("div",{className:"relative flex-1 overflow-hidden",children:M.jsx(XE,{mode:"wait",initial:!1,children:M.jsx(Ou.div,{className:"absolute inset-0",initial:h==="in"?"enterIn":"enterOut",animate:"center",exit:h==="in"?"exitIn":"exitOut",variants:y9,transition:{duration:.2,ease:"easeInOut"},children:M.jsx(m9,{frame:b,componentLibrary:e,onPushLevel:a,theme:n})},`${t.length}-${b.componentName}`)})})]})},"inspector-dialog")]})})}function b9(){const{fitView:t,zoomIn:e,zoomOut:n}=Ia(),i="bg-[var(--embed-bg-tertiary)] hover:opacity-80 text-[var(--embed-text-secondary)] p-1.5 rounded border border-[var(--embed-border)] transition-colors";return M.jsxs("div",{className:"flex items-center gap-1",children:[M.jsx("button",{onClick:()=>n(),className:i,title:"Zoom out","aria-label":"Zoom out",children:M.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:1.5,children:M.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14"})})}),M.jsx("button",{onClick:()=>e(),className:i,title:"Zoom in","aria-label":"Zoom in",children:M.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:1.5,children:M.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 5v14M5 12h14"})})}),M.jsx("button",{onClick:()=>t({padding:.3}),className:i,title:"Fit view","aria-label":"Fit view",children:M.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:1.5,children:M.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})})]})}let gm=null;function x9(){if(!gm){const t=new Map;gm={resolveCircuit:e=>t.get(e),getAllPrimitiveNames:()=>[...t.entries()].filter(([,e])=>e.implementation.kind==="primitive").map(([e])=>e),addCircuit:e=>{t.set(e.name,e)}}}return gm}function w9({circuit:t,componentLibrary:e,portValues:n,sequentialState:i,draggable:s=!0,layout:a,onToggleNode:c,onSetNodeValue:u,onLoadMemory:d,onNodeDoubleClick:h,height:p="100%",focus:m,className:y,renderEmptyState:b,renderOverlay:x,nodeTypes:w,edgeTypes:S,showControls:E=!0,showPortLabels:D,onPortClick:T,glowUnconnected:C,theme:R,panOnMobile:A=!1,onRequestRemount:O}){const k=m1(),H=R??k,$=z6(),q=w??_w,F=S??Nw,Q=e??x9(),B=N.useMemo(()=>m?new Set(Array.isArray(m)?m:[m]):null,[m]),P=N.useMemo(()=>t?Nj(t):null,[t]),{metadata:j}=j6(a?null:P),I=N.useMemo(()=>{if(!P)return{components:{},connections:{}};if(!a)return j;const mt={};for(const Et of P.nodes){const Vt=Et.label||Et.id,jt=a[Vt]??a[Et.id];jt&&(mt[Et.id]={id:Et.id,position:jt})}return{components:mt,connections:{}}},[P,j,a]),{projectedNodes:z,projectedEdges:U}=N.useMemo(()=>{if(!P)return{projectedNodes:[],projectedEdges:[]};const mt=rL(P,I,Q,n??void 0,i??void 0),Et=mt.nodes.map(Vt=>{const jt=Vt.data,zt=jt?.componentRef,ue={...Vt.data};if(D&&(ue.showPortLabels=!0),C&&(ue.glowUnconnected=!0),T){const Xt=jt.label||jt.componentRef;ue.onPortClick=(xe,Pe)=>T(Xt,xe,Pe)}return zt==="Input"&&u&&(ue.onValueChange=Xt=>u(Vt.id,Xt)),c&&(zt==="Switch"||zt==="Button")&&(ue.onToggle=()=>c(Vt.id)),d&&(zt==="RV32I_InstrMem"||zt==="DualPortROM")&&(ue.onLoadMemory=Xt=>d(Vt.id,Xt)),{...Vt,data:ue}});if(B){const Vt=new Set;for(const jt of Et){const zt=jt.data?.label??jt.id;B.has(zt)&&Vt.add(jt.id)}return{projectedNodes:Et.map(jt=>{const zt=jt.data?.label??jt.id;return{...jt,style:{...jt.style,opacity:B.has(zt)?1:.15,transition:"opacity 0.2s"}}}),projectedEdges:mt.edges.map(jt=>({...jt,style:{...jt.style,opacity:Vt.has(jt.source)||Vt.has(jt.target)?1:.15,transition:"opacity 0.2s"}}))}}return{projectedNodes:Et,projectedEdges:mt.edges}},[P,I,Q,n,i,c,u,d,B,D,T,C]),[Y,L]=N.useState([]),[G,tt]=N.useState([]),{fitView:it}=Ia(),lt=tj(),ht=N.useRef(null),ft=N.useRef(new Set),ut=N.useRef(new Map),dt=N.useRef(0);N.useLayoutEffect(()=>{const mt=ht.current,Et=ft.current,Vt=ut.current,jt=P?.name??null,zt=new Set(z.map(pe=>pe.id)),ue=new Map;for(const pe of z){const re=pe.data,ee=`${(re.inputNames??[]).join("|")}>${(re.outputNames??[]).join("|")}`;ue.set(pe.id,ee)}ht.current=jt,ft.current=zt,ut.current=ue;const Xt=jt!==mt;let xe=0;for(const pe of zt)Et.has(pe)&&xe++;const Pe=Math.max(Et.size,zt.size),Po=Pe>0&&xe/Pe<.5,Ae=Xt||Po,So=[];if(!Ae)for(const[pe,re]of ue){const ee=Vt.get(pe);ee!==void 0&&ee!==re&&So.push(pe)}const _i=dt.current===0;dt.current=z.length,L(pe=>{const re=new Map(pe.map(ee=>[ee.id,ee]));return z.map(ee=>{const Ee=re.get(ee.id);return Ee&&!Ae?{...Ee,type:ee.type,data:ee.data,selectable:ee.selectable,deletable:ee.deletable}:ee})}),tt(U),Ae&&Et.size>0?O?.():So.length>0&&requestAnimationFrame(()=>lt(So)),z.length>0&&_i&&!Ae&&requestAnimationFrame(()=>it({padding:.3}))},[z,U]);const Mt=N.useCallback(mt=>{L(Et=>ub(mt,Et))},[]),[Nt,bt]=N.useState([]),Tt=N.useCallback((mt,Et,Vt)=>{bt(jt=>[...jt,{componentName:mt,componentDef:Et,nodeLabel:Vt}])},[]),Dt=N.useCallback(()=>{bt(mt=>mt.slice(0,-1))},[]),qt=N.useCallback(()=>{bt([])},[]),Ht=N.useCallback(mt=>{bt(Et=>Et.slice(0,mt+1))},[]),pt=N.useCallback(mt=>{if(!mt.isComposite)return;const Et=Q.resolveCircuit(mt.componentRef);Et&&Et.implementation.kind==="composite"&&Et.nodes.length>0&&bt([{componentName:mt.componentRef,componentDef:Et,nodeLabel:mt.label??mt.componentRef}])},[Q]),gt=h??pt,yt=N.useCallback((mt,Et)=>{gt(Et.data)},[gt]);return M.jsxs("div",{"data-embed-theme":H,className:`bg-[var(--embed-bg-primary)] overflow-hidden relative ${y??""}`,style:{height:p},"aria-label":"Circuit diagram",children:[M.jsxs(J5,{nodes:Y,edges:G,nodeTypes:q,edgeTypes:F,onNodesChange:Mt,onNodeDoubleClick:yt,fitView:!0,minZoom:.1,maxZoom:3,fitViewOptions:{padding:.3,...B&&{nodes:Y.filter(mt=>{const Et=mt.data?.label??mt.id;return B.has(Et)})}},nodesDraggable:s&&!$,nodesConnectable:!1,elementsSelectable:!0,selectionOnDrag:!1,panOnDrag:$&&!A?!1:[1,2],zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!1,preventScrolling:!1,proOptions:{hideAttribution:!0},deleteKeyCode:null,panActivationKeyCode:null,children:[M.jsx(rj,{variant:jo.Dots,gap:20,size:1,color:"var(--embed-dot-color)"}),E&&M.jsx(Va,{position:"bottom-left",children:M.jsx(b9,{})})]}),x?.(),!t&&(b?b():M.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-[var(--embed-text-muted)]",children:"No circuit"})),!h&&Nt.length>0&&M.jsx(v9,{stack:Nt,componentLibrary:Q,theme:H,onClose:qt,onPopLevel:Dt,onPushLevel:Tt,onNavigate:Ht})]})}function zC(t){const[e,n]=N.useState(0),i=N.useCallback(()=>{n(s=>s+1)},[]);return M.jsx(Zb,{children:M.jsx(w9,{...t,onRequestRemount:i})},e)}const S9=N.forwardRef(function({circuit:e,height:n=300,showControls:i=!0,autoHarness:s=!1,initialInputs:a,layout:c,theme:u,focus:d,showPortLabels:h,onPortClick:p,glowUnconnected:m,renderEmptyState:y,renderOverlay:b,onPortValuesChange:x},w){const S=SM(e,{autoHarness:s,initialInputs:a}),E=m1(),D=u??E,T=N.useRef(x);N.useEffect(()=>{T.current=x}),N.useEffect(()=>{!S.ready||!S.portValues||S.portValues.size===0||T.current?.(S.portValues)},[S.ready,S.portValues]);const C=N.useCallback(()=>{S.tick()},[S.tick]),R=N.useCallback(()=>{S.reset()},[S.reset]);if(N.useImperativeHandle(w,()=>({tick:C,reset:R,setNodeValue:S.setNodeValue,startAutoRun:S.startAutoRun,stopAutoRun:S.stopAutoRun}),[C,R,S.setNodeValue,S.startAutoRun,S.stopAutoRun]),S.error)return M.jsx("div",{style:{height:n},className:"flex items-center justify-center p-4",children:M.jsxs("div",{className:"text-sm text-red-400 bg-red-500/10 rounded p-3 border border-red-500/20",children:[M.jsx("div",{className:"font-medium mb-1",children:"Compilation Error"}),M.jsx("div",{className:"font-mono text-xs",children:S.error})]})});if(!S.ready)return M.jsx("div",{style:{height:n},className:"flex items-center justify-center text-muted-foreground/60 text-sm",children:"Compiling..."});const A=S.isSequential&&i?40:0,O=typeof n=="number"?n-A:n;return M.jsxs("div",{style:{height:n},className:"flex flex-col","data-embed-theme":D,children:[M.jsx("div",{className:"flex-1 min-h-0",children:M.jsx(zC,{circuit:S.circuit,componentLibrary:S.componentLibrary??void 0,portValues:S.portValues,sequentialState:S.sequentialState,onToggleNode:S.toggleNode,onSetNodeValue:S.setNodeValue,onLoadMemory:(k,H)=>{const $=S.getSimulator();$&&($.setNode(k,H),S.runCombinational())},height:O,focus:d,showPortLabels:h,onPortClick:p,glowUnconnected:m,renderEmptyState:y,renderOverlay:b,...c?{layout:c}:{},...u?{theme:u}:{}})}),S.isSequential&&i&&M.jsx(jC,{cycle:S.cycleCount,historyLength:S.history?.length??0,historyIndex:S.historyIndex??-1,isRunning:S.isRunning,isViewingPast:S.isViewingPast??!1,onStep:C,onRun:()=>S.startAutoRun(5),onPause:()=>S.stopAutoRun(),onReset:R,onStepBack:()=>S.stepBack(),onStepForward:()=>{S.isViewingPast?S.stepForward():C()},speed:5})]})});var ym={exports:{}},VC;function E9(){return VC||(VC=1,(function(t){var e=(function(){var n=String.fromCharCode,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",a={};function c(d,h){if(!a[d]){a[d]={};for(var p=0;p<d.length;p++)a[d][d.charAt(p)]=p}return a[d][h]}var u={compressToBase64:function(d){if(d==null)return"";var h=u._compress(d,6,function(p){return i.charAt(p)});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"="}},decompressFromBase64:function(d){return d==null?"":d==""?null:u._decompress(d.length,32,function(h){return c(i,d.charAt(h))})},compressToUTF16:function(d){return d==null?"":u._compress(d,15,function(h){return n(h+32)})+" "},decompressFromUTF16:function(d){return d==null?"":d==""?null:u._decompress(d.length,16384,function(h){return d.charCodeAt(h)-32})},compressToUint8Array:function(d){for(var h=u.compress(d),p=new Uint8Array(h.length*2),m=0,y=h.length;m<y;m++){var b=h.charCodeAt(m);p[m*2]=b>>>8,p[m*2+1]=b%256}return p},decompressFromUint8Array:function(d){if(d==null)return u.decompress(d);for(var h=new Array(d.length/2),p=0,m=h.length;p<m;p++)h[p]=d[p*2]*256+d[p*2+1];var y=[];return h.forEach(function(b){y.push(n(b))}),u.decompress(y.join(""))},compressToEncodedURIComponent:function(d){return d==null?"":u._compress(d,6,function(h){return s.charAt(h)})},decompressFromEncodedURIComponent:function(d){return d==null?"":d==""?null:(d=d.replace(/ /g,"+"),u._decompress(d.length,32,function(h){return c(s,d.charAt(h))}))},compress:function(d){return u._compress(d,16,function(h){return n(h)})},_compress:function(d,h,p){if(d==null)return"";var m,y,b={},x={},w="",S="",E="",D=2,T=3,C=2,R=[],A=0,O=0,k;for(k=0;k<d.length;k+=1)if(w=d.charAt(k),Object.prototype.hasOwnProperty.call(b,w)||(b[w]=T++,x[w]=!0),S=E+w,Object.prototype.hasOwnProperty.call(b,S))E=S;else{if(Object.prototype.hasOwnProperty.call(x,E)){if(E.charCodeAt(0)<256){for(m=0;m<C;m++)A=A<<1,O==h-1?(O=0,R.push(p(A)),A=0):O++;for(y=E.charCodeAt(0),m=0;m<8;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1}else{for(y=1,m=0;m<C;m++)A=A<<1|y,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=0;for(y=E.charCodeAt(0),m=0;m<16;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1}D--,D==0&&(D=Math.pow(2,C),C++),delete x[E]}else for(y=b[E],m=0;m<C;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1;D--,D==0&&(D=Math.pow(2,C),C++),b[S]=T++,E=String(w)}if(E!==""){if(Object.prototype.hasOwnProperty.call(x,E)){if(E.charCodeAt(0)<256){for(m=0;m<C;m++)A=A<<1,O==h-1?(O=0,R.push(p(A)),A=0):O++;for(y=E.charCodeAt(0),m=0;m<8;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1}else{for(y=1,m=0;m<C;m++)A=A<<1|y,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=0;for(y=E.charCodeAt(0),m=0;m<16;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1}D--,D==0&&(D=Math.pow(2,C),C++),delete x[E]}else for(y=b[E],m=0;m<C;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1;D--,D==0&&(D=Math.pow(2,C),C++)}for(y=2,m=0;m<C;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1;for(;;)if(A=A<<1,O==h-1){R.push(p(A));break}else O++;return R.join("")},decompress:function(d){return d==null?"":d==""?null:u._decompress(d.length,32768,function(h){return d.charCodeAt(h)})},_decompress:function(d,h,p){var m=[],y=4,b=4,x=3,w="",S=[],E,D,T,C,R,A,O,k={val:p(0),position:h,index:1};for(E=0;E<3;E+=1)m[E]=E;for(T=0,R=Math.pow(2,2),A=1;A!=R;)C=k.val&k.position,k.position>>=1,k.position==0&&(k.position=h,k.val=p(k.index++)),T|=(C>0?1:0)*A,A<<=1;switch(T){case 0:for(T=0,R=Math.pow(2,8),A=1;A!=R;)C=k.val&k.position,k.position>>=1,k.position==0&&(k.position=h,k.val=p(k.index++)),T|=(C>0?1:0)*A,A<<=1;O=n(T);break;case 1:for(T=0,R=Math.pow(2,16),A=1;A!=R;)C=k.val&k.position,k.position>>=1,k.position==0&&(k.position=h,k.val=p(k.index++)),T|=(C>0?1:0)*A,A<<=1;O=n(T);break;case 2:return""}for(m[3]=O,D=O,S.push(O);;){if(k.index>d)return"";for(T=0,R=Math.pow(2,x),A=1;A!=R;)C=k.val&k.position,k.position>>=1,k.position==0&&(k.position=h,k.val=p(k.index++)),T|=(C>0?1:0)*A,A<<=1;switch(O=T){case 0:for(T=0,R=Math.pow(2,8),A=1;A!=R;)C=k.val&k.position,k.position>>=1,k.position==0&&(k.position=h,k.val=p(k.index++)),T|=(C>0?1:0)*A,A<<=1;m[b++]=n(T),O=b-1,y--;break;case 1:for(T=0,R=Math.pow(2,16),A=1;A!=R;)C=k.val&k.position,k.position>>=1,k.position==0&&(k.position=h,k.val=p(k.index++)),T|=(C>0?1:0)*A,A<<=1;m[b++]=n(T),O=b-1,y--;break;case 2:return S.join("")}if(y==0&&(y=Math.pow(2,x),x++),m[O])w=m[O];else if(O===b)w=D+D.charAt(0);else return null;S.push(w),m[b++]=D+w.charAt(0),y--,D=w,y==0&&(y=Math.pow(2,x),x++)}}};return u})();t!=null?t.exports=e:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return e})})(ym)),ym.exports}var C9=E9();function T9(t){return C9.compressToEncodedURIComponent(t)}const _9=N.createContext(null);function N9(){return N.useContext(_9)}function LC(){return typeof window>"u"?"https://simten.dev":window.location.hostname==="localhost"?window.location.origin:"https://simten.dev"}const A9=160,M9=90;function R9(t){if(!t)return 1.5;const e=Object.values(t);if(e.length===0)return 1.5;const n=Math.max(...e.map(s=>s.x))+A9,i=Math.max(...e.map(s=>s.y))+M9;return n<=0||i<=0?1.5:n/i}const k9=N.forwardRef(function({circuit:e,height:n,aspectRatio:i,showControls:s=!0,layout:a,theme:c,title:u,subtitle:d,description:h,href:p,focus:m,showPortLabels:y,onPortClick:b,glowUnconnected:x,autoRunSpeed:w=500,initialInputs:S,forkSource:E,onPortValuesChange:D},T){const C=u||h,[R,A]=N.useState(null),[O,k]=N.useState(!1),H=N9(),$=async()=>{if(!O)try{const j=E??fM(e);if(H){k(!0);const{hash:I}=await H(j);window.open(`${LC()}/circuit/s/${I}`,"_blank","noopener")}else{const I=T9(j);window.open(`${LC()}/circuit/${I}`,"_blank","noopener")}}catch(j){A(j instanceof Error?j.message:"Couldn't fork this circuit"),setTimeout(()=>A(null),3e3)}finally{k(!1)}},q=n===void 0,F=i??R9(a),Q={width:"100%",aspectRatio:String(F),minHeight:240,maxHeight:"70vh"},B=C?void 0:q?Q:{height:n},P=C?q?Q:{height:n}:{height:"100%"};return M.jsxs("div",{style:B,className:`relative flex flex-col ${C?"rounded-xl border border-[var(--embed-border)] overflow-hidden bg-[var(--embed-bg-secondary)]":""}`,children:[!C&&!p&&M.jsx("button",{type:"button",onClick:$,title:R??"Open and modify this circuit in the Simten editor",className:"absolute top-2 right-2 z-10 hidden md:flex items-center px-2.5 py-1 rounded border border-[var(--embed-border)] bg-[var(--embed-bg-secondary)] text-[11px] text-[var(--embed-text-primary)] hover:opacity-80 transition-colors shadow-sm",children:R?"Fork failed":"Fork →"}),M.jsx("div",{style:P,className:"min-h-0",children:M.jsx(S9,{ref:T,circuit:e,height:"100%",showControls:s,autoHarness:!0,initialInputs:S,layout:a,theme:c,focus:m,showPortLabels:y,onPortClick:b,glowUnconnected:x,autoRunSpeed:w,onPortValuesChange:D})}),C&&M.jsxs("div",{className:"border-t border-[var(--embed-border)] px-4 py-3 flex items-end justify-between gap-4",children:[M.jsxs("div",{children:[M.jsx("div",{className:"text-base font-semibold text-[var(--embed-text-primary)]",children:u}),d&&M.jsx("div",{className:"text-xs text-[var(--embed-text-muted)] font-mono mt-0.5",children:d}),h&&M.jsx("div",{className:"text-sm text-[var(--embed-text-secondary)] mt-1.5 leading-relaxed",children:h})]}),p?M.jsx("a",{href:p,className:"shrink-0 px-3 py-1.5 rounded border border-[var(--embed-border)] text-xs text-[var(--embed-text-primary)] hover:opacity-80 transition-colors",children:"Open →"}):M.jsx("button",{type:"button",onClick:$,title:R??"Open and modify this circuit in the Simten editor",className:"hidden md:flex items-center shrink-0 px-3 py-1.5 rounded border border-[var(--embed-border)] text-xs text-[var(--embed-text-primary)] hover:opacity-80 transition-colors",children:R?`Can't fork: ${R.slice(0,40)}`:"Fork →"})]})]})});function O9({code:t,height:e,showControls:n,title:i,subtitle:s,description:a,href:c,autoRunSpeed:u,theme:d}){const h=sd(),[p,m]=N.useState(null),[y,b]=N.useState(null);return N.useEffect(()=>{if(!t){m(null),b(null);return}let x=!1;return h.compile(t).then(w=>{if(x)return;if("error"in w){b(w.error),m(null);return}const S=w.circuits[w.circuits.length-1];if(!S){b("No circuit found in code"),m(null);return}b(null),m(cM(S,w.libraryCircuits))}),()=>{x=!0}},[t,h]),t?y?M.jsx("div",{style:{height:e},className:"flex items-center justify-center p-4",children:M.jsxs("div",{className:"text-sm text-red-400 bg-red-500/10 rounded p-3 border border-red-500/20",children:[M.jsx("div",{className:"font-medium mb-1",children:"Error"}),M.jsx("div",{className:"font-mono text-xs whitespace-pre-wrap",children:y})]})}):p?M.jsx("div",{"data-embed-theme":d??"dark",children:M.jsx(k9,{circuit:p,height:e,showControls:n,title:i,subtitle:s,description:a,href:c,forkSource:t,autoRunSpeed:u,theme:d})}):M.jsx("div",{style:{height:e},className:"flex items-center justify-center text-sm text-gray-500",children:"Compiling..."}):M.jsx("div",{style:{height:e},className:"flex items-center justify-center text-sm text-gray-500",children:"No circuit code provided"})}function D9(t){return M.jsx(XN,{children:M.jsx(O9,{...t})})}const IC=HN(D9,{props:{code:"string",height:"number",showControls:"boolean",title:"string",subtitle:"string",description:"string",href:"string",autoRunSpeed:"number",theme:"string"}});return customElements.get("circuit-embed")||customElements.define("circuit-embed",IC),Zf.CircuitEmbedWC=IC,Object.defineProperty(Zf,Symbol.toStringTag,{value:"Module"}),Zf})({});
|
|
76
|
+
`),()=>{R.contains(E)&&R.removeChild(E)}},[e]),M.jsx(EH,{isPresent:e,childRef:u,sizeRef:d,pop:a,children:a===!1?t:N.cloneElement(t,{ref:m})})}const TH=({children:t,initial:e,isPresent:n,onExitComplete:o,custom:s,presenceAffectsLayout:a,mode:l,anchorX:u,anchorY:d,root:h})=>{const p=Bh(NH),m=N.useId();let y=!0,b=N.useMemo(()=>(y=!1,{id:m,initial:e,isPresent:n,custom:s,onExitComplete:x=>{p.set(x,!0);for(const w of p.values())if(!w)return;o&&o()},register:x=>(p.set(x,!1),()=>p.delete(x))}),[n,p,o]);return a&&y&&(b={...b}),N.useMemo(()=>{p.forEach((x,w)=>p.set(w,!1))},[n]),N.useEffect(()=>{!n&&!p.size&&o&&o()},[n]),t=M.jsx(CH,{pop:l==="popLayout",isPresent:n,anchorX:u,anchorY:d,root:h,children:t}),M.jsx(Yc.Provider,{value:b,children:t})};function NH(){return new Map}function qS(t=!0){const e=N.useContext(Yc);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:o,register:s}=e,a=N.useId();N.useEffect(()=>{if(t)return s(a)},[t]);const l=N.useCallback(()=>t&&o&&o(a),[a,o,t]);return!n&&o?[!1,l]:[!0]}const cu=t=>t.key||"";function GS(t){const e=[];return N.Children.forEach(t,n=>{N.isValidElement(n)&&e.push(n)}),e}const FS=({children:t,custom:e,initial:n=!0,onExitComplete:o,presenceAffectsLayout:s=!0,mode:a="sync",propagate:l=!1,anchorX:u="left",anchorY:d="top",root:h})=>{const[p,m]=qS(l),y=N.useMemo(()=>GS(t),[t]),b=l&&!p?[]:y.map(cu),x=N.useRef(!0),w=N.useRef(y),_=Bh(()=>new Map),S=N.useRef(new Set),[k,C]=N.useState(y),[E,R]=N.useState(y);y1(()=>{x.current=!1,w.current=y;for(let D=0;D<E.length;D++){const U=cu(E[D]);b.includes(U)?(_.delete(U),S.current.delete(U)):_.get(U)!==!0&&_.set(U,!1)}},[E,b.length,b.join("-")]);const A=[];if(y!==k){let D=[...y];for(let U=0;U<E.length;U++){const q=E[U],Y=cu(q);b.includes(Y)||(D.splice(U,0,q),A.push(q))}return a==="wait"&&A.length&&(D=A),R(GS(D)),C(y),null}const{forceRender:O}=N.useContext(Ph);return M.jsx(M.Fragment,{children:E.map(D=>{const U=cu(D),q=l&&!p?!1:y===E||b.includes(U),Y=()=>{if(S.current.has(U))return;if(S.current.add(U),_.has(U))_.set(U,!0);else return;let K=!0;_.forEach(W=>{W||(K=!1)}),K&&(O?.(),R(w.current),l&&m?.(),o&&o())};return M.jsx(TH,{isPresent:q,initial:!x.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:a,root:h,onExitComplete:q?void 0:Y,anchorX:u,anchorY:d,children:D},U)})})},XS=N.createContext({strict:!1}),ZS={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let KS=!1;function AH(){if(KS)return;const t={};for(const e in ZS)t[e]={isEnabled:n=>ZS[e].some(o=>!!n[o])};$_(t),KS=!0}function QS(){return AH(),pB()}function MH(t){const e=QS();for(const n in t)e[n]={...e[n],...t[n]};$_(e)}const RH=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function uu(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||RH.has(t)}let WS=t=>!uu(t);function kH(t){typeof t=="function"&&(WS=e=>e.startsWith("on")?!uu(e):t(e))}try{kH(require("@emotion/is-prop-valid").default)}catch{}function OH(t,e,n){const o={};for(const s in t)s==="values"&&typeof t.values=="object"||(WS(s)||n===!0&&uu(s)||!e&&!uu(s)||t.draggable&&s.startsWith("onDrag"))&&(o[s]=t[s]);return o}const fu=N.createContext({});function DH(t,e){if(iu(t)){const{initial:n,animate:o}=t;return{initial:n===!1||Ra(n)?n:void 0,animate:Ra(o)?o:void 0}}return t.inherit!==!1?e:{}}function jH(t){const{initial:e,animate:n}=DH(t,N.useContext(fu));return N.useMemo(()=>({initial:e,animate:n}),[JS(e),JS(n)])}function JS(t){return Array.isArray(t)?t.join(" "):t}const Fp=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function t2(t,e,n){for(const o in e)!$e(e[o])&&!nS(o,n)&&(t[o]=e[o])}function zH({transformTemplate:t},e){return N.useMemo(()=>{const n=Fp();return Bp(n,e,t),Object.assign({},n.vars,n.style)},[e])}function VH(t,e){const n=t.style||{},o={};return t2(o,n,t),Object.assign(o,zH(t,e)),o}function LH(t,e){const n={},o=VH(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,o.userSelect=o.WebkitUserSelect=o.WebkitTouchCallout="none",o.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=o,n}const e2=()=>({...Fp(),attrs:{}});function IH(t,e,n,o){const s=N.useMemo(()=>{const a=e2();return iS(a,e,rS(o),t.transformTemplate,t.style),{...a.attrs,style:{...a.style}}},[e]);if(t.style){const a={};t2(a,t.style,t),s.style={...a,...s.style}}return s}const PH=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function Xp(t){return typeof t!="string"||t.includes("-")?!1:!!(PH.indexOf(t)>-1||/[A-Z]/u.test(t))}function BH(t,e,n,{latestValues:o},s,a=!1,l){const d=(l??Xp(t)?IH:LH)(e,o,s,t),h=OH(e,typeof t=="string",a),p=t!==N.Fragment?{...h,...d,ref:n}:{},{children:m}=e,y=N.useMemo(()=>$e(m)?m.get():m,[m]);return N.createElement(t,{...p,children:y})}function HH({scrapeMotionValuesFromProps:t,createRenderState:e},n,o,s){return{latestValues:UH(n,o,s,t),renderState:e()}}function UH(t,e,n,o){const s={},a=o(t,{});for(const y in a)s[y]=au(a[y]);let{initial:l,animate:u}=t;const d=iu(t),h=B_(t);e&&h&&!d&&t.inherit!==!1&&(l===void 0&&(l=e.initial),u===void 0&&(u=e.animate));let p=n?n.initial===!1:!1;p=p||l===!1;const m=p?u:l;if(m&&typeof m!="boolean"&&!nu(m)){const y=Array.isArray(m)?m:[m];for(let b=0;b<y.length;b++){const x=wp(t,y[b]);if(x){const{transitionEnd:w,transition:_,...S}=x;for(const k in S){let C=S[k];if(Array.isArray(C)){const E=p?C.length-1:0;C=C[E]}C!==null&&(s[k]=C)}for(const k in w)s[k]=w[k]}}}return s}const n2=t=>(e,n)=>{const o=N.useContext(fu),s=N.useContext(Yc),a=()=>HH(t,e,o,s);return n?a():Bh(a)},$H=n2({scrapeMotionValuesFromProps:Up,createRenderState:Fp}),YH=n2({scrapeMotionValuesFromProps:sS,createRenderState:e2}),qH=Symbol.for("motionComponentSymbol");function GH(t,e,n){const o=N.useRef(n);N.useInsertionEffect(()=>{o.current=n});const s=N.useRef(null);return N.useCallback(a=>{a&&t.onMount?.(a),e&&(a?e.mount(a):e.unmount());const l=o.current;if(typeof l=="function")if(a){const u=l(a);typeof u=="function"&&(s.current=u)}else s.current?(s.current(),s.current=null):l(a);else l&&(l.current=a)},[e])}const i2=N.createContext({});function Jr(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function FH(t,e,n,o,s,a){const{visualElement:l}=N.useContext(fu),u=N.useContext(XS),d=N.useContext(Yc),h=N.useContext(Gp),p=h.reducedMotion,m=h.skipAnimations,y=N.useRef(null),b=N.useRef(!1);o=o||u.renderer,!y.current&&o&&(y.current=o(t,{visualState:e,parent:l,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:p,skipAnimations:m,isSVG:a}),b.current&&y.current&&(y.current.manuallyAnimateOnMount=!0));const x=y.current,w=N.useContext(i2);x&&!x.projection&&s&&(x.type==="html"||x.type==="svg")&&XH(y.current,n,s,w);const _=N.useRef(!1);N.useInsertionEffect(()=>{x&&_.current&&x.update(n,d)});const S=n[b_],k=N.useRef(!!S&&!window.MotionHandoffIsComplete?.(S)&&window.MotionHasOptimisedAnimation?.(S));return y1(()=>{b.current=!0,x&&(_.current=!0,window.MotionIsMounted=!0,x.updateFeatures(),x.scheduleRenderMicrotask(),k.current&&x.animationState&&x.animationState.animateChanges())}),N.useEffect(()=>{x&&(!k.current&&x.animationState&&x.animationState.animateChanges(),k.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(S)}),k.current=!1),x.enteringChildren=void 0)}),x}function XH(t,e,n,o){const{layoutId:s,layout:a,drag:l,dragConstraints:u,layoutScroll:d,layoutRoot:h,layoutCrossfade:p}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:o2(t.parent)),t.projection.setOptions({layoutId:s,layout:a,alwaysMeasureLayout:!!l||u&&Jr(u),visualElement:t,animationType:typeof a=="string"?a:"both",initialPromotionConfig:o,crossfade:p,layoutScroll:d,layoutRoot:h})}function o2(t){if(t)return t.options.allowProjection!==!1?t.projection:o2(t.parent)}function Zp(t,{forwardMotionProps:e=!1,type:n}={},o,s){o&&MH(o);const a=n?n==="svg":Xp(t),l=a?YH:$H;function u(h,p){let m;const y={...N.useContext(Gp),...h,layoutId:ZH(h)},{isStatic:b}=y,x=jH(h),w=l(h,b);if(!b&&g1){KH();const _=QH(y);m=_.MeasureLayout,x.visualElement=FH(t,w,y,s,_.ProjectionNode,a)}return M.jsxs(fu.Provider,{value:x,children:[m&&x.visualElement?M.jsx(m,{visualElement:x.visualElement,...y}):null,BH(t,h,GH(w,x.visualElement,p),w,b,e,a)]})}u.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const d=N.forwardRef(u);return d[qH]=t,d}function ZH({layoutId:t}){const e=N.useContext(Ph).id;return e&&t!==void 0?e+"-"+t:t}function KH(t,e){N.useContext(XS).strict}function QH(t){const e=QS(),{drag:n,layout:o}=e;if(!n&&!o)return{};const s={...n,...o};return{MeasureLayout:n?.isEnabled(t)||o?.isEnabled(t)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function WH(t,e){if(typeof Proxy>"u")return Zp;const n=new Map,o=(a,l)=>Zp(a,l,t,e),s=(a,l)=>o(a,l);return new Proxy(s,{get:(a,l)=>l==="create"?o:(n.has(l)||n.set(l,Zp(l,void 0,t,e)),n.get(l))})}const JH=(t,e)=>e.isSVG??Xp(t)?new kB(e):new CB(e,{allowProjection:t!==N.Fragment});class tU extends to{constructor(e){super(e),e.animationState||(e.animationState=VB(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();nu(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let eU=0;class nU extends to{constructor(){super(...arguments),this.id=eU++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:o}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===o)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const iU={animation:{Feature:tU},exit:{Feature:nU}};function ja(t){return{point:{x:t.pageX,y:t.pageY}}}const oU=t=>e=>kp(e)&&t(e,ja(e));function za(t,e,n,o){return Da(t,e,oU(n),o)}const r2=({current:t})=>t?t.ownerDocument.defaultView:null,s2=(t,e)=>Math.abs(t-e);function rU(t,e){const n=s2(t.x,e.x),o=s2(t.y,e.y);return Math.sqrt(n**2+o**2)}const a2=new Set(["auto","scroll"]);class l2{constructor(e,n,{transformPagePoint:o,contextWindow:s=window,dragSnapToOrigin:a=!1,distanceThreshold:l=3,element:u}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=b=>{this.handleScroll(b.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=Qp(this.lastMoveEventInfo,this.history),x=this.startEvent!==null,w=rU(b.offset,{x:0,y:0})>=this.distanceThreshold;if(!x&&!w)return;const{point:_}=b,{timestamp:S}=Le;this.history.push({..._,timestamp:S});const{onStart:k,onMove:C}=this.handlers;x||(k&&k(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),C&&C(this.lastMoveEvent,b)},this.handlePointerMove=(b,x)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=Kp(x,this.transformPagePoint),re.update(this.updatePoint,!0)},this.handlePointerUp=(b,x)=>{this.end();const{onEnd:w,onSessionEnd:_,resumeAnimation:S}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&S&&S(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const k=Qp(b.type==="pointercancel"?this.lastMoveEventInfo:Kp(x,this.transformPagePoint),this.history);this.startEvent&&w&&w(b,k),_&&_(b,k)},!kp(e))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=o,this.distanceThreshold=l,this.contextWindow=s||window;const d=ja(e),h=Kp(d,this.transformPagePoint),{point:p}=h,{timestamp:m}=Le;this.history=[{...p,timestamp:m}];const{onSessionStart:y}=n;y&&y(e,Qp(h,this.history)),this.removeListeners=wa(za(this.contextWindow,"pointermove",this.handlePointerMove),za(this.contextWindow,"pointerup",this.handlePointerUp),za(this.contextWindow,"pointercancel",this.handlePointerUp)),u&&this.startScrollTracking(u)}startScrollTracking(e){let n=e.parentElement;for(;n;){const o=getComputedStyle(n);(a2.has(o.overflowX)||a2.has(o.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const o=e===window,s=o?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a={x:s.x-n.x,y:s.y-n.y};a.x===0&&a.y===0||(o?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(e,s),re.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Qi(this.updatePoint)}}function Kp(t,e){return e?{point:e(t.point)}:t}function c2(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Qp({point:t},e){return{point:t,delta:c2(t,u2(e)),offset:c2(t,sU(e)),velocity:aU(e,.1)}}function sU(t){return t[0]}function u2(t){return t[t.length-1]}function aU(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,o=null;const s=u2(t);for(;n>=0&&(o=t[n],!(s.timestamp-o.timestamp>Ln(e)));)n--;if(!o)return{x:0,y:0};o===t[0]&&t.length>2&&s.timestamp-o.timestamp>Ln(e)*2&&(o=t[1]);const a=bn(s.timestamp-o.timestamp);if(a===0)return{x:0,y:0};const l={x:(s.x-o.x)/a,y:(s.y-o.y)/a};return l.x===1/0&&(l.x=0),l.y===1/0&&(l.y=0),l}function lU(t,{min:e,max:n},o){return e!==void 0&&t<e?t=o?he(e,t,o.min):Math.max(t,e):n!==void 0&&t>n&&(t=o?he(n,t,o.max):Math.min(t,n)),t}function f2(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function cU(t,{top:e,left:n,bottom:o,right:s}){return{x:f2(t.x,n,s),y:f2(t.y,e,o)}}function d2(t,e){let n=e.min-t.min,o=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,o]=[o,n]),{min:n,max:o}}function uU(t,e){return{x:d2(t.x,e.x),y:d2(t.y,e.y)}}function fU(t,e){let n=.5;const o=Ge(t),s=Ge(e);return s>o?n=_a(e.min,e.max-o,t.min):o>s&&(n=_a(t.min,t.max-s,e.min)),ni(0,1,n)}function dU(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Wp=.35;function hU(t=Wp){return t===!1?t=0:t===!0&&(t=Wp),{x:h2(t,"left","right"),y:h2(t,"top","bottom")}}function h2(t,e,n){return{min:p2(t,e),max:p2(t,n)}}function p2(t,e){return typeof t=="number"?t:t[e]||0}const pU=new WeakMap;class mU{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=Me(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:o}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const a=m=>{n&&this.snapToCursor(ja(m).point),this.stopAnimation()},l=(m,y)=>{const{drag:b,dragPropagation:x,onDragStart:w}=this.getProps();if(b&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=YP(b),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=y,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),oi(S=>{let k=this.getAxisMotionValue(S).get()||0;if(ii.test(k)){const{projection:C}=this.visualElement;if(C&&C.layout){const E=C.layout.layoutBox[S];E&&(k=Ge(E)*(parseFloat(k)/100))}}this.originPoint[S]=k}),w&&re.update(()=>w(m,y),!1,!0),Sp(this.visualElement,"transform");const{animationState:_}=this.visualElement;_&&_.setActive("whileDrag",!0)},u=(m,y)=>{this.latestPointerEvent=m,this.latestPanInfo=y;const{dragPropagation:b,dragDirectionLock:x,onDirectionLock:w,onDrag:_}=this.getProps();if(!b&&!this.openDragLock)return;const{offset:S}=y;if(x&&this.currentDirection===null){this.currentDirection=yU(S),this.currentDirection!==null&&w&&w(this.currentDirection);return}this.updateAxis("x",y.point,S),this.updateAxis("y",y.point,S),this.visualElement.render(),_&&re.update(()=>_(m,y),!1,!0)},d=(m,y)=>{this.latestPointerEvent=m,this.latestPanInfo=y,this.stop(m,y),this.latestPointerEvent=null,this.latestPanInfo=null},h=()=>{const{dragSnapToOrigin:m}=this.getProps();(m||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:p}=this.getProps();this.panSession=new l2(e,{onSessionStart:a,onStart:l,onMove:u,onSessionEnd:d,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:o,contextWindow:r2(this.visualElement),element:this.visualElement.current})}stop(e,n){const o=e||this.latestPointerEvent,s=n||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!s||!o)return;const{velocity:l}=s;this.startAnimation(l);const{onDragEnd:u}=this.getProps();u&&re.postRender(()=>u(o,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:o}=this.getProps();!o&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,o){const{drag:s}=this.getProps();if(!o||!du(e,s,this.currentDirection))return;const a=this.getAxisMotionValue(e);let l=this.originPoint[e]+o[e];this.constraints&&this.constraints[e]&&(l=lU(l,this.constraints[e],this.elastic[e])),a.set(l)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),o=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,s=this.constraints;e&&Jr(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&o?this.constraints=cU(o.layoutBox,e):this.constraints=!1,this.elastic=hU(n),s!==this.constraints&&!Jr(e)&&o&&this.constraints&&!this.hasMutatedConstraints&&oi(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=dU(o.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Jr(e))return!1;const o=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const a=bB(o,s.root,this.visualElement.getTransformPagePoint());let l=uU(s.layout.layoutBox,a);if(n){const u=n(gB(l));this.hasMutatedConstraints=!!u,u&&(l=q_(u))}return l}startAnimation(e){const{drag:n,dragMomentum:o,dragElastic:s,dragTransition:a,dragSnapToOrigin:l,onDragTransitionEnd:u}=this.getProps(),d=this.constraints||{},h=oi(p=>{if(!du(p,n,this.currentDirection))return;let m=d&&d[p]||{};l&&(m={min:0,max:0});const y=s?200:1e6,b=s?40:1e7,x={type:"inertia",velocity:o?e[p]:0,bounceStiffness:y,bounceDamping:b,timeConstant:750,restDelta:1,restSpeed:10,...a,...m};return this.startAxisValueAnimation(p,x)});return Promise.all(h).then(u)}startAxisValueAnimation(e,n){const o=this.getAxisMotionValue(e);return Sp(this.visualElement,e),o.start(xp(e,o,0,n,this.visualElement,!1))}stopAnimation(){oi(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,o=this.visualElement.getProps(),s=o[n];return s||this.visualElement.getValue(e,(o.initial?o.initial[e]:void 0)||0)}snapToCursor(e){oi(n=>{const{drag:o}=this.getProps();if(!du(n,o,this.currentDirection))return;const{projection:s}=this.visualElement,a=this.getAxisMotionValue(n);if(s&&s.layout){const{min:l,max:u}=s.layout.layoutBox[n],d=a.get()||0;a.set(e[n]-he(l,u,.5)+d)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:o}=this.visualElement;if(!Jr(n)||!o||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};oi(l=>{const u=this.getAxisMotionValue(l);if(u&&this.constraints!==!1){const d=u.get();s[l]=fU({min:d,max:d},this.constraints[l])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",o.root&&o.root.updateScroll(),o.updateLayout(),this.constraints=!1,this.resolveConstraints(),oi(l=>{if(!du(l,e,null))return;const u=this.getAxisMotionValue(l),{min:d,max:h}=this.constraints[l];u.set(he(d,h,s[l]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;pU.set(this.visualElement,this);const e=this.visualElement.current,n=za(e,"pointerdown",h=>{const{drag:p,dragListener:m=!0}=this.getProps(),y=h.target,b=y!==e&&KP(y);p&&m&&!b&&this.start(h)});let o;const s=()=>{const{dragConstraints:h}=this.getProps();Jr(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),o||(o=gU(e,h.current,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,l=a.addEventListener("measure",s);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),re.read(s);const u=Da(window,"resize",()=>this.scalePositionWithinConstraints()),d=a.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(oi(m=>{const y=this.getAxisMotionValue(m);y&&(this.originPoint[m]+=h[m].translate,y.set(y.get()+h[m].translate))}),this.visualElement.render())}));return()=>{u(),n(),l(),d&&d(),o&&o()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:o=!1,dragPropagation:s=!1,dragConstraints:a=!1,dragElastic:l=Wp,dragMomentum:u=!0}=e;return{...e,drag:n,dragDirectionLock:o,dragPropagation:s,dragConstraints:a,dragElastic:l,dragMomentum:u}}}function m2(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function gU(t,e,n){const o=L_(t,m2(n)),s=L_(e,m2(n));return()=>{o(),s()}}function du(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function yU(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class vU extends to{constructor(e){super(e),this.removeGroupControls=vn,this.removeListeners=vn,this.controls=new mU(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||vn}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const Jp=t=>(e,n)=>{t&&re.update(()=>t(e,n),!1,!0)};class bU extends to{constructor(){super(...arguments),this.removePointerDownListener=vn}onPointerDown(e){this.session=new l2(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:r2(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:o,onPanEnd:s}=this.node.getProps();return{onSessionStart:Jp(e),onStart:Jp(n),onMove:Jp(o),onEnd:(a,l)=>{delete this.session,s&&re.postRender(()=>s(a,l))}}}mount(){this.removePointerDownListener=za(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let tm=!1;class xU extends N.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:o,layoutId:s}=this.props,{projection:a}=e;a&&(n.group&&n.group.add(a),o&&o.register&&s&&o.register(a),tm&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),lu.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:o,drag:s,isPresent:a}=this.props,{projection:l}=o;return l&&(l.isPresent=a,e.layoutDependency!==n&&l.setOptions({...l.options,layoutDependency:n}),tm=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==a?l.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?l.promote():l.relegate()||re.postRender(()=>{const u=l.getStack();(!u||!u.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Rp.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:o}=this.props,{projection:s}=e;tm=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),o&&o.deregister&&o.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function g2(t){const[e,n]=qS(),o=N.useContext(Ph);return M.jsx(xU,{...t,layoutGroup:o,switchLayoutGroup:N.useContext(i2),isPresent:e,safeToRemove:n})}const wU={pan:{Feature:bU},drag:{Feature:vU,ProjectionNode:$S,MeasureLayout:g2}};function y2(t,e,n){const{props:o}=t;t.animationState&&o.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,a=o[s];a&&re.postRender(()=>a(e,ja(e)))}class _U extends to{mount(){const{current:e}=this.node;e&&(this.unmount=GP(e,(n,o)=>(y2(this.node,o,"Start"),s=>y2(this.node,s,"End"))))}unmount(){}}class SU extends to{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=wa(Da(this.node.current,"focus",()=>this.onFocus()),Da(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function v2(t,e,n){const{props:o}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&o.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),a=o[s];a&&re.postRender(()=>a(e,ja(e)))}class EU extends to{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:o}=this.node.props;this.unmount=WP(e,(s,a)=>(v2(this.node,a,"Start"),(l,{success:u})=>v2(this.node,l,u?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:o?.tap===!1})}unmount(){}}const em=new WeakMap,nm=new WeakMap,CU=t=>{const e=em.get(t.target);e&&e(t)},TU=t=>{t.forEach(CU)};function NU({root:t,...e}){const n=t||document;nm.has(n)||nm.set(n,{});const o=nm.get(n),s=JSON.stringify(e);return o[s]||(o[s]=new IntersectionObserver(TU,{root:t,...e})),o[s]}function AU(t,e,n){const o=NU(e);return em.set(t,n),o.observe(t),()=>{em.delete(t),o.unobserve(t)}}const MU={some:0,all:1};class RU extends to{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:o,amount:s="some",once:a}=e,l={root:n?n.current:void 0,rootMargin:o,threshold:typeof s=="number"?s:MU[s]},u=d=>{const{isIntersecting:h}=d;if(this.isInView===h||(this.isInView=h,a&&!h&&this.hasEnteredView))return;h&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",h);const{onViewportEnter:p,onViewportLeave:m}=this.node.getProps(),y=h?p:m;y&&y(d)};return AU(this.node.current,l,u)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(kU(e,n))&&this.startObserver()}unmount(){}}function kU({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const OU={...iU,...{inView:{Feature:RU},tap:{Feature:EU},focus:{Feature:SU},hover:{Feature:_U}},...wU,...{layout:{ProjectionNode:$S,MeasureLayout:g2}}},hu=WH(OU,JH),b2="__boundary_in_",x2="__boundary_out_";function DU(t){const e=[],n=[];for(const o of t.inputs){const s=`${b2}${o.name}`,a=o.portType.kind==="bus";e.push({id:s,label:o.name,componentRef:a?"Input":"Switch",arguments:a?{value:0,width:o.portType.width}:{value:!1},inputs:[],outputs:[{id:`${s}_out`,name:"out",portType:o.portType}],clocks:[]})}for(const o of t.outputs){const s=`${x2}${o.name}`,a=o.portType.kind==="bus";e.push({id:s,label:o.name,componentRef:a?"HexDisplay":"Led",arguments:{},inputs:[{id:`${s}_in`,name:"in",portType:o.portType}],outputs:[],clocks:[]})}for(const o of t.connections){const s={...o.source},a={...o.target};o.source.nodeId===""&&(s.nodeId=`${b2}${o.source.portName}`,s.portName="out"),o.target.nodeId===""&&(a.nodeId=`${x2}${o.target.portName}`,a.portName="in"),n.push({...o,source:s,target:a})}return{...t,name:`__drilldown_${t.name}`,nodes:[...e,...t.nodes],connections:n,implementation:{kind:"primitive"}}}const De="__top__";function jU(t,e,n=!1,o){const s=[],a=[],l={path:"",componentName:t.name,children:[],primitives:[]};function u(p,m,y,b=new Set){for(const x of p.nodes){const w=m+x.id,_=e.resolveCircuit(x.componentRef);if(!_)throw new Error(`Unknown component: ${x.componentRef} (referenced by node ${w})`);if(_.implementation.kind==="primitive")s.push({id:w,primitiveType:x.componentRef,arguments:x.arguments,inputs:x.inputs.map(S=>({...S,nodeId:w})),outputs:x.outputs.map(S=>({...S,nodeId:w})),clocks:x.clocks.map(S=>({...S,nodeId:w})),dependents:[],inputSources:[]}),y.primitives.push(w);else if(_.implementation.kind==="composite"){if(b.has(x.componentRef))throw new Error(`Recursive circuit definition detected: '${x.componentRef}' references itself (cycle: ${[...b,x.componentRef].join(" → ")})`);const S={path:w,componentName:x.componentRef,children:[],primitives:[]};y.children.push(S);const k=new Set(b);k.add(x.componentRef),u(_,w+".",S,k)}else console.warn(`Intrinsic component ${x.componentRef} treated as primitive during elaboration`),s.push({id:w,primitiveType:x.componentRef,arguments:x.arguments,inputs:x.inputs.map(S=>({...S,nodeId:w})),outputs:x.outputs.map(S=>({...S,nodeId:w})),clocks:x.clocks.map(S=>({...S,nodeId:w})),dependents:[],inputSources:[]}),y.primitives.push(w)}for(const x of p.connections){const w=x.source.nodeId===""?m===""?De:m.slice(0,-1):m+x.source.nodeId,_=x.target.nodeId===""?m===""?De:m.slice(0,-1):m+x.target.nodeId;a.push({id:`${w}.${x.source.portName}->${_}.${x.target.portName}`,source:{nodeId:w,portName:x.source.portName},target:{nodeId:_,portName:x.target.portName},portType:x.portType})}}if(t.implementation.kind==="primitive"&&t.nodes.length===0){const p=t.name;s.push({id:p,primitiveType:t.name,arguments:{},inputs:t.inputs.map(m=>({id:`${p}.${m.name}`,name:m.name,portType:m.portType,nodeId:p})),outputs:t.outputs.map(m=>({id:`${p}.${m.name}`,name:m.name,portType:m.portType,nodeId:p})),clocks:t.clocks.map(m=>({id:`${p}.${m.name}`,name:m.name,nodeId:p})),dependents:[],inputSources:[]}),l.primitives.push(p);for(const m of t.inputs)a.push({id:`${De}.${m.name}->${p}.${m.name}`,source:{nodeId:De,portName:m.name},target:{nodeId:p,portName:m.name},portType:m.portType});for(const m of t.outputs)a.push({id:`${p}.${m.name}->${De}.${m.name}`,source:{nodeId:p,portName:m.name},target:{nodeId:De,portName:m.name},portType:m.portType})}else u(t,"",l,new Set([t.name]));const d=zU(t,a,s,e,"",n),h={nodes:s,connections:d,hierarchy:l,topLevelInputs:t.inputs,topLevelOutputs:t.outputs,nodeMap:new Map};return LU(h),h}function zU(t,e,n,o,s,a=!1){const l=new Map,u=new Set;function d(m,y,b=new Set){for(const x of m.nodes){const w=y+x.id,_=o.resolveCircuit(x.componentRef);if(_&&_.implementation.kind==="composite"){if(b.has(x.componentRef))continue;u.add(w),a&&console.log(`
|
|
77
|
+
=== Tracing composite: ${w} (${x.componentRef}) ===`),VU(_,w,l,o,a);const S=new Set(b);S.add(x.componentRef),d(_,w+".",S)}}}if(d(t,s,new Set([t.name])),a){console.log(`
|
|
78
|
+
=== Port Forwarding Map (${l.size} rules) ===`);for(const[m,y]of l.entries())for(const b of y)console.log(` ${m} -> ${b.nodeId}.${b.portName}`)}const h=[];for(const m of e){const y=u.has(m.source.nodeId),b=u.has(m.target.nodeId),x=b&&m.source.nodeId.startsWith(m.target.nodeId+"."),w=y&&m.target.nodeId.startsWith(m.source.nodeId+".");if(x||w){a&&console.log(` SKIP PORT FORWARDING: ${m.source.nodeId}.${m.source.portName} -> ${m.target.nodeId}.${m.target.portName}`);continue}const _=y&&b&&m.source.nodeId===m.target.nodeId,S=R=>R.nodeId===De||n.some(A=>A.id===R.nodeId),k=R=>{const A=[],O=new Set,D=[R];for(;D.length>0;){const U=D.shift(),q=`${U.nodeId}.${U.portName}`;if(!O.has(q)){if(O.add(q),S(U)){A.push(U);continue}if(u.has(U.nodeId)&&l.has(q)){const Y=l.get(q);for(const K of Y)D.push(K)}else A.push(U)}}return A.length>0?A:[R]};let C=[m.source];if(y&&!_&&(C=k(m.source),a&&C.length>0))for(const R of C)console.log(` FORWARD SOURCE: ${m.source.nodeId}.${m.source.portName} -> ${R.nodeId}.${R.portName}`);let E=[m.target];if(b&&!_&&(E=k(m.target),a&&E.length>0))for(const R of E)console.log(` FORWARD TARGET: ${m.target.nodeId}.${m.target.portName} -> ${R.nodeId}.${R.portName}`);for(const R of C)for(const A of E)R.nodeId===A.nodeId&&R.portName===A.portName||h.push({id:`${R.nodeId}.${R.portName}->${A.nodeId}.${A.portName}`,source:R,target:A,portType:m.portType})}const p=h.filter(m=>u.has(m.source.nodeId)&&m.source.nodeId===m.target.nodeId);if(p.length>0){a&&console.log(`
|
|
79
|
+
=== Eliminating ${p.length} passthrough connections ===`);const m=[],y=new Set;for(const b of h)if(u.has(b.source.nodeId)&&b.source.nodeId===b.target.nodeId){y.add(b.id),a&&console.log(` PASSTHROUGH: ${b.source.nodeId}.${b.source.portName} -> ${b.target.portName}`);const w=h.filter(S=>S.target.nodeId===b.source.nodeId&&S.target.portName===b.source.portName&&!y.has(S.id)),_=h.filter(S=>S.source.nodeId===b.target.nodeId&&S.source.portName===b.target.portName&&!y.has(S.id));for(const S of w)for(const k of _){const C={id:`${S.source.nodeId}.${S.source.portName}->${k.target.nodeId}.${k.target.portName}`,source:S.source,target:k.target,portType:b.portType};m.push(C),y.add(S.id),y.add(k.id),a&&console.log(` DIRECT: ${C.source.nodeId}.${C.source.portName} -> ${C.target.nodeId}.${C.target.portName}`)}}else y.has(b.id)||m.push(b);return w2(m,n,u,a)}return w2(h,n,u,a)}function w2(t,e,n,o){const s=new Set(e.map(p=>p.id)),a=p=>p.nodeId===De||s.has(p.nodeId),l=new Map;for(const p of t){const m=`${p.source.nodeId}.${p.source.portName}`;l.has(m)||l.set(m,[]),l.get(m).push(p)}const u=p=>{const m=[],y=new Set,b=[p];for(;b.length>0;){const x=b.pop(),w=`${x.nodeId}.${x.portName}`;if(!y.has(w)){if(y.add(w),a(x)){m.push(x);continue}for(const _ of l.get(w)??[])b.push(_.target)}}return m},d=[],h=new Set;for(const p of t){if(!a(p.source))continue;const m=a(p.target)?[p.target]:u(p.target);for(const y of m){if(p.source.nodeId===y.nodeId&&p.source.portName===y.portName)continue;const x=`${p.source.nodeId}.${p.source.portName}->${y.nodeId}.${y.portName}`;h.has(x)||(h.add(x),o&&console.log(` RESOLVED: ${p.source.nodeId}.${p.source.portName} -> ${y.nodeId}.${y.portName}`),d.push({id:x,source:p.source,target:y,portType:p.portType}))}}return d}function VU(t,e,n,o,s=!1){for(const a of t.connections){if(a.source.nodeId===""&&a.target.nodeId!==""){const l=`${e}.${a.source.portName}`,u=pu(e,a.target,t,o);n.has(l)||n.set(l,[]);for(const d of u)n.get(l).push(d),s&&console.log(` INPUT: ${a.source.portName} -> ${d.nodeId}.${d.portName}`)}if(a.source.nodeId!==""&&a.target.nodeId===""){const l=`${e}.${a.target.portName}`,u=pu(e,a.source,t,o);n.has(l)||n.set(l,[]);for(const d of u)n.get(l).push(d),s&&console.log(` OUTPUT: ${a.target.portName} <- ${d.nodeId}.${d.portName}`)}if(a.source.nodeId===""&&a.target.nodeId===""){s&&console.log(` PASSTHROUGH: ${a.source.portName} -> ${a.target.portName}`);const l=`${e}.${a.source.portName}`;n.has(l)||n.set(l,[]),n.get(l).push({nodeId:e,portName:a.target.portName}),s&&console.log(` -> Added passthrough forwarding: ${l} -> ${e}.${a.target.portName}`)}}}function pu(t,e,n,o,s=new Set){if(e.nodeId==="")return[{nodeId:t,portName:e.portName}];const a=t+"."+e.nodeId,l=n.nodes.find(p=>p.id===e.nodeId);if(!l)return[{nodeId:a,portName:e.portName}];const u=o.resolveCircuit(l.componentRef);if(!u||u.implementation.kind!=="composite")return[{nodeId:a,portName:e.portName}];if(s.has(l.componentRef))return[{nodeId:a,portName:e.portName}];const d=new Set(s);d.add(l.componentRef);const h=[];for(const p of u.connections){if(p.target.nodeId===""&&p.target.portName===e.portName){const m=pu(a,p.source,u,o,d);h.push(...m)}if(p.source.nodeId===""&&p.source.portName===e.portName){const m=pu(a,p.target,u,o,d);h.push(...m)}}return h.length>0?h:[{nodeId:a,portName:e.portName}]}function LU(t){t.nodeMap=new Map(t.nodes.map(e=>[e.id,e]));for(const e of t.nodes)e.dependents=[],e.inputSources=[];for(const e of t.connections){const n=e.source.nodeId,o=e.target.nodeId;if(o===De)continue;const s=t.nodeMap.get(n);s&&!s.dependents.includes(o)&&s.dependents.push(o);const a=t.nodeMap.get(o);a&&a.inputSources.push({portName:e.target.portName,sourceNodeId:n,sourcePortName:e.source.portName})}}function IU(t,e){return`${t}.${e}`}function _2(t,e,n){const o=new Map,s=new Map,a=new Map;for(const l of t.nodes){const u=e.resolveCircuit(l.primitiveType);if(u){if(u.implementation.kind==="primitive"&&u.state.length>0){const d=u.state.map(p=>PU(p,l.id,l.arguments,l.primitiveType,n)),h=u.state.length===1?d[0]:Object.fromEntries(u.state.map((p,m)=>[p.name,d[m]]));o.set(l.id,h),s.set(l.id,h)}for(const d of l.clocks)a.set(IU(l.id,d.name),{value:!1,edge:"none"})}}return{currentState:o,nextState:s,clocks:a,cycleCount:0}}function PU(t,e,n,o,s){const a=t.stateType.kind,l=n[t.name];if(a==="memory"){const d=new Map,h=t.initialValue;if(h?.data){if(h.data instanceof Map)for(const[p,m]of h.data)d.set(p,m);else if(typeof h.data=="object")for(const[p,m]of Object.entries(h.data)){const y=parseInt(p,10);!isNaN(y)&&typeof m=="number"&&d.set(y,m)}}if(l!==void 0){if(Array.isArray(l))l.forEach((p,m)=>{typeof p=="number"&&d.set(m,p)});else if(l instanceof Map)for(const[p,m]of l)d.set(p,m);else if(typeof l=="object"&&l!==null)for(const[p,m]of Object.entries(l)){const y=parseInt(p,10);!isNaN(y)&&typeof m=="number"&&d.set(y,m)}}if(s){const p=HU(e,s,o);if(p)for(const[m,y]of p.entries())d.set(m,y)}return d}if(l!==void 0&&(typeof l=="number"||typeof l=="boolean"))return l;const u=t.initialValue;return u}function BU(t){const n=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(n,"i")}function HU(t,e,n){for(const[o,s]of e){const a=BU(o);if(a.test(t)||n&&a.test(n))return s}}const im={And:0,Or:1,Not:2,Nand:3,Nor:4,Xor:5,Xnor:6,Buffer:7,Switch:10,Led:11,Output:12,Button:13,Input:14,Constant:15,Splitter:20,Splitter8to8:21,Combiner8to8:22,Probe:23,BitSlice:24,AddressCombiner:25,Concat:26,BusAnd:40,BusOr:41,BusNot:42,BusXor:43,Incrementer:50,Adder:51,Multiplier:52,Comparator:53,LeftShifter:54,RightShifter:55,Subtractor:56,SignedAdder:57,SignedComparator:58,SignedMultiplier:59,Mux:70,Decoder:71,SevenSegment:80,HexDisplay:81,Screen:82,RasterDisplay:83,DFlipFlop:90,Register:91,ROM:100,RAM:101,DualPortRAM:102,Console:110},UU=Object.entries(im).reduce((t,[e,n])=>(t[n]=e,t),[]);class $U{queue;pending;head=0;tail=0;capacity;constructor(e){this.capacity=e,this.queue=new Uint32Array(e),this.pending=new Uint8Array(e)}enqueue(e){this.pending[e]||(this.pending[e]=1,this.queue[this.tail%this.capacity]=e,this.tail++)}enqueueAll(e){for(let n=0;n<e.length;n++)this.enqueue(e[n])}dequeue(){const e=this.queue[this.head%this.capacity];return this.pending[e]=0,this.head++,e}isEmpty(){return this.head===this.tail}size(){return this.tail-this.head}toArray(){const e=[];for(let n=this.head;n<this.tail;n++)e.push(this.queue[n%this.capacity]);return e}clear(){this.head=0,this.tail=0,this.pending.fill(0)}}function S2(t){return{values:new Int32Array(t),changed:new Uint8Array(t),initialized:new Uint8Array(t)}}function E2(t,e){const n=t.circuit.inputSourcePort[t.portStart+e];return n>=0?t.values.values[n]:0}function C2(t,e,n){const o=t.portStart+t.inputCount+e;t.values.values[o]=n,t.values.initialized[o]=1}const YU=Math.max(...Object.values(im))+1,Va=new Array(YU).fill(null);function T2(t){return new Proxy(t,{get(e,n){if(typeof n=="string"&&/^\d+$/.test(n))return e.get(Number(n))??0;const o=e[n];return typeof o=="function"?o.bind(e):o},set(e,n,o){return typeof n=="string"&&/^\d+$/.test(n)?(e.set(Number(n),o),!0):!1}})}let qU=200;const N2=new Map;function GU(t){const e=im[t];if(e!==void 0)return e;const n=N2.get(t);if(n!==void 0)return n;const o=qU++;return N2.set(t,o),UU[o]=t,o}function FU(t,e,n,o){const s=t.length,a=e.length;return!o||o.length===0?function(u){const d={},h=u.circuit.flatCircuit.nodes[u.nodeIndex]?.arguments;if(h)for(const m in h)d[m]=h[m];for(let m=0;m<s;m++)d[t[m]]=E2(u,m);const p=n(d);for(let m=0;m<a;m++){const y=p[e[m]];y!==void 0&&C2(u,m,y)}}:function(u){const d={},h=u.circuit.flatCircuit.nodes[u.nodeIndex]?.arguments;if(h)for(const m in h)d[m]=h[m];for(let m=0;m<s;m++)d[t[m]]=E2(u,m);if(u.state){const m=u.state.currentState[u.nodeIndex];if(m!=null&&typeof m=="object"&&!Array.isArray(m)&&!(m instanceof Map)){const y=m;for(const b of o){const x=y[b];d[b]=x instanceof Map?T2(x):x}}else m!=null&&(d[o[0]]=m instanceof Map?T2(m):m)}const p=n(d);for(let m=0;m<a;m++){const y=p[e[m]];y!==void 0&&C2(u,m,y)}}}function XU(t){const e=GU(t);if(Va[e]!=null)return e;const n=Ll(t);if(!n)return console.warn(`[eval-bridge] No eval-registry entry for '${t}' — getAllCircuitEvals:`,[...WN().keys()]),e;for(;Va.length<=e;)Va.push(null);return Va[e]=FU(n.inputNames,n.outputNames,n.evalFn,n.stateKeys),e}const om=new Map;function ZU(t){if(om.has(t))return om.get(t);const e=Ll(t);if(!e?.onTickFn)return;const n={inputNames:e.inputNames,stateKeys:e.stateKeys??[],fn:e.onTickFn};return om.set(t,n),n}function KU(t,e){const n=t.nodes.length,o=new Map,s=new Array(n);for(let q=0;q<n;q++){const Y=t.nodes[q];o.set(Y.id,q),s[q]=Y.id}let a=0;const l=new Uint32Array(n),u=new Uint8Array(n),d=new Uint8Array(n);for(let q=0;q<n;q++){const Y=t.nodes[q];l[q]=a,u[q]=Y.inputs.length,d[q]=Y.outputs.length,a+=Y.inputs.length+Y.outputs.length}const h=t.topLevelInputs.length,p=t.topLevelOutputs.length,m=a+h+p,y=new Map,b=new Array(m),x=new Uint8Array(m),w=new Uint8Array(m),_=new Array(m);let S=a;for(const q of t.topLevelInputs){const Y=`${De}.${q.name}`;y.set(Y,S),b[S]=Y,x[S]=1,w[S]=q.portType.kind==="bus"?1:0,S++}for(const q of t.topLevelOutputs){const Y=`${De}.${q.name}`;y.set(Y,S),b[S]=Y,x[S]=0,w[S]=q.portType.kind==="bus"?1:0,S++}for(let q=0;q<n;q++){const Y=t.nodes[q];let K=l[q];for(const W of Y.inputs){const B=`${Y.id}.${W.name}`;y.set(B,K),b[K]=B,x[K]=0,w[K]=W.portType.kind==="bus"?1:0,_[K]=W.name,K++}for(const W of Y.outputs){const B=`${Y.id}.${W.name}`;y.set(B,K),b[K]=B,x[K]=1;let H=W.portType.kind==="bus";if(!H){const j=Y.arguments.width;if(typeof j=="number"&&j>1&&(H=!0),!H&&Y.primitiveType==="Mux"){for(const I of Y.inputs)if(I.name!=="sel"&&I.portType.kind==="bus"){H=!0;break}}}w[K]=H?1:0,K++}}const k=new Uint16Array(n);for(let q=0;q<n;q++){const Y=t.nodes[q];k[q]=XU(Y.primitiveType)}const C=new Array(n);for(let q=0;q<n;q++){const K=t.nodes[q].dependents.map(W=>o.get(W)).filter(W=>W!==void 0);C[q]=new Uint32Array(K)}const E=new Int32Array(a),R=new Int32Array(a);E.fill(-1),R.fill(-1);for(let q=0;q<n;q++){const Y=t.nodes[q],K=l[q];for(let W=0;W<Y.inputSources.length;W++){const B=Y.inputSources[W],H=Y.inputs.findIndex(I=>I.name===B.portName);if(H===-1)continue;const j=K+H;if(B.sourceNodeId===De){E[j]=-1;const I=`${De}.${B.sourcePortName}`;R[j]=y.get(I)??-1}else{const I=o.get(B.sourceNodeId);if(I===void 0)continue;const z=t.nodes[I],$=z.outputs.findIndex(G=>G.name===B.sourcePortName);if($===-1)continue;E[j]=I,R[j]=l[I]+z.inputs.length+$}}}const A=new Uint8Array(n),O=new Uint8Array(n),D=new Uint8Array(n),U=new Uint8Array(n);for(let q=0;q<n;q++){const Y=t.nodes[q];A[q]=Y.inputs.length===0?1:0;const K=e.resolveCircuit(Y.primitiveType);K?.state&&K.state.length>0&&(D[q]=1,O[q]=1);for(const W of Y.inputSources)if(W.sourceNodeId===De){U[q]=1;break}}return{nodeCount:n,portCount:m,nodeIdToIndex:o,indexToNodeId:s,portKeyToIndex:y,indexToPortKey:b,primitiveTypeIndex:k,nodePortStart:l,nodeInputCount:u,nodeOutputCount:d,dependents:C,inputSourceNode:E,inputSourcePort:R,inputPortNames:_,portIsOutput:x,portIsBus:w,isSourceNode:A,isStateOutputNode:O,hasState:D,readsTopLevelInput:U,flatCircuit:t}}function rm(t,e){const n=new Array(t.nodeCount),o=new Array(t.nodeCount);for(const[s,a]of e.currentState){const l=t.nodeIdToIndex.get(s);l!==void 0&&(n[l]=a)}for(const[s,a]of e.nextState){const l=t.nodeIdToIndex.get(s);l!==void 0&&(o[l]=a)}return{currentState:n,nextState:o,clocks:e.clocks,cycleCount:e.cycleCount}}function sm(t,e){const n=new Map,o=new Map;for(let s=0;s<t.nodeCount;s++){const a=t.indexToNodeId[s];e.currentState[s]!==void 0&&n.set(a,e.currentState[s]),e.nextState[s]!==void 0&&o.set(a,e.nextState[s])}return{currentState:n,nextState:o,clocks:e.clocks,cycleCount:e.cycleCount}}const A2=1e4,am=new WeakMap;function QU(t){const e=new Map(t),n=new Proxy(e,{get(o,s){if(typeof s=="string"&&/^\d+$/.test(s))return o.get(Number(s))??0;const a=o[s];return typeof a=="function"?a.bind(o):a},set(o,s,a){return typeof s=="string"&&/^\d+$/.test(s)?(o.set(Number(s),a),!0):!1}});return am.set(n,e),n}const WU=new Int32Array(64),JU=new Uint8Array(64);function La(t,e,n,o,s){let a=0;if(s)for(const[u,d]of s){const h=t.portKeyToIndex.get(u);h!==void 0&&(n.values[h]=typeof d=="boolean"?d?1:0:d,n.initialized[h]=1)}const l={circuit:t,values:n,state:o,queue:e,nodeIndex:0,portStart:0,inputCount:0,outputCount:0};for(;!e.isEmpty();){if(++a>A2)throw new Error(`Propagation did not stabilize after ${A2} iterations. Possible unstable feedback loop in circuit.`);const u=e.dequeue(),d=t.nodePortStart[u],h=t.nodeInputCount[u],p=t.nodeOutputCount[u],m=d+h;l.nodeIndex=u,l.portStart=d,l.inputCount=h,l.outputCount=p;const y=p<=64?WU:new Int32Array(p),b=p<=64?JU:new Uint8Array(p);for(let S=0;S<p;S++)y[S]=n.values[m+S],b[S]=n.initialized[m+S];const x=t.primitiveTypeIndex[u],w=Va[x];w?w(l):t9(t,u);let _=!1;for(let S=0;S<p;S++){const k=m+S;if(n.values[k]!==y[S]||n.initialized[k]&&!b[S]){_=!0;break}}_&&e.enqueueAll(t.dependents[u])}return a}function t9(t,e,n,o,s){const a=t.flatCircuit.nodes[e];throw new Error(`Primitive '${a.primitiveType}' has no registered evaluator. Either import '@simten/core/std' to register the standard library, or register the primitive's eval lambda explicitly via registerEvalFunction(). If you constructed a Circuit IR by hand (rather than via circuit()), you must register its evaluator yourself.`)}function mu(t,e){for(let n=0;n<t.nodeCount;n++)(t.isSourceNode[n]||t.isStateOutputNode[n]||t.readsTopLevelInput[n])&&(e.enqueue(n),t.isSourceNode[n],t.isStateOutputNode[n],t.readsTopLevelInput[n])}function e9(t,e){for(let n=0;n<t.nodeCount;n++)t.isStateOutputNode[n]&&e.enqueue(n)}function n9(t,e){for(const[n,o]of e.clocks)o.edge="rising",o.value=!0}function i9(t,e,n,o){for(let s=0;s<t.nodeCount;s++){if(!t.hasState[s])continue;const a=t.flatCircuit.nodes[s],l=ZU(a.primitiveType);if(!l)continue;const u=new Map,d=t.nodePortStart[s],h=t.nodeInputCount[s];for(let w=0;w<h;w++){const _=d+w,S=t.inputSourceNode[_],k=t.inputSourcePort[_],C=t.inputPortNames[_];if(S===-1){if(o&&k>=0){const E=t.indexToPortKey[k],R=o.get(E);R!==void 0&&u.set(C,R)}}else if(k>=0){const E=e.values[k];u.set(C,E)}}if(a.arguments)for(const[w,_]of Object.entries(a.arguments))u.set(`__${w}`,_);const p={};for(const w of a.clocks){const _=`${a.id}.${w.name}`,S=n.clocks.get(_);S&&(p[w.name]=S.edge)}const m=n.currentState[s],y={};for(const[w,_]of u)y[w]=_;if(m!=null&&typeof m=="object"&&!(m instanceof Map))for(const w of l.stateKeys)y[w]=m[w];else m!=null&&l.stateKeys.length===1&&(m instanceof Map?y[l.stateKeys[0]]=QU(m):y[l.stateKeys[0]]=m);const b=l.fn(y);let x=l.stateKeys.length===1?b[l.stateKeys[0]]:b;x!=null&&typeof x=="object"&&am.has(x)&&(x=am.get(x)),n.nextState[s]=x}}function o9(t){for(let e=0;e<t.currentState.length;e++){const n=t.nextState[e];n!==void 0&&(n instanceof Map?(t.currentState[e]=new Map(n),t.nextState[e]=new Map(n)):(t.currentState[e]=n,t.nextState[e]=n))}t.cycleCount++}function Ia(t,e,n){const o=new Map;if(n)for(const[s,a]of n)o.set(s,a);for(let s=0;s<t.portCount;s++){const a=t.indexToPortKey[s],l=t.portIsOutput[s]===1,u=t.portIsBus[s]===0;let d,h;if(l)d=e.values[s],h=e.initialized[s]!==0;else{const m=t.inputSourcePort[s];m>=0?(d=e.values[m],h=e.initialized[m]!==0):(d=0,h=!1)}h||(d=0);const p=d>1||d<0;o.set(a,u&&!p?d!==0:d)}return o}function r9(t,e,n){for(const[o,s]of n){const a=t.portKeyToIndex.get(o);a!==void 0&&(e.values[a]=typeof s=="boolean"?s?1:0:s,e.initialized[a]=1)}}function gu(t,e,n){for(const o of t.flatCircuit.connections)if(o.target.nodeId===De||o.target.nodeId===""){const s=`${o.source.nodeId}.${o.source.portName}`,a=t.portKeyToIndex.get(s);if(a!==void 0){const l=`${o.target.nodeId||De}.${o.target.portName}`,u=t.portIsBus[a]===0,d=e.values[a];n.set(l,u?d!==0:d)}}}class s9{flatCircuit=null;options=null;numericCircuit=null;numericSeqState=null;numericValues=null;eventQueue=null;topLevelInputs=new Map;cachedFlatSeqState=null;cachedPortValues=null;cacheValid=!1;totalTicks=0;totalEvaluations=0;initialize(e,n){this.flatCircuit=e,this.options=n,this.numericCircuit=KU(e,n.componentLibrary);const o=_2(e,n.componentLibrary);this.numericSeqState=rm(this.numericCircuit,o),this.numericValues=S2(this.numericCircuit.portCount),this.eventQueue=new $U(this.numericCircuit.nodeCount),this.topLevelInputs=new Map;for(const s of e.topLevelInputs){const a=`${De}.${s.name}`,l=s.portType.kind==="bit"?!1:0;this.topLevelInputs.set(a,l)}this.eventQueue.clear(),mu(this.numericCircuit,this.eventQueue),La(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState,this.topLevelInputs),this.totalTicks=0,this.totalEvaluations=0,this.cacheValid=!1}setNode(e,n){if(!this.flatCircuit||!this.numericCircuit)return;const o=`${De}.${e}`;if(this.topLevelInputs.has(o)){this.topLevelInputs.set(o,n),this.cacheValid=!1;return}const s=this.flatCircuit.nodes.find(l=>l.id===e)??this.flatCircuit.nodes.find(l=>l.id.endsWith("."+e));if(!s)return;const a=this.numericCircuit.nodeIdToIndex.get(s.id);if(a!==void 0&&this.numericSeqState&&this.numericSeqState.currentState[a]!==void 0){this.numericSeqState.currentState[a]=n,this.cacheValid=!1,this.cachedFlatSeqState=null,n instanceof Map&&this.options&&(this.options.initialMemory||(this.options.initialMemory=new Map),this.options.initialMemory.set(s.id,n));return}(typeof n=="boolean"||typeof n=="number"||typeof n=="string")&&(s.arguments={...s.arguments,value:n},this.cacheValid=!1)}tick(){if(!this.numericCircuit||!this.numericSeqState||!this.numericValues||!this.eventQueue)throw new Error("Simulator not initialized");this.eventQueue.clear(),mu(this.numericCircuit,this.eventQueue);const e=La(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState,this.topLevelInputs);n9(this.numericCircuit,this.numericSeqState),i9(this.numericCircuit,this.numericValues,this.numericSeqState,this.topLevelInputs),o9(this.numericSeqState),this.eventQueue.clear(),e9(this.numericCircuit,this.eventQueue);const n=La(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState,this.topLevelInputs),o=Ia(this.numericCircuit,this.numericValues,this.topLevelInputs);gu(this.numericCircuit,this.numericValues,o),this.cachedPortValues=o,this.cachedFlatSeqState=null,this.cacheValid=!0;const s=e+n;this.totalTicks++,this.totalEvaluations+=s;const a=sm(this.numericCircuit,this.numericSeqState);return{portValues:o,sequentialState:a,metrics:{phase1Evals:e,phase2Evals:n,totalEvals:s}}}runCombinational(){if(!this.numericCircuit||!this.numericValues||!this.eventQueue)throw new Error("Simulator not initialized");if(this.cacheValid&&this.cachedPortValues)return{portValues:this.cachedPortValues,metrics:{totalEvals:0}};this.eventQueue.clear(),mu(this.numericCircuit,this.eventQueue);try{La(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState??void 0,this.topLevelInputs)}catch(n){return{portValues:Ia(this.numericCircuit,this.numericValues,this.topLevelInputs),metrics:{totalEvals:0},error:n instanceof Error?n.message:"Unknown error"}}const e=Ia(this.numericCircuit,this.numericValues,this.topLevelInputs);return gu(this.numericCircuit,this.numericValues,e),this.cachedPortValues=e,this.cacheValid=!0,{portValues:e,metrics:{totalEvals:0}}}getOutput(e,n){if(!this.numericCircuit||!this.numericValues)return;const o=this.getPortValues(),s=`${e}.${n}`;return o.get(s)}getPortValues(){return!this.numericCircuit||!this.numericValues?new Map:(this.cacheValid||(this.cachedPortValues=Ia(this.numericCircuit,this.numericValues,this.topLevelInputs),gu(this.numericCircuit,this.numericValues,this.cachedPortValues),this.cacheValid=!0),this.cachedPortValues)}getState(){return!this.numericCircuit||!this.numericSeqState?null:((!this.cacheValid||!this.cachedFlatSeqState)&&(this.cachedFlatSeqState=sm(this.numericCircuit,this.numericSeqState)),this.cachedFlatSeqState)}snapshot(){if(!this.numericSeqState||!this.numericCircuit||!this.numericValues)throw new Error("No sequential state to snapshot");const e=Ia(this.numericCircuit,this.numericValues,this.topLevelInputs);gu(this.numericCircuit,this.numericValues,e);const n=sm(this.numericCircuit,this.numericSeqState);return{portValues:e,sequentialState:n,cycleCount:this.numericSeqState.cycleCount}}restore(e){!this.numericCircuit||!this.numericValues||(this.numericSeqState=rm(this.numericCircuit,e.sequentialState),r9(this.numericCircuit,this.numericValues,e.portValues),this.cacheValid=!1)}reset(){if(!this.flatCircuit||!this.options||!this.numericCircuit)return;const e=_2(this.flatCircuit,this.options.componentLibrary,this.options.initialMemory);this.numericSeqState=rm(this.numericCircuit,e),this.numericValues=S2(this.numericCircuit.portCount),this.eventQueue.clear(),mu(this.numericCircuit,this.eventQueue),La(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState,this.topLevelInputs),this.totalTicks=0,this.totalEvaluations=0,this.cacheValid=!1}getMetrics(){return{totalTicks:this.totalTicks,totalEvaluations:this.totalEvaluations,avgEvalsPerTick:this.totalTicks>0?this.totalEvaluations/this.totalTicks:0,nodeCount:this.flatCircuit?.nodes.length??0}}}function a9(t,e){const n=new s9;return n.initialize(t,e),n}function l9(t,e){const n=jU(t,e);return a9(n,{componentLibrary:e})}const c9=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),u9=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,o)=>o?o.toUpperCase():n.toLowerCase()),M2=t=>{const e=u9(t);return e.charAt(0).toUpperCase()+e.slice(1)},R2=(...t)=>t.filter((e,n,o)=>!!e&&e.trim()!==""&&o.indexOf(e)===n).join(" ").trim(),f9=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var d9={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const h9=N.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:o,className:s="",children:a,iconNode:l,...u},d)=>N.createElement("svg",{ref:d,...d9,width:e,height:e,stroke:t,strokeWidth:o?Number(n)*24/Number(e):n,className:R2("lucide",s),...!a&&!f9(u)&&{"aria-hidden":"true"},...u},[...l.map(([h,p])=>N.createElement(h,p)),...Array.isArray(a)?a:[a]]));const eo=(t,e)=>{const n=N.forwardRef(({className:o,...s},a)=>N.createElement(h9,{ref:a,iconNode:e,className:R2(`lucide-${c9(M2(t))}`,`lucide-${t}`,o),...s}));return n.displayName=M2(t),n};const p9=eo("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const m9=eo("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const g9=eo("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);const y9=eo("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);const v9=eo("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);const b9=eo("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);const x9=eo("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const w9=eo("skip-forward",[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]]),k2=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,O2=ex,_9=((t,e)=>n=>{var o;if(e?.variants==null)return O2(t,n?.class,n?.className);const{variants:s,defaultVariants:a}=e,l=Object.keys(s).map(h=>{const p=n?.[h],m=a?.[h];if(p===null)return null;const y=k2(p)||k2(m);return s[h][y]}),u=n&&Object.entries(n).reduce((h,p)=>{let[m,y]=p;return y===void 0||(h[m]=y),h},{}),d=e==null||(o=e.compoundVariants)===null||o===void 0?void 0:o.reduce((h,p)=>{let{class:m,className:y,...b}=p;return Object.entries(b).every(x=>{let[w,_]=x;return Array.isArray(_)?_.includes({...a,...u}[w]):{...a,...u}[w]===_})?[...h,m,y]:h},[]);return O2(t,l,d,n?.class,n?.className)})("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),D2=N.forwardRef(({className:t,variant:e,size:n,...o},s)=>M.jsx("button",{className:jn(_9({variant:e,size:n,className:t})),ref:s,...o}));D2.displayName="Button";function ts({label:t,icon:e,onClick:n,disabled:o}){return M.jsxs(_w,{children:[M.jsx(Sw,{asChild:!0,children:M.jsx(D2,{variant:"ghost",size:"icon",onClick:n,disabled:o,"aria-label":t,className:"h-7 w-7 text-muted-foreground disabled:opacity-40 [&_svg]:size-3.5",children:M.jsx(e,{})})}),M.jsx(Ew,{side:"bottom",children:t})]})}function j2({cycle:t,historyLength:e,historyIndex:n,isRunning:o,isViewingPast:s,onStep:a,onRun:l,onPause:u,onReset:d,onStepBack:h,onStepForward:p,onSeek:m,onSpeedChange:y,speed:b=1,maxSpeed:x=100,showScrubber:w,floating:_,chromeless:S}){const k=_?"absolute top-3 left-1/2 -translate-x-1/2 z-10":"",C=S?"flex items-center gap-1.5":"flex items-center gap-1.5 border-t border-border bg-card/95 px-3 py-1.5";return M.jsx(ww,{children:M.jsx("div",{className:k,children:M.jsxs("div",{className:C,children:[M.jsx(ts,{label:"Tick",icon:w9,onClick:a,disabled:o||s}),o?M.jsx(ts,{label:"Pause",icon:v9,onClick:u}):M.jsx(ts,{label:"Run",icon:b9,onClick:l,disabled:s}),M.jsx(ts,{label:"Reset",icon:x9,onClick:d}),y&&M.jsxs("div",{className:"flex items-center gap-2 border-l border-border pl-2 ml-0.5",children:[M.jsx(g9,{className:"h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":!0}),M.jsx("input",{type:"range",min:"1",max:x,value:b,onChange:E=>y(Number(E.target.value)),className:"w-20 h-1 rounded-lg appearance-none cursor-pointer accent-blue-600",disabled:s,"aria-label":"Simulation speed"}),M.jsxs("span",{className:"min-w-[55px] text-[10px] text-muted-foreground font-mono tabular-nums",children:[b," tick/s"]})]}),M.jsx("div",{className:"border-l border-border pl-1.5 ml-0.5",children:M.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["Cycle ",M.jsx("span",{className:"font-mono font-semibold text-foreground",children:t})]})}),e>1&&M.jsxs("div",{className:"flex items-center gap-0.5 border-l border-border pl-1.5 ml-0.5",children:[M.jsx(ts,{label:"Step back",icon:p9,onClick:h,disabled:n<=0||o}),M.jsx("span",{className:"min-w-[40px] text-center text-[11px] text-muted-foreground",children:s?M.jsxs("span",{className:"font-mono text-amber-600 dark:text-amber-400",children:[n+1,"/",e]}):M.jsxs("span",{className:"font-mono",children:[e,"/",e]})}),M.jsx(ts,{label:"Step forward",icon:m9,onClick:p,disabled:!s||o})]}),w&&m&&e>1&&M.jsxs("div",{className:"flex items-center gap-2 border-l border-border pl-2 ml-0.5",children:[M.jsx(y9,{className:"h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":!0}),M.jsx("input",{type:"range",min:"0",max:e-1,value:n,onChange:E=>m(Number(E.target.value)),className:"w-24 h-1 rounded-lg appearance-none cursor-pointer accent-blue-600",disabled:o,"aria-label":"Cycle scrubber"})]})]})})})}function S9({frame:t,componentLibrary:e,onPushLevel:n,theme:o="dark"}){const s=N.useMemo(()=>DU(t.componentDef),[t.componentDef]),a=N.useMemo(()=>ud(s,e.resolveCircuit),[s,e]),l=N.useCallback(H=>{if(!H.isComposite)return;const j=e.resolveCircuit(H.componentRef);j&&j.implementation.kind==="composite"&&j.nodes.length>0&&n(H.componentRef,j,H.label??H.componentRef)},[e,n]),u=Wf(),[d,h]=N.useState(new Map),[p,m]=N.useState(!1),y=N.useRef(null),[b,x]=N.useState(0),[w,_]=N.useState(!1),S=N.useRef([]),[k,C]=N.useState(0),[E,R]=N.useState(-1),A=N.useRef("");A.current||(A.current=`drill-${typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2)}`);const O=A.current;N.useEffect(()=>()=>{p&&u.dispose(O).catch(()=>{})},[u,O,p]),N.useEffect(()=>{const H=[],j=new Set;for(const z of e.getAllPrimitiveNames()){const $=e.resolveCircuit(z);$&&!j.has(z)&&(j.add(z),H.push($))}const I=z=>{for(const $ of z.nodes){if(j.has($.componentRef))continue;const G=e.resolveCircuit($.componentRef);G&&(j.add($.componentRef),H.push(G),G.implementation.kind==="composite"&&I(G))}};I(s),u.compileIR(s,H,O,{snapshot:a}).then(z=>{if("error"in z){try{const G=l9(s,e);G.runCombinational(),y.current=G,m(!1);const L=new Map;for(const[F,et]of G.getPortValues())L.set(F,et);h(L)}catch(G){console.warn("[InspectorCanvas] Both sandbox and local failed:",G)}return}m(!0);const $=new Map;for(const[G,L]of Object.entries(z.portValues))$.set(G,L);h($),S.current=z.snapshotId!==void 0?[{snapshotId:z.snapshotId,cycle:0}]:[],C(S.current.length),R(S.current.length===0?-1:0),x(0)})},[s,e,u,O,a]);const D=N.useCallback(H=>{const j=`${H}.out`,I=d.get(j);u.setNode(H,!I,O).then(z=>{if("error"in z)return;const $=new Map;for(const[G,L]of Object.entries(z.portValues))$.set(G,L);h($)})},[u,d]),U=N.useCallback((H,j)=>{u.setNode(H,j,O).then(I=>{if("error"in I)return;const z=new Map;for(const[$,G]of Object.entries(I.portValues))z.set($,G);h(z)})},[u]),q=N.useCallback(()=>{u.tick(void 0,O,{snapshot:a}).then(H=>{if("error"in H)return;const j=new Map;for(const[I,z]of Object.entries(H.portValues))j.set(I,z);if(h(j),x(H.cycle),H.snapshotId!==void 0){const I=S.current.slice(0,E+1);I.push({snapshotId:H.snapshotId,cycle:H.cycle}),S.current=I,C(I.length),R(I.length-1)}})},[u,O,a,E]),Y=N.useCallback(()=>{_(!1),u.reset(O).then(H=>{if("error"in H)return;const j=new Map;for(const[I,z]of Object.entries(H.portValues))j.set(I,z);h(j),x(0),S.current=[],C(0),R(-1),a&&u.snapshot(O).then(I=>{"error"in I||I.snapshotId===void 0||(S.current=[{snapshotId:I.snapshotId,cycle:0}],C(1),R(0))})})},[u,O,a]),K=N.useCallback(H=>{const j=S.current[H];j&&u.restore(j.snapshotId,O).then(I=>{if("error"in I)return;const z=new Map;for(const[$,G]of Object.entries(I.portValues))z.set($,G);h(z),x(j.cycle),R(H)})},[u,O]),W=N.useCallback(()=>{_(!1),E>0&&K(E-1)},[E,K]),B=N.useCallback(()=>{E<k-1?K(E+1):q()},[E,k,K,q]);return N.useEffect(()=>{if(!w)return;const H=window.setInterval(()=>{q()},200);return()=>window.clearInterval(H)},[w,q]),M.jsxs("div",{className:"relative h-full w-full",children:[a&&M.jsx(j2,{floating:!0,cycle:b,historyLength:k,historyIndex:E,isRunning:w,isViewingPast:E>=0&&E<k-1,onStep:q,onRun:()=>_(!0),onPause:()=>_(!1),onReset:Y,onStepBack:W,onStepForward:B}),M.jsx(z2,{circuit:s,componentLibrary:e,portValues:d,sequentialState:null,onToggleNode:D,onSetNodeValue:U,onNodeDoubleClick:l,nodeTypes:Tw,edgeTypes:Nw,theme:o,showControls:!0,height:"100%",panOnMobile:!0})]})}function E9({stack:t,onNavigate:e,theme:n="dark"}){const s=t[t.length-1]?.componentDef.metadata?.description,a=n==="dark";return M.jsxs("div",{className:"flex items-center gap-1 text-sm min-w-0",children:[t.map((l,u)=>M.jsxs(ko.Fragment,{children:[u>0&&M.jsx("span",{className:`${a?"text-gray-500":"text-gray-400"} shrink-0`,children:">"}),u<t.length-1?M.jsxs("button",{onClick:()=>e(u),className:`${a?"text-blue-400 hover:text-blue-300":"text-blue-600 hover:text-blue-800"} hover:underline font-medium shrink-0`,children:[l.nodeLabel," (",l.componentName,")"]}):M.jsxs("span",{className:`font-semibold shrink-0 ${a?"text-gray-100":"text-gray-900"}`,children:[l.nodeLabel," (",l.componentName,")"]})]},u)),s&&M.jsxs(M.Fragment,{children:[M.jsx("span",{className:`${a?"text-gray-600":"text-gray-300"} shrink-0`,children:"—"}),M.jsx("span",{className:`${a?"text-gray-400":"text-gray-500"} text-xs italic truncate`,children:s})]})]})}const C9={enterIn:{opacity:0},enterOut:{opacity:0},center:{opacity:1},exitIn:{opacity:0},exitOut:{opacity:0}};function T9({stack:t,componentLibrary:e,theme:n="dark",onClose:o,onPopLevel:s,onPushLevel:a,onNavigate:l}){const u=t.length>0,d=N.useRef(0),[h,p]=N.useState("in");N.useEffect(()=>{t.length>d.current?p("in"):t.length<d.current&&p("out"),d.current=t.length},[t.length]),N.useEffect(()=>{if(!u)return;const x=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=x}},[u]);const m=N.useCallback(x=>{x.target===x.currentTarget&&o()},[o]),y=N.useCallback(x=>{x.key==="Escape"&&(x.stopPropagation(),t.length>1?s():o())},[t.length,s,o]),b=u?t[t.length-1]:null;return M.jsx(FS,{children:u&&b&&M.jsxs(M.Fragment,{children:[M.jsx(hu.div,{className:"fixed inset-0 z-50 bg-black/50",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25},onClick:m,onKeyDown:y,tabIndex:-1},"inspector-backdrop"),M.jsx(hu.div,{className:"fixed inset-0 z-50 flex items-center justify-center p-8 pointer-events-none",children:M.jsxs(hu.div,{className:`flex h-[80vh] w-full max-w-5xl flex-col rounded-lg shadow-xl pointer-events-auto overflow-hidden ${n==="dark"?"bg-gray-900":"bg-white"}`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[M.jsxs("div",{className:`flex items-center justify-between border-b px-4 py-3 ${n==="dark"?"border-gray-700":"border-gray-200"}`,children:[M.jsx(E9,{stack:t,onNavigate:l,theme:n}),M.jsx("button",{onClick:o,className:`rounded p-1 ${n==="dark"?"text-gray-400 hover:bg-gray-800 hover:text-gray-300":"text-gray-400 hover:bg-gray-100 hover:text-gray-600"}`,"aria-label":"Close inspector",children:M.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:M.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),M.jsx("div",{className:"relative flex-1 overflow-hidden",children:M.jsx(FS,{mode:"wait",initial:!1,children:M.jsx(hu.div,{className:"absolute inset-0",initial:h==="in"?"enterIn":"enterOut",animate:"center",exit:h==="in"?"exitIn":"exitOut",variants:C9,transition:{duration:.2,ease:"easeInOut"},children:M.jsx(S9,{frame:b,componentLibrary:e,onPushLevel:a,theme:n})},`${t.length}-${b.componentName}`)})})]})},"inspector-dialog")]})})}function N9(){const{fitView:t,zoomIn:e,zoomOut:n}=da(),o="bg-[var(--embed-bg-tertiary)] hover:opacity-80 text-[var(--embed-text-secondary)] p-1.5 rounded border border-[var(--embed-border)] transition-colors";return M.jsxs("div",{className:"flex items-center gap-1",children:[M.jsx("button",{onClick:()=>n(),className:o,title:"Zoom out","aria-label":"Zoom out",children:M.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:1.5,children:M.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14"})})}),M.jsx("button",{onClick:()=>e(),className:o,title:"Zoom in","aria-label":"Zoom in",children:M.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:1.5,children:M.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 5v14M5 12h14"})})}),M.jsx("button",{onClick:()=>t({padding:.3}),className:o,title:"Fit view","aria-label":"Fit view",children:M.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:1.5,children:M.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})})]})}let lm=null;function A9(){if(!lm){const t=new Map;lm={resolveCircuit:e=>t.get(e),getAllPrimitiveNames:()=>[...t.entries()].filter(([,e])=>e.implementation.kind==="primitive").map(([e])=>e),addCircuit:e=>{t.set(e.name,e)}}}return lm}function M9({circuit:t,componentLibrary:e,portValues:n,sequentialState:o,draggable:s=!0,layout:a,onToggleNode:l,onSetNodeValue:u,onLoadMemory:d,onNodeDoubleClick:h,height:p="100%",focus:m,className:y,renderEmptyState:b,renderOverlay:x,nodeTypes:w,edgeTypes:_,showControls:S=!0,showPortLabels:k,onPortClick:C,glowUnconnected:E,theme:R,panOnMobile:A=!1,onRequestRemount:O}){const D=m1(),U=R??D,q=$8(),Y=w??Tw,K=_??Nw,W=e??A9(),B=N.useMemo(()=>m?new Set(Array.isArray(m)?m:[m]):null,[m]),H=N.useMemo(()=>t?zj(t):null,[t]),{metadata:j}=U8(a?null:H),I=N.useMemo(()=>{if(!H)return{components:{},connections:{}};if(!a)return j;const mt={};for(const Ct of H.nodes){const It=Ct.label||Ct.id,zt=a[It]??a[Ct.id];zt&&(mt[Ct.id]={id:Ct.id,position:zt})}return{components:mt,connections:{}}},[H,j,a]),{projectedNodes:z,projectedEdges:$}=N.useMemo(()=>{if(!H)return{projectedNodes:[],projectedEdges:[]};const mt=hL(H,I,W,n??void 0,o??void 0),Ct=mt.nodes.map(It=>{const zt=It.data,Vt=zt?.componentRef,ve={...It.data};if(k&&(ve.showPortLabels=!0),E&&(ve.glowUnconnected=!0),C){const Wt=zt.label||zt.componentRef;ve.onPortClick=(je,xn)=>C(Wt,je,xn)}return Vt==="Input"&&u&&(ve.onValueChange=Wt=>u(It.id,Wt)),l&&(Vt==="Switch"||Vt==="Button")&&(ve.onToggle=()=>l(It.id)),d&&(Vt==="RV32I_InstrMem"||Vt==="DualPortROM")&&(ve.onLoadMemory=Wt=>d(It.id,Wt)),{...It,data:ve}});if(B){const It=new Set;for(const zt of Ct){const Vt=zt.data?.label??zt.id;B.has(Vt)&&It.add(zt.id)}return{projectedNodes:Ct.map(zt=>{const Vt=zt.data?.label??zt.id;return{...zt,style:{...zt.style,opacity:B.has(Vt)?1:.15,transition:"opacity 0.2s"}}}),projectedEdges:mt.edges.map(zt=>({...zt,style:{...zt.style,opacity:It.has(zt.source)||It.has(zt.target)?1:.15,transition:"opacity 0.2s"}}))}}return{projectedNodes:Ct,projectedEdges:mt.edges}},[H,I,W,n,o,l,u,d,B,k,C,E]),[G,L]=N.useState([]),[F,et]=N.useState([]),{fitView:rt}=da(),ct=lj(),ht=N.useRef(null),ft=N.useRef(new Set),ut=N.useRef(new Map),dt=N.useRef(0);N.useLayoutEffect(()=>{const mt=ht.current,Ct=ft.current,It=ut.current,zt=H?.name??null,Vt=new Set(z.map(Re=>Re.id)),ve=new Map;for(const Re of z){const me=Re.data,le=`${(me.inputNames??[]).join("|")}>${(me.outputNames??[]).join("|")}`;ve.set(Re.id,le)}ht.current=zt,ft.current=Vt,ut.current=ve;const Wt=zt!==mt;let je=0;for(const Re of Vt)Ct.has(Re)&&je++;const xn=Math.max(Ct.size,Vt.size),Pa=xn>0&&je/xn<.5,Hn=Wt||Pa,tr=[];if(!Hn)for(const[Re,me]of ve){const le=It.get(Re);le!==void 0&&le!==me&&tr.push(Re)}const Ba=dt.current===0;dt.current=z.length,L(Re=>{const me=new Map(Re.map(le=>[le.id,le]));return z.map(le=>{const ze=me.get(le.id);return ze&&!Hn?{...ze,type:le.type,data:le.data,selectable:le.selectable,deletable:le.deletable}:le})}),et($),Hn&&Ct.size>0?O?.():tr.length>0&&requestAnimationFrame(()=>ct(tr)),z.length>0&&Ba&&!Hn&&requestAnimationFrame(()=>rt({padding:.3}))},[z,$]);const Ot=N.useCallback(mt=>{L(Ct=>ub(mt,Ct))},[]),[At,bt]=N.useState([]),Tt=N.useCallback((mt,Ct,It)=>{bt(zt=>[...zt,{componentName:mt,componentDef:Ct,nodeLabel:It}])},[]),Dt=N.useCallback(()=>{bt(mt=>mt.slice(0,-1))},[]),Xt=N.useCallback(()=>{bt([])},[]),Ft=N.useCallback(mt=>{bt(Ct=>Ct.slice(0,mt+1))},[]),pt=N.useCallback(mt=>{if(!mt.isComposite)return;const Ct=W.resolveCircuit(mt.componentRef);Ct&&Ct.implementation.kind==="composite"&&Ct.nodes.length>0&&bt([{componentName:mt.componentRef,componentDef:Ct,nodeLabel:mt.label??mt.componentRef}])},[W]),yt=h??pt,vt=N.useCallback((mt,Ct)=>{yt(Ct.data)},[yt]);return M.jsxs("div",{"data-embed-theme":U,className:`bg-[var(--embed-bg-primary)] overflow-hidden relative ${y??""}`,style:{height:p},"aria-label":"Circuit diagram",children:[M.jsxs(aj,{nodes:G,edges:F,nodeTypes:Y,edgeTypes:K,onNodesChange:Ot,onNodeDoubleClick:vt,fitView:!0,minZoom:.1,maxZoom:3,fitViewOptions:{padding:.3,...B&&{nodes:G.filter(mt=>{const Ct=mt.data?.label??mt.id;return B.has(Ct)})}},nodesDraggable:s&&!q,nodesConnectable:!1,elementsSelectable:!0,selectionOnDrag:!1,panOnDrag:q&&!A?!1:[1,2],zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!1,preventScrolling:!1,proOptions:{hideAttribution:!0},deleteKeyCode:null,panActivationKeyCode:null,children:[M.jsx(hj,{variant:pi.Dots,gap:20,size:1,color:"var(--embed-dot-color)"}),S&&M.jsx(ua,{position:"bottom-left",children:M.jsx(N9,{})})]}),x?.(),!t&&(b?b():M.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-[var(--embed-text-muted)]",children:"No circuit"})),!h&&At.length>0&&M.jsx(T9,{stack:At,componentLibrary:W,theme:U,onClose:Xt,onPopLevel:Dt,onPushLevel:Tt,onNavigate:Ft})]})}function z2(t){const[e,n]=N.useState(0),o=N.useCallback(()=>{n(s=>s+1)},[]);return M.jsx(Zb,{children:M.jsx(M9,{...t,onRequestRemount:o})},e)}const R9=N.forwardRef(function({circuit:e,height:n=300,showControls:o=!0,autoHarness:s=!1,initialInputs:a,layout:l,theme:u,focus:d,showPortLabels:h,onPortClick:p,glowUnconnected:m,renderEmptyState:y,renderOverlay:b,onPortValuesChange:x},w){const _=RM(e,{autoHarness:s,initialInputs:a}),S=m1(),k=u??S,C=N.useRef(x);N.useEffect(()=>{C.current=x}),N.useEffect(()=>{!_.ready||!_.portValues||_.portValues.size===0||C.current?.(_.portValues)},[_.ready,_.portValues]);const E=N.useCallback(()=>{_.tick()},[_.tick]),R=N.useCallback(()=>{_.reset()},[_.reset]);if(N.useImperativeHandle(w,()=>({tick:E,reset:R,setNodeValue:_.setNodeValue,startAutoRun:_.startAutoRun,stopAutoRun:_.stopAutoRun}),[E,R,_.setNodeValue,_.startAutoRun,_.stopAutoRun]),_.error)return M.jsx("div",{style:{height:n},className:"flex items-center justify-center p-4",children:M.jsxs("div",{className:"text-sm text-red-400 bg-red-500/10 rounded p-3 border border-red-500/20",children:[M.jsx("div",{className:"font-medium mb-1",children:"Compilation Error"}),M.jsx("div",{className:"font-mono text-xs",children:_.error})]})});if(!_.ready)return M.jsx("div",{style:{height:n},className:"flex items-center justify-center text-muted-foreground/60 text-sm",children:"Compiling..."});const A=_.isSequential&&o?40:0,O=typeof n=="number"?n-A:n;return M.jsxs("div",{style:{height:n},className:"flex flex-col","data-embed-theme":k,children:[M.jsx("div",{className:"flex-1 min-h-0",children:M.jsx(z2,{circuit:_.circuit,componentLibrary:_.componentLibrary??void 0,portValues:_.portValues,sequentialState:_.sequentialState,onToggleNode:_.toggleNode,onSetNodeValue:_.setNodeValue,onLoadMemory:(D,U)=>{const q=_.getSimulator();q&&(q.setNode(D,U),_.runCombinational())},height:O,focus:d,showPortLabels:h,onPortClick:p,glowUnconnected:m,renderEmptyState:y,renderOverlay:b,...l?{layout:l}:{},...u?{theme:u}:{}})}),_.isSequential&&o&&M.jsx(j2,{cycle:_.cycleCount,historyLength:_.history?.length??0,historyIndex:_.historyIndex??-1,isRunning:_.isRunning,isViewingPast:_.isViewingPast??!1,onStep:E,onRun:()=>_.startAutoRun(15),onPause:()=>_.stopAutoRun(),onReset:R,onStepBack:()=>_.stepBack(),onStepForward:()=>{_.isViewingPast?_.stepForward():E()},speed:5})]})});var cm={exports:{}},V2;function k9(){return V2||(V2=1,(function(t){var e=(function(){var n=String.fromCharCode,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",a={};function l(d,h){if(!a[d]){a[d]={};for(var p=0;p<d.length;p++)a[d][d.charAt(p)]=p}return a[d][h]}var u={compressToBase64:function(d){if(d==null)return"";var h=u._compress(d,6,function(p){return o.charAt(p)});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"="}},decompressFromBase64:function(d){return d==null?"":d==""?null:u._decompress(d.length,32,function(h){return l(o,d.charAt(h))})},compressToUTF16:function(d){return d==null?"":u._compress(d,15,function(h){return n(h+32)})+" "},decompressFromUTF16:function(d){return d==null?"":d==""?null:u._decompress(d.length,16384,function(h){return d.charCodeAt(h)-32})},compressToUint8Array:function(d){for(var h=u.compress(d),p=new Uint8Array(h.length*2),m=0,y=h.length;m<y;m++){var b=h.charCodeAt(m);p[m*2]=b>>>8,p[m*2+1]=b%256}return p},decompressFromUint8Array:function(d){if(d==null)return u.decompress(d);for(var h=new Array(d.length/2),p=0,m=h.length;p<m;p++)h[p]=d[p*2]*256+d[p*2+1];var y=[];return h.forEach(function(b){y.push(n(b))}),u.decompress(y.join(""))},compressToEncodedURIComponent:function(d){return d==null?"":u._compress(d,6,function(h){return s.charAt(h)})},decompressFromEncodedURIComponent:function(d){return d==null?"":d==""?null:(d=d.replace(/ /g,"+"),u._decompress(d.length,32,function(h){return l(s,d.charAt(h))}))},compress:function(d){return u._compress(d,16,function(h){return n(h)})},_compress:function(d,h,p){if(d==null)return"";var m,y,b={},x={},w="",_="",S="",k=2,C=3,E=2,R=[],A=0,O=0,D;for(D=0;D<d.length;D+=1)if(w=d.charAt(D),Object.prototype.hasOwnProperty.call(b,w)||(b[w]=C++,x[w]=!0),_=S+w,Object.prototype.hasOwnProperty.call(b,_))S=_;else{if(Object.prototype.hasOwnProperty.call(x,S)){if(S.charCodeAt(0)<256){for(m=0;m<E;m++)A=A<<1,O==h-1?(O=0,R.push(p(A)),A=0):O++;for(y=S.charCodeAt(0),m=0;m<8;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1}else{for(y=1,m=0;m<E;m++)A=A<<1|y,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=0;for(y=S.charCodeAt(0),m=0;m<16;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1}k--,k==0&&(k=Math.pow(2,E),E++),delete x[S]}else for(y=b[S],m=0;m<E;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1;k--,k==0&&(k=Math.pow(2,E),E++),b[_]=C++,S=String(w)}if(S!==""){if(Object.prototype.hasOwnProperty.call(x,S)){if(S.charCodeAt(0)<256){for(m=0;m<E;m++)A=A<<1,O==h-1?(O=0,R.push(p(A)),A=0):O++;for(y=S.charCodeAt(0),m=0;m<8;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1}else{for(y=1,m=0;m<E;m++)A=A<<1|y,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=0;for(y=S.charCodeAt(0),m=0;m<16;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1}k--,k==0&&(k=Math.pow(2,E),E++),delete x[S]}else for(y=b[S],m=0;m<E;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1;k--,k==0&&(k=Math.pow(2,E),E++)}for(y=2,m=0;m<E;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1;for(;;)if(A=A<<1,O==h-1){R.push(p(A));break}else O++;return R.join("")},decompress:function(d){return d==null?"":d==""?null:u._decompress(d.length,32768,function(h){return d.charCodeAt(h)})},_decompress:function(d,h,p){var m=[],y=4,b=4,x=3,w="",_=[],S,k,C,E,R,A,O,D={val:p(0),position:h,index:1};for(S=0;S<3;S+=1)m[S]=S;for(C=0,R=Math.pow(2,2),A=1;A!=R;)E=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=p(D.index++)),C|=(E>0?1:0)*A,A<<=1;switch(C){case 0:for(C=0,R=Math.pow(2,8),A=1;A!=R;)E=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=p(D.index++)),C|=(E>0?1:0)*A,A<<=1;O=n(C);break;case 1:for(C=0,R=Math.pow(2,16),A=1;A!=R;)E=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=p(D.index++)),C|=(E>0?1:0)*A,A<<=1;O=n(C);break;case 2:return""}for(m[3]=O,k=O,_.push(O);;){if(D.index>d)return"";for(C=0,R=Math.pow(2,x),A=1;A!=R;)E=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=p(D.index++)),C|=(E>0?1:0)*A,A<<=1;switch(O=C){case 0:for(C=0,R=Math.pow(2,8),A=1;A!=R;)E=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=p(D.index++)),C|=(E>0?1:0)*A,A<<=1;m[b++]=n(C),O=b-1,y--;break;case 1:for(C=0,R=Math.pow(2,16),A=1;A!=R;)E=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=p(D.index++)),C|=(E>0?1:0)*A,A<<=1;m[b++]=n(C),O=b-1,y--;break;case 2:return _.join("")}if(y==0&&(y=Math.pow(2,x),x++),m[O])w=m[O];else if(O===b)w=k+k.charAt(0);else return null;_.push(w),m[b++]=k+w.charAt(0),y--,k=w,y==0&&(y=Math.pow(2,x),x++)}}};return u})();t!=null?t.exports=e:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return e})})(cm)),cm.exports}var O9=k9();function D9(t){return O9.compressToEncodedURIComponent(t)}const j9=N.createContext(null);function z9(){return N.useContext(j9)}function L2(){return typeof window>"u"?"https://simten.dev":window.location.hostname==="localhost"?window.location.origin:"https://simten.dev"}const V9=160,L9=90;function I9(t){if(!t)return 1.5;const e=Object.values(t);if(e.length===0)return 1.5;const n=Math.max(...e.map(s=>s.x))+V9,o=Math.max(...e.map(s=>s.y))+L9;return n<=0||o<=0?1.5:n/o}const P9=N.forwardRef(function({circuit:e,height:n,aspectRatio:o,showControls:s=!0,layout:a,theme:l,title:u,subtitle:d,description:h,href:p,focus:m,showPortLabels:y,onPortClick:b,glowUnconnected:x,autoRunSpeed:w=500,initialInputs:_,forkSource:S,onPortValuesChange:k},C){const E=u||h,[R,A]=N.useState(null),[O,D]=N.useState(!1),U=z9(),q=async()=>{if(!O)try{const j=S??bM(e);if(U){D(!0);const{hash:I}=await U(j);window.open(`${L2()}/circuit/s/${I}`,"_blank","noopener")}else{const I=D9(j);window.open(`${L2()}/circuit/${I}`,"_blank","noopener")}}catch(j){A(j instanceof Error?j.message:"Couldn't fork this circuit"),setTimeout(()=>A(null),3e3)}finally{D(!1)}},Y=n===void 0,K=o??I9(a),W={width:"100%",aspectRatio:String(K),minHeight:240,maxHeight:"70vh"},B=E?void 0:Y?W:{height:n},H=E?Y?W:{height:n}:{height:"100%"};return M.jsxs("div",{style:B,className:`relative flex flex-col ${E?"rounded-xl border border-[var(--embed-border)] overflow-hidden bg-[var(--embed-bg-secondary)]":""}`,children:[!E&&!p&&M.jsx("button",{type:"button",onClick:q,title:R??"Open and modify this circuit in the Simten editor",className:"absolute top-2 right-2 z-10 hidden md:flex items-center px-2.5 py-1 rounded border border-[var(--embed-border)] bg-[var(--embed-bg-secondary)] text-[11px] text-[var(--embed-text-primary)] hover:opacity-80 transition-colors shadow-sm",children:R?"Fork failed":"Fork →"}),M.jsx("div",{style:H,className:"min-h-0",children:M.jsx(R9,{ref:C,circuit:e,height:"100%",showControls:s,autoHarness:!0,initialInputs:_,layout:a,theme:l,focus:m,showPortLabels:y,onPortClick:b,glowUnconnected:x,autoRunSpeed:w,onPortValuesChange:k})}),E&&M.jsxs("div",{className:"border-t border-[var(--embed-border)] px-4 py-3 flex items-end justify-between gap-4",children:[M.jsxs("div",{children:[M.jsx("div",{className:"text-base font-semibold text-[var(--embed-text-primary)]",children:u}),d&&M.jsx("div",{className:"text-xs text-[var(--embed-text-muted)] font-mono mt-0.5",children:d}),h&&M.jsx("div",{className:"text-sm text-[var(--embed-text-secondary)] mt-1.5 leading-relaxed",children:h})]}),p?M.jsx("a",{href:p,className:"shrink-0 px-3 py-1.5 rounded border border-[var(--embed-border)] text-xs text-[var(--embed-text-primary)] hover:opacity-80 transition-colors",children:"Open →"}):M.jsx("button",{type:"button",onClick:q,title:R??"Open and modify this circuit in the Simten editor",className:"hidden md:flex items-center shrink-0 px-3 py-1.5 rounded border border-[var(--embed-border)] text-xs text-[var(--embed-text-primary)] hover:opacity-80 transition-colors",children:R?`Can't fork: ${R.slice(0,40)}`:"Fork →"})]})]})});function B9({code:t,height:e,showControls:n,title:o,subtitle:s,description:a,href:l,autoRunSpeed:u,theme:d}){const h=Wf(),[p,m]=N.useState(null),[y,b]=N.useState(null);return N.useEffect(()=>{if(!t){m(null),b(null);return}let x=!1;return h.compile(t).then(w=>{if(x)return;if("error"in w){b(w.error),m(null);return}const _=w.circuits[w.circuits.length-1];if(!_){b("No circuit found in code"),m(null);return}b(null),m(yM(_,w.libraryCircuits))}),()=>{x=!0}},[t,h]),t?y?M.jsx("div",{style:{height:e},className:"flex items-center justify-center p-4",children:M.jsxs("div",{className:"text-sm text-red-400 bg-red-500/10 rounded p-3 border border-red-500/20",children:[M.jsx("div",{className:"font-medium mb-1",children:"Error"}),M.jsx("div",{className:"font-mono text-xs whitespace-pre-wrap",children:y})]})}):p?M.jsx("div",{"data-embed-theme":d??"dark",children:M.jsx(P9,{circuit:p,height:e,showControls:n,title:o,subtitle:s,description:a,href:l,forkSource:t,autoRunSpeed:u,theme:d})}):M.jsx("div",{style:{height:e},className:"flex items-center justify-center text-sm text-gray-500",children:"Compiling..."}):M.jsx("div",{style:{height:e},className:"flex items-center justify-center text-sm text-gray-500",children:"No circuit code provided"})}function H9(t){return M.jsx(FN,{children:M.jsx(B9,{...t})})}const I2=HN(H9,{props:{code:"string",height:"number",showControls:"boolean",title:"string",subtitle:"string",description:"string",href:"string",autoRunSpeed:"number",theme:"string"}});return customElements.get("circuit-embed")||customElements.define("circuit-embed",I2),Hf.CircuitEmbedWC=I2,Object.defineProperty(Hf,Symbol.toStringTag,{value:"Module"}),Hf})({});
|