@simten/embed 0.1.5 → 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(Vf){"use strict";var Lf=typeof document<"u"?document.currentScript:null;function tN(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 l=Object.getOwnPropertyDescriptor(i,s);l&&Object.defineProperty(t,s,l.get?l:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function If(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Bf={exports:{}},Dt={};var m0;function eN(){if(m0)return Dt;m0=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"),l=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,q,tt){this.props=L,this.context=q,this.refs=S,this.updater=tt||x}E.prototype.isReactComponent={},E.prototype.setState=function(L,q){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,q,"setState")},E.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function O(){}O.prototype=E.prototype;function C(L,q,tt){this.props=L,this.context=q,this.refs=S,this.updater=tt||x}var _=C.prototype=new O;_.constructor=C,w(_,E.prototype),_.isPureReactComponent=!0;var R=Array.isArray;function A(){}var k={H:null,A:null,T:null,S:null},D=Object.prototype.hasOwnProperty;function H(L,q,tt){var rt=tt.ref;return{$$typeof:t,type:L,key:q,ref:rt!==void 0?rt:null,props:tt}}function Y(L,q){return H(L.type,q,L.props)}function $(L){return typeof L=="object"&&L!==null&&L.$$typeof===t}function F(L){var q={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(tt){return q[tt]})}var Q=/\/+/g;function B(L,q){return typeof L=="object"&&L!==null&&L.key!=null?F(""+L.key):q.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(q){L.status==="pending"&&(L.status="fulfilled",L.value=q)},function(q){L.status==="pending"&&(L.status="rejected",L.reason=q)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function j(L,q,tt,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),q,tt,rt,ct)}}if(ft)return ct=ct(L),ft=rt===""?"."+B(L,0):rt,R(ct)?(tt="",ft!=null&&(tt=ft.replace(Q,"$&/")+"/"),j(ct,q,tt,"",function(kt){return kt})):ct!=null&&($(ct)&&(ct=Y(ct,tt+(ct.key==null||L&&L.key===ct.key?"":(""+ct.key).replace(Q,"$&/")+"/")+ft)),q.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,q,tt,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,q,tt,ht,ct);else if(ht==="object"){if(typeof L.then=="function")return j(P(L),q,tt,rt,ct);throw q=String(L),Error("Objects are not valid as a React child (found: "+(q==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":q)+"). If you meant to render a collection of children, use an array instead.")}return ft}function I(L,q,tt){if(L==null)return L;var rt=[],ct=0;return j(L,rt,"","",function(ht){return q.call(tt,ht,ct++)}),rt}function z(L){if(L._status===-1){var q=L._result;q=q(),q.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=q)}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 q=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(q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},G={map:I,forEach:function(L,q,tt){I(L,function(){q.apply(this,arguments)},tt)},count:function(L){var q=0;return I(L,function(){q++}),q},toArray:function(L){return I(L,function(q){return q})||[]},only:function(L){if(!$(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Dt.Activity=m,Dt.Children=G,Dt.Component=E,Dt.Fragment=n,Dt.Profiler=s,Dt.PureComponent=C,Dt.StrictMode=i,Dt.Suspense=d,Dt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=k,Dt.__COMPILER_RUNTIME={__proto__:null,c:function(L){return k.H.useMemoCache(L)}},Dt.cache=function(L){return function(){return L.apply(null,arguments)}},Dt.cacheSignal=function(){return null},Dt.cloneElement=function(L,q,tt){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(q!=null)for(ht in q.key!==void 0&&(ct=""+q.key),q)!D.call(q,ht)||ht==="key"||ht==="__self"||ht==="__source"||ht==="ref"&&q.ref===void 0||(rt[ht]=q[ht]);var ht=arguments.length-2;if(ht===1)rt.children=tt;else if(1<ht){for(var ft=Array(ht),ut=0;ut<ht;ut++)ft[ut]=arguments[ut+2];rt.children=ft}return H(L.type,ct,rt)},Dt.createContext=function(L){return L={$$typeof:c,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:l,_context:L},L},Dt.createElement=function(L,q,tt){var rt,ct={},ht=null;if(q!=null)for(rt in q.key!==void 0&&(ht=""+q.key),q)D.call(q,rt)&&rt!=="key"&&rt!=="__self"&&rt!=="__source"&&(ct[rt]=q[rt]);var ft=arguments.length-2;if(ft===1)ct.children=tt;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 H(L,ht,ct)},Dt.createRef=function(){return{current:null}},Dt.forwardRef=function(L){return{$$typeof:u,render:L}},Dt.isValidElement=$,Dt.lazy=function(L){return{$$typeof:p,_payload:{_status:-1,_result:L},_init:z}},Dt.memo=function(L,q){return{$$typeof:h,type:L,compare:q===void 0?null:q}},Dt.startTransition=function(L){var q=k.T,tt={};k.T=tt;try{var rt=L(),ct=k.S;ct!==null&&ct(tt,rt),typeof rt=="object"&&rt!==null&&typeof rt.then=="function"&&rt.then(A,U)}catch(ht){U(ht)}finally{q!==null&&tt.types!==null&&(q.types=tt.types),k.T=q}},Dt.unstable_useCacheRefresh=function(){return k.H.useCacheRefresh()},Dt.use=function(L){return k.H.use(L)},Dt.useActionState=function(L,q,tt){return k.H.useActionState(L,q,tt)},Dt.useCallback=function(L,q){return k.H.useCallback(L,q)},Dt.useContext=function(L){return k.H.useContext(L)},Dt.useDebugValue=function(){},Dt.useDeferredValue=function(L,q){return k.H.useDeferredValue(L,q)},Dt.useEffect=function(L,q){return k.H.useEffect(L,q)},Dt.useEffectEvent=function(L){return k.H.useEffectEvent(L)},Dt.useId=function(){return k.H.useId()},Dt.useImperativeHandle=function(L,q,tt){return k.H.useImperativeHandle(L,q,tt)},Dt.useInsertionEffect=function(L,q){return k.H.useInsertionEffect(L,q)},Dt.useLayoutEffect=function(L,q){return k.H.useLayoutEffect(L,q)},Dt.useMemo=function(L,q){return k.H.useMemo(L,q)},Dt.useOptimistic=function(L,q){return k.H.useOptimistic(L,q)},Dt.useReducer=function(L,q,tt){return k.H.useReducer(L,q,tt)},Dt.useRef=function(L){return k.H.useRef(L)},Dt.useState=function(L){return k.H.useState(L)},Dt.useSyncExternalStore=function(L,q,tt){return k.H.useSyncExternalStore(L,q,tt)},Dt.useTransition=function(){return k.H.useTransition()},Dt.version="19.2.0",Dt}var g0;function Ls(){return g0||(g0=1,Bf.exports=eN()),Bf.exports}var N=Ls();const Ai=If(N),y0=tN({__proto__:null,default:Ai},[N]);var Pf={exports:{}},Is={},Hf={exports:{}},Uf={};var v0;function nN(){return v0||(v0=1,(function(t){function e(j,I){var z=j.length;j.push(I);t:for(;0<z;){var U=z-1>>>1,G=j[U];if(0<s(G,I))j[U]=I,j[z]=G,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,G=j.length,L=G>>>1;U<L;){var q=2*(U+1)-1,tt=j[q],rt=q+1,ct=j[rt];if(0>s(tt,z))rt<G&&0>s(ct,tt)?(j[U]=ct,j[rt]=z,U=rt):(j[U]=tt,j[q]=z,U=q);else if(rt<G&&0>s(ct,z))j[U]=ct,j[rt]=z,U=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 l=performance;t.unstable_now=function(){return l.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,O=typeof clearTimeout=="function"?clearTimeout:null,C=typeof setImmediate<"u"?setImmediate:null;function _(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,_(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,k=-1,D=5,H=-1;function Y(){return S?!0:!(t.unstable_now()-H<D)}function $(){if(S=!1,A){var j=t.unstable_now();H=j;var I=!0;try{t:{x=!1,w&&(w=!1,O(k),k=-1),b=!0;var z=y;try{e:{for(_(j),m=n(d);m!==null&&!(m.expirationTime>j&&Y());){var U=m.callback;if(typeof U=="function"){m.callback=null,y=m.priorityLevel;var G=U(m.expirationTime<=j);if(j=t.unstable_now(),typeof G=="function"){m.callback=G,_(j),I=!0;break e}m===n(d)&&i(d),_(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 C=="function")F=function(){C($)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,B=Q.port2;Q.port1.onmessage=$,F=function(){B.postMessage(null)}}else F=function(){E($,0)};function P(j,I){k=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"):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(){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 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>U?(j.sortIndex=z,e(h,j),n(d)===null&&j===n(h)&&(w?(O(k),k=-1):w=!0,P(R,z-U))):(j.sortIndex=G,e(d,j),x||b||(x=!0,A||(A=!0,F()))),j},t.unstable_shouldYield=Y,t.unstable_wrapCallback=function(j){var I=y;return function(){var z=y;y=I;try{return j.apply(this,arguments)}finally{y=z}}}})(Uf)),Uf}var b0;function oN(){return b0||(b0=1,Hf.exports=nN()),Hf.exports}var $f={exports:{}},Pe={};var x0;function iN(){if(x0)return Pe;x0=1;var t=Ls();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 l(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 Pe.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Pe.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 l(d,h,null,p)},Pe.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()}},Pe.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))},Pe.prefetchDNS=function(d){typeof d=="string"&&i.d.D(d)},Pe.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})}},Pe.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)},Pe.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})}},Pe.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)},Pe.requestFormReset=function(d){i.d.r(d)},Pe.unstable_batchedUpdates=function(d,h){return d(h)},Pe.useFormState=function(d,h,p){return c.H.useFormState(d,h,p)},Pe.useFormStatus=function(){return c.H.useHostTransitionStatus()},Pe.version="19.2.0",Pe}var w0;function S0(){if(w0)return $f.exports;w0=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(),$f.exports=iN(),$f.exports}var E0;function rN(){if(E0)return Is;E0=1;var t=oN(),e=Ls(),n=S0();function i(o){var r="https://react.dev/errors/"+o;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)r+="&args[]="+encodeURIComponent(arguments[a])}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 l(o){var r=o,a=o;if(o.alternate)for(;r.return;)r=r.return;else{o=r;do r=o,(r.flags&4098)!==0&&(a=r.return),o=r.return;while(o)}return r.tag===3?a: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(l(o)!==o)throw Error(i(188))}function h(o){var r=o.alternate;if(!r){if(r=l(o),r===null)throw Error(i(188));return r!==o?null:o}for(var a=o,f=r;;){var g=a.return;if(g===null)break;var v=g.alternate;if(v===null){if(f=g.return,f!==null){a=f;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===a)return d(g),o;if(v===f)return d(g),r;v=v.sibling}throw Error(i(188))}if(a.return!==f.return)a=g,f=v;else{for(var T=!1,V=g.child;V;){if(V===a){T=!0,a=g,f=v;break}if(V===f){T=!0,f=g,a=v;break}V=V.sibling}if(!T){for(V=v.child;V;){if(V===a){T=!0,a=v,f=g;break}if(V===f){T=!0,f=v,a=g;break}V=V.sibling}if(!T)throw Error(i(189))}}if(a.alternate!==f)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?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"),O=Symbol.for("react.consumer"),C=Symbol.for("react.context"),_=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),k=Symbol.for("react.memo"),D=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),Y=Symbol.for("react.memo_cache_sentinel"),$=Symbol.iterator;function F(o){return o===null||typeof o!="object"?null:(o=$&&o[$]||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 C:return o.displayName||"Context";case O:return(o._context.displayName||"Context")+".Consumer";case _:var r=o.render;return o=o.displayName,o||(o=r.displayName||r.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case k:return r=o.displayName||null,r!==null?r:B(o.type)||"Memo";case D: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=[],G=-1;function L(o){return{current:o}}function q(o){0>G||(o.current=U[G],U[G]=null,G--)}function tt(o,r){G++,U[G]=o.current,o.current=r}var rt=L(null),ct=L(null),ht=L(null),ft=L(null);function ut(o,r){switch(tt(ht,r),tt(ct,o),tt(rt,null),r.nodeType){case 9:case 11:o=(o=r.documentElement)&&(o=o.namespaceURI)?ET(o):0;break;default:if(o=r.tagName,r=r.namespaceURI)r=ET(r),o=_T(r,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}q(rt),tt(rt,o)}function dt(){q(rt),q(ct),q(ht)}function kt(o){o.memoizedState!==null&&tt(ft,o);var r=rt.current,a=_T(r,o.type);r!==a&&(tt(ct,o),tt(rt,a))}function At(o){ct.current===o&&(q(rt),q(ct)),ft.current===o&&(q(ft),Tl._currentValue=z)}var bt,Tt;function Ot(o){if(bt===void 0)try{throw Error()}catch(a){var r=a.stack.trim().match(/\n( *(at )?)/);bt=r&&r[1]||"",Tt=-1<a.stack.indexOf(`
|
|
2
|
-
at`)?" (<anonymous>)":-1<
|
|
3
|
-
`+bt+
|
|
4
|
-
`),
|
|
5
|
-
`);for(g=f=0;f<
|
|
6
|
-
`+
|
|
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
|
+
`),nt=V.split(`
|
|
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 vt=Object.prototype.hasOwnProperty,mt=t.unstable_scheduleCallback,Ct=t.unstable_cancelCallback,Lt=t.unstable_shouldYield,jt=t.unstable_requestPaint,zt=t.unstable_now,ge=t.unstable_getCurrentPriorityLevel,Qt=t.unstable_ImmediatePriority,Oe=t.unstable_UserBlockingPriority,yn=t.unstable_NormalPriority,za=t.unstable_LowPriority,In=t.unstable_IdlePriority,Ki=t.log,Va=t.unstable_setDisableYieldValue,Ae=null,he=null;function se(o){if(typeof Ki=="function"&&Va(o),he&&typeof he.setStrictMode=="function")try{he.setStrictMode(Ae,o)}catch{}}var De=Math.clz32?Math.clz32:om,em=Math.log,nm=Math.LN2;function om(o){return o>>>=0,o===0?32:31-(em(o)/nm|0)|0}var Qr=256,Wr=262144,Jr=4194304;function vo(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 ts(o,r,a){var f=o.pendingLanes;if(f===0)return 0;var g=0,v=o.suspendedLanes,T=o.pingedLanes;o=o.warmLanes;var V=f&134217727;return V!==0?(f=V&~v,f!==0?g=vo(f):(T&=V,T!==0?g=vo(T):a||(a=V&~o,a!==0&&(g=vo(a))))):(V=f&~v,V!==0?g=vo(V):T!==0?g=vo(T):a||(a=f&~o,a!==0&&(g=vo(a)))),g===0?0:r!==0&&r!==g&&(r&v)===0&&(v=g&-g,a=r&-r,v>=a||v===32&&(a&4194048)!==0)?r:g}function Qi(o,r){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&r)===0}function im(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 du(){var o=Jr;return Jr<<=1,(Jr&62914560)===0&&(Jr=4194304),o}function La(o){for(var r=[],a=0;31>a;a++)r.push(o);return r}function Wi(o,r){o.pendingLanes|=r,r!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function rm(o,r,a,f,g,v){var T=o.pendingLanes;o.pendingLanes=a,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=a,o.entangledLanes&=a,o.errorRecoveryDisabledLanes&=a,o.shellSuspendCounter=0;var V=o.entanglements,X=o.expirationTimes,et=o.hiddenUpdates;for(a=T&~a;0<a;){var st=31-De(a),lt=1<<st;V[st]=0,X[st]=-1;var ot=et[st];if(ot!==null)for(et[st]=null,st=0;st<ot.length;st++){var it=ot[st];it!==null&&(it.lane&=-536870913)}a&=~lt}f!==0&&hu(o,f,0),v!==0&&g===0&&o.tag!==0&&(o.suspendedLanes|=v&~(T&~r))}function hu(o,r,a){o.pendingLanes|=r,o.suspendedLanes&=~r;var f=31-De(r);o.entangledLanes|=r,o.entanglements[f]=o.entanglements[f]|1073741824|a&261930}function pu(o,r){var a=o.entangledLanes|=r;for(o=o.entanglements;a;){var f=31-De(a),g=1<<f;g&r|o[f]&r&&(o[f]|=r),a&=~g}}function mu(o,r){var a=r&-r;return a=(a&42)!==0?1:Ia(a),(a&(o.suspendedLanes|r))!==0?0:a}function Ia(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 Ba(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function gu(){var o=I.p;return o!==0?o:(o=window.event,o===void 0?32:XT(o.type))}function yu(o,r){var a=I.p;try{return I.p=o,r()}finally{I.p=a}}var no=Math.random().toString(36).slice(2),Me="__reactFiber$"+no,Ue="__reactProps$"+no,bo="__reactContainer$"+no,es="__reactEvents$"+no,vu="__reactListeners$"+no,sm="__reactHandles$"+no,bu="__reactResources$"+no,Ji="__reactMarker$"+no;function Pa(o){delete o[Me],delete o[Ue],delete o[es],delete o[vu],delete o[sm]}function ti(o){var r=o[Me];if(r)return r;for(var a=o.parentNode;a;){if(r=a[bo]||a[Me]){if(a=r.alternate,r.child!==null||a!==null&&a.child!==null)for(o=kT(o);o!==null;){if(a=o[Me])return a;o=kT(o)}return r}o=a,a=o.parentNode}return null}function ei(o){if(o=o[Me]||o[bo]){var r=o.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return o}return null}function ni(o){var r=o.tag;if(r===5||r===26||r===27||r===6)return o.stateNode;throw Error(i(33))}function oi(o){var r=o[bu];return r||(r=o[bu]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function we(o){o[Ji]=!0}var xu=new Set,wu={};function xo(o,r){ii(o,r),ii(o+"Capture",r)}function ii(o,r){for(wu[o]=r,o=0;o<r.length;o++)xu.add(r[o])}var am=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]*$"),Ha={},Su={};function lm(o){return vt.call(Su,o)?!0:vt.call(Ha,o)?!1:am.test(o)?Su[o]=!0:(Ha[o]=!0,!1)}function ns(o,r,a){if(lm(r))if(a===null)o.removeAttribute(r);else{switch(typeof a){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,""+a)}}function os(o,r,a){if(a===null)o.removeAttribute(r);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(r);return}o.setAttribute(r,""+a)}}function Bn(o,r,a,f){if(f===null)o.removeAttribute(a);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(a);return}o.setAttributeNS(r,a,""+f)}}function Fe(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Eu(o){var r=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function cm(o,r,a){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(T){a=""+T,v.call(this,T)}}),Object.defineProperty(o,r,{enumerable:f.enumerable}),{getValue:function(){return a},setValue:function(T){a=""+T},stopTracking:function(){o._valueTracker=null,delete o[r]}}}}function is(o){if(!o._valueTracker){var r=Eu(o)?"checked":"value";o._valueTracker=cm(o,r,""+o[r])}}function _u(o){if(!o)return!1;var r=o._valueTracker;if(!r)return!0;var a=r.getValue(),f="";return o&&(f=Eu(o)?o.checked?"true":"false":o.value),o=f,o!==a?(r.setValue(o),!0):!1}function tr(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 um=/[\n"\\]/g;function Ze(o){return o.replace(um,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function er(o,r,a,f,g,v,T,V){o.name="",T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"?o.type=T:o.removeAttribute("type"),r!=null?T==="number"?(r===0&&o.value===""||o.value!=r)&&(o.value=""+Fe(r)):o.value!==""+Fe(r)&&(o.value=""+Fe(r)):T!=="submit"&&T!=="reset"||o.removeAttribute("value"),r!=null?Ua(o,T,Fe(r)):a!=null?Ua(o,T,Fe(a)):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=""+Fe(V):o.removeAttribute("name")}function Cu(o,r,a,f,g,v,T,V){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(o.type=v),r!=null||a!=null){if(!(v!=="submit"&&v!=="reset"||r!=null)){is(o);return}a=a!=null?""+Fe(a):"",r=r!=null?""+Fe(r):a,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,T!=null&&typeof T!="function"&&typeof T!="symbol"&&typeof T!="boolean"&&(o.name=T),is(o)}function Ua(o,r,a){r==="number"&&tr(o.ownerDocument)===o||o.defaultValue===""+a||(o.defaultValue=""+a)}function wo(o,r,a,f){if(o=o.options,r){r={};for(var g=0;g<a.length;g++)r["$"+a[g]]=!0;for(a=0;a<o.length;a++)g=r.hasOwnProperty("$"+o[a].value),o[a].selected!==g&&(o[a].selected=g),g&&f&&(o[a].defaultSelected=!0)}else{for(a=""+Fe(a),r=null,g=0;g<o.length;g++){if(o[g].value===a){o[g].selected=!0,f&&(o[g].defaultSelected=!0);return}r!==null||o[g].disabled||(r=o[g])}r!==null&&(r.selected=!0)}}function v_(o,r,a){if(r!=null&&(r=""+Fe(r),r!==o.value&&(o.value=r),a==null)){o.defaultValue!==r&&(o.defaultValue=r);return}o.defaultValue=a!=null?""+Fe(a):""}function b_(o,r,a,f){if(r==null){if(f!=null){if(a!=null)throw Error(i(92));if(P(f)){if(1<f.length)throw Error(i(93));f=f[0]}a=f}a==null&&(a=""),r=a}a=Fe(r),o.defaultValue=a,f=o.textContent,f===a&&f!==""&&f!==null&&(o.value=f),is(o)}function rs(o,r){if(r){var a=o.firstChild;if(a&&a===o.lastChild&&a.nodeType===3){a.nodeValue=r;return}}o.textContent=r}var O$=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 x_(o,r,a){var f=r.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?f?o.setProperty(r,""):r==="float"?o.cssFloat="":o[r]="":f?o.setProperty(r,a):typeof a!="number"||a===0||O$.has(r)?r==="float"?o.cssFloat=a:o[r]=(""+a).trim():o[r]=a+"px"}function w_(o,r,a){if(r!=null&&typeof r!="object")throw Error(i(62));if(o=o.style,a!=null){for(var f in a)!a.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)&&a[g]!==f&&x_(o,g,f)}else for(var v in r)r.hasOwnProperty(v)&&x_(o,v,r[v])}function fm(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 D$=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"]]),j$=/^[\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 Tu(o){return j$.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function So(){}var dm=null;function hm(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var ss=null,as=null;function S_(o){var r=ei(o);if(r&&(o=r.stateNode)){var a=o[Ue]||null;t:switch(o=r.stateNode,r.type){case"input":if(er(o,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),r=a.name,a.type==="radio"&&r!=null){for(a=o;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+Ze(""+r)+'"][type="radio"]'),r=0;r<a.length;r++){var f=a[r];if(f!==o&&f.form===o.form){var g=f[Ue]||null;if(!g)throw Error(i(90));er(f,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(r=0;r<a.length;r++)f=a[r],f.form===o.form&&_u(f)}break t;case"textarea":v_(o,a.value,a.defaultValue);break t;case"select":r=a.value,r!=null&&wo(o,!!a.multiple,r,!1)}}}var pm=!1;function E_(o,r,a){if(pm)return o(r,a);pm=!0;try{var f=o(r);return f}finally{if(pm=!1,(ss!==null||as!==null)&&(pf(),ss&&(r=ss,o=as,as=ss=null,S_(r),o)))for(r=0;r<o.length;r++)S_(o[r])}}function $a(o,r){var a=o.stateNode;if(a===null)return null;var f=a[Ue]||null;if(f===null)return null;a=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(a&&typeof a!="function")throw Error(i(231,r,typeof a));return a}var Eo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),mm=!1;if(Eo)try{var Ya={};Object.defineProperty(Ya,"passive",{get:function(){mm=!0}}),window.addEventListener("test",Ya,Ya),window.removeEventListener("test",Ya,Ya)}catch{mm=!1}var ri=null,gm=null,Nu=null;function __(){if(Nu)return Nu;var o,r=gm,a=r.length,f,g="value"in ri?ri.value:ri.textContent,v=g.length;for(o=0;o<a&&r[o]===g[o];o++);var T=a-o;for(f=1;f<=T&&r[a-f]===g[v-f];f++);return Nu=g.slice(o,1<f?1-f:void 0)}function Au(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 Mu(){return!0}function C_(){return!1}function Ke(o){function r(a,f,g,v,T){this._reactName=a,this._targetInst=g,this.type=f,this.nativeEvent=v,this.target=T,this.currentTarget=null;for(var V in o)o.hasOwnProperty(V)&&(a=o[V],this[V]=a?a(v):v[V]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Mu:C_,this.isPropagationStopped=C_,this}return m(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=Mu)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=Mu)},persist:function(){},isPersistent:Mu}),r}var nr={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Ru=Ke(nr),Ga=m({},nr,{view:0,detail:0}),z$=Ke(Ga),ym,vm,qa,ku=m({},Ga,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:xm,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!==qa&&(qa&&o.type==="mousemove"?(ym=o.screenX-qa.screenX,vm=o.screenY-qa.screenY):vm=ym=0,qa=o),ym)},movementY:function(o){return"movementY"in o?o.movementY:vm}}),T_=Ke(ku),V$=m({},ku,{dataTransfer:0}),L$=Ke(V$),I$=m({},Ga,{relatedTarget:0}),bm=Ke(I$),B$=m({},nr,{animationName:0,elapsedTime:0,pseudoElement:0}),P$=Ke(B$),H$=m({},nr,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),U$=Ke(H$),$$=m({},nr,{data:0}),N_=Ke($$),Y$={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},G$={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"},q$={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function X$(o){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(o):(o=q$[o])?!!r[o]:!1}function xm(){return X$}var F$=m({},Ga,{key:function(o){if(o.key){var r=Y$[o.key]||o.key;if(r!=="Unidentified")return r}return o.type==="keypress"?(o=Au(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?G$[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:xm,charCode:function(o){return o.type==="keypress"?Au(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Au(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),Z$=Ke(F$),K$=m({},ku,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),A_=Ke(K$),Q$=m({},Ga,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:xm}),W$=Ke(Q$),J$=m({},nr,{propertyName:0,elapsedTime:0,pseudoElement:0}),t9=Ke(J$),e9=m({},ku,{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}),n9=Ke(e9),o9=m({},nr,{newState:0,oldState:0}),i9=Ke(o9),r9=[9,13,27,32],wm=Eo&&"CompositionEvent"in window,Xa=null;Eo&&"documentMode"in document&&(Xa=document.documentMode);var s9=Eo&&"TextEvent"in window&&!Xa,M_=Eo&&(!wm||Xa&&8<Xa&&11>=Xa),R_=" ",k_=!1;function O_(o,r){switch(o){case"keyup":return r9.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function D_(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var ls=!1;function a9(o,r){switch(o){case"compositionend":return D_(r);case"keypress":return r.which!==32?null:(k_=!0,R_);case"textInput":return o=r.data,o===R_&&k_?null:o;default:return null}}function l9(o,r){if(ls)return o==="compositionend"||!wm&&O_(o,r)?(o=__(),Nu=gm=ri=null,ls=!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 M_&&r.locale!=="ko"?null:r.data;default:return null}}var c9={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 j_(o){var r=o&&o.nodeName&&o.nodeName.toLowerCase();return r==="input"?!!c9[o.type]:r==="textarea"}function z_(o,r,a,f){ss?as?as.push(f):as=[f]:ss=f,r=wf(r,"onChange"),0<r.length&&(a=new Ru("onChange","change",null,a,f),o.push({event:a,listeners:r}))}var Fa=null,Za=null;function u9(o){yT(o,0)}function Ou(o){var r=ni(o);if(_u(r))return o}function V_(o,r){if(o==="change")return r}var L_=!1;if(Eo){var Sm;if(Eo){var Em="oninput"in document;if(!Em){var I_=document.createElement("div");I_.setAttribute("oninput","return;"),Em=typeof I_.oninput=="function"}Sm=Em}else Sm=!1;L_=Sm&&(!document.documentMode||9<document.documentMode)}function B_(){Fa&&(Fa.detachEvent("onpropertychange",P_),Za=Fa=null)}function P_(o){if(o.propertyName==="value"&&Ou(Za)){var r=[];z_(r,Za,o,hm(o)),E_(u9,r)}}function f9(o,r,a){o==="focusin"?(B_(),Fa=r,Za=a,Fa.attachEvent("onpropertychange",P_)):o==="focusout"&&B_()}function d9(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Ou(Za)}function h9(o,r){if(o==="click")return Ou(r)}function p9(o,r){if(o==="input"||o==="change")return Ou(r)}function m9(o,r){return o===r&&(o!==0||1/o===1/r)||o!==o&&r!==r}var an=typeof Object.is=="function"?Object.is:m9;function Ka(o,r){if(an(o,r))return!0;if(typeof o!="object"||o===null||typeof r!="object"||r===null)return!1;var a=Object.keys(o),f=Object.keys(r);if(a.length!==f.length)return!1;for(f=0;f<a.length;f++){var g=a[f];if(!vt.call(r,g)||!an(o[g],r[g]))return!1}return!0}function H_(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function U_(o,r){var a=H_(o);o=0;for(var f;a;){if(a.nodeType===3){if(f=o+a.textContent.length,o<=r&&f>=r)return{node:a,offset:r-o};o=f}t:{for(;a;){if(a.nextSibling){a=a.nextSibling;break t}a=a.parentNode}a=void 0}a=H_(a)}}function $_(o,r){return o&&r?o===r?!0:o&&o.nodeType===3?!1:r&&r.nodeType===3?$_(o,r.parentNode):"contains"in o?o.contains(r):o.compareDocumentPosition?!!(o.compareDocumentPosition(r)&16):!1:!1}function Y_(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var r=tr(o.document);r instanceof o.HTMLIFrameElement;){try{var a=typeof r.contentWindow.location.href=="string"}catch{a=!1}if(a)o=r.contentWindow;else break;r=tr(o.document)}return r}function _m(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 g9=Eo&&"documentMode"in document&&11>=document.documentMode,cs=null,Cm=null,Qa=null,Tm=!1;function G_(o,r,a){var f=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;Tm||cs==null||cs!==tr(f)||(f=cs,"selectionStart"in f&&_m(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}),Qa&&Ka(Qa,f)||(Qa=f,f=wf(Cm,"onSelect"),0<f.length&&(r=new Ru("onSelect","select",null,r,a),o.push({event:r,listeners:f}),r.target=cs)))}function or(o,r){var a={};return a[o.toLowerCase()]=r.toLowerCase(),a["Webkit"+o]="webkit"+r,a["Moz"+o]="moz"+r,a}var us={animationend:or("Animation","AnimationEnd"),animationiteration:or("Animation","AnimationIteration"),animationstart:or("Animation","AnimationStart"),transitionrun:or("Transition","TransitionRun"),transitionstart:or("Transition","TransitionStart"),transitioncancel:or("Transition","TransitionCancel"),transitionend:or("Transition","TransitionEnd")},Nm={},q_={};Eo&&(q_=document.createElement("div").style,"AnimationEvent"in window||(delete us.animationend.animation,delete us.animationiteration.animation,delete us.animationstart.animation),"TransitionEvent"in window||delete us.transitionend.transition);function ir(o){if(Nm[o])return Nm[o];if(!us[o])return o;var r=us[o],a;for(a in r)if(r.hasOwnProperty(a)&&a in q_)return Nm[o]=r[a];return o}var X_=ir("animationend"),F_=ir("animationiteration"),Z_=ir("animationstart"),y9=ir("transitionrun"),v9=ir("transitionstart"),b9=ir("transitioncancel"),K_=ir("transitionend"),Q_=new Map,Am="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(" ");Am.push("scrollEnd");function Pn(o,r){Q_.set(o,r),xo(r,[o])}var Du=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)},vn=[],fs=0,Mm=0;function ju(){for(var o=fs,r=Mm=fs=0;r<o;){var a=vn[r];vn[r++]=null;var f=vn[r];vn[r++]=null;var g=vn[r];vn[r++]=null;var v=vn[r];if(vn[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&&W_(a,g,v)}}function zu(o,r,a,f){vn[fs++]=o,vn[fs++]=r,vn[fs++]=a,vn[fs++]=f,Mm|=f,o.lanes|=f,o=o.alternate,o!==null&&(o.lanes|=f)}function Rm(o,r,a,f){return zu(o,r,a,f),Vu(o)}function rr(o,r){return zu(o,null,null,r),Vu(o)}function W_(o,r,a){o.lanes|=a;var f=o.alternate;f!==null&&(f.lanes|=a);for(var g=!1,v=o.return;v!==null;)v.childLanes|=a,f=v.alternate,f!==null&&(f.childLanes|=a),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-De(a),o=v.hiddenUpdates,f=o[g],f===null?o[g]=[r]:f.push(r),r.lane=a|536870912),v):null}function Vu(o){if(50<bl)throw bl=0,Bg=null,Error(i(185));for(var r=o.return;r!==null;)o=r,r=o.return;return o.tag===3?o.stateNode:null}var ds={};function x9(o,r,a,f){this.tag=o,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=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 ln(o,r,a,f){return new x9(o,r,a,f)}function km(o){return o=o.prototype,!(!o||!o.isReactComponent)}function _o(o,r){var a=o.alternate;return a===null?(a=ln(o.tag,r,o.key,o.mode),a.elementType=o.elementType,a.type=o.type,a.stateNode=o.stateNode,a.alternate=o,o.alternate=a):(a.pendingProps=r,a.type=o.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=o.flags&65011712,a.childLanes=o.childLanes,a.lanes=o.lanes,a.child=o.child,a.memoizedProps=o.memoizedProps,a.memoizedState=o.memoizedState,a.updateQueue=o.updateQueue,r=o.dependencies,a.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},a.sibling=o.sibling,a.index=o.index,a.ref=o.ref,a.refCleanup=o.refCleanup,a}function J_(o,r){o.flags&=65011714;var a=o.alternate;return a===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=a.childLanes,o.lanes=a.lanes,o.child=a.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=a.memoizedProps,o.memoizedState=a.memoizedState,o.updateQueue=a.updateQueue,o.type=a.type,r=a.dependencies,o.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),o}function Lu(o,r,a,f,g,v){var T=0;if(f=o,typeof o=="function")km(o)&&(T=1);else if(typeof o=="string")T=C7(o,a,rt.current)?26:o==="html"||o==="head"||o==="body"?27:5;else t:switch(o){case H:return o=ln(31,a,r,g),o.elementType=H,o.lanes=v,o;case w:return sr(a.children,g,v,r);case S:T=8,g|=24;break;case E:return o=ln(12,a,r,g|2),o.elementType=E,o.lanes=v,o;case R:return o=ln(13,a,r,g),o.elementType=R,o.lanes=v,o;case A:return o=ln(19,a,r,g),o.elementType=A,o.lanes=v,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case C:T=10;break t;case O:T=9;break t;case _:T=11;break t;case k:T=14;break t;case D:T=16,f=null;break t}T=29,a=Error(i(130,o===null?"null":typeof o,"")),f=null}return r=ln(T,a,r,g),r.elementType=o,r.type=f,r.lanes=v,r}function sr(o,r,a,f){return o=ln(7,o,f,r),o.lanes=a,o}function Om(o,r,a){return o=ln(6,o,null,r),o.lanes=a,o}function tC(o){var r=ln(18,null,null,0);return r.stateNode=o,r}function Dm(o,r,a){return r=ln(4,o.children!==null?o.children:[],o.key,r),r.lanes=a,r.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},r}var eC=new WeakMap;function bn(o,r){if(typeof o=="object"&&o!==null){var a=eC.get(o);return a!==void 0?a:(r={value:o,source:r,stack:gt(r)},eC.set(o,r),r)}return{value:o,source:r,stack:gt(r)}}var hs=[],ps=0,Iu=null,Wa=0,xn=[],wn=0,si=null,oo=1,io="";function Co(o,r){hs[ps++]=Wa,hs[ps++]=Iu,Iu=o,Wa=r}function nC(o,r,a){xn[wn++]=oo,xn[wn++]=io,xn[wn++]=si,si=o;var f=oo;o=io;var g=32-De(f)-1;f&=~(1<<g),a+=1;var v=32-De(r)+g;if(30<v){var T=g-g%5;v=(f&(1<<T)-1).toString(32),f>>=T,g-=T,oo=1<<32-De(r)+g|a<<g|f,io=v+o}else oo=1<<v|a<<g|f,io=o}function jm(o){o.return!==null&&(Co(o,1),nC(o,1,0))}function zm(o){for(;o===Iu;)Iu=hs[--ps],hs[ps]=null,Wa=hs[--ps],hs[ps]=null;for(;o===si;)si=xn[--wn],xn[wn]=null,io=xn[--wn],xn[wn]=null,oo=xn[--wn],xn[wn]=null}function oC(o,r){xn[wn++]=oo,xn[wn++]=io,xn[wn++]=si,oo=r.id,io=r.overflow,si=o}var Ve=null,ae=null,Yt=!1,ai=null,Sn=!1,Vm=Error(i(519));function li(o){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ja(bn(r,o)),Vm}function iC(o){var r=o.stateNode,a=o.type,f=o.memoizedProps;switch(r[Me]=o,r[Ue]=f,a){case"dialog":Ht("cancel",r),Ht("close",r);break;case"iframe":case"object":case"embed":Ht("load",r);break;case"video":case"audio":for(a=0;a<wl.length;a++)Ht(wl[a],r);break;case"source":Ht("error",r);break;case"img":case"image":case"link":Ht("error",r),Ht("load",r);break;case"details":Ht("toggle",r);break;case"input":Ht("invalid",r),Cu(r,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":Ht("invalid",r);break;case"textarea":Ht("invalid",r),b_(r,f.value,f.defaultValue,f.children)}a=f.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||r.textContent===""+a||f.suppressHydrationWarning===!0||wT(r.textContent,a)?(f.popover!=null&&(Ht("beforetoggle",r),Ht("toggle",r)),f.onScroll!=null&&Ht("scroll",r),f.onScrollEnd!=null&&Ht("scrollend",r),f.onClick!=null&&(r.onclick=So),r=!0):r=!1,r||li(o,!0)}function rC(o){for(Ve=o.return;Ve;)switch(Ve.tag){case 5:case 31:case 13:Sn=!1;return;case 27:case 3:Sn=!0;return;default:Ve=Ve.return}}function ms(o){if(o!==Ve)return!1;if(!Yt)return rC(o),Yt=!0,!1;var r=o.tag,a;if((a=r!==3&&r!==27)&&((a=r===5)&&(a=o.type,a=!(a!=="form"&&a!=="button")||t0(o.type,o.memoizedProps)),a=!a),a&&ae&&li(o),rC(o),r===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(317));ae=RT(o)}else if(r===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(317));ae=RT(o)}else r===27?(r=ae,Si(o.type)?(o=r0,r0=null,ae=o):ae=r):ae=Ve?_n(o.stateNode.nextSibling):null;return!0}function ar(){ae=Ve=null,Yt=!1}function Lm(){var o=ai;return o!==null&&(tn===null?tn=o:tn.push.apply(tn,o),ai=null),o}function Ja(o){ai===null?ai=[o]:ai.push(o)}var Im=L(null),lr=null,To=null;function ci(o,r,a){tt(Im,r._currentValue),r._currentValue=a}function No(o){o._currentValue=Im.current,q(Im)}function Bm(o,r,a){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===a)break;o=o.return}}function Pm(o,r,a,f){var g=o.child;for(g!==null&&(g.return=o);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 X=0;X<r.length;X++)if(V.context===r[X]){v.lanes|=a,V=v.alternate,V!==null&&(V.lanes|=a),Bm(v.return,a,o),f||(T=null);break t}v=V.next}}else if(g.tag===18){if(T=g.return,T===null)throw Error(i(341));T.lanes|=a,v=T.alternate,v!==null&&(v.lanes|=a),Bm(T,a,o),T=null}else T=g.child;if(T!==null)T.return=g;else for(T=g;T!==null;){if(T===o){T=null;break}if(g=T.sibling,g!==null){g.return=T.return,T=g;break}T=T.return}g=T}}function gs(o,r,a,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 T=g.alternate;if(T===null)throw Error(i(387));if(T=T.memoizedProps,T!==null){var V=g.type;an(g.pendingProps.value,T.value)||(o!==null?o.push(V):o=[V])}}else if(g===ft.current){if(T=g.alternate,T===null)throw Error(i(387));T.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(o!==null?o.push(Tl):o=[Tl])}g=g.return}o!==null&&Pm(r,o,a,f),r.flags|=262144}function Bu(o){for(o=o.firstContext;o!==null;){if(!an(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function cr(o){lr=o,To=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function Le(o){return sC(lr,o)}function Pu(o,r){return lr===null&&cr(o),sC(o,r)}function sC(o,r){var a=r._currentValue;if(r={context:r,memoizedValue:a,next:null},To===null){if(o===null)throw Error(i(308));To=r,o.dependencies={lanes:0,firstContext:r},o.flags|=524288}else To=To.next=r;return a}var w9=typeof AbortController<"u"?AbortController:function(){var o=[],r=this.signal={aborted:!1,addEventListener:function(a,f){o.push(f)}};this.abort=function(){r.aborted=!0,o.forEach(function(a){return a()})}},S9=t.unstable_scheduleCallback,E9=t.unstable_NormalPriority,Se={$$typeof:C,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Hm(){return{controller:new w9,data:new Map,refCount:0}}function tl(o){o.refCount--,o.refCount===0&&S9(E9,function(){o.controller.abort()})}var el=null,Um=0,ys=0,vs=null;function _9(o,r){if(el===null){var a=el=[];Um=0,ys=Gg(),vs={status:"pending",value:void 0,then:function(f){a.push(f)}}}return Um++,r.then(aC,aC),r}function aC(){if(--Um===0&&el!==null){vs!==null&&(vs.status="fulfilled");var o=el;el=null,ys=0,vs=null;for(var r=0;r<o.length;r++)(0,o[r])()}}function C9(o,r){var a=[],f={status:"pending",value:null,reason:null,then:function(g){a.push(g)}};return o.then(function(){f.status="fulfilled",f.value=r;for(var g=0;g<a.length;g++)(0,a[g])(r)},function(g){for(f.status="rejected",f.reason=g,g=0;g<a.length;g++)(0,a[g])(void 0)}),f}var lC=j.S;j.S=function(o,r){G2=zt(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&_9(o,r),lC!==null&&lC(o,r)};var ur=L(null);function $m(){var o=ur.current;return o!==null?o:oe.pooledCache}function Hu(o,r){r===null?tt(ur,ur.current):tt(ur,r.pool)}function cC(){var o=$m();return o===null?null:{parent:Se._currentValue,pool:o}}var bs=Error(i(460)),Ym=Error(i(474)),Uu=Error(i(542)),$u={then:function(){}};function uC(o){return o=o.status,o==="fulfilled"||o==="rejected"}function fC(o,r,a){switch(a=o[a],a===void 0?o.push(r):a!==r&&(r.then(So,So),r=a),r.status){case"fulfilled":return r.value;case"rejected":throw o=r.reason,hC(o),o;default:if(typeof r.status=="string")r.then(So,So);else{if(o=oe,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,hC(o),o}throw dr=r,bs}}function fr(o){try{var r=o._init;return r(o._payload)}catch(a){throw a!==null&&typeof a=="object"&&typeof a.then=="function"?(dr=a,bs):a}}var dr=null;function dC(){if(dr===null)throw Error(i(459));var o=dr;return dr=null,o}function hC(o){if(o===bs||o===Uu)throw Error(i(483))}var xs=null,nl=0;function Yu(o){var r=nl;return nl+=1,xs===null&&(xs=[]),fC(xs,o,r)}function ol(o,r){r=r.props.ref,o.ref=r!==void 0?r:null}function Gu(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 pC(o){function r(W,Z){if(o){var J=W.deletions;J===null?(W.deletions=[Z],W.flags|=16):J.push(Z)}}function a(W,Z){if(!o)return null;for(;Z!==null;)r(W,Z),Z=Z.sibling;return null}function f(W){for(var Z=new Map;W!==null;)W.key!==null?Z.set(W.key,W):Z.set(W.index,W),W=W.sibling;return Z}function g(W,Z){return W=_o(W,Z),W.index=0,W.sibling=null,W}function v(W,Z,J){return W.index=J,o?(J=W.alternate,J!==null?(J=J.index,J<Z?(W.flags|=67108866,Z):J):(W.flags|=67108866,Z)):(W.flags|=1048576,Z)}function T(W){return o&&W.alternate===null&&(W.flags|=67108866),W}function V(W,Z,J,at){return Z===null||Z.tag!==6?(Z=Om(J,W.mode,at),Z.return=W,Z):(Z=g(Z,J),Z.return=W,Z)}function X(W,Z,J,at){var Mt=J.type;return Mt===w?st(W,Z,J.props.children,at,J.key):Z!==null&&(Z.elementType===Mt||typeof Mt=="object"&&Mt!==null&&Mt.$$typeof===D&&fr(Mt)===Z.type)?(Z=g(Z,J.props),ol(Z,J),Z.return=W,Z):(Z=Lu(J.type,J.key,J.props,null,W.mode,at),ol(Z,J),Z.return=W,Z)}function et(W,Z,J,at){return Z===null||Z.tag!==4||Z.stateNode.containerInfo!==J.containerInfo||Z.stateNode.implementation!==J.implementation?(Z=Dm(J,W.mode,at),Z.return=W,Z):(Z=g(Z,J.children||[]),Z.return=W,Z)}function st(W,Z,J,at,Mt){return Z===null||Z.tag!==7?(Z=sr(J,W.mode,at,Mt),Z.return=W,Z):(Z=g(Z,J),Z.return=W,Z)}function lt(W,Z,J){if(typeof Z=="string"&&Z!==""||typeof Z=="number"||typeof Z=="bigint")return Z=Om(""+Z,W.mode,J),Z.return=W,Z;if(typeof Z=="object"&&Z!==null){switch(Z.$$typeof){case b:return J=Lu(Z.type,Z.key,Z.props,null,W.mode,J),ol(J,Z),J.return=W,J;case x:return Z=Dm(Z,W.mode,J),Z.return=W,Z;case D:return Z=fr(Z),lt(W,Z,J)}if(P(Z)||F(Z))return Z=sr(Z,W.mode,J,null),Z.return=W,Z;if(typeof Z.then=="function")return lt(W,Yu(Z),J);if(Z.$$typeof===C)return lt(W,Pu(W,Z),J);Gu(W,Z)}return null}function ot(W,Z,J,at){var Mt=Z!==null?Z.key:null;if(typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint")return Mt!==null?null:V(W,Z,""+J,at);if(typeof J=="object"&&J!==null){switch(J.$$typeof){case b:return J.key===Mt?X(W,Z,J,at):null;case x:return J.key===Mt?et(W,Z,J,at):null;case D:return J=fr(J),ot(W,Z,J,at)}if(P(J)||F(J))return Mt!==null?null:st(W,Z,J,at,null);if(typeof J.then=="function")return ot(W,Z,Yu(J),at);if(J.$$typeof===C)return ot(W,Z,Pu(W,J),at);Gu(W,J)}return null}function it(W,Z,J,at,Mt){if(typeof at=="string"&&at!==""||typeof at=="number"||typeof at=="bigint")return W=W.get(J)||null,V(Z,W,""+at,Mt);if(typeof at=="object"&&at!==null){switch(at.$$typeof){case b:return W=W.get(at.key===null?J:at.key)||null,X(Z,W,at,Mt);case x:return W=W.get(at.key===null?J:at.key)||null,et(Z,W,at,Mt);case D:return at=fr(at),it(W,Z,J,at,Mt)}if(P(at)||F(at))return W=W.get(J)||null,st(Z,W,at,Mt,null);if(typeof at.then=="function")return it(W,Z,J,Yu(at),Mt);if(at.$$typeof===C)return it(W,Z,J,Pu(Z,at),Mt);Gu(Z,at)}return null}function xt(W,Z,J,at){for(var Mt=null,Ft=null,_t=Z,It=Z=0,$t=null;_t!==null&&It<J.length;It++){_t.index>It?($t=_t,_t=null):$t=_t.sibling;var Zt=ot(W,_t,J[It],at);if(Zt===null){_t===null&&(_t=$t);break}o&&_t&&Zt.alternate===null&&r(W,_t),Z=v(Zt,Z,It),Ft===null?Mt=Zt:Ft.sibling=Zt,Ft=Zt,_t=$t}if(It===J.length)return a(W,_t),Yt&&Co(W,It),Mt;if(_t===null){for(;It<J.length;It++)_t=lt(W,J[It],at),_t!==null&&(Z=v(_t,Z,It),Ft===null?Mt=_t:Ft.sibling=_t,Ft=_t);return Yt&&Co(W,It),Mt}for(_t=f(_t);It<J.length;It++)$t=it(_t,W,It,J[It],at),$t!==null&&(o&&$t.alternate!==null&&_t.delete($t.key===null?It:$t.key),Z=v($t,Z,It),Ft===null?Mt=$t:Ft.sibling=$t,Ft=$t);return o&&_t.forEach(function(Ni){return r(W,Ni)}),Yt&&Co(W,It),Mt}function Rt(W,Z,J,at){if(J==null)throw Error(i(151));for(var Mt=null,Ft=null,_t=Z,It=Z=0,$t=null,Zt=J.next();_t!==null&&!Zt.done;It++,Zt=J.next()){_t.index>It?($t=_t,_t=null):$t=_t.sibling;var Ni=ot(W,_t,Zt.value,at);if(Ni===null){_t===null&&(_t=$t);break}o&&_t&&Ni.alternate===null&&r(W,_t),Z=v(Ni,Z,It),Ft===null?Mt=Ni:Ft.sibling=Ni,Ft=Ni,_t=$t}if(Zt.done)return a(W,_t),Yt&&Co(W,It),Mt;if(_t===null){for(;!Zt.done;It++,Zt=J.next())Zt=lt(W,Zt.value,at),Zt!==null&&(Z=v(Zt,Z,It),Ft===null?Mt=Zt:Ft.sibling=Zt,Ft=Zt);return Yt&&Co(W,It),Mt}for(_t=f(_t);!Zt.done;It++,Zt=J.next())Zt=it(_t,W,It,Zt.value,at),Zt!==null&&(o&&Zt.alternate!==null&&_t.delete(Zt.key===null?It:Zt.key),Z=v(Zt,Z,It),Ft===null?Mt=Zt:Ft.sibling=Zt,Ft=Zt);return o&&_t.forEach(function(V7){return r(W,V7)}),Yt&&Co(W,It),Mt}function ne(W,Z,J,at){if(typeof J=="object"&&J!==null&&J.type===w&&J.key===null&&(J=J.props.children),typeof J=="object"&&J!==null){switch(J.$$typeof){case b:t:{for(var Mt=J.key;Z!==null;){if(Z.key===Mt){if(Mt=J.type,Mt===w){if(Z.tag===7){a(W,Z.sibling),at=g(Z,J.props.children),at.return=W,W=at;break t}}else if(Z.elementType===Mt||typeof Mt=="object"&&Mt!==null&&Mt.$$typeof===D&&fr(Mt)===Z.type){a(W,Z.sibling),at=g(Z,J.props),ol(at,J),at.return=W,W=at;break t}a(W,Z);break}else r(W,Z);Z=Z.sibling}J.type===w?(at=sr(J.props.children,W.mode,at,J.key),at.return=W,W=at):(at=Lu(J.type,J.key,J.props,null,W.mode,at),ol(at,J),at.return=W,W=at)}return T(W);case x:t:{for(Mt=J.key;Z!==null;){if(Z.key===Mt)if(Z.tag===4&&Z.stateNode.containerInfo===J.containerInfo&&Z.stateNode.implementation===J.implementation){a(W,Z.sibling),at=g(Z,J.children||[]),at.return=W,W=at;break t}else{a(W,Z);break}else r(W,Z);Z=Z.sibling}at=Dm(J,W.mode,at),at.return=W,W=at}return T(W);case D:return J=fr(J),ne(W,Z,J,at)}if(P(J))return xt(W,Z,J,at);if(F(J)){if(Mt=F(J),typeof Mt!="function")throw Error(i(150));return J=Mt.call(J),Rt(W,Z,J,at)}if(typeof J.then=="function")return ne(W,Z,Yu(J),at);if(J.$$typeof===C)return ne(W,Z,Pu(W,J),at);Gu(W,J)}return typeof J=="string"&&J!==""||typeof J=="number"||typeof J=="bigint"?(J=""+J,Z!==null&&Z.tag===6?(a(W,Z.sibling),at=g(Z,J),at.return=W,W=at):(a(W,Z),at=Om(J,W.mode,at),at.return=W,W=at),T(W)):a(W,Z)}return function(W,Z,J,at){try{nl=0;var Mt=ne(W,Z,J,at);return xs=null,Mt}catch(_t){if(_t===bs||_t===Uu)throw _t;var Ft=ln(29,_t,null,W.mode);return Ft.lanes=at,Ft.return=W,Ft}}}var hr=pC(!0),mC=pC(!1),ui=!1;function Gm(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function qm(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 fi(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function di(o,r,a){var f=o.updateQueue;if(f===null)return null;if(f=f.shared,(Kt&2)!==0){var g=f.pending;return g===null?r.next=r:(r.next=g.next,g.next=r),f.pending=r,r=Vu(o),W_(o,null,a),r}return zu(o,f,r,a),Vu(o)}function il(o,r,a){if(r=r.updateQueue,r!==null&&(r=r.shared,(a&4194048)!==0)){var f=r.lanes;f&=o.pendingLanes,a|=f,r.lanes=a,pu(o,a)}}function Xm(o,r){var a=o.updateQueue,f=o.alternate;if(f!==null&&(f=f.updateQueue,a===f)){var g=null,v=null;if(a=a.firstBaseUpdate,a!==null){do{var T={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};v===null?g=v=T:v=v.next=T,a=a.next}while(a!==null);v===null?g=v=r:v=v.next=r}else g=v=r;a={baseState:f.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:f.shared,callbacks:f.callbacks},o.updateQueue=a;return}o=a.lastBaseUpdate,o===null?a.firstBaseUpdate=r:o.next=r,a.lastBaseUpdate=r}var Fm=!1;function rl(){if(Fm){var o=vs;if(o!==null)throw o}}function sl(o,r,a,f){Fm=!1;var g=o.updateQueue;ui=!1;var v=g.firstBaseUpdate,T=g.lastBaseUpdate,V=g.shared.pending;if(V!==null){g.shared.pending=null;var X=V,et=X.next;X.next=null,T===null?v=et:T.next=et,T=X;var st=o.alternate;st!==null&&(st=st.updateQueue,V=st.lastBaseUpdate,V!==T&&(V===null?st.firstBaseUpdate=et:V.next=et,st.lastBaseUpdate=X))}if(v!==null){var lt=g.baseState;T=0,st=et=X=null,V=v;do{var ot=V.lane&-536870913,it=ot!==V.lane;if(it?(Ut&ot)===ot:(f&ot)===ot){ot!==0&&ot===ys&&(Fm=!0),st!==null&&(st=st.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});t:{var xt=o,Rt=V;ot=r;var ne=a;switch(Rt.tag){case 1:if(xt=Rt.payload,typeof xt=="function"){lt=xt.call(ne,lt,ot);break t}lt=xt;break t;case 3:xt.flags=xt.flags&-65537|128;case 0:if(xt=Rt.payload,ot=typeof xt=="function"?xt.call(ne,lt,ot):xt,ot==null)break t;lt=m({},lt,ot);break t;case 2:ui=!0}}ot=V.callback,ot!==null&&(o.flags|=64,it&&(o.flags|=8192),it=g.callbacks,it===null?g.callbacks=[ot]:it.push(ot))}else it={lane:ot,tag:V.tag,payload:V.payload,callback:V.callback,next:null},st===null?(et=st=it,X=lt):st=st.next=it,T|=ot;if(V=V.next,V===null){if(V=g.shared.pending,V===null)break;it=V,V=it.next,it.next=null,g.lastBaseUpdate=it,g.shared.pending=null}}while(!0);st===null&&(X=lt),g.baseState=X,g.firstBaseUpdate=et,g.lastBaseUpdate=st,v===null&&(g.shared.lanes=0),yi|=T,o.lanes=T,o.memoizedState=lt}}function gC(o,r){if(typeof o!="function")throw Error(i(191,o));o.call(r)}function yC(o,r){var a=o.callbacks;if(a!==null)for(o.callbacks=null,o=0;o<a.length;o++)gC(a[o],r)}var ws=L(null),qu=L(0);function vC(o,r){o=Vo,tt(qu,o),tt(ws,r),Vo=o|r.baseLanes}function Zm(){tt(qu,Vo),tt(ws,ws.current)}function Km(){Vo=qu.current,q(ws),q(qu)}var cn=L(null),En=null;function hi(o){var r=o.alternate;tt(ye,ye.current&1),tt(cn,o),En===null&&(r===null||ws.current!==null||r.memoizedState!==null)&&(En=o)}function Qm(o){tt(ye,ye.current),tt(cn,o),En===null&&(En=o)}function bC(o){o.tag===22?(tt(ye,ye.current),tt(cn,o),En===null&&(En=o)):pi()}function pi(){tt(ye,ye.current),tt(cn,cn.current)}function un(o){q(cn),En===o&&(En=null),q(ye)}var ye=L(0);function Xu(o){for(var r=o;r!==null;){if(r.tag===13){var a=r.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||o0(a)||i0(a)))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 Ao=0,Vt=null,te=null,Ee=null,Fu=!1,Ss=!1,pr=!1,Zu=0,al=0,Es=null,T9=0;function pe(){throw Error(i(321))}function Wm(o,r){if(r===null)return!1;for(var a=0;a<r.length&&a<o.length;a++)if(!an(o[a],r[a]))return!1;return!0}function Jm(o,r,a,f,g,v){return Ao=v,Vt=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,j.H=o===null||o.memoizedState===null?n2:pg,pr=!1,v=a(f,g),pr=!1,Ss&&(v=wC(r,a,f,g)),xC(o),v}function xC(o){j.H=ul;var r=te!==null&&te.next!==null;if(Ao=0,Ee=te=Vt=null,Fu=!1,al=0,Es=null,r)throw Error(i(300));o===null||_e||(o=o.dependencies,o!==null&&Bu(o)&&(_e=!0))}function wC(o,r,a,f){Vt=o;var g=0;do{if(Ss&&(Es=null),al=0,Ss=!1,25<=g)throw Error(i(301));if(g+=1,Ee=te=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=o2,v=r(a,f)}while(Ss);return v}function N9(){var o=j.H,r=o.useState()[0];return r=typeof r.then=="function"?ll(r):r,o=o.useState()[0],(te!==null?te.memoizedState:null)!==o&&(Vt.flags|=1024),r}function tg(){var o=Zu!==0;return Zu=0,o}function eg(o,r,a){r.updateQueue=o.updateQueue,r.flags&=-2053,o.lanes&=~a}function ng(o){if(Fu){for(o=o.memoizedState;o!==null;){var r=o.queue;r!==null&&(r.pending=null),o=o.next}Fu=!1}Ao=0,Ee=te=Vt=null,Ss=!1,al=Zu=0,Es=null}function Ge(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Ee===null?Vt.memoizedState=Ee=o:Ee=Ee.next=o,Ee}function ve(){if(te===null){var o=Vt.alternate;o=o!==null?o.memoizedState:null}else o=te.next;var r=Ee===null?Vt.memoizedState:Ee.next;if(r!==null)Ee=r,te=o;else{if(o===null)throw Vt.alternate===null?Error(i(467)):Error(i(310));te=o,o={memoizedState:te.memoizedState,baseState:te.baseState,baseQueue:te.baseQueue,queue:te.queue,next:null},Ee===null?Vt.memoizedState=Ee=o:Ee=Ee.next=o}return Ee}function Ku(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function ll(o){var r=al;return al+=1,Es===null&&(Es=[]),o=fC(Es,o,r),r=Vt,(Ee===null?r.memoizedState:Ee.next)===null&&(r=r.alternate,j.H=r===null||r.memoizedState===null?n2:pg),o}function Qu(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return ll(o);if(o.$$typeof===C)return Le(o)}throw Error(i(438,String(o)))}function og(o){var r=null,a=Vt.updateQueue;if(a!==null&&(r=a.memoCache),r==null){var f=Vt.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}),a===null&&(a=Ku(),Vt.updateQueue=a),a.memoCache=r,a=r.data[r.index],a===void 0)for(a=r.data[r.index]=Array(o),f=0;f<o;f++)a[f]=Y;return r.index++,a}function Mo(o,r){return typeof r=="function"?r(o):r}function Wu(o){var r=ve();return ig(r,te,o)}function ig(o,r,a){var f=o.queue;if(f===null)throw Error(i(311));f.lastRenderedReducer=a;var g=o.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=o.baseState,g===null)o.memoizedState=v;else{r=g.next;var V=T=null,X=null,et=r,st=!1;do{var lt=et.lane&-536870913;if(lt!==et.lane?(Ut<)===lt:(Ao<)===lt){var ot=et.revertLane;if(ot===0)X!==null&&(X=X.next={lane:0,revertLane:0,gesture:null,action:et.action,hasEagerState:et.hasEagerState,eagerState:et.eagerState,next:null}),lt===ys&&(st=!0);else if((Ao&ot)===ot){et=et.next,ot===ys&&(st=!0);continue}else lt={lane:0,revertLane:et.revertLane,gesture:null,action:et.action,hasEagerState:et.hasEagerState,eagerState:et.eagerState,next:null},X===null?(V=X=lt,T=v):X=X.next=lt,Vt.lanes|=ot,yi|=ot;lt=et.action,pr&&a(v,lt),v=et.hasEagerState?et.eagerState:a(v,lt)}else ot={lane:lt,revertLane:et.revertLane,gesture:et.gesture,action:et.action,hasEagerState:et.hasEagerState,eagerState:et.eagerState,next:null},X===null?(V=X=ot,T=v):X=X.next=ot,Vt.lanes|=lt,yi|=lt;et=et.next}while(et!==null&&et!==r);if(X===null?T=v:X.next=V,!an(v,o.memoizedState)&&(_e=!0,st&&(a=vs,a!==null)))throw a;o.memoizedState=v,o.baseState=T,o.baseQueue=X,f.lastRenderedState=v}return g===null&&(f.lanes=0),[o.memoizedState,f.dispatch]}function rg(o){var r=ve(),a=r.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=o;var f=a.dispatch,g=a.pending,v=r.memoizedState;if(g!==null){a.pending=null;var T=g=g.next;do v=o(v,T.action),T=T.next;while(T!==g);an(v,r.memoizedState)||(_e=!0),r.memoizedState=v,r.baseQueue===null&&(r.baseState=v),a.lastRenderedState=v}return[v,f]}function SC(o,r,a){var f=Vt,g=ve(),v=Yt;if(v){if(a===void 0)throw Error(i(407));a=a()}else a=r();var T=!an((te||g).memoizedState,a);if(T&&(g.memoizedState=a,_e=!0),g=g.queue,lg(CC.bind(null,f,g,o),[o]),g.getSnapshot!==r||T||Ee!==null&&Ee.memoizedState.tag&1){if(f.flags|=2048,_s(9,{destroy:void 0},_C.bind(null,f,g,a,r),null),oe===null)throw Error(i(349));v||(Ao&127)!==0||EC(f,r,a)}return a}function EC(o,r,a){o.flags|=16384,o={getSnapshot:r,value:a},r=Vt.updateQueue,r===null?(r=Ku(),Vt.updateQueue=r,r.stores=[o]):(a=r.stores,a===null?r.stores=[o]:a.push(o))}function _C(o,r,a,f){r.value=a,r.getSnapshot=f,TC(r)&&NC(o)}function CC(o,r,a){return a(function(){TC(r)&&NC(o)})}function TC(o){var r=o.getSnapshot;o=o.value;try{var a=r();return!an(o,a)}catch{return!0}}function NC(o){var r=rr(o,2);r!==null&&en(r,o,2)}function sg(o){var r=Ge();if(typeof o=="function"){var a=o;if(o=a(),pr){se(!0);try{a()}finally{se(!1)}}}return r.memoizedState=r.baseState=o,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:o},r}function AC(o,r,a,f){return o.baseState=a,ig(o,te,typeof f=="function"?f:Mo)}function A9(o,r,a,f,g){if(ef(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(T){v.listeners.push(T)}};j.T!==null?a(!0):v.isTransition=!1,f(v),a=r.pending,a===null?(v.next=r.pending=v,MC(r,v)):(v.next=a.next,r.pending=a.next=v)}}function MC(o,r){var a=r.action,f=r.payload,g=o.state;if(r.isTransition){var v=j.T,T={};j.T=T;try{var V=a(g,f),X=j.S;X!==null&&X(T,V),RC(o,r,V)}catch(et){ag(o,r,et)}finally{v!==null&&T.types!==null&&(v.types=T.types),j.T=v}}else try{v=a(g,f),RC(o,r,v)}catch(et){ag(o,r,et)}}function RC(o,r,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(f){kC(o,r,f)},function(f){return ag(o,r,f)}):kC(o,r,a)}function kC(o,r,a){r.status="fulfilled",r.value=a,OC(r),o.state=a,r=o.pending,r!==null&&(a=r.next,a===r?o.pending=null:(a=a.next,r.next=a,MC(o,a)))}function ag(o,r,a){var f=o.pending;if(o.pending=null,f!==null){f=f.next;do r.status="rejected",r.reason=a,OC(r),r=r.next;while(r!==f)}o.action=null}function OC(o){o=o.listeners;for(var r=0;r<o.length;r++)(0,o[r])()}function DC(o,r){return r}function jC(o,r){if(Yt){var a=oe.formState;if(a!==null){t:{var f=Vt;if(Yt){if(ae){e:{for(var g=ae,v=Sn;g.nodeType!==8;){if(!v){g=null;break e}if(g=_n(g.nextSibling),g===null){g=null;break e}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){ae=_n(g.nextSibling),f=g.data==="F!";break t}}li(f)}f=!1}f&&(r=a[0])}}return a=Ge(),a.memoizedState=a.baseState=r,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:DC,lastRenderedState:r},a.queue=f,a=JC.bind(null,Vt,f),f.dispatch=a,f=sg(!1),v=hg.bind(null,Vt,!1,f.queue),f=Ge(),g={state:r,dispatch:null,action:o,pending:null},f.queue=g,a=A9.bind(null,Vt,g,v,a),g.dispatch=a,f.memoizedState=o,[r,a,!1]}function zC(o){var r=ve();return VC(r,te,o)}function VC(o,r,a){if(r=ig(o,r,DC)[0],o=Wu(Mo)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var f=ll(r)}catch(T){throw T===bs?Uu:T}else f=r;r=ve();var g=r.queue,v=g.dispatch;return a!==r.memoizedState&&(Vt.flags|=2048,_s(9,{destroy:void 0},M9.bind(null,g,a),null)),[f,v,o]}function M9(o,r){o.action=r}function LC(o){var r=ve(),a=te;if(a!==null)return VC(r,a,o);ve(),r=r.memoizedState,a=ve();var f=a.queue.dispatch;return a.memoizedState=o,[r,f,!1]}function _s(o,r,a,f){return o={tag:o,create:a,deps:f,inst:r,next:null},r=Vt.updateQueue,r===null&&(r=Ku(),Vt.updateQueue=r),a=r.lastEffect,a===null?r.lastEffect=o.next=o:(f=a.next,a.next=o,o.next=f,r.lastEffect=o),o}function IC(){return ve().memoizedState}function Ju(o,r,a,f){var g=Ge();Vt.flags|=o,g.memoizedState=_s(1|r,{destroy:void 0},a,f===void 0?null:f)}function tf(o,r,a,f){var g=ve();f=f===void 0?null:f;var v=g.memoizedState.inst;te!==null&&f!==null&&Wm(f,te.memoizedState.deps)?g.memoizedState=_s(r,v,a,f):(Vt.flags|=o,g.memoizedState=_s(1|r,v,a,f))}function BC(o,r){Ju(8390656,8,o,r)}function lg(o,r){tf(2048,8,o,r)}function R9(o){Vt.flags|=4;var r=Vt.updateQueue;if(r===null)r=Ku(),Vt.updateQueue=r,r.events=[o];else{var a=r.events;a===null?r.events=[o]:a.push(o)}}function PC(o){var r=ve().memoizedState;return R9({ref:r,nextImpl:o}),function(){if((Kt&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function HC(o,r){return tf(4,2,o,r)}function UC(o,r){return tf(4,4,o,r)}function $C(o,r){if(typeof r=="function"){o=o();var a=r(o);return function(){typeof a=="function"?a():r(null)}}if(r!=null)return o=o(),r.current=o,function(){r.current=null}}function YC(o,r,a){a=a!=null?a.concat([o]):null,tf(4,4,$C.bind(null,r,o),a)}function cg(){}function GC(o,r){var a=ve();r=r===void 0?null:r;var f=a.memoizedState;return r!==null&&Wm(r,f[1])?f[0]:(a.memoizedState=[o,r],o)}function qC(o,r){var a=ve();r=r===void 0?null:r;var f=a.memoizedState;if(r!==null&&Wm(r,f[1]))return f[0];if(f=o(),pr){se(!0);try{o()}finally{se(!1)}}return a.memoizedState=[f,r],f}function ug(o,r,a){return a===void 0||(Ao&1073741824)!==0&&(Ut&261930)===0?o.memoizedState=r:(o.memoizedState=a,o=X2(),Vt.lanes|=o,yi|=o,a)}function XC(o,r,a,f){return an(a,r)?a:ws.current!==null?(o=ug(o,a,f),an(o,r)||(_e=!0),o):(Ao&42)===0||(Ao&1073741824)!==0&&(Ut&261930)===0?(_e=!0,o.memoizedState=a):(o=X2(),Vt.lanes|=o,yi|=o,r)}function FC(o,r,a,f,g){var v=I.p;I.p=v!==0&&8>v?v:8;var T=j.T,V={};j.T=V,hg(o,!1,r,a);try{var X=g(),et=j.S;if(et!==null&&et(V,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var st=C9(X,f);cl(o,r,st,hn(o))}else cl(o,r,f,hn(o))}catch(lt){cl(o,r,{then:function(){},status:"rejected",reason:lt},hn())}finally{I.p=v,T!==null&&V.types!==null&&(T.types=V.types),j.T=T}}function k9(){}function fg(o,r,a,f){if(o.tag!==5)throw Error(i(476));var g=ZC(o).queue;FC(o,g,r,z,a===null?k9:function(){return KC(o),a(f)})}function ZC(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:Mo,lastRenderedState:z},next:null};var a={};return r.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Mo,lastRenderedState:a},next:null},o.memoizedState=r,o=o.alternate,o!==null&&(o.memoizedState=r),r}function KC(o){var r=ZC(o);r.next===null&&(r=o.alternate.memoizedState),cl(o,r.next.queue,{},hn())}function dg(){return Le(Tl)}function QC(){return ve().memoizedState}function WC(){return ve().memoizedState}function O9(o){for(var r=o.return;r!==null;){switch(r.tag){case 24:case 3:var a=hn();o=fi(a);var f=di(r,o,a);f!==null&&(en(f,r,a),il(f,r,a)),r={cache:Hm()},o.payload=r;return}r=r.return}}function D9(o,r,a){var f=hn();a={lane:f,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null},ef(o)?t2(r,a):(a=Rm(o,r,a,f),a!==null&&(en(a,o,f),e2(a,r,f)))}function JC(o,r,a){var f=hn();cl(o,r,a,f)}function cl(o,r,a,f){var g={lane:f,revertLane:0,gesture:null,action:a,hasEagerState:!1,eagerState:null,next:null};if(ef(o))t2(r,g);else{var v=o.alternate;if(o.lanes===0&&(v===null||v.lanes===0)&&(v=r.lastRenderedReducer,v!==null))try{var T=r.lastRenderedState,V=v(T,a);if(g.hasEagerState=!0,g.eagerState=V,an(V,T))return zu(o,r,g,0),oe===null&&ju(),!1}catch{}if(a=Rm(o,r,g,f),a!==null)return en(a,o,f),e2(a,r,f),!0}return!1}function hg(o,r,a,f){if(f={lane:2,revertLane:Gg(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},ef(o)){if(r)throw Error(i(479))}else r=Rm(o,a,f,2),r!==null&&en(r,o,2)}function ef(o){var r=o.alternate;return o===Vt||r!==null&&r===Vt}function t2(o,r){Ss=Fu=!0;var a=o.pending;a===null?r.next=r:(r.next=a.next,a.next=r),o.pending=r}function e2(o,r,a){if((a&4194048)!==0){var f=r.lanes;f&=o.pendingLanes,a|=f,r.lanes=a,pu(o,a)}}var ul={readContext:Le,use:Qu,useCallback:pe,useContext:pe,useEffect:pe,useImperativeHandle:pe,useLayoutEffect:pe,useInsertionEffect:pe,useMemo:pe,useReducer:pe,useRef:pe,useState:pe,useDebugValue:pe,useDeferredValue:pe,useTransition:pe,useSyncExternalStore:pe,useId:pe,useHostTransitionStatus:pe,useFormState:pe,useActionState:pe,useOptimistic:pe,useMemoCache:pe,useCacheRefresh:pe};ul.useEffectEvent=pe;var n2={readContext:Le,use:Qu,useCallback:function(o,r){return Ge().memoizedState=[o,r===void 0?null:r],o},useContext:Le,useEffect:BC,useImperativeHandle:function(o,r,a){a=a!=null?a.concat([o]):null,Ju(4194308,4,$C.bind(null,r,o),a)},useLayoutEffect:function(o,r){return Ju(4194308,4,o,r)},useInsertionEffect:function(o,r){Ju(4,2,o,r)},useMemo:function(o,r){var a=Ge();r=r===void 0?null:r;var f=o();if(pr){se(!0);try{o()}finally{se(!1)}}return a.memoizedState=[f,r],f},useReducer:function(o,r,a){var f=Ge();if(a!==void 0){var g=a(r);if(pr){se(!0);try{a(r)}finally{se(!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=D9.bind(null,Vt,o),[f.memoizedState,o]},useRef:function(o){var r=Ge();return o={current:o},r.memoizedState=o},useState:function(o){o=sg(o);var r=o.queue,a=JC.bind(null,Vt,r);return r.dispatch=a,[o.memoizedState,a]},useDebugValue:cg,useDeferredValue:function(o,r){var a=Ge();return ug(a,o,r)},useTransition:function(){var o=sg(!1);return o=FC.bind(null,Vt,o.queue,!0,!1),Ge().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,r,a){var f=Vt,g=Ge();if(Yt){if(a===void 0)throw Error(i(407));a=a()}else{if(a=r(),oe===null)throw Error(i(349));(Ut&127)!==0||EC(f,r,a)}g.memoizedState=a;var v={value:a,getSnapshot:r};return g.queue=v,BC(CC.bind(null,f,v,o),[o]),f.flags|=2048,_s(9,{destroy:void 0},_C.bind(null,f,v,a,r),null),a},useId:function(){var o=Ge(),r=oe.identifierPrefix;if(Yt){var a=io,f=oo;a=(f&~(1<<32-De(f)-1)).toString(32)+a,r="_"+r+"R_"+a,a=Zu++,0<a&&(r+="H"+a.toString(32)),r+="_"}else a=T9++,r="_"+r+"r_"+a.toString(32)+"_";return o.memoizedState=r},useHostTransitionStatus:dg,useFormState:jC,useActionState:jC,useOptimistic:function(o){var r=Ge();r.memoizedState=r.baseState=o;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=a,r=hg.bind(null,Vt,!0,a),a.dispatch=r,[o,r]},useMemoCache:og,useCacheRefresh:function(){return Ge().memoizedState=O9.bind(null,Vt)},useEffectEvent:function(o){var r=Ge(),a={impl:o};return r.memoizedState=a,function(){if((Kt&2)!==0)throw Error(i(440));return a.impl.apply(void 0,arguments)}}},pg={readContext:Le,use:Qu,useCallback:GC,useContext:Le,useEffect:lg,useImperativeHandle:YC,useInsertionEffect:HC,useLayoutEffect:UC,useMemo:qC,useReducer:Wu,useRef:IC,useState:function(){return Wu(Mo)},useDebugValue:cg,useDeferredValue:function(o,r){var a=ve();return XC(a,te.memoizedState,o,r)},useTransition:function(){var o=Wu(Mo)[0],r=ve().memoizedState;return[typeof o=="boolean"?o:ll(o),r]},useSyncExternalStore:SC,useId:QC,useHostTransitionStatus:dg,useFormState:zC,useActionState:zC,useOptimistic:function(o,r){var a=ve();return AC(a,te,o,r)},useMemoCache:og,useCacheRefresh:WC};pg.useEffectEvent=PC;var o2={readContext:Le,use:Qu,useCallback:GC,useContext:Le,useEffect:lg,useImperativeHandle:YC,useInsertionEffect:HC,useLayoutEffect:UC,useMemo:qC,useReducer:rg,useRef:IC,useState:function(){return rg(Mo)},useDebugValue:cg,useDeferredValue:function(o,r){var a=ve();return te===null?ug(a,o,r):XC(a,te.memoizedState,o,r)},useTransition:function(){var o=rg(Mo)[0],r=ve().memoizedState;return[typeof o=="boolean"?o:ll(o),r]},useSyncExternalStore:SC,useId:QC,useHostTransitionStatus:dg,useFormState:LC,useActionState:LC,useOptimistic:function(o,r){var a=ve();return te!==null?AC(a,te,o,r):(a.baseState=o,[o,a.queue.dispatch])},useMemoCache:og,useCacheRefresh:WC};o2.useEffectEvent=PC;function mg(o,r,a,f){r=o.memoizedState,a=a(f,r),a=a==null?r:m({},r,a),o.memoizedState=a,o.lanes===0&&(o.updateQueue.baseState=a)}var gg={enqueueSetState:function(o,r,a){o=o._reactInternals;var f=hn(),g=fi(f);g.payload=r,a!=null&&(g.callback=a),r=di(o,g,f),r!==null&&(en(r,o,f),il(r,o,f))},enqueueReplaceState:function(o,r,a){o=o._reactInternals;var f=hn(),g=fi(f);g.tag=1,g.payload=r,a!=null&&(g.callback=a),r=di(o,g,f),r!==null&&(en(r,o,f),il(r,o,f))},enqueueForceUpdate:function(o,r){o=o._reactInternals;var a=hn(),f=fi(a);f.tag=2,r!=null&&(f.callback=r),r=di(o,f,a),r!==null&&(en(r,o,a),il(r,o,a))}};function i2(o,r,a,f,g,v,T){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(f,v,T):r.prototype&&r.prototype.isPureReactComponent?!Ka(a,f)||!Ka(g,v):!0}function r2(o,r,a,f){o=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(a,f),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(a,f),r.state!==o&&gg.enqueueReplaceState(r,r.state,null)}function mr(o,r){var a=r;if("ref"in r){a={};for(var f in r)f!=="ref"&&(a[f]=r[f])}if(o=o.defaultProps){a===r&&(a=m({},a));for(var g in o)a[g]===void 0&&(a[g]=o[g])}return a}function s2(o){Du(o)}function a2(o){console.error(o)}function l2(o){Du(o)}function nf(o,r){try{var a=o.onUncaughtError;a(r.value,{componentStack:r.stack})}catch(f){setTimeout(function(){throw f})}}function c2(o,r,a){try{var f=o.onCaughtError;f(a.value,{componentStack:a.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function yg(o,r,a){return a=fi(a),a.tag=3,a.payload={element:null},a.callback=function(){nf(o,r)},a}function u2(o){return o=fi(o),o.tag=3,o}function f2(o,r,a,f){var g=a.type.getDerivedStateFromError;if(typeof g=="function"){var v=f.value;o.payload=function(){return g(v)},o.callback=function(){c2(r,a,f)}}var T=a.stateNode;T!==null&&typeof T.componentDidCatch=="function"&&(o.callback=function(){c2(r,a,f),typeof g!="function"&&(vi===null?vi=new Set([this]):vi.add(this));var V=f.stack;this.componentDidCatch(f.value,{componentStack:V!==null?V:""})})}function j9(o,r,a,f,g){if(a.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(r=a.alternate,r!==null&&gs(r,a,g,!0),a=cn.current,a!==null){switch(a.tag){case 31:case 13:return En===null?mf():a.alternate===null&&me===0&&(me=3),a.flags&=-257,a.flags|=65536,a.lanes=g,f===$u?a.flags|=16384:(r=a.updateQueue,r===null?a.updateQueue=new Set([f]):r.add(f),Ug(o,f,g)),!1;case 22:return a.flags|=65536,f===$u?a.flags|=16384:(r=a.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([f])},a.updateQueue=r):(a=r.retryQueue,a===null?r.retryQueue=new Set([f]):a.add(f)),Ug(o,f,g)),!1}throw Error(i(435,a.tag))}return Ug(o,f,g),mf(),!1}if(Yt)return r=cn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=g,f!==Vm&&(o=Error(i(422),{cause:f}),Ja(bn(o,a)))):(f!==Vm&&(r=Error(i(423),{cause:f}),Ja(bn(r,a))),o=o.current.alternate,o.flags|=65536,g&=-g,o.lanes|=g,f=bn(f,a),g=yg(o.stateNode,f,g),Xm(o,g),me!==4&&(me=2)),!1;var v=Error(i(520),{cause:f});if(v=bn(v,a),vl===null?vl=[v]:vl.push(v),me!==4&&(me=2),r===null)return!0;f=bn(f,a),a=r;do{switch(a.tag){case 3:return a.flags|=65536,o=g&-g,a.lanes|=o,o=yg(a.stateNode,f,o),Xm(a,o),!1;case 1:if(r=a.type,v=a.stateNode,(a.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(vi===null||!vi.has(v))))return a.flags|=65536,g&=-g,a.lanes|=g,g=u2(g),f2(g,o,a,f),Xm(a,g),!1}a=a.return}while(a!==null);return!1}var vg=Error(i(461)),_e=!1;function Ie(o,r,a,f){r.child=o===null?mC(r,null,a,f):hr(r,o.child,a,f)}function d2(o,r,a,f,g){a=a.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 cr(r),f=Jm(o,r,a,T,v,g),V=tg(),o!==null&&!_e?(eg(o,r,g),Ro(o,r,g)):(Yt&&V&&jm(r),r.flags|=1,Ie(o,r,f,g),r.child)}function h2(o,r,a,f,g){if(o===null){var v=a.type;return typeof v=="function"&&!km(v)&&v.defaultProps===void 0&&a.compare===null?(r.tag=15,r.type=v,p2(o,r,v,f,g)):(o=Lu(a.type,null,f,r,r.mode,g),o.ref=r.ref,o.return=r,r.child=o)}if(v=o.child,!Tg(o,g)){var T=v.memoizedProps;if(a=a.compare,a=a!==null?a:Ka,a(T,f)&&o.ref===r.ref)return Ro(o,r,g)}return r.flags|=1,o=_o(v,f),o.ref=r.ref,o.return=r,r.child=o}function p2(o,r,a,f,g){if(o!==null){var v=o.memoizedProps;if(Ka(v,f)&&o.ref===r.ref)if(_e=!1,r.pendingProps=f=v,Tg(o,g))(o.flags&131072)!==0&&(_e=!0);else return r.lanes=o.lanes,Ro(o,r,g)}return bg(o,r,a,f,g)}function m2(o,r,a,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|a:a,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 g2(o,r,v,a,f)}if((a&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},o!==null&&Hu(r,v!==null?v.cachePool:null),v!==null?vC(r,v):Zm(),bC(r);else return f=r.lanes=536870912,g2(o,r,v!==null?v.baseLanes|a:a,a,f)}else v!==null?(Hu(r,v.cachePool),vC(r,v),pi(),r.memoizedState=null):(o!==null&&Hu(r,null),Zm(),pi());return Ie(o,r,g,a),r.child}function fl(o,r){return o!==null&&o.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function g2(o,r,a,f,g){var v=$m();return v=v===null?null:{parent:Se._currentValue,pool:v},r.memoizedState={baseLanes:a,cachePool:v},o!==null&&Hu(r,null),Zm(),bC(r),o!==null&&gs(o,r,f,!0),r.childLanes=g,null}function of(o,r){return r=sf({mode:r.mode,children:r.children},o.mode),r.ref=o.ref,o.child=r,r.return=o,r}function y2(o,r,a){return hr(r,o.child,null,a),o=of(r,r.pendingProps),o.flags|=2,un(r),r.memoizedState=null,o}function z9(o,r,a){var f=r.pendingProps,g=(r.flags&128)!==0;if(r.flags&=-129,o===null){if(Yt){if(f.mode==="hidden")return o=of(r,f),r.lanes=536870912,fl(null,o);if(Qm(r),(o=ae)?(o=MT(o,Sn),o=o!==null&&o.data==="&"?o:null,o!==null&&(r.memoizedState={dehydrated:o,treeContext:si!==null?{id:oo,overflow:io}:null,retryLane:536870912,hydrationErrors:null},a=tC(o),a.return=r,r.child=a,Ve=r,ae=null)):o=null,o===null)throw li(r);return r.lanes=536870912,null}return of(r,f)}var v=o.memoizedState;if(v!==null){var T=v.dehydrated;if(Qm(r),g)if(r.flags&256)r.flags&=-257,r=y2(o,r,a);else if(r.memoizedState!==null)r.child=o.child,r.flags|=128,r=null;else throw Error(i(558));else if(_e||gs(o,r,a,!1),g=(a&o.childLanes)!==0,_e||g){if(f=oe,f!==null&&(T=mu(f,a),T!==0&&T!==v.retryLane))throw v.retryLane=T,rr(o,T),en(f,o,T),vg;mf(),r=y2(o,r,a)}else o=v.treeContext,ae=_n(T.nextSibling),Ve=r,Yt=!0,ai=null,Sn=!1,o!==null&&oC(r,o),r=of(r,f),r.flags|=4096;return r}return o=_o(o.child,{mode:f.mode,children:f.children}),o.ref=r.ref,r.child=o,o.return=r,o}function rf(o,r){var a=r.ref;if(a===null)o!==null&&o.ref!==null&&(r.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(o===null||o.ref!==a)&&(r.flags|=4194816)}}function bg(o,r,a,f,g){return cr(r),a=Jm(o,r,a,f,void 0,g),f=tg(),o!==null&&!_e?(eg(o,r,g),Ro(o,r,g)):(Yt&&f&&jm(r),r.flags|=1,Ie(o,r,a,g),r.child)}function v2(o,r,a,f,g,v){return cr(r),r.updateQueue=null,a=wC(r,f,a,g),xC(o),f=tg(),o!==null&&!_e?(eg(o,r,v),Ro(o,r,v)):(Yt&&f&&jm(r),r.flags|=1,Ie(o,r,a,v),r.child)}function b2(o,r,a,f,g){if(cr(r),r.stateNode===null){var v=ds,T=a.contextType;typeof T=="object"&&T!==null&&(v=Le(T)),v=new a(f,v),r.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=gg,r.stateNode=v,v._reactInternals=r,v=r.stateNode,v.props=f,v.state=r.memoizedState,v.refs={},Gm(r),T=a.contextType,v.context=typeof T=="object"&&T!==null?Le(T):ds,v.state=r.memoizedState,T=a.getDerivedStateFromProps,typeof T=="function"&&(mg(r,a,T,f),v.state=r.memoizedState),typeof a.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&&gg.enqueueReplaceState(v,v.state,null),sl(r,f,v,g),rl(),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=mr(a,V);v.props=X;var et=v.context,st=a.contextType;T=ds,typeof st=="object"&&st!==null&&(T=Le(st));var lt=a.getDerivedStateFromProps;st=typeof lt=="function"||typeof v.getSnapshotBeforeUpdate=="function",V=r.pendingProps!==V,st||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(V||et!==T)&&r2(r,v,f,T),ui=!1;var ot=r.memoizedState;v.state=ot,sl(r,f,v,g),rl(),et=r.memoizedState,V||ot!==et||ui?(typeof lt=="function"&&(mg(r,a,lt,f),et=r.memoizedState),(X=ui||i2(r,a,X,f,ot,et,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=et),v.props=f,v.state=et,v.context=T,f=X):(typeof v.componentDidMount=="function"&&(r.flags|=4194308),f=!1)}else{v=r.stateNode,qm(o,r),T=r.memoizedProps,st=mr(a,T),v.props=st,lt=r.pendingProps,ot=v.context,et=a.contextType,X=ds,typeof et=="object"&&et!==null&&(X=Le(et)),V=a.getDerivedStateFromProps,(et=typeof V=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(T!==lt||ot!==X)&&r2(r,v,f,X),ui=!1,ot=r.memoizedState,v.state=ot,sl(r,f,v,g),rl();var it=r.memoizedState;T!==lt||ot!==it||ui||o!==null&&o.dependencies!==null&&Bu(o.dependencies)?(typeof V=="function"&&(mg(r,a,V,f),it=r.memoizedState),(st=ui||i2(r,a,st,f,ot,it,X)||o!==null&&o.dependencies!==null&&Bu(o.dependencies))?(et||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(f,it,X),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(f,it,X)),typeof v.componentDidUpdate=="function"&&(r.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof v.componentDidUpdate!="function"||T===o.memoizedProps&&ot===o.memoizedState||(r.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||T===o.memoizedProps&&ot===o.memoizedState||(r.flags|=1024),r.memoizedProps=f,r.memoizedState=it),v.props=f,v.state=it,v.context=X,f=st):(typeof v.componentDidUpdate!="function"||T===o.memoizedProps&&ot===o.memoizedState||(r.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||T===o.memoizedProps&&ot===o.memoizedState||(r.flags|=1024),f=!1)}return v=f,rf(o,r),f=(r.flags&128)!==0,v||f?(v=r.stateNode,a=f&&typeof a.getDerivedStateFromError!="function"?null:v.render(),r.flags|=1,o!==null&&f?(r.child=hr(r,o.child,null,g),r.child=hr(r,null,a,g)):Ie(o,r,a,g),r.memoizedState=v.state,o=r.child):o=Ro(o,r,g),o}function x2(o,r,a,f){return ar(),r.flags|=256,Ie(o,r,a,f),r.child}var xg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function wg(o){return{baseLanes:o,cachePool:cC()}}function Sg(o,r,a){return o=o!==null?o.childLanes&~a:0,r&&(o|=dn),o}function w2(o,r,a){var f=r.pendingProps,g=!1,v=(r.flags&128)!==0,T;if((T=v)||(T=o!==null&&o.memoizedState===null?!1:(ye.current&2)!==0),T&&(g=!0,r.flags&=-129),T=(r.flags&32)!==0,r.flags&=-33,o===null){if(Yt){if(g?hi(r):pi(),(o=ae)?(o=MT(o,Sn),o=o!==null&&o.data!=="&"?o:null,o!==null&&(r.memoizedState={dehydrated:o,treeContext:si!==null?{id:oo,overflow:io}:null,retryLane:536870912,hydrationErrors:null},a=tC(o),a.return=r,r.child=a,Ve=r,ae=null)):o=null,o===null)throw li(r);return i0(o)?r.lanes=32:r.lanes=536870912,null}var V=f.children;return f=f.fallback,g?(pi(),g=r.mode,V=sf({mode:"hidden",children:V},g),f=sr(f,g,a,null),V.return=r,f.return=r,V.sibling=f,r.child=V,f=r.child,f.memoizedState=wg(a),f.childLanes=Sg(o,T,a),r.memoizedState=xg,fl(null,f)):(hi(r),Eg(r,V))}var X=o.memoizedState;if(X!==null&&(V=X.dehydrated,V!==null)){if(v)r.flags&256?(hi(r),r.flags&=-257,r=_g(o,r,a)):r.memoizedState!==null?(pi(),r.child=o.child,r.flags|=128,r=null):(pi(),V=f.fallback,g=r.mode,f=sf({mode:"visible",children:f.children},g),V=sr(V,g,a,null),V.flags|=2,f.return=r,V.return=r,f.sibling=V,r.child=f,hr(r,o.child,null,a),f=r.child,f.memoizedState=wg(a),f.childLanes=Sg(o,T,a),r.memoizedState=xg,r=fl(null,f));else if(hi(r),i0(V)){if(T=V.nextSibling&&V.nextSibling.dataset,T)var et=T.dgst;T=et,f=Error(i(419)),f.stack="",f.digest=T,Ja({value:f,source:null,stack:null}),r=_g(o,r,a)}else if(_e||gs(o,r,a,!1),T=(a&o.childLanes)!==0,_e||T){if(T=oe,T!==null&&(f=mu(T,a),f!==0&&f!==X.retryLane))throw X.retryLane=f,rr(o,f),en(T,o,f),vg;o0(V)||mf(),r=_g(o,r,a)}else o0(V)?(r.flags|=192,r.child=o.child,r=null):(o=X.treeContext,ae=_n(V.nextSibling),Ve=r,Yt=!0,ai=null,Sn=!1,o!==null&&oC(r,o),r=Eg(r,f.children),r.flags|=4096);return r}return g?(pi(),V=f.fallback,g=r.mode,X=o.child,et=X.sibling,f=_o(X,{mode:"hidden",children:f.children}),f.subtreeFlags=X.subtreeFlags&65011712,et!==null?V=_o(et,V):(V=sr(V,g,a,null),V.flags|=2),V.return=r,f.return=r,f.sibling=V,r.child=f,fl(null,f),f=r.child,V=o.child.memoizedState,V===null?V=wg(a):(g=V.cachePool,g!==null?(X=Se._currentValue,g=g.parent!==X?{parent:X,pool:X}:g):g=cC(),V={baseLanes:V.baseLanes|a,cachePool:g}),f.memoizedState=V,f.childLanes=Sg(o,T,a),r.memoizedState=xg,fl(o.child,f)):(hi(r),a=o.child,o=a.sibling,a=_o(a,{mode:"visible",children:f.children}),a.return=r,a.sibling=null,o!==null&&(T=r.deletions,T===null?(r.deletions=[o],r.flags|=16):T.push(o)),r.child=a,r.memoizedState=null,a)}function Eg(o,r){return r=sf({mode:"visible",children:r},o.mode),r.return=o,o.child=r}function sf(o,r){return o=ln(22,o,null,r),o.lanes=0,o}function _g(o,r,a){return hr(r,o.child,null,a),o=Eg(r,r.pendingProps.children),o.flags|=2,r.memoizedState=null,o}function S2(o,r,a){o.lanes|=r;var f=o.alternate;f!==null&&(f.lanes|=r),Bm(o.return,r,a)}function Cg(o,r,a,f,g,v){var T=o.memoizedState;T===null?o.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:f,tail:a,tailMode:g,treeForkCount:v}:(T.isBackwards=r,T.rendering=null,T.renderingStartTime=0,T.last=f,T.tail=a,T.tailMode=g,T.treeForkCount=v)}function E2(o,r,a){var f=r.pendingProps,g=f.revealOrder,v=f.tail;f=f.children;var T=ye.current,V=(T&2)!==0;if(V?(T=T&1|2,r.flags|=128):T&=1,tt(ye,T),Ie(o,r,f,a),f=Yt?Wa:0,!V&&o!==null&&(o.flags&128)!==0)t:for(o=r.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&S2(o,a,r);else if(o.tag===19)S2(o,a,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(a=r.child,g=null;a!==null;)o=a.alternate,o!==null&&Xu(o)===null&&(g=a),a=a.sibling;a=g,a===null?(g=r.child,r.child=null):(g=a.sibling,a.sibling=null),Cg(r,!1,g,a,v,f);break;case"backwards":case"unstable_legacy-backwards":for(a=null,g=r.child,r.child=null;g!==null;){if(o=g.alternate,o!==null&&Xu(o)===null){r.child=g;break}o=g.sibling,g.sibling=a,a=g,g=o}Cg(r,!0,a,null,v,f);break;case"together":Cg(r,!1,null,null,void 0,f);break;default:r.memoizedState=null}return r.child}function Ro(o,r,a){if(o!==null&&(r.dependencies=o.dependencies),yi|=r.lanes,(a&r.childLanes)===0)if(o!==null){if(gs(o,r,a,!1),(a&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,a=_o(o,o.pendingProps),r.child=a,a.return=r;o.sibling!==null;)o=o.sibling,a=a.sibling=_o(o,o.pendingProps),a.return=r;a.sibling=null}return r.child}function Tg(o,r){return(o.lanes&r)!==0?!0:(o=o.dependencies,!!(o!==null&&Bu(o)))}function V9(o,r,a){switch(r.tag){case 3:ut(r,r.stateNode.containerInfo),ci(r,Se,o.memoizedState.cache),ar();break;case 27:case 5:kt(r);break;case 4:ut(r,r.stateNode.containerInfo);break;case 10:ci(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,Qm(r),null;break;case 13:var f=r.memoizedState;if(f!==null)return f.dehydrated!==null?(hi(r),r.flags|=128,null):(a&r.child.childLanes)!==0?w2(o,r,a):(hi(r),o=Ro(o,r,a),o!==null?o.sibling:null);hi(r);break;case 19:var g=(o.flags&128)!==0;if(f=(a&r.childLanes)!==0,f||(gs(o,r,a,!1),f=(a&r.childLanes)!==0),g){if(f)return E2(o,r,a);r.flags|=128}if(g=r.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),tt(ye,ye.current),f)break;return null;case 22:return r.lanes=0,m2(o,r,a,r.pendingProps);case 24:ci(r,Se,o.memoizedState.cache)}return Ro(o,r,a)}function _2(o,r,a){if(o!==null)if(o.memoizedProps!==r.pendingProps)_e=!0;else{if(!Tg(o,a)&&(r.flags&128)===0)return _e=!1,V9(o,r,a);_e=(o.flags&131072)!==0}else _e=!1,Yt&&(r.flags&1048576)!==0&&nC(r,Wa,r.index);switch(r.lanes=0,r.tag){case 16:t:{var f=r.pendingProps;if(o=fr(r.elementType),r.type=o,typeof o=="function")km(o)?(f=mr(o,f),r.tag=1,r=b2(null,r,o,f,a)):(r.tag=0,r=bg(null,r,o,f,a));else{if(o!=null){var g=o.$$typeof;if(g===_){r.tag=11,r=d2(null,r,o,f,a);break t}else if(g===k){r.tag=14,r=h2(null,r,o,f,a);break t}}throw r=B(o)||o,Error(i(306,r,""))}}return r;case 0:return bg(o,r,r.type,r.pendingProps,a);case 1:return f=r.type,g=mr(f,r.pendingProps),b2(o,r,f,g,a);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,qm(o,r),sl(r,f,null,a);var T=r.memoizedState;if(f=T.cache,ci(r,Se,f),f!==v.cache&&Pm(r,[Se],a,!0),rl(),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=x2(o,r,f,a);break t}else if(f!==g){g=bn(Error(i(424)),r),Ja(g),r=x2(o,r,f,a);break t}else for(o=r.stateNode.containerInfo,o.nodeType===9?o=o.body:o=o.nodeName==="HTML"?o.ownerDocument.body:o,ae=_n(o.firstChild),Ve=r,Yt=!0,ai=null,Sn=!0,a=mC(r,null,f,a),r.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling;else{if(ar(),f===g){r=Ro(o,r,a);break t}Ie(o,r,f,a)}r=r.child}return r;case 26:return rf(o,r),o===null?(a=zT(r.type,null,r.pendingProps,null))?r.memoizedState=a:Yt||(a=r.type,o=r.pendingProps,f=Sf(ht.current).createElement(a),f[Me]=r,f[Ue]=o,Be(f,a,o),we(f),r.stateNode=f):r.memoizedState=zT(r.type,o.memoizedProps,r.pendingProps,o.memoizedState),null;case 27:return kt(r),o===null&&Yt&&(f=r.stateNode=OT(r.type,r.pendingProps,ht.current),Ve=r,Sn=!0,g=ae,Si(r.type)?(r0=g,ae=_n(f.firstChild)):ae=g),Ie(o,r,r.pendingProps.children,a),rf(o,r),o===null&&(r.flags|=4194304),r.child;case 5:return o===null&&Yt&&((g=f=ae)&&(f=d7(f,r.type,r.pendingProps,Sn),f!==null?(r.stateNode=f,Ve=r,ae=_n(f.firstChild),Sn=!1,g=!0):g=!1),g||li(r)),kt(r),g=r.type,v=r.pendingProps,T=o!==null?o.memoizedProps:null,f=v.children,t0(g,v)?f=null:T!==null&&t0(g,T)&&(r.flags|=32),r.memoizedState!==null&&(g=Jm(o,r,N9,null,null,a),Tl._currentValue=g),rf(o,r),Ie(o,r,f,a),r.child;case 6:return o===null&&Yt&&((o=a=ae)&&(a=h7(a,r.pendingProps,Sn),a!==null?(r.stateNode=a,Ve=r,ae=null,o=!0):o=!1),o||li(r)),null;case 13:return w2(o,r,a);case 4:return ut(r,r.stateNode.containerInfo),f=r.pendingProps,o===null?r.child=hr(r,null,f,a):Ie(o,r,f,a),r.child;case 11:return d2(o,r,r.type,r.pendingProps,a);case 7:return Ie(o,r,r.pendingProps,a),r.child;case 8:return Ie(o,r,r.pendingProps.children,a),r.child;case 12:return Ie(o,r,r.pendingProps.children,a),r.child;case 10:return f=r.pendingProps,ci(r,r.type,f.value),Ie(o,r,f.children,a),r.child;case 9:return g=r.type._context,f=r.pendingProps.children,cr(r),g=Le(g),f=f(g),r.flags|=1,Ie(o,r,f,a),r.child;case 14:return h2(o,r,r.type,r.pendingProps,a);case 15:return p2(o,r,r.type,r.pendingProps,a);case 19:return E2(o,r,a);case 31:return z9(o,r,a);case 22:return m2(o,r,a,r.pendingProps);case 24:return cr(r),f=Le(Se),o===null?(g=$m(),g===null&&(g=oe,v=Hm(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=a),g=v),r.memoizedState={parent:f,cache:g},Gm(r),ci(r,Se,g)):((o.lanes&a)!==0&&(qm(o,r),sl(r,null,null,a),rl()),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),ci(r,Se,f)):(f=v.cache,ci(r,Se,f),f!==g.cache&&Pm(r,[Se],a,!0))),Ie(o,r,r.pendingProps.children,a),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function ko(o){o.flags|=4}function Ng(o,r,a,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(Q2())o.flags|=8192;else throw dr=$u,Ym}else o.flags&=-16777217}function C2(o,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!PT(r))if(Q2())o.flags|=8192;else throw dr=$u,Ym}function af(o,r){r!==null&&(o.flags|=4),o.flags&16384&&(r=o.tag!==22?du():536870912,o.lanes|=r,As|=r)}function dl(o,r){if(!Yt)switch(o.tailMode){case"hidden":r=o.tail;for(var a=null;r!==null;)r.alternate!==null&&(a=r),r=r.sibling;a===null?o.tail=null:a.sibling=null;break;case"collapsed":a=o.tail;for(var f=null;a!==null;)a.alternate!==null&&(f=a),a=a.sibling;f===null?r||o.tail===null?o.tail=null:o.tail.sibling=null:f.sibling=null}}function le(o){var r=o.alternate!==null&&o.alternate.child===o.child,a=0,f=0;if(r)for(var g=o.child;g!==null;)a|=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;)a|=g.lanes|g.childLanes,f|=g.subtreeFlags,f|=g.flags,g.return=o,g=g.sibling;return o.subtreeFlags|=f,o.childLanes=a,r}function L9(o,r,a){var f=r.pendingProps;switch(zm(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return le(r),null;case 1:return le(r),null;case 3:return a=r.stateNode,f=null,o!==null&&(f=o.memoizedState.cache),r.memoizedState.cache!==f&&(r.flags|=2048),No(Se),dt(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(o===null||o.child===null)&&(ms(r)?ko(r):o===null||o.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Lm())),le(r),null;case 26:var g=r.type,v=r.memoizedState;return o===null?(ko(r),v!==null?(le(r),C2(r,v)):(le(r),Ng(r,g,null,f,a))):v?v!==o.memoizedState?(ko(r),le(r),C2(r,v)):(le(r),r.flags&=-16777217):(o=o.memoizedProps,o!==f&&ko(r),le(r),Ng(r,g,o,f,a)),null;case 27:if(At(r),a=ht.current,g=r.type,o!==null&&r.stateNode!=null)o.memoizedProps!==f&&ko(r);else{if(!f){if(r.stateNode===null)throw Error(i(166));return le(r),null}o=rt.current,ms(r)?iC(r):(o=OT(g,f,a),r.stateNode=o,ko(r))}return le(r),null;case 5:if(At(r),g=r.type,o!==null&&r.stateNode!=null)o.memoizedProps!==f&&ko(r);else{if(!f){if(r.stateNode===null)throw Error(i(166));return le(r),null}if(v=rt.current,ms(r))iC(r);else{var T=Sf(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[Me]=r,v[Ue]=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(Be(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&&ko(r)}}return le(r),Ng(r,r.type,o===null?null:o.memoizedProps,r.pendingProps,a),null;case 6:if(o&&r.stateNode!=null)o.memoizedProps!==f&&ko(r);else{if(typeof f!="string"&&r.stateNode===null)throw Error(i(166));if(o=ht.current,ms(r)){if(o=r.stateNode,a=r.memoizedProps,f=null,g=Ve,g!==null)switch(g.tag){case 27:case 5:f=g.memoizedProps}o[Me]=r,o=!!(o.nodeValue===a||f!==null&&f.suppressHydrationWarning===!0||wT(o.nodeValue,a)),o||li(r,!0)}else o=Sf(o).createTextNode(f),o[Me]=r,r.stateNode=o}return le(r),null;case 31:if(a=r.memoizedState,o===null||o.memoizedState!==null){if(f=ms(r),a!==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[Me]=r}else ar(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;le(r),o=!1}else a=Lm(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=a),o=!0;if(!o)return r.flags&256?(un(r),r):(un(r),null);if((r.flags&128)!==0)throw Error(i(558))}return le(r),null;case 13:if(f=r.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(g=ms(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[Me]=r}else ar(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;le(r),g=!1}else g=Lm(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=g),g=!0;if(!g)return r.flags&256?(un(r),r):(un(r),null)}return un(r),(r.flags&128)!==0?(r.lanes=a,r):(a=f!==null,o=o!==null&&o.memoizedState!==null,a&&(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)),a!==o&&a&&(r.child.flags|=8192),af(r,r.updateQueue),le(r),null);case 4:return dt(),o===null&&Zg(r.stateNode.containerInfo),le(r),null;case 10:return No(r.type),le(r),null;case 19:if(q(ye),f=r.memoizedState,f===null)return le(r),null;if(g=(r.flags&128)!==0,v=f.rendering,v===null)if(g)dl(f,!1);else{if(me!==0||o!==null&&(o.flags&128)!==0)for(o=r.child;o!==null;){if(v=Xu(o),v!==null){for(r.flags|=128,dl(f,!1),o=v.updateQueue,r.updateQueue=o,af(r,o),r.subtreeFlags=0,o=a,a=r.child;a!==null;)J_(a,o),a=a.sibling;return tt(ye,ye.current&1|2),Yt&&Co(r,f.treeForkCount),r.child}o=o.sibling}f.tail!==null&&zt()>df&&(r.flags|=128,g=!0,dl(f,!1),r.lanes=4194304)}else{if(!g)if(o=Xu(v),o!==null){if(r.flags|=128,g=!0,o=o.updateQueue,r.updateQueue=o,af(r,o),dl(f,!0),f.tail===null&&f.tailMode==="hidden"&&!v.alternate&&!Yt)return le(r),null}else 2*zt()-f.renderingStartTime>df&&a!==536870912&&(r.flags|=128,g=!0,dl(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,a=ye.current,tt(ye,g?a&1|2:a&1),Yt&&Co(r,f.treeForkCount),o):(le(r),null);case 22:case 23:return un(r),Km(),f=r.memoizedState!==null,o!==null?o.memoizedState!==null!==f&&(r.flags|=8192):f&&(r.flags|=8192),f?(a&536870912)!==0&&(r.flags&128)===0&&(le(r),r.subtreeFlags&6&&(r.flags|=8192)):le(r),a=r.updateQueue,a!==null&&af(r,a.retryQueue),a=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(a=o.memoizedState.cachePool.pool),f=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),f!==a&&(r.flags|=2048),o!==null&&q(ur),null;case 24:return a=null,o!==null&&(a=o.memoizedState.cache),r.memoizedState.cache!==a&&(r.flags|=2048),No(Se),le(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function I9(o,r){switch(zm(r),r.tag){case 1:return o=r.flags,o&65536?(r.flags=o&-65537|128,r):null;case 3:return No(Se),dt(),o=r.flags,(o&65536)!==0&&(o&128)===0?(r.flags=o&-65537|128,r):null;case 26:case 27:case 5:return At(r),null;case 31:if(r.memoizedState!==null){if(un(r),r.alternate===null)throw Error(i(340));ar()}return o=r.flags,o&65536?(r.flags=o&-65537|128,r):null;case 13:if(un(r),o=r.memoizedState,o!==null&&o.dehydrated!==null){if(r.alternate===null)throw Error(i(340));ar()}return o=r.flags,o&65536?(r.flags=o&-65537|128,r):null;case 19:return q(ye),null;case 4:return dt(),null;case 10:return No(r.type),null;case 22:case 23:return un(r),Km(),o!==null&&q(ur),o=r.flags,o&65536?(r.flags=o&-65537|128,r):null;case 24:return No(Se),null;case 25:return null;default:return null}}function T2(o,r){switch(zm(r),r.tag){case 3:No(Se),dt();break;case 26:case 27:case 5:At(r);break;case 4:dt();break;case 31:r.memoizedState!==null&&un(r);break;case 13:un(r);break;case 19:q(ye);break;case 10:No(r.type);break;case 22:case 23:un(r),Km(),o!==null&&q(ur);break;case 24:No(Se)}}function hl(o,r){try{var a=r.updateQueue,f=a!==null?a.lastEffect:null;if(f!==null){var g=f.next;a=g;do{if((a.tag&o)===o){f=void 0;var v=a.create,T=a.inst;f=v(),T.destroy=f}a=a.next}while(a!==g)}}catch(V){Jt(r,r.return,V)}}function mi(o,r,a){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 T=f.inst,V=T.destroy;if(V!==void 0){T.destroy=void 0,g=r;var X=a,et=V;try{et()}catch(st){Jt(g,X,st)}}}f=f.next}while(f!==v)}}catch(st){Jt(r,r.return,st)}}function N2(o){var r=o.updateQueue;if(r!==null){var a=o.stateNode;try{yC(r,a)}catch(f){Jt(o,o.return,f)}}}function A2(o,r,a){a.props=mr(o.type,o.memoizedProps),a.state=o.memoizedState;try{a.componentWillUnmount()}catch(f){Jt(o,r,f)}}function pl(o,r){try{var a=o.ref;if(a!==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 a=="function"?o.refCleanup=a(f):a.current=f}}catch(g){Jt(o,r,g)}}function ro(o,r){var a=o.ref,f=o.refCleanup;if(a!==null)if(typeof f=="function")try{f()}catch(g){Jt(o,r,g)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(g){Jt(o,r,g)}else a.current=null}function M2(o){var r=o.type,a=o.memoizedProps,f=o.stateNode;try{t:switch(r){case"button":case"input":case"select":case"textarea":a.autoFocus&&f.focus();break t;case"img":a.src?f.src=a.src:a.srcSet&&(f.srcset=a.srcSet)}}catch(g){Jt(o,o.return,g)}}function Ag(o,r,a){try{var f=o.stateNode;s7(f,o.type,a,r),f[Ue]=r}catch(g){Jt(o,o.return,g)}}function R2(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&Si(o.type)||o.tag===4}function Mg(o){t:for(;;){for(;o.sibling===null;){if(o.return===null||R2(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&&Si(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 Rg(o,r,a){var f=o.tag;if(f===5||f===6)o=o.stateNode,r?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(o,r):(r=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,r.appendChild(o),a=a._reactRootContainer,a!=null||r.onclick!==null||(r.onclick=So));else if(f!==4&&(f===27&&Si(o.type)&&(a=o.stateNode,r=null),o=o.child,o!==null))for(Rg(o,r,a),o=o.sibling;o!==null;)Rg(o,r,a),o=o.sibling}function lf(o,r,a){var f=o.tag;if(f===5||f===6)o=o.stateNode,r?a.insertBefore(o,r):a.appendChild(o);else if(f!==4&&(f===27&&Si(o.type)&&(a=o.stateNode),o=o.child,o!==null))for(lf(o,r,a),o=o.sibling;o!==null;)lf(o,r,a),o=o.sibling}function k2(o){var r=o.stateNode,a=o.memoizedProps;try{for(var f=o.type,g=r.attributes;g.length;)r.removeAttributeNode(g[0]);Be(r,f,a),r[Me]=o,r[Ue]=a}catch(v){Jt(o,o.return,v)}}var Oo=!1,Ce=!1,kg=!1,O2=typeof WeakSet=="function"?WeakSet:Set,je=null;function B9(o,r){if(o=o.containerInfo,Wg=Mf,o=Y_(o),_m(o)){if("selectionStart"in o)var a={start:o.selectionStart,end:o.selectionEnd};else t:{a=(a=o.ownerDocument)&&a.defaultView||window;var f=a.getSelection&&a.getSelection();if(f&&f.rangeCount!==0){a=f.anchorNode;var g=f.anchorOffset,v=f.focusNode;f=f.focusOffset;try{a.nodeType,v.nodeType}catch{a=null;break t}var T=0,V=-1,X=-1,et=0,st=0,lt=o,ot=null;e:for(;;){for(var it;lt!==a||g!==0&<.nodeType!==3||(V=T+g),lt!==v||f!==0&<.nodeType!==3||(X=T+f),lt.nodeType===3&&(T+=lt.nodeValue.length),(it=lt.firstChild)!==null;)ot=lt,lt=it;for(;;){if(lt===o)break e;if(ot===a&&++et===g&&(V=T),ot===v&&++st===f&&(X=T),(it=lt.nextSibling)!==null)break;lt=ot,ot=lt.parentNode}lt=it}a=V===-1||X===-1?null:{start:V,end:X}}else a=null}a=a||{start:0,end:0}}else a=null;for(Jg={focusedElem:o,selectionRange:a},Mf=!1,je=r;je!==null;)if(r=je,o=r.child,(r.subtreeFlags&1028)!==0&&o!==null)o.return=r,je=o;else for(;je!==null;){switch(r=je,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(a=0;a<o.length;a++)g=o[a],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&v!==null){o=void 0,a=r,g=v.memoizedProps,v=v.memoizedState,f=a.stateNode;try{var xt=mr(a.type,g);o=f.getSnapshotBeforeUpdate(xt,v),f.__reactInternalSnapshotBeforeUpdate=o}catch(Rt){Jt(a,a.return,Rt)}}break;case 3:if((o&1024)!==0){if(o=r.stateNode.containerInfo,a=o.nodeType,a===9)n0(o);else if(a===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":n0(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,je=o;break}je=r.return}}function D2(o,r,a){var f=a.flags;switch(a.tag){case 0:case 11:case 15:jo(o,a),f&4&&hl(5,a);break;case 1:if(jo(o,a),f&4)if(o=a.stateNode,r===null)try{o.componentDidMount()}catch(T){Jt(a,a.return,T)}else{var g=mr(a.type,r.memoizedProps);r=r.memoizedState;try{o.componentDidUpdate(g,r,o.__reactInternalSnapshotBeforeUpdate)}catch(T){Jt(a,a.return,T)}}f&64&&N2(a),f&512&&pl(a,a.return);break;case 3:if(jo(o,a),f&64&&(o=a.updateQueue,o!==null)){if(r=null,a.child!==null)switch(a.child.tag){case 27:case 5:r=a.child.stateNode;break;case 1:r=a.child.stateNode}try{yC(o,r)}catch(T){Jt(a,a.return,T)}}break;case 27:r===null&&f&4&&k2(a);case 26:case 5:jo(o,a),r===null&&f&4&&M2(a),f&512&&pl(a,a.return);break;case 12:jo(o,a);break;case 31:jo(o,a),f&4&&V2(o,a);break;case 13:jo(o,a),f&4&&L2(o,a),f&64&&(o=a.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(a=F9.bind(null,a),p7(o,a))));break;case 22:if(f=a.memoizedState!==null||Oo,!f){r=r!==null&&r.memoizedState!==null||Ce,g=Oo;var v=Ce;Oo=f,(Ce=r)&&!v?zo(o,a,(a.subtreeFlags&8772)!==0):jo(o,a),Oo=g,Ce=v}break;case 30:break;default:jo(o,a)}}function j2(o){var r=o.alternate;r!==null&&(o.alternate=null,j2(r)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(r=o.stateNode,r!==null&&Pa(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 ue=null,Qe=!1;function Do(o,r,a){for(a=a.child;a!==null;)z2(o,r,a),a=a.sibling}function z2(o,r,a){if(he&&typeof he.onCommitFiberUnmount=="function")try{he.onCommitFiberUnmount(Ae,a)}catch{}switch(a.tag){case 26:Ce||ro(a,r),Do(o,r,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:Ce||ro(a,r);var f=ue,g=Qe;Si(a.type)&&(ue=a.stateNode,Qe=!1),Do(o,r,a),El(a.stateNode),ue=f,Qe=g;break;case 5:Ce||ro(a,r);case 6:if(f=ue,g=Qe,ue=null,Do(o,r,a),ue=f,Qe=g,ue!==null)if(Qe)try{(ue.nodeType===9?ue.body:ue.nodeName==="HTML"?ue.ownerDocument.body:ue).removeChild(a.stateNode)}catch(v){Jt(a,r,v)}else try{ue.removeChild(a.stateNode)}catch(v){Jt(a,r,v)}break;case 18:ue!==null&&(Qe?(o=ue,NT(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,a.stateNode),Vs(o)):NT(ue,a.stateNode));break;case 4:f=ue,g=Qe,ue=a.stateNode.containerInfo,Qe=!0,Do(o,r,a),ue=f,Qe=g;break;case 0:case 11:case 14:case 15:mi(2,a,r),Ce||mi(4,a,r),Do(o,r,a);break;case 1:Ce||(ro(a,r),f=a.stateNode,typeof f.componentWillUnmount=="function"&&A2(a,r,f)),Do(o,r,a);break;case 21:Do(o,r,a);break;case 22:Ce=(f=Ce)||a.memoizedState!==null,Do(o,r,a),Ce=f;break;default:Do(o,r,a)}}function V2(o,r){if(r.memoizedState===null&&(o=r.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{Vs(o)}catch(a){Jt(r,r.return,a)}}}function L2(o,r){if(r.memoizedState===null&&(o=r.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{Vs(o)}catch(a){Jt(r,r.return,a)}}function P9(o){switch(o.tag){case 31:case 13:case 19:var r=o.stateNode;return r===null&&(r=o.stateNode=new O2),r;case 22:return o=o.stateNode,r=o._retryCache,r===null&&(r=o._retryCache=new O2),r;default:throw Error(i(435,o.tag))}}function cf(o,r){var a=P9(o);r.forEach(function(f){if(!a.has(f)){a.add(f);var g=Z9.bind(null,o,f);f.then(g,g)}})}function We(o,r){var a=r.deletions;if(a!==null)for(var f=0;f<a.length;f++){var g=a[f],v=o,T=r,V=T;t:for(;V!==null;){switch(V.tag){case 27:if(Si(V.type)){ue=V.stateNode,Qe=!1;break t}break;case 5:ue=V.stateNode,Qe=!1;break t;case 3:case 4:ue=V.stateNode.containerInfo,Qe=!0;break t}V=V.return}if(ue===null)throw Error(i(160));z2(v,T,g),ue=null,Qe=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)I2(r,o),r=r.sibling}var Hn=null;function I2(o,r){var a=o.alternate,f=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:We(r,o),Je(o),f&4&&(mi(3,o,o.return),hl(3,o),mi(5,o,o.return));break;case 1:We(r,o),Je(o),f&512&&(Ce||a===null||ro(a,a.return)),f&64&&Oo&&(o=o.updateQueue,o!==null&&(f=o.callbacks,f!==null&&(a=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=a===null?f:a.concat(f))));break;case 26:var g=Hn;if(We(r,o),Je(o),f&512&&(Ce||a===null||ro(a,a.return)),f&4){var v=a!==null?a.memoizedState:null;if(f=o.memoizedState,a===null)if(f===null)if(o.stateNode===null){t:{f=o.type,a=o.memoizedProps,g=g.ownerDocument||g;e:switch(f){case"title":v=g.getElementsByTagName("title")[0],(!v||v[Ji]||v[Me]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(f),g.head.insertBefore(v,g.querySelector("head > title"))),Be(v,f,a),v[Me]=o,we(v),f=v;break t;case"link":var T=IT("link","href",g).get(f+(a.href||""));if(T){for(var V=0;V<T.length;V++)if(v=T[V],v.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&v.getAttribute("rel")===(a.rel==null?null:a.rel)&&v.getAttribute("title")===(a.title==null?null:a.title)&&v.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){T.splice(V,1);break e}}v=g.createElement(f),Be(v,f,a),g.head.appendChild(v);break;case"meta":if(T=IT("meta","content",g).get(f+(a.content||""))){for(V=0;V<T.length;V++)if(v=T[V],v.getAttribute("content")===(a.content==null?null:""+a.content)&&v.getAttribute("name")===(a.name==null?null:a.name)&&v.getAttribute("property")===(a.property==null?null:a.property)&&v.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&v.getAttribute("charset")===(a.charSet==null?null:a.charSet)){T.splice(V,1);break e}}v=g.createElement(f),Be(v,f,a),g.head.appendChild(v);break;default:throw Error(i(468,f))}v[Me]=o,we(v),f=v}o.stateNode=f}else BT(g,o.type,o.stateNode);else o.stateNode=LT(g,f,o.memoizedProps);else v!==f?(v===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):v.count--,f===null?BT(g,o.type,o.stateNode):LT(g,f,o.memoizedProps)):f===null&&o.stateNode!==null&&Ag(o,o.memoizedProps,a.memoizedProps)}break;case 27:We(r,o),Je(o),f&512&&(Ce||a===null||ro(a,a.return)),a!==null&&f&4&&Ag(o,o.memoizedProps,a.memoizedProps);break;case 5:if(We(r,o),Je(o),f&512&&(Ce||a===null||ro(a,a.return)),o.flags&32){g=o.stateNode;try{rs(g,"")}catch(xt){Jt(o,o.return,xt)}}f&4&&o.stateNode!=null&&(g=o.memoizedProps,Ag(o,g,a!==null?a.memoizedProps:g)),f&1024&&(kg=!0);break;case 6:if(We(r,o),Je(o),f&4){if(o.stateNode===null)throw Error(i(162));f=o.memoizedProps,a=o.stateNode;try{a.nodeValue=f}catch(xt){Jt(o,o.return,xt)}}break;case 3:if(Cf=null,g=Hn,Hn=Ef(r.containerInfo),We(r,o),Hn=g,Je(o),f&4&&a!==null&&a.memoizedState.isDehydrated)try{Vs(r.containerInfo)}catch(xt){Jt(o,o.return,xt)}kg&&(kg=!1,B2(o));break;case 4:f=Hn,Hn=Ef(o.stateNode.containerInfo),We(r,o),Je(o),Hn=f;break;case 12:We(r,o),Je(o);break;case 31:We(r,o),Je(o),f&4&&(f=o.updateQueue,f!==null&&(o.updateQueue=null,cf(o,f)));break;case 13:We(r,o),Je(o),o.child.flags&8192&&o.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(ff=zt()),f&4&&(f=o.updateQueue,f!==null&&(o.updateQueue=null,cf(o,f)));break;case 22:g=o.memoizedState!==null;var X=a!==null&&a.memoizedState!==null,et=Oo,st=Ce;if(Oo=et||g,Ce=st||X,We(r,o),Ce=st,Oo=et,Je(o),f&8192)t:for(r=o.stateNode,r._visibility=g?r._visibility&-2:r._visibility|1,g&&(a===null||X||Oo||Ce||gr(o)),a=null,r=o;;){if(r.tag===5||r.tag===26){if(a===null){X=a=r;try{if(v=X.stateNode,g)T=v.style,typeof T.setProperty=="function"?T.setProperty("display","none","important"):T.display="none";else{V=X.stateNode;var lt=X.memoizedProps.style,ot=lt!=null&<.hasOwnProperty("display")?lt.display:null;V.style.display=ot==null||typeof ot=="boolean"?"":(""+ot).trim()}}catch(xt){Jt(X,X.return,xt)}}}else if(r.tag===6){if(a===null){X=r;try{X.stateNode.nodeValue=g?"":X.memoizedProps}catch(xt){Jt(X,X.return,xt)}}}else if(r.tag===18){if(a===null){X=r;try{var it=X.stateNode;g?AT(it,!0):AT(X.stateNode,!1)}catch(xt){Jt(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;a===r&&(a=null),r=r.return}a===r&&(a=null),r.sibling.return=r.return,r=r.sibling}f&4&&(f=o.updateQueue,f!==null&&(a=f.retryQueue,a!==null&&(f.retryQueue=null,cf(o,a))));break;case 19:We(r,o),Je(o),f&4&&(f=o.updateQueue,f!==null&&(o.updateQueue=null,cf(o,f)));break;case 30:break;case 21:break;default:We(r,o),Je(o)}}function Je(o){var r=o.flags;if(r&2){try{for(var a,f=o.return;f!==null;){if(R2(f)){a=f;break}f=f.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var g=a.stateNode,v=Mg(o);lf(o,v,g);break;case 5:var T=a.stateNode;a.flags&32&&(rs(T,""),a.flags&=-33);var V=Mg(o);lf(o,V,T);break;case 3:case 4:var X=a.stateNode.containerInfo,et=Mg(o);Rg(o,et,X);break;default:throw Error(i(161))}}catch(st){Jt(o,o.return,st)}o.flags&=-3}r&4096&&(o.flags&=-4097)}function B2(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var r=o;B2(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),o=o.sibling}}function jo(o,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)D2(o,r.alternate,r),r=r.sibling}function gr(o){for(o=o.child;o!==null;){var r=o;switch(r.tag){case 0:case 11:case 14:case 15:mi(4,r,r.return),gr(r);break;case 1:ro(r,r.return);var a=r.stateNode;typeof a.componentWillUnmount=="function"&&A2(r,r.return,a),gr(r);break;case 27:El(r.stateNode);case 26:case 5:ro(r,r.return),gr(r);break;case 22:r.memoizedState===null&&gr(r);break;case 30:gr(r);break;default:gr(r)}o=o.sibling}}function zo(o,r,a){for(a=a&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var f=r.alternate,g=o,v=r,T=v.flags;switch(v.tag){case 0:case 11:case 15:zo(g,v,a),hl(4,v);break;case 1:if(zo(g,v,a),f=v,g=f.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(et){Jt(f,f.return,et)}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++)gC(X[g],V)}catch(et){Jt(f,f.return,et)}}a&&T&64&&N2(v),pl(v,v.return);break;case 27:k2(v);case 26:case 5:zo(g,v,a),a&&f===null&&T&4&&M2(v),pl(v,v.return);break;case 12:zo(g,v,a);break;case 31:zo(g,v,a),a&&T&4&&V2(g,v);break;case 13:zo(g,v,a),a&&T&4&&L2(g,v);break;case 22:v.memoizedState===null&&zo(g,v,a),pl(v,v.return);break;case 30:break;default:zo(g,v,a)}r=r.sibling}}function Og(o,r){var a=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(a=o.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==a&&(o!=null&&o.refCount++,a!=null&&tl(a))}function Dg(o,r){o=null,r.alternate!==null&&(o=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==o&&(r.refCount++,o!=null&&tl(o))}function Un(o,r,a,f){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)P2(o,r,a,f),r=r.sibling}function P2(o,r,a,f){var g=r.flags;switch(r.tag){case 0:case 11:case 15:Un(o,r,a,f),g&2048&&hl(9,r);break;case 1:Un(o,r,a,f);break;case 3:Un(o,r,a,f),g&2048&&(o=null,r.alternate!==null&&(o=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==o&&(r.refCount++,o!=null&&tl(o)));break;case 12:if(g&2048){Un(o,r,a,f),o=r.stateNode;try{var v=r.memoizedProps,T=v.id,V=v.onPostCommit;typeof V=="function"&&V(T,r.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(X){Jt(r,r.return,X)}}else Un(o,r,a,f);break;case 31:Un(o,r,a,f);break;case 13:Un(o,r,a,f);break;case 23:break;case 22:v=r.stateNode,T=r.alternate,r.memoizedState!==null?v._visibility&2?Un(o,r,a,f):ml(o,r):v._visibility&2?Un(o,r,a,f):(v._visibility|=2,Cs(o,r,a,f,(r.subtreeFlags&10256)!==0||!1)),g&2048&&Og(T,r);break;case 24:Un(o,r,a,f),g&2048&&Dg(r.alternate,r);break;default:Un(o,r,a,f)}}function Cs(o,r,a,f,g){for(g=g&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var v=o,T=r,V=a,X=f,et=T.flags;switch(T.tag){case 0:case 11:case 15:Cs(v,T,V,X,g),hl(8,T);break;case 23:break;case 22:var st=T.stateNode;T.memoizedState!==null?st._visibility&2?Cs(v,T,V,X,g):ml(v,T):(st._visibility|=2,Cs(v,T,V,X,g)),g&&et&2048&&Og(T.alternate,T);break;case 24:Cs(v,T,V,X,g),g&&et&2048&&Dg(T.alternate,T);break;default:Cs(v,T,V,X,g)}r=r.sibling}}function ml(o,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var a=o,f=r,g=f.flags;switch(f.tag){case 22:ml(a,f),g&2048&&Og(f.alternate,f);break;case 24:ml(a,f),g&2048&&Dg(f.alternate,f);break;default:ml(a,f)}r=r.sibling}}var gl=8192;function Ts(o,r,a){if(o.subtreeFlags&gl)for(o=o.child;o!==null;)H2(o,r,a),o=o.sibling}function H2(o,r,a){switch(o.tag){case 26:Ts(o,r,a),o.flags&gl&&o.memoizedState!==null&&T7(a,Hn,o.memoizedState,o.memoizedProps);break;case 5:Ts(o,r,a);break;case 3:case 4:var f=Hn;Hn=Ef(o.stateNode.containerInfo),Ts(o,r,a),Hn=f;break;case 22:o.memoizedState===null&&(f=o.alternate,f!==null&&f.memoizedState!==null?(f=gl,gl=16777216,Ts(o,r,a),gl=f):Ts(o,r,a));break;default:Ts(o,r,a)}}function U2(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 yl(o){var r=o.deletions;if((o.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var f=r[a];je=f,Y2(f,o)}U2(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)$2(o),o=o.sibling}function $2(o){switch(o.tag){case 0:case 11:case 15:yl(o),o.flags&2048&&mi(9,o,o.return);break;case 3:yl(o);break;case 12:yl(o);break;case 22:var r=o.stateNode;o.memoizedState!==null&&r._visibility&2&&(o.return===null||o.return.tag!==13)?(r._visibility&=-3,uf(o)):yl(o);break;default:yl(o)}}function uf(o){var r=o.deletions;if((o.flags&16)!==0){if(r!==null)for(var a=0;a<r.length;a++){var f=r[a];je=f,Y2(f,o)}U2(o)}for(o=o.child;o!==null;){switch(r=o,r.tag){case 0:case 11:case 15:mi(8,r,r.return),uf(r);break;case 22:a=r.stateNode,a._visibility&2&&(a._visibility&=-3,uf(r));break;default:uf(r)}o=o.sibling}}function Y2(o,r){for(;je!==null;){var a=je;switch(a.tag){case 0:case 11:case 15:mi(8,a,r);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var f=a.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:tl(a.memoizedState.cache)}if(f=a.child,f!==null)f.return=a,je=f;else t:for(a=o;je!==null;){f=je;var g=f.sibling,v=f.return;if(j2(f),f===a){je=null;break t}if(g!==null){g.return=v,je=g;break t}je=v}}}var H9={getCacheForType:function(o){var r=Le(Se),a=r.data.get(o);return a===void 0&&(a=o(),r.data.set(o,a)),a},cacheSignal:function(){return Le(Se).controller.signal}},U9=typeof WeakMap=="function"?WeakMap:Map,Kt=0,oe=null,Pt=null,Ut=0,Wt=0,fn=null,gi=!1,Ns=!1,jg=!1,Vo=0,me=0,yi=0,yr=0,zg=0,dn=0,As=0,vl=null,tn=null,Vg=!1,ff=0,G2=0,df=1/0,hf=null,vi=null,Re=0,bi=null,Ms=null,Lo=0,Lg=0,Ig=null,q2=null,bl=0,Bg=null;function hn(){return(Kt&2)!==0&&Ut!==0?Ut&-Ut:j.T!==null?Gg():gu()}function X2(){if(dn===0)if((Ut&536870912)===0||Yt){var o=Wr;Wr<<=1,(Wr&3932160)===0&&(Wr=262144),dn=o}else dn=536870912;return o=cn.current,o!==null&&(o.flags|=32),dn}function en(o,r,a){(o===oe&&(Wt===2||Wt===9)||o.cancelPendingCommit!==null)&&(Rs(o,0),xi(o,Ut,dn,!1)),Wi(o,a),((Kt&2)===0||o!==oe)&&(o===oe&&((Kt&2)===0&&(yr|=a),me===4&&xi(o,Ut,dn,!1)),so(o))}function F2(o,r,a){if((Kt&6)!==0)throw Error(i(327));var f=!a&&(r&127)===0&&(r&o.expiredLanes)===0||Qi(o,r),g=f?G9(o,r):Hg(o,r,!0),v=f;do{if(g===0){Ns&&!f&&xi(o,r,0,!1);break}else{if(a=o.current.alternate,v&&!$9(a)){g=Hg(o,r,!1),v=!1;continue}if(g===2){if(v=r,o.errorRecoveryDisabledLanes&v)var T=0;else T=o.pendingLanes&-536870913,T=T!==0?T:T&536870912?536870912:0;if(T!==0){r=T;t:{var V=o;g=vl;var X=V.current.memoizedState.isDehydrated;if(X&&(Rs(V,T).flags|=256),T=Hg(V,T,!1),T!==2){if(jg&&!X){V.errorRecoveryDisabledLanes|=v,yr|=v,g=4;break t}v=tn,tn=g,v!==null&&(tn===null?tn=v:tn.push.apply(tn,v))}g=T}if(v=!1,g!==2)continue}}if(g===1){Rs(o,0),xi(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:xi(f,r,dn,!gi);break t;case 2:tn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(g=ff+300-zt(),10<g)){if(xi(f,r,dn,!gi),ts(f,0,!0)!==0)break t;Lo=r,f.timeoutHandle=CT(Z2.bind(null,f,a,tn,hf,Vg,r,dn,yr,As,gi,v,"Throttled",-0,0),g);break t}Z2(f,a,tn,hf,Vg,r,dn,yr,As,gi,v,null,-0,0)}}break}while(!0);so(o)}function Z2(o,r,a,f,g,v,T,V,X,et,st,lt,ot,it){if(o.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:So},H2(r,v,lt);var xt=(v&62914560)===v?ff-zt():(v&4194048)===v?G2-zt():0;if(xt=N7(lt,xt),xt!==null){Lo=v,o.cancelPendingCommit=xt(oT.bind(null,o,r,v,a,f,g,T,V,X,st,lt,null,ot,it)),xi(o,v,T,!et);return}}oT(o,r,v,a,f,g,T,V,X)}function $9(o){for(var r=o;;){var a=r.tag;if((a===0||a===11||a===15)&&r.flags&16384&&(a=r.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var f=0;f<a.length;f++){var g=a[f],v=g.getSnapshot;g=g.value;try{if(!an(v(),g))return!1}catch{return!1}}if(a=r.child,r.subtreeFlags&16384&&a!==null)a.return=r,r=a;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 xi(o,r,a,f){r&=~zg,r&=~yr,o.suspendedLanes|=r,o.pingedLanes&=~r,f&&(o.warmLanes|=r),f=o.expirationTimes;for(var g=r;0<g;){var v=31-De(g),T=1<<v;f[v]=-1,g&=~T}a!==0&&hu(o,a,r)}function pf(){return(Kt&6)===0?(xl(0),!1):!0}function Pg(){if(Pt!==null){if(Wt===0)var o=Pt.return;else o=Pt,To=lr=null,ng(o),xs=null,nl=0,o=Pt;for(;o!==null;)T2(o.alternate,o),o=o.return;Pt=null}}function Rs(o,r){var a=o.timeoutHandle;a!==-1&&(o.timeoutHandle=-1,c7(a)),a=o.cancelPendingCommit,a!==null&&(o.cancelPendingCommit=null,a()),Lo=0,Pg(),oe=o,Pt=a=_o(o.current,null),Ut=r,Wt=0,fn=null,gi=!1,Ns=Qi(o,r),jg=!1,As=dn=zg=yr=yi=me=0,tn=vl=null,Vg=!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-De(f),v=1<<g;r|=o[g],f&=~v}return Vo=r,ju(),a}function K2(o,r){Vt=null,j.H=ul,r===bs||r===Uu?(r=dC(),Wt=3):r===Ym?(r=dC(),Wt=4):Wt=r===vg?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,fn=r,Pt===null&&(me=1,nf(o,bn(r,o.current)))}function Q2(){var o=cn.current;return o===null?!0:(Ut&4194048)===Ut?En===null:(Ut&62914560)===Ut||(Ut&536870912)!==0?o===En:!1}function W2(){var o=j.H;return j.H=ul,o===null?ul:o}function J2(){var o=j.A;return j.A=H9,o}function mf(){me=4,gi||(Ut&4194048)!==Ut&&cn.current!==null||(Ns=!0),(yi&134217727)===0&&(yr&134217727)===0||oe===null||xi(oe,Ut,dn,!1)}function Hg(o,r,a){var f=Kt;Kt|=2;var g=W2(),v=J2();(oe!==o||Ut!==r)&&(hf=null,Rs(o,r)),r=!1;var T=me;t:do try{if(Wt!==0&&Pt!==null){var V=Pt,X=fn;switch(Wt){case 8:Pg(),T=6;break t;case 3:case 2:case 9:case 6:cn.current===null&&(r=!0);var et=Wt;if(Wt=0,fn=null,ks(o,V,X,et),a&&Ns){T=0;break t}break;default:et=Wt,Wt=0,fn=null,ks(o,V,X,et)}}Y9(),T=me;break}catch(st){K2(o,st)}while(!0);return r&&o.shellSuspendCounter++,To=lr=null,Kt=f,j.H=g,j.A=v,Pt===null&&(oe=null,Ut=0,ju()),T}function Y9(){for(;Pt!==null;)tT(Pt)}function G9(o,r){var a=Kt;Kt|=2;var f=W2(),g=J2();oe!==o||Ut!==r?(hf=null,df=zt()+500,Rs(o,r)):Ns=Qi(o,r);t:do try{if(Wt!==0&&Pt!==null){r=Pt;var v=fn;e:switch(Wt){case 1:Wt=0,fn=null,ks(o,r,v,1);break;case 2:case 9:if(uC(v)){Wt=0,fn=null,eT(r);break}r=function(){Wt!==2&&Wt!==9||oe!==o||(Wt=7),so(o)},v.then(r,r);break t;case 3:Wt=7;break t;case 4:Wt=5;break t;case 7:uC(v)?(Wt=0,fn=null,eT(r)):(Wt=0,fn=null,ks(o,r,v,7));break;case 5:var T=null;switch(Pt.tag){case 26:T=Pt.memoizedState;case 5:case 27:var V=Pt;if(T?PT(T):V.stateNode.complete){Wt=0,fn=null;var X=V.sibling;if(X!==null)Pt=X;else{var et=V.return;et!==null?(Pt=et,gf(et)):Pt=null}break e}}Wt=0,fn=null,ks(o,r,v,5);break;case 6:Wt=0,fn=null,ks(o,r,v,6);break;case 8:Pg(),me=6;break t;default:throw Error(i(462))}}q9();break}catch(st){K2(o,st)}while(!0);return To=lr=null,j.H=f,j.A=g,Kt=a,Pt!==null?0:(oe=null,Ut=0,ju(),me)}function q9(){for(;Pt!==null&&!Lt();)tT(Pt)}function tT(o){var r=_2(o.alternate,o,Vo);o.memoizedProps=o.pendingProps,r===null?gf(o):Pt=r}function eT(o){var r=o,a=r.alternate;switch(r.tag){case 15:case 0:r=v2(a,r,r.pendingProps,r.type,void 0,Ut);break;case 11:r=v2(a,r,r.pendingProps,r.type.render,r.ref,Ut);break;case 5:ng(r);default:T2(a,r),r=Pt=J_(r,Vo),r=_2(a,r,Vo)}o.memoizedProps=o.pendingProps,r===null?gf(o):Pt=r}function ks(o,r,a,f){To=lr=null,ng(r),xs=null,nl=0;var g=r.return;try{if(j9(o,g,r,a,Ut)){me=1,nf(o,bn(a,o.current)),Pt=null;return}}catch(v){if(g!==null)throw Pt=g,v;me=1,nf(o,bn(a,o.current)),Pt=null;return}r.flags&32768?(Yt||f===1?o=!0:Ns||(Ut&536870912)!==0?o=!1:(gi=o=!0,(f===2||f===9||f===3||f===6)&&(f=cn.current,f!==null&&f.tag===13&&(f.flags|=16384))),nT(r,o)):gf(r)}function gf(o){var r=o;do{if((r.flags&32768)!==0){nT(r,gi);return}o=r.return;var a=L9(r.alternate,r,Vo);if(a!==null){Pt=a;return}if(r=r.sibling,r!==null){Pt=r;return}Pt=r=o}while(r!==null);me===0&&(me=5)}function nT(o,r){do{var a=I9(o.alternate,o);if(a!==null){a.flags&=32767,Pt=a;return}if(a=o.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!r&&(o=o.sibling,o!==null)){Pt=o;return}Pt=o=a}while(o!==null);me=6,Pt=null}function oT(o,r,a,f,g,v,T,V,X){o.cancelPendingCommit=null;do yf();while(Re!==0);if((Kt&6)!==0)throw Error(i(327));if(r!==null){if(r===o.current)throw Error(i(177));if(v=r.lanes|r.childLanes,v|=Mm,rm(o,a,v,T,V,X),o===oe&&(Pt=oe=null,Ut=0),Ms=r,bi=o,Lo=a,Lg=v,Ig=g,q2=f,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,K9(yn,function(){return lT(),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,T=Kt,Kt|=4;try{B9(o,r,a)}finally{Kt=T,I.p=g,j.T=f}}Re=1,iT(),rT(),sT()}}function iT(){if(Re===1){Re=0;var o=bi,r=Ms,a=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||a){a=j.T,j.T=null;var f=I.p;I.p=2;var g=Kt;Kt|=4;try{I2(r,o);var v=Jg,T=Y_(o.containerInfo),V=v.focusedElem,X=v.selectionRange;if(T!==V&&V&&V.ownerDocument&&$_(V.ownerDocument.documentElement,V)){if(X!==null&&_m(V)){var et=X.start,st=X.end;if(st===void 0&&(st=et),"selectionStart"in V)V.selectionStart=et,V.selectionEnd=Math.min(st,V.value.length);else{var lt=V.ownerDocument||document,ot=lt&<.defaultView||window;if(ot.getSelection){var it=ot.getSelection(),xt=V.textContent.length,Rt=Math.min(X.start,xt),ne=X.end===void 0?Rt:Math.min(X.end,xt);!it.extend&&Rt>ne&&(T=ne,ne=Rt,Rt=T);var W=U_(V,Rt),Z=U_(V,ne);if(W&&Z&&(it.rangeCount!==1||it.anchorNode!==W.node||it.anchorOffset!==W.offset||it.focusNode!==Z.node||it.focusOffset!==Z.offset)){var J=lt.createRange();J.setStart(W.node,W.offset),it.removeAllRanges(),Rt>ne?(it.addRange(J),it.extend(Z.node,Z.offset)):(J.setEnd(Z.node,Z.offset),it.addRange(J))}}}}for(lt=[],it=V;it=it.parentNode;)it.nodeType===1&<.push({element:it,left:it.scrollLeft,top:it.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}}Mf=!!Wg,Jg=Wg=null}finally{Kt=g,I.p=f,j.T=a}}o.current=r,Re=2}}function rT(){if(Re===2){Re=0;var o=bi,r=Ms,a=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||a){a=j.T,j.T=null;var f=I.p;I.p=2;var g=Kt;Kt|=4;try{D2(o,r.alternate,r)}finally{Kt=g,I.p=f,j.T=a}}Re=3}}function sT(){if(Re===4||Re===3){Re=0,jt();var o=bi,r=Ms,a=Lo,f=q2;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Re=5:(Re=0,Ms=bi=null,aT(o,o.pendingLanes));var g=o.pendingLanes;if(g===0&&(vi=null),Ba(a),r=r.stateNode,he&&typeof he.onCommitFiberRoot=="function")try{he.onCommitFiberRoot(Ae,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,T=0;T<f.length;T++){var V=f[T];v(V.value,{componentStack:V.stack})}}finally{j.T=r,I.p=g}}(Lo&3)!==0&&yf(),so(o),g=o.pendingLanes,(a&261930)!==0&&(g&42)!==0?o===Bg?bl++:(bl=0,Bg=o):bl=0,xl(0)}}function aT(o,r){(o.pooledCacheLanes&=r)===0&&(r=o.pooledCache,r!=null&&(o.pooledCache=null,tl(r)))}function yf(){return iT(),rT(),sT(),lT()}function lT(){if(Re!==5)return!1;var o=bi,r=Lg;Lg=0;var a=Ba(Lo),f=j.T,g=I.p;try{I.p=32>a?32:a,j.T=null,a=Ig,Ig=null;var v=bi,T=Lo;if(Re=0,Ms=bi=null,Lo=0,(Kt&6)!==0)throw Error(i(331));var V=Kt;if(Kt|=4,$2(v.current),P2(v,v.current,T,a),Kt=V,xl(0,!1),he&&typeof he.onPostCommitFiberRoot=="function")try{he.onPostCommitFiberRoot(Ae,v)}catch{}return!0}finally{I.p=g,j.T=f,aT(o,r)}}function cT(o,r,a){r=bn(a,r),r=yg(o.stateNode,r,2),o=di(o,r,2),o!==null&&(Wi(o,2),so(o))}function Jt(o,r,a){if(o.tag===3)cT(o,o,a);else for(;r!==null;){if(r.tag===3){cT(r,o,a);break}else if(r.tag===1){var f=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(vi===null||!vi.has(f))){o=bn(a,o),a=u2(2),f=di(r,a,2),f!==null&&(f2(a,f,r,o),Wi(f,2),so(f));break}}r=r.return}}function Ug(o,r,a){var f=o.pingCache;if(f===null){f=o.pingCache=new U9;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(a)||(jg=!0,g.add(a),o=X9.bind(null,o,r,a),r.then(o,o))}function X9(o,r,a){var f=o.pingCache;f!==null&&f.delete(r),o.pingedLanes|=o.suspendedLanes&a,o.warmLanes&=~a,oe===o&&(Ut&a)===a&&(me===4||me===3&&(Ut&62914560)===Ut&&300>zt()-ff?(Kt&2)===0&&Rs(o,0):zg|=a,As===Ut&&(As=0)),so(o)}function uT(o,r){r===0&&(r=du()),o=rr(o,r),o!==null&&(Wi(o,r),so(o))}function F9(o){var r=o.memoizedState,a=0;r!==null&&(a=r.retryLane),uT(o,a)}function Z9(o,r){var a=0;switch(o.tag){case 31:case 13:var f=o.stateNode,g=o.memoizedState;g!==null&&(a=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),uT(o,a)}function K9(o,r){return mt(o,r)}var vf=null,Os=null,$g=!1,bf=!1,Yg=!1,wi=0;function so(o){o!==Os&&o.next===null&&(Os===null?vf=Os=o:Os=Os.next=o),bf=!0,$g||($g=!0,W9())}function xl(o,r){if(!Yg&&bf){Yg=!0;do for(var a=!1,f=vf;f!==null;){if(o!==0){var g=f.pendingLanes;if(g===0)var v=0;else{var T=f.suspendedLanes,V=f.pingedLanes;v=(1<<31-De(42|o)+1)-1,v&=g&~(T&~V),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(a=!0,pT(f,v))}else v=Ut,v=ts(f,f===oe?v:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(v&3)===0||Qi(f,v)||(a=!0,pT(f,v));f=f.next}while(a);Yg=!1}}function Q9(){fT()}function fT(){bf=$g=!1;var o=0;wi!==0&&l7()&&(o=wi);for(var r=zt(),a=null,f=vf;f!==null;){var g=f.next,v=dT(f,r);v===0?(f.next=null,a===null?vf=g:a.next=g,g===null&&(Os=a)):(a=f,(o!==0||(v&3)!==0)&&(bf=!0)),f=g}Re!==0&&Re!==5||xl(o),wi!==0&&(wi=0)}function dT(o,r){for(var a=o.suspendedLanes,f=o.pingedLanes,g=o.expirationTimes,v=o.pendingLanes&-62914561;0<v;){var T=31-De(v),V=1<<T,X=g[T];X===-1?((V&a)===0||(V&f)!==0)&&(g[T]=im(V,r)):X<=r&&(o.expiredLanes|=V),v&=~V}if(r=oe,a=Ut,a=ts(o,o===r?a:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),f=o.callbackNode,a===0||o===r&&(Wt===2||Wt===9)||o.cancelPendingCommit!==null)return f!==null&&f!==null&&Ct(f),o.callbackNode=null,o.callbackPriority=0;if((a&3)===0||Qi(o,a)){if(r=a&-a,r===o.callbackPriority)return r;switch(f!==null&&Ct(f),Ba(a)){case 2:case 8:a=Oe;break;case 32:a=yn;break;case 268435456:a=In;break;default:a=yn}return f=hT.bind(null,o),a=mt(a,f),o.callbackPriority=r,o.callbackNode=a,r}return f!==null&&f!==null&&Ct(f),o.callbackPriority=2,o.callbackNode=null,2}function hT(o,r){if(Re!==0&&Re!==5)return o.callbackNode=null,o.callbackPriority=0,null;var a=o.callbackNode;if(yf()&&o.callbackNode!==a)return null;var f=Ut;return f=ts(o,o===oe?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),f===0?null:(F2(o,f,r),dT(o,zt()),o.callbackNode!=null&&o.callbackNode===a?hT.bind(null,o):null)}function pT(o,r){if(yf())return null;F2(o,r,!0)}function W9(){u7(function(){(Kt&6)!==0?mt(Qt,Q9):fT()})}function Gg(){if(wi===0){var o=ys;o===0&&(o=Qr,Qr<<=1,(Qr&261888)===0&&(Qr=256)),wi=o}return wi}function mT(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Tu(""+o)}function gT(o,r){var a=r.ownerDocument.createElement("input");return a.name=r.name,a.value=r.value,o.id&&a.setAttribute("form",o.id),r.parentNode.insertBefore(a,r),o=new FormData(o),a.parentNode.removeChild(a),o}function J9(o,r,a,f,g){if(r==="submit"&&a&&a.stateNode===g){var v=mT((g[Ue]||null).action),T=f.submitter;T&&(r=(r=T[Ue]||null)?mT(r.formAction):T.getAttribute("formAction"),r!==null&&(v=r,T=null));var V=new Ru("action","action",null,f,g);o.push({event:V,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(wi!==0){var X=T?gT(g,T):new FormData(g);fg(a,{pending:!0,data:X,method:g.method,action:v},null,X)}}else typeof v=="function"&&(V.preventDefault(),X=T?gT(g,T):new FormData(g),fg(a,{pending:!0,data:X,method:g.method,action:v},v,X))},currentTarget:g}]})}}for(var qg=0;qg<Am.length;qg++){var Xg=Am[qg],t7=Xg.toLowerCase(),e7=Xg[0].toUpperCase()+Xg.slice(1);Pn(t7,"on"+e7)}Pn(X_,"onAnimationEnd"),Pn(F_,"onAnimationIteration"),Pn(Z_,"onAnimationStart"),Pn("dblclick","onDoubleClick"),Pn("focusin","onFocus"),Pn("focusout","onBlur"),Pn(y9,"onTransitionRun"),Pn(v9,"onTransitionStart"),Pn(b9,"onTransitionCancel"),Pn(K_,"onTransitionEnd"),ii("onMouseEnter",["mouseout","mouseover"]),ii("onMouseLeave",["mouseout","mouseover"]),ii("onPointerEnter",["pointerout","pointerover"]),ii("onPointerLeave",["pointerout","pointerover"]),xo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),xo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),xo("onBeforeInput",["compositionend","keypress","textInput","paste"]),xo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),xo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),xo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var wl="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(" "),n7=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(wl));function yT(o,r){r=(r&4)!==0;for(var a=0;a<o.length;a++){var f=o[a],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],X=V.instance,et=V.currentTarget;if(V=V.listener,X!==v&&g.isPropagationStopped())break t;v=V,g.currentTarget=et;try{v(g)}catch(st){Du(st)}g.currentTarget=null,v=X}else for(T=0;T<f.length;T++){if(V=f[T],X=V.instance,et=V.currentTarget,V=V.listener,X!==v&&g.isPropagationStopped())break t;v=V,g.currentTarget=et;try{v(g)}catch(st){Du(st)}g.currentTarget=null,v=X}}}}function Ht(o,r){var a=r[es];a===void 0&&(a=r[es]=new Set);var f=o+"__bubble";a.has(f)||(vT(r,o,2,!1),a.add(f))}function Fg(o,r,a){var f=0;r&&(f|=4),vT(a,o,f,r)}var xf="_reactListening"+Math.random().toString(36).slice(2);function Zg(o){if(!o[xf]){o[xf]=!0,xu.forEach(function(a){a!=="selectionchange"&&(n7.has(a)||Fg(a,!1,o),Fg(a,!0,o))});var r=o.nodeType===9?o:o.ownerDocument;r===null||r[xf]||(r[xf]=!0,Fg("selectionchange",!1,r))}}function vT(o,r,a,f){switch(XT(r)){case 2:var g=R7;break;case 8:g=k7;break;default:g=u0}a=g.bind(null,r,a,o),g=void 0,!mm||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(g=!0),f?g!==void 0?o.addEventListener(r,a,{capture:!0,passive:g}):o.addEventListener(r,a,!0):g!==void 0?o.addEventListener(r,a,{passive:g}):o.addEventListener(r,a,!1)}function Kg(o,r,a,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 X=T.tag;if((X===3||X===4)&&T.stateNode.containerInfo===g)return;T=T.return}for(;V!==null;){if(T=ti(V),T===null)return;if(X=T.tag,X===5||X===6||X===26||X===27){f=v=T;continue t}V=V.parentNode}}f=f.return}E_(function(){var et=v,st=hm(a),lt=[];t:{var ot=Q_.get(o);if(ot!==void 0){var it=Ru,xt=o;switch(o){case"keypress":if(Au(a)===0)break t;case"keydown":case"keyup":it=Z$;break;case"focusin":xt="focus",it=bm;break;case"focusout":xt="blur",it=bm;break;case"beforeblur":case"afterblur":it=bm;break;case"click":if(a.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":it=T_;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":it=L$;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":it=W$;break;case X_:case F_:case Z_:it=P$;break;case K_:it=t9;break;case"scroll":case"scrollend":it=z$;break;case"wheel":it=n9;break;case"copy":case"cut":case"paste":it=U$;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":it=A_;break;case"toggle":case"beforetoggle":it=i9}var Rt=(r&4)!==0,ne=!Rt&&(o==="scroll"||o==="scrollend"),W=Rt?ot!==null?ot+"Capture":null:ot;Rt=[];for(var Z=et,J;Z!==null;){var at=Z;if(J=at.stateNode,at=at.tag,at!==5&&at!==26&&at!==27||J===null||W===null||(at=$a(Z,W),at!=null&&Rt.push(Sl(Z,at,J))),ne)break;Z=Z.return}0<Rt.length&&(ot=new it(ot,xt,null,a,st),lt.push({event:ot,listeners:Rt}))}}if((r&7)===0){t:{if(ot=o==="mouseover"||o==="pointerover",it=o==="mouseout"||o==="pointerout",ot&&a!==dm&&(xt=a.relatedTarget||a.fromElement)&&(ti(xt)||xt[bo]))break t;if((it||ot)&&(ot=st.window===st?st:(ot=st.ownerDocument)?ot.defaultView||ot.parentWindow:window,it?(xt=a.relatedTarget||a.toElement,it=et,xt=xt?ti(xt):null,xt!==null&&(ne=l(xt),Rt=xt.tag,xt!==ne||Rt!==5&&Rt!==27&&Rt!==6)&&(xt=null)):(it=null,xt=et),it!==xt)){if(Rt=T_,at="onMouseLeave",W="onMouseEnter",Z="mouse",(o==="pointerout"||o==="pointerover")&&(Rt=A_,at="onPointerLeave",W="onPointerEnter",Z="pointer"),ne=it==null?ot:ni(it),J=xt==null?ot:ni(xt),ot=new Rt(at,Z+"leave",it,a,st),ot.target=ne,ot.relatedTarget=J,at=null,ti(st)===et&&(Rt=new Rt(W,Z+"enter",xt,a,st),Rt.target=J,Rt.relatedTarget=ne,at=Rt),ne=at,it&&xt)e:{for(Rt=o7,W=it,Z=xt,J=0,at=W;at;at=Rt(at))J++;at=0;for(var Mt=Z;Mt;Mt=Rt(Mt))at++;for(;0<J-at;)W=Rt(W),J--;for(;0<at-J;)Z=Rt(Z),at--;for(;J--;){if(W===Z||Z!==null&&W===Z.alternate){Rt=W;break e}W=Rt(W),Z=Rt(Z)}Rt=null}else Rt=null;it!==null&&bT(lt,ot,it,Rt,!1),xt!==null&&ne!==null&&bT(lt,ne,xt,Rt,!0)}}t:{if(ot=et?ni(et):window,it=ot.nodeName&&ot.nodeName.toLowerCase(),it==="select"||it==="input"&&ot.type==="file")var Ft=V_;else if(j_(ot))if(L_)Ft=p9;else{Ft=d9;var _t=f9}else it=ot.nodeName,!it||it.toLowerCase()!=="input"||ot.type!=="checkbox"&&ot.type!=="radio"?et&&fm(et.elementType)&&(Ft=V_):Ft=h9;if(Ft&&(Ft=Ft(o,et))){z_(lt,Ft,a,st);break t}_t&&_t(o,ot,et),o==="focusout"&&et&&ot.type==="number"&&et.memoizedProps.value!=null&&Ua(ot,"number",ot.value)}switch(_t=et?ni(et):window,o){case"focusin":(j_(_t)||_t.contentEditable==="true")&&(cs=_t,Cm=et,Qa=null);break;case"focusout":Qa=Cm=cs=null;break;case"mousedown":Tm=!0;break;case"contextmenu":case"mouseup":case"dragend":Tm=!1,G_(lt,a,st);break;case"selectionchange":if(g9)break;case"keydown":case"keyup":G_(lt,a,st)}var It;if(wm)t:{switch(o){case"compositionstart":var $t="onCompositionStart";break t;case"compositionend":$t="onCompositionEnd";break t;case"compositionupdate":$t="onCompositionUpdate";break t}$t=void 0}else ls?O_(o,a)&&($t="onCompositionEnd"):o==="keydown"&&a.keyCode===229&&($t="onCompositionStart");$t&&(M_&&a.locale!=="ko"&&(ls||$t!=="onCompositionStart"?$t==="onCompositionEnd"&&ls&&(It=__()):(ri=st,gm="value"in ri?ri.value:ri.textContent,ls=!0)),_t=wf(et,$t),0<_t.length&&($t=new N_($t,o,null,a,st),lt.push({event:$t,listeners:_t}),It?$t.data=It:(It=D_(a),It!==null&&($t.data=It)))),(It=s9?a9(o,a):l9(o,a))&&($t=wf(et,"onBeforeInput"),0<$t.length&&(_t=new N_("onBeforeInput","beforeinput",null,a,st),lt.push({event:_t,listeners:$t}),_t.data=It)),J9(lt,o,et,a,st)}yT(lt,r)})}function Sl(o,r,a){return{instance:o,listener:r,currentTarget:a}}function wf(o,r){for(var a=r+"Capture",f=[];o!==null;){var g=o,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=$a(o,a),g!=null&&f.unshift(Sl(o,g,v)),g=$a(o,r),g!=null&&f.push(Sl(o,g,v))),o.tag===3)return f;o=o.return}return[]}function o7(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function bT(o,r,a,f,g){for(var v=r._reactName,T=[];a!==null&&a!==f;){var V=a,X=V.alternate,et=V.stateNode;if(V=V.tag,X!==null&&X===f)break;V!==5&&V!==26&&V!==27||et===null||(X=et,g?(et=$a(a,v),et!=null&&T.unshift(Sl(a,et,X))):g||(et=$a(a,v),et!=null&&T.push(Sl(a,et,X)))),a=a.return}T.length!==0&&o.push({event:r,listeners:T})}var i7=/\r\n?/g,r7=/\u0000|\uFFFD/g;function xT(o){return(typeof o=="string"?o:""+o).replace(i7,`
|
|
9
|
-
`).replace(r7,"")}function wT(o,r){return r=xT(r),xT(o)===r}function ee(o,r,a,f,g,v){switch(a){case"children":typeof f=="string"?r==="body"||r==="textarea"&&f===""||rs(o,f):(typeof f=="number"||typeof f=="bigint")&&r!=="body"&&rs(o,""+f);break;case"className":os(o,"class",f);break;case"tabIndex":os(o,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":os(o,a,f);break;case"style":w_(o,f,v);break;case"data":if(r!=="object"){os(o,"data",f);break}case"src":case"href":if(f===""&&(r!=="a"||a!=="href")){o.removeAttribute(a);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){o.removeAttribute(a);break}f=Tu(""+f),o.setAttribute(a,f);break;case"action":case"formAction":if(typeof f=="function"){o.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(a==="formAction"?(r!=="input"&&ee(o,r,"name",g.name,g,null),ee(o,r,"formEncType",g.formEncType,g,null),ee(o,r,"formMethod",g.formMethod,g,null),ee(o,r,"formTarget",g.formTarget,g,null)):(ee(o,r,"encType",g.encType,g,null),ee(o,r,"method",g.method,g,null),ee(o,r,"target",g.target,g,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){o.removeAttribute(a);break}f=Tu(""+f),o.setAttribute(a,f);break;case"onClick":f!=null&&(o.onclick=So);break;case"onScroll":f!=null&&Ht("scroll",o);break;case"onScrollEnd":f!=null&&Ht("scrollend",o);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(a=f.__html,a!=null){if(g.children!=null)throw Error(i(60));o.innerHTML=a}}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}a=Tu(""+f),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?o.setAttribute(a,""+f):o.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?o.setAttribute(a,""):o.removeAttribute(a);break;case"capture":case"download":f===!0?o.setAttribute(a,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?o.setAttribute(a,f):o.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?o.setAttribute(a,f):o.removeAttribute(a);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?o.removeAttribute(a):o.setAttribute(a,f);break;case"popover":Ht("beforetoggle",o),Ht("toggle",o),ns(o,"popover",f);break;case"xlinkActuate":Bn(o,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":Bn(o,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":Bn(o,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":Bn(o,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":Bn(o,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":Bn(o,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":Bn(o,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":Bn(o,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":Bn(o,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":ns(o,"is",f);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=D$.get(a)||a,ns(o,a,f))}}function Qg(o,r,a,f,g,v){switch(a){case"style":w_(o,f,v);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(a=f.__html,a!=null){if(g.children!=null)throw Error(i(60));o.innerHTML=a}}break;case"children":typeof f=="string"?rs(o,f):(typeof f=="number"||typeof f=="bigint")&&rs(o,""+f);break;case"onScroll":f!=null&&Ht("scroll",o);break;case"onScrollEnd":f!=null&&Ht("scrollend",o);break;case"onClick":f!=null&&(o.onclick=So);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!wu.hasOwnProperty(a))t:{if(a[0]==="o"&&a[1]==="n"&&(g=a.endsWith("Capture"),r=a.slice(2,g?a.length-7:void 0),v=o[Ue]||null,v=v!=null?v[a]:null,typeof v=="function"&&o.removeEventListener(r,v,g),typeof f=="function")){typeof v!="function"&&v!==null&&(a in o?o[a]=null:o.hasAttribute(a)&&o.removeAttribute(a)),o.addEventListener(r,f,g);break t}a in o?o[a]=f:f===!0?o.setAttribute(a,""):ns(o,a,f)}}}function Be(o,r,a){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ht("error",o),Ht("load",o);var f=!1,g=!1,v;for(v in a)if(a.hasOwnProperty(v)){var T=a[v];if(T!=null)switch(v){case"src":f=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:ee(o,r,v,T,a,null)}}g&&ee(o,r,"srcSet",a.srcSet,a,null),f&&ee(o,r,"src",a.src,a,null);return;case"input":Ht("invalid",o);var V=v=T=g=null,X=null,et=null;for(f in a)if(a.hasOwnProperty(f)){var st=a[f];if(st!=null)switch(f){case"name":g=st;break;case"type":T=st;break;case"checked":X=st;break;case"defaultChecked":et=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:ee(o,r,f,st,a,null)}}Cu(o,v,V,X,et,T,g,!1);return;case"select":Ht("invalid",o),f=T=v=null;for(g in a)if(a.hasOwnProperty(g)&&(V=a[g],V!=null))switch(g){case"value":v=V;break;case"defaultValue":T=V;break;case"multiple":f=V;default:ee(o,r,g,V,a,null)}r=v,a=T,o.multiple=!!f,r!=null?wo(o,!!f,r,!1):a!=null&&wo(o,!!f,a,!0);return;case"textarea":Ht("invalid",o),v=g=f=null;for(T in a)if(a.hasOwnProperty(T)&&(V=a[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(i(91));break;default:ee(o,r,T,V,a,null)}b_(o,f,g,v);return;case"option":for(X in a)a.hasOwnProperty(X)&&(f=a[X],f!=null)&&(X==="selected"?o.selected=f&&typeof f!="function"&&typeof f!="symbol":ee(o,r,X,f,a,null));return;case"dialog":Ht("beforetoggle",o),Ht("toggle",o),Ht("cancel",o),Ht("close",o);break;case"iframe":case"object":Ht("load",o);break;case"video":case"audio":for(f=0;f<wl.length;f++)Ht(wl[f],o);break;case"image":Ht("error",o),Ht("load",o);break;case"details":Ht("toggle",o);break;case"embed":case"source":case"link":Ht("error",o),Ht("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(et in a)if(a.hasOwnProperty(et)&&(f=a[et],f!=null))switch(et){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:ee(o,r,et,f,a,null)}return;default:if(fm(r)){for(st in a)a.hasOwnProperty(st)&&(f=a[st],f!==void 0&&Qg(o,r,st,f,a,void 0));return}}for(V in a)a.hasOwnProperty(V)&&(f=a[V],f!=null&&ee(o,r,V,f,a,null))}function s7(o,r,a,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,X=null,et=null,st=null;for(it in a){var lt=a[it];if(a.hasOwnProperty(it)&<!=null)switch(it){case"checked":break;case"value":break;case"defaultValue":X=lt;default:f.hasOwnProperty(it)||ee(o,r,it,null,f,lt)}}for(var ot in f){var it=f[ot];if(lt=a[ot],f.hasOwnProperty(ot)&&(it!=null||lt!=null))switch(ot){case"type":v=it;break;case"name":g=it;break;case"checked":et=it;break;case"defaultChecked":st=it;break;case"value":T=it;break;case"defaultValue":V=it;break;case"children":case"dangerouslySetInnerHTML":if(it!=null)throw Error(i(137,r));break;default:it!==lt&&ee(o,r,ot,it,f,lt)}}er(o,T,V,X,et,st,v,g);return;case"select":it=T=V=ot=null;for(v in a)if(X=a[v],a.hasOwnProperty(v)&&X!=null)switch(v){case"value":break;case"multiple":it=X;default:f.hasOwnProperty(v)||ee(o,r,v,null,f,X)}for(g in f)if(v=f[g],X=a[g],f.hasOwnProperty(g)&&(v!=null||X!=null))switch(g){case"value":ot=v;break;case"defaultValue":V=v;break;case"multiple":T=v;default:v!==X&&ee(o,r,g,v,f,X)}r=V,a=T,f=it,ot!=null?wo(o,!!a,ot,!1):!!f!=!!a&&(r!=null?wo(o,!!a,r,!0):wo(o,!!a,a?[]:"",!1));return;case"textarea":it=ot=null;for(V in a)if(g=a[V],a.hasOwnProperty(V)&&g!=null&&!f.hasOwnProperty(V))switch(V){case"value":break;case"children":break;default:ee(o,r,V,null,f,g)}for(T in f)if(g=f[T],v=a[T],f.hasOwnProperty(T)&&(g!=null||v!=null))switch(T){case"value":ot=g;break;case"defaultValue":it=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(i(91));break;default:g!==v&&ee(o,r,T,g,f,v)}v_(o,ot,it);return;case"option":for(var xt in a)ot=a[xt],a.hasOwnProperty(xt)&&ot!=null&&!f.hasOwnProperty(xt)&&(xt==="selected"?o.selected=!1:ee(o,r,xt,null,f,ot));for(X in f)ot=f[X],it=a[X],f.hasOwnProperty(X)&&ot!==it&&(ot!=null||it!=null)&&(X==="selected"?o.selected=ot&&typeof ot!="function"&&typeof ot!="symbol":ee(o,r,X,ot,f,it));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 Rt in a)ot=a[Rt],a.hasOwnProperty(Rt)&&ot!=null&&!f.hasOwnProperty(Rt)&&ee(o,r,Rt,null,f,ot);for(et in f)if(ot=f[et],it=a[et],f.hasOwnProperty(et)&&ot!==it&&(ot!=null||it!=null))switch(et){case"children":case"dangerouslySetInnerHTML":if(ot!=null)throw Error(i(137,r));break;default:ee(o,r,et,ot,f,it)}return;default:if(fm(r)){for(var ne in a)ot=a[ne],a.hasOwnProperty(ne)&&ot!==void 0&&!f.hasOwnProperty(ne)&&Qg(o,r,ne,void 0,f,ot);for(st in f)ot=f[st],it=a[st],!f.hasOwnProperty(st)||ot===it||ot===void 0&&it===void 0||Qg(o,r,st,ot,f,it);return}}for(var W in a)ot=a[W],a.hasOwnProperty(W)&&ot!=null&&!f.hasOwnProperty(W)&&ee(o,r,W,null,f,ot);for(lt in f)ot=f[lt],it=a[lt],!f.hasOwnProperty(lt)||ot===it||ot==null&&it==null||ee(o,r,lt,ot,f,it)}function ST(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function a7(){if(typeof performance.getEntriesByType=="function"){for(var o=0,r=0,a=performance.getEntriesByType("resource"),f=0;f<a.length;f++){var g=a[f],v=g.transferSize,T=g.initiatorType,V=g.duration;if(v&&V&&ST(T)){for(T=0,V=g.responseEnd,f+=1;f<a.length;f++){var X=a[f],et=X.startTime;if(et>V)break;var st=X.transferSize,lt=X.initiatorType;st&&ST(lt)&&(X=X.responseEnd,T+=st*(X<V?1:(V-et)/(X-et)))}if(--f,r+=8*(v+T)/(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 Wg=null,Jg=null;function Sf(o){return o.nodeType===9?o:o.ownerDocument}function ET(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 _T(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 t0(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 e0=null;function l7(){var o=window.event;return o&&o.type==="popstate"?o===e0?!1:(e0=o,!0):(e0=null,!1)}var CT=typeof setTimeout=="function"?setTimeout:void 0,c7=typeof clearTimeout=="function"?clearTimeout:void 0,TT=typeof Promise=="function"?Promise:void 0,u7=typeof queueMicrotask=="function"?queueMicrotask:typeof TT<"u"?function(o){return TT.resolve(null).then(o).catch(f7)}:CT;function f7(o){setTimeout(function(){throw o})}function Si(o){return o==="head"}function NT(o,r){var a=r,f=0;do{var g=a.nextSibling;if(o.removeChild(a),g&&g.nodeType===8)if(a=g.data,a==="/$"||a==="/&"){if(f===0){o.removeChild(g),Vs(r);return}f--}else if(a==="$"||a==="$?"||a==="$~"||a==="$!"||a==="&")f++;else if(a==="html")El(o.ownerDocument.documentElement);else if(a==="head"){a=o.ownerDocument.head,El(a);for(var v=a.firstChild;v;){var T=v.nextSibling,V=v.nodeName;v[Ji]||V==="SCRIPT"||V==="STYLE"||V==="LINK"&&v.rel.toLowerCase()==="stylesheet"||a.removeChild(v),v=T}}else a==="body"&&El(o.ownerDocument.body);a=g}while(a);Vs(r)}function AT(o,r){var a=o;o=0;do{var f=a.nextSibling;if(a.nodeType===1?r?(a._stashedDisplay=a.style.display,a.style.display="none"):(a.style.display=a._stashedDisplay||"",a.getAttribute("style")===""&&a.removeAttribute("style")):a.nodeType===3&&(r?(a._stashedText=a.nodeValue,a.nodeValue=""):a.nodeValue=a._stashedText||""),f&&f.nodeType===8)if(a=f.data,a==="/$"){if(o===0)break;o--}else a!=="$"&&a!=="$?"&&a!=="$~"&&a!=="$!"||o++;a=f}while(a)}function n0(o){var r=o.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var a=r;switch(r=r.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":n0(a),Pa(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}o.removeChild(a)}}function d7(o,r,a,f){for(;o.nodeType===1;){var g=a;if(o.nodeName.toLowerCase()!==r.toLowerCase()){if(!f&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(f){if(!o[Ji])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=_n(o.nextSibling),o===null)break}return null}function h7(o,r,a){if(r==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!a||(o=_n(o.nextSibling),o===null))return null;return o}function MT(o,r){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!r||(o=_n(o.nextSibling),o===null))return null;return o}function o0(o){return o.data==="$?"||o.data==="$~"}function i0(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function p7(o,r){var a=o.ownerDocument;if(o.data==="$~")o._reactRetry=r;else if(o.data!=="$?"||a.readyState!=="loading")r();else{var f=function(){r(),a.removeEventListener("DOMContentLoaded",f)};a.addEventListener("DOMContentLoaded",f),o._reactRetry=f}}function _n(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 r0=null;function RT(o){o=o.nextSibling;for(var r=0;o;){if(o.nodeType===8){var a=o.data;if(a==="/$"||a==="/&"){if(r===0)return _n(o.nextSibling);r--}else a!=="$"&&a!=="$!"&&a!=="$?"&&a!=="$~"&&a!=="&"||r++}o=o.nextSibling}return null}function kT(o){o=o.previousSibling;for(var r=0;o;){if(o.nodeType===8){var a=o.data;if(a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"){if(r===0)return o;r--}else a!=="/$"&&a!=="/&"||r++}o=o.previousSibling}return null}function OT(o,r,a){switch(r=Sf(a),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 El(o){for(var r=o.attributes;r.length;)o.removeAttributeNode(r[0]);Pa(o)}var Cn=new Map,DT=new Set;function Ef(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var Io=I.d;I.d={f:m7,r:g7,D:y7,C:v7,L:b7,m:x7,X:S7,S:w7,M:E7};function m7(){var o=Io.f(),r=pf();return o||r}function g7(o){var r=ei(o);r!==null&&r.tag===5&&r.type==="form"?KC(r):Io.r(o)}var Ds=typeof document>"u"?null:document;function jT(o,r,a){var f=Ds;if(f&&typeof r=="string"&&r){var g=Ze(r);g='link[rel="'+o+'"][href="'+g+'"]',typeof a=="string"&&(g+='[crossorigin="'+a+'"]'),DT.has(g)||(DT.add(g),o={rel:o,crossOrigin:a,href:r},f.querySelector(g)===null&&(r=f.createElement("link"),Be(r,"link",o),we(r),f.head.appendChild(r)))}}function y7(o){Io.D(o),jT("dns-prefetch",o,null)}function v7(o,r){Io.C(o,r),jT("preconnect",o,r)}function b7(o,r,a){Io.L(o,r,a);var f=Ds;if(f&&o&&r){var g='link[rel="preload"][as="'+Ze(r)+'"]';r==="image"&&a&&a.imageSrcSet?(g+='[imagesrcset="'+Ze(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(g+='[imagesizes="'+Ze(a.imageSizes)+'"]')):g+='[href="'+Ze(o)+'"]';var v=g;switch(r){case"style":v=js(o);break;case"script":v=zs(o)}Cn.has(v)||(o=m({rel:"preload",href:r==="image"&&a&&a.imageSrcSet?void 0:o,as:r},a),Cn.set(v,o),f.querySelector(g)!==null||r==="style"&&f.querySelector(_l(v))||r==="script"&&f.querySelector(Cl(v))||(r=f.createElement("link"),Be(r,"link",o),we(r),f.head.appendChild(r)))}}function x7(o,r){Io.m(o,r);var a=Ds;if(a&&o){var f=r&&typeof r.as=="string"?r.as:"script",g='link[rel="modulepreload"][as="'+Ze(f)+'"][href="'+Ze(o)+'"]',v=g;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=zs(o)}if(!Cn.has(v)&&(o=m({rel:"modulepreload",href:o},r),Cn.set(v,o),a.querySelector(g)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(Cl(v)))return}f=a.createElement("link"),Be(f,"link",o),we(f),a.head.appendChild(f)}}}function w7(o,r,a){Io.S(o,r,a);var f=Ds;if(f&&o){var g=oi(f).hoistableStyles,v=js(o);r=r||"default";var T=g.get(v);if(!T){var V={loading:0,preload:null};if(T=f.querySelector(_l(v)))V.loading=5;else{o=m({rel:"stylesheet",href:o,"data-precedence":r},a),(a=Cn.get(v))&&s0(o,a);var X=T=f.createElement("link");we(X),Be(X,"link",o),X._p=new Promise(function(et,st){X.onload=et,X.onerror=st}),X.addEventListener("load",function(){V.loading|=1}),X.addEventListener("error",function(){V.loading|=2}),V.loading|=4,_f(T,r,f)}T={type:"stylesheet",instance:T,count:1,state:V},g.set(v,T)}}}function S7(o,r){Io.X(o,r);var a=Ds;if(a&&o){var f=oi(a).hoistableScripts,g=zs(o),v=f.get(g);v||(v=a.querySelector(Cl(g)),v||(o=m({src:o,async:!0},r),(r=Cn.get(g))&&a0(o,r),v=a.createElement("script"),we(v),Be(v,"link",o),a.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(g,v))}}function E7(o,r){Io.M(o,r);var a=Ds;if(a&&o){var f=oi(a).hoistableScripts,g=zs(o),v=f.get(g);v||(v=a.querySelector(Cl(g)),v||(o=m({src:o,async:!0,type:"module"},r),(r=Cn.get(g))&&a0(o,r),v=a.createElement("script"),we(v),Be(v,"link",o),a.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(g,v))}}function zT(o,r,a,f){var g=(g=ht.current)?Ef(g):null;if(!g)throw Error(i(446));switch(o){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(r=js(a.href),a=oi(g).hoistableStyles,f=a.get(r),f||(f={type:"style",instance:null,count:0,state:null},a.set(r,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){o=js(a.href);var v=oi(g).hoistableStyles,T=v.get(o);if(T||(g=g.ownerDocument||g,T={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(o,T),(v=g.querySelector(_l(o)))&&!v._p&&(T.instance=v,T.state.loading=5),Cn.has(o)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},Cn.set(o,a),v||_7(g,o,a,T.state))),r&&f===null)throw Error(i(528,""));return T}if(r&&f!==null)throw Error(i(529,""));return null;case"script":return r=a.async,a=a.src,typeof a=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=zs(a),a=oi(g).hoistableScripts,f=a.get(r),f||(f={type:"script",instance:null,count:0,state:null},a.set(r,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,o))}}function js(o){return'href="'+Ze(o)+'"'}function _l(o){return'link[rel="stylesheet"]['+o+"]"}function VT(o){return m({},o,{"data-precedence":o.precedence,precedence:null})}function _7(o,r,a,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}),Be(r,"link",a),we(r),o.head.appendChild(r))}function zs(o){return'[src="'+Ze(o)+'"]'}function Cl(o){return"script[async]"+o}function LT(o,r,a){if(r.count++,r.instance===null)switch(r.type){case"style":var f=o.querySelector('style[data-href~="'+Ze(a.href)+'"]');if(f)return r.instance=f,we(f),f;var g=m({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return f=(o.ownerDocument||o).createElement("style"),we(f),Be(f,"style",g),_f(f,a.precedence,o),r.instance=f;case"stylesheet":g=js(a.href);var v=o.querySelector(_l(g));if(v)return r.state.loading|=4,r.instance=v,we(v),v;f=VT(a),(g=Cn.get(g))&&s0(f,g),v=(o.ownerDocument||o).createElement("link"),we(v);var T=v;return T._p=new Promise(function(V,X){T.onload=V,T.onerror=X}),Be(v,"link",f),r.state.loading|=4,_f(v,a.precedence,o),r.instance=v;case"script":return v=zs(a.src),(g=o.querySelector(Cl(v)))?(r.instance=g,we(g),g):(f=a,(g=Cn.get(v))&&(f=m({},a),a0(f,g)),o=o.ownerDocument||o,g=o.createElement("script"),we(g),Be(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,_f(f,a.precedence,o));return r.instance}function _f(o,r,a){for(var f=a.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(o,v.nextSibling):(r=a.nodeType===9?a.head:a,r.insertBefore(o,r.firstChild))}function s0(o,r){o.crossOrigin==null&&(o.crossOrigin=r.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=r.referrerPolicy),o.title==null&&(o.title=r.title)}function a0(o,r){o.crossOrigin==null&&(o.crossOrigin=r.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=r.referrerPolicy),o.integrity==null&&(o.integrity=r.integrity)}var Cf=null;function IT(o,r,a){if(Cf===null){var f=new Map,g=Cf=new Map;g.set(a,f)}else g=Cf,f=g.get(a),f||(f=new Map,g.set(a,f));if(f.has(o))return f;for(f.set(o,null),a=a.getElementsByTagName(o),g=0;g<a.length;g++){var v=a[g];if(!(v[Ji]||v[Me]||o==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var T=v.getAttribute(r)||"";T=o+T;var V=f.get(T);V?V.push(v):f.set(T,[v])}}return f}function BT(o,r,a){o=o.ownerDocument||o,o.head.insertBefore(a,r==="title"?o.querySelector("head > title"):null)}function C7(o,r,a){if(a===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 PT(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function T7(o,r,a,f){if(a.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(a.state.loading&4)===0){if(a.instance===null){var g=js(f.href),v=r.querySelector(_l(g));if(v){r=v._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(o.count++,o=Tf.bind(o),r.then(o,o)),a.state.loading|=4,a.instance=v,we(v);return}v=r.ownerDocument||r,f=VT(f),(g=Cn.get(g))&&s0(f,g),v=v.createElement("link"),we(v);var T=v;T._p=new Promise(function(V,X){T.onload=V,T.onerror=X}),Be(v,"link",f),a.instance=v}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(a,r),(r=a.state.preload)&&(a.state.loading&3)===0&&(o.count++,a=Tf.bind(o),r.addEventListener("load",a),r.addEventListener("error",a))}}var l0=0;function N7(o,r){return o.stylesheets&&o.count===0&&Af(o,o.stylesheets),0<o.count||0<o.imgCount?function(a){var f=setTimeout(function(){if(o.stylesheets&&Af(o,o.stylesheets),o.unsuspend){var v=o.unsuspend;o.unsuspend=null,v()}},6e4+r);0<o.imgBytes&&l0===0&&(l0=62500*a7());var g=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Af(o,o.stylesheets),o.unsuspend)){var v=o.unsuspend;o.unsuspend=null,v()}},(o.imgBytes>l0?50:800)+r);return o.unsuspend=a,function(){o.unsuspend=null,clearTimeout(f),clearTimeout(g)}}:null}function Tf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Af(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Nf=null;function Af(o,r){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Nf=new Map,r.forEach(A7,o),Nf=null,Tf.call(o))}function A7(o,r){if(!(r.state.loading&4)){var a=Nf.get(o);if(a)var f=a.get(null);else{a=new Map,Nf.set(o,a);for(var g=o.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")&&(a.set(T.dataset.precedence,T),f=T)}f&&a.set(null,f)}g=r.instance,T=g.getAttribute("data-precedence"),v=a.get(T)||f,v===f&&a.set(null,g),a.set(T,g),this.count++,f=Tf.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 Tl={$$typeof:C,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function M7(o,r,a,f,g,v,T,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=La(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=La(0),this.hiddenUpdates=La(null),this.identifierPrefix=f,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=T,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=X,this.incompleteTransitions=new Map}function HT(o,r,a,f,g,v,T,V,X,et,st,lt){return o=new M7(o,r,a,T,X,et,st,lt,V),r=1,v===!0&&(r|=24),v=ln(3,null,null,r),o.current=v,v.stateNode=o,r=Hm(),r.refCount++,o.pooledCache=r,r.refCount++,v.memoizedState={element:f,isDehydrated:a,cache:r},Gm(v),o}function UT(o){return o?(o=ds,o):ds}function $T(o,r,a,f,g,v){g=UT(g),f.context===null?f.context=g:f.pendingContext=g,f=fi(r),f.payload={element:a},v=v===void 0?null:v,v!==null&&(f.callback=v),a=di(o,f,r),a!==null&&(en(a,o,r),il(a,o,r))}function YT(o,r){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var a=o.retryLane;o.retryLane=a!==0&&a<r?a:r}}function c0(o,r){YT(o,r),(o=o.alternate)&&YT(o,r)}function GT(o){if(o.tag===13||o.tag===31){var r=rr(o,67108864);r!==null&&en(r,o,67108864),c0(o,67108864)}}function qT(o){if(o.tag===13||o.tag===31){var r=hn();r=Ia(r);var a=rr(o,r);a!==null&&en(a,o,r),c0(o,r)}}var Mf=!0;function R7(o,r,a,f){var g=j.T;j.T=null;var v=I.p;try{I.p=2,u0(o,r,a,f)}finally{I.p=v,j.T=g}}function k7(o,r,a,f){var g=j.T;j.T=null;var v=I.p;try{I.p=8,u0(o,r,a,f)}finally{I.p=v,j.T=g}}function u0(o,r,a,f){if(Mf){var g=f0(f);if(g===null)Kg(o,r,f,Rf,a),FT(o,f);else if(D7(g,o,r,a,f))f.stopPropagation();else if(FT(o,f),r&4&&-1<O7.indexOf(o)){for(;g!==null;){var v=ei(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var T=vo(v.pendingLanes);if(T!==0){var V=v;for(V.pendingLanes|=2,V.entangledLanes|=2;T;){var X=1<<31-De(T);V.entanglements[1]|=X,T&=~X}so(v),(Kt&6)===0&&(df=zt()+500,xl(0))}}break;case 31:case 13:V=rr(v,2),V!==null&&en(V,v,2),pf(),c0(v,2)}if(v=f0(f),v===null&&Kg(o,r,f,Rf,a),v===g)break;g=v}g!==null&&f.stopPropagation()}else Kg(o,r,f,null,a)}}function f0(o){return o=hm(o),d0(o)}var Rf=null;function d0(o){if(Rf=null,o=ti(o),o!==null){var r=l(o);if(r===null)o=null;else{var a=r.tag;if(a===13){if(o=c(r),o!==null)return o;o=null}else if(a===31){if(o=u(r),o!==null)return o;o=null}else if(a===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;o=null}else r!==o&&(o=null)}}return Rf=o,null}function XT(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(ge()){case Qt:return 2;case Oe:return 8;case yn:case za:return 32;case In:return 268435456;default:return 32}default:return 32}}var h0=!1,Ei=null,_i=null,Ci=null,Nl=new Map,Al=new Map,Ti=[],O7="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 FT(o,r){switch(o){case"focusin":case"focusout":Ei=null;break;case"dragenter":case"dragleave":_i=null;break;case"mouseover":case"mouseout":Ci=null;break;case"pointerover":case"pointerout":Nl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Al.delete(r.pointerId)}}function Ml(o,r,a,f,g,v){return o===null||o.nativeEvent!==v?(o={blockedOn:r,domEventName:a,eventSystemFlags:f,nativeEvent:v,targetContainers:[g]},r!==null&&(r=ei(r),r!==null&>(r)),o):(o.eventSystemFlags|=f,r=o.targetContainers,g!==null&&r.indexOf(g)===-1&&r.push(g),o)}function D7(o,r,a,f,g){switch(r){case"focusin":return Ei=Ml(Ei,o,r,a,f,g),!0;case"dragenter":return _i=Ml(_i,o,r,a,f,g),!0;case"mouseover":return Ci=Ml(Ci,o,r,a,f,g),!0;case"pointerover":var v=g.pointerId;return Nl.set(v,Ml(Nl.get(v)||null,o,r,a,f,g)),!0;case"gotpointercapture":return v=g.pointerId,Al.set(v,Ml(Al.get(v)||null,o,r,a,f,g)),!0}return!1}function ZT(o){var r=ti(o.target);if(r!==null){var a=l(r);if(a!==null){if(r=a.tag,r===13){if(r=c(a),r!==null){o.blockedOn=r,yu(o.priority,function(){qT(a)});return}}else if(r===31){if(r=u(a),r!==null){o.blockedOn=r,yu(o.priority,function(){qT(a)});return}}else if(r===3&&a.stateNode.current.memoizedState.isDehydrated){o.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}o.blockedOn=null}function kf(o){if(o.blockedOn!==null)return!1;for(var r=o.targetContainers;0<r.length;){var a=f0(o.nativeEvent);if(a===null){a=o.nativeEvent;var f=new a.constructor(a.type,a);dm=f,a.target.dispatchEvent(f),dm=null}else return r=ei(a),r!==null&>(r),o.blockedOn=a,!1;r.shift()}return!0}function KT(o,r,a){kf(o)&&a.delete(r)}function j7(){h0=!1,Ei!==null&&kf(Ei)&&(Ei=null),_i!==null&&kf(_i)&&(_i=null),Ci!==null&&kf(Ci)&&(Ci=null),Nl.forEach(KT),Al.forEach(KT)}function Of(o,r){o.blockedOn===r&&(o.blockedOn=null,h0||(h0=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,j7)))}var Df=null;function QT(o){Df!==o&&(Df=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Df===o&&(Df=null);for(var r=0;r<o.length;r+=3){var a=o[r],f=o[r+1],g=o[r+2];if(typeof f!="function"){if(d0(f||a)===null)continue;break}var v=ei(a);v!==null&&(o.splice(r,3),r-=3,fg(v,{pending:!0,data:g,method:a.method,action:f},f,g))}}))}function Vs(o){function r(X){return Of(X,o)}Ei!==null&&Of(Ei,o),_i!==null&&Of(_i,o),Ci!==null&&Of(Ci,o),Nl.forEach(r),Al.forEach(r);for(var a=0;a<Ti.length;a++){var f=Ti[a];f.blockedOn===o&&(f.blockedOn=null)}for(;0<Ti.length&&(a=Ti[0],a.blockedOn===null);)ZT(a),a.blockedOn===null&&Ti.shift();if(a=(o.ownerDocument||o).$$reactFormReplay,a!=null)for(f=0;f<a.length;f+=3){var g=a[f],v=a[f+1],T=g[Ue]||null;if(typeof v=="function")T||QT(a);else if(T){var V=null;if(v&&v.hasAttribute("formAction")){if(g=v,T=v[Ue]||null)V=T.formAction;else if(d0(g)!==null)continue}else V=T.action;typeof V=="function"?a[f+1]=V:(a.splice(f,3),f-=3),QT(a)}}}function WT(){function o(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(a,20)}function a(){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(a,100),function(){f=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),g!==null&&(g(),g=null)}}}function p0(o){this._internalRoot=o}jf.prototype.render=p0.prototype.render=function(o){var r=this._internalRoot;if(r===null)throw Error(i(409));var a=r.current,f=hn();$T(a,f,o,r,null,null)},jf.prototype.unmount=p0.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var r=o.containerInfo;$T(o.current,2,null,o,null,null),pf(),r[bo]=null}};function jf(o){this._internalRoot=o}jf.prototype.unstable_scheduleHydration=function(o){if(o){var r=gu();o={blockedOn:null,target:o,priority:r};for(var a=0;a<Ti.length&&r!==0&&r<Ti[a].priority;a++);Ti.splice(a,0,o),a===0&&ZT(o)}};var JT=e.version;if(JT!=="19.2.0")throw Error(i(527,JT,"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 z7={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:j,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var zf=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!zf.isDisabled&&zf.supportsFiber)try{Ae=zf.inject(z7),he=zf}catch{}}return Is.createRoot=function(o,r){if(!s(o))throw Error(i(299));var a=!1,f="",g=s2,v=a2,T=l2;return r!=null&&(r.unstable_strictMode===!0&&(a=!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=HT(o,1,!1,null,null,a,f,null,g,v,T,WT),o[bo]=r.current,Zg(o),new p0(r)},Is.hydrateRoot=function(o,r,a){if(!s(o))throw Error(i(299));var f=!1,g="",v=s2,T=a2,V=l2,X=null;return a!=null&&(a.unstable_strictMode===!0&&(f=!0),a.identifierPrefix!==void 0&&(g=a.identifierPrefix),a.onUncaughtError!==void 0&&(v=a.onUncaughtError),a.onCaughtError!==void 0&&(T=a.onCaughtError),a.onRecoverableError!==void 0&&(V=a.onRecoverableError),a.formState!==void 0&&(X=a.formState)),r=HT(o,1,!0,r,a??null,f,g,X,v,T,V,WT),r.context=UT(null),a=r.current,f=hn(),f=Ia(f),g=fi(f),g.callback=null,di(a,g,f),a=f,r.current.lanes=a,Wi(r,a),so(r),o[bo]=r.current,Zg(o),new jf(r)},Is.version="19.2.0",Is}var _0;function sN(){if(_0)return Pf.exports;_0=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(),Pf.exports=rN(),Pf.exports}var aN=sN();const lN={stringify:t=>t?"true":"false",parse:t=>/^[ty1-9]/i.test(t)},cN={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}},uN={stringify:t=>JSON.stringify(t),parse:t=>JSON.parse(t)};function fN(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 C0=Symbol.for("r2wc.bound"),hN={parse:(t,e,n)=>{const i=dN(e),s=n;if(typeof s<"u"&&i in s&&typeof s[i]<"u"){let l=s[i];return C0 in s[i]||(l=l.bind(s),Object.defineProperty(l,C0,{value:!0})),l}else return}},pN={stringify:t=>`${t}`,parse:t=>parseFloat(t)},mN={stringify:t=>t,parse:t=>t},Yf={string:mN,number:pN,boolean:lN,function:cN,method:hN,json:uN},Rl=Symbol.for("r2wc.render"),kl=Symbol.for("r2wc.connected"),Mi=Symbol.for("r2wc.context"),$n=Symbol.for("r2wc.props");function gN(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),l={},c={},u={},d={};for(const p of i){l[p]=Array.isArray(e.props)?"string":e.props[p];const m=fN(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)}[kl]=!0;[Mi];[$n]={};container;constructor(){super(),e.shadow?this.container=this.attachShadow({mode:e.shadow}):this.container=this,this[$n].container=this.container;for(const m of i){const y=u[m],b=this.getAttribute(y),x=l[m],w=x?Yf[x]:null;w?.parse&&(b||x==="method")&&(this[$n][m]=w.parse(b,y,this))}for(const m of s)this[$n][m]=y=>{const b=m.replace(/^on/,"").toLowerCase();this.dispatchEvent(new CustomEvent(b,{detail:y,...c[m]}))}}connectedCallback(){this[kl]=!0,this[Rl]()}disconnectedCallback(){this[kl]=!1,this[Mi]&&n.unmount(this[Mi]),delete this[Mi]}attributeChangedCallback(m,y,b){const x=d[m],w=l[x],S=w?Yf[w]:null;x in l&&S?.parse&&(b||w==="method")&&(this[$n][x]=S.parse(b,m,this),this[Rl]())}[Rl](){this[kl]&&(this[Mi]?n.update(this[Mi],this[$n]):this[Mi]=n.mount(this.container,t,this[$n]))}}for(const p of i){const m=u[p],y=l[p];Object.defineProperty(h.prototype,p,{enumerable:!0,configurable:!0,get(){return this[$n][p]},set(b){this[$n][p]=b;const x=y?Yf[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 l&&x?.parse&&(b||y==="method")&&(this[$n][p]=x.parse(b,m,this)),this[Rl]()}})}return h}function yN(t,e,n){const i=aN.createRoot(t),s=Ai.createElement(e,n);return i.render(s),{root:i,ReactComponent:e}}function vN({root:t,ReactComponent:e},n){const i=Ai.createElement(e,n);t.render(i)}function bN({root:t}){t.unmount()}function xN(t,e={}){return gN(t,e,{mount:yN,update:vN,unmount:bN})}var Gf={exports:{}},Bs={};var T0;function wN(){if(T0)return Bs;T0=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(i,s,l){var c=null;if(l!==void 0&&(c=""+l),s.key!==void 0&&(c=""+s.key),"key"in s){l={};for(var u in s)u!=="key"&&(l[u]=s[u])}else l=s;return s=l.ref,{$$typeof:t,type:i,key:c,ref:s!==void 0?s:null,props:l}}return Bs.Fragment=e,Bs.jsx=n,Bs.jsxs=n,Bs}var N0;function SN(){return N0||(N0=1,Gf.exports=wN()),Gf.exports}var M=SN();const EN={PROD:!0},A0=typeof{url:Lf&&Lf.tagName.toUpperCase()==="SCRIPT"&&Lf.src||new URL("circuit-embed.js",document.baseURI).href}<"u"?EN:void 0,qf=A0?.VITE_SANDBOX_ORIGIN||(A0?.PROD?"https://sandbox.simten.dev":"http://localhost:3002");function M0(t,e,n,i){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=i,e.appendChild(s),t.iframe=s,t.ready=!1,window.addEventListener("message",n),s}function _N(t){return`sb-${++t.idCounter}`}function CN(){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 _=t.current,R=e.current;if(R){for(const[,A]of _.pending)A({type:"error",error:"Sandbox restarted (crash)"});_.pending.clear(),_.readyQueue=[],window.removeEventListener("message",n.current),M0(_,R,n.current,l.current)}},[]),s=N.useCallback(_=>{if(_.origin!==qf)return;const R=t.current,A=_.data;if(A.type==="ready"){R.ready=!0;for(const D of R.readyQueue)D();R.readyQueue=[];return}if(!A.id)return;const k=R.pending.get(A.id);k&&(R.pending.delete(A.id),k(A))},[]);n.current=s;const l=N.useRef(i);l.current=i,N.useEffect(()=>{const _=document.createElement("div");_.style.cssText="position:absolute;left:-9999px;top:-9999px;",document.body.appendChild(_),e.current=_;const R=t.current;return M0(R,_,s,i),()=>{window.removeEventListener("message",s),_.remove(),e.current=null}},[s]);const c=N.useCallback(_=>new Promise(R=>{const A=t.current,k=_N(A),D={..._,id:k};A.pending.set(k,R);const H=()=>{const Y=A.iframe;if(!Y?.contentWindow){A.pending.delete(k),R({type:"error",error:"Sandbox iframe not available"});return}Y.contentWindow.postMessage(D,qf)};A.ready?H():A.readyQueue.push(H)}),[]),u=N.useCallback(async(_,R="default")=>{const A=await c({type:"compile",source:_,slot:R});if("error"in A)return A;const k=A;return{circuits:k.circuits,libraryCircuits:k.libraryCircuits,portValues:k.portValues,peripheralState:k.peripheralState}},[c]),d=N.useCallback(async(_,R,A,k)=>{const D=await c({type:"compile-ir",circuit:_,libraryCircuits:R,slot:A,evalSources:k?.evalSources,snapshot:k?.snapshot});if("error"in D)return D;const H=D;return{portValues:H.portValues,peripheralState:H.peripheralState,snapshotId:H.snapshotId}},[c]),h=N.useCallback(async(_,R="default",A)=>{const k=await c({type:"tick",inputs:_,slot:R,snapshot:A?.snapshot});if("error"in k)return k;const D=k;return{portValues:D.portValues,cycle:D.cycle,peripheralState:D.peripheralState,snapshotId:D.snapshotId}},[c]),p=N.useCallback(async(_,R,A="default",k)=>{const D=await c({type:"tick-n",n:_,inputs:R,slot:A,snapshot:k?.snapshot});if("error"in D)return D;const H=D;return{portValues:H.portValues,cycle:H.cycle,peripheralState:H.peripheralState,snapshotId:H.snapshotId}},[c]),m=N.useCallback(async(_,R,A,k="default")=>{const D=await c({type:"scan-port",addrNodeId:_,valuePortKey:R,count:A,slot:k});return"error"in D?D:{values:D.values}},[c]),y=N.useCallback(async _=>{const R=await c({type:"simulate",..._});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(_="default")=>{const R=await c({type:"reset",slot:_});if("error"in R)return R;const A=R;return{portValues:A.portValues,peripheralState:A.peripheralState}},[c]),x=N.useCallback(async(_,R,A="default",k)=>{const D=await c({type:"set-node",nodeId:_,value:R,slot:A,snapshot:k?.snapshot});if("error"in D)return D;const H=D;return{portValues:H.portValues,peripheralState:H.peripheralState,snapshotId:H.snapshotId}},[c]),w=N.useCallback(async(_="default")=>{const R=await c({type:"snapshot",slot:_});return"error"in R?R:{snapshotId:R.snapshotId}},[c]),S=N.useCallback(async(_,R="default")=>{const A=await c({type:"restore",snapshotId:_,slot:R});if("error"in A)return A;const k=A;return{portValues:k.portValues,cycle:k.cycle,peripheralState:k.peripheralState}},[c]),E=N.useCallback(async(_,R="default")=>{const A=await c({type:"prune-snapshots",keepAfterId:_,slot:R});return"error"in A,A},[c]),O=N.useCallback(async _=>{await c({type:"dispose",slot:_})},[c]),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:S,pruneSnapshots:E,dispose:O,isReady:C}}const R0=N.createContext(null);function TN({children:t}){const e=CN();return M.jsx(R0.Provider,{value:e,children:t})}const NN={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 Xf(){return N.useContext(R0)??NN}function Ri(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 AN(t){return t!=null&&typeof t=="object"&&t.__stateKind==="reg"}function MN(t){return t!=null&&typeof t=="object"&&t.__stateKind==="mem"}const nt={kind:"bit"};function K(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 k0(t){return typeof t=="number"?t===1?nt:K(t):t}const Ol=new Map;function RN(t,e){Ol.has(t)||Ol.set(t,e)}function Dl(t){return Ol.get(t)}function kN(){return Ol}function ON(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 Ff(t,e,n){const i={};for(const[s,l]of e)i[s]=ON(t,s,l);return new Proxy(i,{get(s,l){if(l in s)return s[l];if(typeof l=="symbol"||l.startsWith("_"))return;const c=t===""?"circuit":`node '${t}'${n?` (${n})`:""}`,u=Object.keys(s).join(", ");throw new Error(`Port '${l}' does not exist on ${c}. Available ports: ${u||"none"}`)}})}function yt(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 G=z(U),L=yt(t,G);L._args=U??{};for(const q of L.circuit.state)if(q.stateType.kind==="bit")q.initialValue=!1;else if(q.stateType.kind==="bus")typeof q.initialValue=="number"&&(q.initialValue=0);else if(q.stateType.kind==="memory"){const tt=q.initialValue;q.initialValue={data:new Map,addressWidth:tt?.addressWidth??q.stateType.addressWidth,dataWidth:tt?.dataWidth??q.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,k0(U));const s=new Map;if(n.outputs)for(const[z,U]of Object.entries(n.outputs))s.set(z,k0(U));const l=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(l))(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[G,L]of Object.entries(l)){const q=new Map;for(const tt of L.circuit.inputs)q.set(tt.name,tt.portType);for(const tt of L.circuit.outputs)q.set(tt.name,tt.portType);z[G]=Ff(G,q,L.circuit.name)}const U={inputs:Ff("",i),outputs:Ff("",s),nodes:z};try{d=n.connect(U)}catch(G){c.push(G instanceof Error?G.message:String(G))}}for(const z of d){O0(z.source,i,s,l,c);for(const U of z.targets)O0(U,i,s,l,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 G of z.targets){const L=h(G),q=p.get(L);if(q){if(q.nodeId===z.source.nodeId&&q.portName===z.source.portName)continue;let tt=m.get(L);tt||(tt=new Set([h(q)]),m.set(L,tt)),tt.add(h(z.source));continue}p.set(L,{nodeId:z.source.nodeId,portName:z.source.portName}),U.push(G)}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(l).length>0;let S,E;x&&!w?(S={kind:"primitive"},E=n.state!=null?"sequential":"combinational"):w?(S={kind:"composite"},E=DN(l,n.state)?"sequential":"combinational"):(S={kind:"primitive"},E="combinational");const O=Array.from(i,([z,U])=>({name:z,portType:U})),C=Array.from(s,([z,U])=>({name:z,portType:U})),_=[];(n.state!=null||n.onTick!=null)&&_.push({name:"clk"});const R=[];if(n.state!=null)for(const[z,U]of Object.entries(n.state))if(MN(U)){const G=Math.ceil(Math.log2(U.depth))||1;R.push({id:`${t}-${z}`,name:z,stateType:{kind:"memory",addressWidth:G,dataWidth:U.width},initialValue:{data:new Map(U.initial),addressWidth:G,dataWidth:U.width},clockRef:"clk",edge:"rising"})}else AN(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(l)){const G=U._args??{};A.push({id:z,componentRef:U.circuit.name,arguments:G,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 k=[];let D=0;for(const z of d)for(const U of z.targets)k.push({id:`conn_${D++}`,source:{nodeId:z.source.nodeId,portName:z.source.portName},target:{nodeId:U.nodeId,portName:U.portName},portType:z.portType});const H={timing:E},Y=n.meta;Y&&(Y.description!==void 0&&(H.description=Y.description),Y.category!==void 0&&(H.category=Y.category),Y.icon!==void 0&&(H.icon=Y.icon),Y.tags!==void 0&&(H.tags=Y.tags),Y.author!==void 0&&(H.author=Y.author),Y.version!==void 0&&(H.version=Y.version),Y.synthesizable!==void 0&&(H.synthesizable=Y.synthesizable),Y.interactiveArg!==void 0&&(H.interactiveArg=Y.interactiveArg));const $={version:1,name:t,inputs:O,outputs:C,clocks:_,state:R,nodes:A,connections:k,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(l))if(F.has(z.circuit.name)||F.set(z.circuit.name,z),z._dependencies)for(const[U,G]of z._dependencies)F.has(U)||F.set(U,G);const Q={};for(const z of O)Q[z.name]=z;const B={};for(const z of C)B[z.name]=z;const P={};for(const z of A)P[z.id]=z;const j={circuit:$,inputs:Q,outputs:B,nodes:P,_dependencies:F};Object.defineProperty(j,"toJSON",{value:function(){const z={};for(const[U,G]of this._dependencies)z[U]=G;return{circuit:this.circuit,_dependencies:z}},enumerable:!1});const I=n.state?Object.keys(n.state):void 0;return RN(t,{inputNames:$.inputs.map(z=>z.name),outputNames:$.outputs.map(z=>z.name),evalFn:n.eval??(()=>({})),stateKeys:I,onTickFn:n.onTick}),j}function O0(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 l=i[t.nodeId];if(!l){s.push(`Node '${t.nodeId}' does not exist`);return}l.circuit.inputs.some(u=>u.name===t.portName)||l.circuit.outputs.some(u=>u.name===t.portName)||s.push(`Port '${t.portName}' does not exist on node '${t.nodeId}' (${l.circuit.name})`)}}function DN(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 jN=yt("And",{inputs:{a:nt,b:nt},outputs:{out:nt},meta:{category:"logic-gates",icon:"&",description:"Logical AND gate"},eval:({a:t,b:e})=>({out:t&&e?1:0})}),zN=yt("Or",{inputs:{a:nt,b:nt},outputs:{out:nt},meta:{category:"logic-gates",icon:"≥1",description:"Logical OR gate"},eval:({a:t,b:e})=>({out:t||e?1:0})}),VN=yt("Not",{inputs:{in:nt},outputs:{out:nt},meta:{category:"logic-gates",icon:"¬",description:"Logical NOT gate"},eval:({in:t})=>({out:t?0:1})}),LN=yt("Nand",{inputs:{a:nt,b:nt},outputs:{out:nt},meta:{category:"logic-gates",icon:"⊼",description:"Logical NAND gate"},eval:({a:t,b:e})=>({out:t&&e?0:1})}),IN=yt("Nor",{inputs:{a:nt,b:nt},outputs:{out:nt},meta:{category:"logic-gates",icon:"⊽",description:"Logical NOR gate"},eval:({a:t,b:e})=>({out:t||e?0:1})}),BN=yt("Xor",{inputs:{a:nt,b:nt},outputs:{out:nt},meta:{category:"logic-gates",icon:"⊕",description:"Logical XOR gate"},eval:({a:t,b:e})=>({out:t!==e?1:0})}),PN=yt("Xnor",{inputs:{a:nt,b:nt},outputs:{out:nt},meta:{category:"logic-gates",icon:"⊙",description:"Logical XNOR gate"},eval:({a:t,b:e})=>({out:t===e?1:0})}),HN=yt("Buffer",{inputs:{in:nt},outputs:{out:nt},meta:{category:"logic-gates",icon:"▷",description:"Buffer — passes input through unchanged"},eval:({in:t})=>({out:t})}),UN=Object.freeze(Object.defineProperty({__proto__:null,And:jN,Buffer:HN,Nand:LN,Nor:IN,Not:VN,Or:zN,Xnor:PN,Xor:BN},Symbol.toStringTag,{value:"Module"})),$N=yt("Incrementer",{inputs:{in:K(8)},outputs:{out:K(8)},meta:{category:"arithmetic",icon:"+1",description:"Adds 1 to the input"},eval:({in:t})=>({out:t+1&255})}),YN=yt("Adder",({width:t=8}={})=>({inputs:{a:K(t),b:K(t),carry_in:nt},outputs:{sum:K(t),carry_out:nt},meta:{category:"arithmetic",icon:"+",description:"N-bit adder with carry"},eval:({a:e,b:n,carry_in:i,width:s=t})=>{const l=s,c=l>=32?4294967295:(1<<l)-1,u=(e>>>0)+(n>>>0)+i;return{sum:u&c,carry_out:u>c?1:0}}})),GN=yt("Subtractor",({width:t=8}={})=>({inputs:{a:K(t),b:K(t),borrow_in:nt},outputs:{difference:K(t),borrow_out:nt},meta:{category:"arithmetic",icon:"−",description:"N-bit subtractor with borrow"},eval:({a:e,b:n,borrow_in:i,width:s=t})=>{const l=s,c=l>=32?4294967295:(1<<l)-1,u=(e>>>0)-(n>>>0)-i;return{difference:u&c,borrow_out:u<0?1:0}}})),qN=yt("Multiplier",{inputs:{a:K(8),b:K(8)},outputs:{product:K(16)},meta:{category:"arithmetic",icon:"×",description:"N-bit multiplier"},eval:({a:t,b:e})=>({product:t*e&65535})}),XN=yt("Comparator",({width:t=8}={})=>({inputs:{a:K(t),b:K(t)},outputs:{eq:nt,lt:nt,gt:nt},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}}})),FN=yt("LeftShifter",({width:t=8}={})=>({inputs:{value:K(t),shift:K(t)},outputs:{result:K(t)},meta:{category:"arithmetic",icon:"≪",description:"Left bit shifter"},eval:({value:e,shift:n,width:i=t})=>{const s=i,l=n,c=s>=32?4294967295:(1<<s)-1;return{result:l>=s?0:e<<l&c}}})),ZN=yt("RightShifter",({width:t=8}={})=>({inputs:{value:K(t),shift:K(t)},outputs:{result:K(t)},meta:{category:"arithmetic",icon:"≫",description:"Right bit shifter"},eval:({value:e,shift:n,width:i=t})=>{const s=i,l=n;return{result:l>=s?0:e>>>l}}})),KN=yt("SignedAdder",{inputs:{a:K(8),b:K(8),carry_in:nt},outputs:{sum:K(8),overflow:nt,carry_out:nt},meta:{category:"arithmetic",icon:"±+",description:"Signed adder with overflow detection"},eval:({a:t,b:e,carry_in:n})=>{const l=t>>>0,c=e>>>0,u=l+c+n,d=u&255,h=(l&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}}}),QN=yt("SignedComparator",{inputs:{a:K(8),b:K(8)},outputs:{eq:nt,lt:nt,gt:nt,lte:nt,gte:nt},meta:{category:"arithmetic",icon:"±⋚",description:"Signed comparator"},eval:({a:t,b:e})=>{const s=t&255,l=e&255,c=s&128?s-256:s,u=l&128?l-256:l;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}}}),WN=yt("SignedMultiplier",{inputs:{a:K(8),b:K(8)},outputs:{product:K(16)},meta:{category:"arithmetic",icon:"±×",description:"Signed multiplier"},eval:({a:t,b:e})=>{const s=t&255,l=e&255,c=s&128?s-256:s,u=l&128?l-256:l,d=c*u;return{product:d>=0?d:d+65536}}}),JN=yt("BusAnd",({width:t=8}={})=>({inputs:{a:K(t),b:K(t)},outputs:{out:K(t)},meta:{category:"bus-operations",icon:"&8",description:"Bitwise AND on buses"},eval:({a:e,b:n})=>({out:e&n})})),tA=yt("BusOr",({width:t=8}={})=>({inputs:{a:K(t),b:K(t)},outputs:{out:K(t)},meta:{category:"bus-operations",icon:"|8",description:"Bitwise OR on buses"},eval:({a:e,b:n})=>({out:(e|n)>>>0})})),eA=yt("BusNot",{inputs:{in:K(8)},outputs:{out:K(8)},meta:{category:"bus-operations",icon:"¬8",description:"Bitwise NOT on bus"},eval:({in:t})=>({out:~t&255})}),nA=yt("BusXor",({width:t=8}={})=>({inputs:{a:K(t),b:K(t)},outputs:{out:K(t)},meta:{category:"bus-operations",icon:"⊕8",description:"Bitwise XOR on buses"},eval:({a:e,b:n})=>({out:(e^n)>>>0})})),oA=Object.freeze(Object.defineProperty({__proto__:null,Adder:YN,BusAnd:JN,BusNot:eA,BusOr:tA,BusXor:nA,Comparator:XN,Incrementer:$N,LeftShifter:FN,Multiplier:qN,RightShifter:ZN,SignedAdder:KN,SignedComparator:QN,SignedMultiplier:WN,Subtractor:GN},Symbol.toStringTag,{value:"Module"})),iA=yt("Mux",({width:t=1}={})=>({inputs:{in0:t===1?nt:K(t),in1:t===1?nt:K(t),sel:nt},outputs:{out:t===1?nt:K(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})})),rA=yt("Decoder",{inputs:{in:K(2)},outputs:{out0:nt,out1:nt,out2:nt,out3:nt},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})}),sA=yt("Splitter",{inputs:{in:K(8)},outputs:{out0:K(4),out1:K(4)},meta:{category:"utilities",icon:"⊢",description:"Bus splitter"},eval:({in:t})=>({out0:t&15,out1:t>>4&15})}),aA=yt("Splitter8to8",{inputs:{in:K(8)},outputs:{bit0:nt,bit1:nt,bit2:nt,bit3:nt,bit4:nt,bit5:nt,bit6:nt,bit7:nt},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})}),lA=yt("Combiner8to8",{inputs:{bit0:nt,bit1:nt,bit2:nt,bit3:nt,bit4:nt,bit5:nt,bit6:nt,bit7:nt},outputs:{out:K(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:l,bit6:c,bit7:u})=>({out:t&1|(e&1)<<1|(n&1)<<2|(i&1)<<3|(s&1)<<4|(l&1)<<5|(c&1)<<6|(u&1)<<7})}),cA=yt("Concat",{inputs:{high:K(4),low:K(4)},outputs:{out:K(8)},meta:{category:"utilities",icon:"||",description:"Concatenate two buses"},eval:({high:t,low:e})=>({out:t<<4|e})}),uA=yt("BitSlice",t=>({inputs:{in:K(8)},outputs:{out:K(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}}})),fA=yt("AddressCombiner",{inputs:{lo:K(8),hi:K(8)},outputs:{out:K(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})}),dA=yt("Probe",{inputs:{in:nt},outputs:{out:nt},meta:{category:"utilities",icon:"🔍",description:"Debug observation point"},eval:({in:t})=>({out:t})}),hA=Object.freeze(Object.defineProperty({__proto__:null,AddressCombiner:fA,BitSlice:uA,Combiner8to8:lA,Concat:cA,Decoder:rA,Mux:iA,Probe:dA,Splitter:sA,Splitter8to8:aA},Symbol.toStringTag,{value:"Module"})),pA=yt("DFlipFlop",({value:t=!1}={})=>({inputs:{d:nt},outputs:{q:nt,q_bar:nt},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})})),mA=yt("Register",({width:t=8,value:e=0}={})=>({inputs:{data:K(t),we:nt},outputs:{q:K(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})})),gA=Object.freeze(Object.defineProperty({__proto__:null,DFlipFlop:pA,Register:mA},Symbol.toStringTag,{value:"Module"})),yA=yt("ROM",t=>({inputs:{addr:K(16)},outputs:{data_out:K(8)},state:{memory:Ri(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})})),vA=yt("RAM",t=>({inputs:{addr:K(8),data_in:K(8),we:nt},outputs:{data_out:K(8)},state:{memory:Ri(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})})),bA=yt("DualPortRAM",t=>({inputs:{addrA:K(8),dataA:K(8),weA:nt,addrB:K(8)},outputs:{outA:K(8),outB:K(8)},state:{memory:Ri(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 xA(t){const e={};for(let n=0;n<t.length;n++){const i=t[n]&255;i!==0&&(e[n]=i)}return e}function wA(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 l=(t[s]>>>0&n)>>>0;l!==0&&(i[s]=l)}return i}function SA(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 EA=Object.freeze(Object.defineProperty({__proto__:null,DualPortRAM:bA,RAM:vA,ROM:yA,romFromBytes:xA,romFromEntries:SA,romFromWords:wA},Symbol.toStringTag,{value:"Module"})),Zf=yt("Switch",t=>({outputs:{out:nt},eval:({value:e})=>({out:e?1:0}),meta:{category:"input-output",icon:"⚡",description:"User-controllable 1-bit toggle",interactiveArg:"value"}})),Kf=yt("Button",t=>({outputs:{out:nt},eval:({value:e})=>({out:e?1:0}),meta:{category:"input-output",icon:"🔘",description:"Push button input (momentary)",interactiveArg:"value"}})),Qf=yt("Led",{inputs:{in:nt},eval:()=>({}),meta:{category:"input-output",icon:"💡",description:"Visual output LED indicator"}}),Wf=yt("Input",t=>({outputs:{out:K(8)},eval:({value:e})=>({out:typeof e=="number"?e:0}),meta:{category:"input-output",icon:"🔢",description:"Multi-bit numeric input",interactiveArg:"value"}})),Jf=yt("Output",{inputs:{in:K(8)},eval:()=>({}),meta:{category:"input-output",icon:"📤",description:"Multi-bit output sink"}}),_A=yt("Constant",({width:t=1}={})=>({outputs:{out:t===1?nt:K(t)},eval:({value:e})=>({out:typeof e=="number"?e:0}),meta:{category:"utilities",icon:"K",description:"Fixed value source",interactiveArg:"value"}})),CA=Object.freeze(Object.defineProperty({__proto__:null,Button:Kf,Constant:_A,Input:Wf,Led:Qf,Output:Jf,Switch:Zf},Symbol.toStringTag,{value:"Module"})),TA=yt("SevenSegment",{inputs:{in:K(4)},meta:{category:"display",icon:"7",description:"4-bit seven-segment display",synthesizable:!1}}),td=yt("HexDisplay",{inputs:{in:K(8)},meta:{category:"display",icon:"0xFF",description:"Hexadecimal display",synthesizable:!1}}),NA=yt("Screen",t=>({inputs:{dataIn:K(8)},outputs:{addrB:K(16)},state:{memory:new Map},meta:{category:"display",icon:"🖥️",description:"Pixel display",synthesizable:!1},eval:()=>({addrB:0})})),AA=yt("RasterDisplay",t=>({inputs:{dataIn:K(8)},outputs:{addrB:K(16),scanX:K(8),scanY:K(8),hblank:nt,vblank:nt},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})})),MA=yt("Console",{inputs:{data:K(8),we:nt},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}}),RA=Object.freeze(Object.defineProperty({__proto__:null,Console:MA,HexDisplay:td,RasterDisplay:AA,Screen:NA,SevenSegment:TA},Symbol.toStringTag,{value:"Module"})),kA=yt("RV32I_Decode",{inputs:{instruction:K(32)},outputs:{opcode:K(7),rd:K(5),funct3:K(3),rs1:K(5),rs2:K(5),funct7:K(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"}}),OA=yt("RV32I_ALU",{inputs:{a:K(32),b:K(32),alu_op:K(4)},outputs:{result:K(32),zero:nt},eval:({a:t,b:e,alu_op:n})=>{const i=t>>>0,s=e>>>0,l=n&15;let c;switch(l){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"}}),DA=yt("RV32I_ImmGen",{inputs:{instruction:K(32)},outputs:{immediate:K(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,l=e>>>7&1,c=e>>>25&63,u=e>>>8&15;i=s<<12|l<<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,l=e>>>12&255,c=e>>>20&1,u=e>>>21&1023;i=s<<20|l<<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"}}),jA=yt("RV32I_Control",{inputs:{opcode:K(7),funct3:K(3),funct7_bit:nt},outputs:{alu_op:K(4),alu_src:nt,mem_read:nt,mem_write:nt,reg_write:nt,mem_to_reg:nt,branch:nt,jump:nt,lui:nt,auipc:nt,is_jalr:nt},eval:({opcode:t,funct3:e,funct7_bit:n})=>{const i=t&127,s=e&7,l=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=l?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=l?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=l?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"}}),zA=yt("RV32I_BranchComp",{inputs:{a:K(32),b:K(32),funct3:K(3)},outputs:{take_branch:nt},eval:({a:t,b:e,funct3:n})=>{const i=t>>>0,s=e>>>0,l=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=l<c?1:0;break;case 5:d=l>=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"}}),VA=yt("RV32I_RegisterFile",{inputs:{rs1:K(5),rs2:K(5),rd:K(5),write_data:K(32),we:nt,debug_rs:K(5)},outputs:{read1:K(32),read2:K(32),debug_read:K(32)},state:{memory:Ri(32,32)},eval:({rs1:t,rs2:e,debug_rs:n,memory:i})=>{const s=t&31,l=e&31,c=n&31;return{read1:s===0?0:i[s]>>>0,read2:l===0?0:i[l]>>>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"}}),LA=yt("RV32I_InstrMem",{inputs:{addr:K(32)},outputs:{instruction:K(32)},state:{memory:Ri(65536,8)},eval:({addr:t,memory:e})=>{const n=t>>>0,i=e[n],s=e[n+1],l=e[n+2];return{instruction:(e[n+3]<<24|l<<16|s<<8|i)>>>0}},onTick:({memory:t})=>({memory:t}),meta:{category:"rv32i",icon:"IM",description:"RISC-V instruction memory"}}),IA=yt("RV32I_DataMem",{inputs:{addr:K(32),write_data:K(32),mem_read:nt,mem_write:nt,funct3:K(3)},outputs:{read_data:K(32),misalign:nt},state:{memory:Ri(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 l=t>>>0,c=i&7;let u=0;if(((c===1||c===5)&&(l&1)!==0||c===2&&(l&3)!==0)&&(u=1),!e)return{read_data:0,misalign:u};let d;switch(c){case 0:{d=s[l]<<24>>24>>>0;break}case 1:{const h=s[l];d=(s[l+1]<<8|h)<<16>>16>>>0;break}case 2:{const h=s[l],p=s[l+1],m=s[l+2];d=(s[l+3]<<24|m<<16|p<<8|h)>>>0;break}case 4:d=s[l];break;case 5:{const h=s[l];d=(s[l+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 l=t>>>0,c=e>>>0;switch(i&7){case 0:s[l]=c&255;break;case 1:s[l]=c&255,s[l+1]=c>>>8&255;break;case 2:s[l]=c&255,s[l+1]=c>>>8&255,s[l+2]=c>>>16&255,s[l+3]=c>>>24&255;break}return{memory:s}},meta:{category:"rv32i",icon:"DM",description:"RISC-V data memory with byte/half/word access"}}),BA=yt("RV32I_WritebackMux",{inputs:{alu_result:K(32),load_data:K(32),pc_plus4:K(32),immediate:K(32),pc_plus_imm:K(32),mem_to_reg:nt,lui:nt,auipc:nt,jump:nt},outputs:{write_data:K(32)},eval:({alu_result:t,load_data:e,pc_plus4:n,immediate:i,pc_plus_imm:s,mem_to_reg:l,lui:c,auipc:u,jump:d})=>{let h;return d?h=n:u?h=s:c?h=i:l?h=e:h=t,{write_data:(h??0)>>>0}},meta:{category:"rv32i",icon:"WB",description:"RISC-V writeback mux"}}),PA=yt("RV32I_NextPCMux",{inputs:{pc_plus4:K(32),branch_target:K(32),jal_target:K(32),jalr_target:K(32),branch:nt,take_branch:nt,jump:nt,is_jalr:nt},outputs:{next_pc:K(32)},eval:({pc_plus4:t,branch_target:e,jal_target:n,jalr_target:i,branch:s,take_branch:l,jump:c,is_jalr:u})=>{let d;return c?d=u?i&-2:n:s&&l?d=e:d=t,{next_pc:(d??0)>>>0}},meta:{category:"rv32i",icon:"PC",description:"RISC-V next PC mux"}}),HA=yt("RV32I_ForwardingUnit",{inputs:{id_rs1:K(5),id_rs2:K(5),ex_rd:K(5),ex_reg_write:nt,mem_rd:K(5),mem_reg_write:nt},outputs:{forward_a:K(2),forward_b:K(2)},eval:({id_rs1:t,id_rs2:e,ex_rd:n,ex_reg_write:i,mem_rd:s,mem_reg_write:l})=>{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:l&&h!==0&&h===c&&(p=2),i&&d!==0&&d===u?m=1:l&&h!==0&&h===u&&(m=2),{forward_a:p,forward_b:m}},meta:{category:"rv32i",icon:"FWD",description:"RISC-V data forwarding unit"}}),UA=yt("RV32I_WBBypass",{inputs:{rs_val:K(32),rs_addr:K(5),wb_val:K(32),wb_rd:K(5),wb_we:nt},outputs:{out:K(32)},eval:({rs_val:t,rs_addr:e,wb_val:n,wb_rd:i,wb_we:s})=>{const l=e&31,c=i&31;return{out:(s&&c!==0&&c===l?n:t)>>>0}},meta:{category:"rv32i",icon:"BYP",description:"RISC-V writeback bypass"}}),$A=yt("RV32I_LoadAlign",{inputs:{data:K(32),funct3:K(3)},outputs:{out:K(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)"}}),YA=yt("RV32I_LoadAlignFull",{inputs:{data:K(32),byte_offset:K(2),funct3:K(3)},outputs:{out:K(32)},eval:({data:t,byte_offset:e,funct3:n})=>{const i=t>>>0,s=e&3,l=n&7,c=i>>>s*8&255,u=i>>>(s&2)*8&65535;let d;switch(l){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)"}}),GA=yt("RV32I_HazardUnit",{inputs:{if_rs1:K(5),if_rs2:K(5),id_rd:K(5),id_mem_read:nt,branch_taken:nt,jump:nt},outputs:{stall:nt,flush:nt},eval:({if_rs1:t,if_rs2:e,id_rd:n,id_mem_read:i,branch_taken:s,jump:l})=>{const c=t&31,u=e&31,d=n&31;return{stall:i&&d!==0&&(d===c||d===u)?1:0,flush:s||l?1:0}},meta:{category:"rv32i",icon:"HAZ",description:"RISC-V hazard detection unit"}}),qA=yt("DualPortROM",t=>({inputs:{addrA:K(32),addrB:K(32)},outputs:{dataA:K(32),dataB:K(32)},state:{memory:Ri(65536,8)},eval:({addrA:e,addrB:n,memory:i})=>{const s=e>>>0,l=n>>>0;return{dataA:(i[s+3]<<24|i[s+2]<<16|i[s+1]<<8|i[s])>>>0,dataB:(i[l+3]<<24|i[l+2]<<16|i[l+1]<<8|i[l])>>>0}},onTick:({memory:e})=>({memory:e}),meta:{category:"memory",description:"Dual-port read-only memory"}})),XA=Object.freeze(Object.defineProperty({__proto__:null,DualPortROM:qA,RV32I_ALU:OA,RV32I_BranchComp:zA,RV32I_Control:jA,RV32I_DataMem:IA,RV32I_Decode:kA,RV32I_ForwardingUnit:HA,RV32I_HazardUnit:GA,RV32I_ImmGen:DA,RV32I_InstrMem:LA,RV32I_LoadAlign:$A,RV32I_LoadAlignFull:YA,RV32I_NextPCMux:PA,RV32I_RegisterFile:VA,RV32I_WBBypass:UA,RV32I_WritebackMux:BA},Symbol.toStringTag,{value:"Module"})),FA=(()=>{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})(),ZA=yt("Eth_ProtocolDecoder",{inputs:{ethertype:K(16)},outputs:{is_ipv4:nt,is_ipv6:nt,is_arp:nt,is_vlan:nt,is_mpls:nt},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"}}),KA=yt("Eth_AddrClassifier",{inputs:{dst_mac_hi:K(16),dst_mac_lo:K(32)},outputs:{is_broadcast:nt,is_multicast:nt,is_unicast:nt},eval:({dst_mac_hi:t,dst_mac_lo:e})=>{const n=t&65535,i=(e&4294967295)>>>0,s=n===65535&&i===4294967295?1:0,l=!s&&(i>>>24&1)===1?1:0;return{is_broadcast:s,is_multicast:l,is_unicast:!s&&!l?1:0}},meta:{category:"networking",icon:"EA",description:"MAC address classifier"}}),QA=yt("Eth_FrameInput",{inputs:{enable:nt,reset:nt},outputs:{tdata:K(32),tkeep:K(4),tvalid:nt,tlast:nt,byte_offset:K(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,l=(e.get(65542)??0)!==0?1:0,c=(e.get(65543)??0)&65535;return{tdata:n,tkeep:i,tvalid:s,tlast:l,byte_offset:c}},onTick:({enable:t,reset:e,memory:n})=>{const i=n??new Map,s=65536,l=65537,c=65538,u=65539,d=65540,h=65541,p=65542,m=65543;if(e){const _=new Map(i);return _.set(s,0),_.set(c,0),_.set(h,0),_.set(p,0),{memory:_}}if(!t){const _=new Map(i);return _.set(h,0),{memory:_}}const y=new Map(i);if(!(i.get(c)??0)){let _=-1;for(const R of i.keys())R<65536&&R>_&&(_=R);y.set(l,_+1),y.set(c,1)}const b=y.get(l)??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,O=0;for(let _=0;_<S;_++)E=(E|((i.get(x+_)??0)&255)<<24-_*8)>>>0,O|=1<<3-_;const C=x+S>=b;return y.set(u,E),y.set(d,O),y.set(h,1),y.set(p,C?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)"}}),WA=yt("Eth_FrameParser",{inputs:{tdata:K(32),tkeep:K(4),tvalid:nt,tlast:nt},outputs:{dst_mac_hi:K(16),dst_mac_lo:K(32),dst_mac_valid:nt,src_mac_hi:K(16),src_mac_lo:K(32),src_mac_valid:nt,ethertype:K(16),ethertype_valid:nt,has_vlan:nt,vlan_tci:K(16),vlan_valid:nt,payload_valid:nt,frame_done:nt,frame_length:K(16),parse_state:K(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,l=(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:l,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 l=s??new Map;if(!n)return{memory:l};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,O=0,C=2,_=3,R=4,A=5,k=6,D=7,H=new Map(l);let Y=l.get(h)??O;const $=(u>>3&1)+(u>>2&1)+(u>>1&1)+(u&1),F=l.get(E)??0;H.set(E,F+$);const Q=c>>>24&255,B=c>>>16&255,P=c>>>8&255,j=c&255;switch(Y){case O:H.set(p,c),H.set(h,C);break;case C:H.set(m,Q<<8|B),H.set(y,P<<8|j),H.set(h,_);break;case _:H.set(b,l.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?D:k));break}case A:H.set(x,(Q<<8|B)&65535),H.set(h,d?D:k);break;case k:d&&H.set(h,D);break}return d&&Y!==D&&H.set(E,F+$),{memory:H}},meta:{category:"networking",icon:"EF",description:"Ethernet frame parser FSM"}}),JA=yt("Eth_CRC32",{inputs:{data:K(32),data_valid:nt,tkeep:K(4),tlast:nt,reset:nt},outputs:{crc:K(32),crc_ok:nt},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:l})=>{const c=l??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=(FA[(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"}}),tM=yt("MemBusMux",{inputs:{addr:K(32),write_data:K(32),mem_read:nt,mem_write:nt,funct3:K(3),read_data_0:K(32),read_data_1:K(32),read_data_2:K(32),read_data_3:K(32),read_data_4:K(32)},outputs:{local_addr:K(32),write_data_out:K(32),funct3_out:K(3),read_data:K(32),p0_read:nt,p0_write:nt,p1_read:nt,p1_write:nt,p2_read:nt,p2_write:nt,p3_read:nt,p3_write:nt,p4_read:nt,p4_write:nt},eval:({addr:t,write_data:e,mem_read:n,mem_write:i,funct3:s,read_data_0:l,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:O,end4:C})=>{const _=(t??0)>>>0,R=(e??0)>>>0,A=(s??0)&7,k=[{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:(O??2147495935)>>>0},{base:(x??0)>>>0,end:(C??65535)>>>0}];let D=-1;for(let B=0;B<5;B++)if(_>=k[B].base&&_<=k[B].end){D=B;break}const H=D>=0?_-k[D].base>>>0:0,Y=[l,c,u,d,h].map(B=>(B??0)>>>0),$=D>=0?Y[D]:0,F=!!n,Q=!!i;return{local_addr:H,write_data_out:R,funct3_out:A,read_data:$,p0_read:D===0&&F?1:0,p0_write:D===0&&Q?1:0,p1_read:D===1&&F?1:0,p1_write:D===1&&Q?1:0,p2_read:D===2&&F?1:0,p2_write:D===2&&Q?1:0,p3_read:D===3&&F?1:0,p3_write:D===3&&Q?1:0,p4_read:D===4&&F?1:0,p4_write:D===4&&Q?1:0}},meta:{category:"rv32i",icon:"BUS",description:"Memory bus multiplexer"}}),eM=yt("UART_TX",{inputs:{addr:K(32),write_data:K(32),mem_read:nt,mem_write:nt},outputs:{read_data:K(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 l=String.fromCharCode(e&255),c=(i??"")+l;return{text:c.length>4096?c.slice(-4096):c}},meta:{category:"io",icon:"TX",description:"UART transmitter",synthesizable:!1}}),nM=yt("NIC_FIFO",{inputs:{tx_addr:K(32),tx_write_data:K(32),tx_mem_read:nt,tx_mem_write:nt,rx_addr:K(32),rx_mem_read:nt,rx_mem_write:nt,net_rx_data:K(32),net_rx_valid:nt,net_rx_frame:nt},outputs:{tx_read_data:K(32),rx_read_data:K(32),net_tx_data:K(32),net_tx_valid:nt,net_tx_frame:nt},state:{memory:new Map},eval:({tx_mem_read:t,rx_mem_read:e,tx_addr:n,rx_addr:i,memory:s})=>{const l=s??new Map;let c=0;t&&(n??0)>>>0===8&&(c=(l.get(8192)??0)-(l.get(8193)??0));let u=0;if(e){const x=(i??0)>>>0;x===0?u=(l.get(4096+(l.get(8209)??0))??0)>>>0:x===8&&(u=l.get(8210)??0)}const d=l.get(8196)??0,h=l.get(8195)??0,p=l.get(8192)??0;let m=0,y=0,b=0;return d&&h<p&&(m=(l.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:l,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=(l??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}}),oM=Object.freeze(Object.defineProperty({__proto__:null,Eth_AddrClassifier:KA,Eth_CRC32:JA,Eth_FrameInput:QA,Eth_FrameParser:WA,Eth_ProtocolDecoder:ZA,MemBusMux:tM,NIC_FIFO:nM,UART_TX:eM},Symbol.toStringTag,{value:"Module"})),D0=t=>!!t&&typeof t=="object"&&"circuit"in t,iM=[...Object.values(UN),...Object.values(oA),...Object.values(hA),...Object.values(gA),...Object.values(EA),...Object.values(CA),...Object.values(RA),...Object.values(XA),...Object.values(oM)],rM=t=>{if(D0(t))return t;if(typeof t=="function")try{const e=t();return D0(e)?e:null}catch{return null}return null},sM=Object.freeze(iM.map(rM).filter(t=>t!==null));function aM(t,e){const n=new Map;for(const i of e)n.set(i.name,z0(j0(i,new Map)));return z0(j0(t,n))}function j0(t,e){const n={};for(const l of t.inputs)n[l.name]=l;const i={};for(const l of t.outputs)i[l.name]=l;const s={};for(const l of t.nodes)s[l.id]=l;return{circuit:t,inputs:n,outputs:i,nodes:s,_dependencies:e}}function z0(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 lM(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=[],l=[];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:[]}),l.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:[]}),l.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:l,implementation:{kind:"composite"},metadata:{description:`Auto-generated harness for ${t.name}`}}}function ed(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&&ed(s,e,n))return!0}return!1}const V0=new Set(sM.map(t=>t.circuit.name));class jl extends Error{constructor(e){super(e),this.name="CircuitToSourceError"}}function cM(t){const e=new Map;for(const[s,l]of t._dependencies)V0.has(s)||e.set(s,l.circuit);for(const s of t.circuit.nodes)if(!V0.has(s.componentRef)&&!e.has(s.componentRef)){const l=t._dependencies.get(s.componentRef);l&&e.set(s.componentRef,l.circuit)}const n=[],i=uM(e);for(const s of i)n.push(L0(s)),n.push("");return n.push(L0(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
|
|
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 P0(t,e){return t.nodeId===""?e==="source"?`inputs.${t.portName}`:`outputs.${t.portName}`:`nodes.${t.nodeId}.${t.portName}`}const vM="__top__";function bM(t){const e={},n=new Set;function i(s){const l=s.circuit.name;if(n.has(l))return;n.add(l);const c=Dl(l);c&&(e[l]={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 xM(t,e){const n=Xf(),i=N.useMemo(()=>`embed-${typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2)}`,[]),{rawCircuit:s,componentLibrary:l}=N.useMemo(()=>{const pt=new Map,gt={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[Zf(),Kf(),Qf,Wf(),Jf,td])gt.addCircuit(vt.circuit);if(t&&(gt.addCircuit(t.circuit),t._dependencies))for(const[,vt]of t._dependencies)vt?.circuit&>.addCircuit(vt.circuit);return{rawCircuit:t?.circuit??null,componentLibrary:gt}},[t]),c=N.useMemo(()=>s?e?.autoHarness?lM(s,l,e.initialInputs):s:null,[s,l,e?.autoHarness,e?.initialInputs]),u=N.useMemo(()=>ed(c,l.resolveCircuit),[c,l]),[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),[O,C]=N.useState(5),_=N.useRef(null),R=N.useRef([]),[A,k]=N.useState(-1),[D,H]=N.useState(0),Y=200,$=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($),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 vt=bM(t),mt=[],Ct=new Set,Lt=Qt=>{Ct.has(Qt.name)||(Ct.add(Qt.name),mt.push(Qt))};Lt(t.circuit);for(const[,Qt]of t._dependencies)Qt?.circuit&&Lt(Qt.circuit);for(const Qt of[Zf(),Kf(),Qf,Wf(),Jf,td])Lt(Qt.circuit);const jt=l.getAllPrimitiveNames();for(const Qt of jt){const Oe=l.resolveCircuit(Qt);Oe&&Lt(Oe)}const zt=await n.compileIR(c,mt,i,{evalSources:vt,snapshot:u});if(pt)return;if("error"in zt){console.error("[useCircuitSimulator] compileIR failed:",zt.error),w(!1);return}const ge=new Map;for(const[Qt,Oe]of Object.entries(zt.portValues))ge.set(Qt,Oe);h(ge),zt.peripheralState&&m(zt.peripheralState),b(0),R.current=zt.snapshotId!==void 0?[{snapshotId:zt.snapshotId,cycle:0,inputs:{...$}}]:[],k(zt.snapshotId!==void 0?0:-1),H(R.current.length),w(!0)}return gt(),()=>{pt=!0,n.dispose(i).catch(()=>{})}},[t,c,l,n,i,u]),N.useEffect(()=>{P($)},[$]),N.useEffect(()=>{if(!x||d.size===0||!c)return;const pt={};for(const gt of c.outputs){const vt=`${vM}.${gt.name}`,mt=d.get(vt);mt!==void 0&&(pt[gt.name]=typeof mt=="number"?mt:!!mt)}Q(pt)},[x,d,c]);const I=N.useCallback((pt,gt,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:gt,inputs:{...vt}}),mt.length>Y){const Lt=mt.length-Y,jt=mt[Lt-1].snapshotId;mt.splice(0,Lt),n.pruneSnapshots(jt,i).catch(()=>{})}z.current=mt.length-1,k(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 vt={...j.current,[pt]:gt};if(j.current=vt,P(vt),!x)return;const mt=await n.setNode(pt,gt,i);if("error"in mt)return;const Ct=new Map;for(const[Lt,jt]of Object.entries(mt.portValues))Ct.set(Lt,jt);h(Ct),mt.peripheralState&&m(mt.peripheralState)},[x,n,i]),G=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`,vt=d.get(gt),mt=typeof vt=="boolean"?!vt:vt===1?0:1,Ct=await n.setNode(pt,mt,i);if("error"in Ct)return;const Lt=new Map;for(const[jt,zt]of Object.entries(Ct.portValues))Lt.set(jt,zt);h(Lt),Ct.peripheralState&&m(Ct.peripheralState)},[x,d,n,i]),q=N.useCallback(async(pt,gt)=>{if(!x)return null;const vt=await n.setNode(pt,gt,i);if("error"in vt)return null;const mt=new Map;for(const[Ct,Lt]of Object.entries(vt.portValues))mt.set(Ct,Lt);return h(mt),vt.peripheralState&&m(vt.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[vt,mt]of Object.entries(pt.portValues))gt.set(vt,mt);h(gt),b(pt.cycle),pt.peripheralState&&m(pt.peripheralState),I(pt.snapshotId,pt.cycle,j.current)},[x,n,i,u,I]),rt=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 vt=new Map;for(const[mt,Ct]of Object.entries(gt.portValues))vt.set(mt,Ct);h(vt),b(gt.cycle),gt.peripheralState&&m(gt.peripheralState),I(gt.snapshotId,gt.cycle,j.current)},[x,n,i,u,I]),ct=N.useCallback(async(pt,gt,vt)=>{if(!x||vt<=0)return null;const mt=await n.scanPort(pt,gt,vt,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[vt,mt]of Object.entries(pt.portValues))gt.set(vt,mt);if(h(gt),b(0),P($),pt.peripheralState?m(pt.peripheralState):m({}),R.current=[],u){const vt=await n.snapshot(i);!("error"in vt)&&vt.snapshotId!==void 0&&(R.current=[{snapshotId:vt.snapshotId,cycle:0,inputs:{...$}}])}z.current=R.current.length>0?0:-1,k(R.current.length>0?0:-1),H(R.current.length)},[n,i,$,u]),ft=N.useCallback(async(pt,gt)=>{const vt=await n.restore(pt.snapshotId,i);if("error"in vt)return;const mt=new Map;for(const[Lt,jt]of Object.entries(vt.portValues))mt.set(Lt,jt);h(mt),b(vt.cycle),vt.peripheralState?m(vt.peripheralState):m({});const Ct={...pt.inputs};j.current=Ct,P(Ct),z.current=gt,k(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]),kt=N.useCallback(async pt=>{if(!x)return;const gt=R.current;pt<0||pt>=gt.length||await ft(gt[pt],pt)},[x,ft]),At=N.useRef(tt);N.useEffect(()=>{At.current=tt},[tt]);const bt=N.useCallback((pt,gt)=>{_.current&&clearInterval(_.current),C(pt),E(!0);const vt=Math.max(1,Math.floor(1e3/pt));_.current=setInterval(()=>{At.current()},vt)},[]),Tt=N.useCallback(()=>{_.current&&(clearInterval(_.current),_.current=null),E(!1)},[]),Ot=N.useCallback(pt=>{if(C(pt),_.current){clearInterval(_.current);const gt=Math.max(1,Math.floor(1e3/pt));_.current=setInterval(()=>{At.current()},gt)}},[]);N.useEffect(()=>()=>{_.current&&clearInterval(_.current)},[]);const Xt=N.useMemo(()=>{const pt=Object.entries(p);if(pt.length===0)return null;const gt=new Map;for(const[vt,mt]of pt)gt.set(vt,mt);return{currentState:gt,nextState:new Map,clocks:new Map,cycleCount:y}},[p,y]),qt=N.useMemo(()=>R.current.slice(0,D).map(pt=>({engineSnapshot:pt.snapshotId,metadata:pt.cycle})),[D]);return{outputs:F,inputs:B,cycleCount:y,ready:x,error:null,isSequential:u,circuit:c,portValues:d.size>0?d:null,sequentialState:Xt,componentLibrary:l,history:qt,historyIndex:A,isViewingPast:A>=0&&A<D-1,isRunning:S,speed:O,setNode:U,toggleInput:G,toggleNode:L,setNodeValue:q,tick:tt,tickN:rt,scanPort:ct,reset:ht,stepBack:ut,stepForward:dt,seek:kt,startAutoRun:bt,stopAutoRun:Tt,setSpeed:Ot,runCombinational:()=>{},getSimulator:()=>null}}function be(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=be(t[n]))!==""&&(e+=(e&&" ")+i);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var wM={value:()=>{}};function zl(){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 Vl(n)}function Vl(t){this._=t}function SM(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}})}Vl.prototype=zl.prototype={constructor:Vl,on:function(t,e){var n=this._,i=SM(t+"",n),s,l=-1,c=i.length;if(arguments.length<2){for(;++l<c;)if((s=(t=i[l]).type)&&(s=EM(n[s],t.name)))return s;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++l<c;)if(s=(t=i[l]).type)n[s]=H0(n[s],t.name,e);else if(e==null)for(s in n)n[s]=H0(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 Vl(t)},call:function(t,e){if((s=arguments.length-2)>0)for(var n=new Array(s),i=0,s,l;i<s;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(l=this._[t],i=0,s=l.length;i<s;++i)l[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,l=i.length;s<l;++s)i[s].value.apply(e,n)}};function EM(t,e){for(var n=0,i=t.length,s;n<i;++n)if((s=t[n]).name===e)return s.value}function H0(t,e,n){for(var i=0,s=t.length;i<s;++i)if(t[i].name===e){t[i]=wM,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}var nd="http://www.w3.org/1999/xhtml";const U0={svg:"http://www.w3.org/2000/svg",xhtml:nd,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Ll(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),U0.hasOwnProperty(e)?{space:U0[e],local:t}:t}function _M(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===nd&&e.documentElement.namespaceURI===nd?e.createElement(t):e.createElementNS(n,t)}}function CM(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function $0(t){var e=Ll(t);return(e.local?CM:_M)(e)}function TM(){}function od(t){return t==null?TM:function(){return this.querySelector(t)}}function NM(t){typeof t!="function"&&(t=od(t));for(var e=this._groups,n=e.length,i=new Array(n),s=0;s<n;++s)for(var l=e[s],c=l.length,u=i[s]=new Array(c),d,h,p=0;p<c;++p)(d=l[p])&&(h=t.call(d,d.__data__,p,l))&&("__data__"in d&&(h.__data__=d.__data__),u[p]=h);return new nn(i,this._parents)}function AM(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function MM(){return[]}function Y0(t){return t==null?MM:function(){return this.querySelectorAll(t)}}function RM(t){return function(){return AM(t.apply(this,arguments))}}function kM(t){typeof t=="function"?t=RM(t):t=Y0(t);for(var e=this._groups,n=e.length,i=[],s=[],l=0;l<n;++l)for(var c=e[l],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 nn(i,s)}function G0(t){return function(){return this.matches(t)}}function q0(t){return function(e){return e.matches(t)}}var OM=Array.prototype.find;function DM(t){return function(){return OM.call(this.children,t)}}function jM(){return this.firstElementChild}function zM(t){return this.select(t==null?jM:DM(typeof t=="function"?t:q0(t)))}var VM=Array.prototype.filter;function LM(){return Array.from(this.children)}function IM(t){return function(){return VM.call(this.children,t)}}function BM(t){return this.selectAll(t==null?LM:IM(typeof t=="function"?t:q0(t)))}function PM(t){typeof t!="function"&&(t=G0(t));for(var e=this._groups,n=e.length,i=new Array(n),s=0;s<n;++s)for(var l=e[s],c=l.length,u=i[s]=[],d,h=0;h<c;++h)(d=l[h])&&t.call(d,d.__data__,h,l)&&u.push(d);return new nn(i,this._parents)}function X0(t){return new Array(t.length)}function HM(){return new nn(this._enter||this._groups.map(X0),this._parents)}function Il(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}Il.prototype={constructor:Il,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 UM(t){return function(){return t}}function $M(t,e,n,i,s,l){for(var c=0,u,d=e.length,h=l.length;c<h;++c)(u=e[c])?(u.__data__=l[c],i[c]=u):n[c]=new Il(t,l[c]);for(;c<d;++c)(u=e[c])&&(s[c]=u)}function YM(t,e,n,i,s,l,c){var u,d,h=new Map,p=e.length,m=l.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,l[u],u,l)+"",(d=h.get(b))?(i[u]=d,d.__data__=l[u],h.delete(b)):n[u]=new Il(t,l[u]);for(u=0;u<p;++u)(d=e[u])&&h.get(y[u])===d&&(s[u]=d)}function GM(t){return t.__data__}function qM(t,e){if(!arguments.length)return Array.from(this,GM);var n=e?YM:$M,i=this._parents,s=this._groups;typeof t!="function"&&(t=UM(t));for(var l=s.length,c=new Array(l),u=new Array(l),d=new Array(l),h=0;h<l;++h){var p=i[h],m=s[h],y=m.length,b=XM(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 O=0,C=0,_,R;O<x;++O)if(_=w[O]){for(O>=C&&(C=O+1);!(R=S[C])&&++C<x;);_._next=R||null}}return c=new nn(c,i),c._enter=u,c._exit=d,c}function XM(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function FM(){return new nn(this._exit||this._groups.map(X0),this._parents)}function ZM(t,e,n){var i=this.enter(),s=this,l=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?l.remove():n(l),i&&s?i.merge(s).order():s}function KM(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,s=n.length,l=i.length,c=Math.min(s,l),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 nn(u,this._parents)}function QM(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i=t[e],s=i.length-1,l=i[s],c;--s>=0;)(c=i[s])&&(l&&c.compareDocumentPosition(l)^4&&l.parentNode.insertBefore(c,l),l=c);return this}function WM(t){t||(t=JM);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),l=0;l<i;++l){for(var c=n[l],u=c.length,d=s[l]=new Array(u),h,p=0;p<u;++p)(h=c[p])&&(d[p]=h);d.sort(e)}return new nn(s,this._parents).order()}function JM(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function tR(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function eR(){return Array.from(this)}function nR(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],s=0,l=i.length;s<l;++s){var c=i[s];if(c)return c}return null}function oR(){let t=0;for(const e of this)++t;return t}function iR(){return!this.node()}function rR(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var s=e[n],l=0,c=s.length,u;l<c;++l)(u=s[l])&&t.call(u,u.__data__,l,s);return this}function sR(t){return function(){this.removeAttribute(t)}}function aR(t){return function(){this.removeAttributeNS(t.space,t.local)}}function lR(t,e){return function(){this.setAttribute(t,e)}}function cR(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function uR(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function fR(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 dR(t,e){var n=Ll(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?aR:sR:typeof e=="function"?n.local?fR:uR:n.local?cR:lR)(n,e))}function F0(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function hR(t){return function(){this.style.removeProperty(t)}}function pR(t,e,n){return function(){this.style.setProperty(t,e,n)}}function mR(t,e,n){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function gR(t,e,n){return arguments.length>1?this.each((e==null?hR:typeof e=="function"?mR:pR)(t,e,n??"")):vr(this.node(),t)}function vr(t,e){return t.style.getPropertyValue(e)||F0(t).getComputedStyle(t,null).getPropertyValue(e)}function yR(t){return function(){delete this[t]}}function vR(t,e){return function(){this[t]=e}}function bR(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function xR(t,e){return arguments.length>1?this.each((e==null?yR:typeof e=="function"?bR:vR)(t,e)):this.node()[t]}function Z0(t){return t.trim().split(/^|\s+/)}function id(t){return t.classList||new K0(t)}function K0(t){this._node=t,this._names=Z0(t.getAttribute("class")||"")}K0.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 Q0(t,e){for(var n=id(t),i=-1,s=e.length;++i<s;)n.add(e[i])}function W0(t,e){for(var n=id(t),i=-1,s=e.length;++i<s;)n.remove(e[i])}function wR(t){return function(){Q0(this,t)}}function SR(t){return function(){W0(this,t)}}function ER(t,e){return function(){(e.apply(this,arguments)?Q0:W0)(this,t)}}function _R(t,e){var n=Z0(t+"");if(arguments.length<2){for(var i=id(this.node()),s=-1,l=n.length;++s<l;)if(!i.contains(n[s]))return!1;return!0}return this.each((typeof e=="function"?ER:e?wR:SR)(n,e))}function CR(){this.textContent=""}function TR(t){return function(){this.textContent=t}}function NR(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function AR(t){return arguments.length?this.each(t==null?CR:(typeof t=="function"?NR:TR)(t)):this.node().textContent}function MR(){this.innerHTML=""}function RR(t){return function(){this.innerHTML=t}}function kR(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function OR(t){return arguments.length?this.each(t==null?MR:(typeof t=="function"?kR:RR)(t)):this.node().innerHTML}function DR(){this.nextSibling&&this.parentNode.appendChild(this)}function jR(){return this.each(DR)}function zR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function VR(){return this.each(zR)}function LR(t){var e=typeof t=="function"?t:$0(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function IR(){return null}function BR(t,e){var n=typeof t=="function"?t:$0(t),i=e==null?IR:typeof e=="function"?e:od(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function PR(){var t=this.parentNode;t&&t.removeChild(this)}function HR(){return this.each(PR)}function UR(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function $R(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function YR(t){return this.select(t?$R:UR)}function GR(t){return arguments.length?this.property("__data__",t):this.node().__data__}function qR(t){return function(e){t.call(this,e,this.__data__)}}function XR(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 FR(t){return function(){var e=this.__on;if(e){for(var n=0,i=-1,s=e.length,l;n<s;++n)l=e[n],(!t.type||l.type===t.type)&&l.name===t.name?this.removeEventListener(l.type,l.listener,l.options):e[++i]=l;++i?e.length=i:delete this.__on}}}function ZR(t,e,n){return function(){var i=this.__on,s,l=qR(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=l,s.options=n),s.value=e;return}}this.addEventListener(t.type,l,n),s={type:t.type,name:t.name,value:e,listener:l,options:n},i?i.push(s):this.__on=[s]}}function KR(t,e,n){var i=XR(t+""),s,l=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<l;++s)if((c=i[s]).type===p.type&&c.name===p.name)return p.value}return}for(u=e?ZR:FR,s=0;s<l;++s)this.each(u(i[s],e,n));return this}function J0(t,e,n){var i=F0(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 QR(t,e){return function(){return J0(this,t,e)}}function WR(t,e){return function(){return J0(this,t,e.apply(this,arguments))}}function JR(t,e){return this.each((typeof e=="function"?WR:QR)(t,e))}function*tk(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],s=0,l=i.length,c;s<l;++s)(c=i[s])&&(yield c)}var ty=[null];function nn(t,e){this._groups=t,this._parents=e}function Ps(){return new nn([[document.documentElement]],ty)}function ek(){return this}nn.prototype=Ps.prototype={constructor:nn,select:NM,selectAll:kM,selectChild:zM,selectChildren:BM,filter:PM,data:qM,enter:HM,exit:FM,join:ZM,merge:KM,selection:ek,order:QM,sort:WM,call:tR,nodes:eR,node:nR,size:oR,empty:iR,each:rR,attr:dR,style:gR,property:xR,classed:_R,text:AR,html:OR,raise:jR,lower:VR,append:LR,insert:BR,remove:HR,clone:YR,datum:GR,on:KR,dispatch:JR,[Symbol.iterator]:tk};function on(t){return typeof t=="string"?new nn([[document.querySelector(t)]],[document.documentElement]):new nn([[t]],ty)}function nk(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Tn(t,e){if(t=nk(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 ok={passive:!1},Hs={capture:!0,passive:!1};function rd(t){t.stopImmediatePropagation()}function br(t){t.preventDefault(),t.stopImmediatePropagation()}function ey(t){var e=t.document.documentElement,n=on(t).on("dragstart.drag",br,Hs);"onselectstart"in e?n.on("selectstart.drag",br,Hs):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function ny(t,e){var n=t.document.documentElement,i=on(t).on("dragstart.drag",null);e&&(i.on("click.drag",br,Hs),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 Bl=t=>()=>t;function sd(t,{sourceEvent:e,subject:n,target:i,identifier:s,active:l,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:l,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}})}sd.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function ik(t){return!t.ctrlKey&&!t.button}function rk(){return this.parentNode}function sk(t,e){return e??{x:t.x,y:t.y}}function ak(){return navigator.maxTouchPoints||"ontouchstart"in this}function oy(){var t=ik,e=rk,n=sk,i=ak,s={},l=zl("start","drag","end"),c=0,u,d,h,p,m=0;function y(_){_.on("mousedown.drag",b).filter(i).on("touchstart.drag",S).on("touchmove.drag",E,ok).on("touchend.drag touchcancel.drag",O).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function b(_,R){if(!(p||!t.call(this,_,R))){var A=C(this,e.call(this,_,R),_,R,"mouse");A&&(on(_.view).on("mousemove.drag",x,Hs).on("mouseup.drag",w,Hs),ey(_.view),rd(_),h=!1,u=_.clientX,d=_.clientY,A("start",_))}}function x(_){if(br(_),!h){var R=_.clientX-u,A=_.clientY-d;h=R*R+A*A>m}s.mouse("drag",_)}function w(_){on(_.view).on("mousemove.drag mouseup.drag",null),ny(_.view,h),br(_),s.mouse("end",_)}function S(_,R){if(t.call(this,_,R)){var A=_.changedTouches,k=e.call(this,_,R),D=A.length,H,Y;for(H=0;H<D;++H)(Y=C(this,k,_,R,A[H].identifier,A[H]))&&(rd(_),Y("start",_,A[H]))}}function E(_){var R=_.changedTouches,A=R.length,k,D;for(k=0;k<A;++k)(D=s[R[k].identifier])&&(br(_),D("drag",_,R[k]))}function O(_){var R=_.changedTouches,A=R.length,k,D;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),k=0;k<A;++k)(D=s[R[k].identifier])&&(rd(_),D("end",_,R[k]))}function C(_,R,A,k,D,H){var Y=l.copy(),$=Tn(H||A,R),F,Q,B;if((B=n.call(_,new sd("beforestart",{sourceEvent:A,target:y,identifier:D,active:c,x:$[0],y:$[1],dx:0,dy:0,dispatch:Y}),k))!=null)return F=B.x-$[0]||0,Q=B.y-$[1]||0,function P(j,I,z){var U=$,G;switch(j){case"start":s[D]=P,G=c++;break;case"end":delete s[D],--c;case"drag":$=Tn(z||I,R),G=c;break}Y.call(j,_,new sd(j,{sourceEvent:I,subject:B,target:y,identifier:D,active:G,x:$[0]+F,y:$[1]+Q,dx:$[0]-U[0],dy:$[1]-U[1],dispatch:Y}),k)}}return y.filter=function(_){return arguments.length?(t=typeof _=="function"?_:Bl(!!_),y):t},y.container=function(_){return arguments.length?(e=typeof _=="function"?_:Bl(_),y):e},y.subject=function(_){return arguments.length?(n=typeof _=="function"?_:Bl(_),y):n},y.touchable=function(_){return arguments.length?(i=typeof _=="function"?_:Bl(!!_),y):i},y.on=function(){var _=l.on.apply(l,arguments);return _===l?y:_},y.clickDistance=function(_){return arguments.length?(m=(_=+_)*_,y):Math.sqrt(m)},y}function ad(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function iy(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function Us(){}var $s=.7,Pl=1/$s,xr="\\s*([+-]?\\d+)\\s*",Ys="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Yn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",lk=/^#([0-9a-f]{3,8})$/,ck=new RegExp(`^rgb\\(${xr},${xr},${xr}\\)$`),uk=new RegExp(`^rgb\\(${Yn},${Yn},${Yn}\\)$`),fk=new RegExp(`^rgba\\(${xr},${xr},${xr},${Ys}\\)$`),dk=new RegExp(`^rgba\\(${Yn},${Yn},${Yn},${Ys}\\)$`),hk=new RegExp(`^hsl\\(${Ys},${Yn},${Yn}\\)$`),pk=new RegExp(`^hsla\\(${Ys},${Yn},${Yn},${Ys}\\)$`),ry={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};ad(Us,ki,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:sy,formatHex:sy,formatHex8:mk,formatHsl:gk,formatRgb:ay,toString:ay});function sy(){return this.rgb().formatHex()}function mk(){return this.rgb().formatHex8()}function gk(){return dy(this).formatHsl()}function ay(){return this.rgb().formatRgb()}function ki(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=lk.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?ly(e):n===3?new qe(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?Hl(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?Hl(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=ck.exec(t))?new qe(e[1],e[2],e[3],1):(e=uk.exec(t))?new qe(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=fk.exec(t))?Hl(e[1],e[2],e[3],e[4]):(e=dk.exec(t))?Hl(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=hk.exec(t))?fy(e[1],e[2]/100,e[3]/100,1):(e=pk.exec(t))?fy(e[1],e[2]/100,e[3]/100,e[4]):ry.hasOwnProperty(t)?ly(ry[t]):t==="transparent"?new qe(NaN,NaN,NaN,0):null}function ly(t){return new qe(t>>16&255,t>>8&255,t&255,1)}function Hl(t,e,n,i){return i<=0&&(t=e=n=NaN),new qe(t,e,n,i)}function yk(t){return t instanceof Us||(t=ki(t)),t?(t=t.rgb(),new qe(t.r,t.g,t.b,t.opacity)):new qe}function ld(t,e,n,i){return arguments.length===1?yk(t):new qe(t,e,n,i??1)}function qe(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}ad(qe,ld,iy(Us,{brighter(t){return t=t==null?Pl:Math.pow(Pl,t),new qe(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?$s:Math.pow($s,t),new qe(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new qe(Oi(this.r),Oi(this.g),Oi(this.b),Ul(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:cy,formatHex:cy,formatHex8:vk,formatRgb:uy,toString:uy}));function cy(){return`#${Di(this.r)}${Di(this.g)}${Di(this.b)}`}function vk(){return`#${Di(this.r)}${Di(this.g)}${Di(this.b)}${Di((isNaN(this.opacity)?1:this.opacity)*255)}`}function uy(){const t=Ul(this.opacity);return`${t===1?"rgb(":"rgba("}${Oi(this.r)}, ${Oi(this.g)}, ${Oi(this.b)}${t===1?")":`, ${t})`}`}function Ul(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Oi(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Di(t){return t=Oi(t),(t<16?"0":"")+t.toString(16)}function fy(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Nn(t,e,n,i)}function dy(t){if(t instanceof Nn)return new Nn(t.h,t.s,t.l,t.opacity);if(t instanceof Us||(t=ki(t)),!t)return new Nn;if(t instanceof Nn)return t;t=t.rgb();var e=t.r/255,n=t.g/255,i=t.b/255,s=Math.min(e,n,i),l=Math.max(e,n,i),c=NaN,u=l-s,d=(l+s)/2;return u?(e===l?c=(n-i)/u+(n<i)*6:n===l?c=(i-e)/u+2:c=(e-n)/u+4,u/=d<.5?l+s:2-l-s,c*=60):u=d>0&&d<1?0:c,new Nn(c,u,d,t.opacity)}function bk(t,e,n,i){return arguments.length===1?dy(t):new Nn(t,e,n,i??1)}function Nn(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}ad(Nn,bk,iy(Us,{brighter(t){return t=t==null?Pl:Math.pow(Pl,t),new Nn(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?$s:Math.pow($s,t),new Nn(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 qe(cd(t>=240?t-240:t+120,s,i),cd(t,s,i),cd(t<120?t+240:t-120,s,i),this.opacity)},clamp(){return new Nn(hy(this.h),$l(this.s),$l(this.l),Ul(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=Ul(this.opacity);return`${t===1?"hsl(":"hsla("}${hy(this.h)}, ${$l(this.s)*100}%, ${$l(this.l)*100}%${t===1?")":`, ${t})`}`}}));function hy(t){return t=(t||0)%360,t<0?t+360:t}function $l(t){return Math.max(0,Math.min(1,t||0))}function cd(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 ud=t=>()=>t;function xk(t,e){return function(n){return t+n*e}}function wk(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 Sk(t){return(t=+t)==1?py:function(e,n){return n-e?wk(e,n,t):ud(isNaN(e)?n:e)}}function py(t,e){var n=e-t;return n?xk(t,n):ud(isNaN(t)?e:t)}const Yl=(function t(e){var n=Sk(e);function i(s,l){var c=n((s=ld(s)).r,(l=ld(l)).r),u=n(s.g,l.g),d=n(s.b,l.b),h=py(s.opacity,l.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 Ek(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,i=e.slice(),s;return function(l){for(s=0;s<n;++s)i[s]=t[s]*(1-l)+e[s]*l;return i}}function _k(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function Ck(t,e){var n=e?e.length:0,i=t?Math.min(n,t.length):0,s=new Array(i),l=new Array(n),c;for(c=0;c<i;++c)s[c]=Gs(t[c],e[c]);for(;c<n;++c)l[c]=e[c];return function(u){for(c=0;c<i;++c)l[c]=s[c](u);return l}}function Tk(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function Gn(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function Nk(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]=Gs(t[s],e[s]):i[s]=e[s];return function(l){for(s in n)i[s]=n[s](l);return i}}var fd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,dd=new RegExp(fd.source,"g");function Ak(t){return function(){return t}}function Mk(t){return function(e){return t(e)+""}}function my(t,e){var n=fd.lastIndex=dd.lastIndex=0,i,s,l,c=-1,u=[],d=[];for(t=t+"",e=e+"";(i=fd.exec(t))&&(s=dd.exec(e));)(l=s.index)>n&&(l=e.slice(n,l),u[c]?u[c]+=l:u[++c]=l),(i=i[0])===(s=s[0])?u[c]?u[c]+=s:u[++c]=s:(u[++c]=null,d.push({i:c,x:Gn(i,s)})),n=dd.lastIndex;return n<e.length&&(l=e.slice(n),u[c]?u[c]+=l:u[++c]=l),u.length<2?d[0]?Mk(d[0].x):Ak(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 Gs(t,e){var n=typeof e,i;return e==null||n==="boolean"?ud(e):(n==="number"?Gn:n==="string"?(i=ki(e))?(e=i,Yl):my:e instanceof ki?Yl:e instanceof Date?Tk:_k(e)?Ek:Array.isArray(e)?Ck:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?Nk:Gn)(t,e)}var gy=180/Math.PI,hd={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function yy(t,e,n,i,s,l){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:l,rotate:Math.atan2(e,t)*gy,skewX:Math.atan(d)*gy,scaleX:c,scaleY:u}}var Gl;function Rk(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?hd:yy(e.a,e.b,e.c,e.d,e.e,e.f)}function kk(t){return t==null||(Gl||(Gl=document.createElementNS("http://www.w3.org/2000/svg","g")),Gl.setAttribute("transform",t),!(t=Gl.transform.baseVal.consolidate()))?hd:(t=t.matrix,yy(t.a,t.b,t.c,t.d,t.e,t.f))}function vy(t,e,n,i){function s(h){return h.length?h.pop()+" ":""}function l(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:Gn(h,m)},{i:w-2,x:Gn(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:Gn(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:Gn(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:Gn(h,m)},{i:w-2,x:Gn(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),l(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 Ok=vy(Rk,"px, ","px)","deg)"),Dk=vy(kk,", ",")",")"),jk=1e-12;function by(t){return((t=Math.exp(t))+1/t)/2}function zk(t){return((t=Math.exp(t))-1/t)/2}function Vk(t){return((t=Math.exp(2*t))-1)/(t+1)}const ql=(function t(e,n,i){function s(l,c){var u=l[0],d=l[1],h=l[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<jk)E=Math.log(y/h)/e,S=function(k){return[u+k*b,d+k*x,h*Math.exp(e*k*E)]};else{var O=Math.sqrt(w),C=(y*y-h*h+i*w)/(2*h*n*O),_=(y*y-h*h-i*w)/(2*y*n*O),R=Math.log(Math.sqrt(C*C+1)-C),A=Math.log(Math.sqrt(_*_+1)-_);E=(A-R)/e,S=function(k){var D=k*E,H=by(R),Y=h/(n*O)*(H*Vk(e*D+R)-zk(R));return[u+Y*b,d+Y*x,h*H/by(e*D+R)]}}return S.duration=E*1e3*e/Math.SQRT2,S}return s.rho=function(l){var c=Math.max(.001,+l),u=c*c,d=u*u;return t(c,u,d)},s})(Math.SQRT2,2,4);var wr=0,qs=0,Xs=0,xy=1e3,Xl,Fs,Fl=0,ji=0,Zl=0,Zs=typeof performance=="object"&&performance.now?performance:Date,wy=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function pd(){return ji||(wy(Lk),ji=Zs.now()+Zl)}function Lk(){ji=0}function Kl(){this._call=this._time=this._next=null}Kl.prototype=Sy.prototype={constructor:Kl,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?pd():+n)+(e==null?0:+e),!this._next&&Fs!==this&&(Fs?Fs._next=this:Xl=this,Fs=this),this._call=t,this._time=n,md()},stop:function(){this._call&&(this._call=null,this._time=1/0,md())}};function Sy(t,e,n){var i=new Kl;return i.restart(t,e,n),i}function Ik(){pd(),++wr;for(var t=Xl,e;t;)(e=ji-t._time)>=0&&t._call.call(void 0,e),t=t._next;--wr}function Ey(){ji=(Fl=Zs.now())+Zl,wr=qs=0;try{Ik()}finally{wr=0,Pk(),ji=0}}function Bk(){var t=Zs.now(),e=t-Fl;e>xy&&(Zl-=e,Fl=t)}function Pk(){for(var t,e=Xl,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:Xl=n);Fs=t,md(i)}function md(t){if(!wr){qs&&(qs=clearTimeout(qs));var e=t-ji;e>24?(t<1/0&&(qs=setTimeout(Ey,t-Zs.now()-Zl)),Xs&&(Xs=clearInterval(Xs))):(Xs||(Fl=Zs.now(),Xs=setInterval(Bk,xy)),wr=1,wy(Ey))}}function _y(t,e,n){var i=new Kl;return e=e==null?0:+e,i.restart(s=>{i.stop(),t(s+e)},e,n),i}var Hk=zl("start","end","cancel","interrupt"),Uk=[],Cy=0,Ty=1,gd=2,Ql=3,Ny=4,yd=5,Wl=6;function Jl(t,e,n,i,s,l){var c=t.__transition;if(!c)t.__transition={};else if(n in c)return;$k(t,n,{name:e,index:i,group:s,on:Hk,tween:Uk,time:l.time,delay:l.delay,duration:l.duration,ease:l.ease,timer:null,state:Cy})}function vd(t,e){var n=An(t,e);if(n.state>Cy)throw new Error("too late; already scheduled");return n}function qn(t,e){var n=An(t,e);if(n.state>Ql)throw new Error("too late; already running");return n}function An(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function $k(t,e,n){var i=t.__transition,s;i[e]=n,n.timer=Sy(l,0,n.time);function l(h){n.state=Ty,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!==Ty)return d();for(p in i)if(b=i[p],b.name===n.name){if(b.state===Ql)return _y(c);b.state===Ny?(b.state=Wl,b.timer.stop(),b.on.call("interrupt",t,t.__data__,b.index,b.group),delete i[p]):+p<e&&(b.state=Wl,b.timer.stop(),b.on.call("cancel",t,t.__data__,b.index,b.group),delete i[p])}if(_y(function(){n.state===Ql&&(n.state=Ny,n.timer.restart(u,n.delay,n.time),u(h))}),n.state=gd,n.on.call("start",t,t.__data__,n.index,n.group),n.state===gd){for(n.state=Ql,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=yd,1),m=-1,y=s.length;++m<y;)s[m].call(t,p);n.state===yd&&(n.on.call("end",t,t.__data__,n.index,n.group),d())}function d(){n.state=Wl,n.timer.stop(),delete i[e];for(var h in i)return;delete t.__transition}}function tc(t,e){var n=t.__transition,i,s,l=!0,c;if(n){e=e==null?null:e+"";for(c in n){if((i=n[c]).name!==e){l=!1;continue}s=i.state>gd&&i.state<yd,i.state=Wl,i.timer.stop(),i.on.call(s?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete n[c]}l&&delete t.__transition}}function Yk(t){return this.each(function(){tc(this,t)})}function Gk(t,e){var n,i;return function(){var s=qn(this,t),l=s.tween;if(l!==n){i=n=l;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 qk(t,e,n){var i,s;if(typeof n!="function")throw new Error;return function(){var l=qn(this,t),c=l.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)}l.tween=s}}function Xk(t,e){var n=this._id;if(t+="",arguments.length<2){for(var i=An(this.node(),n).tween,s=0,l=i.length,c;s<l;++s)if((c=i[s]).name===t)return c.value;return null}return this.each((e==null?Gk:qk)(n,t,e))}function bd(t,e,n){var i=t._id;return t.each(function(){var s=qn(this,i);(s.value||(s.value={}))[e]=n.apply(this,arguments)}),function(s){return An(s,i).value[e]}}function Ay(t,e){var n;return(typeof e=="number"?Gn:e instanceof ki?Yl:(n=ki(e))?(e=n,Yl):my)(t,e)}function Fk(t){return function(){this.removeAttribute(t)}}function Zk(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Kk(t,e,n){var i,s=n+"",l;return function(){var c=this.getAttribute(t);return c===s?null:c===i?l:l=e(i=c,n)}}function Qk(t,e,n){var i,s=n+"",l;return function(){var c=this.getAttributeNS(t.space,t.local);return c===s?null:c===i?l:l=e(i=c,n)}}function Wk(t,e,n){var i,s,l;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?l:(s=d,l=e(i=c,u)))}}function Jk(t,e,n){var i,s,l;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?l:(s=d,l=e(i=c,u)))}}function t3(t,e){var n=Ll(t),i=n==="transform"?Dk:Ay;return this.attrTween(t,typeof e=="function"?(n.local?Jk:Wk)(n,i,bd(this,"attr."+t,e)):e==null?(n.local?Zk:Fk)(n):(n.local?Qk:Kk)(n,i,e))}function e3(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function n3(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function o3(t,e){var n,i;function s(){var l=e.apply(this,arguments);return l!==i&&(n=(i=l)&&n3(t,l)),n}return s._value=e,s}function i3(t,e){var n,i;function s(){var l=e.apply(this,arguments);return l!==i&&(n=(i=l)&&e3(t,l)),n}return s._value=e,s}function r3(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=Ll(t);return this.tween(n,(i.local?o3:i3)(i,e))}function s3(t,e){return function(){vd(this,t).delay=+e.apply(this,arguments)}}function a3(t,e){return e=+e,function(){vd(this,t).delay=e}}function l3(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?s3:a3)(e,t)):An(this.node(),e).delay}function c3(t,e){return function(){qn(this,t).duration=+e.apply(this,arguments)}}function u3(t,e){return e=+e,function(){qn(this,t).duration=e}}function f3(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?c3:u3)(e,t)):An(this.node(),e).duration}function d3(t,e){if(typeof e!="function")throw new Error;return function(){qn(this,t).ease=e}}function h3(t){var e=this._id;return arguments.length?this.each(d3(e,t)):An(this.node(),e).ease}function p3(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;qn(this,t).ease=n}}function m3(t){if(typeof t!="function")throw new Error;return this.each(p3(this._id,t))}function g3(t){typeof t!="function"&&(t=G0(t));for(var e=this._groups,n=e.length,i=new Array(n),s=0;s<n;++s)for(var l=e[s],c=l.length,u=i[s]=[],d,h=0;h<c;++h)(d=l[h])&&t.call(d,d.__data__,h,l)&&u.push(d);return new ao(i,this._parents,this._name,this._id)}function y3(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,i=e.length,s=n.length,l=Math.min(i,s),c=new Array(i),u=0;u<l;++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 ao(c,this._parents,this._name,this._id)}function v3(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 b3(t,e,n){var i,s,l=v3(e)?vd:qn;return function(){var c=l(this,t),u=c.on;u!==i&&(s=(i=u).copy()).on(e,n),c.on=s}}function x3(t,e){var n=this._id;return arguments.length<2?An(this.node(),n).on.on(t):this.each(b3(n,t,e))}function w3(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function S3(){return this.on("end.remove",w3(this._id))}function E3(t){var e=this._name,n=this._id;typeof t!="function"&&(t=od(t));for(var i=this._groups,s=i.length,l=new Array(s),c=0;c<s;++c)for(var u=i[c],d=u.length,h=l[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,Jl(h[y],e,n,y,h,An(p,n)));return new ao(l,this._parents,e,n)}function _3(t){var e=this._name,n=this._id;typeof t!="function"&&(t=Y0(t));for(var i=this._groups,s=i.length,l=[],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=An(p,n),w=0,S=y.length;w<S;++w)(b=y[w])&&Jl(b,e,n,w,y,x);l.push(y),c.push(p)}return new ao(l,c,e,n)}var C3=Ps.prototype.constructor;function T3(){return new C3(this._groups,this._parents)}function N3(t,e){var n,i,s;return function(){var l=vr(this,t),c=(this.style.removeProperty(t),vr(this,t));return l===c?null:l===n&&c===i?s:s=e(n=l,i=c)}}function My(t){return function(){this.style.removeProperty(t)}}function A3(t,e,n){var i,s=n+"",l;return function(){var c=vr(this,t);return c===s?null:c===i?l:l=e(i=c,n)}}function M3(t,e,n){var i,s,l;return function(){var c=vr(this,t),u=n(this),d=u+"";return u==null&&(d=u=(this.style.removeProperty(t),vr(this,t))),c===d?null:c===i&&d===s?l:(s=d,l=e(i=c,u))}}function R3(t,e){var n,i,s,l="style."+e,c="end."+l,u;return function(){var d=qn(this,t),h=d.on,p=d.value[l]==null?u||(u=My(e)):void 0;(h!==n||s!==p)&&(i=(n=h).copy()).on(c,s=p),d.on=i}}function k3(t,e,n){var i=(t+="")=="transform"?Ok:Ay;return e==null?this.styleTween(t,N3(t,i)).on("end.style."+t,My(t)):typeof e=="function"?this.styleTween(t,M3(t,i,bd(this,"style."+t,e))).each(R3(this._id,t)):this.styleTween(t,A3(t,i,e),n).on("end.style."+t,null)}function O3(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function D3(t,e,n){var i,s;function l(){var c=e.apply(this,arguments);return c!==s&&(i=(s=c)&&O3(t,c,n)),i}return l._value=e,l}function j3(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,D3(t,e,n??""))}function z3(t){return function(){this.textContent=t}}function V3(t){return function(){var e=t(this);this.textContent=e??""}}function L3(t){return this.tween("text",typeof t=="function"?V3(bd(this,"text",t)):z3(t==null?"":t+""))}function I3(t){return function(e){this.textContent=t.call(this,e)}}function B3(t){var e,n;function i(){var s=t.apply(this,arguments);return s!==n&&(e=(n=s)&&I3(s)),e}return i._value=t,i}function P3(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,B3(t))}function H3(){for(var t=this._name,e=this._id,n=Ry(),i=this._groups,s=i.length,l=0;l<s;++l)for(var c=i[l],u=c.length,d,h=0;h<u;++h)if(d=c[h]){var p=An(d,e);Jl(d,t,n,h,c,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new ao(i,this._parents,t,n)}function U3(){var t,e,n=this,i=n._id,s=n.size();return new Promise(function(l,c){var u={value:c},d={value:function(){--s===0&&l()}};n.each(function(){var h=qn(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&&l()})}var $3=0;function ao(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function Ry(){return++$3}var lo=Ps.prototype;ao.prototype={constructor:ao,select:E3,selectAll:_3,selectChild:lo.selectChild,selectChildren:lo.selectChildren,filter:g3,merge:y3,selection:T3,transition:H3,call:lo.call,nodes:lo.nodes,node:lo.node,size:lo.size,empty:lo.empty,each:lo.each,on:x3,attr:t3,attrTween:r3,style:k3,styleTween:j3,text:L3,textTween:P3,remove:S3,tween:Xk,delay:l3,duration:f3,ease:h3,easeVarying:m3,end:U3,[Symbol.iterator]:lo[Symbol.iterator]};function Y3(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var G3={time:null,delay:0,duration:250,ease:Y3};function q3(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 X3(t){var e,n;t instanceof ao?(e=t._id,t=t._name):(e=Ry(),(n=G3).time=pd(),t=t==null?null:t+"");for(var i=this._groups,s=i.length,l=0;l<s;++l)for(var c=i[l],u=c.length,d,h=0;h<u;++h)(d=c[h])&&Jl(d,t,e,h,c,n||q3(d,e));return new ao(i,this._parents,t,e)}Ps.prototype.interrupt=Yk,Ps.prototype.transition=X3;const ec=t=>()=>t;function F3(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 co(t,e,n){this.k=t,this.x=e,this.y=n}co.prototype={constructor:co,scale:function(t){return t===1?this:new co(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new co(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 nc=new co(1,0,0);ky.prototype=co.prototype;function ky(t){for(;!t.__zoom;)if(!(t=t.parentNode))return nc;return t.__zoom}function xd(t){t.stopImmediatePropagation()}function Ks(t){t.preventDefault(),t.stopImmediatePropagation()}function Z3(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function K3(){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 Oy(){return this.__zoom||nc}function Q3(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function W3(){return navigator.maxTouchPoints||"ontouchstart"in this}function J3(t,e,n){var i=t.invertX(e[0][0])-n[0][0],s=t.invertX(e[1][0])-n[1][0],l=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>l?(l+c)/2:Math.min(0,l)||Math.max(0,c))}function Dy(){var t=Z3,e=K3,n=J3,i=Q3,s=W3,l=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,d=ql,h=zl("start","zoom","end"),p,m,y,b=500,x=150,w=0,S=10;function E(B){B.property("__zoom",Oy).on("wheel.zoom",D,{passive:!1}).on("mousedown.zoom",H).on("dblclick.zoom",Y).filter(s).on("touchstart.zoom",$).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",Oy),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,G=j==null?_(z):typeof j=="function"?j.apply(this,arguments):j,L=U.invert(G),q=typeof P=="function"?P.apply(this,arguments):P;return n(C(O(U,q),G,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),G=this.__zoom,L=I==null?_(U):typeof I=="function"?I.apply(this,arguments):I;return n(nc.translate(L[0],L[1]).scale(G.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof j=="function"?-j.apply(this,arguments):-j),U,c)},I,z)};function O(B,P){return P=Math.max(l[0],Math.min(l[1],P)),P===B.k?B:new co(P,B.x,B.y)}function C(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 co(B.k,I,z)}function _(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,G=A(z,U).event(I),L=e.apply(z,U),q=j==null?_(L):typeof j=="function"?j.apply(z,U):j,tt=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),rt=z.__zoom,ct=typeof P=="function"?P.apply(z,U):P,ht=d(rt.invert(q).concat(tt/rt.k),ct.invert(q).concat(tt/ct.k));return function(ft){if(ft===1)ft=ct;else{var ut=ht(ft),dt=tt/ut[2];ft=new co(dt,q[0]-ut[0]*dt,q[1]-ut[1]*dt)}G.zoom(null,ft)}})}function A(B,P,j){return!j&&B.__zooming||new k(B,P)}function k(B,P){this.that=B,this.args=P,this.active=0,this.sourceEvent=null,this.extent=e.apply(B,P),this.taps=0}k.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=on(this.that).datum();h.call(B,this.that,new F3(B,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:h}),P)}};function D(B,...P){if(!t.apply(this,arguments))return;var j=A(this,P).event(B),I=this.__zoom,z=Math.max(l[0],Math.min(l[1],I.k*Math.pow(2,i.apply(this,arguments)))),U=Tn(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)],tc(this),j.start()}Ks(B),j.wheel=setTimeout(G,x),j.zoom("mouse",n(C(O(I,z),j.mouse[0],j.mouse[1]),j.extent,c));function G(){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=on(B.view).on("mousemove.zoom",q,!0).on("mouseup.zoom",tt,!0),U=Tn(B,j),G=B.clientX,L=B.clientY;ey(B.view),xd(B),I.mouse=[U,this.__zoom.invert(U)],tc(this),I.start();function q(rt){if(Ks(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]=Tn(rt,j),I.mouse[1]),I.extent,c))}function tt(rt){z.on("mousemove.zoom mouseup.zoom",null),ny(rt.view,I.moved),Ks(rt),I.event(rt).end()}}function Y(B,...P){if(t.apply(this,arguments)){var j=this.__zoom,I=Tn(B.changedTouches?B.changedTouches[0]:B,this),z=j.invert(I),U=j.k*(B.shiftKey?.5:2),G=n(C(O(j,U),I,z),e.apply(this,P),c);Ks(B),u>0?on(this).transition().duration(u).call(R,G,I,B):on(this).call(E.transform,G,I,B)}}function $(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,G,L,q;for(xd(B),G=0;G<I;++G)L=j[G],q=Tn(L,this),q=[q,this.__zoom.invert(q),L.identifier],z.touch0?!z.touch1&&z.touch0[2]!==q[2]&&(z.touch1=q,z.taps=0):(z.touch0=q,U=!0,z.taps=1+!!p);p&&(p=clearTimeout(p)),U&&(z.taps<2&&(m=q[0],p=setTimeout(function(){p=null},b)),tc(this),z.start())}}function F(B,...P){if(this.__zooming){var j=A(this,P).event(B),I=B.changedTouches,z=I.length,U,G,L,q;for(Ks(B),U=0;U<z;++U)G=I[U],L=Tn(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 tt=j.touch0[0],rt=j.touch0[1],ct=j.touch1[0],ht=j.touch1[1],ft=(ft=ct[0]-tt[0])*ft+(ft=ct[1]-tt[1])*ft,ut=(ut=ht[0]-rt[0])*ut+(ut=ht[1]-rt[1])*ut;G=O(G,Math.sqrt(ft/ut)),L=[(tt[0]+ct[0])/2,(tt[1]+ct[1])/2],q=[(rt[0]+ht[0])/2,(rt[1]+ht[1])/2]}else if(j.touch0)L=j.touch0[0],q=j.touch0[1];else return;j.zoom("touch",n(C(G,L,q),j.extent,c))}}function Q(B,...P){if(this.__zooming){var j=A(this,P).event(B),I=B.changedTouches,z=I.length,U,G;for(xd(B),y&&clearTimeout(y),y=setTimeout(function(){y=null},b),U=0;U<z;++U)G=I[U],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=Tn(G,this),Math.hypot(m[0]-G[0],m[1]-G[1])<S)){var L=on(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return E.wheelDelta=function(B){return arguments.length?(i=typeof B=="function"?B:ec(+B),E):i},E.filter=function(B){return arguments.length?(t=typeof B=="function"?B:ec(!!B),E):t},E.touchable=function(B){return arguments.length?(s=typeof B=="function"?B:ec(!!B),E):s},E.extent=function(B){return arguments.length?(e=typeof B=="function"?B:ec([[+B[0][0],+B[0][1]],[+B[1][0],+B[1][1]]]),E):e},E.scaleExtent=function(B){return arguments.length?(l[0]=+B[0],l[1]=+B[1],E):[l[0],l[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 Xn={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."},Qs=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],jy=["Enter"," ","Escape"],zy={"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 Sr;(function(t){t.Strict="strict",t.Loose="loose"})(Sr||(Sr={}));var zi;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(zi||(zi={}));var Ws;(function(t){t.Partial="partial",t.Full="full"})(Ws||(Ws={}));const Vy={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var Bo;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(Bo||(Bo={}));var oc;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(oc||(oc={}));var Nt;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(Nt||(Nt={}));const Ly={[Nt.Left]:Nt.Right,[Nt.Right]:Nt.Left,[Nt.Top]:Nt.Bottom,[Nt.Bottom]:Nt.Top};function Iy(t){return t===null?null:t?"valid":"invalid"}const By=t=>"id"in t&&"source"in t&&"target"in t,tO=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),wd=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),Js=(t,e=[0,0])=>{const{width:n,height:i}=uo(t),s=t.origin??e,l=n*s[0],c=i*s[1];return{x:t.position.x-l,y:t.position.y-c}},eO=(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 l=typeof s=="string";let c=!e.nodeLookup&&!l?s:void 0;e.nodeLookup&&(c=l?e.nodeLookup.get(s):wd(s)?s:e.nodeLookup.get(s.id));const u=c?sc(c,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return ic(i,u)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return rc(n)},ta=(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=ic(n,sc(s)),i=!0)}),i?rc(n):{x:0,y:0,width:0,height:0}},Sd=(t,e,[n,i,s]=[0,0,1],l=!1,c=!1)=>{const u={...oa(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=ea(u,_r(h)),S=(b??0)*(x??0),E=l&&w>0;(!h.internals.handleBounds||E||w>=S||h.dragging)&&d.push(h)}return d},nO=(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 oO(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 iO({nodes:t,width:e,height:n,panZoom:i,minZoom:s,maxZoom:l},c){if(t.size===0)return Promise.resolve(!0);const u=oO(t,c),d=ta(u),h=_d(d,e,n,c?.minZoom??s,c?.maxZoom??l,c?.padding??.1);return await i.setViewport(h,{duration:c?.duration,ease:c?.ease,interpolate:c?.interpolate}),Promise.resolve(!0)}function Py({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:i=[0,0],nodeExtent:s,onError:l}){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)l?.("005",Xn.error005());else{const b=u.measured.width,x=u.measured.height;b&&x&&(m=[[d,h],[d+b,h+x]])}else u&&Tr(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=Tr(m)?Vi(e,m,c.measured):e;return(c.measured.width===void 0||c.measured.height===void 0)&&l?.("015",Xn.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 rO({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:i,onBeforeDelete:s}){const l=new Set(t.map(y=>y.id)),c=[];for(const y of n){if(y.deletable===!1)continue;const b=l.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=nO(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 Er=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),Vi=(t={x:0,y:0},e,n)=>({x:Er(t.x,e[0][0],e[1][0]-(n?.width??0)),y:Er(t.y,e[0][1],e[1][1]-(n?.height??0))});function Hy(t,e,n){const{width:i,height:s}=uo(n),{x:l,y:c}=n.internals.positionAbsolute;return Vi(t,[[l,c],[l+i,c+s]],e)}const Uy=(t,e,n)=>t<e?Er(Math.abs(t-e),1,e)/e:t>n?-Er(Math.abs(t-n),1,e)/e:0,$y=(t,e,n=15,i=40)=>{const s=Uy(t.x,i,e.width-i)*n,l=Uy(t.y,i,e.height-i)*n;return[s,l]},ic=(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)}),Ed=({x:t,y:e,width:n,height:i})=>({x:t,y:e,x2:t+n,y2:e+i}),rc=({x:t,y:e,x2:n,y2:i})=>({x:t,y:e,width:n-t,height:i-e}),_r=(t,e=[0,0])=>{const{x:n,y:i}=wd(t)?t.internals.positionAbsolute:Js(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}},sc=(t,e=[0,0])=>{const{x:n,y:i}=wd(t)?t.internals.positionAbsolute:Js(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)}},Yy=(t,e)=>rc(ic(Ed(t),Ed(e))),ea=(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)},Gy=t=>Mn(t.width)&&Mn(t.height)&&Mn(t.x)&&Mn(t.y),Mn=t=>!isNaN(t)&&isFinite(t),sO=(t,e)=>{},na=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),oa=({x:t,y:e},[n,i,s],l=!1,c=[1,1])=>{const u={x:(t-n)/s,y:(e-i)/s};return l?na(u,c):u},ac=({x:t,y:e},[n,i,s])=>({x:t*s+n,y:e*s+i});function Cr(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 aO(t,e,n){if(typeof t=="string"||typeof t=="number"){const i=Cr(t,n),s=Cr(t,e);return{top:i,right:s,bottom:i,left:s,x:s*2,y:i*2}}if(typeof t=="object"){const i=Cr(t.top??t.y??0,n),s=Cr(t.bottom??t.y??0,n),l=Cr(t.left??t.x??0,e),c=Cr(t.right??t.x??0,e);return{top:i,right:c,bottom:s,left:l,x:l+c,y:i+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function lO(t,e,n,i,s,l){const{x:c,y:u}=ac(t,[e,n,i]),{x:d,y:h}=ac({x:t.x+t.width,y:t.y+t.height},[e,n,i]),p=s-d,m=l-h;return{left:Math.floor(c),top:Math.floor(u),right:Math.floor(p),bottom:Math.floor(m)}}const _d=(t,e,n,i,s,l)=>{const c=aO(l,e,n),u=(e-c.x)/t.width,d=(n-c.y)/t.height,h=Math.min(u,d),p=Er(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=lO(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}},ia=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function Tr(t){return t!=null&&t!=="parent"}function uo(t){return{width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}}function qy(t){return(t.measured?.width??t.width??t.initialWidth)!==void 0&&(t.measured?.height??t.height??t.initialHeight)!==void 0}function Xy(t,e={width:0,height:0},n,i,s){const l={...t},c=i.get(n);if(c){const u=c.origin||s;l.x+=c.internals.positionAbsolute.x-(e.width??0)*u[0],l.y+=c.internals.positionAbsolute.y-(e.height??0)*u[1]}return l}function Fy(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function cO(){let t,e;return{promise:new Promise((i,s)=>{t=i,e=s}),resolve:t,reject:e}}function uO(t){return{...zy,...t||{}}}function ra(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:i,containerBounds:s}){const{x:l,y:c}=Rn(t),u=oa({x:l-(s?.left??0),y:c-(s?.top??0)},i),{x:d,y:h}=n?na(u,e):u;return{xSnapped:d,ySnapped:h,...u}}const Cd=t=>({width:t.offsetWidth,height:t.offsetHeight}),Zy=t=>t?.getRootNode?.()||window?.document,fO=["INPUT","SELECT","TEXTAREA"];function Ky(t){const e=t.composedPath?.()?.[0]||t.target;return e?.nodeType!==1?!1:fO.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const Qy=t=>"clientX"in t,Rn=(t,e)=>{const n=Qy(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)}},Wy=(t,e,n,i,s)=>{const l=e.querySelectorAll(`.${t}`);return!l||!l.length?null:Array.from(l).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,...Cd(c)}})};function Jy({sourceX:t,sourceY:e,targetX:n,targetY:i,sourceControlX:s,sourceControlY:l,targetControlX:c,targetControlY:u}){const d=t*.125+s*.375+c*.375+n*.125,h=e*.125+l*.375+u*.375+i*.125,p=Math.abs(d-t),m=Math.abs(h-e);return[d,h,p,m]}function lc(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function tv({pos:t,x1:e,y1:n,x2:i,y2:s,c:l}){switch(t){case Nt.Left:return[e-lc(e-i,l),n];case Nt.Right:return[e+lc(i-e,l),n];case Nt.Top:return[e,n-lc(n-s,l)];case Nt.Bottom:return[e,n+lc(s-n,l)]}}function ev({sourceX:t,sourceY:e,sourcePosition:n=Nt.Bottom,targetX:i,targetY:s,targetPosition:l=Nt.Top,curvature:c=.25}){const[u,d]=tv({pos:n,x1:t,y1:e,x2:i,y2:s,c}),[h,p]=tv({pos:l,x1:i,y1:s,x2:t,y2:e,c}),[m,y,b,x]=Jy({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 nv({sourceX:t,sourceY:e,targetX:n,targetY:i}){const s=Math.abs(n-t)/2,l=n<t?n+s:n-s,c=Math.abs(i-e)/2,u=i<e?i+c:i-c;return[l,u,s,c]}function dO({sourceNode:t,targetNode:e,selected:n=!1,zIndex:i=0,elevateOnSelect:s=!1,zIndexMode:l="basic"}){if(l==="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 hO({sourceNode:t,targetNode:e,width:n,height:i,transform:s}){const l=ic(sc(t),sc(e));l.x===l.x2&&(l.x2+=1),l.y===l.y2&&(l.y2+=1);const c={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:i/s[2]};return ea(c,rc(l))>0}const pO=({source:t,sourceHandle:e,target:n,targetHandle:i})=>`xy-edge__${t}${e||""}-${n}${i||""}`,mO=(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)),gO=(t,e,n={})=>{if(!t.source||!t.target)return e;const i=n.getEdgeId||pO;let s;return By(t)?s={...t}:s={...t,id:i(t)},mO(s,e)?e:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,e.concat(s))};function ov({sourceX:t,sourceY:e,targetX:n,targetY:i}){const[s,l,c,u]=nv({sourceX:t,sourceY:e,targetX:n,targetY:i});return[`M ${t},${e}L ${n},${i}`,s,l,c,u]}const iv={[Nt.Left]:{x:-1,y:0},[Nt.Right]:{x:1,y:0},[Nt.Top]:{x:0,y:-1},[Nt.Bottom]:{x:0,y:1}},yO=({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},rv=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function vO({source:t,sourcePosition:e=Nt.Bottom,target:n,targetPosition:i=Nt.Top,center:s,offset:l,stepPosition:c}){const u=iv[e],d=iv[i],h={x:t.x+u.x*l,y:t.y+u.y*l},p={x:n.x+d.x*l,y:n.y+d.y*l},m=yO({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},O={x:0,y:0},[,,C,_]=nv({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}],k=[{x:h.x,y:S},{x:p.x,y:S}];u[y]===b?x=y==="x"?A:k:x=y==="x"?k:A}else{const A=[{x:h.x,y:p.y}],k=[{x:p.x,y:h.y}];if(y==="x"?x=u.x===b?k:A:x=u.y===b?A:k,e===i){const F=Math.abs(t[y]-n[y]);if(F<=l){const Q=Math.min(l-1,l-F);u[y]===b?E[y]=(h[y]>t[y]?-1:1)*Q:O[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:k)}const D={x:h.x+E.x,y:h.y+E.y},H={x:p.x+O.x,y:p.y+O.y},Y=Math.max(Math.abs(D.x-x[0].x),Math.abs(H.x-x[0].x)),$=Math.max(Math.abs(D.y-x[0].y),Math.abs(H.y-x[0].y));Y>=$?(w=(D.x+H.x)/2,S=x[0].y):(w=x[0].x,S=(D.y+H.y)/2)}return[[t,{x:h.x+E.x,y:h.y+E.y},...x,{x:p.x+O.x,y:p.y+O.y},n],w,S,C,_]}function bO(t,e,n,i){const s=Math.min(rv(t,e)/2,rv(e,n)/2,i),{x:l,y:c}=e;if(t.x===l&&l===n.x||t.y===c&&c===n.y)return`L${l} ${c}`;if(t.y===c){const h=t.x<n.x?-1:1,p=t.y<n.y?1:-1;return`L ${l+s*h},${c}Q ${l},${c} ${l},${c+s*p}`}const u=t.x<n.x?1:-1,d=t.y<n.y?-1:1;return`L ${l},${c+s*d}Q ${l},${c} ${l+s*u},${c}`}function Td({sourceX:t,sourceY:e,sourcePosition:n=Nt.Bottom,targetX:i,targetY:s,targetPosition:l=Nt.Top,borderRadius:c=5,centerX:u,centerY:d,offset:h=20,stepPosition:p=.5}){const[m,y,b,x,w]=vO({source:{x:t,y:e},sourcePosition:n,target:{x:i,y:s},targetPosition:l,center:{x:u,y:d},offset:h,stepPosition:p});return[m.reduce((E,O,C)=>{let _="";return C>0&&C<m.length-1?_=bO(m[C-1],O,m[C+1],c):_=`${C===0?"M":"L"}${O.x} ${O.y}`,E+=_,E},""),y,b,x,w]}function sv(t){return t&&!!(t.internals.handleBounds||t.handles?.length)&&!!(t.measured.width||t.width||t.initialWidth)}function xO(t){const{sourceNode:e,targetNode:n}=t;if(!sv(e)||!sv(n))return null;const i=e.internals.handleBounds||av(e.handles),s=n.internals.handleBounds||av(n.handles),l=lv(i?.source??[],t.sourceHandle),c=lv(t.connectionMode===Sr.Strict?s?.target??[]:(s?.target??[]).concat(s?.source??[]),t.targetHandle);if(!l||!c)return t.onError?.("008",Xn.error008(l?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const u=l?.position||Nt.Bottom,d=c?.position||Nt.Top,h=Li(e,l,u),p=Li(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 Li(t,e,n=Nt.Left,i=!1){const s=(e?.x??0)+t.internals.positionAbsolute.x,l=(e?.y??0)+t.internals.positionAbsolute.y,{width:c,height:u}=e??uo(t);if(i)return{x:s+c/2,y:l+u/2};switch(e?.position??n){case Nt.Top:return{x:s+c/2,y:l};case Nt.Right:return{x:s+c,y:l+u/2};case Nt.Bottom:return{x:s+c/2,y:l+u};case Nt.Left:return{x:s,y:l+u/2}}}function lv(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function Nd(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("&")}`:""}function wO(t,{id:e,defaultColor:n,defaultMarkerStart:i,defaultMarkerEnd:s}){const l=new Set;return t.reduce((c,u)=>([u.markerStart||i,u.markerEnd||s].forEach(d=>{if(d&&typeof d=="object"){const h=Nd(d,e);l.has(h)||(c.push({id:h,color:d.color||n,...d}),l.add(h))}}),c),[]).sort((c,u)=>c.id.localeCompare(u.id))}const cv=1e3,SO=10,Ad={nodeOrigin:[0,0],nodeExtent:Qs,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},EO={...Ad,checkEquality:!0};function Md(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=Md(Ad,n);for(const s of t.values())if(s.parentId)Od(s,t,e,i);else{const l=Js(s,i.nodeOrigin),c=Tr(s.extent)?s.extent:i.nodeExtent,u=Vi(l,c,uo(s));s.internals.positionAbsolute=u}}function CO(t,e){if(!t.handles)return t.measured?e?.internals.handleBounds:void 0;const n=[],i=[];for(const s of t.handles){const l={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(l):s.type==="target"&&i.push(l)}return{source:n,target:i}}function Rd(t){return t==="manual"}function kd(t,e,n,i={}){const s=Md(EO,i),l={i:0},c=new Map(e),u=s?.elevateNodesOnSelect&&!Rd(s.zIndexMode)?cv: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=Js(h,s.nodeOrigin),y=Tr(h.extent)?h.extent:s.nodeExtent,b=Vi(m,y,uo(h));p={...s.defaults,...h,measured:{width:h.measured?.width,height:h.measured?.height},internals:{positionAbsolute:b,handleBounds:CO(h,p),z:uv(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&&Od(p,e,n,i,l)}return d}function TO(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 Od(t,e,n,i,s){const{elevateNodesOnSelect:l,nodeOrigin:c,nodeExtent:u,zIndexMode:d}=Md(Ad,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}TO(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*SO),s&&p.internals.rootParentIndex!==void 0&&(s.i=p.internals.rootParentIndex);const m=l&&!Rd(d)?cv:0,{x:y,y:b,z:x}=NO(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 uv(t,e,n){const i=Mn(t.zIndex)?t.zIndex:0;return Rd(n)?i:i+(t.selected?e:0)}function NO(t,e,n,i,s,l){const{x:c,y:u}=e.internals.positionAbsolute,d=uo(t),h=Js(t,n),p=Tr(t.extent)?Vi(h,t.extent,d):h;let m=Vi({x:c+p.x,y:u+p.y},i,d);t.extent==="parent"&&(m=Hy(m,d,e));const y=uv(t,s,l),b=e.internals.z??0;return{x:m.x,y:m.y,z:b>=y?b+1:y}}function Dd(t,e,n,i=[0,0]){const s=[],l=new Map;for(const c of t){const u=e.get(c.parentId);if(!u)continue;const d=l.get(c.parentId)?.expandedRect??_r(u),h=Yy(d,c.rect);l.set(c.parentId,{expandedRect:h,parent:u})}return l.size>0&&l.forEach(({expandedRect:c,parent:u},d)=>{const h=u.internals.positionAbsolute,p=uo(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(O=>{t.some(C=>C.id===O.id)||s.push({id:O.id,type:"position",position:{x:O.position.x+y,y:O.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 AO(t,e,n,i,s,l,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=Cd(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 O=b.nodeElement.getBoundingClientRect(),C=Tr(x.extent)?x.extent:l;let{positionAbsolute:_}=x.internals;x.parentId&&x.extent==="parent"?_=Hy(_,w,e.get(x.parentId)):C&&(_=Vi(_,C,w));const R={...x,measured:w,internals:{...x.internals,positionAbsolute:_,handleBounds:{source:Wy("source",b.nodeElement,O,m,x.id),target:Wy("target",b.nodeElement,O,m,x.id)}}};e.set(x.id,R),x.parentId&&Od(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:_r(R,s)}))}}if(y.length>0){const b=Dd(y,e,n,s);h.push(...b)}return{changes:h,updatedInternals:d}}async function MO({delta:t,panZoom:e,transform:n,translateExtent:i,width:s,height:l}){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,l]],i),u=!!c&&(c.x!==n[0]||c.y!==n[1]||c.k!==n[2]);return Promise.resolve(u)}function fv(t,e,n,i,s,l){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)),l){c=`${s}-${t}-${l}`;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:l,sourceHandle:c=null,targetHandle:u=null}=i,d={edgeId:i.id,source:s,target:l,sourceHandle:c,targetHandle:u},h=`${s}-${c}--${l}-${u}`,p=`${l}-${u}--${s}-${c}`;fv("source",d,p,t,s,c),fv("target",d,h,t,l,u),e.set(i.id,i)}}function hv(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:hv(n,e):!1}function pv(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 RO(t,e,n,i){const s=new Map;for(const[l,c]of t)if((c.selected||c.id===i)&&(!c.parentId||!hv(c,t))&&(c.draggable||e&&typeof c.draggable>"u")){const u=t.get(l);u&&s.set(l,{id:l,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 jd({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 l=n.get(t)?.internals.userNode;return[l?{...l,position:e.get(t)?.position||l.position,dragging:i}:s[0],s]}function kO({dragItems:t,snapGrid:e,x:n,y:i}){const s=t.values().next().value;if(!s)return null;const l={x:n-s.distance.x,y:i-s.distance.y},c=na(l,e);return{x:c.x-l.x,y:c.y-l.y}}function OO({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:i,onDragStop:s}){let l={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:O,handleSelector:C,domNode:_,isSelectable:R,nodeId:A,nodeClickDistance:k=0}){y=on(_);function D({x:F,y:Q}){const{nodeLookup:B,nodeExtent:P,snapGrid:j,snapToGrid:I,nodeOrigin:z,onNodeDrag:U,onSelectionDrag:G,onError:L,updateNodePositions:q}=e();l={x:F,y:Q};let tt=!1;const rt=u.size>1,ct=rt&&P?Ed(ta(u)):null,ht=rt&&I?kO({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)}:na(dt,j));let kt=null;if(rt&&P&&!ut.extent&&ct){const{positionAbsolute:Tt}=ut.internals,Ot=Tt.x-ct.x+P[0][0],Xt=Tt.x+ut.measured.width-ct.x2+P[1][0],qt=Tt.y-ct.y+P[0][1],pt=Tt.y+ut.measured.height-ct.y2+P[1][1];kt=[[Ot,qt],[Xt,pt]]}const{position:At,positionAbsolute:bt}=Py({nodeId:ft,nextPosition:dt,nodeLookup:B,nodeExtent:kt||P,nodeOrigin:z,onError:L});tt=tt||ut.position.x!==At.x||ut.position.y!==At.y,ut.position=At,ut.internals.positionAbsolute=bt}if(x=x||tt,!!tt&&(q(u,!0),w&&(i||U||!A&&G))){const[ft,ut]=jd({nodeId:A,dragItems:u,nodeLookup:B});i?.(w,u,ft,ut),U?.(w,ft,ut),A||G?.(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]=$y(h,p,B);(j!==0||I!==0)&&(l.x=(l.x??0)-j/F[2],l.y=(l.y??0)-I/F[2],await Q({x:j,y:I})&&D(l)),c=requestAnimationFrame(H)}function Y(F){const{nodeLookup:Q,multiSelectionActive:B,nodesDraggable:P,transform:j,snapGrid:I,snapToGrid:z,selectNodesOnDrag:U,onNodeDragStart:G,onSelectionDragStart:L,unselectNodesAndEdges:q}=e();m=!0,(!U||!R)&&!B&&A&&(Q.get(A)?.selected||q()),R&&U&&A&&t?.(A);const tt=ra(F.sourceEvent,{transform:j,snapGrid:I,snapToGrid:z,containerBounds:p});if(l=tt,u=RO(Q,P,tt,A),u.size>0&&(n||G||!A&&L)){const[rt,ct]=jd({nodeId:A,dragItems:u,nodeLookup:Q});n?.(F.sourceEvent,u,rt,ct),G?.(F.sourceEvent,rt,ct),A||L?.(F.sourceEvent,ct)}}const $=oy().clickDistance(k).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&&Y(F),l=ra(F.sourceEvent,{transform:P,snapGrid:j,snapToGrid:I,containerBounds:p}),h=Rn(F.sourceEvent,p)}).on("drag",F=>{const{autoPanOnNodeDrag:Q,transform:B,snapGrid:P,snapToGrid:j,nodeDragThreshold:I,nodeLookup:z}=e(),U=ra(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 G=Rn(F.sourceEvent,p),L=G.x-h.x,q=G.y-h.y;Math.sqrt(L*L+q*q)>I&&Y(F)}(l.x!==U.xSnapped||l.y!==U.ySnapped)&&u&&m&&(h=Rn(F.sourceEvent,p),D(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]=jd({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&&(!O||!pv(Q,`.${O}`,_))&&(!C||pv(Q,C,_))});y.call($)}function E(){y?.on(".drag",null)}return{update:S,destroy:E}}function DO(t,e,n){const i=[],s={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const l of e.values())ea(s,_r(l))>0&&i.push(l);return i}const jO=250;function zO(t,e,n,i){let s=[],l=1/0;const c=DO(t,n,e+jO);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}=Li(u,h,h.position,!0),y=Math.sqrt(Math.pow(p-t.x,2)+Math.pow(m-t.y,2));y>e||(y<l?(s=[{...h,x:p,y:m}],l=y):y===l&&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 mv(t,e,n,i,s,l=!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&&l?{...d,...Li(c,d,d.position,!0)}:d}function gv(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function VO(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const yv=()=>!0;function LO(t,{connectionMode:e,connectionRadius:n,handleId:i,nodeId:s,edgeUpdaterType:l,isTarget:c,domNode:u,nodeLookup:d,lib:h,autoPanOnConnect:p,flowId:m,panBy:y,cancelConnection:b,onConnectStart:x,onConnect:w,onConnectEnd:S,isValidConnection:E=yv,onReconnectEnd:O,updateConnection:C,getTransform:_,getFromHandle:R,autoPanSpeed:A,dragThreshold:k=1,handleDomNode:D}){const H=Zy(t.target);let Y=0,$;const{x:F,y:Q}=Rn(t),B=gv(l,D),P=u?.getBoundingClientRect();let j=!1;if(!P||!B)return;const I=mv(s,B,i,d,e);if(!I)return;let z=Rn(t,P),U=!1,G=null,L=!1,q=null;function tt(){if(!p||!P)return;const[At,bt]=$y(z,P,A);y({x:At,y:bt}),Y=requestAnimationFrame(tt)}const rt={...I,nodeId:s,type:B,position:I.position},ct=d.get(s);let ft={inProgress:!0,isValid:null,from:Li(ct,rt,Nt.Left,!0),fromHandle:rt,fromPosition:rt.position,fromNode:ct,to:z,toHandle:null,toPosition:Ly[rt.position],toNode:null,pointer:z};function ut(){j=!0,C(ft),x?.(t,{nodeId:s,handleId:i,handleType:B})}k===0&&ut();function dt(At){if(!j){const{x:pt,y:gt}=Rn(At),vt=pt-F,mt=gt-Q;if(!(vt*vt+mt*mt>k*k))return;ut()}if(!R()||!rt){kt(At);return}const bt=_();z=Rn(At,P),$=zO(oa(z,bt,!1,[1,1]),n,d,rt),U||(tt(),U=!0);const Tt=vv(At,{handle:$,connectionMode:e,fromNodeId:s,fromHandleId:i,fromType:c?"target":"source",isValidConnection:E,doc:H,lib:h,flowId:m,nodeLookup:d});q=Tt.handleDomNode,G=Tt.connection,L=VO(!!$,Tt.isValid);const Ot=d.get(s),Xt=Ot?Li(Ot,rt,Nt.Left,!0):ft.from,qt={...ft,from:Xt,isValid:L,to:Tt.toHandle&&L?ac({x:Tt.toHandle.x,y:Tt.toHandle.y},bt):z,toHandle:Tt.toHandle,toPosition:L&&Tt.toHandle?Tt.toHandle.position:Ly[rt.position],toNode:Tt.toHandle?d.get(Tt.toHandle.nodeId):null,pointer:z};C(qt),ft=qt}function kt(At){if(!("touches"in At&&At.touches.length>0)){if(j){($||q)&&G&&L&&w?.(G);const{inProgress:bt,...Tt}=ft,Ot={...Tt,toPosition:ft.toHandle?ft.toPosition:null};S?.(At,Ot),l&&O?.(At,Ot)}b(),cancelAnimationFrame(Y),U=!1,L=!1,G=null,q=null,H.removeEventListener("mousemove",dt),H.removeEventListener("mouseup",kt),H.removeEventListener("touchmove",dt),H.removeEventListener("touchend",kt)}}H.addEventListener("mousemove",dt),H.addEventListener("mouseup",kt),H.addEventListener("touchmove",dt),H.addEventListener("touchend",kt)}function vv(t,{handle:e,connectionMode:n,fromNodeId:i,fromHandleId:s,fromType:l,doc:c,lib:u,flowId:d,isValidConnection:h=yv,nodeLookup:p}){const m=l==="target",y=e?c.querySelector(`.${u}-flow__handle[data-id="${d}-${e?.nodeId}-${e?.id}-${e?.type}"]`):null,{x:b,y:x}=Rn(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 O=gv(void 0,S),C=S.getAttribute("data-nodeid"),_=S.getAttribute("data-handleid"),R=S.classList.contains("connectable"),A=S.classList.contains("connectableend");if(!C||!O)return E;const k={source:m?C:i,sourceHandle:m?_:s,target:m?i:C,targetHandle:m?s:_};E.connection=k;const H=R&&A&&(n===Sr.Strict?m&&O==="source"||!m&&O==="target":C!==i||_!==s);E.isValid=H&&h(k),E.toHandle=mv(C,O,_,p,n,!0)}return E}const zd={onPointerDown:LO,isValid:vv};function IO({domNode:t,panZoom:e,getTransform:n,getViewScale:i}){const s=on(t);function l({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 _=n(),R=C.sourceEvent.ctrlKey&&ia()?10:1,A=-C.sourceEvent.deltaY*(C.sourceEvent.deltaMode===1?.05:C.sourceEvent.deltaMode?1:.002)*p,k=_[2]*Math.pow(2,A*R);e.scaleTo(k)};let w=[0,0];const S=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])},E=C=>{const _=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 k=i()*Math.max(_[2],Math.log(_[2]))*(b?-1:1),D={x:_[0]-A[0]*k,y:_[1]-A[1]*k},H=[[0,0],[d,h]];e.setViewportConstrained({x:D.x,y:D.y,zoom:_[2]},H,u)},O=Dy().on("start",S).on("zoom",m?E:null).on("zoom.wheel",y?x:null);s.call(O,{})}function c(){s.on("zoom",null)}return{update:l,destroy:c,pointer:Tn}}const cc=t=>({x:t.x,y:t.y,zoom:t.k}),Vd=({x:t,y:e,zoom:n})=>nc.translate(t,e).scale(n),Nr=(t,e)=>t.target.closest(`.${e}`),bv=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),BO=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,Ld=(t,e=0,n=BO,i=()=>{})=>{const s=typeof e=="number"&&e>0;return s||i(),s?t.transition().duration(e).ease(n).on("end",i):t},xv=t=>{const e=t.ctrlKey&&ia()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function PO({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:i,panOnScrollMode:s,panOnScrollSpeed:l,zoomOnPinch:c,onPanZoomStart:u,onPanZoom:d,onPanZoomEnd:h}){return p=>{if(Nr(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=Tn(p),E=xv(p),O=m*Math.pow(2,E);i.scaleTo(n,O,S,p);return}const y=p.deltaMode===1?20:1;let b=s===zi.Vertical?0:p.deltaX*y,x=s===zi.Horizontal?0:p.deltaY*y;!ia()&&p.shiftKey&&s!==zi.Vertical&&(b=p.deltaY*y,x=0),i.translateBy(n,-(b/m)*l,-(x/m)*l,{internal:!0});const w=cc(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 HO({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(i,s){const l=i.type==="wheel",c=!e&&l&&!i.ctrlKey,u=Nr(i,t);if(i.ctrlKey&&l&&u&&i.preventDefault(),c||u)return null;i.preventDefault(),n.call(this,i,s)}}function UO({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return i=>{if(i.sourceEvent?.internal)return;const s=cc(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 $O({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:i,onPanZoom:s}){return l=>{t.usedRightMouseButton=!!(n&&bv(e,t.mouseButton??0)),l.sourceEvent?.sync||i([l.transform.x,l.transform.y,l.transform.k]),s&&!l.sourceEvent?.internal&&s?.(l.sourceEvent,cc(l.transform))}}function YO({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:i,onPanZoomEnd:s,onPaneContextMenu:l}){return c=>{if(!c.sourceEvent?.internal&&(t.isZoomingOrPanning=!1,l&&bv(e,t.mouseButton??0)&&!t.usedRightMouseButton&&c.sourceEvent&&l(c.sourceEvent),t.usedRightMouseButton=!1,i(!1),s)){const u=cc(c.transform);t.prevViewport=u,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{s?.(c.sourceEvent,u)},n?150:0)}}}function GO({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:i,panOnScroll:s,zoomOnDoubleClick:l,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"&&(Nr(m,`${h}-flow__node`)||Nr(m,`${h}-flow__edge`)))return!0;if(!i&&!y&&!s&&!l&&!n||c||p&&!x||Nr(m,u)&&x||Nr(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 qO({domNode:t,minZoom:e,maxZoom:n,translateExtent:i,viewport:s,onPanZoom:l,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=Dy().scaleExtent([e,n]).translateExtent(i),y=on(t).call(m);O({x:s.x,y:s.y,zoom:Er(s.zoom,e,n)},[[0,0],[p.width,p.height]],i);const b=y.on("wheel.zoom"),x=y.on("dblclick.zoom");m.wheelDelta(xv);function w($,F){return y?new Promise(Q=>{m?.interpolate(F?.interpolate==="linear"?Gs:ql).transform(Ld(y,F?.duration,F?.ease,()=>Q(!0)),$)}):Promise.resolve(!1)}function S({noWheelClassName:$,noPanClassName:F,onPaneContextMenu:Q,userSelectionActive:B,panOnScroll:P,panOnDrag:j,panOnScrollMode:I,panOnScrollSpeed:z,preventScrolling:U,zoomOnPinch:G,zoomOnScroll:L,zoomOnDoubleClick:q,zoomActivationKeyPressed:tt,lib:rt,onTransformChange:ct,connectionInProgress:ht,paneClickDistance:ft,selectionOnDrag:ut}){B&&!h.isZoomingOrPanning&&E();const dt=P&&!tt&&!B;m.clickDistance(ut?1/0:!Mn(ft)||ft<0?0:ft);const kt=dt?PO({zoomPanValues:h,noWheelClassName:$,d3Selection:y,d3Zoom:m,panOnScrollMode:I,panOnScrollSpeed:z,zoomOnPinch:G,onPanZoomStart:c,onPanZoom:l,onPanZoomEnd:u}):HO({noWheelClassName:$,preventScrolling:U,d3ZoomHandler:b});if(y.on("wheel.zoom",kt,{passive:!1}),!B){const bt=UO({zoomPanValues:h,onDraggingChange:d,onPanZoomStart:c});m.on("start",bt);const Tt=$O({zoomPanValues:h,panOnDrag:j,onPaneContextMenu:!!Q,onPanZoom:l,onTransformChange:ct});m.on("zoom",Tt);const Ot=YO({zoomPanValues:h,panOnDrag:j,panOnScroll:P,onPaneContextMenu:Q,onPanZoomEnd:u,onDraggingChange:d});m.on("end",Ot)}const At=GO({zoomActivationKeyPressed:tt,panOnDrag:j,zoomOnScroll:L,panOnScroll:P,zoomOnDoubleClick:q,zoomOnPinch:G,userSelectionActive:B,noPanClassName:F,noWheelClassName:$,lib:rt,connectionInProgress:ht});m.filter(At),q?y.on("dblclick.zoom",x):y.on("dblclick.zoom",null)}function E(){m.on("zoom",null)}async function O($,F,Q){const B=Vd($),P=m?.constrain()(B,F,Q);return P&&await w(P),new Promise(j=>j(P))}async function C($,F){const Q=Vd($);return await w(Q,F),new Promise(B=>B(Q))}function _($){if(y){const F=Vd($),Q=y.property("__zoom");(Q.k!==$.zoom||Q.x!==$.x||Q.y!==$.y)&&m?.transform(y,F,null,{sync:!0})}}function R(){const $=y?ky(y.node()):{x:0,y:0,k:1};return{x:$.x,y:$.y,zoom:$.k}}function A($,F){return y?new Promise(Q=>{m?.interpolate(F?.interpolate==="linear"?Gs:ql).scaleTo(Ld(y,F?.duration,F?.ease,()=>Q(!0)),$)}):Promise.resolve(!1)}function k($,F){return y?new Promise(Q=>{m?.interpolate(F?.interpolate==="linear"?Gs:ql).scaleBy(Ld(y,F?.duration,F?.ease,()=>Q(!0)),$)}):Promise.resolve(!1)}function D($){m?.scaleExtent($)}function H($){m?.translateExtent($)}function Y($){const F=!Mn($)||$<0?0:$;m?.clickDistance(F)}return{update:S,destroy:E,setViewport:C,setViewportConstrained:O,getViewport:R,scaleTo:A,scaleBy:k,setScaleExtent:D,setTranslateExtent:H,syncViewport:_,setClickDistance:Y}}var Ar;(function(t){t.Line="line",t.Handle="handle"})(Ar||(Ar={}));function XO({width:t,prevWidth:e,height:n,prevHeight:i,affectsX:s,affectsY:l}){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&&l&&(d[1]=d[1]*-1),d}function wv(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 Po(t,e){return Math.max(0,e-t)}function Ho(t,e){return Math.max(0,t-e)}function uc(t,e,n){return Math.max(0,e-t,t-n)}function Sv(t,e){return t?!e:e}function FO(t,e,n,i,s,l,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:O}=i,{x:C,y:_,width:R,height:A,aspectRatio:k}=t;let D=Math.floor(p?b-t.pointerX:0),H=Math.floor(m?x-t.pointerY:0);const Y=R+(d?-D:D),$=A+(h?-H:H),F=-l[0]*R,Q=-l[1]*A;let B=uc(Y,w,S),P=uc($,E,O);if(c){let z=0,U=0;d&&D<0?z=Po(C+D+F,c[0][0]):!d&&D>0&&(z=Ho(C+Y+F,c[1][0])),h&&H<0?U=Po(_+H+Q,c[0][1]):!h&&H>0&&(U=Ho(_+$+Q,c[1][1])),B=Math.max(B,z),P=Math.max(P,U)}if(u){let z=0,U=0;d&&D>0?z=Ho(C+D,u[0][0]):!d&&D<0&&(z=Po(C+Y,u[1][0])),h&&H>0?U=Ho(_+H,u[0][1]):!h&&H<0&&(U=Po(_+$,u[1][1])),B=Math.max(B,z),P=Math.max(P,U)}if(s){if(p){const z=uc(Y/k,E,O)*k;if(B=Math.max(B,z),c){let U=0;!d&&!h||d&&!h&&y?U=Ho(_+Q+Y/k,c[1][1])*k:U=Po(_+Q+(d?D:-D)/k,c[0][1])*k,B=Math.max(B,U)}if(u){let U=0;!d&&!h||d&&!h&&y?U=Po(_+Y/k,u[1][1])*k:U=Ho(_+(d?D:-D)/k,u[0][1])*k,B=Math.max(B,U)}}if(m){const z=uc($*k,w,S)/k;if(P=Math.max(P,z),c){let U=0;!d&&!h||h&&!d&&y?U=Ho(C+$*k+F,c[1][0])/k:U=Po(C+(h?H:-H)*k+F,c[0][0])/k,P=Math.max(P,U)}if(u){let U=0;!d&&!h||h&&!d&&y?U=Po(C+$*k,u[1][0])/k:U=Ho(C+(h?H:-H)*k,u[0][0])/k,P=Math.max(P,U)}}}H=H+(H<0?P:-P),D=D+(D<0?B:-B),s&&(y?Y>$*k?H=(Sv(d,h)?-D:D)/k:D=(Sv(d,h)?-H:H)*k:p?(H=D/k,h=d):(D=H*k,d=h));const j=d?C+D:C,I=h?_+H:_;return{width:R+(d?-D:D),height:A+(h?-H:H),x:l[0]*D*(d?-1:1)+j,y:l[1]*H*(h?-1:1)+I}}const Ev={width:0,height:0,x:0,y:0},ZO={...Ev,pointerX:0,pointerY:0,aspectRatio:1};function KO(t){return[[0,0],[t.measured.width,t.measured.height]]}function QO(t,e,n){const i=e.position.x+t.position.x,s=e.position.y+t.position.y,l=t.measured.width??0,c=t.measured.height??0,u=n[0]*l,d=n[1]*c;return[[i-u,s-d],[i+l-u,s+c-d]]}function WO({domNode:t,nodeId:e,getStoreItems:n,onChange:i,onEnd:s}){const l=on(t);let c={controlDirection:wv("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={...Ev},O={...ZO};c={boundaries:p,resizeDirection:y,keepAspectRatio:m,controlDirection:wv(h)};let C,_=null,R=[],A,k,D,H=!1;const Y=oy().on("start",$=>{const{nodeLookup:F,transform:Q,snapGrid:B,snapToGrid:P,nodeOrigin:j,paneDomNode:I}=n();if(C=F.get(e),!C)return;_=I?.getBoundingClientRect()??null;const{xSnapped:z,ySnapped:U}=ra($.sourceEvent,{transform:Q,snapGrid:B,snapToGrid:P,containerBounds:_});E={width:C.measured.width??0,height:C.measured.height??0,x:C.position.x??0,y:C.position.y??0},O={...E,pointerX:z,pointerY:U,aspectRatio:E.width/E.height},A=void 0,C.parentId&&(C.extent==="parent"||C.expandParent)&&(A=F.get(C.parentId),k=A&&C.extent==="parent"?KO(A):void 0),R=[],D=void 0;for(const[G,L]of F)if(L.parentId===e&&(R.push({id:G,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){const q=QO(L,C,L.origin??j);D?D=[[Math.min(q[0][0],D[0][0]),Math.min(q[0][1],D[0][1])],[Math.max(q[1][0],D[1][0]),Math.max(q[1][1],D[1][1])]]:D=q}b?.($,{...E})}).on("drag",$=>{const{transform:F,snapGrid:Q,snapToGrid:B,nodeOrigin:P}=n(),j=ra($.sourceEvent,{transform:F,snapGrid:Q,snapToGrid:B,containerBounds:_}),I=[];if(!C)return;const{x:z,y:U,width:G,height:L}=E,q={},tt=C.origin??P,{width:rt,height:ct,x:ht,y:ft}=FO(O,c.controlDirection,j,c.boundaries,c.keepAspectRatio,tt,k,D),ut=rt!==G,dt=ct!==L,kt=ht!==z&&ut,At=ft!==U&&dt;if(!kt&&!At&&!ut&&!dt)return;if((kt||At||tt[0]===1||tt[1]===1)&&(q.x=kt?ht:E.x,q.y=At?ft:E.y,E.x=q.x,E.y=q.y,R.length>0)){const Xt=ht-z,qt=ft-U;for(const pt of R)pt.position={x:pt.position.x-Xt+tt[0]*(rt-G),y:pt.position.y-qt+tt[1]*(ct-L)},I.push(pt)}if((ut||dt)&&(q.width=ut&&(!c.resizeDirection||c.resizeDirection==="horizontal")?rt:E.width,q.height=dt&&(!c.resizeDirection||c.resizeDirection==="vertical")?ct:E.height,E.width=q.width,E.height=q.height),A&&C.expandParent){const Xt=tt[0]*(q.width??0);q.x&&q.x<Xt&&(E.x=Xt,O.x=O.x-(q.x-Xt));const qt=tt[1]*(q.height??0);q.y&&q.y<qt&&(E.y=qt,O.y=O.y-(q.y-qt))}const bt=XO({width:E.width,prevWidth:G,height:E.height,prevHeight:L,affectsX:c.controlDirection.affectsX,affectsY:c.controlDirection.affectsY}),Tt={...E,direction:bt};S?.($,Tt)!==!1&&(H=!0,x?.($,Tt),i(q,I))}).on("end",$=>{H&&(w?.($,{...E}),s?.({...E}),H=!1)});l.call(Y)}function d(){l.on(".drag",null)}return{update:u,destroy:d}}var Id={exports:{}},Bd={},Pd={exports:{}},Hd={};var _v;function JO(){if(_v)return Hd;_v=1;var t=Ls();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,l=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 l(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 Hd.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,Hd}var Cv;function tD(){return Cv||(Cv=1,Pd.exports=JO()),Pd.exports}var Tv;function eD(){if(Tv)return Bd;Tv=1;var t=Ls(),e=tD();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,l=t.useRef,c=t.useEffect,u=t.useMemo,d=t.useDebugValue;return Bd.useSyncExternalStoreWithSelector=function(h,p,m,y,b){var x=l(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(!O){if(O=!0,C=A,A=y(A),b!==void 0&&w.hasValue){var k=w.value;if(b(k,A))return _=k}return _=A}if(k=_,i(C,A))return k;var D=y(A);return b!==void 0&&b(k,D)?(C=A,k):(C=A,_=D)}var O=!1,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},Bd}var Nv;function nD(){return Nv||(Nv=1,Id.exports=eD()),Id.exports}var oD=nD();const iD=If(oD),rD={},Av=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:()=>{(rD?"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},sD=t=>t?Av(t):Av,{useDebugValue:aD}=Ai,{useSyncExternalStoreWithSelector:lD}=iD,cD=t=>t;function Mv(t,e=cD,n){const i=lD(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return aD(i),i}const Rv=(t,e)=>{const n=sD(t),i=(s,l=e)=>Mv(n,s,l);return Object.assign(i,n),i},uD=(t,e)=>t?Rv(t,e):Rv;function ce(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 Ud=S0();const fD=If(Ud),fc=N.createContext(null),dD=fc.Provider,kv=Xn.error001();function Gt(t,e){const n=N.useContext(fc);if(n===null)throw new Error(kv);return Mv(n,t,e)}function re(){const t=N.useContext(fc);if(t===null)throw new Error(kv);return N.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const Ov={display:"none"},hD={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Dv="react-flow__node-desc",jv="react-flow__edge-desc",pD="react-flow__aria-live",mD=t=>t.ariaLiveMessage,gD=t=>t.ariaLabelConfig;function yD({rfId:t}){const e=Gt(mD);return M.jsx("div",{id:`${pD}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:hD,children:e})}function vD({rfId:t,disableKeyboardA11y:e}){const n=Gt(gD);return M.jsxs(M.Fragment,{children:[M.jsx("div",{id:`${Dv}-${t}`,style:Ov,children:e?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),M.jsx("div",{id:`${jv}-${t}`,style:Ov,children:n["edge.a11yDescription.default"]}),!e&&M.jsx(yD,{rfId:t})]})}const sa=N.forwardRef(({position:t="top-left",children:e,className:n,style:i,...s},l)=>{const c=`${t}`.split("-");return M.jsx("div",{className:be(["react-flow__panel",n,...c]),style:i,ref:l,...s,children:e})});sa.displayName="Panel";function bD({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:M.jsx(sa,{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 xD=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}},dc=t=>t.id;function wD(t,e){return ce(t.selectedNodes.map(dc),e.selectedNodes.map(dc))&&ce(t.selectedEdges.map(dc),e.selectedEdges.map(dc))}function SD({onSelectionChange:t}){const e=re(),{selectedNodes:n,selectedEdges:i}=Gt(xD,wD);return N.useEffect(()=>{const s={nodes:n,edges:i};t?.(s),e.getState().onSelectionChangeHandlers.forEach(l=>l(s))},[n,i,t]),null}const ED=t=>!!t.onSelectionChangeHandlers;function _D({onSelectionChange:t}){const e=Gt(ED);return t||e?M.jsx(SD,{onSelectionChange:t}):null}const zv=[0,0],CD={x:0,y:0,zoom:1},Vv=[...["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"],TD=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}),Lv={translateExtent:Qs,nodeOrigin:zv,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function ND(t){const{setNodes:e,setEdges:n,setMinZoom:i,setMaxZoom:s,setTranslateExtent:l,setNodeExtent:c,reset:u,setDefaultNodesAndEdges:d}=Gt(TD,ce),h=re();N.useEffect(()=>(d(t.defaultNodes,t.defaultEdges),()=>{p.current=Lv,u()}),[]);const p=N.useRef(Lv);return N.useEffect(()=>{for(const m of Vv){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"?l(y):m==="nodeExtent"?c(y):m==="ariaLabelConfig"?h.setState({ariaLabelConfig:uO(y)}):m==="fitView"?h.setState({fitViewQueued:y}):m==="fitViewOptions"?h.setState({fitViewOptions:y}):h.setState({[m]:y})))}p.current=t},Vv.map(m=>t[m])),null}function Iv(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function AD(t){const[e,n]=N.useState(t==="system"?null:t);return N.useEffect(()=>{if(t!=="system"){n(t);return}const i=Iv(),s=()=>n(i?.matches?"dark":"light");return s(),i?.addEventListener("change",s),()=>{i?.removeEventListener("change",s)}},[t]),e!==null?e:Iv()?.matches?"dark":"light"}const Bv=typeof document<"u"?document:null;function aa(t=null,e={target:Bv,actInsideInputWithModifier:!0}){const[n,i]=N.useState(!1),s=N.useRef(!1),l=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??Bv,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)&&Ky(b))return!1;const w=Hv(b.code,u);if(l.current.add(b[w]),Pv(c,l.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=Hv(b.code,u);Pv(c,l.current,!0)?(i(!1),l.current.clear()):l.current.delete(b[x]),b.key==="Meta"&&l.current.clear(),s.current=!1},y=()=>{l.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 Pv(t,e,n){return t.filter(i=>n||i.length===e.size).some(i=>i.every(s=>e.has(s)))}function Hv(t,e){return e.includes(t)?"code":"key"}const MD=()=>{const t=re();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,l],panZoom:c}=t.getState();return c?(await c.setViewport({x:e.x??i,y:e.y??s,zoom:e.zoom??l},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:l,maxZoom:c,panZoom:u}=t.getState(),d=_d(e,i,s,l,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:l,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??l;return oa(h,i,m,p)},flowToScreenPosition:e=>{const{transform:n,domNode:i}=t.getState();if(!i)return e;const{x:s,y:l}=i.getBoundingClientRect(),c=ac(e,n);return{x:c.x+s,y:c.y+l}}}),[])};function Uv(t,e){const n=[],i=new Map,s=[];for(const l of t)if(l.type==="add"){s.push(l);continue}else if(l.type==="remove"||l.type==="replace")i.set(l.id,[l]);else{const c=i.get(l.id);c?c.push(l):i.set(l.id,[l])}for(const l of e){const c=i.get(l.id);if(!c){n.push(l);continue}if(c[0].type==="remove")continue;if(c[0].type==="replace"){n.push({...c[0].item});continue}const u={...l};for(const d of c)RD(d,u);n.push(u)}return s.length&&s.forEach(l=>{l.index!==void 0?n.splice(l.index,0,{...l.item}):n.push({...l.item})}),n}function RD(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 $v(t,e){return Uv(t,e)}function kD(t,e){return Uv(t,e)}function Ii(t,e){return{id:t,type:"select",selected:e}}function Mr(t,e=new Set,n=!1){const i=[];for(const[s,l]of t){const c=e.has(s);!(l.selected===void 0&&!c)&&l.selected!==c&&(n&&(l.selected=c),i.push(Ii(l.id,c)))}return i}function Yv({items:t=[],lookup:e}){const n=[],i=new Map(t.map(s=>[s.id,s]));for(const[s,l]of t.entries()){const c=e.get(l.id),u=c?.internals?.userNode??c;u!==void 0&&u!==l&&n.push({id:l.id,item:l,type:"replace"}),u===void 0&&n.push({item:l,type:"add",index:s})}for(const[s]of e)i.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function Gv(t){return{id:t.id,type:"remove"}}const qv=t=>tO(t),OD=t=>By(t);function Xv(t){return N.forwardRef(t)}const DD=typeof window<"u"?N.useLayoutEffect:N.useEffect;function Fv(t){const[e,n]=N.useState(BigInt(0)),[i]=N.useState(()=>jD(()=>n(s=>s+BigInt(1))));return DD(()=>{const s=i.get();s.length&&(t(s),i.reset())},[e]),i}function jD(t){let e=[];return{get:()=>e,reset:()=>{e=[]},push:n=>{e.push(n),t()}}}const Zv=N.createContext(null);function zD({children:t}){const e=re(),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=Yv({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:O,setNodes:C}=e.getState();E&&C(O)})},[]),i=Fv(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(Yv({items:b,lookup:y}))},[]),l=Fv(s),c=N.useMemo(()=>({nodeQueue:i,edgeQueue:l}),[]);return M.jsx(Zv.Provider,{value:c,children:t})}function VD(){const t=N.useContext(Zv);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const LD=t=>!!t.panZoom;function la(){const t=MD(),e=re(),n=VD(),i=Gt(LD),s=N.useMemo(()=>{const l=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=qv(m)?m:y.get(m.id),w=x.parentId?Xy(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 _r(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&&qv(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&&OD(S)?S:{...w,...S}}return w}))};return{getNodes:()=>e.getState().nodes.map(m=>({...m})),getNode:m=>l(m)?.internals.userNode,getInternalNode:l,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:O,onDelete:C,onBeforeDelete:_}=e.getState(),{nodes:R,edges:A}=await rO({nodesToRemove:m,edgesToRemove:y,nodes:b,edges:x,onBeforeDelete:_}),k=A.length>0,D=R.length>0;if(k){const H=A.map(Gv);S?.(A),O(H)}if(D){const H=R.map(Gv);w?.(R),E(H)}return(D||k)&&C?.({nodes:R,edges:A}),{deletedNodes:R,deletedEdges:A}},getIntersectingNodes:(m,y=!0,b)=>{const x=Gy(m),w=x?m:d(m),S=b!==void 0;return w?(b||e.getState().nodes).filter(E=>{const O=e.getState().nodeLookup.get(E.id);if(O&&!x&&(E.id===m.id||!O.internals.positionAbsolute))return!1;const C=_r(S?E:O),_=ea(C,w);return y&&_>0||_>=C.width*C.height||_>=w.width*w.height}):[]},isNodeIntersecting:(m,y,b=!0)=>{const w=Gy(m)?m:d(m);if(!w)return!1;const S=ea(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 eO(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??cO();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 Kv=t=>t.selected,ID=typeof window<"u"?window:void 0;function BD({deleteKeyCode:t,multiSelectionKeyCode:e}){const n=re(),{deleteElements:i}=la(),s=aa(t,{actInsideInputWithModifier:!1}),l=aa(e,{target:ID});N.useEffect(()=>{if(s){const{edges:c,nodes:u}=n.getState();i({nodes:u.filter(Kv),edges:c.filter(Kv)}),n.setState({nodesSelectionActive:!1})}},[s]),N.useEffect(()=>{n.setState({multiSelectionActive:l})},[l])}function PD(t){const e=re();N.useEffect(()=>{const n=()=>{if(!t.current||!(t.current.checkVisibility?.()??!0))return!1;const i=Cd(t.current);(i.height===0||i.width===0)&&e.getState().onError?.("004",Xn.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 hc={position:"absolute",width:"100%",height:"100%",top:0,left:0},HD=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function UD({onPaneContextMenu:t,zoomOnScroll:e=!0,zoomOnPinch:n=!0,panOnScroll:i=!1,panOnScrollSpeed:s=.5,panOnScrollMode:l=zi.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:O,paneClickDistance:C,selectionOnDrag:_}){const R=re(),A=N.useRef(null),{userSelectionActive:k,lib:D,connectionInProgress:H}=Gt(HD,ce),Y=aa(y),$=N.useRef();PD(A);const F=N.useCallback(Q=>{E?.({x:Q[0],y:Q[1],zoom:Q[2]}),O||R.setState({transform:Q})},[E,O]);return N.useEffect(()=>{if(A.current){$.current=qO({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}=$.current.getViewport();return R.setState({panZoom:$.current,transform:[Q,B,P],domNode:A.current.closest(".react-flow")}),()=>{$.current?.destroy()}}},[]),N.useEffect(()=>{$.current?.update({onPaneContextMenu:t,zoomOnScroll:e,zoomOnPinch:n,panOnScroll:i,panOnScrollSpeed:s,panOnScrollMode:l,zoomOnDoubleClick:c,panOnDrag:u,zoomActivationKeyPressed:Y,preventScrolling:b,noPanClassName:S,userSelectionActive:k,noWheelClassName:w,lib:D,onTransformChange:F,connectionInProgress:H,selectionOnDrag:_,paneClickDistance:C})},[t,e,n,i,s,l,c,u,Y,b,S,k,w,D,F,H,_,C]),M.jsx("div",{className:"react-flow__renderer",ref:A,style:hc,children:x})}const $D=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function YD(){const{userSelectionActive:t,userSelectionRect:e}=Gt($D,ce);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 $d=(t,e)=>n=>{n.target===e.current&&t?.(n)},GD=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,connectionInProgress:t.connection.inProgress,dragging:t.paneDragging});function qD({isSelecting:t,selectionKeyPressed:e,selectionMode:n=Ws.Full,panOnDrag:i,paneClickDistance:s,selectionOnDrag:l,onSelectionStart:c,onSelectionEnd:u,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:p,onPaneMouseEnter:m,onPaneMouseMove:y,onPaneMouseLeave:b,children:x}){const w=re(),{userSelectionActive:S,elementsSelectable:E,dragging:O,connectionInProgress:C}=Gt(GD,ce),_=E&&(t||S),R=N.useRef(null),A=N.useRef(),k=N.useRef(new Set),D=N.useRef(new Set),H=N.useRef(!1),Y=z=>{if(H.current||C){H.current=!1;return}d?.(z),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},$=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 G=z.target===R.current;if(!G&&!!z.target.closest(".nokey")||!t||!(l&&G||e)||z.button!==0||!z.isPrimary)return;z.target?.setPointerCapture?.(z.pointerId),H.current=!1;const{x:tt,y:rt}=Rn(z.nativeEvent,A.current);w.setState({userSelectionRect:{width:0,height:0,startX:tt,startY:rt,x:tt,y:rt}}),G||(z.stopPropagation(),z.preventDefault())},P=z=>{const{userSelectionRect:U,transform:G,nodeLookup:L,edgeLookup:q,connectionLookup:tt,triggerNodeChanges:rt,triggerEdgeChanges:ct,defaultEdgeOptions:ht,resetSelectedElements:ft}=w.getState();if(!A.current||!U)return;const{x:ut,y:dt}=Rn(z.nativeEvent,A.current),{startX:kt,startY:At}=U;if(!H.current){const qt=e?0:s;if(Math.hypot(ut-kt,dt-At)<=qt)return;ft(),c?.(z)}H.current=!0;const bt={startX:kt,startY:At,x:ut<kt?ut:kt,y:dt<At?dt:At,width:Math.abs(ut-kt),height:Math.abs(dt-At)},Tt=k.current,Ot=D.current;k.current=new Set(Sd(L,bt,G,n===Ws.Partial,!0).map(qt=>qt.id)),D.current=new Set;const Xt=ht?.selectable??!0;for(const qt of k.current){const pt=tt.get(qt);if(pt)for(const{edgeId:gt}of pt.values()){const vt=q.get(gt);vt&&(vt.selectable??Xt)&&D.current.add(gt)}}if(!Fy(Tt,k.current)){const qt=Mr(L,k.current,!0);rt(qt)}if(!Fy(Ot,D.current)){const qt=Mr(q,D.current);ct(qt)}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&&Y?.(z),w.setState({userSelectionActive:!1,userSelectionRect:null}),H.current&&(u?.(z),w.setState({nodesSelectionActive:k.current.size>0})))},I=i===!0||Array.isArray(i)&&i.includes(0);return M.jsxs("div",{className:be(["react-flow__pane",{draggable:I,dragging:O,selection:t}]),onClick:_?void 0:$d(Y,R),onContextMenu:$d($,R),onWheel:$d(F,R),onPointerEnter:_?void 0:m,onPointerMove:_?P:y,onPointerUp:_?j:void 0,onPointerDownCapture:_?B:void 0,onClickCapture:_?Q:void 0,onPointerLeave:b,ref:R,style:hc,children:[x,M.jsx(YD,{})]})}function Yd({id:t,store:e,unselect:n=!1,nodeRef:i}){const{addSelectedNodes:s,unselectNodesAndEdges:l,multiSelectionActive:c,nodeLookup:u,onError:d}=e.getState(),h=u.get(t);if(!h){d?.("012",Xn.error012(t));return}e.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&c)&&(l({nodes:[h],edges:[]}),requestAnimationFrame(()=>i?.current?.blur())):s([t])}function Qv({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:i,nodeId:s,isSelectable:l,nodeClickDistance:c}){const u=re(),[d,h]=N.useState(!1),p=N.useRef();return N.useEffect(()=>{p.current=OO({getStoreItems:()=>u.getState(),onNodeMouseDown:m=>{Yd({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:l,nodeId:s,nodeClickDistance:c}),()=>{p.current?.destroy()}},[n,i,e,l,t,s,c]),d}const XD=t=>e=>e.selected&&(e.draggable||t&&typeof e.draggable>"u");function Wv(){const t=re();return N.useCallback(n=>{const{nodeExtent:i,snapToGrid:s,snapGrid:l,nodesDraggable:c,onError:u,updateNodePositions:d,nodeLookup:h,nodeOrigin:p}=t.getState(),m=new Map,y=XD(c),b=s?l[0]:5,x=s?l[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 O={x:E.internals.positionAbsolute.x+w,y:E.internals.positionAbsolute.y+S};s&&(O=na(O,l));const{position:C,positionAbsolute:_}=Py({nodeId:E.id,nextPosition:O,nodeLookup:h,nodeExtent:i,nodeOrigin:p,onError:u});E.position=C,E.internals.positionAbsolute=_,m.set(E.id,E)}d(m)},[])}const Gd=N.createContext(null),FD=Gd.Provider;Gd.Consumer;const Jv=()=>N.useContext(Gd),ZD=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),KD=(t,e,n)=>i=>{const{connectionClickStartHandle:s,connectionMode:l,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:l===Sr.Strict?u?.type!==n:t!==u?.nodeId||e!==u?.id,connectionInProcess:!!u,clickConnectionInProcess:!!s,valid:p&&h}};function QD({type:t="source",position:e=Nt.Top,isValidConnection:n,isConnectable:i=!0,isConnectableStart:s=!0,isConnectableEnd:l=!0,id:c,onConnect:u,children:d,className:h,onMouseDown:p,onTouchStart:m,...y},b){const x=c||null,w=t==="target",S=re(),E=Jv(),{connectOnClick:O,noPanClassName:C,rfId:_}=Gt(ZD,ce),{connectingFrom:R,connectingTo:A,clickConnecting:k,isPossibleEndHandle:D,connectionInProcess:H,clickConnectionInProcess:Y,valid:$}=Gt(KD(E,x,t),ce);E||S.getState().onError?.("010",Xn.error010());const F=P=>{const{defaultEdgeOptions:j,onConnect:I,hasDefaultEdges:z}=S.getState(),U={...j,...P};if(z){const{edges:G,setEdges:L}=S.getState();L(gO(U,G))}I?.(U),u?.(U)},Q=P=>{if(!E)return;const j=Qy(P.nativeEvent);if(s&&(j&&P.button===0||!j)){const I=S.getState();zd.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:G,lib:L,rfId:q,nodeLookup:tt,connection:rt}=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 ct=Zy(P.target),ht=n||G,{connection:ft,isValid:ut}=zd.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:q,doc:ct,lib:L,nodeLookup:tt});ut&&ft&&F(ft);const dt=structuredClone(rt);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":`${_}-${E}-${x}-${t}`,className:be(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",C,h,{source:!w,target:w,connectable:i,connectablestart:s,connectableend:l,clickconnecting:k,connectingfrom:R,connectingto:A,valid:$,connectionindicator:i&&(!H||D)&&(H||Y?l:s)}]),onMouseDown:Q,onTouchStart:Q,onClick:O?B:void 0,ref:b,...y,children:d})}const Rr=N.memo(Xv(QD));function WD({data:t,isConnectable:e,sourcePosition:n=Nt.Bottom}){return M.jsxs(M.Fragment,{children:[t?.label,M.jsx(Rr,{type:"source",position:n,isConnectable:e})]})}function JD({data:t,isConnectable:e,targetPosition:n=Nt.Top,sourcePosition:i=Nt.Bottom}){return M.jsxs(M.Fragment,{children:[M.jsx(Rr,{type:"target",position:n,isConnectable:e}),t?.label,M.jsx(Rr,{type:"source",position:i,isConnectable:e})]})}function t5(){return null}function e5({data:t,isConnectable:e,targetPosition:n=Nt.Top}){return M.jsxs(M.Fragment,{children:[M.jsx(Rr,{type:"target",position:n,isConnectable:e}),t?.label]})}const pc={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},tb={input:WD,default:JD,output:e5,group:t5};function n5(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 o5=t=>{const{width:e,height:n,x:i,y:s}=ta(t.nodeLookup,{filter:l=>!!l.selected});return{width:Mn(e)?e:null,height:Mn(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 i5({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const i=re(),{width:s,height:l,transformString:c,userSelectionActive:u}=Gt(o5,ce),d=Wv(),h=N.useRef(null);N.useEffect(()=>{n||h.current?.focus({preventScroll:!0})},[n]);const p=!u&&s!==null&&l!==null;if(Qv({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(pc,b.key)&&(b.preventDefault(),d({direction:pc[b.key],factor:b.shiftKey?4:1}))};return M.jsx("div",{className:be(["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:l}})})}const eb=typeof window<"u"?window:void 0,r5=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function nb({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:l,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:O,zoomOnPinch:C,panOnScroll:_,panOnScrollSpeed:R,panOnScrollMode:A,zoomOnDoubleClick:k,panOnDrag:D,defaultViewport:H,translateExtent:Y,minZoom:$,maxZoom:F,preventScrolling:Q,onSelectionContextMenu:B,noWheelClassName:P,noPanClassName:j,disableKeyboardA11y:I,onViewportChange:z,isControlledViewport:U}){const{nodesSelectionActive:G,userSelectionActive:L}=Gt(r5,ce),q=aa(h,{target:eb}),tt=aa(w,{target:eb}),rt=tt||D,ct=tt||_,ht=p&&rt!==!0,ft=q||L||ht;return BD({deleteKeyCode:d,multiSelectionKeyCode:x}),M.jsx(UD,{onPaneContextMenu:l,elementsSelectable:E,zoomOnScroll:O,zoomOnPinch:C,panOnScroll:ct,panOnScrollSpeed:R,panOnScrollMode:A,zoomOnDoubleClick:k,panOnDrag:!q&&rt,defaultViewport:H,translateExtent:Y,minZoom:$,maxZoom:F,zoomActivationKeyCode:S,preventScrolling:Q,noWheelClassName:P,noPanClassName:j,onViewportChange:z,isControlledViewport:U,paneClickDistance:u,selectionOnDrag:ht,children:M.jsxs(qD,{onSelectionStart:y,onSelectionEnd:b,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:l,onPaneScroll:c,panOnDrag:rt,isSelecting:!!ft,selectionMode:m,selectionKeyPressed:q,paneClickDistance:u,selectionOnDrag:ht,children:[t,G&&M.jsx(i5,{onSelectionContextMenu:B,noPanClassName:j,disableKeyboardA11y:I})]})})}nb.displayName="FlowRenderer";const s5=N.memo(nb),a5=t=>e=>t?Sd(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 l5(t){return Gt(N.useCallback(a5(t),[t]),ce)}const c5=t=>t.updateNodeInternals;function u5(){const t=Gt(c5),[e]=N.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const i=new Map;n.forEach(s=>{const l=s.target.getAttribute("data-id");i.set(l,{id:l,nodeElement:s.target,force:!0})}),t(i)}));return N.useEffect(()=>()=>{e?.disconnect()},[e]),e}function f5({node:t,nodeType:e,hasDimensions:n,resizeObserver:i}){const s=re(),l=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(()=>{l.current&&!t.hidden&&(!p||c.current!==l.current)&&(c.current&&i?.unobserve(c.current),i?.observe(l.current),c.current=l.current)},[p,t.hidden]),N.useEffect(()=>()=>{c.current&&(i?.unobserve(c.current),c.current=null)},[]),N.useEffect(()=>{if(l.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:l.current,force:!0}]])))}},[t.id,e,t.sourcePosition,t.targetPosition]),l}function d5({id:t,onClick:e,onMouseEnter:n,onMouseMove:i,onMouseLeave:s,onContextMenu:l,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:O}){const{node:C,internals:_,isParent:R}=Gt(ut=>{const dt=ut.nodeLookup.get(t),kt=ut.parentLookup.has(t);return{node:dt,internals:dt.internals,isParent:kt}},ce);let A=C.type||"default",k=S?.[A]||tb[A];k===void 0&&(O?.("003",Xn.error003(A)),A="default",k=S?.default||tb.default);const D=!!(C.draggable||u&&typeof C.draggable>"u"),H=!!(C.selectable||d&&typeof C.selectable>"u"),Y=!!(C.connectable||h&&typeof C.connectable>"u"),$=!!(C.focusable||p&&typeof C.focusable>"u"),F=re(),Q=qy(C),B=f5({node:C,nodeType:A,hasDimensions:Q,resizeObserver:m}),P=Qv({nodeRef:B,disabled:C.hidden||!D,noDragClassName:y,handleSelector:C.dragHandle,nodeId:t,isSelectable:H,nodeClickDistance:E}),j=Wv();if(C.hidden)return null;const I=uo(C),z=n5(C),U=H||D||e||n||i||s,G=n?ut=>n(ut,{..._.userNode}):void 0,L=i?ut=>i(ut,{..._.userNode}):void 0,q=s?ut=>s(ut,{..._.userNode}):void 0,tt=l?ut=>l(ut,{..._.userNode}):void 0,rt=c?ut=>c(ut,{..._.userNode}):void 0,ct=ut=>{const{selectNodesOnDrag:dt,nodeDragThreshold:kt}=F.getState();H&&(!dt||!D||kt>0)&&Yd({id:t,store:F,nodeRef:B}),e&&e(ut,{..._.userNode})},ht=ut=>{if(!(Ky(ut.nativeEvent)||x)){if(jy.includes(ut.key)&&H){const dt=ut.key==="Escape";Yd({id:t,store:F,unselect:dt,nodeRef:B})}else if(D&&C.selected&&Object.prototype.hasOwnProperty.call(pc,ut.key)){ut.preventDefault();const{ariaLabelConfig:dt}=F.getState();F.setState({ariaLiveMessage:dt["node.a11yDescription.ariaLiveMessage"]({direction:ut.key.replace("Arrow","").toLowerCase(),x:~~_.positionAbsolute.x,y:~~_.positionAbsolute.y})}),j({direction:pc[ut.key],factor:ut.shiftKey?4:1})}}},ft=()=>{if(x||!B.current?.matches(":focus-visible"))return;const{transform:ut,width:dt,height:kt,autoPanOnNodeFocus:At,setCenter:bt}=F.getState();if(!At)return;Sd(new Map([[t,C]]),{x:0,y:0,width:dt,height:kt},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:be(["react-flow__node",`react-flow__node-${A}`,{[b]:D},C.className,{selected:C.selected,selectable:H,parent:R,draggable:D,dragging:P}]),ref:B,style:{zIndex:_.z,transform:`translate(${_.positionAbsolute.x}px,${_.positionAbsolute.y}px)`,pointerEvents:U?"all":"none",visibility:Q?"visible":"hidden",...C.style,...z},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:G,onMouseMove:L,onMouseLeave:q,onContextMenu:tt,onClick:ct,onDoubleClick:rt,onKeyDown:$?ht:void 0,tabIndex:$?0:void 0,onFocus:$?ft:void 0,role:C.ariaRole??($?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${Dv}-${w}`,"aria-label":C.ariaLabel,...C.domAttributes,children:M.jsx(FD,{value:t,children:M.jsx(k,{id:t,data:C.data,type:A,positionAbsoluteX:_.positionAbsolute.x,positionAbsoluteY:_.positionAbsolute.y,selected:C.selected??!1,selectable:H,draggable:D,deletable:C.deletable??!0,isConnectable:Y,sourcePosition:C.sourcePosition,targetPosition:C.targetPosition,dragging:P,dragHandle:C.dragHandle,zIndex:_.z,parentId:C.parentId,...I})})})}var h5=N.memo(d5);const p5=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function ob(t){const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:i,elementsSelectable:s,onError:l}=Gt(p5,ce),c=l5(t.onlyRenderVisibleElements),u=u5();return M.jsx("div",{className:"react-flow__nodes",style:hc,children:c.map(d=>M.jsx(h5,{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:l},d))})}ob.displayName="NodeRenderer";const m5=N.memo(ob);function g5(t){return Gt(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 l=n.nodeLookup.get(s.source),c=n.nodeLookup.get(s.target);l&&c&&hO({sourceNode:l,targetNode:c,width:n.width,height:n.height,transform:n.transform})&&i.push(s.id)}return i},[t]),ce)}const y5=({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"})},v5=({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"})},ib={[oc.Arrow]:y5,[oc.ArrowClosed]:v5};function b5(t){const e=re();return N.useMemo(()=>Object.prototype.hasOwnProperty.call(ib,t)?ib[t]:(e.getState().onError?.("009",Xn.error009(t)),null),[t])}const x5=({id:t,type:e,color:n,width:i=12.5,height:s=12.5,markerUnits:l="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const d=b5(e);return d?M.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${i}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:l,orient:u,refX:"0",refY:"0",children:M.jsx(d,{color:n,strokeWidth:c})}):null},rb=({defaultColor:t,rfId:e})=>{const n=Gt(l=>l.edges),i=Gt(l=>l.defaultEdgeOptions),s=N.useMemo(()=>wO(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(l=>M.jsx(x5,{id:l.id,type:l.type,color:l.color,width:l.width,height:l.height,markerUnits:l.markerUnits,strokeWidth:l.strokeWidth,orient:l.orient},l.id))})}):null};rb.displayName="MarkerDefinitions";var w5=N.memo(rb);function sb({x:t,y:e,label:n,labelStyle:i,labelShowBg:s=!0,labelBgStyle:l,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=be(["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:l,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}sb.displayName="EdgeText";const S5=N.memo(sb);function mc({path:t,labelX:e,labelY:n,label:i,labelStyle:s,labelShowBg:l,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:be(["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&&Mn(e)&&Mn(n)?M.jsx(S5,{x:e,y:n,label:i,labelStyle:s,labelShowBg:l,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d}):null]})}function ab({pos:t,x1:e,y1:n,x2:i,y2:s}){return t===Nt.Left||t===Nt.Right?[.5*(e+i),n]:[e,.5*(n+s)]}function lb({sourceX:t,sourceY:e,sourcePosition:n=Nt.Bottom,targetX:i,targetY:s,targetPosition:l=Nt.Top}){const[c,u]=ab({pos:n,x1:t,y1:e,x2:i,y2:s}),[d,h]=ab({pos:l,x1:i,y1:s,x2:t,y2:e}),[p,m,y,b]=Jy({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 cb(t){return N.memo(({id:e,sourceX:n,sourceY:i,targetX:s,targetY:l,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[O,C,_]=lb({sourceX:n,sourceY:i,sourcePosition:c,targetX:s,targetY:l,targetPosition:u}),R=t.isInternal?void 0:e;return M.jsx(mc,{id:R,path:O,labelX:C,labelY:_,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:S,interactionWidth:E})})}const E5=cb({isInternal:!1}),ub=cb({isInternal:!0});E5.displayName="SimpleBezierEdge",ub.displayName="SimpleBezierEdgeInternal";function fb(t){return N.memo(({id:e,sourceX:n,sourceY:i,targetX:s,targetY:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,sourcePosition:b=Nt.Bottom,targetPosition:x=Nt.Top,markerEnd:w,markerStart:S,pathOptions:E,interactionWidth:O})=>{const[C,_,R]=Td({sourceX:n,sourceY:i,sourcePosition:b,targetX:s,targetY:l,targetPosition:x,borderRadius:E?.borderRadius,offset:E?.offset,stepPosition:E?.stepPosition}),A=t.isInternal?void 0:e;return M.jsx(mc,{id:A,path:C,labelX:_,labelY:R,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:S,interactionWidth:O})})}const qd=fb({isInternal:!1}),db=fb({isInternal:!0});qd.displayName="SmoothStepEdge",db.displayName="SmoothStepEdgeInternal";function hb(t){return N.memo(({id:e,...n})=>{const i=t.isInternal?void 0:e;return M.jsx(qd,{...n,id:i,pathOptions:N.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const _5=hb({isInternal:!1}),pb=hb({isInternal:!0});_5.displayName="StepEdge",pb.displayName="StepEdgeInternal";function mb(t){return N.memo(({id:e,sourceX:n,sourceY:i,targetX:s,targetY:l,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:x,interactionWidth:w})=>{const[S,E,O]=ov({sourceX:n,sourceY:i,targetX:s,targetY:l}),C=t.isInternal?void 0:e;return M.jsx(mc,{id:C,path:S,labelX:E,labelY:O,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:x,interactionWidth:w})})}const C5=mb({isInternal:!1}),gb=mb({isInternal:!0});C5.displayName="StraightEdge",gb.displayName="StraightEdgeInternal";function yb(t){return N.memo(({id:e,sourceX:n,sourceY:i,targetX:s,targetY:l,sourcePosition:c=Nt.Bottom,targetPosition:u=Nt.Top,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:S,pathOptions:E,interactionWidth:O})=>{const[C,_,R]=ev({sourceX:n,sourceY:i,sourcePosition:c,targetX:s,targetY:l,targetPosition:u,curvature:E?.curvature}),A=t.isInternal?void 0:e;return M.jsx(mc,{id:A,path:C,labelX:_,labelY:R,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:S,interactionWidth:O})})}const T5=yb({isInternal:!1}),vb=yb({isInternal:!0});T5.displayName="BezierEdge",vb.displayName="BezierEdgeInternal";const bb={default:vb,straight:gb,step:pb,smoothstep:db,simplebezier:ub},xb={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},N5=(t,e,n)=>n===Nt.Left?t-e:n===Nt.Right?t+e:t,A5=(t,e,n)=>n===Nt.Top?t-e:n===Nt.Bottom?t+e:t,wb="react-flow__edgeupdater";function Sb({position:t,centerX:e,centerY:n,radius:i=10,onMouseDown:s,onMouseEnter:l,onMouseOut:c,type:u}){return M.jsx("circle",{onMouseDown:s,onMouseEnter:l,onMouseOut:c,className:be([wb,`${wb}-${u}`]),cx:N5(e,i,t),cy:A5(n,i,t),r:i,stroke:"transparent",fill:"transparent"})}function M5({isReconnectable:t,reconnectRadius:e,edge:n,sourceX:i,sourceY:s,targetX:l,targetY:c,sourcePosition:u,targetPosition:d,onReconnect:h,onReconnectStart:p,onReconnectEnd:m,setReconnecting:y,setUpdateHover:b}){const x=re(),w=(_,R)=>{if(_.button!==0)return;const{autoPanOnConnect:A,domNode:k,connectionMode:D,connectionRadius:H,lib:Y,onConnectStart:$,cancelConnection:F,nodeLookup:Q,rfId:B,panBy:P,updateConnection:j}=x.getState(),I=R.type==="target",z=(L,q)=>{y(!1),m?.(L,n,R.type,q)},U=L=>h?.(n,L),G=(L,q)=>{y(!0),p?.(_,n,R.type),$?.(L,q)};zd.onPointerDown(_.nativeEvent,{autoPanOnConnect:A,connectionMode:D,connectionRadius:H,domNode:k,handleId:R.id,nodeId:R.nodeId,nodeLookup:Q,isTarget:I,edgeUpdaterType:R.type,lib:Y,flowId:B,cancelConnection:F,panBy:P,isValidConnection:(...L)=>x.getState().isValidConnection?.(...L)??!0,onConnect:U,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:_.currentTarget})},S=_=>w(_,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),E=_=>w(_,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),O=()=>b(!0),C=()=>b(!1);return M.jsxs(M.Fragment,{children:[(t===!0||t==="source")&&M.jsx(Sb,{position:u,centerX:i,centerY:s,radius:e,onMouseDown:S,onMouseEnter:O,onMouseOut:C,type:"source"}),(t===!0||t==="target")&&M.jsx(Sb,{position:d,centerX:l,centerY:c,radius:e,onMouseDown:E,onMouseEnter:O,onMouseOut:C,type:"target"})]})}function R5({id:t,edgesFocusable:e,edgesReconnectable:n,elementsSelectable:i,onClick:s,onDoubleClick:l,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:O}){let C=Gt(bt=>bt.edgeLookup.get(t));const _=Gt(bt=>bt.defaultEdgeOptions);C=_?{..._,...C}:C;let R=C.type||"default",A=w?.[R]||bb[R];A===void 0&&(E?.("011",Xn.error011(R)),R="default",A=w?.default||bb.default);const k=!!(C.focusable||e&&typeof C.focusable>"u"),D=typeof m<"u"&&(C.reconnectable||n&&typeof C.reconnectable>"u"),H=!!(C.selectable||i&&typeof C.selectable>"u"),Y=N.useRef(null),[$,F]=N.useState(!1),[Q,B]=N.useState(!1),P=re(),{zIndex:j,sourceX:I,sourceY:z,targetX:U,targetY:G,sourcePosition:L,targetPosition:q}=Gt(N.useCallback(bt=>{const Tt=bt.nodeLookup.get(C.source),Ot=bt.nodeLookup.get(C.target);if(!Tt||!Ot)return{zIndex:C.zIndex,...xb};const Xt=xO({id:t,sourceNode:Tt,targetNode:Ot,sourceHandle:C.sourceHandle||null,targetHandle:C.targetHandle||null,connectionMode:bt.connectionMode,onError:E});return{zIndex:dO({selected:C.selected,zIndex:C.zIndex,sourceNode:Tt,targetNode:Ot,elevateOnSelect:bt.elevateEdgesOnSelect,zIndexMode:bt.zIndexMode}),...Xt||xb}},[C.source,C.target,C.sourceHandle,C.targetHandle,C.selected,C.zIndex]),ce),tt=N.useMemo(()=>C.markerStart?`url('#${Nd(C.markerStart,x)}')`:void 0,[C.markerStart,x]),rt=N.useMemo(()=>C.markerEnd?`url('#${Nd(C.markerEnd,x)}')`:void 0,[C.markerEnd,x]);if(C.hidden||I===null||z===null||U===null||G===null)return null;const ct=bt=>{const{addSelectedEdges:Tt,unselectNodesAndEdges:Ot,multiSelectionActive:Xt}=P.getState();H&&(P.setState({nodesSelectionActive:!1}),C.selected&&Xt?(Ot({nodes:[],edges:[C]}),Y.current?.blur()):Tt([t])),s&&s(bt,C)},ht=l?bt=>{l(bt,{...C})}:void 0,ft=c?bt=>{c(bt,{...C})}:void 0,ut=u?bt=>{u(bt,{...C})}:void 0,dt=d?bt=>{d(bt,{...C})}:void 0,kt=h?bt=>{h(bt,{...C})}:void 0,At=bt=>{if(!O&&jy.includes(bt.key)&&H){const{unselectNodesAndEdges:Tt,addSelectedEdges:Ot}=P.getState();bt.key==="Escape"?(Y.current?.blur(),Tt({edges:[C]})):Ot([t])}};return M.jsx("svg",{style:{zIndex:j},children:M.jsxs("g",{className:be(["react-flow__edge",`react-flow__edge-${R}`,C.className,S,{selected:C.selected,animated:C.animated,inactive:!H&&!s,updating:$,selectable:H}]),onClick:ct,onDoubleClick:ht,onContextMenu:ft,onMouseEnter:ut,onMouseMove:dt,onMouseLeave:kt,onKeyDown:k?At:void 0,tabIndex:k?0:void 0,role:C.ariaRole??(k?"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":k?`${jv}-${x}`:void 0,ref:Y,...C.domAttributes,children:[!Q&&M.jsx(A,{id:t,source:C.source,target:C.target,type:C.type,selected:C.selected,animated:C.animated,selectable:H,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:U,targetY:G,sourcePosition:L,targetPosition:q,data:C.data,style:C.style,sourceHandleId:C.sourceHandle,targetHandleId:C.targetHandle,markerStart:tt,markerEnd:rt,pathOptions:"pathOptions"in C?C.pathOptions:void 0,interactionWidth:C.interactionWidth}),D&&M.jsx(M5,{edge:C,isReconnectable:D,reconnectRadius:p,onReconnect:m,onReconnectStart:y,onReconnectEnd:b,sourceX:I,sourceY:z,targetX:U,targetY:G,sourcePosition:L,targetPosition:q,setUpdateHover:F,setReconnecting:B})]})})}var k5=N.memo(R5);const O5=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function Eb({defaultMarkerColor:t,onlyRenderVisibleElements:e,rfId:n,edgeTypes:i,noPanClassName:s,onReconnect:l,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:O,onError:C}=Gt(O5,ce),_=g5(e);return M.jsxs("div",{className:"react-flow__edges",children:[M.jsx(w5,{defaultColor:t,rfId:n}),_.map(R=>M.jsx(k5,{id:R,edgesFocusable:S,edgesReconnectable:E,elementsSelectable:O,noPanClassName:s,onReconnect:l,onContextMenu:c,onMouseEnter:u,onMouseMove:d,onMouseLeave:h,onClick:p,reconnectRadius:m,onDoubleClick:y,onReconnectStart:b,onReconnectEnd:x,rfId:n,onError:C,edgeTypes:i,disableKeyboardA11y:w},R))]})}Eb.displayName="EdgeRenderer";const D5=N.memo(Eb),j5=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function z5({children:t}){const e=Gt(j5);return M.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:e},children:t})}function V5(t){const e=la(),n=N.useRef(!1);N.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const L5=t=>t.panZoom?.syncViewport;function I5(t){const e=Gt(L5),n=re();return N.useEffect(()=>{t&&(e?.(t),n.setState({transform:[t.x,t.y,t.zoom]}))},[t,e]),null}function B5(t){return t.connection.inProgress?{...t.connection,to:oa(t.connection.to,t.transform)}:{...t.connection}}function P5(t){return B5}function H5(t){const e=P5();return Gt(e,ce)}const U5=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function $5({containerStyle:t,style:e,type:n,component:i}){const{nodesConnectable:s,width:l,height:c,isValid:u,inProgress:d}=Gt(U5,ce);return!(l&&s&&d)?null:M.jsx("svg",{style:t,width:l,height:c,className:"react-flow__connectionline react-flow__container",children:M.jsx("g",{className:be(["react-flow__connection",Iy(u)]),children:M.jsx(_b,{style:e,type:n,CustomComponent:i,isValid:u})})})}const _b=({style:t,type:e=Bo.Bezier,CustomComponent:n,isValid:i})=>{const{inProgress:s,from:l,fromNode:c,fromHandle:u,fromPosition:d,to:h,toNode:p,toHandle:m,toPosition:y,pointer:b}=H5();if(!s)return;if(n)return M.jsx(n,{connectionLineType:e,connectionLineStyle:t,fromNode:c,fromHandle:u,fromX:l.x,fromY:l.y,toX:h.x,toY:h.y,fromPosition:d,toPosition:y,connectionStatus:Iy(i),toNode:p,toHandle:m,pointer:b});let x="";const w={sourceX:l.x,sourceY:l.y,sourcePosition:d,targetX:h.x,targetY:h.y,targetPosition:y};switch(e){case Bo.Bezier:[x]=ev(w);break;case Bo.SimpleBezier:[x]=lb(w);break;case Bo.Step:[x]=Td({...w,borderRadius:0});break;case Bo.SmoothStep:[x]=Td(w);break;default:[x]=ov(w)}return M.jsx("path",{d:x,fill:"none",className:"react-flow__connection-path",style:t})};_b.displayName="ConnectionLine";const Y5={};function Cb(t=Y5){N.useRef(t),re(),N.useEffect(()=>{},[t])}function G5(){re(),N.useRef(!1),N.useEffect(()=>{},[])}function Tb({nodeTypes:t,edgeTypes:e,onInit:n,onNodeClick:i,onEdgeClick:s,onNodeDoubleClick:l,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:O,selectionOnDrag:C,selectionMode:_,multiSelectionKeyCode:R,panActivationKeyCode:A,zoomActivationKeyCode:k,deleteKeyCode:D,onlyRenderVisibleElements:H,elementsSelectable:Y,defaultViewport:$,translateExtent:F,minZoom:Q,maxZoom:B,preventScrolling:P,defaultMarkerColor:j,zoomOnScroll:I,zoomOnPinch:z,panOnScroll:U,panOnScrollSpeed:G,panOnScrollMode:L,zoomOnDoubleClick:q,panOnDrag:tt,onPaneClick:rt,onPaneMouseEnter:ct,onPaneMouseMove:ht,onPaneMouseLeave:ft,onPaneScroll:ut,onPaneContextMenu:dt,paneClickDistance:kt,nodeClickDistance:At,onEdgeContextMenu:bt,onEdgeMouseEnter:Tt,onEdgeMouseMove:Ot,onEdgeMouseLeave:Xt,reconnectRadius:qt,onReconnect:pt,onReconnectStart:gt,onReconnectEnd:vt,noDragClassName:mt,noWheelClassName:Ct,noPanClassName:Lt,disableKeyboardA11y:jt,nodeExtent:zt,rfId:ge,viewport:Qt,onViewportChange:Oe}){return Cb(t),Cb(e),G5(),V5(n),I5(Qt),M.jsx(s5,{onPaneClick:rt,onPaneMouseEnter:ct,onPaneMouseMove:ht,onPaneMouseLeave:ft,onPaneContextMenu:dt,onPaneScroll:ut,paneClickDistance:kt,deleteKeyCode:D,selectionKeyCode:O,selectionOnDrag:C,selectionMode:_,onSelectionStart:y,onSelectionEnd:b,multiSelectionKeyCode:R,panActivationKeyCode:A,zoomActivationKeyCode:k,elementsSelectable:Y,zoomOnScroll:I,zoomOnPinch:z,zoomOnDoubleClick:q,panOnScroll:U,panOnScrollSpeed:G,panOnScrollMode:L,panOnDrag:tt,defaultViewport:$,translateExtent:F,minZoom:Q,maxZoom:B,onSelectionContextMenu:m,preventScrolling:P,noDragClassName:mt,noWheelClassName:Ct,noPanClassName:Lt,disableKeyboardA11y:jt,onViewportChange:Oe,isControlledViewport:!!Qt,children:M.jsxs(z5,{children:[M.jsx(D5,{edgeTypes:e,onEdgeClick:s,onEdgeDoubleClick:c,onReconnect:pt,onReconnectStart:gt,onReconnectEnd:vt,onlyRenderVisibleElements:H,onEdgeContextMenu:bt,onEdgeMouseEnter:Tt,onEdgeMouseMove:Ot,onEdgeMouseLeave:Xt,reconnectRadius:qt,defaultMarkerColor:j,noPanClassName:Lt,disableKeyboardA11y:jt,rfId:ge}),M.jsx($5,{style:w,type:x,component:S,containerStyle:E}),M.jsx("div",{className:"react-flow__edgelabel-renderer"}),M.jsx(m5,{nodeTypes:t,onNodeClick:i,onNodeDoubleClick:l,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:p,nodeClickDistance:At,onlyRenderVisibleElements:H,noPanClassName:Lt,noDragClassName:mt,disableKeyboardA11y:jt,nodeExtent:zt,rfId:ge}),M.jsx("div",{className:"react-flow__viewport-portal"})]})})}Tb.displayName="GraphView";const q5=N.memo(Tb),Nb=({nodes:t,edges:e,defaultNodes:n,defaultEdges:i,width:s,height:l,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??[],O=n??t??[],C=p??[0,0],_=m??Qs;dv(w,S,E);const R=kd(O,b,x,{nodeOrigin:C,nodeExtent:_,zIndexMode:y});let A=[0,0,1];if(c&&s&&l){const k=ta(b,{filter:$=>!!(($.width||$.initialWidth)&&($.height||$.initialHeight))}),{x:D,y:H,zoom:Y}=_d(k,s,l,d,h,u?.padding??.1);A=[D,H,Y]}return{rfId:"1",width:s??0,height:l??0,transform:A,nodes:O,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:Qs,nodeExtent:_,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:Sr.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:c??!1,fitViewOptions:u,fitViewResolver:null,connection:{...Vy},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:sO,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:zy,zIndexMode:y,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},X5=({nodes:t,edges:e,defaultNodes:n,defaultEdges:i,width:s,height:l,fitView:c,fitViewOptions:u,minZoom:d,maxZoom:h,nodeOrigin:p,nodeExtent:m,zIndexMode:y})=>uD((b,x)=>{async function w(){const{nodeLookup:S,panZoom:E,fitViewOptions:O,fitViewResolver:C,width:_,height:R,minZoom:A,maxZoom:k}=x();E&&(await iO({nodes:S,width:_,height:R,panZoom:E,minZoom:A,maxZoom:k},O),C?.resolve(!0),b({fitViewResolver:null}))}return{...Nb({nodes:t,edges:e,width:s,height:l,fitView:c,fitViewOptions:u,minZoom:d,maxZoom:h,nodeOrigin:p,nodeExtent:m,defaultNodes:n,defaultEdges:i,zIndexMode:y}),setNodes:S=>{const{nodeLookup:E,parentLookup:O,nodeOrigin:C,elevateNodesOnSelect:_,fitViewQueued:R,zIndexMode:A}=x(),k=kd(S,E,O,{nodeOrigin:C,nodeExtent:m,elevateNodesOnSelect:_,checkEquality:!0,zIndexMode:A});R&&k?(w(),b({nodes:S,nodesInitialized:k,fitViewQueued:!1,fitViewOptions:void 0})):b({nodes:S,nodesInitialized:k})},setEdges:S=>{const{connectionLookup:E,edgeLookup:O}=x();dv(E,O,S),b({edges:S})},setDefaultNodesAndEdges:(S,E)=>{if(S){const{setNodes:O}=x();O(S),b({hasDefaultNodes:!0})}if(E){const{setEdges:O}=x();O(E),b({hasDefaultEdges:!0})}},updateNodeInternals:S=>{const{triggerNodeChanges:E,nodeLookup:O,parentLookup:C,domNode:_,nodeOrigin:R,nodeExtent:A,debug:k,fitViewQueued:D,zIndexMode:H}=x(),{changes:Y,updatedInternals:$}=AO(S,O,C,_,R,A,H);$&&(_O(O,C,{nodeOrigin:R,nodeExtent:A,zIndexMode:H}),D?(w(),b({fitViewQueued:!1,fitViewOptions:void 0})):b({}),Y?.length>0&&(k&&console.log("React Flow: trigger node changes",Y),E?.(Y)))},updateNodePositions:(S,E=!1)=>{const O=[];let C=[];const{nodeLookup:_,triggerNodeChanges:R,connection:A,updateConnection:k,onNodesChangeMiddlewareMap:D}=x();for(const[H,Y]of S){const $=_.get(H),F=!!($?.expandParent&&$?.parentId&&Y?.position),Q={id:H,type:"position",position:F?{x:Math.max(0,Y.position.x),y:Math.max(0,Y.position.y)}:Y.position,dragging:E};if($&&A.inProgress&&A.fromNode.id===$.id){const B=Li($,A.fromHandle,Nt.Left,!0);k({...A,from:B})}F&&$.parentId&&O.push({id:H,parentId:$.parentId,rect:{...Y.internals.positionAbsolute,width:Y.measured.width??0,height:Y.measured.height??0}}),C.push(Q)}if(O.length>0){const{parentLookup:H,nodeOrigin:Y}=x(),$=Dd(O,_,H,Y);C.push(...$)}for(const H of D.values())C=H(C);R(C)},triggerNodeChanges:S=>{const{onNodesChange:E,setNodes:O,nodes:C,hasDefaultNodes:_,debug:R}=x();if(S?.length){if(_){const A=$v(S,C);O(A)}R&&console.log("React Flow: trigger node changes",S),E?.(S)}},triggerEdgeChanges:S=>{const{onEdgesChange:E,setEdges:O,edges:C,hasDefaultEdges:_,debug:R}=x();if(S?.length){if(_){const A=kD(S,C);O(A)}R&&console.log("React Flow: trigger edge changes",S),E?.(S)}},addSelectedNodes:S=>{const{multiSelectionActive:E,edgeLookup:O,nodeLookup:C,triggerNodeChanges:_,triggerEdgeChanges:R}=x();if(E){const A=S.map(k=>Ii(k,!0));_(A);return}_(Mr(C,new Set([...S]),!0)),R(Mr(O))},addSelectedEdges:S=>{const{multiSelectionActive:E,edgeLookup:O,nodeLookup:C,triggerNodeChanges:_,triggerEdgeChanges:R}=x();if(E){const A=S.map(k=>Ii(k,!0));R(A);return}R(Mr(O,new Set([...S]))),_(Mr(C,new Set,!0))},unselectNodesAndEdges:({nodes:S,edges:E}={})=>{const{edges:O,nodes:C,nodeLookup:_,triggerNodeChanges:R,triggerEdgeChanges:A}=x(),k=S||C,D=E||O,H=[];for(const $ of k){if(!$.selected)continue;const F=_.get($.id);F&&(F.selected=!1),H.push(Ii($.id,!1))}const Y=[];for(const $ of D)$.selected&&Y.push(Ii($.id,!1));R(H),A(Y)},setMinZoom:S=>{const{panZoom:E,maxZoom:O}=x();E?.setScaleExtent([S,O]),b({minZoom:S})},setMaxZoom:S=>{const{panZoom:E,minZoom:O}=x();E?.setScaleExtent([O,S]),b({maxZoom:S})},setTranslateExtent:S=>{x().panZoom?.setTranslateExtent(S),b({translateExtent:S})},resetSelectedElements:()=>{const{edges:S,nodes:E,triggerNodeChanges:O,triggerEdgeChanges:C,elementsSelectable:_}=x();if(!_)return;const R=E.reduce((k,D)=>D.selected?[...k,Ii(D.id,!1)]:k,[]),A=S.reduce((k,D)=>D.selected?[...k,Ii(D.id,!1)]:k,[]);O(R),C(A)},setNodeExtent:S=>{const{nodes:E,nodeLookup:O,parentLookup:C,nodeOrigin:_,elevateNodesOnSelect:R,nodeExtent:A,zIndexMode:k}=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]||(kd(E,O,C,{nodeOrigin:_,nodeExtent:S,elevateNodesOnSelect:R,checkEquality:!1,zIndexMode:k}),b({nodeExtent:S}))},panBy:S=>{const{transform:E,width:O,height:C,panZoom:_,translateExtent:R}=x();return MO({delta:S,panZoom:_,transform:E,translateExtent:R,width:O,height:C})},setCenter:async(S,E,O)=>{const{width:C,height:_,maxZoom:R,panZoom:A}=x();if(!A)return Promise.resolve(!1);const k=typeof O?.zoom<"u"?O.zoom:R;return await A.setViewport({x:C/2-S*k,y:_/2-E*k,zoom:k},{duration:O?.duration,ease:O?.ease,interpolate:O?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{b({connection:{...Vy}})},updateConnection:S=>{b({connection:S})},reset:()=>b({...Nb()})}},Object.is);function Ab({initialNodes:t,initialEdges:e,defaultNodes:n,defaultEdges:i,initialWidth:s,initialHeight:l,initialMinZoom:c,initialMaxZoom:u,initialFitViewOptions:d,fitView:h,nodeOrigin:p,nodeExtent:m,zIndexMode:y,children:b}){const[x]=N.useState(()=>X5({nodes:t,edges:e,defaultNodes:n,defaultEdges:i,width:s,height:l,fitView:h,minZoom:c,maxZoom:u,fitViewOptions:d,nodeOrigin:p,nodeExtent:m,zIndexMode:y}));return M.jsx(dD,{value:x,children:M.jsx(zD,{children:b})})}function F5({children:t,nodes:e,edges:n,defaultNodes:i,defaultEdges:s,width:l,height:c,fitView:u,fitViewOptions:d,minZoom:h,maxZoom:p,nodeOrigin:m,nodeExtent:y,zIndexMode:b}){return N.useContext(fc)?M.jsx(M.Fragment,{children:t}):M.jsx(Ab,{initialNodes:e,initialEdges:n,defaultNodes:i,defaultEdges:s,initialWidth:l,initialHeight:c,fitView:u,initialFitViewOptions:d,initialMinZoom:h,initialMaxZoom:p,nodeOrigin:m,nodeExtent:y,zIndexMode:b,children:t})}const Z5={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function K5({nodes:t,edges:e,defaultNodes:n,defaultEdges:i,className:s,nodeTypes:l,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:O,onNodeMouseMove:C,onNodeMouseLeave:_,onNodeContextMenu:R,onNodeDoubleClick:A,onNodeDragStart:k,onNodeDrag:D,onNodeDragStop:H,onNodesDelete:Y,onEdgesDelete:$,onDelete:F,onSelectionChange:Q,onSelectionDragStart:B,onSelectionDrag:P,onSelectionDragStop:j,onSelectionContextMenu:I,onSelectionStart:z,onSelectionEnd:U,onBeforeDelete:G,connectionMode:L,connectionLineType:q=Bo.Bezier,connectionLineStyle:tt,connectionLineComponent:rt,connectionLineContainerStyle:ct,deleteKeyCode:ht="Backspace",selectionKeyCode:ft="Shift",selectionOnDrag:ut=!1,selectionMode:dt=Ws.Full,panActivationKeyCode:kt="Space",multiSelectionKeyCode:At=ia()?"Meta":"Control",zoomActivationKeyCode:bt=ia()?"Meta":"Control",snapToGrid:Tt,snapGrid:Ot,onlyRenderVisibleElements:Xt=!1,selectNodesOnDrag:qt,nodesDraggable:pt,autoPanOnNodeFocus:gt,nodesConnectable:vt,nodesFocusable:mt,nodeOrigin:Ct=zv,edgesFocusable:Lt,edgesReconnectable:jt,elementsSelectable:zt=!0,defaultViewport:ge=CD,minZoom:Qt=.5,maxZoom:Oe=2,translateExtent:yn=Qs,preventScrolling:za=!0,nodeExtent:In,defaultMarkerColor:Ki="#b1b1b7",zoomOnScroll:Va=!0,zoomOnPinch:Ae=!0,panOnScroll:he=!1,panOnScrollSpeed:se=.5,panOnScrollMode:De=zi.Free,zoomOnDoubleClick:em=!0,panOnDrag:nm=!0,onPaneClick:om,onPaneMouseEnter:Qr,onPaneMouseMove:Wr,onPaneMouseLeave:Jr,onPaneScroll:vo,onPaneContextMenu:ts,paneClickDistance:Qi=1,nodeClickDistance:im=0,children:du,onReconnect:La,onReconnectStart:Wi,onReconnectEnd:rm,onEdgeContextMenu:hu,onEdgeDoubleClick:pu,onEdgeMouseEnter:mu,onEdgeMouseMove:Ia,onEdgeMouseLeave:Ba,reconnectRadius:gu=10,onNodesChange:yu,onEdgesChange:no,noDragClassName:Me="nodrag",noWheelClassName:Ue="nowheel",noPanClassName:bo="nopan",fitView:es,fitViewOptions:vu,connectOnClick:sm,attributionPosition:bu,proOptions:Ji,defaultEdgeOptions:Pa,elevateNodesOnSelect:ti=!0,elevateEdgesOnSelect:ei=!1,disableKeyboardA11y:ni=!1,autoPanOnConnect:oi,autoPanOnNodeDrag:we,autoPanSpeed:xu,connectionRadius:wu,isValidConnection:xo,onError:ii,style:am,id:Ha,nodeDragThreshold:Su,connectionDragThreshold:lm,viewport:ns,onViewportChange:os,width:Bn,height:Fe,colorMode:Eu="light",debug:cm,onScroll:is,ariaLabelConfig:_u,zIndexMode:tr="basic",...um},Ze){const er=Ha||"1",Cu=AD(Eu),Ua=N.useCallback(wo=>{wo.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),is?.(wo)},[is]);return M.jsx("div",{"data-testid":"rf__wrapper",...um,onScroll:Ua,style:{...am,...Z5},ref:Ze,className:be(["react-flow",s,Cu]),id:Ha,role:"application",children:M.jsxs(F5,{nodes:t,edges:e,width:Bn,height:Fe,fitView:es,fitViewOptions:vu,minZoom:Qt,maxZoom:Oe,nodeOrigin:Ct,nodeExtent:In,zIndexMode:tr,children:[M.jsx(q5,{onInit:h,onNodeClick:u,onEdgeClick:d,onNodeMouseEnter:O,onNodeMouseMove:C,onNodeMouseLeave:_,onNodeContextMenu:R,onNodeDoubleClick:A,nodeTypes:l,edgeTypes:c,connectionLineType:q,connectionLineStyle:tt,connectionLineComponent:rt,connectionLineContainerStyle:ct,selectionKeyCode:ft,selectionOnDrag:ut,selectionMode:dt,deleteKeyCode:ht,multiSelectionKeyCode:At,panActivationKeyCode:kt,zoomActivationKeyCode:bt,onlyRenderVisibleElements:Xt,defaultViewport:ge,translateExtent:yn,minZoom:Qt,maxZoom:Oe,preventScrolling:za,zoomOnScroll:Va,zoomOnPinch:Ae,zoomOnDoubleClick:em,panOnScroll:he,panOnScrollSpeed:se,panOnScrollMode:De,panOnDrag:nm,onPaneClick:om,onPaneMouseEnter:Qr,onPaneMouseMove:Wr,onPaneMouseLeave:Jr,onPaneScroll:vo,onPaneContextMenu:ts,paneClickDistance:Qi,nodeClickDistance:im,onSelectionContextMenu:I,onSelectionStart:z,onSelectionEnd:U,onReconnect:La,onReconnectStart:Wi,onReconnectEnd:rm,onEdgeContextMenu:hu,onEdgeDoubleClick:pu,onEdgeMouseEnter:mu,onEdgeMouseMove:Ia,onEdgeMouseLeave:Ba,reconnectRadius:gu,defaultMarkerColor:Ki,noDragClassName:Me,noWheelClassName:Ue,noPanClassName:bo,rfId:er,disableKeyboardA11y:ni,nodeExtent:In,viewport:ns,onViewportChange:os}),M.jsx(ND,{nodes:t,edges:e,defaultNodes:n,defaultEdges:i,onConnect:b,onConnectStart:x,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:E,nodesDraggable:pt,autoPanOnNodeFocus:gt,nodesConnectable:vt,nodesFocusable:mt,edgesFocusable:Lt,edgesReconnectable:jt,elementsSelectable:zt,elevateNodesOnSelect:ti,elevateEdgesOnSelect:ei,minZoom:Qt,maxZoom:Oe,nodeExtent:In,onNodesChange:yu,onEdgesChange:no,snapToGrid:Tt,snapGrid:Ot,connectionMode:L,translateExtent:yn,connectOnClick:sm,defaultEdgeOptions:Pa,fitView:es,fitViewOptions:vu,onNodesDelete:Y,onEdgesDelete:$,onDelete:F,onNodeDragStart:k,onNodeDrag:D,onNodeDragStop:H,onSelectionDrag:P,onSelectionDragStart:B,onSelectionDragStop:j,onMove:p,onMoveStart:m,onMoveEnd:y,noPanClassName:bo,nodeOrigin:Ct,rfId:er,autoPanOnConnect:oi,autoPanOnNodeDrag:we,autoPanSpeed:xu,onError:ii,connectionRadius:wu,isValidConnection:xo,selectNodesOnDrag:qt,nodeDragThreshold:Su,connectionDragThreshold:lm,onBeforeDelete:G,debug:cm,ariaLabelConfig:_u,zIndexMode:tr}),M.jsx(_D,{onSelectionChange:Q}),du,M.jsx(bD,{proOptions:Ji,position:bu}),M.jsx(vD,{rfId:er,disableKeyboardA11y:ni})]})})}var Q5=Xv(K5);function W5(){const t=re();return N.useCallback(e=>{const{domNode:n,updateNodeInternals:i}=t.getState(),s=Array.isArray(e)?e:[e],l=new Map;s.forEach(c=>{const u=n?.querySelector(`.react-flow__node[data-id="${c}"]`);u&&l.set(c,{id:c,nodeElement:u,force:!0})}),requestAnimationFrame(()=>i(l,{triggerFitView:!1}))},[])}function J5({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:be(["react-flow__background-pattern",n,i])})}function tj({radius:t,className:e}){return M.jsx("circle",{cx:t,cy:t,r:t,className:be(["react-flow__background-pattern","dots",e])})}var fo;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(fo||(fo={}));const ej={[fo.Dots]:1,[fo.Lines]:1,[fo.Cross]:6},nj=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function Mb({id:t,variant:e=fo.Dots,gap:n=20,size:i,lineWidth:s=1,offset:l=0,color:c,bgColor:u,style:d,className:h,patternClassName:p}){const m=N.useRef(null),{transform:y,patternId:b}=Gt(nj,ce),x=i||ej[e],w=e===fo.Dots,S=e===fo.Cross,E=Array.isArray(n)?n:[n,n],O=[E[0]*y[2]||1,E[1]*y[2]||1],C=x*y[2],_=Array.isArray(l)?l:[l,l],R=S?[C,C]:O,A=[_[0]*y[2]||1+R[0]/2,_[1]*y[2]||1+R[1]/2],k=`${b}${t||""}`;return M.jsxs("svg",{className:be(["react-flow__background",h]),style:{...d,...hc,"--xy-background-color-props":u,"--xy-background-pattern-color-props":c},ref:m,"data-testid":"rf__background",children:[M.jsx("pattern",{id:k,x:y[0]%O[0],y:y[1]%O[1],width:O[0],height:O[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${A[0]},-${A[1]})`,children:w?M.jsx(tj,{radius:C/2,className:p}):M.jsx(J5,{dimensions:R,lineWidth:s,variant:e,className:p})}),M.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${k})`})]})}Mb.displayName="Background";const oj=N.memo(Mb);function ij(){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 rj(){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 sj(){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 aj(){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 lj(){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 gc({children:t,className:e,...n}){return M.jsx("button",{type:"button",className:be(["react-flow__controls-button",e]),...n,children:t})}const cj=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function Rb({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:i=!0,fitViewOptions:s,onZoomIn:l,onZoomOut:c,onFitView:u,onInteractiveChange:d,className:h,children:p,position:m="bottom-left",orientation:y="vertical","aria-label":b}){const x=re(),{isInteractive:w,minZoomReached:S,maxZoomReached:E,ariaLabelConfig:O}=Gt(cj,ce),{zoomIn:C,zoomOut:_,fitView:R}=la(),A=()=>{C(),l?.()},k=()=>{_(),c?.()},D=()=>{R(s),u?.()},H=()=>{x.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),d?.(!w)},Y=y==="horizontal"?"horizontal":"vertical";return M.jsxs(sa,{className:be(["react-flow__controls",Y,h]),position:m,style:t,"data-testid":"rf__controls","aria-label":b??O["controls.ariaLabel"],children:[e&&M.jsxs(M.Fragment,{children:[M.jsx(gc,{onClick:A,className:"react-flow__controls-zoomin",title:O["controls.zoomIn.ariaLabel"],"aria-label":O["controls.zoomIn.ariaLabel"],disabled:E,children:M.jsx(ij,{})}),M.jsx(gc,{onClick:k,className:"react-flow__controls-zoomout",title:O["controls.zoomOut.ariaLabel"],"aria-label":O["controls.zoomOut.ariaLabel"],disabled:S,children:M.jsx(rj,{})})]}),n&&M.jsx(gc,{className:"react-flow__controls-fitview",onClick:D,title:O["controls.fitView.ariaLabel"],"aria-label":O["controls.fitView.ariaLabel"],children:M.jsx(sj,{})}),i&&M.jsx(gc,{className:"react-flow__controls-interactive",onClick:H,title:O["controls.interactive.ariaLabel"],"aria-label":O["controls.interactive.ariaLabel"],children:w?M.jsx(lj,{}):M.jsx(aj,{})}),p]})}Rb.displayName="Controls",N.memo(Rb);function uj({id:t,x:e,y:n,width:i,height:s,style:l,color:c,strokeColor:u,strokeWidth:d,className:h,borderRadius:p,shapeRendering:m,selected:y,onClick:b}){const{background:x,backgroundColor:w}=l||{},S=c||x||w;return M.jsx("rect",{className:be(["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 fj=N.memo(uj),dj=t=>t.nodes.map(e=>e.id),Xd=t=>t instanceof Function?t:()=>t;function hj({nodeStrokeColor:t,nodeColor:e,nodeClassName:n="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:l=fj,onClick:c}){const u=Gt(dj,ce),d=Xd(e),h=Xd(t),p=Xd(n),m=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return M.jsx(M.Fragment,{children:u.map(y=>M.jsx(mj,{id:y,nodeColorFunc:d,nodeStrokeColorFunc:h,nodeClassNameFunc:p,nodeBorderRadius:i,nodeStrokeWidth:s,NodeComponent:l,onClick:c,shapeRendering:m},y))})}function pj({id:t,nodeColorFunc:e,nodeStrokeColorFunc:n,nodeClassNameFunc:i,nodeBorderRadius:s,nodeStrokeWidth:l,shapeRendering:c,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 S=w.internals.userNode,{x:E,y:O}=w.internals.positionAbsolute,{width:C,height:_}=uo(S);return{node:S,x:E,y:O,width:C,height:_}},ce);return!h||h.hidden||!qy(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:l,shapeRendering:c,onClick:d,id:h.id})}const mj=N.memo(pj);var gj=N.memo(hj);const yj=200,vj=150,bj=t=>!t.hidden,xj=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?Yy(ta(t.nodeLookup,{filter:bj}),e):e,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},wj="react-flow__minimap-desc";function kb({style:t,className:e,nodeStrokeColor:n,nodeColor:i,nodeClassName:s="",nodeBorderRadius:l=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:O,zoomStep:C=1,offsetScale:_=5}){const R=re(),A=N.useRef(null),{boundingRect:k,viewBB:D,rfId:H,panZoom:Y,translateExtent:$,flowWidth:F,flowHeight:Q,ariaLabelConfig:B}=Gt(xj,ce),P=t?.width??yj,j=t?.height??vj,I=k.width/P,z=k.height/j,U=Math.max(I,z),G=U*P,L=U*j,q=_*U,tt=k.x-(G-k.width)/2-q,rt=k.y-(L-k.height)/2-q,ct=G+q*2,ht=L+q*2,ft=`${wj}-${H}`,ut=N.useRef(0),dt=N.useRef();ut.current=U,N.useEffect(()=>{if(A.current&&Y)return dt.current=IO({domNode:A.current,panZoom:Y,getTransform:()=>R.getState().transform,getViewScale:()=>ut.current}),()=>{dt.current?.destroy()}},[Y]),N.useEffect(()=>{dt.current?.update({translateExtent:$,width:F,height:Q,inversePan:O,pannable:w,zoomStep:C,zoomable:S})},[w,S,O,C,$,F,Q]);const kt=b?Tt=>{const[Ot,Xt]=dt.current?.pointer(Tt)||[0,0];b(Tt,{x:Ot,y:Xt})}:void 0,At=x?N.useCallback((Tt,Ot)=>{const Xt=R.getState().nodeLookup.get(Ot).internals.userNode;x(Tt,Xt)},[]):void 0,bt=E??B["minimap.ariaLabel"];return M.jsx(sa,{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:be(["react-flow__minimap",e]),"data-testid":"rf__minimap",children:M.jsxs("svg",{width:P,height:j,viewBox:`${tt} ${rt} ${ct} ${ht}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ft,ref:A,onClick:kt,children:[bt&&M.jsx("title",{id:ft,children:bt}),M.jsx(gj,{onClick:At,nodeColor:i,nodeStrokeColor:n,nodeBorderRadius:l,nodeClassName:s,nodeStrokeWidth:c,nodeComponent:u}),M.jsx("path",{className:"react-flow__minimap-mask",d:`M${tt-q},${rt-q}h${ct+q*2}v${ht+q*2}h${-ct-q*2}z
|
|
24
|
-
M${D.x},${D.y}h${D.width}v${D.height}h${-D.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}kb.displayName="MiniMap",N.memo(kb);const Sj=t=>e=>t?`${Math.max(1/e.transform[2],1)}`:void 0,Ej={[Ar.Line]:"right",[Ar.Handle]:"bottom-right"};function _j({nodeId:t,position:e,variant:n=Ar.Handle,className:i,style:s=void 0,children:l,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 O=Jv(),C=typeof t=="string"?t:O,_=re(),R=N.useRef(null),A=n===Ar.Handle,k=Gt(N.useCallback(Sj(A&&b),[A,b]),ce),D=N.useRef(null),H=e??Ej[n];N.useEffect(()=>{if(!(!R.current||!C))return D.current||(D.current=WO({domNode:R.current,nodeId:C,getStoreItems:()=>{const{nodeLookup:$,transform:F,snapGrid:Q,snapToGrid:B,nodeOrigin:P,domNode:j}=_.getState();return{nodeLookup:$,transform:F,snapGrid:Q,snapToGrid:B,nodeOrigin:P,paneDomNode:j}},onChange:($,F)=>{const{triggerNodeChanges:Q,nodeLookup:B,parentLookup:P,nodeOrigin:j}=_.getState(),I=[],z={x:$.x,y:$.y},U=B.get(C);if(U&&U.expandParent&&U.parentId){const G=U.origin??j,L=$.width??U.measured.width??0,q=$.height??U.measured.height??0,tt={id:U.id,parentId:U.parentId,rect:{width:L,height:q,...Xy({x:$.x??U.position.x,y:$.y??U.position.y},{width:L,height:q},U.parentId,B,G)}},rt=Dd([tt],B,P,j);I.push(...rt),z.x=$.x?Math.max(G[0]*L,$.x):void 0,z.y=$.y?Math.max(G[1]*q,$.y):void 0}if(z.x!==void 0&&z.y!==void 0){const G={id:C,type:"position",position:{...z}};I.push(G)}if($.width!==void 0&&$.height!==void 0){const L={id:C,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:$.width,height:$.height}};I.push(L)}for(const G of F){const L={...G,type:"position"};I.push(L)}Q(I)},onEnd:({width:$,height:F})=>{const Q={id:C,type:"dimensions",resizing:!1,dimensions:{width:$,height:F}};_.getState().triggerNodeChanges([Q])}})),D.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}),()=>{D.current?.destroy()}},[H,u,d,h,p,m,w,S,E,x]);const Y=H.split("-");return M.jsx("div",{className:be(["react-flow__resize-control","nodrag",...Y,n,i]),ref:R,style:{...s,scale:k,...c&&{[A?"backgroundColor":"borderColor"]:c}},children:l})}N.memo(_j);function Ob(t){if(t.includes("."))return Ob(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 Cj(t){return{...t,nodes:t.nodes.map(e=>({...e,label:Ob(e.label||e.id)}))}}function Db(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=Db(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function jb(){for(var t,e,n=0,i="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=Db(t))&&(i&&(i+=" "),i+=e);return i}const Tj=(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},Nj=(t,e)=>({classGroupId:t,validator:e}),zb=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),yc="-",Vb=[],Aj="arbitrary..",Mj=t=>{const e=kj(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=t;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return Rj(c);const u=c.split(yc),d=u[0]===""&&u.length>1?1:0;return Lb(u,d,e)},getConflictingClassGroupIds:(c,u)=>{if(u){const d=i[c],h=n[c];return d?h?Tj(h,d):d:h||Vb}return n[c]||Vb}}},Lb=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],l=n.nextPart.get(s);if(l){const h=Lb(t,e+1,l);if(h)return h}const c=n.validators;if(c===null)return;const u=e===0?t.join(yc):t.slice(e).join(yc),d=c.length;for(let h=0;h<d;h++){const p=c[h];if(p.validator(u))return p.classGroupId}},Rj=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?Aj+i:void 0})(),kj=t=>{const{theme:e,classGroups:n}=t;return Oj(n,e)},Oj=(t,e)=>{const n=zb();for(const i in t){const s=t[i];Fd(s,n,i,e)}return n},Fd=(t,e,n,i)=>{const s=t.length;for(let l=0;l<s;l++){const c=t[l];Dj(c,e,n,i)}},Dj=(t,e,n,i)=>{if(typeof t=="string"){jj(t,e,n);return}if(typeof t=="function"){zj(t,e,n,i);return}Vj(t,e,n,i)},jj=(t,e,n)=>{const i=t===""?e:Ib(e,t);i.classGroupId=n},zj=(t,e,n,i)=>{if(Lj(t)){Fd(t(i),e,n,i);return}e.validators===null&&(e.validators=[]),e.validators.push(Nj(n,t))},Vj=(t,e,n,i)=>{const s=Object.entries(t),l=s.length;for(let c=0;c<l;c++){const[u,d]=s[c];Fd(d,Ib(e,u),n,i)}},Ib=(t,e)=>{let n=t;const i=e.split(yc),s=i.length;for(let l=0;l<s;l++){const c=i[l];let u=n.nextPart.get(c);u||(u=zb(),n.nextPart.set(c,u)),n=u}return n},Lj=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Ij=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),i=Object.create(null);const s=(l,c)=>{n[l]=c,e++,e>t&&(e=0,i=n,n=Object.create(null))};return{get(l){let c=n[l];if(c!==void 0)return c;if((c=i[l])!==void 0)return s(l,c),c},set(l,c){l in n?n[l]=c:s(l,c)}}},Zd="!",Bb=":",Bj=[],Pb=(t,e,n,i,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:i,isExternal:s}),Pj=t=>{const{prefix:e,experimentalParseClassName:n}=t;let i=s=>{const l=[];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===Bb){l.push(s.slice(d,w)),d=w+1;continue}if(S==="/"){h=w;continue}}S==="["?c++:S==="]"?c--:S==="("?u++:S===")"&&u--}const m=l.length===0?s:s.slice(d);let y=m,b=!1;m.endsWith(Zd)?(y=m.slice(0,-1),b=!0):m.startsWith(Zd)&&(y=m.slice(1),b=!0);const x=h&&h>d?h-d:void 0;return Pb(l,b,y,x)};if(e){const s=e+Bb,l=i;i=c=>c.startsWith(s)?l(c.slice(s.length)):Pb(Bj,!1,c,void 0,!0)}if(n){const s=i;i=l=>n({className:l,parseClassName:s})}return i},Hj=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,i)=>{e.set(n,1e6+i)}),n=>{const i=[];let s=[];for(let l=0;l<n.length;l++){const c=n[l],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}},Uj=t=>({cache:Ij(t.cacheSize),parseClassName:Pj(t),sortModifiers:Hj(t),...Mj(t)}),$j=/\s+/,Yj=(t,e)=>{const{parseClassName:n,getClassGroupId:i,getConflictingClassGroupIds:s,sortModifiers:l}=e,c=[],u=t.trim().split($j);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 O=y.length===0?"":y.length===1?y[0]:l(y).join(":"),C=b?O+Zd:O,_=C+E;if(c.indexOf(_)>-1)continue;c.push(_);const R=s(E,S);for(let A=0;A<R.length;++A){const k=R[A];c.push(C+k)}d=p+(d.length>0?" "+d:d)}return d},Gj=(...t)=>{let e=0,n,i,s="";for(;e<t.length;)(n=t[e++])&&(i=Hb(n))&&(s&&(s+=" "),s+=i);return s},Hb=t=>{if(typeof t=="string")return t;let e,n="";for(let i=0;i<t.length;i++)t[i]&&(e=Hb(t[i]))&&(n&&(n+=" "),n+=e);return n},qj=(t,...e)=>{let n,i,s,l;const c=d=>{const h=e.reduce((p,m)=>m(p),t());return n=Uj(h),i=n.cache.get,s=n.cache.set,l=u,u(d)},u=d=>{const h=i(d);if(h)return h;const p=Yj(d,n);return s(d,p),p};return l=c,(...d)=>l(Gj(...d))},Xj=[],Te=t=>{const e=n=>n[t]||Xj;return e.isThemeGetter=!0,e},Ub=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,$b=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Fj=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Zj=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Kj=/\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$/,Qj=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Wj=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Jj=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Uo=t=>Fj.test(t),Bt=t=>!!t&&!Number.isNaN(Number(t)),$o=t=>!!t&&Number.isInteger(Number(t)),Kd=t=>t.endsWith("%")&&Bt(t.slice(0,-1)),ho=t=>Zj.test(t),Yb=()=>!0,tz=t=>Kj.test(t)&&!Qj.test(t),Qd=()=>!1,ez=t=>Wj.test(t),nz=t=>Jj.test(t),oz=t=>!wt(t)&&!Et(t),iz=t=>Yo(t,Kb,Qd),wt=t=>Ub.test(t),Bi=t=>Yo(t,Qb,tz),Gb=t=>Yo(t,dz,Bt),rz=t=>Yo(t,Jb,Yb),sz=t=>Yo(t,Wb,Qd),qb=t=>Yo(t,Fb,Qd),az=t=>Yo(t,Zb,nz),vc=t=>Yo(t,tx,ez),Et=t=>$b.test(t),ca=t=>Pi(t,Qb),lz=t=>Pi(t,Wb),Xb=t=>Pi(t,Fb),cz=t=>Pi(t,Kb),uz=t=>Pi(t,Zb),bc=t=>Pi(t,tx,!0),fz=t=>Pi(t,Jb,!0),Yo=(t,e,n)=>{const i=Ub.exec(t);return i?i[1]?e(i[1]):n(i[2]):!1},Pi=(t,e,n=!1)=>{const i=$b.exec(t);return i?i[1]?e(i[1]):n:!1},Fb=t=>t==="position"||t==="percentage",Zb=t=>t==="image"||t==="url",Kb=t=>t==="length"||t==="size"||t==="bg-size",Qb=t=>t==="length",dz=t=>t==="number",Wb=t=>t==="family-name",Jb=t=>t==="number"||t==="weight",tx=t=>t==="shadow",hz=qj(()=>{const t=Te("color"),e=Te("font"),n=Te("text"),i=Te("font-weight"),s=Te("tracking"),l=Te("leading"),c=Te("breakpoint"),u=Te("container"),d=Te("spacing"),h=Te("radius"),p=Te("shadow"),m=Te("inset-shadow"),y=Te("text-shadow"),b=Te("drop-shadow"),x=Te("blur"),w=Te("perspective"),S=Te("aspect"),E=Te("ease"),O=Te("animate"),C=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[..._(),Et,wt],A=()=>["auto","hidden","clip","visible","scroll"],k=()=>["auto","contain","none"],D=()=>[Et,wt,d],H=()=>[Uo,"full","auto",...D()],Y=()=>[$o,"none","subgrid",Et,wt],$=()=>["auto",{span:["full",$o,Et,wt]},$o,Et,wt],F=()=>[$o,"auto",Et,wt],Q=()=>["auto","min","max","fr",Et,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",...D()],I=()=>[Uo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...D()],z=()=>[Uo,"screen","full","dvw","lvw","svw","min","max","fit",...D()],U=()=>[Uo,"screen","full","lh","dvh","lvh","svh","min","max","fit",...D()],G=()=>[t,Et,wt],L=()=>[..._(),Xb,qb,{position:[Et,wt]}],q=()=>["no-repeat",{repeat:["","x","y","space","round"]}],tt=()=>["auto","cover","contain",cz,iz,{size:[Et,wt]}],rt=()=>[Kd,ca,Bi],ct=()=>["","none","full",h,Et,wt],ht=()=>["",Bt,ca,Bi],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,Kd,Xb,qb],kt=()=>["","none",x,Et,wt],At=()=>["none",Bt,Et,wt],bt=()=>["none",Bt,Et,wt],Tt=()=>[Bt,Et,wt],Ot=()=>[Uo,"full",...D()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[ho],breakpoint:[ho],color:[Yb],container:[ho],"drop-shadow":[ho],ease:["in","out","in-out"],font:[oz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[ho],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[ho],shadow:[ho],spacing:["px",Bt],text:[ho],"text-shadow":[ho],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",Uo,wt,Et,S]}],container:["container"],columns:[{columns:[Bt,wt,Et,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:k()}],"overscroll-x":[{"overscroll-x":k()}],"overscroll-y":[{"overscroll-y":k()}],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:[$o,"auto",Et,wt]}],basis:[{basis:[Uo,"full","auto",u,...D()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Bt,Uo,"auto","initial","none",wt]}],grow:[{grow:["",Bt,Et,wt]}],shrink:[{shrink:["",Bt,Et,wt]}],order:[{order:[$o,"first","last","none",Et,wt]}],"grid-cols":[{"grid-cols":Y()}],"col-start-end":[{col:$()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":Y()}],"row-start-end":[{row:$()}],"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:D()}],"gap-x":[{"gap-x":D()}],"gap-y":[{"gap-y":D()}],"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: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",...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,ca,Bi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,fz,rz]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",Kd,wt]}],"font-family":[{font:[lz,sz,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,Et,wt]}],"line-clamp":[{"line-clamp":[Bt,"none",Et,Gb]}],leading:[{leading:[l,...D()]}],"list-image":[{"list-image":["none",Et,wt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Et,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",Et,Bi]}],"text-decoration-color":[{decoration:G()}],"underline-offset":[{"underline-offset":[Bt,"auto",Et,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",Et,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",Et,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:q()}],"bg-size":[{bg:tt()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},$o,Et,wt],radial:["",Et,wt],conic:[$o,Et,wt]},uz,az]}],"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,Et,wt]}],"outline-w":[{outline:["",Bt,ca,Bi]}],"outline-color":[{outline:G()}],shadow:[{shadow:["","none",p,bc,vc]}],"shadow-color":[{shadow:G()}],"inset-shadow":[{"inset-shadow":["none",m,bc,vc]}],"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,Bi]}],"ring-offset-color":[{"ring-offset":G()}],"inset-ring-w":[{"inset-ring":ht()}],"inset-ring-color":[{"inset-ring":G()}],"text-shadow":[{"text-shadow":["none",y,bc,vc]}],"text-shadow-color":[{"text-shadow":G()}],opacity:[{opacity:[Bt,Et,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":[Et,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":_()}],"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:q()}],"mask-size":[{mask:tt()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Et,wt]}],filter:[{filter:["","none",Et,wt]}],blur:[{blur:kt()}],brightness:[{brightness:[Bt,Et,wt]}],contrast:[{contrast:[Bt,Et,wt]}],"drop-shadow":[{"drop-shadow":["","none",b,bc,vc]}],"drop-shadow-color":[{"drop-shadow":G()}],grayscale:[{grayscale:["",Bt,Et,wt]}],"hue-rotate":[{"hue-rotate":[Bt,Et,wt]}],invert:[{invert:["",Bt,Et,wt]}],saturate:[{saturate:[Bt,Et,wt]}],sepia:[{sepia:["",Bt,Et,wt]}],"backdrop-filter":[{"backdrop-filter":["","none",Et,wt]}],"backdrop-blur":[{"backdrop-blur":kt()}],"backdrop-brightness":[{"backdrop-brightness":[Bt,Et,wt]}],"backdrop-contrast":[{"backdrop-contrast":[Bt,Et,wt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Bt,Et,wt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Bt,Et,wt]}],"backdrop-invert":[{"backdrop-invert":["",Bt,Et,wt]}],"backdrop-opacity":[{"backdrop-opacity":[Bt,Et,wt]}],"backdrop-saturate":[{"backdrop-saturate":[Bt,Et,wt]}],"backdrop-sepia":[{"backdrop-sepia":["",Bt,Et,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",Et,wt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Bt,"initial",Et,wt]}],ease:[{ease:["linear","initial",E,Et,wt]}],delay:[{delay:[Bt,Et,wt]}],animate:[{animate:["none",O,Et,wt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Et,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:[Et,wt,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Ot()}],"translate-x":[{"translate-x":Ot()}],"translate-y":[{"translate-y":Ot()}],"translate-z":[{"translate-z":Ot()}],"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",Et,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",Et,wt]}],fill:[{fill:["none",...G()]}],"stroke-w":[{stroke:[Bt,ca,Bi,Gb]}],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 kn(...t){return hz(jb(t))}function Xe({children:t,inputPorts:e=[],outputPorts:n=[],selected:i,className:s,showPortLabels:l,onPortClick:c,glowUnconnected:u}){return M.jsxs("div",{className:kn("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(Ai.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(Rr,{type:"target",position:Nt.Left,id:`in-${d.name}`,className:kn("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}),l&&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(Ai.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(Rr,{type:"source",position:Nt.Right,id:`out-${d.name}`,className:kn("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}),l&&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 ex(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function nx(...t){return e=>{let n=!1;const i=t.map(s=>{const l=ex(s,e);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let s=0;s<i.length;s++){const l=i[s];typeof l=="function"?l():ex(t[s],null)}}}}function Hi(...t){return N.useCallback(nx(...t),t)}function pz(t){const e=mz(t),n=N.forwardRef((i,s)=>{const{children:l,...c}=i,u=N.Children.toArray(l),d=u.find(yz);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:l})});return n.displayName=`${t}.Slot`,n}function mz(t){const e=N.forwardRef((n,i)=>{const{children:s,...l}=n;if(N.isValidElement(s)){const c=bz(s),u=vz(l,s.props);return s.type!==N.Fragment&&(u.ref=i?nx(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 ox=Symbol("radix.slottable");function gz(t){const e=({children:n})=>M.jsx(M.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=ox,e}function yz(t){return N.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===ox}function vz(t,e){const n={...e};for(const i in e){const s=t[i],l=e[i];/^on[A-Z]/.test(i)?s&&l?n[i]=(...u)=>{const d=l(...u);return s(...u),d}:s&&(n[i]=s):i==="style"?n[i]={...s,...l}:i==="className"&&(n[i]=[s,l].filter(Boolean).join(" "))}return{...t,...n}}function bz(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 xz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Go=xz.reduce((t,e)=>{const n=pz(`Primitive.${e}`),i=N.forwardRef((s,l)=>{const{asChild:c,...u}=s,d=c?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),M.jsx(d,{...u,ref:l})});return i.displayName=`Primitive.${e}`,{...t,[e]:i}},{});function wz(t,e){t&&Ud.flushSync(()=>t.dispatchEvent(e))}var Sz=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"}),Ez="VisuallyHidden",ix=N.forwardRef((t,e)=>M.jsx(Go.span,{...t,ref:e,style:{...Sz,...t.style}}));ix.displayName=Ez;var _z=ix;function rx(t,e=[]){let n=[];function i(l,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=l+"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 \`${l}\``)}return[h,p]}const s=()=>{const l=n.map(c=>N.createContext(c));return function(u){const d=u?.[t]||l;return N.useMemo(()=>({[`__scope${t}`]:{...u,[t]:d}}),[u,d])}};return s.scopeName=t,[i,Cz(s,...e)]}function Cz(...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(l){const c=i.reduce((u,{useScope:d,scopeName:h})=>{const m=d(l)[`__scope${h}`];return{...u,...m}},{});return N.useMemo(()=>({[`__scope${e.scopeName}`]:c}),[c])}};return n.scopeName=e.scopeName,n}function po(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t?.(s),n===!1||!s.defaultPrevented)return e?.(s)}}var qo=globalThis?.document?N.useLayoutEffect:()=>{},Tz=y0[" useInsertionEffect ".trim().toString()]||qo;function Nz({prop:t,defaultProp:e,onChange:n=()=>{},caller:i}){const[s,l,c]=Az({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=Mz(p)?p(t):p;m!==t&&c.current?.(m)}else l(p)},[u,t,l,c]);return[d,h]}function Az({defaultProp:t,onChange:e}){const[n,i]=N.useState(t),s=N.useRef(n),l=N.useRef(e);return Tz(()=>{l.current=e},[e]),N.useEffect(()=>{s.current!==n&&(l.current?.(n),s.current=n)},[n,s]),[n,i,l]}function Mz(t){return typeof t=="function"}function Rz(t,e){return N.useReducer((n,i)=>e[n][i]??n,t)}var Wd=t=>{const{present:e,children:n}=t,i=kz(e),s=typeof n=="function"?n({present:i.isPresent}):N.Children.only(n),l=Hi(i.ref,Oz(s));return typeof n=="function"||i.isPresent?N.cloneElement(s,{ref:l}):null};Wd.displayName="Presence";function kz(t){const[e,n]=N.useState(),i=N.useRef(null),s=N.useRef(t),l=N.useRef("none"),c=t?"mounted":"unmounted",[u,d]=Rz(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return N.useEffect(()=>{const h=xc(i.current);l.current=u==="mounted"?h:"none"},[u]),qo(()=>{const h=i.current,p=s.current;if(p!==t){const y=l.current,b=xc(h);t?d("MOUNT"):b==="none"||h?.display==="none"?d("UNMOUNT"):d(p&&y!==b?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,d]),qo(()=>{if(e){let h;const p=e.ownerDocument.defaultView??window,m=b=>{const w=xc(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&&(l.current=xc(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 xc(t){return t?.animationName||"none"}function Oz(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 Dz=y0[" useId ".trim().toString()]||(()=>{}),jz=0;function zz(t){const[e,n]=N.useState(Dz());return qo(()=>{n(i=>i??String(jz++))},[t]),e?`radix-${e}`:""}function wc(t){const e=N.useRef(t);return N.useEffect(()=>{e.current=t}),N.useMemo(()=>(...n)=>e.current?.(...n),[])}function Vz(t,e=globalThis?.document){const n=wc(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 Lz="DismissableLayer",Jd="dismissableLayer.update",Iz="dismissableLayer.pointerDownOutside",Bz="dismissableLayer.focusOutside",sx,ax=N.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),lx=N.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:l,onInteractOutside:c,onDismiss:u,...d}=t,h=N.useContext(ax),[p,m]=N.useState(null),y=p?.ownerDocument??globalThis?.document,[,b]=N.useState({}),x=Hi(e,k=>m(k)),w=Array.from(h.layers),[S]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),E=w.indexOf(S),O=p?w.indexOf(p):-1,C=h.layersWithOutsidePointerEventsDisabled.size>0,_=O>=E,R=Uz(k=>{const D=k.target,H=[...h.branches].some(Y=>Y.contains(D));!_||H||(s?.(k),c?.(k),k.defaultPrevented||u?.())},y),A=$z(k=>{const D=k.target;[...h.branches].some(Y=>Y.contains(D))||(l?.(k),c?.(k),k.defaultPrevented||u?.())},y);return Vz(k=>{O===h.layers.size-1&&(i?.(k),!k.defaultPrevented&&u&&(k.preventDefault(),u()))},y),N.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(sx=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),cx(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=sx)}},[p,y,n,h]),N.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),cx())},[p,h]),N.useEffect(()=>{const k=()=>b({});return document.addEventListener(Jd,k),()=>document.removeEventListener(Jd,k)},[]),M.jsx(Go.div,{...d,ref:x,style:{pointerEvents:C?_?"auto":"none":void 0,...t.style},onFocusCapture:po(t.onFocusCapture,A.onFocusCapture),onBlurCapture:po(t.onBlurCapture,A.onBlurCapture),onPointerDownCapture:po(t.onPointerDownCapture,R.onPointerDownCapture)})});lx.displayName=Lz;var Pz="DismissableLayerBranch",Hz=N.forwardRef((t,e)=>{const n=N.useContext(ax),i=N.useRef(null),s=Hi(e,i);return N.useEffect(()=>{const l=i.current;if(l)return n.branches.add(l),()=>{n.branches.delete(l)}},[n.branches]),M.jsx(Go.div,{...t,ref:s})});Hz.displayName=Pz;function Uz(t,e=globalThis?.document){const n=wc(t),i=N.useRef(!1),s=N.useRef(()=>{});return N.useEffect(()=>{const l=u=>{if(u.target&&!i.current){let d=function(){ux(Iz,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",l)},0);return()=>{window.clearTimeout(c),e.removeEventListener("pointerdown",l),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>i.current=!0}}function $z(t,e=globalThis?.document){const n=wc(t),i=N.useRef(!1);return N.useEffect(()=>{const s=l=>{l.target&&!i.current&&ux(Bz,n,{originalEvent:l},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function cx(){const t=new CustomEvent(Jd);document.dispatchEvent(t)}function ux(t,e,n,{discrete:i}){const s=n.originalEvent.target,l=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),i?wz(s,l):s.dispatchEvent(l)}var Yz="Portal",fx=N.forwardRef((t,e)=>{const{container:n,...i}=t,[s,l]=N.useState(!1);qo(()=>l(!0),[]);const c=n||s&&globalThis?.document?.body;return c?fD.createPortal(M.jsx(Go.div,{...i,ref:e}),c):null});fx.displayName=Yz;function Gz(t){const[e,n]=N.useState(void 0);return qo(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const l=s[0];let c,u;if("borderBoxSize"in l){const d=l.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 qz=["top","right","bottom","left"],Xo=Math.min,rn=Math.max,Sc=Math.round,Ec=Math.floor,Fn=t=>({x:t,y:t}),Xz={left:"right",right:"left",bottom:"top",top:"bottom"},Fz={start:"end",end:"start"};function th(t,e,n){return rn(t,Xo(e,n))}function mo(t,e){return typeof t=="function"?t(e):t}function go(t){return t.split("-")[0]}function kr(t){return t.split("-")[1]}function eh(t){return t==="x"?"y":"x"}function nh(t){return t==="y"?"height":"width"}const Zz=new Set(["top","bottom"]);function Zn(t){return Zz.has(go(t))?"y":"x"}function oh(t){return eh(Zn(t))}function Kz(t,e,n){n===void 0&&(n=!1);const i=kr(t),s=oh(t),l=nh(s);let c=s==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[l]>e.floating[l]&&(c=_c(c)),[c,_c(c)]}function Qz(t){const e=_c(t);return[ih(t),e,ih(e)]}function ih(t){return t.replace(/start|end/g,e=>Fz[e])}const dx=["left","right"],hx=["right","left"],Wz=["top","bottom"],Jz=["bottom","top"];function tV(t,e,n){switch(t){case"top":case"bottom":return n?e?hx:dx:e?dx:hx;case"left":case"right":return e?Wz:Jz;default:return[]}}function eV(t,e,n,i){const s=kr(t);let l=tV(go(t),n==="start",i);return s&&(l=l.map(c=>c+"-"+s),e&&(l=l.concat(l.map(ih)))),l}function _c(t){return t.replace(/left|right|bottom|top/g,e=>Xz[e])}function nV(t){return{top:0,right:0,bottom:0,left:0,...t}}function px(t){return typeof t!="number"?nV(t):{top:t,right:t,bottom:t,left:t}}function Cc(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 mx(t,e,n){let{reference:i,floating:s}=t;const l=Zn(e),c=oh(e),u=nh(c),d=go(e),h=l==="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(kr(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 oV(t,e){var n;e===void 0&&(e={});const{x:i,y:s,platform:l,rects:c,elements:u,strategy:d}=t,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:y=!1,padding:b=0}=mo(e,t),x=px(b),S=u[y?m==="floating"?"reference":"floating":m],E=Cc(await l.getClippingRect({element:(n=await(l.isElement==null?void 0:l.isElement(S)))==null||n?S:S.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(u.floating)),boundary:h,rootBoundary:p,strategy:d})),O=m==="floating"?{x:i,y:s,width:c.floating.width,height:c.floating.height}:c.reference,C=await(l.getOffsetParent==null?void 0:l.getOffsetParent(u.floating)),_=await(l.isElement==null?void 0:l.isElement(C))?await(l.getScale==null?void 0:l.getScale(C))||{x:1,y:1}:{x:1,y:1},R=Cc(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:O,offsetParent:C,strategy:d}):O);return{top:(E.top-R.top+x.top)/_.y,bottom:(R.bottom-E.bottom+x.bottom)/_.y,left:(E.left-R.left+x.left)/_.x,right:(R.right-E.right+x.right)/_.x}}const iV=async(t,e,n)=>{const{placement:i="bottom",strategy:s="absolute",middleware:l=[],platform:c}=n,u=l.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}=mx(h,i,d),y=i,b={},x=0;for(let S=0;S<u.length;S++){var w;const{name:E,fn:O}=u[S],{x:C,y:_,data:R,reset:A}=await O({x:p,y:m,initialPlacement:i,placement:y,strategy:s,middlewareData:b,rects:h,platform:{...c,detectOverflow:(w=c.detectOverflow)!=null?w:oV},elements:{reference:t,floating:e}});p=C??p,m=_??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}=mx(h,y,d)),S=-1)}return{x:p,y:m,placement:y,strategy:s,middlewareData:b}},rV=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:i,placement:s,rects:l,platform:c,elements:u,middlewareData:d}=e,{element:h,padding:p=0}=mo(t,e)||{};if(h==null)return{};const m=px(p),y={x:n,y:i},b=oh(s),x=nh(b),w=await c.getDimensions(h),S=b==="y",E=S?"top":"left",O=S?"bottom":"right",C=S?"clientHeight":"clientWidth",_=l.reference[x]+l.reference[b]-y[b]-l.floating[x],R=y[b]-l.reference[b],A=await(c.getOffsetParent==null?void 0:c.getOffsetParent(h));let k=A?A[C]:0;(!k||!await(c.isElement==null?void 0:c.isElement(A)))&&(k=u.floating[C]||l.floating[x]);const D=_/2-R/2,H=k/2-w[x]/2-1,Y=Xo(m[E],H),$=Xo(m[O],H),F=Y,Q=k-w[x]-$,B=k/2-w[x]/2+D,P=th(F,B,Q),j=!d.arrow&&kr(s)!=null&&B!==P&&l.reference[x]/2-(B<F?Y:$)-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}}}),sV=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,i;const{placement:s,middlewareData:l,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}=mo(t,e);if((n=l.arrow)!=null&&n.alignmentOffset)return{};const E=go(s),O=Zn(u),C=go(u)===u,_=await(d.isRTL==null?void 0:d.isRTL(h.floating)),R=y||(C||!w?[_c(u)]:Qz(u)),A=x!=="none";!y&&A&&R.push(...eV(u,w,x,_));const k=[u,...R],D=await d.detectOverflow(e,S),H=[];let Y=((i=l.flip)==null?void 0:i.overflows)||[];if(p&&H.push(D[E]),m){const B=Kz(s,c,_);H.push(D[B[0]],D[B[1]])}if(Y=[...Y,{placement:s,overflows:H}],!H.every(B=>B<=0)){var $,F;const B=((($=l.flip)==null?void 0:$.index)||0)+1,P=k[B];if(P&&(!(m==="alignment"?O!==Zn(P):!1)||Y.every(z=>Zn(z.placement)===O?z.overflows[0]>0:!0)))return{data:{index:B,overflows:Y},reset:{placement:P}};let j=(F=Y.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=Y.filter(z=>{if(A){const U=Zn(z.placement);return U===O||U==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(U=>U>0).reduce((U,G)=>U+G,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 gx(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function yx(t){return qz.some(e=>t[e]>=0)}const aV=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:i}=e,{strategy:s="referenceHidden",...l}=mo(t,e);switch(s){case"referenceHidden":{const c=await i.detectOverflow(e,{...l,elementContext:"reference"}),u=gx(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:yx(u)}}}case"escaped":{const c=await i.detectOverflow(e,{...l,altBoundary:!0}),u=gx(c,n.floating);return{data:{escapedOffsets:u,escaped:yx(u)}}}default:return{}}}}},vx=new Set(["left","top"]);async function lV(t,e){const{placement:n,platform:i,elements:s}=t,l=await(i.isRTL==null?void 0:i.isRTL(s.floating)),c=go(n),u=kr(n),d=Zn(n)==="y",h=vx.has(c)?-1:1,p=l&&d?-1:1,m=mo(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 cV=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;const{x:s,y:l,placement:c,middlewareData:u}=e,d=await lV(e,t);return c===((n=u.offset)==null?void 0:n.placement)&&(i=u.arrow)!=null&&i.alignmentOffset?{}:{x:s+d.x,y:l+d.y,data:{...d,placement:c}}}}},uV=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:i,placement:s,platform:l}=e,{mainAxis:c=!0,crossAxis:u=!1,limiter:d={fn:E=>{let{x:O,y:C}=E;return{x:O,y:C}}},...h}=mo(t,e),p={x:n,y:i},m=await l.detectOverflow(e,h),y=Zn(go(s)),b=eh(y);let x=p[b],w=p[y];if(c){const E=b==="y"?"top":"left",O=b==="y"?"bottom":"right",C=x+m[E],_=x-m[O];x=th(C,x,_)}if(u){const E=y==="y"?"top":"left",O=y==="y"?"bottom":"right",C=w+m[E],_=w-m[O];w=th(C,w,_)}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}}}}}},fV=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:i,placement:s,rects:l,middlewareData:c}=e,{offset:u=0,mainAxis:d=!0,crossAxis:h=!0}=mo(t,e),p={x:n,y:i},m=Zn(s),y=eh(m);let b=p[y],x=p[m];const w=mo(u,e),S=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(d){const C=y==="y"?"height":"width",_=l.reference[y]-l.floating[C]+S.mainAxis,R=l.reference[y]+l.reference[C]-S.mainAxis;b<_?b=_:b>R&&(b=R)}if(h){var E,O;const C=y==="y"?"width":"height",_=vx.has(go(s)),R=l.reference[m]-l.floating[C]+(_&&((E=c.offset)==null?void 0:E[m])||0)+(_?0:S.crossAxis),A=l.reference[m]+l.reference[C]+(_?0:((O=c.offset)==null?void 0:O[m])||0)-(_?S.crossAxis:0);x<R?x=R:x>A&&(x=A)}return{[y]:b,[m]:x}}}},dV=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,i;const{placement:s,rects:l,platform:c,elements:u}=e,{apply:d=()=>{},...h}=mo(t,e),p=await c.detectOverflow(e,h),m=go(s),y=kr(s),b=Zn(s)==="y",{width:x,height:w}=l.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 O=w-p.top-p.bottom,C=x-p.left-p.right,_=Xo(w-p[S],O),R=Xo(x-p[E],C),A=!e.middlewareData.shift;let k=_,D=R;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(D=C),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(k=O),A&&!y){const Y=rn(p.left,0),$=rn(p.right,0),F=rn(p.top,0),Q=rn(p.bottom,0);b?D=x-2*(Y!==0||$!==0?Y+$:rn(p.left,p.right)):k=w-2*(F!==0||Q!==0?F+Q:rn(p.top,p.bottom))}await d({...e,availableWidth:D,availableHeight:k});const H=await c.getDimensions(u.floating);return x!==H.width||w!==H.height?{reset:{rects:!0}}:{}}}};function Tc(){return typeof window<"u"}function Or(t){return bx(t)?(t.nodeName||"").toLowerCase():"#document"}function sn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Kn(t){var e;return(e=(bx(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function bx(t){return Tc()?t instanceof Node||t instanceof sn(t).Node:!1}function On(t){return Tc()?t instanceof Element||t instanceof sn(t).Element:!1}function Qn(t){return Tc()?t instanceof HTMLElement||t instanceof sn(t).HTMLElement:!1}function xx(t){return!Tc()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof sn(t).ShadowRoot}const hV=new Set(["inline","contents"]);function ua(t){const{overflow:e,overflowX:n,overflowY:i,display:s}=Dn(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!hV.has(s)}const pV=new Set(["table","td","th"]);function mV(t){return pV.has(Or(t))}const gV=[":popover-open",":modal"];function Nc(t){return gV.some(e=>{try{return t.matches(e)}catch{return!1}})}const yV=["transform","translate","scale","rotate","perspective"],vV=["transform","translate","scale","rotate","perspective","filter"],bV=["paint","layout","strict","content"];function rh(t){const e=sh(),n=On(t)?Dn(t):t;return yV.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)||vV.some(i=>(n.willChange||"").includes(i))||bV.some(i=>(n.contain||"").includes(i))}function xV(t){let e=Fo(t);for(;Qn(e)&&!Dr(e);){if(rh(e))return e;if(Nc(e))return null;e=Fo(e)}return null}function sh(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const wV=new Set(["html","body","#document"]);function Dr(t){return wV.has(Or(t))}function Dn(t){return sn(t).getComputedStyle(t)}function Ac(t){return On(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Fo(t){if(Or(t)==="html")return t;const e=t.assignedSlot||t.parentNode||xx(t)&&t.host||Kn(t);return xx(e)?e.host:e}function wx(t){const e=Fo(t);return Dr(e)?t.ownerDocument?t.ownerDocument.body:t.body:Qn(e)&&ua(e)?e:wx(e)}function fa(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=wx(t),l=s===((i=t.ownerDocument)==null?void 0:i.body),c=sn(s);if(l){const u=ah(c);return e.concat(c,c.visualViewport||[],ua(s)?s:[],u&&n?fa(u):[])}return e.concat(s,fa(s,[],n))}function ah(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Sx(t){const e=Dn(t);let n=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=Qn(t),l=s?t.offsetWidth:n,c=s?t.offsetHeight:i,u=Sc(n)!==l||Sc(i)!==c;return u&&(n=l,i=c),{width:n,height:i,$:u}}function lh(t){return On(t)?t:t.contextElement}function jr(t){const e=lh(t);if(!Qn(e))return Fn(1);const n=e.getBoundingClientRect(),{width:i,height:s,$:l}=Sx(e);let c=(l?Sc(n.width):n.width)/i,u=(l?Sc(n.height):n.height)/s;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const SV=Fn(0);function Ex(t){const e=sn(t);return!sh()||!e.visualViewport?SV:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function EV(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==sn(t)?!1:e}function Ui(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),l=lh(t);let c=Fn(1);e&&(i?On(i)&&(c=jr(i)):c=jr(t));const u=EV(l,n,i)?Ex(l):Fn(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(l){const y=sn(l),b=i&&On(i)?sn(i):i;let x=y,w=ah(x);for(;w&&i&&b!==x;){const S=jr(w),E=w.getBoundingClientRect(),O=Dn(w),C=E.left+(w.clientLeft+parseFloat(O.paddingLeft))*S.x,_=E.top+(w.clientTop+parseFloat(O.paddingTop))*S.y;d*=S.x,h*=S.y,p*=S.x,m*=S.y,d+=C,h+=_,x=sn(w),w=ah(x)}}return Cc({width:p,height:m,x:d,y:h})}function Mc(t,e){const n=Ac(t).scrollLeft;return e?e.left+n:Ui(Kn(t)).left+n}function _x(t,e){const n=t.getBoundingClientRect(),i=n.left+e.scrollLeft-Mc(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 l=s==="fixed",c=Kn(i),u=e?Nc(e.floating):!1;if(i===c||u&&l)return n;let d={scrollLeft:0,scrollTop:0},h=Fn(1);const p=Fn(0),m=Qn(i);if((m||!m&&!l)&&((Or(i)!=="body"||ua(c))&&(d=Ac(i)),Qn(i))){const b=Ui(i);h=jr(i),p.x=b.x+i.clientLeft,p.y=b.y+i.clientTop}const y=c&&!m&&!l?_x(c,d):Fn(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 CV(t){return Array.from(t.getClientRects())}function TV(t){const e=Kn(t),n=Ac(t),i=t.ownerDocument.body,s=rn(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),l=rn(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let c=-n.scrollLeft+Mc(t);const u=-n.scrollTop;return Dn(i).direction==="rtl"&&(c+=rn(e.clientWidth,i.clientWidth)-s),{width:s,height:l,x:c,y:u}}const Cx=25;function NV(t,e){const n=sn(t),i=Kn(t),s=n.visualViewport;let l=i.clientWidth,c=i.clientHeight,u=0,d=0;if(s){l=s.width,c=s.height;const p=sh();(!p||p&&e==="fixed")&&(u=s.offsetLeft,d=s.offsetTop)}const h=Mc(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<=Cx&&(l-=x)}else h<=Cx&&(l+=h);return{width:l,height:c,x:u,y:d}}const AV=new Set(["absolute","fixed"]);function MV(t,e){const n=Ui(t,!0,e==="fixed"),i=n.top+t.clientTop,s=n.left+t.clientLeft,l=Qn(t)?jr(t):Fn(1),c=t.clientWidth*l.x,u=t.clientHeight*l.y,d=s*l.x,h=i*l.y;return{width:c,height:u,x:d,y:h}}function Tx(t,e,n){let i;if(e==="viewport")i=NV(t,n);else if(e==="document")i=TV(Kn(t));else if(On(e))i=MV(e,n);else{const s=Ex(t);i={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Cc(i)}function Nx(t,e){const n=Fo(t);return n===e||!On(n)||Dr(n)?!1:Dn(n).position==="fixed"||Nx(n,e)}function RV(t,e){const n=e.get(t);if(n)return n;let i=fa(t,[],!1).filter(u=>On(u)&&Or(u)!=="body"),s=null;const l=Dn(t).position==="fixed";let c=l?Fo(t):t;for(;On(c)&&!Dr(c);){const u=Dn(c),d=rh(c);!d&&u.position==="fixed"&&(s=null),(l?!d&&!s:!d&&u.position==="static"&&!!s&&AV.has(s.position)||ua(c)&&!d&&Nx(t,c))?i=i.filter(p=>p!==c):s=u,c=Fo(c)}return e.set(t,i),i}function kV(t){let{element:e,boundary:n,rootBoundary:i,strategy:s}=t;const c=[...n==="clippingAncestors"?Nc(e)?[]:RV(e,this._c):[].concat(n),i],u=c[0],d=c.reduce((h,p)=>{const m=Tx(e,p,s);return h.top=rn(m.top,h.top),h.right=Xo(m.right,h.right),h.bottom=Xo(m.bottom,h.bottom),h.left=rn(m.left,h.left),h},Tx(e,u,s));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function OV(t){const{width:e,height:n}=Sx(t);return{width:e,height:n}}function DV(t,e,n){const i=Qn(e),s=Kn(e),l=n==="fixed",c=Ui(t,!0,l,e);let u={scrollLeft:0,scrollTop:0};const d=Fn(0);function h(){d.x=Mc(s)}if(i||!i&&!l)if((Or(e)!=="body"||ua(s))&&(u=Ac(e)),i){const b=Ui(e,!0,l,e);d.x=b.x+e.clientLeft,d.y=b.y+e.clientTop}else s&&h();l&&!i&&s&&h();const p=s&&!i&&!l?_x(s,u):Fn(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 ch(t){return Dn(t).position==="static"}function Ax(t,e){if(!Qn(t)||Dn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Kn(t)===n&&(n=n.ownerDocument.body),n}function Mx(t,e){const n=sn(t);if(Nc(t))return n;if(!Qn(t)){let s=Fo(t);for(;s&&!Dr(s);){if(On(s)&&!ch(s))return s;s=Fo(s)}return n}let i=Ax(t,e);for(;i&&mV(i)&&ch(i);)i=Ax(i,e);return i&&Dr(i)&&ch(i)&&!rh(i)?n:i||xV(t)||n}const jV=async function(t){const e=this.getOffsetParent||Mx,n=this.getDimensions,i=await n(t.floating);return{reference:DV(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function zV(t){return Dn(t).direction==="rtl"}const VV={convertOffsetParentRelativeRectToViewportRelativeRect:_V,getDocumentElement:Kn,getClippingRect:kV,getOffsetParent:Mx,getElementRects:jV,getClientRects:CV,getDimensions:OV,getScale:jr,isElement:On,isRTL:zV};function Rx(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function LV(t,e){let n=null,i;const s=Kn(t);function l(){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),l();const h=t.getBoundingClientRect(),{left:p,top:m,width:y,height:b}=h;if(u||e(),!y||!b)return;const x=Ec(m),w=Ec(s.clientWidth-(p+y)),S=Ec(s.clientHeight-(m+b)),E=Ec(p),C={rootMargin:-x+"px "+-w+"px "+-S+"px "+-E+"px",threshold:rn(0,Xo(1,d))||1};let _=!0;function R(A){const k=A[0].intersectionRatio;if(k!==d){if(!_)return c();k?c(!1,k):i=setTimeout(()=>{c(!1,1e-7)},1e3)}k===1&&!Rx(h,t.getBoundingClientRect())&&c(),_=!1}try{n=new IntersectionObserver(R,{...C,root:s.ownerDocument})}catch{n=new IntersectionObserver(R,C)}n.observe(t)}return c(!0),l}function IV(t,e,n,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:l=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=i,h=lh(t),p=s||l?[...h?fa(h):[],...fa(e)]:[];p.forEach(E=>{s&&E.addEventListener("scroll",n,{passive:!0}),l&&E.addEventListener("resize",n)});const m=h&&u?LV(h,n):null;let y=-1,b=null;c&&(b=new ResizeObserver(E=>{let[O]=E;O&&O.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?Ui(t):null;d&&S();function S(){const E=Ui(t);w&&!Rx(w,E)&&n(),w=E,x=requestAnimationFrame(S)}return n(),()=>{var E;p.forEach(O=>{s&&O.removeEventListener("scroll",n),l&&O.removeEventListener("resize",n)}),m?.(),(E=b)==null||E.disconnect(),b=null,d&&cancelAnimationFrame(x)}}const BV=cV,PV=uV,HV=sV,UV=dV,$V=aV,kx=rV,YV=fV,GV=(t,e,n)=>{const i=new Map,s={platform:VV,...n},l={...s.platform,_c:i};return iV(t,e,{...s,platform:l})};var qV=typeof document<"u",XV=function(){},Rc=qV?N.useLayoutEffect:XV;function kc(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(!kc(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 l=s[i];if(!(l==="_owner"&&t.$$typeof)&&!kc(t[l],e[l]))return!1}return!0}return t!==t&&e!==e}function Ox(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function Dx(t,e){const n=Ox(t);return Math.round(e*n)/n}function uh(t){const e=N.useRef(t);return Rc(()=>{e.current=t}),e}function FV(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:i=[],platform:s,elements:{reference:l,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);kc(y,i)||b(i);const[x,w]=N.useState(null),[S,E]=N.useState(null),O=N.useCallback(z=>{z!==A.current&&(A.current=z,w(z))},[]),C=N.useCallback(z=>{z!==k.current&&(k.current=z,E(z))},[]),_=l||x,R=c||S,A=N.useRef(null),k=N.useRef(null),D=N.useRef(p),H=d!=null,Y=uh(d),$=uh(s),F=uh(h),Q=N.useCallback(()=>{if(!A.current||!k.current)return;const z={placement:e,strategy:n,middleware:y};$.current&&(z.platform=$.current),GV(A.current,k.current,z).then(U=>{const G={...U,isPositioned:F.current!==!1};B.current&&!kc(D.current,G)&&(D.current=G,Ud.flushSync(()=>{m(G)}))})},[y,e,n,$,F]);Rc(()=>{h===!1&&D.current.isPositioned&&(D.current.isPositioned=!1,m(z=>({...z,isPositioned:!1})))},[h]);const B=N.useRef(!1);Rc(()=>(B.current=!0,()=>{B.current=!1}),[]),Rc(()=>{if(_&&(A.current=_),R&&(k.current=R),_&&R){if(Y.current)return Y.current(_,R,Q);Q()}},[_,R,Q,Y,H]);const P=N.useMemo(()=>({reference:A,floating:k,setReference:O,setFloating:C}),[O,C]),j=N.useMemo(()=>({reference:_,floating:R}),[_,R]),I=N.useMemo(()=>{const z={position:n,left:0,top:0};if(!j.floating)return z;const U=Dx(j.floating,p.x),G=Dx(j.floating,p.y);return u?{...z,transform:"translate("+U+"px, "+G+"px)",...Ox(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:G}},[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 ZV=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?kx({element:i.current,padding:s}).fn(n):{}:i?kx({element:i,padding:s}).fn(n):{}}}},KV=(t,e)=>({...BV(t),options:[t,e]}),QV=(t,e)=>({...PV(t),options:[t,e]}),WV=(t,e)=>({...YV(t),options:[t,e]}),JV=(t,e)=>({...HV(t),options:[t,e]}),t4=(t,e)=>({...UV(t),options:[t,e]}),e4=(t,e)=>({...$V(t),options:[t,e]}),n4=(t,e)=>({...ZV(t),options:[t,e]});var o4="Arrow",jx=N.forwardRef((t,e)=>{const{children:n,width:i=10,height:s=5,...l}=t;return M.jsx(Go.svg,{...l,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"})})});jx.displayName=o4;var i4=jx,fh="Popper",[zx,Vx]=rx(fh),[r4,Lx]=zx(fh),Ix=t=>{const{__scopePopper:e,children:n}=t,[i,s]=N.useState(null);return M.jsx(r4,{scope:e,anchor:i,onAnchorChange:s,children:n})};Ix.displayName=fh;var Bx="PopperAnchor",Px=N.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:i,...s}=t,l=Lx(Bx,n),c=N.useRef(null),u=Hi(e,c),d=N.useRef(null);return N.useEffect(()=>{const h=d.current;d.current=i?.current||c.current,h!==d.current&&l.onAnchorChange(d.current)}),i?null:M.jsx(Go.div,{...s,ref:u})});Px.displayName=Bx;var dh="PopperContent",[s4,a4]=zx(dh),Hx=N.forwardRef((t,e)=>{const{__scopePopper:n,side:i="bottom",sideOffset:s=0,align:l="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=Lx(dh,n),[E,O]=N.useState(null),C=Hi(e,ft=>O(ft)),[_,R]=N.useState(null),A=Gz(_),k=A?.width??0,D=A?.height??0,H=i+(l!=="center"?"-"+l:""),Y=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},$=Array.isArray(h)?h:[h],F=$.length>0,Q={padding:Y,boundary:$.filter(c4),altBoundary:F},{refs:B,floatingStyles:P,placement:j,isPositioned:I,middlewareData:z}=FV({strategy:"fixed",placement:H,whileElementsMounted:(...ft)=>IV(...ft,{animationFrame:b==="always"}),elements:{reference:S.anchor},middleware:[KV({mainAxis:s+D,alignmentAxis:c}),d&&QV({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?WV():void 0,...Q}),d&&JV({...Q}),t4({...Q,apply:({elements:ft,rects:ut,availableWidth:dt,availableHeight:kt})=>{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",`${kt}px`),Tt.setProperty("--radix-popper-anchor-width",`${At}px`),Tt.setProperty("--radix-popper-anchor-height",`${bt}px`)}}),_&&n4({element:_,padding:u}),u4({arrowWidth:k,arrowHeight:D}),y&&e4({strategy:"referenceHidden",...Q})]}),[U,G]=Yx(j),L=wc(x);qo(()=>{I&&L?.()},[I,L]);const q=z.arrow?.x,tt=z.arrow?.y,rt=z.arrow?.centerOffset!==0,[ct,ht]=N.useState();return qo(()=>{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: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(s4,{scope:n,placedSide:U,onArrowChange:R,arrowX:q,arrowY:tt,shouldHideArrow:rt,children:M.jsx(Go.div,{"data-side":U,"data-align":G,...w,ref:C,style:{...w.style,animation:I?void 0:"none"}})})})});Hx.displayName=dh;var Ux="PopperArrow",l4={top:"bottom",right:"left",bottom:"top",left:"right"},$x=N.forwardRef(function(e,n){const{__scopePopper:i,...s}=e,l=a4(Ux,i),c=l4[l.placedSide];return M.jsx("span",{ref:l.onArrowChange,style:{position:"absolute",left:l.arrowX,top:l.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[l.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[l.placedSide],visibility:l.shouldHideArrow?"hidden":void 0},children:M.jsx(i4,{...s,ref:n,style:{...s.style,display:"block"}})})});$x.displayName=Ux;function c4(t){return t!==null}var u4=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]=Yx(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 Yx(t){const[e,n="center"]=t.split("-");return[e,n]}var f4=Ix,d4=Px,h4=Hx,p4=$x,[Oc]=rx("Tooltip",[Vx]),Dc=Vx(),Gx="TooltipProvider",m4=700,hh="tooltip.open",[g4,ph]=Oc(Gx),qx=t=>{const{__scopeTooltip:e,delayDuration:n=m4,skipDelayDuration:i=300,disableHoverableContent:s=!1,children:l}=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(g4,{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:l})};qx.displayName=Gx;var da="Tooltip",[y4,ha]=Oc(da),Xx=t=>{const{__scopeTooltip:e,children:n,open:i,defaultOpen:s,onOpenChange:l,disableHoverableContent:c,delayDuration:u}=t,d=ph(da,t.__scopeTooltip),h=Dc(e),[p,m]=N.useState(null),y=zz(),b=N.useRef(0),x=c??d.disableHoverableContent,w=u??d.delayDuration,S=N.useRef(!1),[E,O]=Nz({prop:i,defaultProp:s??!1,onChange:k=>{k?(d.onOpen(),document.dispatchEvent(new CustomEvent(hh))):d.onClose(),l?.(k)},caller:da}),C=N.useMemo(()=>E?S.current?"delayed-open":"instant-open":"closed",[E]),_=N.useCallback(()=>{window.clearTimeout(b.current),b.current=0,S.current=!1,O(!0)},[O]),R=N.useCallback(()=>{window.clearTimeout(b.current),b.current=0,O(!1)},[O]),A=N.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{S.current=!0,O(!0),b.current=0},w)},[w,O]);return N.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),M.jsx(f4,{...h,children:M.jsx(y4,{scope:e,contentId:y,open:E,stateAttribute:C,trigger:p,onTriggerChange:m,onTriggerEnter:N.useCallback(()=>{d.isOpenDelayedRef.current?A():_()},[d.isOpenDelayedRef,A,_]),onTriggerLeave:N.useCallback(()=>{x?R():(window.clearTimeout(b.current),b.current=0)},[R,x]),onOpen:_,onClose:R,disableHoverableContent:x,children:n})})};Xx.displayName=da;var mh="TooltipTrigger",Fx=N.forwardRef((t,e)=>{const{__scopeTooltip:n,...i}=t,s=ha(mh,n),l=ph(mh,n),c=Dc(n),u=N.useRef(null),d=Hi(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(d4,{asChild:!0,...c,children:M.jsx(Go.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:d,onPointerMove:po(t.onPointerMove,y=>{y.pointerType!=="touch"&&!p.current&&!l.isPointerInTransitRef.current&&(s.onTriggerEnter(),p.current=!0)}),onPointerLeave:po(t.onPointerLeave,()=>{s.onTriggerLeave(),p.current=!1}),onPointerDown:po(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:po(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:po(t.onBlur,s.onClose),onClick:po(t.onClick,s.onClose)})})});Fx.displayName=mh;var gh="TooltipPortal",[v4,b4]=Oc(gh,{forceMount:void 0}),Zx=t=>{const{__scopeTooltip:e,forceMount:n,children:i,container:s}=t,l=ha(gh,e);return M.jsx(v4,{scope:e,forceMount:n,children:M.jsx(Wd,{present:n||l.open,children:M.jsx(fx,{asChild:!0,container:s,children:i})})})};Zx.displayName=gh;var zr="TooltipContent",Kx=N.forwardRef((t,e)=>{const n=b4(zr,t.__scopeTooltip),{forceMount:i=n.forceMount,side:s="top",...l}=t,c=ha(zr,t.__scopeTooltip);return M.jsx(Wd,{present:i||c.open,children:c.disableHoverableContent?M.jsx(Qx,{side:s,...l,ref:e}):M.jsx(x4,{side:s,...l,ref:e})})}),x4=N.forwardRef((t,e)=>{const n=ha(zr,t.__scopeTooltip),i=ph(zr,t.__scopeTooltip),s=N.useRef(null),l=Hi(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},O=_4(E,S.getBoundingClientRect()),C=C4(E,O),_=T4(w.getBoundingClientRect()),R=A4([...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},O=d?.contains(S)||p?.contains(S),C=!N4(E,c);O?y():C&&(y(),h())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[d,p,c,h,y]),M.jsx(Qx,{...t,ref:l})}),[w4,S4]=Oc(da,{isInside:!1}),E4=gz("TooltipContent"),Qx=N.forwardRef((t,e)=>{const{__scopeTooltip:n,children:i,"aria-label":s,onEscapeKeyDown:l,onPointerDownOutside:c,...u}=t,d=ha(zr,n),h=Dc(n),{onClose:p}=d;return N.useEffect(()=>(document.addEventListener(hh,p),()=>document.removeEventListener(hh,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(lx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:m=>m.preventDefault(),onDismiss:p,children:M.jsxs(h4,{"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(E4,{children:i}),M.jsx(w4,{scope:n,isInside:!0,children:M.jsx(_z,{id:d.contentId,role:"tooltip",children:s||i})})]})})});Kx.displayName=zr;var Wx="TooltipArrow",Jx=N.forwardRef((t,e)=>{const{__scopeTooltip:n,...i}=t,s=Dc(n);return S4(Wx,n).isInside?null:M.jsx(p4,{...s,...i,ref:e})});Jx.displayName=Wx;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),l=Math.abs(e.left-t.x);switch(Math.min(n,i,s,l)){case l:return"left";case s:return"right";case n:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function C4(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 T4(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 N4(t,e){const{x:n,y:i}=t;let s=!1;for(let l=0,c=e.length-1;l<e.length;c=l++){const u=e[l],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 A4(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),M4(e)}function M4(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 l=e[e.length-1],c=e[e.length-2];if((l.x-c.x)*(s.y-c.y)>=(l.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 l=n[n.length-1],c=n[n.length-2];if((l.x-c.x)*(s.y-c.y)>=(l.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 R4=qx,k4=Xx,O4=Fx,D4=Zx,j4=Kx,z4=Jx;function tw({delayDuration:t=0,...e}){return M.jsx(R4,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function ew({...t}){return M.jsx(k4,{"data-slot":"tooltip",...t})}function nw({...t}){return M.jsx(O4,{"data-slot":"tooltip-trigger",...t})}function ow({className:t,sideOffset:e=0,children:n,...i}){return M.jsx(D4,{children:M.jsxs(j4,{"data-slot":"tooltip-content",sideOffset:e,className:kn("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(z4,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function Vr(){return M.jsx(tw,{delayDuration:200,children:M.jsxs(ew,{children:[M.jsx(nw,{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(ow,{side:"top",sideOffset:4,children:"Double-click to inspect"})]})})}function V4({data:t}){const e=t.width??8,n=(1<<Math.min(e,31))-1,i=t.numericValue??0,[s,l]=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()),l(!0)},[i]),p=N.useCallback(()=>{const x=parseInt(c,10);isNaN(x)||d(x),l(!1)},[c,d]),m=N.useCallback(x=>{x.stopPropagation(),x.key==="Enter"?p():x.key==="Escape"&&l(!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 L4({data:t,selected:e}){const n=t.value??!1,i=t.componentRef==="Input",s=N.useCallback(c=>{c.stopPropagation(),t.onToggle?.()},[t]),l=t.outputNames.map((c,u)=>({name:c,index:u,type:"output",value:i?(t.numericValue??0)!==0:n}));return M.jsx(Xe,{outputPorts:l,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(Vr,{}),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(V4,{data:t}):M.jsxs(M.Fragment,{children:[M.jsx("button",{onClick:s,role:"switch","aria-checked":n,"aria-label":t.label||t.componentRef,className:kn("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:kn("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:kn("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:kn("text-xs font-semibold tracking-wide transition-colors duration-300",n?"text-emerald-400":"text-[var(--embed-text-secondary)]"),children:n?"ON":"OFF"})]})]})})}function I4({data:t,selected:e}){const n=t.numericValue??0,i=t.width??8,s=(1<<Math.min(i,31))-1,[l,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 O=E.toLowerCase().startsWith("0x")?parseInt(E,16):parseInt(E,10);isNaN(O)&&(O=0),O=Math.max(0,Math.min(s,O)),t.onValueChange?.(O),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(Xe,{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:[l?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 B4({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"})),l=t.outputNames.map((c,u)=>({name:c,index:u,type:"output"}));return M.jsx(Xe,{inputPorts:s,outputPorts:l,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 P4({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"})),l=u=>u.toString(16).toUpperCase().padStart(2,"0"),c=()=>{if(t.componentRef==="HexDisplay"){const u=l(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:kn("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:kn("text-xs font-semibold",n?"text-green-400":"text-[var(--embed-text-secondary)]"),children:n?"ON":"OFF"})]})};return M.jsx(Xe,{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(Vr,{}),c()]})})}function H4({data:t,selected:e}){const n=t.arguments?.width??8,i=t.arguments?.height??8,s=n*i,l=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(Xe,{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:l.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 U4({data:t,selected:e}){const n=t.__pixels??new Array(64).fill(0),i=8,s=16,l=2;return M.jsx(Xe,{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)*l,height:i*s+(i-1)*l,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+l),y:h*(s+l),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 $4({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,
|
|
26
|
-
`).length:0,
|
|
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:
|
|
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 rw={inputNode:L4,numericInputNode:I4,outputNode:P4,logicGateNode:X4,registerNode:F4,ramNode:Z4,romNode:K4,rv32iInstrMemNode:J4,ethFrameInputNode:B4,consoleNode:$4,uartTxNode:Y4,nicFifoNode:Q4,screenNode:H4,rasterDisplayNode:U4},sw={orthogonal:qd},yh={TRUE:"#22c55e",FALSE:"#94a3b8",UNDEFINED:"#cbd5e1"};function $i(t){return t.nodeId===""?`.${t.portName}`:`${t.nodeId}.${t.portName}`}function tL(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 eL(t,e,n,i,s){const l=[];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=tL(c.componentRef,h,p,b);let w,S,E,O,C,_,R;if(c.componentRef==="Switch"||c.componentRef==="Led"){let A=!1;if(i){if(c.componentRef==="Led"&&c.inputs.length>0){const k=$i({nodeId:c.id,portName:c.inputs[0].name}),D=i.get(k);D!==void 0&&(w=!!D,A=!0)}else if(c.componentRef==="Switch"&&c.outputs.length>0){const k=$i({nodeId:c.id,portName:c.outputs[0].name}),D=i.get(k);D!==void 0&&(w=!!D,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 k=$i({nodeId:c.id,portName:c.outputs[0].name}),D=i.get(k);D!==void 0&&typeof D=="number"&&(S=D,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=$i({nodeId:c.id,portName:c.inputs[0].name}),k=i.get(A);S=typeof k=="number"?k:0}}else if(c.componentRef==="Screen"){const A=c.arguments.width??8,k=c.arguments.height??8,D=A*k;if(O=new Array(D).fill(0),s&&i){const H=Array.from(t.connections).find(Y=>Y.target.nodeId===c.id&&Y.target.portName==="dataIn");if(H){const Y=t.nodes.find($=>$.id===H.source.nodeId);if(Y?.componentRef==="DualPortRAM"){const $=s.currentState.get(Y.id);if($ instanceof Map)for(let F=0;F<D;F++)O[F]=$.get(F)??0}else if(Y?.componentRef==="Mux"){const $=$i({nodeId:Y.id,portName:"sel"}),Q=i.get($)===0?"in0":"in1",B=Array.from(t.connections).find(P=>P.target.nodeId===Y.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<D;I++)O[I]=j.get(I)??0}}}}}}else if(c.componentRef==="RasterDisplay"){const A=c.arguments.width??8,k=c.arguments.height??8,D=A*k;if(O=new Array(D).fill(0),s){const H=s.currentState.get(c.id);if(H instanceof Map)for(let Y=0;Y<D;Y++)O[Y]=H.get(Y)??0}}else if(c.componentRef==="Console"){if(s){const A=s.currentState.get(c.id);typeof A=="string"&&(C=A)}}else if(c.componentRef==="UART_TX"){if(s){const A=s.currentState.get(c.id);typeof A=="string"&&(_=A)}}else if(c.componentRef==="NIC_FIFO"&&s){const A=s.currentState.get(c.id);if(A instanceof Map){const k=A,D=k.get(8192)??0,H=k.get(8193)??0,Y=k.get(8210)??0,$=(k.get(8196)??0)!==0;R={txCount:D-H,rxCount:Y,draining:$}}}l.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:O,__consoleText:C,__uartText:_,__nicState:R},selectable:!0,deletable:!1})}if(s){const c=new Set(l.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");l.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 l}function nL(t,e){const n=[];for(const i of t.connections){let s=yh.UNDEFINED;if(e){const l=e.get($i(i.source))??e.get($i(i.target));l!==void 0&&(s=(typeof l=="boolean"?l:l!==0)?yh.TRUE:yh.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 oL(t,e,n,i,s){return t?{nodes:eL(t,e,n,i,s),edges:nL(t,i)}:{nodes:[],edges:[]}}var aw=Object.defineProperty,iL=(t,e,n)=>e in t?aw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,rL=(t,e)=>{for(var n in e)aw(t,n,{get:e[n],enumerable:!0})},sL=(t,e,n)=>iL(t,e+"",n),lw={};rL(lw,{Graph:()=>pn,alg:()=>bh,json:()=>dw,version:()=>cL});var aL=Object.defineProperty,cw=(t,e)=>{for(var n in e)aL(t,n,{get:e[n],enumerable:!0})},pn=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,l])=>{t(s)&&e.setNode(s,l)}),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 l=this.parent(s);return!l||e.hasNode(l)?(n[s]=l??void 0,l??void 0):l in n?n[l]:i(l)};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,l,c,u,d=!1;typeof t=="object"&&t!==null&&"v"in t?(s=t.v,l=t.w,c=t.name,arguments.length===2&&(u=e,d=!0)):(s=t,l=e,c=i,arguments.length>2&&(u=n,d=!0)),s=""+s,l=""+l,c!==void 0&&(c=""+c);let h=pa(this._isDirected,s,l,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(l),this._edgeLabels[h]=d?u:this._defaultEdgeLabelFn(s,l,c);let p=lL(this._isDirected,s,l,c);return s=p.v,l=p.w,Object.freeze(p),this._edgeObjs[h]=p,uw(this._preds[l],s),uw(this._sucs[s],l),this._in[l][h]=p,this._out[s][h]=p,this._edgeCount++,this}edge(t,e,n){let i=arguments.length===1?vh(this._isDirected,t):pa(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?vh(this._isDirected,t):pa(this._isDirected,t,e,n))in this._edgeLabels}removeEdge(t,e,n){let i=arguments.length===1?vh(this._isDirected,t):pa(this._isDirected,t,e,n),s=this._edgeObjs[i];if(s){let l=s.v,c=s.w;delete this._edgeLabels[i],delete this._edgeObjs[i],fw(this._preds[c],l),fw(this._sucs[l],c),delete this._in[c][i],delete this._out[l][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 uw(t,e){t[e]?t[e]++:t[e]=1}function fw(t,e){t[e]!==void 0&&!--t[e]&&delete t[e]}function pa(t,e,n,i){let s=""+e,l=""+n;if(!t&&s>l){let c=s;s=l,l=c}return s+""+l+""+(i===void 0?"\0":i)}function lL(t,e,n,i){let s=""+e,l=""+n;if(!t&&s>l){let u=s;s=l,l=u}let c={v:s,w:l};return i&&(c.name=i),c}function vh(t,e){return pa(t,e.v,e.w,e.name)}var cL="4.0.1",dw={};cw(dw,{read:()=>hL,write:()=>uL});function uL(t){let e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:fL(t),edges:dL(t)},n=t.graph();return n!==void 0&&(e.value=structuredClone(n)),e}function fL(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 dL(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 hL(t){let e=new pn(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 bh={};cw(bh,{CycleException:()=>zc,bellmanFord:()=>hw,components:()=>gL,dijkstra:()=>jc,dijkstraAll:()=>bL,findCycles:()=>xL,floydWarshall:()=>SL,isAcyclic:()=>_L,postorder:()=>TL,preorder:()=>NL,prim:()=>AL,shortestPaths:()=>ML,tarjan:()=>mw,topsort:()=>gw});var pL=()=>1;function hw(t,e,n,i){return mL(t,String(e),n||pL,i||function(s){return t.outEdges(s)})}function mL(t,e,n,i){let s={},l,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},l=!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&&(l=!1,c++,h(),!!l);m++);if(c===p-1&&(l=!1,h(),l))throw new Error("The graph contains a negative weight cycle");return s}function gL(t){let e={},n=[],i;function s(l){l in e||(e[l]=!0,i.push(l),t.successors(l).forEach(s),t.predecessors(l).forEach(s))}return t.nodes().forEach(function(l){i=[],s(l),i.length&&n.push(i)}),n}var pw=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,l=s.length;return n[i]=l,s.push({key:i,priority:e}),this._decrease(l),!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],l=n[e];n[t]=l,n[e]=s,i[l.key]=t,i[s.key]=e}},yL=()=>1;function jc(t,e,n,i){let s=function(l){return t.outEdges(l)};return vL(t,String(e),n||yL,i||s)}function vL(t,e,n,i){let s={},l=new pw,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,l.decrease(p,b))};for(t.nodes().forEach(function(h){let p=h===e?0:Number.POSITIVE_INFINITY;s[h]={distance:p,predecessor:""},l.add(h,p)});l.size()>0&&(c=l.removeMin(),u=s[c],u.distance!==Number.POSITIVE_INFINITY);)i(c).forEach(d);return s}function bL(t,e,n){return t.nodes().reduce(function(i,s){return i[s]=jc(t,s,e,n),i},{})}function mw(t){let e=0,n=[],i={},s=[];function l(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)):(l(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||l(c)}),s}function xL(t){return mw(t).filter(function(e){return e.length>1||e.length===1&&t.hasEdge(e[0],e[0])})}var wL=()=>1;function SL(t,e,n){return EL(t,e||wL,n||function(i){return t.outEdges(i)})}function EL(t,e,n){let i={},s=t.nodes();return s.forEach(function(l){i[l]={},i[l][l]={distance:0,predecessor:""},s.forEach(function(c){l!==c&&(i[l][c]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(l).forEach(function(c){let u=c.v===l?c.w:c.v,d=e(c);i[l][u]={distance:d,predecessor:l}})}),s.forEach(function(l){let c=i[l];s.forEach(function(u){let d=i[u];s.forEach(function(h){let p=d[l],m=c[h],y=d[h],b=p.distance+m.distance;b<y.distance&&(y.distance=b,y.predecessor=m.predecessor)})})}),i}var zc=class extends Error{constructor(...t){super(...t)}};function gw(t){let e={},n={},i=[];function s(l){if(l in n)throw new zc;l in e||(n[l]=!0,e[l]=!0,t.predecessors(l).forEach(s),delete n[l],i.push(l))}if(t.sinks().forEach(s),Object.keys(e).length!==t.nodeCount())throw new zc;return i}function _L(t){try{gw(t)}catch(e){if(e instanceof zc)return!1;throw e}return!0}function CL(t,e,n,i,s){Array.isArray(e)||(e=[e]);let l=(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=yw(t,u,n==="post",c,l,i,s)}),s}function yw(t,e,n,i,s,l,c){return e in i||(i[e]=!0,n||(c=l(c,e)),s(e).forEach(function(u){c=yw(t,u,n,i,s,l,c)}),n&&(c=l(c,e))),c}function vw(t,e,n){return CL(t,e,n,function(i,s){return i.push(s),i},[])}function TL(t,e){return vw(t,e,"post")}function NL(t,e){return vw(t,e,"pre")}function AL(t,e){let n=new pn,i={},s=new pw,l;function c(d){let h=d.v===l?d.w:d.v,p=s.priority(h);if(p!==void 0){let m=e(d);m<p&&(i[h]=l,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(l=s.removeMin(),l in i)n.setEdge(l,i[l]);else{if(u)throw new Error("Input graph is not connected: "+t);u=!0}t.nodeEdges(l).forEach(c)}return n}function ML(t,e,n,i){return RL(t,e,n,i??(s=>{let l=t.outEdges(s);return l??[]}))}function RL(t,e,n,i){if(n===void 0)return jc(t,e,n,i);let s=!1,l=t.nodes();for(let c=0;c<l.length;c++){let u=i(l[c]);for(let d=0;d<u.length;d++){let h=u[d],p=h.v===l[c]?h.v:h.w,m=p===h.v?h.w:h.v;n({v:p,w:m})<0&&(s=!0)}if(s)return hw(t,e,n,i)}return jc(t,e,n,i)}function Lr(t,e,n,i){let s=i;for(;t.hasNode(s);)s=xh(i);return n.dummy=e,t.setNode(s,n),s}function kL(t){let e=new pn().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 bw(t){let e=new pn({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 xw(t,e){let n=t.x,i=t.y,s=e.x-n,l=e.y-i,c=t.width/2,u=t.height/2;if(!s&&!l)throw new Error("Not possible to find intersection inside of the rectangle");let d,h;return Math.abs(l)*c>Math.abs(s)*u?(l<0&&(u=-u),d=u*s/l,h=u):(s<0&&(c=-c),d=c,h=c*l/s),{x:n+d,y:i+h}}function ma(t){let e=ga(Ew(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 OL(t){let e=t.nodes().map(i=>{let s=t.node(i).rank;return s===void 0?Number.MAX_VALUE:s}),n=Wn(Math.min,e);t.nodes().forEach(i=>{let s=t.node(i);Object.hasOwn(s,"rank")&&(s.rank-=n)})}function DL(t){let e=t.nodes().map(c=>t.node(c).rank).filter(c=>c!==void 0),n=Wn(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,l=t.graph().nodeRankFactor;Array.from(i).forEach((c,u)=>{c===void 0&&u%l!==0?--s:c!==void 0&&s&&c.forEach(d=>t.node(d).rank+=s)})}function ww(t,e,n,i){let s={width:0,height:0};return arguments.length>=4&&(s.rank=n,s.order=i),Lr(t,"border",s,e)}function jL(t,e=Sw){let n=[];for(let i=0;i<t.length;i+=e){let s=t.slice(i,i+e);n.push(s)}return n}var Sw=65535;function Wn(t,e){if(e.length>Sw){let n=jL(e);return t(...n.map(i=>t(...i)))}else return t(...e)}function Ew(t){let e=t.nodes().map(n=>{let i=t.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return Wn(Math.max,e)}function zL(t,e){let n={lhs:[],rhs:[]};return t.forEach(i=>{e(i)?n.lhs.push(i):n.rhs.push(i)}),n}function _w(t,e){let n=Date.now();try{return e()}finally{console.log(t+" time: "+(Date.now()-n)+"ms")}}function Cw(t,e){return e()}var VL=0;function xh(t){let e=++VL;return t+(""+e)}function ga(t,e,n=1){e==null&&(e=t,t=0);let i=l=>l<e;n<0&&(i=l=>e<l);let s=[];for(let l=t;i(l);l+=n)s.push(l);return s}function Vc(t,e){let n={};for(let i of e)t[i]!==void 0&&(n[i]=t[i]);return n}function Lc(t,e){let n;return typeof e=="string"?n=i=>i[e]:n=e,Object.entries(t).reduce((i,[s,l])=>(i[s]=n(l,s),i),{})}function LL(t,e){return t.reduce((n,i,s)=>(n[i]=e[s],n),{})}var Ic="\0",IL="3.0.0",BL=class{constructor(){sL(this,"_sentinel");let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,e=t._prev;if(e!==t)return Tw(e),e}enqueue(t){let e=this._sentinel;t._prev&&t._next&&Tw(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,PL)),n=n._prev;return"["+t.join(", ")+"]"}};function Tw(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function PL(t,e){if(t!=="_next"&&t!=="_prev")return e}var HL=BL,UL=()=>1;function $L(t,e){if(t.nodeCount()<=1)return[];let n=GL(t,e||UL);return YL(n.graph,n.buckets,n.zeroIdx).flatMap(i=>t.outEdges(i.v,i.w)||[])}function YL(t,e,n){var i;let s=[],l=e[e.length-1],c=e[0],u;for(;t.nodeCount();){for(;u=c.dequeue();)wh(t,e,n,u);for(;u=l.dequeue();)wh(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(wh(t,e,n,u,!0)||[]);break}}}return s}function wh(t,e,n,i,s){let l=[],c=s?l:void 0;return(t.inEdges(i.v)||[]).forEach(u=>{let d=t.edge(u),h=t.node(u.v);s&&l.push({v:u.v,w:u.w}),h.out-=d,Sh(e,n,h)}),(t.outEdges(i.v)||[]).forEach(u=>{let d=t.edge(u),h=u.w,p=t.node(h);p.in-=d,Sh(e,n,p)}),t.removeNode(i.v),c}function GL(t,e){let n=new pn,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 l=qL(s+i+3).map(()=>new HL),c=i+1;return n.nodes().forEach(u=>{Sh(l,c,n.node(u))}),{graph:n,buckets:l,zeroIdx:c}}function Sh(t,e,n){var i,s,l;n.out?n.in?(l=t[n.out-n.in+e])==null||l.enqueue(n):(s=t[t.length-1])==null||s.enqueue(n):(i=t[0])==null||i.enqueue(n)}function qL(t){let e=[];for(let n=0;n<t;n++)e.push(n);return e}function XL(t){(t.graph().acyclicer==="greedy"?$L(t,e(t)):FL(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,xh("rev"))});function e(n){return i=>n.edge(i).weight}}function FL(t){let e=[],n={},i={};function s(l){Object.hasOwn(i,l)||(i[l]=!0,n[l]=!0,t.outEdges(l).forEach(c=>{Object.hasOwn(n,c.w)?e.push(c):s(c.w)}),delete n[l])}return t.nodes().forEach(s),e}function ZL(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 KL(t){t.graph().dummyChains=[],t.edges().forEach(e=>QL(t,e))}function QL(t,e){let n=e.v,i=t.node(n).rank,s=e.w,l=t.node(s).rank,c=e.name,u=t.edge(e),d=u.labelRank;if(l===i+1)return;t.removeEdge(e);let h,p,m;for(m=0,++i;i<l;++m,++i)u.points=[],p={width:0,height:0,edgeLabel:u,edgeObj:e,rank:i},h=Lr(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 WL(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 Eh(t){let e={};function n(i){let s=t.node(i);if(Object.hasOwn(e,i))return s.rank;e[i]=!0;let l=t.outEdges(i),c=l?l.map(d=>d==null?Number.POSITIVE_INFINITY:n(d.w)-t.edge(d).minlen):[],u=Wn(Math.min,c);return u===Number.POSITIVE_INFINITY&&(u=0),s.rank=u}t.sources().forEach(n)}function Ir(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}var Nw=JL;function JL(t){let e=new pn({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 l,c;for(;tI(e,t)<s&&(l=eI(e,t),!!l);)c=e.hasNode(l.v)?Ir(t,l):-Ir(t,l),nI(e,t,c);return e}function tI(t,e){function n(i){let s=e.nodeEdges(i);s&&s.forEach(l=>{let c=l.v,u=i===c?l.w:c;!t.hasNode(u)&&!Ir(e,l)&&(t.setNode(u,{}),t.setEdge(i,u,{}),n(u))})}return t.nodes().forEach(n),t.nodeCount()}function eI(t,e){return e.edges().reduce((n,i)=>{let s=Number.POSITIVE_INFINITY;return t.hasNode(i.v)!==t.hasNode(i.w)&&(s=Ir(e,i)),s<n[0]?[s,i]:n},[Number.POSITIVE_INFINITY,null])[1]}function nI(t,e,n){t.nodes().forEach(i=>e.node(i).rank+=n)}var{preorder:oI,postorder:iI}=bh,rI=Yi;Yi.initLowLimValues=Ch,Yi.initCutValues=_h,Yi.calcCutValue=Aw,Yi.leaveEdge=Rw,Yi.enterEdge=kw,Yi.exchangeEdges=Ow;function Yi(t){t=kL(t),Eh(t);let e=Nw(t);Ch(e),_h(e,t);let n,i;for(;n=Rw(e);)i=kw(e,t,n),Ow(e,t,n,i)}function _h(t,e){let n=iI(t,t.nodes());n=n.slice(0,n.length-1),n.forEach(i=>sI(t,e,i))}function sI(t,e,n){let i=t.node(n).parent,s=t.edge(n,i);s.cutvalue=Aw(t,e,n)}function Aw(t,e,n){let i=t.node(n).parent,s=!0,l=e.edge(n,i),c=0;l||(s=!1,l=e.edge(i,n)),c=l.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,lI(t,n,p)){let b=t.edge(n,p).cutvalue;c+=m?-b:b}}}),c}function Ch(t,e){arguments.length<2&&(e=t.nodes()[0]),Mw(t,{},1,e)}function Mw(t,e,n,i,s){let l=n,c=t.node(i);e[i]=!0;let u=t.neighbors(i);return u&&u.forEach(d=>{Object.hasOwn(e,d)||(n=Mw(t,e,n,d,i))}),c.low=l,c.lim=n++,s?c.parent=s:delete c.parent,n}function Rw(t){return t.edges().find(e=>t.edge(e).cutvalue<0)}function kw(t,e,n){let i=n.v,s=n.w;e.hasEdge(i,s)||(i=n.w,s=n.v);let l=t.node(i),c=t.node(s),u=l,d=!1;return l.lim>c.lim&&(u=c,d=!0),e.edges().filter(h=>d===Dw(t,t.node(h.v),u)&&d!==Dw(t,t.node(h.w),u)).reduce((h,p)=>Ir(e,p)<Ir(e,h)?p:h)}function Ow(t,e,n,i){let s=n.v,l=n.w;t.removeEdge(s,l),t.setEdge(i.v,i.w,{}),Ch(t),_h(t,e),aI(t,e)}function aI(t,e){let n=t.nodes().find(s=>!t.node(s).parent);if(!n)return;let i=oI(t,[n]);i=i.slice(1),i.forEach(s=>{let l=t.node(s).parent,c=e.edge(s,l),u=!1;c||(c=e.edge(l,s),u=!0),e.node(s).rank=e.node(l).rank+(u?c.minlen:-c.minlen)})}function lI(t,e,n){return t.hasEdge(e,n)}function Dw(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}var cI=uI;function uI(t){let e=t.graph().ranker;if(typeof e=="function")return e(t);switch(e){case"network-simplex":jw(t);break;case"tight-tree":dI(t);break;case"longest-path":fI(t);break;case"none":break;default:jw(t)}}var fI=Eh;function dI(t){Eh(t),Nw(t)}function jw(t){rI(t)}var hI=pI;function pI(t){let e=gI(t);t.graph().dummyChains.forEach(n=>{let i=t.node(n),s=i.edgeObj,l=mI(t,e,s.v,s.w),c=l.path,u=l.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 mI(t,e,n,i){let s=[],l=[],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;)l.push(p);return{path:s.concat(l.reverse()),lca:h}}function gI(t){let e={},n=0;function i(s){let l=n;t.children(s).forEach(i),e[s]={low:l,lim:n++}}return t.children(Ic).forEach(i),e}function yI(t){let e=Lr(t,"root",{},"_root"),n=vI(t),i=Object.values(n),s=Wn(Math.max,i)-1,l=2*s+1;t.graph().nestingRoot=e,t.edges().forEach(u=>t.edge(u).minlen*=l);let c=bI(t)+1;t.children(Ic).forEach(u=>zw(t,e,l,c,s,n,u)),t.graph().nodeRankFactor=l}function zw(t,e,n,i,s,l,c){var u;let d=t.children(c);if(!d.length){c!==e&&t.setEdge(e,c,{weight:0,minlen:n});return}let h=ww(t,"_bt"),p=ww(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;zw(t,e,n,i,s,l,y);let x=t.node(y),w=x.borderTop?x.borderTop:y,S=x.borderBottom?x.borderBottom:y,E=x.borderTop?i:2*i,O=w!==S?1:s-((b=l[c])!=null?b:0)+1;t.setEdge(h,w,{weight:E,minlen:O,nestingEdge:!0}),t.setEdge(S,p,{weight:E,minlen:O,nestingEdge:!0})}),t.parent(c)||t.setEdge(e,h,{weight:0,minlen:s+((u=l[c])!=null?u:0)})}function vI(t){let e={};function n(i,s){let l=t.children(i);l&&l.length&&l.forEach(c=>n(c,s+1)),e[i]=s}return t.children(Ic).forEach(i=>n(i,1)),e}function bI(t){return t.edges().reduce((e,n)=>e+t.edge(n).weight,0)}function xI(t){let e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(n=>{t.edge(n).nestingEdge&&t.removeEdge(n)})}var wI=SI;function SI(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 l=s.minRank,c=s.maxRank+1;l<c;++l)Vw(t,"borderLeft","_bl",n,s,l),Vw(t,"borderRight","_br",n,s,l)}}t.children(Ic).forEach(e)}function Vw(t,e,n,i,s,l){let c={width:0,height:0,rank:l,borderType:e},u=s[e][l-1],d=Lr(t,"border",c,n);s[e][l]=d,t.setParent(d,i),u&&t.setEdge(u,d,{weight:1})}function EI(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="lr"||n==="rl")&&Lw(t)}function _I(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="bt"||n==="rl")&&CI(t),(n==="lr"||n==="rl")&&(TI(t),Lw(t))}function Lw(t){t.nodes().forEach(e=>Iw(t.node(e))),t.edges().forEach(e=>Iw(t.edge(e)))}function Iw(t){let e=t.width;t.width=t.height,t.height=e}function CI(t){t.nodes().forEach(e=>Th(t.node(e))),t.edges().forEach(e=>{var n;let i=t.edge(e);(n=i.points)==null||n.forEach(Th),Object.hasOwn(i,"y")&&Th(i)})}function Th(t){t.y=-t.y}function TI(t){t.nodes().forEach(e=>Nh(t.node(e))),t.edges().forEach(e=>{var n;let i=t.edge(e);(n=i.points)==null||n.forEach(Nh),Object.hasOwn(i,"x")&&Nh(i)})}function Nh(t){let e=t.x;t.x=t.y,t.y=e}function NI(t){let e={},n=t.nodes().filter(u=>!t.children(u).length),i=n.map(u=>t.node(u).rank),s=Wn(Math.max,i),l=ga(s+1).map(()=>[]);function c(u){if(e[u])return;e[u]=!0;let d=t.node(u);l[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),l}function AI(t,e){let n=0;for(let i=1;i<e.length;++i)n+=MI(t,e[i-1],e[i]);return n}function MI(t,e,n){let i=LL(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):[]}),l=1;for(;l<n.length;)l<<=1;let c=2*l-1;l-=1;let u=new Array(c).fill(0),d=0;return s.forEach(h=>{let p=h.pos+l;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 RI(t,e=[]){return e.map(n=>{let i=t.inEdges(n);if(!i||!i.length)return{v:n};{let s=i.reduce((l,c)=>{let u=t.edge(c),d=t.node(c.v);return{sum:l.sum+u.weight*d.order,weight:l.weight+u.weight}},{sum:0,weight:0});return{v:n,barycenter:s.sum/s.weight,weight:s.weight}}})}function kI(t,e){let n={};t.forEach((s,l)=>{let c={indegree:0,in:[],out:[],vs:[s.v],i:l};s.barycenter!==void 0&&(c.barycenter=s.barycenter,c.weight=s.weight),n[s.v]=c}),e.edges().forEach(s=>{let l=n[s.v],c=n[s.w];l!==void 0&&c!==void 0&&(c.indegree++,l.out.push(c))});let i=Object.values(n).filter(s=>!s.indegree);return OI(i)}function OI(t){let e=[];function n(s){return l=>{l.merged||(l.barycenter===void 0||s.barycenter===void 0||l.barycenter>=s.barycenter)&&DI(s,l)}}function i(s){return l=>{l.in.push(s),--l.indegree===0&&t.push(l)}}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=>Vc(s,["vs","i","barycenter","weight"]))}function DI(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 jI(t,e){let n=zL(t,p=>Object.hasOwn(p,"barycenter")),i=n.lhs,s=n.rhs.sort((p,m)=>m.i-p.i),l=[],c=0,u=0,d=0;i.sort(zI(!!e)),d=Bw(l,s,d),i.forEach(p=>{d+=p.vs.length,l.push(p.vs),c+=p.barycenter*p.weight,u+=p.weight,d=Bw(l,s,d)});let h={vs:l.flat(1)};return u&&(h.barycenter=c/u,h.weight=u),h}function Bw(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 zI(t){return(e,n)=>e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i}function Pw(t,e,n,i){let s=t.children(e),l=t.node(e),c=l?l.borderLeft:void 0,u=l?l.borderRight:void 0,d={};c&&(s=s.filter(y=>y!==c&&y!==u));let h=RI(t,s);h.forEach(y=>{if(t.children(y.v).length){let b=Pw(t,y.v,n,i);d[y.v]=b,Object.hasOwn(b,"barycenter")&&LI(y,b)}});let p=kI(h,n);VI(p,d);let m=jI(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 VI(t,e){t.forEach(n=>{n.vs=n.vs.flatMap(i=>e[i]?e[i].vs:i)})}function LI(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 II(t,e,n,i){i||(i=t.nodes());let s=BI(t),l=new pn({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){l.setNode(c),l.setParent(c,d||s);let h=t[n](c);h&&h.forEach(p=>{let m=p.v===c?p.w:p.v,y=l.edge(m,c),b=y!==void 0?y.weight:0;l.setEdge(m,c,{weight:t.edge(p).weight+b})}),Object.hasOwn(u,"minRank")&&l.setNode(c,{borderLeft:u.borderLeft[e],borderRight:u.borderRight[e]})}}),l}function BI(t){let e;for(;t.hasNode(e=xh("_root")););return e}function PI(t,e,n){let i={},s;n.forEach(l=>{let c=t.parent(l),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 Hw(t,e={}){if(typeof e.customOrder=="function"){e.customOrder(t,Hw);return}let n=Ew(t),i=Uw(t,ga(1,n+1),"inEdges"),s=Uw(t,ga(n-1,-1,-1),"outEdges"),l=NI(t);if($w(t,l),e.disableOptimalOrderHeuristic)return;let c=Number.POSITIVE_INFINITY,u,d=e.constraints||[];for(let h=0,p=0;p<4;++h,++p){HI(h%2?i:s,h%4>=2,d),l=ma(t);let m=AI(t,l);m<c?(p=0,u=Object.assign({},l),c=m):m===c&&(u=structuredClone(l))}$w(t,u)}function Uw(t,e,n){let i=new Map,s=(l,c)=>{i.has(l)||i.set(l,[]),i.get(l).push(c)};for(let l of t.nodes()){let c=t.node(l);if(typeof c.rank=="number"&&s(c.rank,l),typeof c.minRank=="number"&&typeof c.maxRank=="number")for(let u=c.minRank;u<=c.maxRank;u++)u!==c.rank&&s(u,l)}return e.map(function(l){return II(t,l,n,i.get(l)||[])})}function HI(t,e,n){let i=new pn;t.forEach(function(s){n.forEach(u=>i.setEdge(u.left,u.right));let l=s.graph().root,c=Pw(s,l,i,e);c.vs.forEach((u,d)=>s.node(u).order=d),PI(s,i,c.vs)})}function $w(t,e){Object.values(e).forEach(n=>n.forEach((i,s)=>t.node(i).order=s))}function UI(t,e){let n={};function i(s,l){let c=0,u=0,d=s.length,h=l[l.length-1];return l.forEach((p,m)=>{let y=YI(t,p),b=y?t.node(y).order:d;(y||p===h)&&(l.slice(u,m+1).forEach(x=>{let w=t.predecessors(x);w&&w.forEach(S=>{let E=t.node(S),O=E.order;(O<c||b<O)&&!(E.dummy&&t.node(x).dummy)&&Yw(n,S,x)})}),u=m+1,c=b)}),l}return e.length&&e.reduce(i),n}function $I(t,e){let n={};function i(l,c,u,d,h){ga(c,u).forEach(p=>{let m=l[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)&&Yw(n,b,m)})}})}function s(l,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,l.length)}),c}return e.length&&e.reduce(s),n}function YI(t,e){if(t.node(e).dummy){let n=t.predecessors(e);if(n)return n.find(i=>t.node(i).dummy)}}function Yw(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 GI(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 qI(t,e,n,i){let s={},l={},c={};return e.forEach(u=>{u.forEach((d,h)=>{s[d]=d,l[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&&l[h]===h&&d<S&&!GI(n,h,w)){let E=s[w];E!==void 0&&(l[w]=h,l[h]=s[h]=E,d=S)}}}})}),{root:s,align:l}}function XI(t,e,n,i,s=!1){let l={},c=FI(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 O of x(E))w.push(O)}E=w.pop()}}function h(b){let x=c.inEdges(b);x?l[b]=x.reduce((w,S)=>{var E;let O=(E=l[S.v])!=null?E:0,C=c.edge(S);return Math.max(w,O+(C!==void 0?C:0))},0):l[b]=0}function p(b){let x=c.outEdges(b),w=Number.POSITIVE_INFINITY;x&&(w=x.reduce((E,O)=>{let C=l[O.w],_=c.edge(O);return Math.min(E,(C!==void 0?C:0)-(_!==void 0?_:0))},Number.POSITIVE_INFINITY));let S=t.node(b);w!==Number.POSITIVE_INFINITY&&S.borderType!==u&&(l[b]=Math.max(l[b]!==void 0?l[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&&(l[b]=(x=l[w])!=null?x:0)}),l}function FI(t,e,n,i){let s=new pn,l=t.graph(),c=JI(l.nodesep,l.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 ZI(t,e){return Object.values(e).reduce((n,i)=>{let s=Number.NEGATIVE_INFINITY,l=Number.POSITIVE_INFINITY;Object.entries(i).forEach(([u,d])=>{let h=t6(t,u)/2;s=Math.max(d+h,s),l=Math.min(d-h,l)});let c=s-l;return c<n[0]&&(n=[c,i]),n},[Number.POSITIVE_INFINITY,null])[1]}function KI(t,e){let n=Object.values(e),i=Wn(Math.min,n),s=Wn(Math.max,n);["u","d"].forEach(l=>{["l","r"].forEach(c=>{let u=l+c,d=t[u];if(!d||d===e)return;let h=Object.values(d),p=i-Wn(Math.min,h);c!=="l"&&(p=s-Wn(Math.max,h)),p&&(t[u]=Lc(d,m=>m+p))})})}function QI(t,e=void 0){let n=t.ul;return n?Lc(n,(i,s)=>{var l,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(((l=u[1])!=null?l:0)+((c=u[2])!=null?c:0))/2}):{}}function WI(t){let e=ma(t),n=Object.assign(UI(t,e),$I(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=qI(t,s,n,p=>(c==="u"?t.predecessors(p):t.successors(p))||[]),h=XI(t,s,d.root,d.align,u==="r");u==="r"&&(h=Lc(h,p=>-p)),i[c+u]=h})});let l=ZI(t,i);return KI(i,l),QI(i,t.graph().align)}function JI(t,e,n){return(i,s,l)=>{let c=i.node(s),u=i.node(l),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 t6(t,e){return t.node(e).width}function e6(t){t=bw(t),n6(t),Object.entries(WI(t)).forEach(([e,n])=>t.node(e).x=n)}function n6(t){let e=ma(t),n=t.graph(),i=n.ranksep,s=n.rankalign,l=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=l+h.height/2:s==="bottom"?h.y=l+u-h.height/2:h.y=l+u/2}),l+=u+i})}function o6(t,e={}){let n=e.debugTiming?_w:Cw;return n("layout",()=>{let i=n(" buildLayoutGraph",()=>h6(t));return n(" runLayout",()=>i6(i,n,e)),n(" updateInputGraph",()=>r6(t,i)),i})}function i6(t,e,n){e(" makeSpaceForEdgeLabels",()=>p6(t)),e(" removeSelfEdges",()=>E6(t)),e(" acyclic",()=>XL(t)),e(" nestingGraph.run",()=>yI(t)),e(" rank",()=>cI(bw(t))),e(" injectEdgeLabelProxies",()=>m6(t)),e(" removeEmptyRanks",()=>DL(t)),e(" nestingGraph.cleanup",()=>xI(t)),e(" normalizeRanks",()=>OL(t)),e(" assignRankMinMax",()=>g6(t)),e(" removeEdgeLabelProxies",()=>y6(t)),e(" normalize.run",()=>KL(t)),e(" parentDummyChains",()=>hI(t)),e(" addBorderSegments",()=>wI(t)),e(" order",()=>Hw(t,n)),e(" insertSelfEdges",()=>_6(t)),e(" adjustCoordinateSystem",()=>EI(t)),e(" position",()=>e6(t)),e(" positionSelfEdges",()=>C6(t)),e(" removeBorderNodes",()=>S6(t)),e(" normalize.undo",()=>WL(t)),e(" fixupEdgeLabelCoords",()=>x6(t)),e(" undoCoordinateSystem",()=>_I(t)),e(" translateGraph",()=>v6(t)),e(" assignNodeIntersects",()=>b6(t)),e(" reversePoints",()=>w6(t)),e(" acyclic.undo",()=>ZL(t))}function r6(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 s6=["nodesep","edgesep","ranksep","marginx","marginy"],a6={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},l6=["acyclicer","ranker","rankdir","align","rankalign"],c6=["width","height","rank"],Gw={width:0,height:0},u6=["minlen","weight","width","height","labeloffset"],f6={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},d6=["labelpos"];function h6(t){let e=new pn({multigraph:!0,compound:!0}),n=Mh(t.graph());return e.setGraph(Object.assign({},a6,Ah(n,s6),Vc(n,l6))),t.nodes().forEach(i=>{let s=Mh(t.node(i)),l=Ah(s,c6);Object.keys(Gw).forEach(u=>{l[u]===void 0&&(l[u]=Gw[u])}),e.setNode(i,l);let c=t.parent(i);c!==void 0&&e.setParent(i,c)}),t.edges().forEach(i=>{let s=Mh(t.edge(i));e.setEdge(i,Object.assign({},f6,Ah(s,u6),Vc(s,d6)))}),e}function p6(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 m6(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};Lr(t,"edge-proxy",s,"_ep")}})}function g6(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 y6(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 v6(t){let e=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,s=0,l=t.graph(),c=l.marginx||0,u=l.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)}),l.width=n-e+c,l.height=s-i+u}function b6(t){t.edges().forEach(e=>{let n=t.edge(e),i=t.node(e.v),s=t.node(e.w),l,c;n.points?(l=n.points[0],c=n.points[n.points.length-1]):(n.points=[],l=s,c=i),n.points.unshift(xw(i,l)),n.points.push(xw(s,c))})}function x6(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 w6(t){t.edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}function S6(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),l=t.node(n.borderLeft[n.borderLeft.length-1]),c=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(c.x-l.x),n.height=Math.abs(s.y-i.y),n.x=l.x+n.width/2,n.y=i.y+n.height/2}}),t.nodes().forEach(e=>{t.node(e).dummy==="border"&&t.removeNode(e)})}function E6(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){ma(t).forEach(e=>{let n=0;e.forEach((i,s)=>{let l=t.node(i);l.order=s+n,(l.selfEdges||[]).forEach(c=>{Lr(t,"selfedge",{width:c.label.width,height:c.label.height,rank:l.rank,order:s+ ++n,e:c.e,label:c.label},"_se")}),delete l.selfEdges})})}function C6(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="selfedge"){let i=n,s=t.node(i.e.v),l=s.x+s.width/2,c=s.y,u=n.x-l,d=s.height/2;t.setEdge(i.e,i.label),t.removeNode(e),i.label.points=[{x:l+2*u/3,y:c-d},{x:l+5*u/6,y:c-d},{x:l+u,y:c},{x:l+5*u/6,y:c+d},{x:l+2*u/3,y:c+d}],i.label.x=n.x,i.label.y=n.y}})}function Ah(t,e){return Lc(Vc(t,e),Number)}function Mh(t){let e={};return t&&Object.entries(t).forEach(([n,i])=>{typeof n=="string"&&(n=n.toLowerCase()),e[n]=i}),e}function T6(t){let e=ma(t),n=new pn({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 l="layer"+s;n.setNode(l,{rank:"same"}),i.reduce((c,u)=>(n.setEdge(c,u,{style:"invis"}),u))}),n}var N6={graphlib:lw,version:IL,layout:o6,debug:T6,util:{time:_w,notime:Cw}},qw=N6;const A6={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}},M6={width:160,height:80};function R6(t){return A6[t]??M6}function k6(t,e){const l=new qw.graphlib.Graph;l.setGraph({rankdir:"LR",nodesep:60,ranksep:90,marginx:20,marginy:20}),l.setDefaultEdgeLabel(()=>({}));const c=new Set;for(const d of t.nodes){const h=R6(d.componentRef);l.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)||l.setEdge(d.source.nodeId,d.target.nodeId);qw.layout(l);const u={components:{},connections:{}};for(const d of t.nodes){const h=l.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 O6(t,e){return N.useMemo(()=>t?{metadata:k6(t),isLayoutReady:!0}:{metadata:{components:{},connections:{}},isLayoutReady:!1},[t,e?.direction,e?.nodeSpacing,e?.rankSpacing])}const Xw="(pointer: coarse) and (max-width: 1024px)";function D6(){const[t,e]=N.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(Xw).matches);return N.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const n=window.matchMedia(Xw),i=s=>e(s.matches);return e(n.matches),n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[]),t}function Fw(){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 Rh=N.createContext({});function kh(t){const e=N.useRef(null);return e.current===null&&(e.current=t()),e.current}const Zw=typeof window<"u",Kw=Zw?N.useLayoutEffect:N.useEffect,Bc=N.createContext(null);function Oh(t,e){t.indexOf(e)===-1&&t.push(e)}function Pc(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Jn=(t,e,n)=>n>e?e:n<t?t:n;let Dh=()=>{};const yo={},Qw=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function Ww(t){return typeof t=="object"&&t!==null}const Jw=t=>/^0[^.\s]+$/u.test(t);function t1(t){let e;return()=>(e===void 0&&(e=t()),e)}const mn=t=>t,j6=(t,e)=>n=>e(t(n)),ya=(...t)=>t.reduce(j6),va=(t,e,n)=>{const i=e-t;return i===0?1:(n-t)/i};class jh{constructor(){this.subscriptions=[]}add(e){return Oh(this.subscriptions,e),()=>Pc(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 l=0;l<s;l++){const c=this.subscriptions[l];c&&c(e,n,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const jn=t=>t*1e3,gn=t=>t/1e3;function e1(t,e){return e?t*(1e3/e):0}const n1=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,z6=1e-7,V6=12;function L6(t,e,n,i,s){let l,c,u=0;do c=e+(n-e)/2,l=n1(c,i,s)-t,l>0?n=c:e=c;while(Math.abs(l)>z6&&++u<V6);return c}function ba(t,e,n,i){if(t===e&&n===i)return mn;const s=l=>L6(l,0,1,t,n);return l=>l===0||l===1?l:n1(s(l),e,i)}const o1=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,i1=t=>e=>1-t(1-e),r1=ba(.33,1.53,.69,.99),zh=i1(r1),s1=o1(zh),a1=t=>(t*=2)<1?.5*zh(t):.5*(2-Math.pow(2,-10*(t-1))),Vh=t=>1-Math.sin(Math.acos(t)),l1=i1(Vh),c1=o1(Vh),I6=ba(.42,0,1,1),B6=ba(0,0,.58,1),u1=ba(.42,0,.58,1),P6=t=>Array.isArray(t)&&typeof t[0]!="number",f1=t=>Array.isArray(t)&&typeof t[0]=="number",H6={linear:mn,easeIn:I6,easeInOut:u1,easeOut:B6,circIn:Vh,circInOut:c1,circOut:l1,backIn:zh,backInOut:s1,backOut:r1,anticipate:a1},U6=t=>typeof t=="string",d1=t=>{if(f1(t)){Dh(t.length===4);const[e,n,i,s]=t;return ba(e,n,i,s)}else if(U6(t))return H6[t];return t},Hc=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function $6(t,e){let n=new Set,i=new Set,s=!1,l=!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){l=!0;return}s=!0,[n,i]=[i,n],n.forEach(d),n.clear(),s=!1,l&&(l=!1,h.process(p))}};return h}const Y6=40;function h1(t,e){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},l=()=>n=!0,c=Hc.reduce((C,_)=>(C[_]=$6(l),C),{}),{setup:u,read:d,resolveKeyframes:h,preUpdate:p,update:m,preRender:y,render:b,postRender:x}=c,w=()=>{const C=yo.useManualTiming?s.timestamp:performance.now();n=!1,yo.useManualTiming||(s.delta=i?1e3/60:Math.max(Math.min(C-s.timestamp,Y6),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&&(i=!1,t(w))},S=()=>{n=!0,i=!0,s.isProcessing||t(w)};return{schedule:Hc.reduce((C,_)=>{const R=c[_];return C[_]=(A,k=!1,D=!1)=>(n||S(),R.schedule(A,k,D)),C},{}),cancel:C=>{for(let _=0;_<Hc.length;_++)c[Hc[_]].cancel(C)},state:s,steps:c}}const{schedule:ie,cancel:Zo,state:ze,steps:Lh}=h1(typeof requestAnimationFrame<"u"?requestAnimationFrame:mn,!0);let Uc;function G6(){Uc=void 0}const $e={now:()=>(Uc===void 0&&$e.set(ze.isProcessing||yo.useManualTiming?ze.timestamp:performance.now()),Uc),set:t=>{Uc=t,queueMicrotask(G6)}},p1=t=>e=>typeof e=="string"&&e.startsWith(t),m1=p1("--"),q6=p1("var(--"),Ih=t=>q6(t)?X6.test(t.split("/*")[0].trim()):!1,X6=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function g1(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const Br={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},xa={...Br,transform:t=>Jn(0,1,t)},$c={...Br,default:1},wa=t=>Math.round(t*1e5)/1e5,Bh=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function F6(t){return t==null}const Z6=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,Ph=(t,e)=>n=>!!(typeof n=="string"&&Z6.test(n)&&n.startsWith(t)||e&&!F6(n)&&Object.prototype.hasOwnProperty.call(n,e)),y1=(t,e,n)=>i=>{if(typeof i!="string")return i;const[s,l,c,u]=i.match(Bh);return{[t]:parseFloat(s),[e]:parseFloat(l),[n]:parseFloat(c),alpha:u!==void 0?parseFloat(u):1}},K6=t=>Jn(0,255,t),Hh={...Br,transform:t=>Math.round(K6(t))},Gi={test:Ph("rgb","red"),parse:y1("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+Hh.transform(t)+", "+Hh.transform(e)+", "+Hh.transform(n)+", "+wa(xa.transform(i))+")"};function Q6(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 Uh={test:Ph("#"),parse:Q6,transform:Gi.transform},Sa=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Ko=Sa("deg"),to=Sa("%"),St=Sa("px"),W6=Sa("vh"),J6=Sa("vw"),v1={...to,parse:t=>to.parse(t)/100,transform:t=>to.transform(t*100)},Pr={test:Ph("hsl","hue"),parse:y1("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+to.transform(wa(e))+", "+to.transform(wa(n))+", "+wa(xa.transform(i))+")"},xe={test:t=>Gi.test(t)||Uh.test(t)||Pr.test(t),parse:t=>Gi.test(t)?Gi.parse(t):Pr.test(t)?Pr.parse(t):Uh.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Gi.transform(t):Pr.transform(t),getAnimatableNone:t=>{const e=xe.parse(t);return e.alpha=0,xe.transform(e)}},t8=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function e8(t){return isNaN(t)&&typeof t=="string"&&(t.match(Bh)?.length||0)+(t.match(t8)?.length||0)>0}const b1="number",x1="color",n8="var",o8="var(",w1="${}",i8=/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 Ea(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},s=[];let l=0;const u=e.replace(i8,d=>(xe.test(d)?(i.color.push(l),s.push(x1),n.push(xe.parse(d))):d.startsWith(o8)?(i.var.push(l),s.push(n8),n.push(d)):(i.number.push(l),s.push(b1),n.push(parseFloat(d))),++l,w1)).split(w1);return{values:n,split:u,indexes:i,types:s}}function S1(t){return Ea(t).values}function E1(t){const{split:e,types:n}=Ea(t),i=e.length;return s=>{let l="";for(let c=0;c<i;c++)if(l+=e[c],s[c]!==void 0){const u=n[c];u===b1?l+=wa(s[c]):u===x1?l+=xe.transform(s[c]):l+=s[c]}return l}}const r8=t=>typeof t=="number"?0:xe.test(t)?xe.getAnimatableNone(t):t;function s8(t){const e=S1(t);return E1(t)(e.map(r8))}const zn={test:e8,parse:S1,createTransformer:E1,getAnimatableNone:s8};function $h(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 a8({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,e/=100,n/=100;let s=0,l=0,c=0;if(!e)s=l=c=n;else{const u=n<.5?n*(1+e):n+e-n*e,d=2*n-u;s=$h(d,u,t+.3333333333333333),l=$h(d,u,t),c=$h(d,u,t-.3333333333333333)}return{red:Math.round(s*255),green:Math.round(l*255),blue:Math.round(c*255),alpha:i}}function Yc(t,e){return n=>n>0?e:t}const fe=(t,e,n)=>t+(e-t)*n,Yh=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},l8=[Uh,Gi,Pr],c8=t=>l8.find(e=>e.test(t));function _1(t){const e=c8(t);if(!e)return!1;let n=e.parse(t);return e===Pr&&(n=a8(n)),n}const C1=(t,e)=>{const n=_1(t),i=_1(e);if(!n||!i)return Yc(t,e);const s={...n};return l=>(s.red=Yh(n.red,i.red,l),s.green=Yh(n.green,i.green,l),s.blue=Yh(n.blue,i.blue,l),s.alpha=fe(n.alpha,i.alpha,l),Gi.transform(s))},Gh=new Set(["none","hidden"]);function u8(t,e){return Gh.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function f8(t,e){return n=>fe(t,e,n)}function qh(t){return typeof t=="number"?f8:typeof t=="string"?Ih(t)?Yc:xe.test(t)?C1:p8:Array.isArray(t)?T1:typeof t=="object"?xe.test(t)?C1:d8:Yc}function T1(t,e){const n=[...t],i=n.length,s=t.map((l,c)=>qh(l)(l,e[c]));return l=>{for(let c=0;c<i;c++)n[c]=s[c](l);return n}}function d8(t,e){const n={...t,...e},i={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(i[s]=qh(t[s])(t[s],e[s]));return s=>{for(const l in i)n[l]=i[l](s);return n}}function h8(t,e){const n=[],i={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const l=e.types[s],c=t.indexes[l][i[l]],u=t.values[c]??0;n[s]=u,i[l]++}return n}const p8=(t,e)=>{const n=zn.createTransformer(e),i=Ea(t),s=Ea(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?Gh.has(t)&&!s.values.length||Gh.has(e)&&!i.values.length?u8(t,e):ya(T1(h8(i,s),s.values),n):Yc(t,e)};function N1(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?fe(t,e,n):qh(t)(t,e)}const m8=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>ie.update(e,n),stop:()=>Zo(e),now:()=>ze.isProcessing?ze.timestamp:$e.now()}},A1=(t,e,n=10)=>{let i="";const s=Math.max(Math.round(e/n),2);for(let l=0;l<s;l++)i+=Math.round(t(l/(s-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},Gc=2e4;function Xh(t){let e=0;const n=50;let i=t.next(e);for(;!i.done&&e<Gc;)e+=n,i=t.next(e);return e>=Gc?1/0:e}function g8(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(Xh(i),Gc);return{type:"keyframes",ease:l=>i.next(s*l).value/e,duration:gn(s)}}const y8=5;function M1(t,e,n){const i=Math.max(e-y8,0);return e1(n-t(i),e-i)}const de={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},Fh=.001;function v8({duration:t=de.duration,bounce:e=de.bounce,velocity:n=de.velocity,mass:i=de.mass}){let s,l,c=1-e;c=Jn(de.minDamping,de.maxDamping,c),t=Jn(de.minDuration,de.maxDuration,gn(t)),c<1?(s=h=>{const p=h*c,m=p*t,y=p-n,b=Zh(h,c),x=Math.exp(-m);return Fh-y/b*x},l=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=Zh(Math.pow(h,2),c);return(-s(h)+Fh>0?-1:1)*((y-b)*x)/w}):(s=h=>{const p=Math.exp(-h*t),m=(h-n)*t+1;return-Fh+p*m},l=h=>{const p=Math.exp(-h*t),m=(n-h)*(t*t);return p*m});const u=5/t,d=x8(s,l,u);if(t=jn(t),isNaN(d))return{stiffness:de.stiffness,damping:de.damping,duration:t};{const h=Math.pow(d,2)*i;return{stiffness:h,damping:c*2*Math.sqrt(i*h),duration:t}}}const b8=12;function x8(t,e,n){let i=n;for(let s=1;s<b8;s++)i=i-t(i)/e(i);return i}function Zh(t,e){return t*Math.sqrt(1-e*e)}const w8=["duration","bounce"],S8=["stiffness","damping","mass"];function R1(t,e){return e.some(n=>t[n]!==void 0)}function E8(t){let e={velocity:de.velocity,stiffness:de.stiffness,damping:de.damping,mass:de.mass,isResolvedFromDuration:!1,...t};if(!R1(t,S8)&&R1(t,w8))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(n*1.2),s=i*i,l=2*Jn(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:de.mass,stiffness:s,damping:l}}else{const n=v8({...t,velocity:0});e={...e,...n,mass:de.mass},e.isResolvedFromDuration=!0}return e}function qc(t=de.visualDuration,e=de.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:s}=n;const l=n.keyframes[0],c=n.keyframes[n.keyframes.length-1],u={done:!1,value:l},{stiffness:d,damping:h,mass:p,duration:m,velocity:y,isResolvedFromDuration:b}=E8({...n,velocity:-gn(n.velocity||0)}),x=y||0,w=h/(2*Math.sqrt(d*p)),S=c-l,E=gn(Math.sqrt(d/p)),O=Math.abs(S)<5;i||(i=O?de.restSpeed.granular:de.restSpeed.default),s||(s=O?de.restDelta.granular:de.restDelta.default);let C;if(w<1){const R=Zh(E,w);C=A=>{const k=Math.exp(-w*E*A);return c-k*((x+w*E*S)/R*Math.sin(R*A)+S*Math.cos(R*A))}}else if(w===1)C=R=>c-Math.exp(-E*R)*(S+(x+E*S)*R);else{const R=E*Math.sqrt(w*w-1);C=A=>{const k=Math.exp(-w*E*A),D=Math.min(R*A,300);return c-k*((x+w*E*S)*Math.sinh(D)+R*S*Math.cosh(D))/R}}const _={calculatedDuration:b&&m||null,next:R=>{const A=C(R);if(b)u.done=R>=m;else{let k=R===0?x:0;w<1&&(k=R===0?jn(x):M1(C,R,A));const D=Math.abs(k)<=i,H=Math.abs(c-A)<=s;u.done=D&&H}return u.value=u.done?c:A,u},toString:()=>{const R=Math.min(Xh(_),Gc),A=A1(k=>_.next(R*k).value,R,30);return R+"ms "+A},toTransition:()=>{}};return _}qc.applyToOptions=t=>{const e=g8(t,100,qc);return t.ease=e.ease,t.duration=jn(e.duration),t.type="keyframes",t};function Kh({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:l=500,modifyTarget:c,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 S=m+w,E=c===void 0?S:c(S);E!==S&&(w=E-m);const O=D=>-w*Math.exp(-D/i),C=D=>E+O(D),_=D=>{const H=O(D),Y=C(D);y.done=Math.abs(H)<=h,y.value=y.done?E:Y};let R,A;const k=D=>{b(y.value)&&(R=D,A=qc({keyframes:[y.value,x(y.value)],velocity:M1(C,D,y.value),damping:s,stiffness:l,restDelta:h,restSpeed:p}))};return k(0),{calculatedDuration:null,next:D=>{let H=!1;return!A&&R===void 0&&(H=!0,_(D),k(D)),R!==void 0&&D>=R?A.next(D-R):(!H&&_(D),y)}}}function _8(t,e,n){const i=[],s=n||yo.mix||N1,l=t.length-1;for(let c=0;c<l;c++){let u=s(t[c],t[c+1]);if(e){const d=Array.isArray(e)?e[c]||mn:e;u=ya(d,u)}i.push(u)}return i}function C8(t,e,{clamp:n=!0,ease:i,mixer:s}={}){const l=t.length;if(Dh(l===e.length),l===1)return()=>e[0];if(l===2&&e[0]===e[1])return()=>e[1];const c=t[0]===t[1];t[0]>t[l-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=va(t[m],t[m+1],p);return u[m](y)};return n?p=>h(Jn(t[0],t[l-1],p)):h}function T8(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=va(0,e,i);t.push(fe(n,1,s))}}function N8(t){const e=[0];return T8(e,t.length-1),e}function A8(t,e){return t.map(n=>n*e)}function M8(t,e){return t.map(()=>e||u1).splice(0,t.length-1)}function _a({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=P6(i)?i.map(d1):d1(i),l={done:!1,value:e[0]},c=A8(n&&n.length===e.length?n:N8(e),t),u=C8(c,e,{ease:Array.isArray(s)?s:M8(e,s)});return{calculatedDuration:t,next:d=>(l.value=u(d),l.done=d>=t,l)}}const R8=t=>t!==null;function Qh(t,{repeat:e,repeatType:n="loop"},i,s=1){const l=t.filter(R8),u=s<0||e&&n!=="loop"&&e%2===1?0:l.length-1;return!u||i===void 0?l[u]:i}const k8={decay:Kh,inertia:Kh,tween:_a,keyframes:_a,spring:qc};function k1(t){typeof t.type=="string"&&(t.type=k8[t.type])}class Wh{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 O8=t=>t/100;class Jh extends Wh{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!==$e.now()&&this.tick($e.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;k1(e);const{type:n=_a,repeat:i=0,repeatDelay:s=0,repeatType:l,velocity:c=0}=e;let{keyframes:u}=e;const d=n||_a;d!==_a&&typeof u[0]!="number"&&(this.mixKeyframes=ya(O8,N1(u[0],u[1])),u=[0,100]);const h=d({...e,keyframes:u});l==="mirror"&&(this.mirroredGenerator=d({...e,keyframes:[...u].reverse(),velocity:-c})),h.calculatedDuration===null&&(h.calculatedDuration=Xh(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:l,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),O=this.playbackSpeed>=0?E<0:E>s;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let C=this.currentTime,_=i;if(m){const D=Math.min(this.currentTime,s)/u;let H=Math.floor(D),Y=D%1;!Y&&D>=1&&(Y=1),Y===1&&H--,H=Math.min(H,m+1),H%2&&(y==="reverse"?(Y=1-Y,b&&(Y-=b/u)):y==="mirror"&&(_=c)),C=Jn(0,1,Y)*u}const R=O?{done:!1,value:p[0]}:_.next(C);l&&(R.value=l(R.value));let{done:A}=R;!O&&d!==null&&(A=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const k=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return k&&x!==Kh&&(R.value=Qh(p,this.options,S,this.speed)),w&&w(R.value),k&&this.finish(),R}then(e,n){return this.finished.then(e,n)}get duration(){return gn(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+gn(e)}get time(){return gn(this.currentTime)}set time(e){e=jn(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($e.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=gn(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=m8,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($e.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 D8(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const qi=t=>t*180/Math.PI,tp=t=>{const e=qi(Math.atan2(t[1],t[0]));return ep(e)},j8={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:tp,rotateZ:tp,skewX:t=>qi(Math.atan(t[1])),skewY:t=>qi(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},ep=t=>(t=t%360,t<0&&(t+=360),t),O1=tp,D1=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),j1=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),z8={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:D1,scaleY:j1,scale:t=>(D1(t)+j1(t))/2,rotateX:t=>ep(qi(Math.atan2(t[6],t[5]))),rotateY:t=>ep(qi(Math.atan2(-t[2],t[0]))),rotateZ:O1,rotate:O1,skewX:t=>qi(Math.atan(t[4])),skewY:t=>qi(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function np(t){return t.includes("scale")?1:0}function op(t,e){if(!t||t==="none")return np(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,s;if(n)i=z8,s=n;else{const u=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=j8,s=u}if(!s)return np(e);const l=i[e],c=s[1].split(",").map(L8);return typeof l=="function"?l(c):c[l]}const V8=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return op(n,e)};function L8(t){return parseFloat(t.trim())}const Hr=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Ur=new Set(Hr),z1=t=>t===Br||t===St,I8=new Set(["x","y","z"]),B8=Hr.filter(t=>!I8.has(t));function P8(t){const e=[];return B8.forEach(n=>{const i=t.getValue(n);i!==void 0&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e}const Qo={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})=>op(e,"x"),y:(t,{transform:e})=>op(e,"y")};Qo.translateX=Qo.x,Qo.translateY=Qo.y;const Xi=new Set;let ip=!1,rp=!1,sp=!1;function V1(){if(rp){const t=Array.from(Xi).filter(i=>i.needsMeasurement),e=new Set(t.map(i=>i.element)),n=new Map;e.forEach(i=>{const s=P8(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(([l,c])=>{i.getValue(l)?.set(c)})}),t.forEach(i=>i.measureEndState()),t.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}rp=!1,ip=!1,Xi.forEach(t=>t.complete(sp)),Xi.clear()}function L1(){Xi.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(rp=!0)})}function H8(){sp=!0,L1(),V1(),sp=!1}class ap{constructor(e,n,i,s,l,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=l,this.isAsync=c}scheduleResolve(){this.state="scheduled",this.isAsync?(Xi.add(this),ip||(ip=!0,ie.read(L1),ie.resolveKeyframes(V1))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:i,motionValue:s}=this;if(e[0]===null){const l=s?.get(),c=e[e.length-1];if(l!==void 0)e[0]=l;else if(i&&n){const u=i.readValue(n,c);u!=null&&(e[0]=u)}e[0]===void 0&&(e[0]=c),s&&l===void 0&&s.set(e[0])}D8(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Xi.delete(this)}cancel(){this.state==="scheduled"&&(Xi.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const U8=t=>t.startsWith("--");function $8(t,e,n){U8(e)?t.style.setProperty(e,n):t.style[e]=n}const Y8={};function I1(t,e){const n=t1(t);return()=>Y8[e]??n()}const G8=I1(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),B1=I1(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),Ca=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,P1={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:Ca([0,.65,.55,1]),circOut:Ca([.55,0,1,.45]),backIn:Ca([.31,.01,.66,-.59]),backOut:Ca([.33,1.53,.69,.99])};function H1(t,e){if(t)return typeof t=="function"?B1()?A1(t,e):"ease-out":f1(t)?Ca(t):Array.isArray(t)?t.map(n=>H1(n,e)||P1.easeOut):P1[t]}function q8(t,e,n,{delay:i=0,duration:s=300,repeat:l=0,repeatType:c="loop",ease:u="easeOut",times:d}={},h=void 0){const p={[e]:n};d&&(p.offset=d);const m=H1(u,s);Array.isArray(m)&&(p.easing=m);const y={delay:i,duration:s,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:l+1,direction:c==="reverse"?"alternate":"normal"};return h&&(y.pseudoElement=h),t.animate(p,y)}function U1(t){return typeof t=="function"&&"applyToOptions"in t}function X8({type:t,...e}){return U1(t)&&B1()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class $1 extends Wh{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:i,keyframes:s,pseudoElement:l,allowFlatten:c=!1,finalKeyframe:u,onComplete:d}=e;this.isPseudoElement=!!l,this.allowFlatten=c,this.options=e,Dh(typeof e.type!="string");const h=X8(e);this.animation=q8(n,i,s,h,l),h.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!l){const p=Qh(s,this.options,u,this.speed);this.updateMotionValue?this.updateMotionValue(p):$8(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 gn(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+gn(e)}get time(){return gn(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=jn(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&&G8()?(this.animation.timeline=e,mn):n(this)}}const Y1={anticipate:a1,backInOut:s1,circInOut:c1};function F8(t){return t in Y1}function Z8(t){typeof t.ease=="string"&&F8(t.ease)&&(t.ease=Y1[t.ease])}const lp=10;class K8 extends $1{constructor(e){Z8(e),k1(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:i,onComplete:s,element:l,...c}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const u=new Jh({...c,autoplay:!1}),d=Math.max(lp,$e.now()-this.startTime),h=Jn(0,lp,d-lp);n.setWithVelocity(u.sample(Math.max(0,d-h)).value,u.sample(d).value,h),u.stop()}}const G1=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(zn.test(t)||t==="0")&&!t.startsWith("url("));function Q8(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 W8(t,e,n,i){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const l=t[t.length-1],c=G1(s,e),u=G1(l,e);return!c||!u?!1:Q8(t)||(n==="spring"||U1(n))&&i}function cp(t){t.duration=0,t.type="keyframes"}const J8=new Set(["opacity","clipPath","filter","transform"]),tB=t1(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function eB(t){const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:l,type:c}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:d,transformTemplate:h}=e.owner.getProps();return tB()&&n&&J8.has(n)&&(n!=="transform"||!h)&&!d&&!i&&s!=="mirror"&&l!==0&&c!=="inertia"}const nB=40;class oB extends Wh{constructor({autoplay:e=!0,delay:n=0,type:i="keyframes",repeat:s=0,repeatDelay:l=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=$e.now();const y={autoplay:e,delay:n,type:i,repeat:s,repeatDelay:l,repeatType:c,name:d,motionValue:h,element:p,...m},b=p?.KeyframeResolver||ap;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:l,type:c,velocity:u,delay:d,isHandoff:h,onUpdate:p}=i;this.resolvedAt=$e.now(),W8(e,l,c,u)||((yo.instantAnimations||!d)&&p?.(Qh(e,i,n)),e[0]=e[e.length-1],cp(i),i.repeat=0);const y={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>nB?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:e},b=!h&&eB(y),x=y.motionValue?.owner?.current,w=b?new K8({...y,element:x}):new Jh(y);w.finished.then(()=>{this.notifyFinished()}).catch(mn),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(),H8()),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 q1(t,e,n,i=0,s=1){const l=Array.from(t).sort((h,p)=>h.sortNodePosition(p)).indexOf(e),c=t.size,u=(c-1)*i;return typeof n=="function"?n(l,c):s===1?l*i:u-l*i}const iB=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function rB(t){const e=iB.exec(t);if(!e)return[,];const[,n,i,s]=e;return[`--${n??i}`,s]}function X1(t,e,n=1){const[i,s]=rB(t);if(!i)return;const l=window.getComputedStyle(e).getPropertyValue(i);if(l){const c=l.trim();return Qw(c)?parseFloat(c):c}return Ih(s)?X1(s,e,n+1):s}const sB={type:"spring",stiffness:500,damping:25,restSpeed:10},aB=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),lB={type:"keyframes",duration:.8},cB={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},uB=(t,{keyframes:e})=>e.length>2?lB:Ur.has(t)?t.startsWith("scale")?aB(e[1]):sB:cB,fB=t=>t!==null;function dB(t,{repeat:e,repeatType:n="loop"},i){const s=t.filter(fB),l=e&&n!=="loop"&&e%2===1?0:s.length-1;return s[l]}function F1(t,e){if(t?.inherit&&e){const{inherit:n,...i}=t;return{...e,...i}}return t}function up(t,e){const n=t?.[e]??t?.default??t;return n!==t?F1(n,t):n}function hB({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:s,repeat:l,repeatType:c,repeatDelay:u,from:d,elapsed:h,...p}){return!!Object.keys(p).length}const fp=(t,e,n,i={},s,l)=>c=>{const u=up(i,t)||{},d=u.delay||i.delay||0;let{elapsed:h=0}=i;h=h-jn(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:l?void 0:s};hB(u)||Object.assign(p,uB(t,p)),p.duration&&(p.duration=jn(p.duration)),p.repeatDelay&&(p.repeatDelay=jn(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let m=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(cp(p),p.delay===0&&(m=!0)),(yo.instantAnimations||yo.skipAnimations||s?.shouldSkipAnimations)&&(m=!0,cp(p),p.delay=0),p.allowFlatten=!u.type&&!u.ease,m&&!l&&e.get()!==void 0){const y=dB(p.keyframes,u);if(y!==void 0){ie.update(()=>{p.onUpdate(y),p.onComplete()});return}}return u.isSync?new Jh(p):new oB(p)};function Z1(t){const e=[{},{}];return t?.values.forEach((n,i)=>{e[0][i]=n.get(),e[1][i]=n.getVelocity()}),e}function dp(t,e,n,i){if(typeof e=="function"){const[s,l]=Z1(i);e=e(n!==void 0?n:t.custom,s,l)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,l]=Z1(i);e=e(n!==void 0?n:t.custom,s,l)}return e}function $r(t,e,n){const i=t.getProps();return dp(i,e,n!==void 0?n:i.custom,t)}const K1=new Set(["width","height","top","left","right","bottom",...Hr]),Q1=30,pB=t=>!isNaN(parseFloat(t));class mB{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{const s=$e.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 l of this.dependents)l.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=$e.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=pB(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 jh);const i=this.events[e].add(n);return e==="change"?()=>{i(),ie.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=$e.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>Q1)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,Q1);return e1(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 Yr(t,e){return new mB(t,e)}const hp=t=>Array.isArray(t);function gB(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,Yr(n))}function yB(t){return hp(t)?t[t.length-1]||0:t}function vB(t,e){const n=$r(t,e);let{transitionEnd:i={},transition:s={},...l}=n||{};l={...l,...i};for(const c in l){const u=yB(l[c]);gB(t,c,u)}}const He=t=>!!(t&&t.getVelocity);function bB(t){return!!(He(t)&&t.add)}function pp(t,e){const n=t.getValue("willChange");if(bB(n))return n.add(e);if(!n&&yo.WillChange){const i=new yo.WillChange("auto");t.addValue("willChange",i),i.add(e)}}function mp(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const W1="data-"+mp("framerAppearId");function J1(t){return t.props[W1]}function xB({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,i}function tS(t,e,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:l,transitionEnd:c,...u}=e;const d=t.getDefaultTransition();l=l?F1(l,d):d;const h=l?.reduceMotion;i&&(l=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&&xB(m,y))continue;const w={delay:n,...up(l||{},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 _=J1(t);if(_){const R=window.MotionHandoffAnimation(_,y,ie);R!==null&&(w.startTime=R,E=!0)}}pp(t,y);const O=h??t.shouldReduceMotion;b.start(fp(y,b,x,O&&K1.has(y)?{type:!1}:w,t,E));const C=b.animation;C&&p.push(C)}if(c){const y=()=>ie.update(()=>{c&&vB(t,c)});p.length?Promise.all(p).then(y):y()}return p}function gp(t,e,n={}){const i=$r(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const l=i?()=>Promise.all(tS(t,i,n)):()=>Promise.resolve(),c=t.variantChildren&&t.variantChildren.size?(d=0)=>{const{delayChildren:h=0,staggerChildren:p,staggerDirection:m}=s;return wB(t,e,d,h,p,m,n)}:()=>Promise.resolve(),{when:u}=s;if(u){const[d,h]=u==="beforeChildren"?[l,c]:[c,l];return d().then(()=>h())}else return Promise.all([l(),c(n.delay)])}function wB(t,e,n=0,i=0,s=0,l=1,c){const u=[];for(const d of t.variantChildren)d.notify("AnimationStart",e),u.push(gp(d,e,{...c,delay:n+(typeof i=="function"?0:i)+q1(t.variantChildren,d,i,s,l)}).then(()=>d.notify("AnimationComplete",e)));return Promise.all(u)}function SB(t,e,n={}){t.notify("AnimationStart",e);let i;if(Array.isArray(e)){const s=e.map(l=>gp(t,l,n));i=Promise.all(s)}else if(typeof e=="string")i=gp(t,e,n);else{const s=typeof e=="function"?$r(t,e,n.custom):e;i=Promise.all(tS(t,s,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}const EB={test:t=>t==="auto",parse:t=>t},eS=t=>e=>e.test(t),nS=[Br,St,to,Ko,J6,W6,EB],oS=t=>nS.find(eS(t));function _B(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||Jw(t):!0}const CB=new Set(["brightness","contrast","saturate","opacity"]);function TB(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[i]=n.match(Bh)||[];if(!i)return t;const s=n.replace(i,"");let l=CB.has(e)?1:0;return i!==n&&(l*=100),e+"("+l+s+")"}const NB=/\b([a-z-]*)\(.*?\)/gu,yp={...zn,getAnimatableNone:t=>{const e=t.match(NB);return e?e.map(TB).join(" "):t}},vp={...zn,getAnimatableNone:t=>{const e=zn.parse(t);return zn.createTransformer(t)(e.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},iS={...Br,transform:Math.round},bp={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:Ko,rotateX:Ko,rotateY:Ko,rotateZ:Ko,scale:$c,scaleX:$c,scaleY:$c,scaleZ:$c,skew:Ko,skewX:Ko,skewY:Ko,distance:St,translateX:St,translateY:St,translateZ:St,x:St,y:St,z:St,perspective:St,transformPerspective:St,opacity:xa,originX:v1,originY:v1,originZ:St},zIndex:iS,fillOpacity:xa,strokeOpacity:xa,numOctaves:iS},AB={...bp,color:xe,backgroundColor:xe,outlineColor:xe,fill:xe,stroke:xe,borderColor:xe,borderTopColor:xe,borderRightColor:xe,borderBottomColor:xe,borderLeftColor:xe,filter:yp,WebkitFilter:yp,mask:vp,WebkitMask:vp},rS=t=>AB[t],MB=new Set([yp,vp]);function sS(t,e){let n=rS(t);return MB.has(n)||(n=zn),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const RB=new Set(["auto","none","0"]);function kB(t,e,n){let i=0,s;for(;i<t.length&&!s;){const l=t[i];typeof l=="string"&&!RB.has(l)&&Ea(l).values.length&&(s=t[i]),i++}if(s&&n)for(const l of e)t[l]=sS(n,s)}class OB extends ap{constructor(e,n,i,s,l){super(e,n,i,s,l,!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(),Ih(m))){const y=X1(m,n.current);y!==void 0&&(e[p]=y),p===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!K1.has(i)||e.length!==2)return;const[s,l]=e,c=oS(s),u=oS(l),d=g1(s),h=g1(l);if(d!==h&&Qo[i]){this.needsMeasurement=!0;return}if(c!==u)if(z1(c)&&z1(u))for(let p=0;p<e.length;p++){const m=e[p];typeof m=="string"&&(e[p]=parseFloat(m))}else Qo[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&&kB(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=Qo[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 l=i.length-1,c=i[l];i[l]=Qo[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 DB=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 lS=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function xp(t){return Ww(t)&&"offsetHeight"in t}const{schedule:wp}=h1(queueMicrotask,!1),Vn={x:!1,y:!1};function cS(){return Vn.x||Vn.y}function jB(t){return t==="x"||t==="y"?Vn[t]?null:(Vn[t]=!0,()=>{Vn[t]=!1}):Vn.x||Vn.y?null:(Vn.x=Vn.y=!0,()=>{Vn.x=Vn.y=!1})}function uS(t,e){const n=aS(t),i=new AbortController,s={passive:!0,...e,signal:i.signal};return[n,s,()=>i.abort()]}function zB(t){return!(t.pointerType==="touch"||cS())}function VB(t,e,n={}){const[i,s,l]=uS(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(!zB(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)}),l}const fS=(t,e)=>e?t===e?!0:fS(t,e.parentElement):!1,Sp=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,LB=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function IB(t){return LB.has(t.tagName)||t.isContentEditable===!0}const BB=new Set(["INPUT","SELECT","TEXTAREA"]);function PB(t){return BB.has(t.tagName)||t.isContentEditable===!0}const Xc=new WeakSet;function dS(t){return e=>{e.key==="Enter"&&t(e)}}function Ep(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const HB=(t,e)=>{const n=t.currentTarget;if(!n)return;const i=dS(()=>{if(Xc.has(n))return;Ep(n,"down");const s=dS(()=>{Ep(n,"up")}),l=()=>Ep(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",l,e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)};function hS(t){return Sp(t)&&!cS()}const pS=new WeakSet;function UB(t,e,n={}){const[i,s,l]=uS(t,n),c=u=>{const d=u.currentTarget;if(!hS(u)||pS.has(u))return;Xc.add(d),n.stopPropagation&&pS.add(u);const h=e(d,u),p=(b,x)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",y),Xc.has(d)&&Xc.delete(d),hS(b)&&typeof h=="function"&&h(b,{success:x})},m=b=>{p(b,d===window||d===document||n.useGlobalTarget||fS(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),xp(u)&&(u.addEventListener("focus",h=>HB(h,s)),!IB(u)&&!u.hasAttribute("tabindex")&&(u.tabIndex=0))}),l}function _p(t){return Ww(t)&&"ownerSVGElement"in t}const Fc=new WeakMap;let Zc;const mS=(t,e,n)=>(i,s)=>s&&s[0]?s[0][t+"Size"]:_p(i)&&"getBBox"in i?i.getBBox()[e]:i[n],$B=mS("inline","width","offsetWidth"),YB=mS("block","height","offsetHeight");function GB({target:t,borderBoxSize:e}){Fc.get(t)?.forEach(n=>{n(t,{get width(){return $B(t,e)},get height(){return YB(t,e)}})})}function qB(t){t.forEach(GB)}function XB(){typeof ResizeObserver>"u"||(Zc=new ResizeObserver(qB))}function FB(t,e){Zc||XB();const n=aS(t);return n.forEach(i=>{let s=Fc.get(i);s||(s=new Set,Fc.set(i,s)),s.add(e),Zc?.observe(i)}),()=>{n.forEach(i=>{const s=Fc.get(i);s?.delete(e),s?.size||Zc?.unobserve(i)})}}const Kc=new Set;let Gr;function ZB(){Gr=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};Kc.forEach(e=>e(t))},window.addEventListener("resize",Gr)}function KB(t){return Kc.add(t),Gr||ZB(),()=>{Kc.delete(t),!Kc.size&&typeof Gr=="function"&&(window.removeEventListener("resize",Gr),Gr=void 0)}}function gS(t,e){return typeof t=="function"?KB(t):FB(t,e)}function QB(t){return _p(t)&&t.tagName==="svg"}const WB=[...nS,xe,zn],JB=t=>WB.find(eS(t)),yS=()=>({translate:0,scale:1,origin:0,originPoint:0}),qr=()=>({x:yS(),y:yS()}),vS=()=>({min:0,max:0}),Ne=()=>({x:vS(),y:vS()}),tP=new WeakMap;function Qc(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function Ta(t){return typeof t=="string"||Array.isArray(t)}const Cp=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Tp=["initial",...Cp];function Wc(t){return Qc(t.animate)||Tp.some(e=>Ta(t[e]))}function bS(t){return!!(Wc(t)||t.variants)}function eP(t,e,n){for(const i in e){const s=e[i],l=n[i];if(He(s))t.addValue(i,s);else if(He(l))t.addValue(i,Yr(s,{owner:t}));else if(l!==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,Yr(c!==void 0?c:s,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const Np={current:null},xS={current:!1},nP=typeof window<"u";function oP(){if(xS.current=!0,!!nP)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>Np.current=t.matches;t.addEventListener("change",e),e()}else Np.current=!1}const wS=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Jc={};function SS(t){Jc=t}function iP(){return Jc}class rP{scrapeMotionValuesFromProps(e,n,i){return{}}constructor({parent:e,props:n,presenceContext:i,reducedMotionConfig:s,skipAnimations:l,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=ap,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=$e.now();this.renderScheduledAt<b&&(this.renderScheduledAt=b,ie.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=l,this.options=d,this.blockInitialAnimation=!!c,this.isControllingVariants=Wc(n),this.isVariantNode=bS(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&&He(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,tP.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:(xS.current||oP(),this.shouldReduceMotion=Np.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(),Zo(this.notifyUpdate),Zo(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&&DB.has(e)&&this.current instanceof HTMLElement){const{factory:c,keyframes:u,times:d,ease:h,duration:p}=n.accelerate,m=new $1({element:this.current,name:e,keyframes:u,times:d,ease:h,duration:jn(p)}),y=c(m);this.valueSubscriptions.set(e,()=>{y(),m.cancel()});return}const i=Ur.has(e);i&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",c=>{this.latestValues[e]=c,this.props.onUpdate&&ie.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let l;typeof window<"u"&&window.MotionCheckAppearSync&&(l=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),l&&l(),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 Jc){const n=Jc[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 l=this.features[e];l.isMounted?l.update():(l.mount(),l.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):Ne()}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<wS.length;i++){const s=wS[i];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const l="on"+s,c=e[l];c&&(this.propEventSubscriptions[s]=this.on(s,c))}this.prevMotionValues=eP(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=Yr(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"&&(Qw(i)||Jw(i))?i=parseFloat(i):!JB(i)&&zn.test(n)&&(i=sS(e,n)),this.setBaseTarget(e,He(i)?i.get():i)),He(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 l=dp(this.props,n,this.presenceContext?.custom);l&&(i=l[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!He(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 jh),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){wp.render(this.render)}}class ES extends rP{constructor(){super(...arguments),this.KeyframeResolver=OB}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;He(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Wo{constructor(e){this.isMounted=!1,this.node=e}update(){}}function _S({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function sP({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function aP(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 Ap(t){return t===void 0||t===1}function Mp({scale:t,scaleX:e,scaleY:n}){return!Ap(t)||!Ap(e)||!Ap(n)}function Fi(t){return Mp(t)||CS(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function CS(t){return TS(t.x)||TS(t.y)}function TS(t){return t&&t!=="0%"}function tu(t,e,n){const i=t-n,s=e*i;return n+s}function NS(t,e,n,i,s){return s!==void 0&&(t=tu(t,s,i)),tu(t,n,i)+e}function Rp(t,e=0,n=1,i,s){t.min=NS(t.min,e,n,i,s),t.max=NS(t.max,e,n,i,s)}function AS(t,{x:e,y:n}){Rp(t.x,e.translate,e.scale,e.originPoint),Rp(t.y,n.translate,n.scale,n.originPoint)}const MS=.999999999999,RS=1.0000000000001;function lP(t,e,n,i=!1){const s=n.length;if(!s)return;e.x=e.y=1;let l,c;for(let u=0;u<s;u++){l=n[u],c=l.projectionDelta;const{visualElement:d}=l.options;d&&d.props.style&&d.props.style.display==="contents"||(i&&l.options.layoutScroll&&l.scroll&&l!==l.root&&Fr(t,{x:-l.scroll.offset.x,y:-l.scroll.offset.y}),c&&(e.x*=c.x.scale,e.y*=c.y.scale,AS(t,c)),i&&Fi(l.latestValues)&&Fr(t,l.latestValues))}e.x<RS&&e.x>MS&&(e.x=1),e.y<RS&&e.y>MS&&(e.y=1)}function Xr(t,e){t.min=t.min+e,t.max=t.max+e}function kS(t,e,n,i,s=.5){const l=fe(t.min,t.max,s);Rp(t,e,n,l,i)}function Fr(t,e){kS(t.x,e.x,e.scaleX,e.scale,e.originX),kS(t.y,e.y,e.scaleY,e.scale,e.originY)}function OS(t,e){return _S(aP(t.getBoundingClientRect(),e))}function cP(t,e,n){const i=OS(t,n),{scroll:s}=e;return s&&(Xr(i.x,s.offset.x),Xr(i.y,s.offset.y)),i}const uP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},fP=Hr.length;function dP(t,e,n){let i="",s=!0;for(let l=0;l<fP;l++){const c=Hr[l],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=lS(u,bp[c]);if(!d){s=!1;const p=uP[c]||c;i+=`${p}(${h}) `}n&&(e[c]=h)}}return i=i.trim(),n?i=n(e,s?"":i):s&&(i="none"),i}function kp(t,e,n){const{style:i,vars:s,transformOrigin:l}=t;let c=!1,u=!1;for(const d in e){const h=e[d];if(Ur.has(d)){c=!0;continue}else if(m1(d)){s[d]=h;continue}else{const p=lS(h,bp[d]);d.startsWith("origin")?(u=!0,l[d]=p):i[d]=p}}if(e.transform||(c||n?i.transform=dP(e,t.transform,n):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:h="50%",originZ:p=0}=l;i.transformOrigin=`${d} ${h} ${p}`}}function DS(t,{style:e,vars:n},i,s){const l=t.style;let c;for(c in e)l[c]=e[c];s?.applyProjectionStyles(l,i);for(c in n)l.setProperty(c,n[c])}function jS(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const Na={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(St.test(t))t=parseFloat(t);else return t;const n=jS(t,e.target.x),i=jS(t,e.target.y);return`${n}% ${i}%`}},hP={correct:(t,{treeScale:e,projectionDelta:n})=>{const i=t,s=zn.parse(t);if(s.length>5)return i;const l=zn.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=fe(u,d,.5);return typeof s[2+c]=="number"&&(s[2+c]/=h),typeof s[3+c]=="number"&&(s[3+c]/=h),l(s)}},Op={borderRadius:{...Na,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Na,borderTopRightRadius:Na,borderBottomLeftRadius:Na,borderBottomRightRadius:Na,boxShadow:hP};function zS(t,{layout:e,layoutId:n}){return Ur.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Op[t]||t==="opacity")}function Dp(t,e,n){const i=t.style,s=e?.style,l={};if(!i)return l;for(const c in i)(He(i[c])||s&&He(s[c])||zS(c,t)||n?.getValue(c)?.liveStyle!==void 0)&&(l[c]=i[c]);return l}function pP(t){return window.getComputedStyle(t)}class mP extends ES{constructor(){super(...arguments),this.type="html",this.renderInstance=DS}readValueFromInstance(e,n){if(Ur.has(n))return this.projection?.isProjecting?np(n):V8(e,n);{const i=pP(e),s=(m1(n)?i.getPropertyValue(n):i[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return OS(e,n)}build(e,n,i){kp(e,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,i){return Dp(e,n,i)}}const gP={offset:"stroke-dashoffset",array:"stroke-dasharray"},yP={offset:"strokeDashoffset",array:"strokeDasharray"};function vP(t,e,n=1,i=0,s=!0){t.pathLength=1;const l=s?gP:yP;t[l.offset]=`${-i}`,t[l.array]=`${e} ${n}`}const bP=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function VS(t,{attrX:e,attrY:n,attrScale:i,pathLength:s,pathSpacing:l=1,pathOffset:c=0,...u},d,h,p){if(kp(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 bP)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&&vP(m,s,l,c,!1)}const LS=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"]),IS=t=>typeof t=="string"&&t.toLowerCase()==="svg";function xP(t,e,n,i){DS(t,e,void 0,i);for(const s in e.attrs)t.setAttribute(LS.has(s)?s:mp(s),e.attrs[s])}function BS(t,e,n){const i=Dp(t,e,n);for(const s in t)if(He(t[s])||He(e[s])){const l=Hr.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;i[l]=t[s]}return i}class wP extends ES{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=Ne}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Ur.has(n)){const i=rS(n);return i&&i.default||0}return n=LS.has(n)?n:mp(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,i){return BS(e,n,i)}build(e,n,i){VS(e,n,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(e,n,i,s){xP(e,n,i,s)}mount(e){this.isSVGTag=IS(e.tagName),super.mount(e)}}const SP=Tp.length;function PS(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?PS(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<SP;n++){const i=Tp[n],s=t.props[i];(Ta(s)||s===!1)&&(e[i]=s)}return e}function HS(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 EP=[...Cp].reverse(),_P=Cp.length;function CP(t){return e=>Promise.all(e.map(({animation:n,options:i})=>SB(t,n,i)))}function TP(t){let e=CP(t),n=US(),i=!0;const s=d=>(h,p)=>{const m=$r(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 l(d){e=d(t)}function c(d){const{props:h}=t,p=PS(t.parent)||{},m=[],y=new Set;let b={},x=1/0;for(let S=0;S<_P;S++){const E=EP[S],O=n[E],C=h[E]!==void 0?h[E]:p[E],_=Ta(C),R=E===d?O.isActive:null;R===!1&&(x=S);let A=C===p[E]&&C!==h[E]&&_;if(A&&i&&t.manuallyAnimateOnMount&&(A=!1),O.protectedKeys={...b},!O.isActive&&R===null||!C&&!O.prevProp||Qc(C)||typeof C=="boolean")continue;if(E==="exit"&&O.isActive&&R!==!0){O.prevResolvedValues&&(b={...b,...O.prevResolvedValues});continue}const k=NP(O.prevProp,C);let D=k||E===d&&O.isActive&&!A&&_||S>x&&_,H=!1;const Y=Array.isArray(C)?C:[C];let $=Y.reduce(s(E),{});R===!1&&($={});const{prevResolvedValues:F={}}=O,Q={...F,...$},B=I=>{D=!0,y.has(I)&&(H=!0,y.delete(I)),O.needsAnimating[I]=!0;const z=t.getValue(I);z&&(z.liveStyle=!1)};for(const I in Q){const z=$[I],U=F[I];if(b.hasOwnProperty(I))continue;let G=!1;hp(z)&&hp(U)?G=!HS(z,U):G=z!==U,G?z!=null?B(I):y.add(I):z!==void 0&&y.has(I)?B(I):O.protectedKeys[I]=!0}O.prevProp=C,O.prevResolvedValues=$,O.isActive&&(b={...b,...$}),i&&t.blockInitialAnimation&&(D=!1);const P=A&&k;D&&(!P||H)&&m.push(...Y.map(I=>{const z={type:E};if(typeof I=="string"&&i&&!P&&t.manuallyAnimateOnMount&&t.parent){const{parent:U}=t,G=$r(U,I);if(U.enteringChildren&&G){const{delayChildren:L}=G.transition||{};z.delay=q1(U.enteringChildren,t,L)}}return{animation:I,options:z}}))}if(y.size){const S={};if(typeof h.initial!="boolean"){const E=$r(t,Array.isArray(h.initial)?h.initial[0]:h.initial);E&&E.transition&&(S.transition=E.transition)}y.forEach(E=>{const O=t.getBaseTarget(E),C=t.getValue(E);C&&(C.liveStyle=!0),S[E]=O??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:l,getState:()=>n,reset:()=>{n=US()}}}function NP(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!HS(e,t):!1}function Zi(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function US(){return{animate:Zi(!0),whileInView:Zi(),whileHover:Zi(),whileTap:Zi(),whileDrag:Zi(),whileFocus:Zi(),exit:Zi()}}function $S(t,e){t.min=e.min,t.max=e.max}function Ln(t,e){$S(t.x,e.x),$S(t.y,e.y)}function YS(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const GS=1e-4,AP=1-GS,MP=1+GS,qS=.01,RP=0-qS,kP=0+qS;function Ye(t){return t.max-t.min}function OP(t,e,n){return Math.abs(t-e)<=n}function XS(t,e,n,i=.5){t.origin=i,t.originPoint=fe(e.min,e.max,t.origin),t.scale=Ye(n)/Ye(e),t.translate=fe(n.min,n.max,t.origin)-t.originPoint,(t.scale>=AP&&t.scale<=MP||isNaN(t.scale))&&(t.scale=1),(t.translate>=RP&&t.translate<=kP||isNaN(t.translate))&&(t.translate=0)}function Aa(t,e,n,i){XS(t.x,e.x,n.x,i?i.originX:void 0),XS(t.y,e.y,n.y,i?i.originY:void 0)}function FS(t,e,n){t.min=n.min+e.min,t.max=t.min+Ye(e)}function DP(t,e,n){FS(t.x,e.x,n.x),FS(t.y,e.y,n.y)}function ZS(t,e,n){t.min=e.min-n.min,t.max=t.min+Ye(e)}function eu(t,e,n){ZS(t.x,e.x,n.x),ZS(t.y,e.y,n.y)}function KS(t,e,n,i,s){return t-=e,t=tu(t,1/n,i),s!==void 0&&(t=tu(t,1/s,i)),t}function jP(t,e=0,n=1,i=.5,s,l=t,c=t){if(to.test(e)&&(e=parseFloat(e),e=fe(c.min,c.max,e/100)-c.min),typeof e!="number")return;let u=fe(l.min,l.max,i);t===l&&(u-=e),t.min=KS(t.min,e,n,u,s),t.max=KS(t.max,e,n,u,s)}function QS(t,e,[n,i,s],l,c){jP(t,e[n],e[i],e[s],e.scale,l,c)}const zP=["x","scaleX","originX"],VP=["y","scaleY","originY"];function WS(t,e,n,i){QS(t.x,e,zP,n?n.x:void 0,i?i.x:void 0),QS(t.y,e,VP,n?n.y:void 0,i?i.y:void 0)}function JS(t){return t.translate===0&&t.scale===1}function tE(t){return JS(t.x)&&JS(t.y)}function eE(t,e){return t.min===e.min&&t.max===e.max}function LP(t,e){return eE(t.x,e.x)&&eE(t.y,e.y)}function nE(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function oE(t,e){return nE(t.x,e.x)&&nE(t.y,e.y)}function iE(t){return Ye(t.x)/Ye(t.y)}function rE(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function eo(t){return[t("x"),t("y")]}function IP(t,e,n){let i="";const s=t.x.translate/e.x,l=t.y.translate/e.y,c=n?.z||0;if((s||l||c)&&(i=`translate3d(${s}px, ${l}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 sE=["TopLeft","TopRight","BottomLeft","BottomRight"],BP=sE.length,aE=t=>typeof t=="string"?parseFloat(t):t,lE=t=>typeof t=="number"||St.test(t);function PP(t,e,n,i,s,l){s?(t.opacity=fe(0,n.opacity??1,HP(i)),t.opacityExit=fe(e.opacity??1,0,UP(i))):l&&(t.opacity=fe(e.opacity??1,n.opacity??1,i));for(let c=0;c<BP;c++){const u=`border${sE[c]}Radius`;let d=cE(e,u),h=cE(n,u);if(d===void 0&&h===void 0)continue;d||(d=0),h||(h=0),d===0||h===0||lE(d)===lE(h)?(t[u]=Math.max(fe(aE(d),aE(h),i),0),(to.test(h)||to.test(d))&&(t[u]+="%")):t[u]=h}(e.rotate||n.rotate)&&(t.rotate=fe(e.rotate||0,n.rotate||0,i))}function cE(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const HP=uE(0,.5,l1),UP=uE(.5,.95,mn);function uE(t,e,n){return i=>i<t?0:i>e?1:n(va(t,e,i))}function $P(t,e,n){const i=He(t)?t:Yr(t);return i.start(fp("",i,e,n)),i.animation}function Ma(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}const YP=(t,e)=>t.depth-e.depth;class GP{constructor(){this.children=[],this.isDirty=!1}add(e){Oh(this.children,e),this.isDirty=!0}remove(e){Pc(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(YP),this.isDirty=!1,this.children.forEach(e)}}function qP(t,e){const n=$e.now(),i=({timestamp:s})=>{const l=s-n;l>=e&&(Zo(i),t(l-e))};return ie.setup(i,!0),()=>Zo(i)}function nu(t){return He(t)?t.get():t}class XP{constructor(){this.members=[]}add(e){Oh(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&&Pc(this.members,i)}e.scheduleRender()}remove(e){if(Pc(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 l=this.members[s],c=l.instance;if(l.isPresent!==!1&&(!c||c.isConnected!==!1)){i=l;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,l=e.options.layoutDependency;if(!(s!==void 0&&l!==void 0&&s===l)){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 ou={hasAnimatedSinceResize:!0,hasEverUpdated:!1},jp=["","X","Y","Z"],FP=1e3;let ZP=0;function zp(t,e,n,i){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),i&&(i[t]=0))}function fE(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=J1(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:l}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",ie,!(s||l))}const{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&fE(i)}function dE({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:i,resetTransform:s}){return class{constructor(c={},u=e?.()){this.id=ZP++,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(WP),this.nodes.forEach(nH),this.nodes.forEach(oH),this.nodes.forEach(JP)},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 GP)}addEventListener(c,u){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new jh),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=_p(c)&&!QB(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;ie.read(()=>{m=window.innerWidth}),t(c,()=>{const b=window.innerWidth;b!==m&&(m=b,this.root.updateBlockedByResize=!0,p&&p(),p=qP(y,250),ou.hasAnimatedSinceResize&&(ou.hasAnimatedSinceResize=!1,this.nodes.forEach(mE)))})}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()||lH,{onLayoutAnimationStart:w,onLayoutAnimationComplete:S}=h.getProps(),E=!this.targetLayout||!oE(this.targetLayout,b),O=!m&&y;if(this.options.layoutRoot||this.resumeFrom||O||m&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const C={...up(x,"layout"),onPlay:w,onComplete:S};(h.shouldReduceMotion||this.options.layoutRoot)&&(C.delay=0,C.type=!1),this.startAnimation(C),this.setAnimationOrigin(p,O)}else m||mE(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(),Zo(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(iH),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&&fE(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(hE);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(pE);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(eH),this.nodes.forEach(KP),this.nodes.forEach(QP)):this.nodes.forEach(pE),this.clearAllSnapshots();const u=$e.now();ze.delta=Jn(0,16.666666666666668,u-ze.timestamp),ze.timestamp=u,ze.isProcessing=!0,Lh.update.process(ze),Lh.preRender.process(ze),Lh.render.process(ze),ze.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,wp.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(tH),this.sharedNodes.forEach(rH)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ie.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ie.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Ye(this.snapshot.measuredBox.x)&&!Ye(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=Ne(),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&&!tE(this.projectionDelta),d=this.getTransformTemplate(),h=d?d(this.latestValues,""):void 0,p=h!==this.prevTransformTemplateValue;c&&this.instance&&(u||Fi(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)),cH(d),{animationId:this.root.animationId,measuredBox:u,layoutBox:d,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:c}=this.options;if(!c)return Ne();const u=c.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(uH))){const{scroll:h}=this.root;h&&(Xr(u.x,h.offset.x),Xr(u.y,h.offset.y))}return u}removeElementScroll(c){const u=Ne();if(Ln(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&&Ln(u,c),Xr(u.x,p.offset.x),Xr(u.y,p.offset.y))}return u}applyTransform(c,u=!1){const d=Ne();Ln(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&&Fr(d,{x:-p.scroll.offset.x,y:-p.scroll.offset.y}),Fi(p.latestValues)&&Fr(d,p.latestValues)}return Fi(this.latestValues)&&Fr(d,this.latestValues),d}removeTransform(c){const u=Ne();Ln(u,c);for(let d=0;d<this.path.length;d++){const h=this.path[d];if(!h.instance||!Fi(h.latestValues))continue;Mp(h.latestValues)&&h.updateSnapshot();const p=Ne(),m=h.measurePageBox();Ln(p,m),WS(u,h.latestValues,h.snapshot?h.snapshot.layoutBox:void 0,p)}return Fi(this.latestValues)&&WS(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!==ze.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=ze.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=Ne(),this.targetWithTransforms=Ne()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),DP(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Ln(this.target,this.layout.layoutBox),AS(this.target,this.targetDelta)):Ln(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||Mp(this.parent.latestValues)||CS(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=Ne(),this.relativeTargetOrigin=Ne(),eu(this.relativeTargetOrigin,u,d),Ln(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===ze.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;Ln(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,y=this.treeScale.y;lP(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=Ne());const{target:b}=c;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(YS(this.prevProjectionDelta.x,this.projectionDelta.x),YS(this.prevProjectionDelta.y,this.projectionDelta.y)),Aa(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==y||!rE(this.projectionDelta.x,this.prevProjectionDelta.x)||!rE(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=qr(),this.projectionDelta=qr(),this.projectionDeltaWithTransform=qr()}setAnimationOrigin(c,u=!1){const d=this.snapshot,h=d?d.latestValues:{},p={...this.latestValues},m=qr();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!u;const y=Ne(),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,O=!!(w&&!E&&this.options.crossfade===!0&&!this.path.some(aH));this.animationProgress=0;let C;this.mixTargetDelta=_=>{const R=_/1e3;gE(m.x,c.x,R),gE(m.y,c.y,R),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(eu(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),sH(this.relativeTarget,this.relativeTargetOrigin,y,R),C&&LP(this.relativeTarget,C)&&(this.isProjectionDirty=!1),C||(C=Ne()),Ln(C,this.relativeTarget)),w&&(this.animationValues=p,PP(p,h,this.latestValues,R,O,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&&(Zo(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ie.update(()=>{ou.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Yr(0)),this.motionValue.jump(0,!1),this.currentAnimation=$P(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(FP),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&&wE(this.options.animationType,this.layout.layoutBox,h.layoutBox)){d=this.target||Ne();const m=Ye(this.layout.layoutBox.x);d.x.min=c.target.x.min,d.x.max=d.x.min+m;const y=Ye(this.layout.layoutBox.y);d.y.min=c.target.y.min,d.y.max=d.y.min+y}Ln(u,d),Fr(u,p),Aa(this.projectionDeltaWithTransform,this.layoutCorrected,u,p)}}registerSharedNode(c,u){this.sharedNodes.has(c)||this.sharedNodes.set(c,new XP),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&&zp("z",c,h,this.animationValues);for(let p=0;p<jp.length;p++)zp(`rotate${jp[p]}`,c,h,this.animationValues),zp(`skew${jp[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=nu(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=nu(u?.pointerEvents)||""),this.hasProjected&&!Fi(this.latestValues)&&(c.transform=d?d({},""):"none",this.hasProjected=!1);return}c.visibility="";const p=h.animationValues||h.latestValues;this.applyTransformsToTarget();let m=IP(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 Op){if(p[x]===void 0)continue;const{correct:w,applyTo:S,isCSSVariable:E}=Op[x],O=m==="none"?p[x]:w(p[x],h);if(S){const C=S.length;for(let _=0;_<C;_++)c[S[_]]=O}else E?this.options.visualElement.renderState.vars[x]=O:c[x]=O}this.options.layoutId&&(c.pointerEvents=h===this?nu(u?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(c=>c.currentAnimation?.stop()),this.root.nodes.forEach(hE),this.root.sharedNodes.clear()}}}function KP(t){t.updateLayout()}function QP(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,l=e.source!==t.layout.source;s==="size"?eo(p=>{const m=l?e.measuredBox[p]:e.layoutBox[p],y=Ye(m);m.min=n[p].min,m.max=m.min+y}):wE(s,e.layoutBox,n)&&eo(p=>{const m=l?e.measuredBox[p]:e.layoutBox[p],y=Ye(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=qr();Aa(c,n,e.layoutBox);const u=qr();l?Aa(u,t.applyTransform(i,!0),e.measuredBox):Aa(u,n,e.layoutBox);const d=!tE(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=Ne();eu(b,e.layoutBox,m.layoutBox);const x=Ne();eu(x,n,y.layoutBox),oE(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 WP(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 JP(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function tH(t){t.clearSnapshot()}function hE(t){t.clearMeasurements()}function pE(t){t.isLayoutDirty=!1}function eH(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function mE(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function nH(t){t.resolveTargetDelta()}function oH(t){t.calcProjection()}function iH(t){t.resetSkewAndRotation()}function rH(t){t.removeLeadSnapshot()}function gE(t,e,n){t.translate=fe(e.translate,0,n),t.scale=fe(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function yE(t,e,n,i){t.min=fe(e.min,n.min,i),t.max=fe(e.max,n.max,i)}function sH(t,e,n,i){yE(t.x,e.x,n.x,i),yE(t.y,e.y,n.y,i)}function aH(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const lH={duration:.45,ease:[.4,0,.1,1]},vE=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),bE=vE("applewebkit/")&&!vE("chrome/")?Math.round:mn;function xE(t){t.min=bE(t.min),t.max=bE(t.max)}function cH(t){xE(t.x),xE(t.y)}function wE(t,e,n){return t==="position"||t==="preserve-aspect"&&!OP(iE(e),iE(n),.2)}function uH(t){return t!==t.root&&t.scroll?.wasRoot}const fH=dE({attachResizeListener:(t,e)=>Ma(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Vp={current:void 0},SE=dE({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Vp.current){const t=new fH({});t.mount(window),t.setOptions({layoutScroll:!0}),Vp.current=t}return Vp.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),Lp=N.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function EE(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function dH(...t){return e=>{let n=!1;const i=t.map(s=>{const l=EE(s,e);return!n&&typeof l=="function"&&(n=!0),l});if(n)return()=>{for(let s=0;s<i.length;s++){const l=i[s];typeof l=="function"?l():EE(t[s],null)}}}}function hH(...t){return N.useCallback(dH(...t),t)}class pH 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=xp(i)&&i.offsetWidth||0,l=xp(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=l-c.height-c.top}return null}componentDidUpdate(){}render(){return this.props.children}}function mH({children:t,isPresent:e,anchorX:n,anchorY:i,root:s,pop:l}){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(Lp),p=t.props?.ref??t?.ref,m=hH(u,p);return N.useInsertionEffect(()=>{const{width:y,height:b,top:x,left:w,right:S,bottom:E}=d.current;if(e||l===!1||!u.current||!y||!b)return;const O=n==="left"?`left: ${w}`:`right: ${S}`,C=i==="bottom"?`bottom: ${E}`:`top: ${x}`;u.current.dataset.motionPopId=c;const _=document.createElement("style");h&&(_.nonce=h);const R=s??document.head;return R.appendChild(_),_.sheet&&_.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
|
-
${
|
|
73
|
+
${k}px !important;
|
|
74
74
|
${C}px !important;
|
|
75
75
|
}
|
|
76
|
-
`),()=>{R.contains(_)&&R.removeChild(_)}},[e]),M.jsx(pH,{isPresent:e,childRef:u,sizeRef:d,pop:l,children:l===!1?t:N.cloneElement(t,{ref:m})})}const gH=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:s,presenceAffectsLayout:l,mode:c,anchorX:u,anchorY:d,root:h})=>{const p=kh(yH),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 l&&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(mH,{pop:c==="popLayout",isPresent:n,anchorX:u,anchorY:d,root:h,children:t}),M.jsx(Bc.Provider,{value:b,children:t})};function yH(){return new Map}function _E(t=!0){const e=N.useContext(Bc);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:s}=e,l=N.useId();N.useEffect(()=>{if(t)return s(l)},[t]);const c=N.useCallback(()=>t&&i&&i(l),[l,i,t]);return!n&&i?[!1,c]:[!0]}const iu=t=>t.key||"";function CE(t){const e=[];return N.Children.forEach(t,n=>{N.isValidElement(n)&&e.push(n)}),e}const TE=({children:t,custom:e,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:l="sync",propagate:c=!1,anchorX:u="left",anchorY:d="top",root:h})=>{const[p,m]=_E(c),y=N.useMemo(()=>CE(t),[t]),b=c&&!p?[]:y.map(iu),x=N.useRef(!0),w=N.useRef(y),S=kh(()=>new Map),E=N.useRef(new Set),[O,C]=N.useState(y),[_,R]=N.useState(y);Kw(()=>{x.current=!1,w.current=y;for(let D=0;D<_.length;D++){const H=iu(_[D]);b.includes(H)?(S.delete(H),E.current.delete(H)):S.get(H)!==!0&&S.set(H,!1)}},[_,b.length,b.join("-")]);const A=[];if(y!==O){let D=[...y];for(let H=0;H<_.length;H++){const Y=_[H],$=iu(Y);b.includes($)||(D.splice(H,0,Y),A.push(Y))}return l==="wait"&&A.length&&(D=A),R(CE(D)),C(y),null}const{forceRender:k}=N.useContext(Rh);return M.jsx(M.Fragment,{children:_.map(D=>{const H=iu(D),Y=c&&!p?!1:y===_||b.includes(H),$=()=>{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&&(k?.(),R(w.current),c&&m?.(),i&&i())};return M.jsx(gH,{isPresent:Y,initial:!x.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:l,root:h,onExitComplete:Y?void 0:$,anchorX:u,anchorY:d,children:D},H)})})},NE=N.createContext({strict:!1}),AE={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 ME=!1;function vH(){if(ME)return;const t={};for(const e in AE)t[e]={isEnabled:n=>AE[e].some(i=>!!n[i])};SS(t),ME=!0}function RE(){return vH(),iP()}function bH(t){const e=RE();for(const n in t)e[n]={...e[n],...t[n]};SS(e)}const xH=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 ru(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||xH.has(t)}let kE=t=>!ru(t);function wH(t){typeof t=="function"&&(kE=e=>e.startsWith("on")?!ru(e):t(e))}try{wH(require("@emotion/is-prop-valid").default)}catch{}function SH(t,e,n){const i={};for(const s in t)s==="values"&&typeof t.values=="object"||(kE(s)||n===!0&&ru(s)||!e&&!ru(s)||t.draggable&&s.startsWith("onDrag"))&&(i[s]=t[s]);return i}const su=N.createContext({});function EH(t,e){if(Wc(t)){const{initial:n,animate:i}=t;return{initial:n===!1||Ta(n)?n:void 0,animate:Ta(i)?i:void 0}}return t.inherit!==!1?e:{}}function _H(t){const{initial:e,animate:n}=EH(t,N.useContext(su));return N.useMemo(()=>({initial:e,animate:n}),[OE(e),OE(n)])}function OE(t){return Array.isArray(t)?t.join(" "):t}const Ip=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function DE(t,e,n){for(const i in e)!He(e[i])&&!zS(i,n)&&(t[i]=e[i])}function CH({transformTemplate:t},e){return N.useMemo(()=>{const n=Ip();return kp(n,e,t),Object.assign({},n.vars,n.style)},[e])}function TH(t,e){const n=t.style||{},i={};return DE(i,n,t),Object.assign(i,CH(t,e)),i}function NH(t,e){const n={},i=TH(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 jE=()=>({...Ip(),attrs:{}});function AH(t,e,n,i){const s=N.useMemo(()=>{const l=jE();return VS(l,e,IS(i),t.transformTemplate,t.style),{...l.attrs,style:{...l.style}}},[e]);if(t.style){const l={};DE(l,t.style,t),s.style={...l,...s.style}}return s}const MH=["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 Bp(t){return typeof t!="string"||t.includes("-")?!1:!!(MH.indexOf(t)>-1||/[A-Z]/u.test(t))}function RH(t,e,n,{latestValues:i},s,l=!1,c){const d=(c??Bp(t)?AH:NH)(e,i,s,t),h=SH(e,typeof t=="string",l),p=t!==N.Fragment?{...h,...d,ref:n}:{},{children:m}=e,y=N.useMemo(()=>He(m)?m.get():m,[m]);return N.createElement(t,{...p,children:y})}function kH({scrapeMotionValuesFromProps:t,createRenderState:e},n,i,s){return{latestValues:OH(n,i,s,t),renderState:e()}}function OH(t,e,n,i){const s={},l=i(t,{});for(const y in l)s[y]=nu(l[y]);let{initial:c,animate:u}=t;const d=Wc(t),h=bS(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"&&!Qc(m)){const y=Array.isArray(m)?m:[m];for(let b=0;b<y.length;b++){const x=dp(t,y[b]);if(x){const{transitionEnd:w,transition:S,...E}=x;for(const O in E){let C=E[O];if(Array.isArray(C)){const _=p?C.length-1:0;C=C[_]}C!==null&&(s[O]=C)}for(const O in w)s[O]=w[O]}}}return s}const zE=t=>(e,n)=>{const i=N.useContext(su),s=N.useContext(Bc),l=()=>kH(t,e,i,s);return n?l():kh(l)},DH=zE({scrapeMotionValuesFromProps:Dp,createRenderState:Ip}),jH=zE({scrapeMotionValuesFromProps:BS,createRenderState:jE}),zH=Symbol.for("motionComponentSymbol");function VH(t,e,n){const i=N.useRef(n);N.useInsertionEffect(()=>{i.current=n});const s=N.useRef(null);return N.useCallback(l=>{l&&t.onMount?.(l),e&&(l?e.mount(l):e.unmount());const c=i.current;if(typeof c=="function")if(l){const u=c(l);typeof u=="function"&&(s.current=u)}else s.current?(s.current(),s.current=null):c(l);else c&&(c.current=l)},[e])}const VE=N.createContext({});function Zr(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function LH(t,e,n,i,s,l){const{visualElement:c}=N.useContext(su),u=N.useContext(NE),d=N.useContext(Bc),h=N.useContext(Lp),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:l}),b.current&&y.current&&(y.current.manuallyAnimateOnMount=!0));const x=y.current,w=N.useContext(VE);x&&!x.projection&&s&&(x.type==="html"||x.type==="svg")&&IH(y.current,n,s,w);const S=N.useRef(!1);N.useInsertionEffect(()=>{x&&S.current&&x.update(n,d)});const E=n[W1],O=N.useRef(!!E&&!window.MotionHandoffIsComplete?.(E)&&window.MotionHasOptimisedAnimation?.(E));return Kw(()=>{b.current=!0,x&&(S.current=!0,window.MotionIsMounted=!0,x.updateFeatures(),x.scheduleRenderMicrotask(),O.current&&x.animationState&&x.animationState.animateChanges())}),N.useEffect(()=>{x&&(!O.current&&x.animationState&&x.animationState.animateChanges(),O.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(E)}),O.current=!1),x.enteringChildren=void 0)}),x}function IH(t,e,n,i){const{layoutId:s,layout:l,drag:c,dragConstraints:u,layoutScroll:d,layoutRoot:h,layoutCrossfade:p}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:LE(t.parent)),t.projection.setOptions({layoutId:s,layout:l,alwaysMeasureLayout:!!c||u&&Zr(u),visualElement:t,animationType:typeof l=="string"?l:"both",initialPromotionConfig:i,crossfade:p,layoutScroll:d,layoutRoot:h})}function LE(t){if(t)return t.options.allowProjection!==!1?t.projection:LE(t.parent)}function Pp(t,{forwardMotionProps:e=!1,type:n}={},i,s){i&&bH(i);const l=n?n==="svg":Bp(t),c=l?jH:DH;function u(h,p){let m;const y={...N.useContext(Lp),...h,layoutId:BH(h)},{isStatic:b}=y,x=_H(h),w=c(h,b);if(!b&&Zw){PH();const S=HH(y);m=S.MeasureLayout,x.visualElement=LH(t,w,y,s,S.ProjectionNode,l)}return M.jsxs(su.Provider,{value:x,children:[m&&x.visualElement?M.jsx(m,{visualElement:x.visualElement,...y}):null,RH(t,h,VH(w,x.visualElement,p),w,b,e,l)]})}u.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const d=N.forwardRef(u);return d[zH]=t,d}function BH({layoutId:t}){const e=N.useContext(Rh).id;return e&&t!==void 0?e+"-"+t:t}function PH(t,e){N.useContext(NE).strict}function HH(t){const e=RE(),{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 UH(t,e){if(typeof Proxy>"u")return Pp;const n=new Map,i=(l,c)=>Pp(l,c,t,e),s=(l,c)=>i(l,c);return new Proxy(s,{get:(l,c)=>c==="create"?i:(n.has(c)||n.set(c,Pp(c,void 0,t,e)),n.get(c))})}const $H=(t,e)=>e.isSVG??Bp(t)?new wP(e):new mP(e,{allowProjection:t!==N.Fragment});class YH extends Wo{constructor(e){super(e),e.animationState||(e.animationState=TP(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();Qc(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 GH=0;class qH extends Wo{constructor(){super(...arguments),this.id=GH++}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 XH={animation:{Feature:YH},exit:{Feature:qH}};function Ra(t){return{point:{x:t.pageX,y:t.pageY}}}const FH=t=>e=>Sp(e)&&t(e,Ra(e));function ka(t,e,n,i){return Ma(t,e,FH(n),i)}const IE=({current:t})=>t?t.ownerDocument.defaultView:null,BE=(t,e)=>Math.abs(t-e);function ZH(t,e){const n=BE(t.x,e.x),i=BE(t.y,e.y);return Math.sqrt(n**2+i**2)}const PE=new Set(["auto","scroll"]);class HE{constructor(e,n,{transformPagePoint:i,contextWindow:s=window,dragSnapToOrigin:l=!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=Up(this.lastMoveEventInfo,this.history),x=this.startEvent!==null,w=ZH(b.offset,{x:0,y:0})>=this.distanceThreshold;if(!x&&!w)return;const{point:S}=b,{timestamp:E}=ze;this.history.push({...S,timestamp:E});const{onStart:O,onMove:C}=this.handlers;x||(O&&O(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),C&&C(this.lastMoveEvent,b)},this.handlePointerMove=(b,x)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=Hp(x,this.transformPagePoint),ie.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 O=Up(b.type==="pointercancel"?this.lastMoveEventInfo:Hp(x,this.transformPagePoint),this.history);this.startEvent&&w&&w(b,O),S&&S(b,O)},!Sp(e))return;this.dragSnapToOrigin=l,this.handlers=n,this.transformPagePoint=i,this.distanceThreshold=c,this.contextWindow=s||window;const d=Ra(e),h=Hp(d,this.transformPagePoint),{point:p}=h,{timestamp:m}=ze;this.history=[{...p,timestamp:m}];const{onSessionStart:y}=n;y&&y(e,Up(h,this.history)),this.removeListeners=ya(ka(this.contextWindow,"pointermove",this.handlePointerMove),ka(this.contextWindow,"pointerup",this.handlePointerUp),ka(this.contextWindow,"pointercancel",this.handlePointerUp)),u&&this.startScrollTracking(u)}startScrollTracking(e){let n=e.parentElement;for(;n;){const i=getComputedStyle(n);(PE.has(i.overflowX)||PE.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},l={x:s.x-n.x,y:s.y-n.y};l.x===0&&l.y===0||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=l.x,this.lastMoveEventInfo.point.y+=l.y):this.history.length>0&&(this.history[0].x-=l.x,this.history[0].y-=l.y),this.scrollPositions.set(e,s),ie.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Zo(this.updatePoint)}}function Hp(t,e){return e?{point:e(t.point)}:t}function UE(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Up({point:t},e){return{point:t,delta:UE(t,$E(e)),offset:UE(t,KH(e)),velocity:QH(e,.1)}}function KH(t){return t[0]}function $E(t){return t[t.length-1]}function QH(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const s=$E(t);for(;n>=0&&(i=t[n],!(s.timestamp-i.timestamp>jn(e)));)n--;if(!i)return{x:0,y:0};i===t[0]&&t.length>2&&s.timestamp-i.timestamp>jn(e)*2&&(i=t[1]);const l=gn(s.timestamp-i.timestamp);if(l===0)return{x:0,y:0};const c={x:(s.x-i.x)/l,y:(s.y-i.y)/l};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function WH(t,{min:e,max:n},i){return e!==void 0&&t<e?t=i?fe(e,t,i.min):Math.max(t,e):n!==void 0&&t>n&&(t=i?fe(n,t,i.max):Math.min(t,n)),t}function YE(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 JH(t,{top:e,left:n,bottom:i,right:s}){return{x:YE(t.x,n,s),y:YE(t.y,e,i)}}function GE(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 tU(t,e){return{x:GE(t.x,e.x),y:GE(t.y,e.y)}}function eU(t,e){let n=.5;const i=Ye(t),s=Ye(e);return s>i?n=va(e.min,e.max-i,t.min):i>s&&(n=va(t.min,t.max-s,e.min)),Jn(0,1,n)}function nU(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 $p=.35;function oU(t=$p){return t===!1?t=0:t===!0&&(t=$p),{x:qE(t,"left","right"),y:qE(t,"top","bottom")}}function qE(t,e,n){return{min:XE(t,e),max:XE(t,n)}}function XE(t,e){return typeof t=="number"?t:t[e]||0}const iU=new WeakMap;class rU{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=Ne(),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 l=m=>{n&&this.snapToCursor(Ra(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=jB(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),eo(E=>{let O=this.getAxisMotionValue(E).get()||0;if(to.test(O)){const{projection:C}=this.visualElement;if(C&&C.layout){const _=C.layout.layoutBox[E];_&&(O=Ye(_)*(parseFloat(O)/100))}}this.originPoint[E]=O}),w&&ie.update(()=>w(m,y),!1,!0),pp(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=aU(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&&ie.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 HE(e,{onSessionStart:l,onStart:c,onMove:u,onSessionEnd:d,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:i,contextWindow:IE(this.visualElement),element:this.visualElement.current})}stop(e,n){const i=e||this.latestPointerEvent,s=n||this.latestPanInfo,l=this.isDragging;if(this.cancel(),!l||!s||!i)return;const{velocity:c}=s;this.startAnimation(c);const{onDragEnd:u}=this.getProps();u&&ie.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||!au(e,s,this.currentDirection))return;const l=this.getAxisMotionValue(e);let c=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(c=WH(c,this.constraints[e],this.elastic[e])),l.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&&Zr(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&i?this.constraints=JH(i.layoutBox,e):this.constraints=!1,this.elastic=oU(n),s!==this.constraints&&!Zr(e)&&i&&this.constraints&&!this.hasMutatedConstraints&&eo(l=>{this.constraints!==!1&&this.getAxisMotionValue(l)&&(this.constraints[l]=nU(i.layoutBox[l],this.constraints[l]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!Zr(e))return!1;const i=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const l=cP(i,s.root,this.visualElement.getTransformPagePoint());let c=tU(s.layout.layoutBox,l);if(n){const u=n(sP(c));this.hasMutatedConstraints=!!u,u&&(c=_S(u))}return c}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:s,dragTransition:l,dragSnapToOrigin:c,onDragTransitionEnd:u}=this.getProps(),d=this.constraints||{},h=eo(p=>{if(!au(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,...l,...m};return this.startAxisValueAnimation(p,x)});return Promise.all(h).then(u)}startAxisValueAnimation(e,n){const i=this.getAxisMotionValue(e);return pp(this.visualElement,e),i.start(fp(e,i,0,n,this.visualElement,!1))}stopAnimation(){eo(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){eo(n=>{const{drag:i}=this.getProps();if(!au(n,i,this.currentDirection))return;const{projection:s}=this.visualElement,l=this.getAxisMotionValue(n);if(s&&s.layout){const{min:c,max:u}=s.layout.layoutBox[n],d=l.get()||0;l.set(e[n]-fe(c,u,.5)+d)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!Zr(n)||!i||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};eo(c=>{const u=this.getAxisMotionValue(c);if(u&&this.constraints!==!1){const d=u.get();s[c]=eU({min:d,max:d},this.constraints[c])}});const{transformTemplate:l}=this.visualElement.getProps();this.visualElement.current.style.transform=l?l({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.constraints=!1,this.resolveConstraints(),eo(c=>{if(!au(c,e,null))return;const u=this.getAxisMotionValue(c),{min:d,max:h}=this.constraints[c];u.set(fe(d,h,s[c]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;iU.set(this.visualElement,this);const e=this.visualElement.current,n=ka(e,"pointerdown",h=>{const{drag:p,dragListener:m=!0}=this.getProps(),y=h.target,b=y!==e&&PB(y);p&&m&&!b&&this.start(h)});let i;const s=()=>{const{dragConstraints:h}=this.getProps();Zr(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),i||(i=sU(e,h.current,()=>this.scalePositionWithinConstraints())))},{projection:l}=this.visualElement,c=l.addEventListener("measure",s);l&&!l.layout&&(l.root&&l.root.updateScroll(),l.updateLayout()),ie.read(s);const u=Ma(window,"resize",()=>this.scalePositionWithinConstraints()),d=l.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(eo(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:l=!1,dragElastic:c=$p,dragMomentum:u=!0}=e;return{...e,drag:n,dragDirectionLock:i,dragPropagation:s,dragConstraints:l,dragElastic:c,dragMomentum:u}}}function FE(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function sU(t,e,n){const i=gS(t,FE(n)),s=gS(e,FE(n));return()=>{i(),s()}}function au(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function aU(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class lU extends Wo{constructor(e){super(e),this.removeGroupControls=mn,this.removeListeners=mn,this.controls=new rU(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||mn}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 Yp=t=>(e,n)=>{t&&ie.update(()=>t(e,n),!1,!0)};class cU extends Wo{constructor(){super(...arguments),this.removePointerDownListener=mn}onPointerDown(e){this.session=new HE(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:IE(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:s}=this.node.getProps();return{onSessionStart:Yp(e),onStart:Yp(n),onMove:Yp(i),onEnd:(l,c)=>{delete this.session,s&&ie.postRender(()=>s(l,c))}}}mount(){this.removePointerDownListener=ka(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 Gp=!1;class uU extends N.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:s}=this.props,{projection:l}=e;l&&(n.group&&n.group.add(l),i&&i.register&&s&&i.register(l),Gp&&l.root.didUpdate(),l.addEventListener("animationComplete",()=>{this.safeToRemove()}),l.setOptions({...l.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),ou.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:i,drag:s,isPresent:l}=this.props,{projection:c}=i;return c&&(c.isPresent=l,e.layoutDependency!==n&&c.setOptions({...c.options,layoutDependency:n}),Gp=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==l?c.willUpdate():this.safeToRemove(),e.isPresent!==l&&(l?c.promote():c.relegate()||ie.postRender(()=>{const u=c.getStack();(!u||!u.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),wp.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:s}=e;Gp=!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 ZE(t){const[e,n]=_E(),i=N.useContext(Rh);return M.jsx(uU,{...t,layoutGroup:i,switchLayoutGroup:N.useContext(VE),isPresent:e,safeToRemove:n})}const fU={pan:{Feature:cU},drag:{Feature:lU,ProjectionNode:SE,MeasureLayout:ZE}};function KE(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,l=i[s];l&&ie.postRender(()=>l(e,Ra(e)))}class dU extends Wo{mount(){const{current:e}=this.node;e&&(this.unmount=VB(e,(n,i)=>(KE(this.node,i,"Start"),s=>KE(this.node,s,"End"))))}unmount(){}}class hU extends Wo{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=ya(Ma(this.node.current,"focus",()=>this.onFocus()),Ma(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function QE(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),l=i[s];l&&ie.postRender(()=>l(e,Ra(e)))}class pU extends Wo{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:i}=this.node.props;this.unmount=UB(e,(s,l)=>(QE(this.node,l,"Start"),(c,{success:u})=>QE(this.node,c,u?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:i?.tap===!1})}unmount(){}}const qp=new WeakMap,Xp=new WeakMap,mU=t=>{const e=qp.get(t.target);e&&e(t)},gU=t=>{t.forEach(mU)};function yU({root:t,...e}){const n=t||document;Xp.has(n)||Xp.set(n,{});const i=Xp.get(n),s=JSON.stringify(e);return i[s]||(i[s]=new IntersectionObserver(gU,{root:t,...e})),i[s]}function vU(t,e,n){const i=yU(e);return qp.set(t,n),i.observe(t),()=>{qp.delete(t),i.unobserve(t)}}const bU={some:0,all:1};class xU extends Wo{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:l}=e,c={root:n?n.current:void 0,rootMargin:i,threshold:typeof s=="number"?s:bU[s]},u=d=>{const{isIntersecting:h}=d;if(this.isInView===h||(this.isInView=h,l&&!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 vU(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(wU(e,n))&&this.startObserver()}unmount(){}}function wU({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const SU={...XH,...{inView:{Feature:xU},tap:{Feature:pU},focus:{Feature:hU},hover:{Feature:dU}},...fU,...{layout:{ProjectionNode:SE,MeasureLayout:ZE}}},lu=UH(SU,$H),WE="__boundary_in_",JE="__boundary_out_";function EU(t){const e=[],n=[];for(const i of t.inputs){const s=`${WE}${i.name}`,l=i.portType.kind==="bus";e.push({id:s,label:i.name,componentRef:l?"Input":"Switch",arguments:l?{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=`${JE}${i.name}`,l=i.portType.kind==="bus";e.push({id:s,label:i.name,componentRef:l?"HexDisplay":"Led",arguments:{},inputs:[{id:`${s}_in`,name:"in",portType:i.portType}],outputs:[],clocks:[]})}for(const i of t.connections){const s={...i.source},l={...i.target};i.source.nodeId===""&&(s.nodeId=`${WE}${i.source.portName}`,s.portName="out"),i.target.nodeId===""&&(l.nodeId=`${JE}${i.target.portName}`,l.portName="in"),n.push({...i,source:s,target:l})}return{...t,name:`__drilldown_${t.name}`,nodes:[...e,...t.nodes],connections:n,implementation:{kind:"primitive"}}}const ke="__top__";function _U(t,e,n=!1,i){const s=[],l=[],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 O=new Set(b);O.add(x.componentRef),u(S,w+".",E,O)}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===""?ke:m.slice(0,-1):m+x.source.nodeId,S=x.target.nodeId===""?m===""?ke:m.slice(0,-1):m+x.target.nodeId;l.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)l.push({id:`${ke}.${m.name}->${p}.${m.name}`,source:{nodeId:ke,portName:m.name},target:{nodeId:p,portName:m.name},portType:m.portType});for(const m of t.outputs)l.push({id:`${p}.${m.name}->${ke}.${m.name}`,source:{nodeId:p,portName:m.name},target:{nodeId:ke,portName:m.name},portType:m.portType})}else u(t,"",c,new Set([t.name]));const d=CU(t,l,s,e,"",n),h={nodes:s,connections:d,hierarchy:c,topLevelInputs:t.inputs,topLevelOutputs:t.outputs,nodeMap:new Map};return NU(h),h}function CU(t,e,n,i,s,l=!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),l&&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),l&&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 O of S){const C={id:`${E.source.nodeId}.${E.source.portName}->${O.target.nodeId}.${O.target.portName}`,source:E.source,target:O.target,portType:b.portType};m.push(C),y.add(E.id),y.add(O.id),l&&console.log(` DIRECT: ${C.source.nodeId}.${C.source.portName} -> ${C.target.nodeId}.${C.target.portName}`)}}else y.has(b.id)||m.push(b);return t_(m,n,u,l)}return t_(h,n,u,l)}function t_(t,e,n,i){const s=new Set(e.map(p=>p.id)),l=p=>p.nodeId===ke||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),l(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(!l(p.source))continue;const m=l(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 TU(t,e,n,i,s=!1){for(const l of t.connections){if(l.source.nodeId===""&&l.target.nodeId!==""){const c=`${e}.${l.source.portName}`,u=cu(e,l.target,t,i);n.has(c)||n.set(c,[]);for(const d of u)n.get(c).push(d),s&&console.log(` INPUT: ${l.source.portName} -> ${d.nodeId}.${d.portName}`)}if(l.source.nodeId!==""&&l.target.nodeId===""){const c=`${e}.${l.target.portName}`,u=cu(e,l.source,t,i);n.has(c)||n.set(c,[]);for(const d of u)n.get(c).push(d),s&&console.log(` OUTPUT: ${l.target.portName} <- ${d.nodeId}.${d.portName}`)}if(l.source.nodeId===""&&l.target.nodeId===""){s&&console.log(` PASSTHROUGH: ${l.source.portName} -> ${l.target.portName}`);const c=`${e}.${l.source.portName}`;n.has(c)||n.set(c,[]),n.get(c).push({nodeId:e,portName:l.target.portName}),s&&console.log(` -> Added passthrough forwarding: ${c} -> ${e}.${l.target.portName}`)}}}function cu(t,e,n,i,s=new Set){if(e.nodeId==="")return[{nodeId:t,portName:e.portName}];const l=t+"."+e.nodeId,c=n.nodes.find(p=>p.id===e.nodeId);if(!c)return[{nodeId:l,portName:e.portName}];const u=i.resolveCircuit(c.componentRef);if(!u||u.implementation.kind!=="composite")return[{nodeId:l,portName:e.portName}];if(s.has(c.componentRef))return[{nodeId:l,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=cu(l,p.source,u,i,d);h.push(...m)}if(p.source.nodeId===""&&p.source.portName===e.portName){const m=cu(l,p.target,u,i,d);h.push(...m)}}return h.length>0?h:[{nodeId:l,portName:e.portName}]}function NU(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===ke)continue;const s=t.nodeMap.get(n);s&&!s.dependents.includes(i)&&s.dependents.push(i);const l=t.nodeMap.get(i);l&&l.inputSources.push({portName:e.target.portName,sourceNodeId:n,sourcePortName:e.source.portName})}}function AU(t,e){return`${t}.${e}`}function e_(t,e,n){const i=new Map,s=new Map,l=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=>MU(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)l.set(AU(c.id,d.name),{value:!1,edge:"none"})}}return{currentState:i,nextState:s,clocks:l,cycleCount:0}}function MU(t,e,n,i,s){const l=t.stateType.kind,c=n[t.name];if(l==="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=kU(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 RU(t){const n=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(n,"i")}function kU(t,e,n){for(const[i,s]of e){const l=RU(i);if(l.test(t)||n&&l.test(n))return s}}const Fp={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},OU=Object.entries(Fp).reduce((t,[e,n])=>(t[n]=e,t),[]);class DU{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 n_(t){return{values:new Int32Array(t),changed:new Uint8Array(t),initialized:new Uint8Array(t)}}function o_(t,e){const n=t.circuit.inputSourcePort[t.portStart+e];return n>=0?t.values.values[n]:0}function i_(t,e,n){const i=t.portStart+t.inputCount+e;t.values.values[i]=n,t.values.initialized[i]=1}const jU=Math.max(...Object.values(Fp))+1,Oa=new Array(jU).fill(null);function r_(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 zU=200;const s_=new Map;function VU(t){const e=Fp[t];if(e!==void 0)return e;const n=s_.get(t);if(n!==void 0)return n;const i=zU++;return s_.set(t,i),OU[i]=t,i}function LU(t,e,n,i){const s=t.length,l=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]]=o_(u,m);const p=n(d);for(let m=0;m<l;m++){const y=p[e[m]];y!==void 0&&i_(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]]=o_(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?r_(x):x}}else m!=null&&(d[i[0]]=m instanceof Map?r_(m):m)}const p=n(d);for(let m=0;m<l;m++){const y=p[e[m]];y!==void 0&&i_(u,m,y)}}}function IU(t){const e=VU(t);if(Oa[e]!=null)return e;const n=Dl(t);if(!n)return console.warn(`[eval-bridge] No eval-registry entry for '${t}' — getAllCircuitEvals:`,[...kN().keys()]),e;for(;Oa.length<=e;)Oa.push(null);return Oa[e]=LU(n.inputNames,n.outputNames,n.evalFn,n.stateKeys),e}const Zp=new Map;function BU(t){if(Zp.has(t))return Zp.get(t);const e=Dl(t);if(!e?.onTickFn)return;const n={inputNames:e.inputNames,stateKeys:e.stateKeys??[],fn:e.onTickFn};return Zp.set(t,n),n}function PU(t,e){const n=t.nodes.length,i=new Map,s=new Array(n);for(let Y=0;Y<n;Y++){const $=t.nodes[Y];i.set($.id,Y),s[Y]=$.id}let l=0;const c=new Uint32Array(n),u=new Uint8Array(n),d=new Uint8Array(n);for(let Y=0;Y<n;Y++){const $=t.nodes[Y];c[Y]=l,u[Y]=$.inputs.length,d[Y]=$.outputs.length,l+=$.inputs.length+$.outputs.length}const h=t.topLevelInputs.length,p=t.topLevelOutputs.length,m=l+h+p,y=new Map,b=new Array(m),x=new Uint8Array(m),w=new Uint8Array(m),S=new Array(m);let E=l;for(const Y of t.topLevelInputs){const $=`${ke}.${Y.name}`;y.set($,E),b[E]=$,x[E]=1,w[E]=Y.portType.kind==="bus"?1:0,E++}for(const Y of t.topLevelOutputs){const $=`${ke}.${Y.name}`;y.set($,E),b[E]=$,x[E]=0,w[E]=Y.portType.kind==="bus"?1:0,E++}for(let Y=0;Y<n;Y++){const $=t.nodes[Y];let F=c[Y];for(const Q of $.inputs){const B=`${$.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 $.outputs){const B=`${$.id}.${Q.name}`;y.set(B,F),b[F]=B,x[F]=1;let P=Q.portType.kind==="bus";if(!P){const j=$.arguments.width;if(typeof j=="number"&&j>1&&(P=!0),!P&&$.primitiveType==="Mux"){for(const I of $.inputs)if(I.name!=="sel"&&I.portType.kind==="bus"){P=!0;break}}}w[F]=P?1:0,F++}}const O=new Uint16Array(n);for(let Y=0;Y<n;Y++){const $=t.nodes[Y];O[Y]=IU($.primitiveType)}const C=new Array(n);for(let Y=0;Y<n;Y++){const F=t.nodes[Y].dependents.map(Q=>i.get(Q)).filter(Q=>Q!==void 0);C[Y]=new Uint32Array(F)}const _=new Int32Array(l),R=new Int32Array(l);_.fill(-1),R.fill(-1);for(let Y=0;Y<n;Y++){const $=t.nodes[Y],F=c[Y];for(let Q=0;Q<$.inputSources.length;Q++){const B=$.inputSources[Q],P=$.inputs.findIndex(I=>I.name===B.portName);if(P===-1)continue;const j=F+P;if(B.sourceNodeId===ke){_[j]=-1;const I=`${ke}.${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(G=>G.name===B.sourcePortName);if(U===-1)continue;_[j]=I,R[j]=c[I]+z.inputs.length+U}}}const A=new Uint8Array(n),k=new Uint8Array(n),D=new Uint8Array(n),H=new Uint8Array(n);for(let Y=0;Y<n;Y++){const $=t.nodes[Y];A[Y]=$.inputs.length===0?1:0;const F=e.resolveCircuit($.primitiveType);F?.state&&F.state.length>0&&(D[Y]=1,k[Y]=1);for(const Q of $.inputSources)if(Q.sourceNodeId===ke){H[Y]=1;break}}return{nodeCount:n,portCount:m,nodeIdToIndex:i,indexToNodeId:s,portKeyToIndex:y,indexToPortKey:b,primitiveTypeIndex:O,nodePortStart:c,nodeInputCount:u,nodeOutputCount:d,dependents:C,inputSourceNode:_,inputSourcePort:R,inputPortNames:S,portIsOutput:x,portIsBus:w,isSourceNode:A,isStateOutputNode:k,hasState:D,readsTopLevelInput:H,flatCircuit:t}}function Kp(t,e){const n=new Array(t.nodeCount),i=new Array(t.nodeCount);for(const[s,l]of e.currentState){const c=t.nodeIdToIndex.get(s);c!==void 0&&(n[c]=l)}for(const[s,l]of e.nextState){const c=t.nodeIdToIndex.get(s);c!==void 0&&(i[c]=l)}return{currentState:n,nextState:i,clocks:e.clocks,cycleCount:e.cycleCount}}function Qp(t,e){const n=new Map,i=new Map;for(let s=0;s<t.nodeCount;s++){const l=t.indexToNodeId[s];e.currentState[s]!==void 0&&n.set(l,e.currentState[s]),e.nextState[s]!==void 0&&i.set(l,e.nextState[s])}return{currentState:n,nextState:i,clocks:e.clocks,cycleCount:e.cycleCount}}const a_=1e4,Wp=new WeakMap;function HU(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 l=i[s];return typeof l=="function"?l.bind(i):l},set(i,s,l){return typeof s=="string"&&/^\d+$/.test(s)?(i.set(Number(s),l),!0):!1}});return Wp.set(n,e),n}const UU=new Int32Array(64),$U=new Uint8Array(64);function Da(t,e,n,i,s){let l=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(++l>a_)throw new Error(`Propagation did not stabilize after ${a_} 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?UU:new Int32Array(p),b=p<=64?$U: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=Oa[x];w?w(c):YU(t,u);let S=!1;for(let E=0;E<p;E++){const O=m+E;if(n.values[O]!==y[E]||n.initialized[O]&&!b[E]){S=!0;break}}S&&e.enqueueAll(t.dependents[u])}return l}function YU(t,e,n,i,s){const l=t.flatCircuit.nodes[e];throw new Error(`Primitive '${l.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 uu(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 GU(t,e){for(let n=0;n<t.nodeCount;n++)t.isStateOutputNode[n]&&e.enqueue(n)}function qU(t,e){for(const[n,i]of e.clocks)i.edge="rising",i.value=!0}function XU(t,e,n,i){for(let s=0;s<t.nodeCount;s++){if(!t.hasState[s])continue;const l=t.flatCircuit.nodes[s],c=BU(l.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],O=t.inputSourcePort[S],C=t.inputPortNames[S];if(E===-1){if(i&&O>=0){const _=t.indexToPortKey[O],R=i.get(_);R!==void 0&&u.set(C,R)}}else if(O>=0){const _=e.values[O];u.set(C,_)}}if(l.arguments)for(const[w,S]of Object.entries(l.arguments))u.set(`__${w}`,S);const p={};for(const w of l.clocks){const S=`${l.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]]=HU(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"&&Wp.has(x)&&(x=Wp.get(x)),n.nextState[s]=x}}function FU(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 ja(t,e,n){const i=new Map;if(n)for(const[s,l]of n)i.set(s,l);for(let s=0;s<t.portCount;s++){const l=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(l,u&&!p?d!==0:d)}return i}function ZU(t,e,n){for(const[i,s]of n){const l=t.portKeyToIndex.get(i);l!==void 0&&(e.values[l]=typeof s=="boolean"?s?1:0:s,e.initialized[l]=1)}}function fu(t,e,n){for(const i of t.flatCircuit.connections)if(i.target.nodeId===ke||i.target.nodeId===""){const s=`${i.source.nodeId}.${i.source.portName}`,l=t.portKeyToIndex.get(s);if(l!==void 0){const c=`${i.target.nodeId||ke}.${i.target.portName}`,u=t.portIsBus[l]===0,d=e.values[l];n.set(c,u?d!==0:d)}}}class KU{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=PU(e,n.componentLibrary);const i=e_(e,n.componentLibrary);this.numericSeqState=Kp(this.numericCircuit,i),this.numericValues=n_(this.numericCircuit.portCount),this.eventQueue=new DU(this.numericCircuit.nodeCount),this.topLevelInputs=new Map;for(const s of e.topLevelInputs){const l=`${ke}.${s.name}`,c=s.portType.kind==="bit"?!1:0;this.topLevelInputs.set(l,c)}this.eventQueue.clear(),uu(this.numericCircuit,this.eventQueue),Da(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=`${ke}.${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 l=this.numericCircuit.nodeIdToIndex.get(s.id);if(l!==void 0&&this.numericSeqState&&this.numericSeqState.currentState[l]!==void 0){this.numericSeqState.currentState[l]=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(),uu(this.numericCircuit,this.eventQueue);const e=Da(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState,this.topLevelInputs);qU(this.numericCircuit,this.numericSeqState),XU(this.numericCircuit,this.numericValues,this.numericSeqState,this.topLevelInputs),FU(this.numericSeqState),this.eventQueue.clear(),GU(this.numericCircuit,this.eventQueue);const n=Da(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState,this.topLevelInputs),i=ja(this.numericCircuit,this.numericValues,this.topLevelInputs);fu(this.numericCircuit,this.numericValues,i),this.cachedPortValues=i,this.cachedFlatSeqState=null,this.cacheValid=!0;const s=e+n;this.totalTicks++,this.totalEvaluations+=s;const l=Qp(this.numericCircuit,this.numericSeqState);return{portValues:i,sequentialState:l,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(),uu(this.numericCircuit,this.eventQueue);try{Da(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState??void 0,this.topLevelInputs)}catch(n){return{portValues:ja(this.numericCircuit,this.numericValues,this.topLevelInputs),metrics:{totalEvals:0},error:n instanceof Error?n.message:"Unknown error"}}const e=ja(this.numericCircuit,this.numericValues,this.topLevelInputs);return fu(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=ja(this.numericCircuit,this.numericValues,this.topLevelInputs),fu(this.numericCircuit,this.numericValues,this.cachedPortValues),this.cacheValid=!0),this.cachedPortValues)}getState(){return!this.numericCircuit||!this.numericSeqState?null:((!this.cacheValid||!this.cachedFlatSeqState)&&(this.cachedFlatSeqState=Qp(this.numericCircuit,this.numericSeqState)),this.cachedFlatSeqState)}snapshot(){if(!this.numericSeqState||!this.numericCircuit||!this.numericValues)throw new Error("No sequential state to snapshot");const e=ja(this.numericCircuit,this.numericValues,this.topLevelInputs);fu(this.numericCircuit,this.numericValues,e);const n=Qp(this.numericCircuit,this.numericSeqState);return{portValues:e,sequentialState:n,cycleCount:this.numericSeqState.cycleCount}}restore(e){!this.numericCircuit||!this.numericValues||(this.numericSeqState=Kp(this.numericCircuit,e.sequentialState),ZU(this.numericCircuit,this.numericValues,e.portValues),this.cacheValid=!1)}reset(){if(!this.flatCircuit||!this.options||!this.numericCircuit)return;const e=e_(this.flatCircuit,this.options.componentLibrary,this.options.initialMemory);this.numericSeqState=Kp(this.numericCircuit,e),this.numericValues=n_(this.numericCircuit.portCount),this.eventQueue.clear(),uu(this.numericCircuit,this.eventQueue),Da(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 QU(t,e){const n=new KU;return n.initialize(t,e),n}function WU(t,e){const n=_U(t,e);return QU(n,{componentLibrary:e})}const JU=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),t$=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,i)=>i?i.toUpperCase():n.toLowerCase()),l_=t=>{const e=t$(t);return e.charAt(0).toUpperCase()+e.slice(1)},c_=(...t)=>t.filter((e,n,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===n).join(" ").trim(),e$=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var n$={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 o$=N.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:s="",children:l,iconNode:c,...u},d)=>N.createElement("svg",{ref:d,...n$,width:e,height:e,stroke:t,strokeWidth:i?Number(n)*24/Number(e):n,className:c_("lucide",s),...!l&&!e$(u)&&{"aria-hidden":"true"},...u},[...c.map(([h,p])=>N.createElement(h,p)),...Array.isArray(l)?l:[l]]));const Jo=(t,e)=>{const n=N.forwardRef(({className:i,...s},l)=>N.createElement(o$,{ref:l,iconNode:e,className:c_(`lucide-${JU(l_(t))}`,`lucide-${t}`,i),...s}));return n.displayName=l_(t),n};const i$=Jo("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const r$=Jo("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const s$=Jo("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);const a$=Jo("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 l$=Jo("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 c$=Jo("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 u$=Jo("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 f$=Jo("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"}]]),u_=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,f_=jb,d$=((t,e)=>n=>{var i;if(e?.variants==null)return f_(t,n?.class,n?.className);const{variants:s,defaultVariants:l}=e,c=Object.keys(s).map(h=>{const p=n?.[h],m=l?.[h];if(p===null)return null;const y=u_(p)||u_(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({...l,...u}[w]):{...l,...u}[w]===S})?[...h,m,y]:h},[]);return f_(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"}}),d_=N.forwardRef(({className:t,variant:e,size:n,...i},s)=>M.jsx("button",{className:kn(d$({variant:e,size:n,className:t})),ref:s,...i}));d_.displayName="Button";function Kr({label:t,icon:e,onClick:n,disabled:i}){return M.jsxs(ew,{children:[M.jsx(nw,{asChild:!0,children:M.jsx(d_,{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(ow,{side:"bottom",children:t})]})}function h_({cycle:t,historyLength:e,historyIndex:n,isRunning:i,isViewingPast:s,onStep:l,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 O=S?"absolute top-3 left-1/2 -translate-x-1/2 z-10":"",C=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(tw,{children:M.jsx("div",{className:O,children:M.jsxs("div",{className:C,children:[M.jsx(Kr,{label:"Tick",icon:f$,onClick:l,disabled:i||s}),i?M.jsx(Kr,{label:"Pause",icon:l$,onClick:u}):M.jsx(Kr,{label:"Run",icon:c$,onClick:c,disabled:s}),M.jsx(Kr,{label:"Reset",icon:u$,onClick:d}),y&&M.jsxs("div",{className:"flex items-center gap-2 border-l border-border pl-2 ml-0.5",children:[M.jsx(s$,{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:_=>y(Number(_.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(Kr,{label:"Step back",icon:i$,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(Kr,{label:"Step forward",icon:r$,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(a$,{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:_=>m(Number(_.target.value)),className:"w-24 h-1 rounded-lg appearance-none cursor-pointer accent-blue-600",disabled:i,"aria-label":"Cycle scrubber"})]})]})})})}function h$({frame:t,componentLibrary:e,onPushLevel:n,theme:i="dark"}){const s=N.useMemo(()=>EU(t.componentDef),[t.componentDef]),l=N.useMemo(()=>ed(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=Xf(),[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([]),[O,C]=N.useState(0),[_,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 k=A.current;N.useEffect(()=>()=>{p&&u.dispose(k).catch(()=>{})},[u,k,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 G=e.resolveCircuit(U.componentRef);G&&(j.add(U.componentRef),P.push(G),G.implementation.kind==="composite"&&I(G))}};I(s),u.compileIR(s,P,k,{snapshot:l}).then(z=>{if("error"in z){try{const G=WU(s,e);G.runCombinational(),y.current=G,m(!1);const L=new Map;for(const[q,tt]of G.getPortValues())L.set(q,tt);h(L)}catch(G){console.warn("[InspectorCanvas] Both sandbox and local failed:",G)}return}m(!0);const U=new Map;for(const[G,L]of Object.entries(z.portValues))U.set(G,L);h(U),E.current=z.snapshotId!==void 0?[{snapshotId:z.snapshotId,cycle:0}]:[],C(E.current.length),R(E.current.length===0?-1:0),x(0)})},[s,e,u,k,l]);const D=N.useCallback(P=>{const j=`${P}.out`,I=d.get(j);u.setNode(P,!I,k).then(z=>{if("error"in z)return;const U=new Map;for(const[G,L]of Object.entries(z.portValues))U.set(G,L);h(U)})},[u,d]),H=N.useCallback((P,j)=>{u.setNode(P,j,k).then(I=>{if("error"in I)return;const z=new Map;for(const[U,G]of Object.entries(I.portValues))z.set(U,G);h(z)})},[u]),Y=N.useCallback(()=>{u.tick(void 0,k,{snapshot:l}).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,_+1);I.push({snapshotId:P.snapshotId,cycle:P.cycle}),E.current=I,C(I.length),R(I.length-1)}})},[u,k,l,_]),$=N.useCallback(()=>{S(!1),u.reset(k).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=[],C(0),R(-1),l&&u.snapshot(k).then(I=>{"error"in I||I.snapshotId===void 0||(E.current=[{snapshotId:I.snapshotId,cycle:0}],C(1),R(0))})})},[u,k,l]),F=N.useCallback(P=>{const j=E.current[P];j&&u.restore(j.snapshotId,k).then(I=>{if("error"in I)return;const z=new Map;for(const[U,G]of Object.entries(I.portValues))z.set(U,G);h(z),x(j.cycle),R(P)})},[u,k]),Q=N.useCallback(()=>{S(!1),_>0&&F(_-1)},[_,F]),B=N.useCallback(()=>{_<O-1?F(_+1):Y()},[_,O,F,Y]);return N.useEffect(()=>{if(!w)return;const P=window.setInterval(()=>{Y()},200);return()=>window.clearInterval(P)},[w,Y]),M.jsxs("div",{className:"relative h-full w-full",children:[l&&M.jsx(h_,{floating:!0,cycle:b,historyLength:O,historyIndex:_,isRunning:w,isViewingPast:_>=0&&_<O-1,onStep:Y,onRun:()=>S(!0),onPause:()=>S(!1),onReset:$,onStepBack:Q,onStepForward:B}),M.jsx(p_,{circuit:s,componentLibrary:e,portValues:d,sequentialState:null,onToggleNode:D,onSetNodeValue:H,onNodeDoubleClick:c,nodeTypes:rw,edgeTypes:sw,theme:i,showControls:!0,height:"100%",panOnMobile:!0})]})}function p$({stack:t,onNavigate:e,theme:n="dark"}){const s=t[t.length-1]?.componentDef.metadata?.description,l=n==="dark";return M.jsxs("div",{className:"flex items-center gap-1 text-sm min-w-0",children:[t.map((c,u)=>M.jsxs(Ai.Fragment,{children:[u>0&&M.jsx("span",{className:`${l?"text-gray-500":"text-gray-400"} shrink-0`,children:">"}),u<t.length-1?M.jsxs("button",{onClick:()=>e(u),className:`${l?"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 ${l?"text-gray-100":"text-gray-900"}`,children:[c.nodeLabel," (",c.componentName,")"]})]},u)),s&&M.jsxs(M.Fragment,{children:[M.jsx("span",{className:`${l?"text-gray-600":"text-gray-300"} shrink-0`,children:"—"}),M.jsx("span",{className:`${l?"text-gray-400":"text-gray-500"} text-xs italic truncate`,children:s})]})]})}const m$={enterIn:{opacity:0},enterOut:{opacity:0},center:{opacity:1},exitIn:{opacity:0},exitOut:{opacity:0}};function g$({stack:t,componentLibrary:e,theme:n="dark",onClose:i,onPopLevel:s,onPushLevel:l,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(TE,{children:u&&b&&M.jsxs(M.Fragment,{children:[M.jsx(lu.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(lu.div,{className:"fixed inset-0 z-50 flex items-center justify-center p-8 pointer-events-none",children:M.jsxs(lu.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(p$,{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(TE,{mode:"wait",initial:!1,children:M.jsx(lu.div,{className:"absolute inset-0",initial:h==="in"?"enterIn":"enterOut",animate:"center",exit:h==="in"?"exitIn":"exitOut",variants:m$,transition:{duration:.2,ease:"easeInOut"},children:M.jsx(h$,{frame:b,componentLibrary:e,onPushLevel:l,theme:n})},`${t.length}-${b.componentName}`)})})]})},"inspector-dialog")]})})}function y$(){const{fitView:t,zoomIn:e,zoomOut:n}=la(),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 Jp=null;function v$(){if(!Jp){const t=new Map;Jp={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 Jp}function b$({circuit:t,componentLibrary:e,portValues:n,sequentialState:i,draggable:s=!0,layout:l,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:O,onPortClick:C,glowUnconnected:_,theme:R,panOnMobile:A=!1,onRequestRemount:k}){const D=Fw(),H=R??D,Y=D6(),$=w??rw,F=S??sw,Q=e??v$(),B=N.useMemo(()=>m?new Set(Array.isArray(m)?m:[m]):null,[m]),P=N.useMemo(()=>t?Cj(t):null,[t]),{metadata:j}=O6(l?null:P),I=N.useMemo(()=>{if(!P)return{components:{},connections:{}};if(!l)return j;const mt={};for(const Ct of P.nodes){const Lt=Ct.label||Ct.id,jt=l[Lt]??l[Ct.id];jt&&(mt[Ct.id]={id:Ct.id,position:jt})}return{components:mt,connections:{}}},[P,j,l]),{projectedNodes:z,projectedEdges:U}=N.useMemo(()=>{if(!P)return{projectedNodes:[],projectedEdges:[]};const mt=oL(P,I,Q,n??void 0,i??void 0),Ct=mt.nodes.map(Lt=>{const jt=Lt.data,zt=jt?.componentRef,ge={...Lt.data};if(O&&(ge.showPortLabels=!0),_&&(ge.glowUnconnected=!0),C){const Qt=jt.label||jt.componentRef;ge.onPortClick=(Oe,yn)=>C(Qt,Oe,yn)}return zt==="Input"&&u&&(ge.onValueChange=Qt=>u(Lt.id,Qt)),c&&(zt==="Switch"||zt==="Button")&&(ge.onToggle=()=>c(Lt.id)),d&&(zt==="RV32I_InstrMem"||zt==="DualPortROM")&&(ge.onLoadMemory=Qt=>d(Lt.id,Qt)),{...Lt,data:ge}});if(B){const Lt=new Set;for(const jt of Ct){const zt=jt.data?.label??jt.id;B.has(zt)&&Lt.add(jt.id)}return{projectedNodes:Ct.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:Lt.has(jt.source)||Lt.has(jt.target)?1:.15,transition:"opacity 0.2s"}}))}}return{projectedNodes:Ct,projectedEdges:mt.edges}},[P,I,Q,n,i,c,u,d,B,O,C,_]),[G,L]=N.useState([]),[q,tt]=N.useState([]),{fitView:rt}=la(),ct=W5(),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,Lt=ut.current,jt=P?.name??null,zt=new Set(z.map(Ae=>Ae.id)),ge=new Map;for(const Ae of z){const he=Ae.data,se=`${(he.inputNames??[]).join("|")}>${(he.outputNames??[]).join("|")}`;ge.set(Ae.id,se)}ht.current=jt,ft.current=zt,ut.current=ge;const Qt=jt!==mt;let Oe=0;for(const Ae of zt)Ct.has(Ae)&&Oe++;const yn=Math.max(Ct.size,zt.size),za=yn>0&&Oe/yn<.5,In=Qt||za,Ki=[];if(!In)for(const[Ae,he]of ge){const se=Lt.get(Ae);se!==void 0&&se!==he&&Ki.push(Ae)}const Va=dt.current===0;dt.current=z.length,L(Ae=>{const he=new Map(Ae.map(se=>[se.id,se]));return z.map(se=>{const De=he.get(se.id);return De&&!In?{...De,type:se.type,data:se.data,selectable:se.selectable,deletable:se.deletable}:se})}),tt(U),In&&Ct.size>0?k?.():Ki.length>0&&requestAnimationFrame(()=>ct(Ki)),z.length>0&&Va&&!In&&requestAnimationFrame(()=>rt({padding:.3}))},[z,U]);const kt=N.useCallback(mt=>{L(Ct=>$v(mt,Ct))},[]),[At,bt]=N.useState([]),Tt=N.useCallback((mt,Ct,Lt)=>{bt(jt=>[...jt,{componentName:mt,componentDef:Ct,nodeLabel:Lt}])},[]),Ot=N.useCallback(()=>{bt(mt=>mt.slice(0,-1))},[]),Xt=N.useCallback(()=>{bt([])},[]),qt=N.useCallback(mt=>{bt(Ct=>Ct.slice(0,mt+1))},[]),pt=N.useCallback(mt=>{if(!mt.isComposite)return;const Ct=Q.resolveCircuit(mt.componentRef);Ct&&Ct.implementation.kind==="composite"&&Ct.nodes.length>0&&bt([{componentName:mt.componentRef,componentDef:Ct,nodeLabel:mt.label??mt.componentRef}])},[Q]),gt=h??pt,vt=N.useCallback((mt,Ct)=>{gt(Ct.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(Q5,{nodes:G,edges:q,nodeTypes:$,edgeTypes:F,onNodesChange:kt,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&&!Y,nodesConnectable:!1,elementsSelectable:!0,selectionOnDrag:!1,panOnDrag:Y&&!A?!1:[1,2],zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!1,preventScrolling:!1,proOptions:{hideAttribution:!0},deleteKeyCode:null,panActivationKeyCode:null,children:[M.jsx(oj,{variant:fo.Dots,gap:20,size:1,color:"var(--embed-dot-color)"}),E&&M.jsx(sa,{position:"bottom-left",children:M.jsx(y$,{})})]}),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(g$,{stack:At,componentLibrary:Q,theme:H,onClose:Xt,onPopLevel:Ot,onPushLevel:Tt,onNavigate:qt})]})}function p_(t){const[e,n]=N.useState(0),i=N.useCallback(()=>{n(s=>s+1)},[]);return M.jsx(Ab,{children:M.jsx(b$,{...t,onRequestRemount:i})},e)}const x$=N.forwardRef(function({circuit:e,height:n=300,showControls:i=!0,autoHarness:s=!1,initialInputs:l,layout:c,theme:u,focus:d,showPortLabels:h,onPortClick:p,glowUnconnected:m,renderEmptyState:y,renderOverlay:b,onPortValuesChange:x},w){const S=xM(e,{autoHarness:s,initialInputs:l}),E=Fw(),O=u??E,C=N.useRef(x);N.useEffect(()=>{C.current=x}),N.useEffect(()=>{!S.ready||!S.portValues||S.portValues.size===0||C.current?.(S.portValues)},[S.ready,S.portValues]);const _=N.useCallback(()=>{S.tick()},[S.tick]),R=N.useCallback(()=>{S.reset()},[S.reset]);if(N.useImperativeHandle(w,()=>({tick:_,reset:R,setNodeValue:S.setNodeValue,startAutoRun:S.startAutoRun,stopAutoRun:S.stopAutoRun}),[_,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,k=typeof n=="number"?n-A:n;return M.jsxs("div",{style:{height:n},className:"flex flex-col","data-embed-theme":O,children:[M.jsx("div",{className:"flex-1 min-h-0",children:M.jsx(p_,{circuit:S.circuit,componentLibrary:S.componentLibrary??void 0,portValues:S.portValues,sequentialState:S.sequentialState,onToggleNode:S.toggleNode,onSetNodeValue:S.setNodeValue,onLoadMemory:(D,H)=>{const Y=S.getSimulator();Y&&(Y.setNode(D,H),S.runCombinational())},height:k,focus:d,showPortLabels:h,onPortClick:p,glowUnconnected:m,renderEmptyState:y,renderOverlay:b,...c?{layout:c}:{},...u?{theme:u}:{}})}),S.isSequential&&i&&M.jsx(h_,{cycle:S.cycleCount,historyLength:S.history?.length??0,historyIndex:S.historyIndex??-1,isRunning:S.isRunning,isViewingPast:S.isViewingPast??!1,onStep:_,onRun:()=>S.startAutoRun(5),onPause:()=>S.stopAutoRun(),onReset:R,onStepBack:()=>S.stepBack(),onStepForward:()=>{S.isViewingPast?S.stepForward():_()},speed:5})]})});var tm={exports:{}},m_;function w$(){return m_||(m_=1,(function(t){var e=(function(){var n=String.fromCharCode,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",l={};function c(d,h){if(!l[d]){l[d]={};for(var p=0;p<d.length;p++)l[d][d.charAt(p)]=p}return l[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="",O=2,C=3,_=2,R=[],A=0,k=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=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<_;m++)A=A<<1,k==h-1?(k=0,R.push(p(A)),A=0):k++;for(y=E.charCodeAt(0),m=0;m<8;m++)A=A<<1|y&1,k==h-1?(k=0,R.push(p(A)),A=0):k++,y=y>>1}else{for(y=1,m=0;m<_;m++)A=A<<1|y,k==h-1?(k=0,R.push(p(A)),A=0):k++,y=0;for(y=E.charCodeAt(0),m=0;m<16;m++)A=A<<1|y&1,k==h-1?(k=0,R.push(p(A)),A=0):k++,y=y>>1}O--,O==0&&(O=Math.pow(2,_),_++),delete x[E]}else for(y=b[E],m=0;m<_;m++)A=A<<1|y&1,k==h-1?(k=0,R.push(p(A)),A=0):k++,y=y>>1;O--,O==0&&(O=Math.pow(2,_),_++),b[S]=C++,E=String(w)}if(E!==""){if(Object.prototype.hasOwnProperty.call(x,E)){if(E.charCodeAt(0)<256){for(m=0;m<_;m++)A=A<<1,k==h-1?(k=0,R.push(p(A)),A=0):k++;for(y=E.charCodeAt(0),m=0;m<8;m++)A=A<<1|y&1,k==h-1?(k=0,R.push(p(A)),A=0):k++,y=y>>1}else{for(y=1,m=0;m<_;m++)A=A<<1|y,k==h-1?(k=0,R.push(p(A)),A=0):k++,y=0;for(y=E.charCodeAt(0),m=0;m<16;m++)A=A<<1|y&1,k==h-1?(k=0,R.push(p(A)),A=0):k++,y=y>>1}O--,O==0&&(O=Math.pow(2,_),_++),delete x[E]}else for(y=b[E],m=0;m<_;m++)A=A<<1|y&1,k==h-1?(k=0,R.push(p(A)),A=0):k++,y=y>>1;O--,O==0&&(O=Math.pow(2,_),_++)}for(y=2,m=0;m<_;m++)A=A<<1|y&1,k==h-1?(k=0,R.push(p(A)),A=0):k++,y=y>>1;for(;;)if(A=A<<1,k==h-1){R.push(p(A));break}else k++;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,O,C,_,R,A,k,D={val:p(0),position:h,index:1};for(E=0;E<3;E+=1)m[E]=E;for(C=0,R=Math.pow(2,2),A=1;A!=R;)_=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=p(D.index++)),C|=(_>0?1:0)*A,A<<=1;switch(C){case 0:for(C=0,R=Math.pow(2,8),A=1;A!=R;)_=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=p(D.index++)),C|=(_>0?1:0)*A,A<<=1;k=n(C);break;case 1:for(C=0,R=Math.pow(2,16),A=1;A!=R;)_=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=p(D.index++)),C|=(_>0?1:0)*A,A<<=1;k=n(C);break;case 2:return""}for(m[3]=k,O=k,S.push(k);;){if(D.index>d)return"";for(C=0,R=Math.pow(2,x),A=1;A!=R;)_=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=p(D.index++)),C|=(_>0?1:0)*A,A<<=1;switch(k=C){case 0:for(C=0,R=Math.pow(2,8),A=1;A!=R;)_=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=p(D.index++)),C|=(_>0?1:0)*A,A<<=1;m[b++]=n(C),k=b-1,y--;break;case 1:for(C=0,R=Math.pow(2,16),A=1;A!=R;)_=D.val&D.position,D.position>>=1,D.position==0&&(D.position=h,D.val=p(D.index++)),C|=(_>0?1:0)*A,A<<=1;m[b++]=n(C),k=b-1,y--;break;case 2:return S.join("")}if(y==0&&(y=Math.pow(2,x),x++),m[k])w=m[k];else if(k===b)w=O+O.charAt(0);else return null;S.push(w),m[b++]=O+w.charAt(0),y--,O=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})})(tm)),tm.exports}var S$=w$();function E$(t){return S$.compressToEncodedURIComponent(t)}const _$=N.createContext(null);function C$(){return N.useContext(_$)}function g_(){return typeof window>"u"?"https://simten.dev":window.location.hostname==="localhost"?window.location.origin:"https://simten.dev"}const T$=160,N$=90;function A$(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))+T$,i=Math.max(...e.map(s=>s.y))+N$;return n<=0||i<=0?1.5:n/i}const M$=N.forwardRef(function({circuit:e,height:n,aspectRatio:i,showControls:s=!0,layout:l,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:O},C){const _=u||h,[R,A]=N.useState(null),[k,D]=N.useState(!1),H=C$(),Y=async()=>{if(!k)try{const j=E??cM(e);if(H){D(!0);const{hash:I}=await H(j);window.open(`${g_()}/circuit/s/${I}`,"_blank","noopener")}else{const I=E$(j);window.open(`${g_()}/circuit/${I}`,"_blank","noopener")}}catch(j){A(j instanceof Error?j.message:"Couldn't fork this circuit"),setTimeout(()=>A(null),3e3)}finally{D(!1)}},$=n===void 0,F=i??A$(l),Q={width:"100%",aspectRatio:String(F),minHeight:240,maxHeight:"70vh"},B=_?void 0:$?Q:{height:n},P=_?$?Q:{height:n}:{height:"100%"};return M.jsxs("div",{style:B,className:`relative flex flex-col ${_?"rounded-xl border border-[var(--embed-border)] overflow-hidden bg-[var(--embed-bg-secondary)]":""}`,children:[!_&&!p&&M.jsx("button",{type:"button",onClick:Y,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(x$,{ref:C,circuit:e,height:"100%",showControls:s,autoHarness:!0,initialInputs:S,layout:l,theme:c,focus:m,showPortLabels:y,onPortClick:b,glowUnconnected:x,autoRunSpeed:w,onPortValuesChange:O})}),_&&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:Y,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 R$({code:t,height:e,showControls:n,title:i,subtitle:s,description:l,href:c,autoRunSpeed:u,theme:d}){const h=Xf(),[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(aM(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(M$,{circuit:p,height:e,showControls:n,title:i,subtitle:s,description:l,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 k$(t){return M.jsx(TN,{children:M.jsx(R$,{...t})})}const y_=xN(k$,{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",y_),Vf.CircuitEmbedWC=y_,Object.defineProperty(Vf,Symbol.toStringTag,{value:"Module"}),Vf})({});
|
|
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})({});
|