@simten/embed 0.1.5 → 0.1.6

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.
@@ -1,29 +1,29 @@
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<a.stack.indexOf("@")?"@unknown:0:0":""}return`
3
- `+bt+o+Tt}var Xt=!1;function qt(o,r){if(!o||Xt)return"";Xt=!0;var a=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(it){var ot=it}Reflect.construct(o,[],lt)}else{try{lt.call()}catch(it){ot=it}o.call(lt.prototype)}}else{try{throw Error()}catch(it){ot=it}(lt=o())&&typeof lt.catch=="function"&&lt.catch(function(){})}}catch(it){if(it&&ot&&typeof it.stack=="string")return[it.stack,ot.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 X=T.split(`
4
- `),et=V.split(`
5
- `);for(g=f=0;f<X.length&&!X[f].includes("DetermineComponentFrameRoot");)f++;for(;g<et.length&&!et[g].includes("DetermineComponentFrameRoot");)g++;if(f===X.length||g===et.length)for(f=X.length-1,g=et.length-1;1<=f&&0<=g&&X[f]!==et[g];)g--;for(;1<=f&&0<=g;f--,g--)if(X[f]!==et[g]){if(f!==1||g!==1)do if(f--,g--,0>g||X[f]!==et[g]){var st=`
6
- `+X[f].replace(" at new "," at ");return o.displayName&&st.includes("<anonymous>")&&(st=st.replace("<anonymous>",o.displayName)),st}while(1<=f&&0<=g);break}}}finally{Xt=!1,Error.prepareStackTrace=a}return(a=o?o.displayName||o.name:"")?Ot(a):""}function pt(o,r){switch(o.tag){case 26:case 27:case 5:return Ot(o.type);case 16:return Ot("Lazy");case 13:return o.child!==r&&r!==null?Ot("Suspense Fallback"):Ot("Suspense");case 19:return Ot("SuspenseList");case 0:case 15:return qt(o.type,!1);case 11:return qt(o.type.render,!1);case 1:return qt(o.type,!0);case 31:return Ot("Activity");default:return""}}function gt(o){try{var r="",a=null;do r+=pt(o,a),a=o,o=o.return;while(o);return r}catch(f){return`
1
+ var SimtenEmbed=(function(Zf){"use strict";var Kf=typeof document<"u"?document.currentScript:null;function wN(t,e){for(var n=0;n<e.length;n++){const i=e[n];if(typeof i!="string"&&!Array.isArray(i)){for(const s in i)if(s!=="default"&&!(s in t)){const a=Object.getOwnPropertyDescriptor(i,s);a&&Object.defineProperty(t,s,a.get?a:{enumerable:!0,get:()=>i[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}function Qf(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Wf={exports:{}},Lt={};var C0;function SN(){if(C0)return Lt;C0=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),s=Symbol.for("react.profiler"),a=Symbol.for("react.consumer"),c=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),h=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function b(L){return L===null||typeof L!="object"?null:(L=y&&L[y]||L["@@iterator"],typeof L=="function"?L:null)}var x={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,S={};function E(L,G,tt){this.props=L,this.context=G,this.refs=S,this.updater=tt||x}E.prototype.isReactComponent={},E.prototype.setState=function(L,G){if(typeof L!="object"&&typeof L!="function"&&L!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,L,G,"setState")},E.prototype.forceUpdate=function(L){this.updater.enqueueForceUpdate(this,L,"forceUpdate")};function D(){}D.prototype=E.prototype;function T(L,G,tt){this.props=L,this.context=G,this.refs=S,this.updater=tt||x}var C=T.prototype=new D;C.constructor=T,w(C,E.prototype),C.isPureReactComponent=!0;var R=Array.isArray;function A(){}var O={H:null,A:null,T:null,S:null},k=Object.prototype.hasOwnProperty;function H(L,G,tt){var it=tt.ref;return{$$typeof:t,type:L,key:G,ref:it!==void 0?it:null,props:tt}}function $(L,G){return H(L.type,G,L.props)}function q(L){return typeof L=="object"&&L!==null&&L.$$typeof===t}function F(L){var G={"=":"=0",":":"=2"};return"$"+L.replace(/[=:]/g,function(tt){return G[tt]})}var Q=/\/+/g;function B(L,G){return typeof L=="object"&&L!==null&&L.key!=null?F(""+L.key):G.toString(36)}function P(L){switch(L.status){case"fulfilled":return L.value;case"rejected":throw L.reason;default:switch(typeof L.status=="string"?L.then(A,A):(L.status="pending",L.then(function(G){L.status==="pending"&&(L.status="fulfilled",L.value=G)},function(G){L.status==="pending"&&(L.status="rejected",L.reason=G)})),L.status){case"fulfilled":return L.value;case"rejected":throw L.reason}}throw L}function j(L,G,tt,it,lt){var ht=typeof L;(ht==="undefined"||ht==="boolean")&&(L=null);var ft=!1;if(L===null)ft=!0;else switch(ht){case"bigint":case"string":case"number":ft=!0;break;case"object":switch(L.$$typeof){case t:case e:ft=!0;break;case p:return ft=L._init,j(ft(L._payload),G,tt,it,lt)}}if(ft)return lt=lt(L),ft=it===""?"."+B(L,0):it,R(lt)?(tt="",ft!=null&&(tt=ft.replace(Q,"$&/")+"/"),j(lt,G,tt,"",function(Mt){return Mt})):lt!=null&&(q(lt)&&(lt=$(lt,tt+(lt.key==null||L&&L.key===lt.key?"":(""+lt.key).replace(Q,"$&/")+"/")+ft)),G.push(lt)),1;ft=0;var ut=it===""?".":it+":";if(R(L))for(var dt=0;dt<L.length;dt++)it=L[dt],ht=ut+B(it,dt),ft+=j(it,G,tt,ht,lt);else if(dt=b(L),typeof dt=="function")for(L=dt.call(L),dt=0;!(it=L.next()).done;)it=it.value,ht=ut+B(it,dt++),ft+=j(it,G,tt,ht,lt);else if(ht==="object"){if(typeof L.then=="function")return j(P(L),G,tt,it,lt);throw G=String(L),Error("Objects are not valid as a React child (found: "+(G==="[object Object]"?"object with keys {"+Object.keys(L).join(", ")+"}":G)+"). If you meant to render a collection of children, use an array instead.")}return ft}function I(L,G,tt){if(L==null)return L;var it=[],lt=0;return j(L,it,"","",function(ht){return G.call(tt,ht,lt++)}),it}function z(L){if(L._status===-1){var G=L._result;G=G(),G.then(function(tt){(L._status===0||L._status===-1)&&(L._status=1,L._result=tt)},function(tt){(L._status===0||L._status===-1)&&(L._status=2,L._result=tt)}),L._status===-1&&(L._status=0,L._result=G)}if(L._status===1)return L._result.default;throw L._result}var U=typeof reportError=="function"?reportError:function(L){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var G=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof L=="object"&&L!==null&&typeof L.message=="string"?String(L.message):String(L),error:L});if(!window.dispatchEvent(G))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",L);return}console.error(L)},Y={map:I,forEach:function(L,G,tt){I(L,function(){G.apply(this,arguments)},tt)},count:function(L){var G=0;return I(L,function(){G++}),G},toArray:function(L){return I(L,function(G){return G})||[]},only:function(L){if(!q(L))throw Error("React.Children.only expected to receive a single React element child.");return L}};return Lt.Activity=m,Lt.Children=Y,Lt.Component=E,Lt.Fragment=n,Lt.Profiler=s,Lt.PureComponent=T,Lt.StrictMode=i,Lt.Suspense=d,Lt.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=O,Lt.__COMPILER_RUNTIME={__proto__:null,c:function(L){return O.H.useMemoCache(L)}},Lt.cache=function(L){return function(){return L.apply(null,arguments)}},Lt.cacheSignal=function(){return null},Lt.cloneElement=function(L,G,tt){if(L==null)throw Error("The argument must be a React element, but you passed "+L+".");var it=w({},L.props),lt=L.key;if(G!=null)for(ht in G.key!==void 0&&(lt=""+G.key),G)!k.call(G,ht)||ht==="key"||ht==="__self"||ht==="__source"||ht==="ref"&&G.ref===void 0||(it[ht]=G[ht]);var ht=arguments.length-2;if(ht===1)it.children=tt;else if(1<ht){for(var ft=Array(ht),ut=0;ut<ht;ut++)ft[ut]=arguments[ut+2];it.children=ft}return H(L.type,lt,it)},Lt.createContext=function(L){return L={$$typeof:c,_currentValue:L,_currentValue2:L,_threadCount:0,Provider:null,Consumer:null},L.Provider=L,L.Consumer={$$typeof:a,_context:L},L},Lt.createElement=function(L,G,tt){var it,lt={},ht=null;if(G!=null)for(it in G.key!==void 0&&(ht=""+G.key),G)k.call(G,it)&&it!=="key"&&it!=="__self"&&it!=="__source"&&(lt[it]=G[it]);var ft=arguments.length-2;if(ft===1)lt.children=tt;else if(1<ft){for(var ut=Array(ft),dt=0;dt<ft;dt++)ut[dt]=arguments[dt+2];lt.children=ut}if(L&&L.defaultProps)for(it in ft=L.defaultProps,ft)lt[it]===void 0&&(lt[it]=ft[it]);return H(L,ht,lt)},Lt.createRef=function(){return{current:null}},Lt.forwardRef=function(L){return{$$typeof:u,render:L}},Lt.isValidElement=q,Lt.lazy=function(L){return{$$typeof:p,_payload:{_status:-1,_result:L},_init:z}},Lt.memo=function(L,G){return{$$typeof:h,type:L,compare:G===void 0?null:G}},Lt.startTransition=function(L){var G=O.T,tt={};O.T=tt;try{var it=L(),lt=O.S;lt!==null&&lt(tt,it),typeof it=="object"&&it!==null&&typeof it.then=="function"&&it.then(A,U)}catch(ht){U(ht)}finally{G!==null&&tt.types!==null&&(G.types=tt.types),O.T=G}},Lt.unstable_useCacheRefresh=function(){return O.H.useCacheRefresh()},Lt.use=function(L){return O.H.use(L)},Lt.useActionState=function(L,G,tt){return O.H.useActionState(L,G,tt)},Lt.useCallback=function(L,G){return O.H.useCallback(L,G)},Lt.useContext=function(L){return O.H.useContext(L)},Lt.useDebugValue=function(){},Lt.useDeferredValue=function(L,G){return O.H.useDeferredValue(L,G)},Lt.useEffect=function(L,G){return O.H.useEffect(L,G)},Lt.useEffectEvent=function(L){return O.H.useEffectEvent(L)},Lt.useId=function(){return O.H.useId()},Lt.useImperativeHandle=function(L,G,tt){return O.H.useImperativeHandle(L,G,tt)},Lt.useInsertionEffect=function(L,G){return O.H.useInsertionEffect(L,G)},Lt.useLayoutEffect=function(L,G){return O.H.useLayoutEffect(L,G)},Lt.useMemo=function(L,G){return O.H.useMemo(L,G)},Lt.useOptimistic=function(L,G){return O.H.useOptimistic(L,G)},Lt.useReducer=function(L,G,tt){return O.H.useReducer(L,G,tt)},Lt.useRef=function(L){return O.H.useRef(L)},Lt.useState=function(L){return O.H.useState(L)},Lt.useSyncExternalStore=function(L,G,tt){return O.H.useSyncExternalStore(L,G,tt)},Lt.useTransition=function(){return O.H.useTransition()},Lt.version="19.2.0",Lt}var T0;function ha(){return T0||(T0=1,Wf.exports=SN()),Wf.exports}var N=ha();const dr=Qf(N),_0=wN({__proto__:null,default:dr},[N]);var Jf={exports:{}},pa={},td={exports:{}},ed={};var N0;function EN(){return N0||(N0=1,(function(t){function e(j,I){var z=j.length;j.push(I);t:for(;0<z;){var U=z-1>>>1,Y=j[U];if(0<s(Y,I))j[U]=I,j[z]=Y,z=U;else break t}}function n(j){return j.length===0?null:j[0]}function i(j){if(j.length===0)return null;var I=j[0],z=j.pop();if(z!==I){j[0]=z;t:for(var U=0,Y=j.length,L=Y>>>1;U<L;){var G=2*(U+1)-1,tt=j[G],it=G+1,lt=j[it];if(0>s(tt,z))it<Y&&0>s(lt,tt)?(j[U]=lt,j[it]=z,U=it):(j[U]=tt,j[G]=z,U=G);else if(it<Y&&0>s(lt,z))j[U]=lt,j[it]=z,U=it;else break t}}return I}function s(j,I){var z=j.sortIndex-I.sortIndex;return z!==0?z:j.id-I.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var a=performance;t.unstable_now=function(){return a.now()}}else{var c=Date,u=c.now();t.unstable_now=function(){return c.now()-u}}var d=[],h=[],p=1,m=null,y=3,b=!1,x=!1,w=!1,S=!1,E=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;function C(j){for(var I=n(h);I!==null;){if(I.callback===null)i(h);else if(I.startTime<=j)i(h),I.sortIndex=I.expirationTime,e(d,I);else break;I=n(h)}}function R(j){if(w=!1,C(j),!x)if(n(d)!==null)x=!0,A||(A=!0,F());else{var I=n(h);I!==null&&P(R,I.startTime-j)}}var A=!1,O=-1,k=5,H=-1;function $(){return S?!0:!(t.unstable_now()-H<k)}function q(){if(S=!1,A){var j=t.unstable_now();H=j;var I=!0;try{t:{x=!1,w&&(w=!1,D(O),O=-1),b=!0;var z=y;try{e:{for(C(j),m=n(d);m!==null&&!(m.expirationTime>j&&$());){var U=m.callback;if(typeof U=="function"){m.callback=null,y=m.priorityLevel;var Y=U(m.expirationTime<=j);if(j=t.unstable_now(),typeof Y=="function"){m.callback=Y,C(j),I=!0;break e}m===n(d)&&i(d),C(j)}else i(d);m=n(d)}if(m!==null)I=!0;else{var L=n(h);L!==null&&P(R,L.startTime-j),I=!1}}break t}finally{m=null,y=z,b=!1}I=void 0}}finally{I?F():A=!1}}}var F;if(typeof T=="function")F=function(){T(q)};else if(typeof MessageChannel<"u"){var Q=new MessageChannel,B=Q.port2;Q.port1.onmessage=q,F=function(){B.postMessage(null)}}else F=function(){E(q,0)};function P(j,I){O=E(function(){j(t.unstable_now())},I)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(j){j.callback=null},t.unstable_forceFrameRate=function(j){0>j||125<j?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):k=0<j?Math.floor(1e3/j):5},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_next=function(j){switch(y){case 1:case 2:case 3:var I=3;break;default:I=y}var z=y;y=I;try{return j()}finally{y=z}},t.unstable_requestPaint=function(){S=!0},t.unstable_runWithPriority=function(j,I){switch(j){case 1:case 2:case 3:case 4:case 5:break;default:j=3}var z=y;y=j;try{return I()}finally{y=z}},t.unstable_scheduleCallback=function(j,I,z){var U=t.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?U+z:U):z=U,j){case 1:var Y=-1;break;case 2:Y=250;break;case 5:Y=1073741823;break;case 4:Y=1e4;break;default:Y=5e3}return Y=z+Y,j={id:p++,callback:I,priorityLevel:j,startTime:z,expirationTime:Y,sortIndex:-1},z>U?(j.sortIndex=z,e(h,j),n(d)===null&&j===n(h)&&(w?(D(O),O=-1):w=!0,P(R,z-U))):(j.sortIndex=Y,e(d,j),x||b||(x=!0,A||(A=!0,F()))),j},t.unstable_shouldYield=$,t.unstable_wrapCallback=function(j){var I=y;return function(){var z=y;y=I;try{return j.apply(this,arguments)}finally{y=z}}}})(ed)),ed}var A0;function CN(){return A0||(A0=1,td.exports=EN()),td.exports}var nd={exports:{}},Ge={};var M0;function TN(){if(M0)return Ge;M0=1;var t=ha();function e(d){var h="https://react.dev/errors/"+d;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)h+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+d+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var i={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},s=Symbol.for("react.portal");function a(d,h,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:s,key:m==null?null:""+m,children:d,containerInfo:h,implementation:p}}var c=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function u(d,h){if(d==="font")return"";if(typeof h=="string")return h==="use-credentials"?h:""}return Ge.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Ge.createPortal=function(d,h){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!h||h.nodeType!==1&&h.nodeType!==9&&h.nodeType!==11)throw Error(e(299));return a(d,h,null,p)},Ge.flushSync=function(d){var h=c.T,p=i.p;try{if(c.T=null,i.p=2,d)return d()}finally{c.T=h,i.p=p,i.d.f()}},Ge.preconnect=function(d,h){typeof d=="string"&&(h?(h=h.crossOrigin,h=typeof h=="string"?h==="use-credentials"?h:"":void 0):h=null,i.d.C(d,h))},Ge.prefetchDNS=function(d){typeof d=="string"&&i.d.D(d)},Ge.preinit=function(d,h){if(typeof d=="string"&&h&&typeof h.as=="string"){var p=h.as,m=u(p,h.crossOrigin),y=typeof h.integrity=="string"?h.integrity:void 0,b=typeof h.fetchPriority=="string"?h.fetchPriority:void 0;p==="style"?i.d.S(d,typeof h.precedence=="string"?h.precedence:void 0,{crossOrigin:m,integrity:y,fetchPriority:b}):p==="script"&&i.d.X(d,{crossOrigin:m,integrity:y,fetchPriority:b,nonce:typeof h.nonce=="string"?h.nonce:void 0})}},Ge.preinitModule=function(d,h){if(typeof d=="string")if(typeof h=="object"&&h!==null){if(h.as==null||h.as==="script"){var p=u(h.as,h.crossOrigin);i.d.M(d,{crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0})}}else h==null&&i.d.M(d)},Ge.preload=function(d,h){if(typeof d=="string"&&typeof h=="object"&&h!==null&&typeof h.as=="string"){var p=h.as,m=u(p,h.crossOrigin);i.d.L(d,p,{crossOrigin:m,integrity:typeof h.integrity=="string"?h.integrity:void 0,nonce:typeof h.nonce=="string"?h.nonce:void 0,type:typeof h.type=="string"?h.type:void 0,fetchPriority:typeof h.fetchPriority=="string"?h.fetchPriority:void 0,referrerPolicy:typeof h.referrerPolicy=="string"?h.referrerPolicy:void 0,imageSrcSet:typeof h.imageSrcSet=="string"?h.imageSrcSet:void 0,imageSizes:typeof h.imageSizes=="string"?h.imageSizes:void 0,media:typeof h.media=="string"?h.media:void 0})}},Ge.preloadModule=function(d,h){if(typeof d=="string")if(h){var p=u(h.as,h.crossOrigin);i.d.m(d,{as:typeof h.as=="string"&&h.as!=="script"?h.as:void 0,crossOrigin:p,integrity:typeof h.integrity=="string"?h.integrity:void 0})}else i.d.m(d)},Ge.requestFormReset=function(d){i.d.r(d)},Ge.unstable_batchedUpdates=function(d,h){return d(h)},Ge.useFormState=function(d,h,p){return c.H.useFormState(d,h,p)},Ge.useFormStatus=function(){return c.H.useHostTransitionStatus()},Ge.version="19.2.0",Ge}var R0;function k0(){if(R0)return nd.exports;R0=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),nd.exports=TN(),nd.exports}var O0;function _N(){if(O0)return pa;O0=1;var t=CN(),e=ha(),n=k0();function i(o){var r="https://react.dev/errors/"+o;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var l=2;l<arguments.length;l++)r+="&args[]="+encodeURIComponent(arguments[l])}return"Minified React error #"+o+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function s(o){return!(!o||o.nodeType!==1&&o.nodeType!==9&&o.nodeType!==11)}function a(o){var r=o,l=o;if(o.alternate)for(;r.return;)r=r.return;else{o=r;do r=o,(r.flags&4098)!==0&&(l=r.return),o=r.return;while(o)}return r.tag===3?l:null}function c(o){if(o.tag===13){var r=o.memoizedState;if(r===null&&(o=o.alternate,o!==null&&(r=o.memoizedState)),r!==null)return r.dehydrated}return null}function u(o){if(o.tag===31){var r=o.memoizedState;if(r===null&&(o=o.alternate,o!==null&&(r=o.memoizedState)),r!==null)return r.dehydrated}return null}function d(o){if(a(o)!==o)throw Error(i(188))}function h(o){var r=o.alternate;if(!r){if(r=a(o),r===null)throw Error(i(188));return r!==o?null:o}for(var l=o,f=r;;){var g=l.return;if(g===null)break;var v=g.alternate;if(v===null){if(f=g.return,f!==null){l=f;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===l)return d(g),o;if(v===f)return d(g),r;v=v.sibling}throw Error(i(188))}if(l.return!==f.return)l=g,f=v;else{for(var _=!1,V=g.child;V;){if(V===l){_=!0,l=g,f=v;break}if(V===f){_=!0,f=g,l=v;break}V=V.sibling}if(!_){for(V=v.child;V;){if(V===l){_=!0,l=v,f=g;break}if(V===f){_=!0,f=v,l=g;break}V=V.sibling}if(!_)throw Error(i(189))}}if(l.alternate!==f)throw Error(i(190))}if(l.tag!==3)throw Error(i(188));return l.stateNode.current===l?o:r}function p(o){var r=o.tag;if(r===5||r===26||r===27||r===6)return o;for(o=o.child;o!==null;){if(r=p(o),r!==null)return r;o=o.sibling}return null}var m=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),x=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),E=Symbol.for("react.profiler"),D=Symbol.for("react.consumer"),T=Symbol.for("react.context"),C=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),A=Symbol.for("react.suspense_list"),O=Symbol.for("react.memo"),k=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),$=Symbol.for("react.memo_cache_sentinel"),q=Symbol.iterator;function F(o){return o===null||typeof o!="object"?null:(o=q&&o[q]||o["@@iterator"],typeof o=="function"?o:null)}var Q=Symbol.for("react.client.reference");function B(o){if(o==null)return null;if(typeof o=="function")return o.$$typeof===Q?null:o.displayName||o.name||null;if(typeof o=="string")return o;switch(o){case w:return"Fragment";case E:return"Profiler";case S:return"StrictMode";case R:return"Suspense";case A:return"SuspenseList";case H:return"Activity"}if(typeof o=="object")switch(o.$$typeof){case x:return"Portal";case T:return o.displayName||"Context";case D:return(o._context.displayName||"Context")+".Consumer";case C:var r=o.render;return o=o.displayName,o||(o=r.displayName||r.name||"",o=o!==""?"ForwardRef("+o+")":"ForwardRef"),o;case O:return r=o.displayName||null,r!==null?r:B(o.type)||"Memo";case k:r=o._payload,o=o._init;try{return B(o(r))}catch{}}return null}var P=Array.isArray,j=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,I=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,z={pending:!1,data:null,method:null,action:null},U=[],Y=-1;function L(o){return{current:o}}function G(o){0>Y||(o.current=U[Y],U[Y]=null,Y--)}function tt(o,r){Y++,U[Y]=o.current,o.current=r}var it=L(null),lt=L(null),ht=L(null),ft=L(null);function ut(o,r){switch(tt(ht,r),tt(lt,o),tt(it,null),r.nodeType){case 9:case 11:o=(o=r.documentElement)&&(o=o.namespaceURI)?q_(o):0;break;default:if(o=r.tagName,r=r.namespaceURI)r=q_(r),o=Y_(r,o);else switch(o){case"svg":o=1;break;case"math":o=2;break;default:o=0}}G(it),tt(it,o)}function dt(){G(it),G(lt),G(ht)}function Mt(o){o.memoizedState!==null&&tt(ft,o);var r=it.current,l=Y_(r,o.type);r!==l&&(tt(lt,o),tt(it,l))}function Nt(o){lt.current===o&&(G(it),G(lt)),ft.current===o&&(G(ft),Zl._currentValue=z)}var bt,Tt;function Dt(o){if(bt===void 0)try{throw Error()}catch(l){var r=l.stack.trim().match(/\n( *(at )?)/);bt=r&&r[1]||"",Tt=-1<l.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<l.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+bt+o+Tt}var qt=!1;function Ht(o,r){if(!o||qt)return"";qt=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var f={DetermineComponentFrameRoot:function(){try{if(r){var ct=function(){throw Error()};if(Object.defineProperty(ct.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ct,[])}catch(rt){var ot=rt}Reflect.construct(o,[],ct)}else{try{ct.call()}catch(rt){ot=rt}o.call(ct.prototype)}}else{try{throw Error()}catch(rt){ot=rt}(ct=o())&&typeof ct.catch=="function"&&ct.catch(function(){})}}catch(rt){if(rt&&ot&&typeof rt.stack=="string")return[rt.stack,ot.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(),_=v[0],V=v[1];if(_&&V){var X=_.split(`
4
+ `),nt=V.split(`
5
+ `);for(g=f=0;f<X.length&&!X[f].includes("DetermineComponentFrameRoot");)f++;for(;g<nt.length&&!nt[g].includes("DetermineComponentFrameRoot");)g++;if(f===X.length||g===nt.length)for(f=X.length-1,g=nt.length-1;1<=f&&0<=g&&X[f]!==nt[g];)g--;for(;1<=f&&0<=g;f--,g--)if(X[f]!==nt[g]){if(f!==1||g!==1)do if(f--,g--,0>g||X[f]!==nt[g]){var st=`
6
+ `+X[f].replace(" at new "," at ");return o.displayName&&st.includes("<anonymous>")&&(st=st.replace("<anonymous>",o.displayName)),st}while(1<=f&&0<=g);break}}}finally{qt=!1,Error.prepareStackTrace=l}return(l=o?o.displayName||o.name:"")?Dt(l):""}function pt(o,r){switch(o.tag){case 26:case 27:case 5:return Dt(o.type);case 16:return Dt("Lazy");case 13:return o.child!==r&&r!==null?Dt("Suspense Fallback"):Dt("Suspense");case 19:return Dt("SuspenseList");case 0:case 15:return Ht(o.type,!1);case 11:return Ht(o.type.render,!1);case 1:return Ht(o.type,!0);case 31:return Dt("Activity");default:return""}}function gt(o){try{var r="",l=null;do r+=pt(o,l),l=o,o=o.return;while(o);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)===lt:(Ao&lt)===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&&lt.nodeType!==3||(V=T+g),lt!==v||f!==0&&lt.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&&lt.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&&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&&lt.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)&&lt!=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&&GT(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&&GT(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:
8
+ `+f.stack}}var yt=Object.prototype.hasOwnProperty,mt=t.unstable_scheduleCallback,Et=t.unstable_cancelCallback,Vt=t.unstable_shouldYield,jt=t.unstable_requestPaint,zt=t.unstable_now,ue=t.unstable_getCurrentPriorityLevel,Xt=t.unstable_ImmediatePriority,xe=t.unstable_UserBlockingPriority,Pe=t.unstable_NormalPriority,Po=t.unstable_LowPriority,Ae=t.unstable_IdlePriority,So=t.log,_i=t.unstable_setDisableYieldValue,pe=null,re=null;function ee(o){if(typeof So=="function"&&_i(o),re&&typeof re.setStrictMode=="function")try{re.setStrictMode(pe,o)}catch{}}var Ee=Math.clz32?Math.clz32:Mi,Ni=Math.log,Ai=Math.LN2;function Mi(o){return o>>>=0,o===0?32:31-(Ni(o)/Ai|0)|0}var Jn=256,to=262144,Eo=4194304;function mn(o){var r=o&42;if(r!==0)return r;switch(o&-o){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return o&261888;case 262144:case 524288:case 1048576:case 2097152:return o&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return o&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return o}}function Ri(o,r,l){var f=o.pendingLanes;if(f===0)return 0;var g=0,v=o.suspendedLanes,_=o.pingedLanes;o=o.warmLanes;var V=f&134217727;return V!==0?(f=V&~v,f!==0?g=mn(f):(_&=V,_!==0?g=mn(_):l||(l=V&~o,l!==0&&(g=mn(l))))):(V=f&~v,V!==0?g=mn(V):_!==0?g=mn(_):l||(l=f&~o,l!==0&&(g=mn(l)))),g===0?0:r!==0&&r!==g&&(r&v)===0&&(v=g&-g,l=r&-r,v>=l||v===32&&(l&4194048)!==0)?r:g}function eo(o,r){return(o.pendingLanes&~(o.suspendedLanes&~o.pingedLanes)&r)===0}function tn(o,r){switch(o){case 1:case 2:case 4:case 8:case 64:return r+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return r+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ki(){var o=Eo;return Eo<<=1,(Eo&62914560)===0&&(Eo=4194304),o}function Ke(o){for(var r=[],l=0;31>l;l++)r.push(o);return r}function no(o,r){o.pendingLanes|=r,r!==268435456&&(o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0)}function Oi(o,r,l,f,g,v){var _=o.pendingLanes;o.pendingLanes=l,o.suspendedLanes=0,o.pingedLanes=0,o.warmLanes=0,o.expiredLanes&=l,o.entangledLanes&=l,o.errorRecoveryDisabledLanes&=l,o.shellSuspendCounter=0;var V=o.entanglements,X=o.expirationTimes,nt=o.hiddenUpdates;for(l=_&~l;0<l;){var st=31-Ee(l),ct=1<<st;V[st]=0,X[st]=-1;var ot=nt[st];if(ot!==null)for(nt[st]=null,st=0;st<ot.length;st++){var rt=ot[st];rt!==null&&(rt.lane&=-536870913)}l&=~ct}f!==0&&Di(o,f,0),v!==0&&g===0&&o.tag!==0&&(o.suspendedLanes|=v&~(_&~r))}function Di(o,r,l){o.pendingLanes|=r,o.suspendedLanes&=~r;var f=31-Ee(r);o.entangledLanes|=r,o.entanglements[f]=o.entanglements[f]|1073741824|l&261930}function ji(o,r){var l=o.entangledLanes|=r;for(o=o.entanglements;l;){var f=31-Ee(l),g=1<<f;g&r|o[f]&r&&(o[f]|=r),l&=~g}}function zi(o,r){var l=r&-r;return l=(l&42)!==0?1:Ho(l),(l&(o.suspendedLanes|r))!==0?0:l}function Ho(o){switch(o){case 2:o=1;break;case 8:o=4;break;case 32:o=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:o=128;break;case 268435456:o=134217728;break;default:o=0}return o}function Uo(o){return o&=-o,2<o?8<o?(o&134217727)!==0?32:268435456:8:2}function $o(){var o=I.p;return o!==0?o:(o=window.event,o===void 0?32:pN(o.type))}function Vi(o,r){var l=I.p;try{return I.p=o,r()}finally{I.p=l}}var en=Math.random().toString(36).slice(2),ve="__reactFiber$"+en,Me="__reactProps$"+en,gn="__reactContainer$"+en,Co="__reactEvents$"+en,Li="__reactListeners$"+en,zr="__reactHandles$"+en,Ii="__reactResources$"+en,oo="__reactMarker$"+en;function qo(o){delete o[ve],delete o[Me],delete o[Co],delete o[Li],delete o[zr]}function Mn(o){var r=o[ve];if(r)return r;for(var l=o.parentNode;l;){if(r=l[gn]||l[ve]){if(l=r.alternate,r.child!==null||l!==null&&l.child!==null)for(o=W_(o);o!==null;){if(l=o[ve])return l;o=W_(o)}return r}o=l,l=o.parentNode}return null}function yn(o){if(o=o[ve]||o[gn]){var r=o.tag;if(r===5||r===6||r===13||r===31||r===26||r===27||r===3)return o}return null}function Rn(o){var r=o.tag;if(r===5||r===26||r===27||r===6)return o.stateNode;throw Error(i(33))}function kn(o){var r=o[Ii];return r||(r=o[Ii]={hoistableStyles:new Map,hoistableScripts:new Map}),r}function me(o){o[oo]=!0}var Bi=new Set,Pi={};function vn(o,r){On(o,r),On(o+"Capture",r)}function On(o,r){for(Pi[o]=r,o=0;o<r.length;o++)Bi.add(r[o])}var Ds=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),Yo={},Hi={};function Ui(o){return yt.call(Hi,o)?!0:yt.call(Yo,o)?!1:Ds.test(o)?Hi[o]=!0:(Yo[o]=!0,!1)}function He(o,r,l){if(Ui(r))if(l===null)o.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":o.removeAttribute(r);return;case"boolean":var f=r.toLowerCase().slice(0,5);if(f!=="data-"&&f!=="aria-"){o.removeAttribute(r);return}}o.setAttribute(r,""+l)}}function Go(o,r,l){if(l===null)o.removeAttribute(r);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(r);return}o.setAttribute(r,""+l)}}function io(o,r,l,f){if(f===null)o.removeAttribute(l);else{switch(typeof f){case"undefined":case"function":case"symbol":case"boolean":o.removeAttribute(l);return}o.setAttributeNS(r,l,""+f)}}function nn(o){switch(typeof o){case"bigint":case"boolean":case"number":case"string":case"undefined":return o;case"object":return o;default:return""}}function Vu(o){var r=o.type;return(o=o.nodeName)&&o.toLowerCase()==="input"&&(r==="checkbox"||r==="radio")}function vm(o,r,l){var f=Object.getOwnPropertyDescriptor(o.constructor.prototype,r);if(!o.hasOwnProperty(r)&&typeof f<"u"&&typeof f.get=="function"&&typeof f.set=="function"){var g=f.get,v=f.set;return Object.defineProperty(o,r,{configurable:!0,get:function(){return g.call(this)},set:function(_){l=""+_,v.call(this,_)}}),Object.defineProperty(o,r,{enumerable:f.enumerable}),{getValue:function(){return l},setValue:function(_){l=""+_},stopTracking:function(){o._valueTracker=null,delete o[r]}}}}function js(o){if(!o._valueTracker){var r=Vu(o)?"checked":"value";o._valueTracker=vm(o,r,""+o[r])}}function Lu(o){if(!o)return!1;var r=o._valueTracker;if(!r)return!0;var l=r.getValue(),f="";return o&&(f=Vu(o)?o.checked?"true":"false":o.value),o=f,o!==l?(r.setValue(o),!0):!1}function Vr(o){if(o=o||(typeof document<"u"?document:void 0),typeof o>"u")return null;try{return o.activeElement||o.body}catch{return o.body}}var bm=/[\n"\\]/g;function on(o){return o.replace(bm,function(r){return"\\"+r.charCodeAt(0).toString(16)+" "})}function Lr(o,r,l,f,g,v,_,V){o.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?o.type=_:o.removeAttribute("type"),r!=null?_==="number"?(r===0&&o.value===""||o.value!=r)&&(o.value=""+nn(r)):o.value!==""+nn(r)&&(o.value=""+nn(r)):_!=="submit"&&_!=="reset"||o.removeAttribute("value"),r!=null?fl(o,_,nn(r)):l!=null?fl(o,_,nn(l)):f!=null&&o.removeAttribute("value"),g==null&&v!=null&&(o.defaultChecked=!!v),g!=null&&(o.checked=g&&typeof g!="function"&&typeof g!="symbol"),V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"?o.name=""+nn(V):o.removeAttribute("name")}function Iu(o,r,l,f,g,v,_,V){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(o.type=v),r!=null||l!=null){if(!(v!=="submit"&&v!=="reset"||r!=null)){js(o);return}l=l!=null?""+nn(l):"",r=r!=null?""+nn(r):l,V||r===o.value||(o.value=r),o.defaultValue=r}f=f??g,f=typeof f!="function"&&typeof f!="symbol"&&!!f,o.checked=V?o.checked:!!f,o.defaultChecked=!!f,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(o.name=_),js(o)}function fl(o,r,l){r==="number"&&Vr(o.ownerDocument)===o||o.defaultValue===""+l||(o.defaultValue=""+l)}function Xo(o,r,l,f){if(o=o.options,r){r={};for(var g=0;g<l.length;g++)r["$"+l[g]]=!0;for(l=0;l<o.length;l++)g=r.hasOwnProperty("$"+o[l].value),o[l].selected!==g&&(o[l].selected=g),g&&f&&(o[l].defaultSelected=!0)}else{for(l=""+nn(l),r=null,g=0;g<o.length;g++){if(o[g].value===l){o[g].selected=!0,f&&(o[g].defaultSelected=!0);return}r!==null||o[g].disabled||(r=o[g])}r!==null&&(r.selected=!0)}}function BC(o,r,l){if(r!=null&&(r=""+nn(r),r!==o.value&&(o.value=r),l==null)){o.defaultValue!==r&&(o.defaultValue=r);return}o.defaultValue=l!=null?""+nn(l):""}function PC(o,r,l,f){if(r==null){if(f!=null){if(l!=null)throw Error(i(92));if(P(f)){if(1<f.length)throw Error(i(93));f=f[0]}l=f}l==null&&(l=""),r=l}l=nn(r),o.defaultValue=l,f=o.textContent,f===l&&f!==""&&f!==null&&(o.value=f),js(o)}function zs(o,r){if(r){var l=o.firstChild;if(l&&l===o.lastChild&&l.nodeType===3){l.nodeValue=r;return}}o.textContent=r}var j9=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function HC(o,r,l){var f=r.indexOf("--")===0;l==null||typeof l=="boolean"||l===""?f?o.setProperty(r,""):r==="float"?o.cssFloat="":o[r]="":f?o.setProperty(r,l):typeof l!="number"||l===0||j9.has(r)?r==="float"?o.cssFloat=l:o[r]=(""+l).trim():o[r]=l+"px"}function UC(o,r,l){if(r!=null&&typeof r!="object")throw Error(i(62));if(o=o.style,l!=null){for(var f in l)!l.hasOwnProperty(f)||r!=null&&r.hasOwnProperty(f)||(f.indexOf("--")===0?o.setProperty(f,""):f==="float"?o.cssFloat="":o[f]="");for(var g in r)f=r[g],r.hasOwnProperty(g)&&l[g]!==f&&HC(o,g,f)}else for(var v in r)r.hasOwnProperty(v)&&HC(o,v,r[v])}function xm(o){if(o.indexOf("-")===-1)return!1;switch(o){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var z9=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),V9=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function Bu(o){return V9.test(""+o)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":o}function Fo(){}var wm=null;function Sm(o){return o=o.target||o.srcElement||window,o.correspondingUseElement&&(o=o.correspondingUseElement),o.nodeType===3?o.parentNode:o}var Vs=null,Ls=null;function $C(o){var r=yn(o);if(r&&(o=r.stateNode)){var l=o[Me]||null;t:switch(o=r.stateNode,r.type){case"input":if(Lr(o,l.value,l.defaultValue,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name),r=l.name,l.type==="radio"&&r!=null){for(l=o;l.parentNode;)l=l.parentNode;for(l=l.querySelectorAll('input[name="'+on(""+r)+'"][type="radio"]'),r=0;r<l.length;r++){var f=l[r];if(f!==o&&f.form===o.form){var g=f[Me]||null;if(!g)throw Error(i(90));Lr(f,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(r=0;r<l.length;r++)f=l[r],f.form===o.form&&Lu(f)}break t;case"textarea":BC(o,l.value,l.defaultValue);break t;case"select":r=l.value,r!=null&&Xo(o,!!l.multiple,r,!1)}}}var Em=!1;function qC(o,r,l){if(Em)return o(r,l);Em=!0;try{var f=o(r);return f}finally{if(Em=!1,(Vs!==null||Ls!==null)&&(Nf(),Vs&&(r=Vs,o=Ls,Ls=Vs=null,$C(r),o)))for(r=0;r<o.length;r++)$C(o[r])}}function dl(o,r){var l=o.stateNode;if(l===null)return null;var f=l[Me]||null;if(f===null)return null;l=f[r];t:switch(r){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(f=!f.disabled)||(o=o.type,f=!(o==="button"||o==="input"||o==="select"||o==="textarea")),o=!f;break t;default:o=!1}if(o)return null;if(l&&typeof l!="function")throw Error(i(231,r,typeof l));return l}var Zo=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Cm=!1;if(Zo)try{var hl={};Object.defineProperty(hl,"passive",{get:function(){Cm=!0}}),window.addEventListener("test",hl,hl),window.removeEventListener("test",hl,hl)}catch{Cm=!1}var $i=null,Tm=null,Pu=null;function YC(){if(Pu)return Pu;var o,r=Tm,l=r.length,f,g="value"in $i?$i.value:$i.textContent,v=g.length;for(o=0;o<l&&r[o]===g[o];o++);var _=l-o;for(f=1;f<=_&&r[l-f]===g[v-f];f++);return Pu=g.slice(o,1<f?1-f:void 0)}function Hu(o){var r=o.keyCode;return"charCode"in o?(o=o.charCode,o===0&&r===13&&(o=13)):o=r,o===10&&(o=13),32<=o||o===13?o:0}function Uu(){return!0}function GC(){return!1}function rn(o){function r(l,f,g,v,_){this._reactName=l,this._targetInst=g,this.type=f,this.nativeEvent=v,this.target=_,this.currentTarget=null;for(var V in o)o.hasOwnProperty(V)&&(l=o[V],this[V]=l?l(v):v[V]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Uu:GC,this.isPropagationStopped=GC,this}return m(r.prototype,{preventDefault:function(){this.defaultPrevented=!0;var l=this.nativeEvent;l&&(l.preventDefault?l.preventDefault():typeof l.returnValue!="unknown"&&(l.returnValue=!1),this.isDefaultPrevented=Uu)},stopPropagation:function(){var l=this.nativeEvent;l&&(l.stopPropagation?l.stopPropagation():typeof l.cancelBubble!="unknown"&&(l.cancelBubble=!0),this.isPropagationStopped=Uu)},persist:function(){},isPersistent:Uu}),r}var Ir={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(o){return o.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},$u=rn(Ir),pl=m({},Ir,{view:0,detail:0}),L9=rn(pl),_m,Nm,ml,qu=m({},pl,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Mm,button:0,buttons:0,relatedTarget:function(o){return o.relatedTarget===void 0?o.fromElement===o.srcElement?o.toElement:o.fromElement:o.relatedTarget},movementX:function(o){return"movementX"in o?o.movementX:(o!==ml&&(ml&&o.type==="mousemove"?(_m=o.screenX-ml.screenX,Nm=o.screenY-ml.screenY):Nm=_m=0,ml=o),_m)},movementY:function(o){return"movementY"in o?o.movementY:Nm}}),XC=rn(qu),I9=m({},qu,{dataTransfer:0}),B9=rn(I9),P9=m({},pl,{relatedTarget:0}),Am=rn(P9),H9=m({},Ir,{animationName:0,elapsedTime:0,pseudoElement:0}),U9=rn(H9),$9=m({},Ir,{clipboardData:function(o){return"clipboardData"in o?o.clipboardData:window.clipboardData}}),q9=rn($9),Y9=m({},Ir,{data:0}),FC=rn(Y9),G9={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},X9={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},F9={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Z9(o){var r=this.nativeEvent;return r.getModifierState?r.getModifierState(o):(o=F9[o])?!!r[o]:!1}function Mm(){return Z9}var K9=m({},pl,{key:function(o){if(o.key){var r=G9[o.key]||o.key;if(r!=="Unidentified")return r}return o.type==="keypress"?(o=Hu(o),o===13?"Enter":String.fromCharCode(o)):o.type==="keydown"||o.type==="keyup"?X9[o.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Mm,charCode:function(o){return o.type==="keypress"?Hu(o):0},keyCode:function(o){return o.type==="keydown"||o.type==="keyup"?o.keyCode:0},which:function(o){return o.type==="keypress"?Hu(o):o.type==="keydown"||o.type==="keyup"?o.keyCode:0}}),Q9=rn(K9),W9=m({},qu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ZC=rn(W9),J9=m({},pl,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Mm}),t$=rn(J9),e$=m({},Ir,{propertyName:0,elapsedTime:0,pseudoElement:0}),n$=rn(e$),o$=m({},qu,{deltaX:function(o){return"deltaX"in o?o.deltaX:"wheelDeltaX"in o?-o.wheelDeltaX:0},deltaY:function(o){return"deltaY"in o?o.deltaY:"wheelDeltaY"in o?-o.wheelDeltaY:"wheelDelta"in o?-o.wheelDelta:0},deltaZ:0,deltaMode:0}),i$=rn(o$),r$=m({},Ir,{newState:0,oldState:0}),s$=rn(r$),a$=[9,13,27,32],Rm=Zo&&"CompositionEvent"in window,gl=null;Zo&&"documentMode"in document&&(gl=document.documentMode);var l$=Zo&&"TextEvent"in window&&!gl,KC=Zo&&(!Rm||gl&&8<gl&&11>=gl),QC=" ",WC=!1;function JC(o,r){switch(o){case"keyup":return a$.indexOf(r.keyCode)!==-1;case"keydown":return r.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function t2(o){return o=o.detail,typeof o=="object"&&"data"in o?o.data:null}var Is=!1;function c$(o,r){switch(o){case"compositionend":return t2(r);case"keypress":return r.which!==32?null:(WC=!0,QC);case"textInput":return o=r.data,o===QC&&WC?null:o;default:return null}}function u$(o,r){if(Is)return o==="compositionend"||!Rm&&JC(o,r)?(o=YC(),Pu=Tm=$i=null,Is=!1,o):null;switch(o){case"paste":return null;case"keypress":if(!(r.ctrlKey||r.altKey||r.metaKey)||r.ctrlKey&&r.altKey){if(r.char&&1<r.char.length)return r.char;if(r.which)return String.fromCharCode(r.which)}return null;case"compositionend":return KC&&r.locale!=="ko"?null:r.data;default:return null}}var f$={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function e2(o){var r=o&&o.nodeName&&o.nodeName.toLowerCase();return r==="input"?!!f$[o.type]:r==="textarea"}function n2(o,r,l,f){Vs?Ls?Ls.push(f):Ls=[f]:Vs=f,r=jf(r,"onChange"),0<r.length&&(l=new $u("onChange","change",null,l,f),o.push({event:l,listeners:r}))}var yl=null,vl=null;function d$(o){I_(o,0)}function Yu(o){var r=Rn(o);if(Lu(r))return o}function o2(o,r){if(o==="change")return r}var i2=!1;if(Zo){var km;if(Zo){var Om="oninput"in document;if(!Om){var r2=document.createElement("div");r2.setAttribute("oninput","return;"),Om=typeof r2.oninput=="function"}km=Om}else km=!1;i2=km&&(!document.documentMode||9<document.documentMode)}function s2(){yl&&(yl.detachEvent("onpropertychange",a2),vl=yl=null)}function a2(o){if(o.propertyName==="value"&&Yu(vl)){var r=[];n2(r,vl,o,Sm(o)),qC(d$,r)}}function h$(o,r,l){o==="focusin"?(s2(),yl=r,vl=l,yl.attachEvent("onpropertychange",a2)):o==="focusout"&&s2()}function p$(o){if(o==="selectionchange"||o==="keyup"||o==="keydown")return Yu(vl)}function m$(o,r){if(o==="click")return Yu(r)}function g$(o,r){if(o==="input"||o==="change")return Yu(r)}function y$(o,r){return o===r&&(o!==0||1/o===1/r)||o!==o&&r!==r}var bn=typeof Object.is=="function"?Object.is:y$;function bl(o,r){if(bn(o,r))return!0;if(typeof o!="object"||o===null||typeof r!="object"||r===null)return!1;var l=Object.keys(o),f=Object.keys(r);if(l.length!==f.length)return!1;for(f=0;f<l.length;f++){var g=l[f];if(!yt.call(r,g)||!bn(o[g],r[g]))return!1}return!0}function l2(o){for(;o&&o.firstChild;)o=o.firstChild;return o}function c2(o,r){var l=l2(o);o=0;for(var f;l;){if(l.nodeType===3){if(f=o+l.textContent.length,o<=r&&f>=r)return{node:l,offset:r-o};o=f}t:{for(;l;){if(l.nextSibling){l=l.nextSibling;break t}l=l.parentNode}l=void 0}l=l2(l)}}function u2(o,r){return o&&r?o===r?!0:o&&o.nodeType===3?!1:r&&r.nodeType===3?u2(o,r.parentNode):"contains"in o?o.contains(r):o.compareDocumentPosition?!!(o.compareDocumentPosition(r)&16):!1:!1}function f2(o){o=o!=null&&o.ownerDocument!=null&&o.ownerDocument.defaultView!=null?o.ownerDocument.defaultView:window;for(var r=Vr(o.document);r instanceof o.HTMLIFrameElement;){try{var l=typeof r.contentWindow.location.href=="string"}catch{l=!1}if(l)o=r.contentWindow;else break;r=Vr(o.document)}return r}function Dm(o){var r=o&&o.nodeName&&o.nodeName.toLowerCase();return r&&(r==="input"&&(o.type==="text"||o.type==="search"||o.type==="tel"||o.type==="url"||o.type==="password")||r==="textarea"||o.contentEditable==="true")}var v$=Zo&&"documentMode"in document&&11>=document.documentMode,Bs=null,jm=null,xl=null,zm=!1;function d2(o,r,l){var f=l.window===l?l.document:l.nodeType===9?l:l.ownerDocument;zm||Bs==null||Bs!==Vr(f)||(f=Bs,"selectionStart"in f&&Dm(f)?f={start:f.selectionStart,end:f.selectionEnd}:(f=(f.ownerDocument&&f.ownerDocument.defaultView||window).getSelection(),f={anchorNode:f.anchorNode,anchorOffset:f.anchorOffset,focusNode:f.focusNode,focusOffset:f.focusOffset}),xl&&bl(xl,f)||(xl=f,f=jf(jm,"onSelect"),0<f.length&&(r=new $u("onSelect","select",null,r,l),o.push({event:r,listeners:f}),r.target=Bs)))}function Br(o,r){var l={};return l[o.toLowerCase()]=r.toLowerCase(),l["Webkit"+o]="webkit"+r,l["Moz"+o]="moz"+r,l}var Ps={animationend:Br("Animation","AnimationEnd"),animationiteration:Br("Animation","AnimationIteration"),animationstart:Br("Animation","AnimationStart"),transitionrun:Br("Transition","TransitionRun"),transitionstart:Br("Transition","TransitionStart"),transitioncancel:Br("Transition","TransitionCancel"),transitionend:Br("Transition","TransitionEnd")},Vm={},h2={};Zo&&(h2=document.createElement("div").style,"AnimationEvent"in window||(delete Ps.animationend.animation,delete Ps.animationiteration.animation,delete Ps.animationstart.animation),"TransitionEvent"in window||delete Ps.transitionend.transition);function Pr(o){if(Vm[o])return Vm[o];if(!Ps[o])return o;var r=Ps[o],l;for(l in r)if(r.hasOwnProperty(l)&&l in h2)return Vm[o]=r[l];return o}var p2=Pr("animationend"),m2=Pr("animationiteration"),g2=Pr("animationstart"),b$=Pr("transitionrun"),x$=Pr("transitionstart"),w$=Pr("transitioncancel"),y2=Pr("transitionend"),v2=new Map,Lm="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Lm.push("scrollEnd");function ro(o,r){v2.set(o,r),vn(r,[o])}var Gu=typeof reportError=="function"?reportError:function(o){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var r=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof o=="object"&&o!==null&&typeof o.message=="string"?String(o.message):String(o),error:o});if(!window.dispatchEvent(r))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",o);return}console.error(o)},Dn=[],Hs=0,Im=0;function Xu(){for(var o=Hs,r=Im=Hs=0;r<o;){var l=Dn[r];Dn[r++]=null;var f=Dn[r];Dn[r++]=null;var g=Dn[r];Dn[r++]=null;var v=Dn[r];if(Dn[r++]=null,f!==null&&g!==null){var _=f.pending;_===null?g.next=g:(g.next=_.next,_.next=g),f.pending=g}v!==0&&b2(l,g,v)}}function Fu(o,r,l,f){Dn[Hs++]=o,Dn[Hs++]=r,Dn[Hs++]=l,Dn[Hs++]=f,Im|=f,o.lanes|=f,o=o.alternate,o!==null&&(o.lanes|=f)}function Bm(o,r,l,f){return Fu(o,r,l,f),Zu(o)}function Hr(o,r){return Fu(o,null,null,r),Zu(o)}function b2(o,r,l){o.lanes|=l;var f=o.alternate;f!==null&&(f.lanes|=l);for(var g=!1,v=o.return;v!==null;)v.childLanes|=l,f=v.alternate,f!==null&&(f.childLanes|=l),v.tag===22&&(o=v.stateNode,o===null||o._visibility&1||(g=!0)),o=v,v=v.return;return o.tag===3?(v=o.stateNode,g&&r!==null&&(g=31-Ee(l),o=v.hiddenUpdates,f=o[g],f===null?o[g]=[r]:f.push(r),r.lane=l|536870912),v):null}function Zu(o){if(50<Ul)throw Ul=0,Fg=null,Error(i(185));for(var r=o.return;r!==null;)o=r,r=o.return;return o.tag===3?o.stateNode:null}var Us={};function S$(o,r,l,f){this.tag=o,this.key=l,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=r,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=f,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function xn(o,r,l,f){return new S$(o,r,l,f)}function Pm(o){return o=o.prototype,!(!o||!o.isReactComponent)}function Ko(o,r){var l=o.alternate;return l===null?(l=xn(o.tag,r,o.key,o.mode),l.elementType=o.elementType,l.type=o.type,l.stateNode=o.stateNode,l.alternate=o,o.alternate=l):(l.pendingProps=r,l.type=o.type,l.flags=0,l.subtreeFlags=0,l.deletions=null),l.flags=o.flags&65011712,l.childLanes=o.childLanes,l.lanes=o.lanes,l.child=o.child,l.memoizedProps=o.memoizedProps,l.memoizedState=o.memoizedState,l.updateQueue=o.updateQueue,r=o.dependencies,l.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext},l.sibling=o.sibling,l.index=o.index,l.ref=o.ref,l.refCleanup=o.refCleanup,l}function x2(o,r){o.flags&=65011714;var l=o.alternate;return l===null?(o.childLanes=0,o.lanes=r,o.child=null,o.subtreeFlags=0,o.memoizedProps=null,o.memoizedState=null,o.updateQueue=null,o.dependencies=null,o.stateNode=null):(o.childLanes=l.childLanes,o.lanes=l.lanes,o.child=l.child,o.subtreeFlags=0,o.deletions=null,o.memoizedProps=l.memoizedProps,o.memoizedState=l.memoizedState,o.updateQueue=l.updateQueue,o.type=l.type,r=l.dependencies,o.dependencies=r===null?null:{lanes:r.lanes,firstContext:r.firstContext}),o}function Ku(o,r,l,f,g,v){var _=0;if(f=o,typeof o=="function")Pm(o)&&(_=1);else if(typeof o=="string")_=N7(o,l,it.current)?26:o==="html"||o==="head"||o==="body"?27:5;else t:switch(o){case H:return o=xn(31,l,r,g),o.elementType=H,o.lanes=v,o;case w:return Ur(l.children,g,v,r);case S:_=8,g|=24;break;case E:return o=xn(12,l,r,g|2),o.elementType=E,o.lanes=v,o;case R:return o=xn(13,l,r,g),o.elementType=R,o.lanes=v,o;case A:return o=xn(19,l,r,g),o.elementType=A,o.lanes=v,o;default:if(typeof o=="object"&&o!==null)switch(o.$$typeof){case T:_=10;break t;case D:_=9;break t;case C:_=11;break t;case O:_=14;break t;case k:_=16,f=null;break t}_=29,l=Error(i(130,o===null?"null":typeof o,"")),f=null}return r=xn(_,l,r,g),r.elementType=o,r.type=f,r.lanes=v,r}function Ur(o,r,l,f){return o=xn(7,o,f,r),o.lanes=l,o}function Hm(o,r,l){return o=xn(6,o,null,r),o.lanes=l,o}function w2(o){var r=xn(18,null,null,0);return r.stateNode=o,r}function Um(o,r,l){return r=xn(4,o.children!==null?o.children:[],o.key,r),r.lanes=l,r.stateNode={containerInfo:o.containerInfo,pendingChildren:null,implementation:o.implementation},r}var S2=new WeakMap;function jn(o,r){if(typeof o=="object"&&o!==null){var l=S2.get(o);return l!==void 0?l:(r={value:o,source:r,stack:gt(r)},S2.set(o,r),r)}return{value:o,source:r,stack:gt(r)}}var $s=[],qs=0,Qu=null,wl=0,zn=[],Vn=0,qi=null,To=1,_o="";function Qo(o,r){$s[qs++]=wl,$s[qs++]=Qu,Qu=o,wl=r}function E2(o,r,l){zn[Vn++]=To,zn[Vn++]=_o,zn[Vn++]=qi,qi=o;var f=To;o=_o;var g=32-Ee(f)-1;f&=~(1<<g),l+=1;var v=32-Ee(r)+g;if(30<v){var _=g-g%5;v=(f&(1<<_)-1).toString(32),f>>=_,g-=_,To=1<<32-Ee(r)+g|l<<g|f,_o=v+o}else To=1<<v|l<<g|f,_o=o}function $m(o){o.return!==null&&(Qo(o,1),E2(o,1,0))}function qm(o){for(;o===Qu;)Qu=$s[--qs],$s[qs]=null,wl=$s[--qs],$s[qs]=null;for(;o===qi;)qi=zn[--Vn],zn[Vn]=null,_o=zn[--Vn],zn[Vn]=null,To=zn[--Vn],zn[Vn]=null}function C2(o,r){zn[Vn++]=To,zn[Vn++]=_o,zn[Vn++]=qi,To=r.id,_o=r.overflow,qi=o}var Ue=null,fe=null,Ft=!1,Yi=null,Ln=!1,Ym=Error(i(519));function Gi(o){var r=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Sl(jn(r,o)),Ym}function T2(o){var r=o.stateNode,l=o.type,f=o.memoizedProps;switch(r[ve]=o,r[Me]=f,l){case"dialog":$t("cancel",r),$t("close",r);break;case"iframe":case"object":case"embed":$t("load",r);break;case"video":case"audio":for(l=0;l<ql.length;l++)$t(ql[l],r);break;case"source":$t("error",r);break;case"img":case"image":case"link":$t("error",r),$t("load",r);break;case"details":$t("toggle",r);break;case"input":$t("invalid",r),Iu(r,f.value,f.defaultValue,f.checked,f.defaultChecked,f.type,f.name,!0);break;case"select":$t("invalid",r);break;case"textarea":$t("invalid",r),PC(r,f.value,f.defaultValue,f.children)}l=f.children,typeof l!="string"&&typeof l!="number"&&typeof l!="bigint"||r.textContent===""+l||f.suppressHydrationWarning===!0||U_(r.textContent,l)?(f.popover!=null&&($t("beforetoggle",r),$t("toggle",r)),f.onScroll!=null&&$t("scroll",r),f.onScrollEnd!=null&&$t("scrollend",r),f.onClick!=null&&(r.onclick=Fo),r=!0):r=!1,r||Gi(o,!0)}function _2(o){for(Ue=o.return;Ue;)switch(Ue.tag){case 5:case 31:case 13:Ln=!1;return;case 27:case 3:Ln=!0;return;default:Ue=Ue.return}}function Ys(o){if(o!==Ue)return!1;if(!Ft)return _2(o),Ft=!0,!1;var r=o.tag,l;if((l=r!==3&&r!==27)&&((l=r===5)&&(l=o.type,l=!(l!=="form"&&l!=="button")||c0(o.type,o.memoizedProps)),l=!l),l&&fe&&Gi(o),_2(o),r===13){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(317));fe=Q_(o)}else if(r===31){if(o=o.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(317));fe=Q_(o)}else r===27?(r=fe,sr(o.type)?(o=p0,p0=null,fe=o):fe=r):fe=Ue?Bn(o.stateNode.nextSibling):null;return!0}function $r(){fe=Ue=null,Ft=!1}function Gm(){var o=Yi;return o!==null&&(cn===null?cn=o:cn.push.apply(cn,o),Yi=null),o}function Sl(o){Yi===null?Yi=[o]:Yi.push(o)}var Xm=L(null),qr=null,Wo=null;function Xi(o,r,l){tt(Xm,r._currentValue),r._currentValue=l}function Jo(o){o._currentValue=Xm.current,G(Xm)}function Fm(o,r,l){for(;o!==null;){var f=o.alternate;if((o.childLanes&r)!==r?(o.childLanes|=r,f!==null&&(f.childLanes|=r)):f!==null&&(f.childLanes&r)!==r&&(f.childLanes|=r),o===l)break;o=o.return}}function Zm(o,r,l,f){var g=o.child;for(g!==null&&(g.return=o);g!==null;){var v=g.dependencies;if(v!==null){var _=g.child;v=v.firstContext;t:for(;v!==null;){var V=v;v=g;for(var X=0;X<r.length;X++)if(V.context===r[X]){v.lanes|=l,V=v.alternate,V!==null&&(V.lanes|=l),Fm(v.return,l,o),f||(_=null);break t}v=V.next}}else if(g.tag===18){if(_=g.return,_===null)throw Error(i(341));_.lanes|=l,v=_.alternate,v!==null&&(v.lanes|=l),Fm(_,l,o),_=null}else _=g.child;if(_!==null)_.return=g;else for(_=g;_!==null;){if(_===o){_=null;break}if(g=_.sibling,g!==null){g.return=_.return,_=g;break}_=_.return}g=_}}function Gs(o,r,l,f){o=null;for(var g=r,v=!1;g!==null;){if(!v){if((g.flags&524288)!==0)v=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var _=g.alternate;if(_===null)throw Error(i(387));if(_=_.memoizedProps,_!==null){var V=g.type;bn(g.pendingProps.value,_.value)||(o!==null?o.push(V):o=[V])}}else if(g===ft.current){if(_=g.alternate,_===null)throw Error(i(387));_.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(o!==null?o.push(Zl):o=[Zl])}g=g.return}o!==null&&Zm(r,o,l,f),r.flags|=262144}function Wu(o){for(o=o.firstContext;o!==null;){if(!bn(o.context._currentValue,o.memoizedValue))return!0;o=o.next}return!1}function Yr(o){qr=o,Wo=null,o=o.dependencies,o!==null&&(o.firstContext=null)}function $e(o){return N2(qr,o)}function Ju(o,r){return qr===null&&Yr(o),N2(o,r)}function N2(o,r){var l=r._currentValue;if(r={context:r,memoizedValue:l,next:null},Wo===null){if(o===null)throw Error(i(308));Wo=r,o.dependencies={lanes:0,firstContext:r},o.flags|=524288}else Wo=Wo.next=r;return l}var E$=typeof AbortController<"u"?AbortController:function(){var o=[],r=this.signal={aborted:!1,addEventListener:function(l,f){o.push(f)}};this.abort=function(){r.aborted=!0,o.forEach(function(l){return l()})}},C$=t.unstable_scheduleCallback,T$=t.unstable_NormalPriority,Re={$$typeof:T,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Km(){return{controller:new E$,data:new Map,refCount:0}}function El(o){o.refCount--,o.refCount===0&&C$(T$,function(){o.controller.abort()})}var Cl=null,Qm=0,Xs=0,Fs=null;function _$(o,r){if(Cl===null){var l=Cl=[];Qm=0,Xs=t0(),Fs={status:"pending",value:void 0,then:function(f){l.push(f)}}}return Qm++,r.then(A2,A2),r}function A2(){if(--Qm===0&&Cl!==null){Fs!==null&&(Fs.status="fulfilled");var o=Cl;Cl=null,Xs=0,Fs=null;for(var r=0;r<o.length;r++)(0,o[r])()}}function N$(o,r){var l=[],f={status:"pending",value:null,reason:null,then:function(g){l.push(g)}};return o.then(function(){f.status="fulfilled",f.value=r;for(var g=0;g<l.length;g++)(0,l[g])(r)},function(g){for(f.status="rejected",f.reason=g,g=0;g<l.length;g++)(0,l[g])(void 0)}),f}var M2=j.S;j.S=function(o,r){d_=zt(),typeof r=="object"&&r!==null&&typeof r.then=="function"&&_$(o,r),M2!==null&&M2(o,r)};var Gr=L(null);function Wm(){var o=Gr.current;return o!==null?o:se.pooledCache}function tf(o,r){r===null?tt(Gr,Gr.current):tt(Gr,r.pool)}function R2(){var o=Wm();return o===null?null:{parent:Re._currentValue,pool:o}}var Zs=Error(i(460)),Jm=Error(i(474)),ef=Error(i(542)),nf={then:function(){}};function k2(o){return o=o.status,o==="fulfilled"||o==="rejected"}function O2(o,r,l){switch(l=o[l],l===void 0?o.push(r):l!==r&&(r.then(Fo,Fo),r=l),r.status){case"fulfilled":return r.value;case"rejected":throw o=r.reason,j2(o),o;default:if(typeof r.status=="string")r.then(Fo,Fo);else{if(o=se,o!==null&&100<o.shellSuspendCounter)throw Error(i(482));o=r,o.status="pending",o.then(function(f){if(r.status==="pending"){var g=r;g.status="fulfilled",g.value=f}},function(f){if(r.status==="pending"){var g=r;g.status="rejected",g.reason=f}})}switch(r.status){case"fulfilled":return r.value;case"rejected":throw o=r.reason,j2(o),o}throw Fr=r,Zs}}function Xr(o){try{var r=o._init;return r(o._payload)}catch(l){throw l!==null&&typeof l=="object"&&typeof l.then=="function"?(Fr=l,Zs):l}}var Fr=null;function D2(){if(Fr===null)throw Error(i(459));var o=Fr;return Fr=null,o}function j2(o){if(o===Zs||o===ef)throw Error(i(483))}var Ks=null,Tl=0;function of(o){var r=Tl;return Tl+=1,Ks===null&&(Ks=[]),O2(Ks,o,r)}function _l(o,r){r=r.props.ref,o.ref=r!==void 0?r:null}function rf(o,r){throw r.$$typeof===y?Error(i(525)):(o=Object.prototype.toString.call(r),Error(i(31,o==="[object Object]"?"object with keys {"+Object.keys(r).join(", ")+"}":o)))}function z2(o){function r(W,K){if(o){var et=W.deletions;et===null?(W.deletions=[K],W.flags|=16):et.push(K)}}function l(W,K){if(!o)return null;for(;K!==null;)r(W,K),K=K.sibling;return null}function f(W){for(var K=new Map;W!==null;)W.key!==null?K.set(W.key,W):K.set(W.index,W),W=W.sibling;return K}function g(W,K){return W=Ko(W,K),W.index=0,W.sibling=null,W}function v(W,K,et){return W.index=et,o?(et=W.alternate,et!==null?(et=et.index,et<K?(W.flags|=67108866,K):et):(W.flags|=67108866,K)):(W.flags|=1048576,K)}function _(W){return o&&W.alternate===null&&(W.flags|=67108866),W}function V(W,K,et,at){return K===null||K.tag!==6?(K=Hm(et,W.mode,at),K.return=W,K):(K=g(K,et),K.return=W,K)}function X(W,K,et,at){var Rt=et.type;return Rt===w?st(W,K,et.props.children,at,et.key):K!==null&&(K.elementType===Rt||typeof Rt=="object"&&Rt!==null&&Rt.$$typeof===k&&Xr(Rt)===K.type)?(K=g(K,et.props),_l(K,et),K.return=W,K):(K=Ku(et.type,et.key,et.props,null,W.mode,at),_l(K,et),K.return=W,K)}function nt(W,K,et,at){return K===null||K.tag!==4||K.stateNode.containerInfo!==et.containerInfo||K.stateNode.implementation!==et.implementation?(K=Um(et,W.mode,at),K.return=W,K):(K=g(K,et.children||[]),K.return=W,K)}function st(W,K,et,at,Rt){return K===null||K.tag!==7?(K=Ur(et,W.mode,at,Rt),K.return=W,K):(K=g(K,et),K.return=W,K)}function ct(W,K,et){if(typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint")return K=Hm(""+K,W.mode,et),K.return=W,K;if(typeof K=="object"&&K!==null){switch(K.$$typeof){case b:return et=Ku(K.type,K.key,K.props,null,W.mode,et),_l(et,K),et.return=W,et;case x:return K=Um(K,W.mode,et),K.return=W,K;case k:return K=Xr(K),ct(W,K,et)}if(P(K)||F(K))return K=Ur(K,W.mode,et,null),K.return=W,K;if(typeof K.then=="function")return ct(W,of(K),et);if(K.$$typeof===T)return ct(W,Ju(W,K),et);rf(W,K)}return null}function ot(W,K,et,at){var Rt=K!==null?K.key:null;if(typeof et=="string"&&et!==""||typeof et=="number"||typeof et=="bigint")return Rt!==null?null:V(W,K,""+et,at);if(typeof et=="object"&&et!==null){switch(et.$$typeof){case b:return et.key===Rt?X(W,K,et,at):null;case x:return et.key===Rt?nt(W,K,et,at):null;case k:return et=Xr(et),ot(W,K,et,at)}if(P(et)||F(et))return Rt!==null?null:st(W,K,et,at,null);if(typeof et.then=="function")return ot(W,K,of(et),at);if(et.$$typeof===T)return ot(W,K,Ju(W,et),at);rf(W,et)}return null}function rt(W,K,et,at,Rt){if(typeof at=="string"&&at!==""||typeof at=="number"||typeof at=="bigint")return W=W.get(et)||null,V(K,W,""+at,Rt);if(typeof at=="object"&&at!==null){switch(at.$$typeof){case b:return W=W.get(at.key===null?et:at.key)||null,X(K,W,at,Rt);case x:return W=W.get(at.key===null?et:at.key)||null,nt(K,W,at,Rt);case k:return at=Xr(at),rt(W,K,et,at,Rt)}if(P(at)||F(at))return W=W.get(et)||null,st(K,W,at,Rt,null);if(typeof at.then=="function")return rt(W,K,et,of(at),Rt);if(at.$$typeof===T)return rt(W,K,et,Ju(K,at),Rt);rf(K,at)}return null}function xt(W,K,et,at){for(var Rt=null,Kt=null,_t=K,Bt=K=0,Gt=null;_t!==null&&Bt<et.length;Bt++){_t.index>Bt?(Gt=_t,_t=null):Gt=_t.sibling;var Qt=ot(W,_t,et[Bt],at);if(Qt===null){_t===null&&(_t=Gt);break}o&&_t&&Qt.alternate===null&&r(W,_t),K=v(Qt,K,Bt),Kt===null?Rt=Qt:Kt.sibling=Qt,Kt=Qt,_t=Gt}if(Bt===et.length)return l(W,_t),Ft&&Qo(W,Bt),Rt;if(_t===null){for(;Bt<et.length;Bt++)_t=ct(W,et[Bt],at),_t!==null&&(K=v(_t,K,Bt),Kt===null?Rt=_t:Kt.sibling=_t,Kt=_t);return Ft&&Qo(W,Bt),Rt}for(_t=f(_t);Bt<et.length;Bt++)Gt=rt(_t,W,Bt,et[Bt],at),Gt!==null&&(o&&Gt.alternate!==null&&_t.delete(Gt.key===null?Bt:Gt.key),K=v(Gt,K,Bt),Kt===null?Rt=Gt:Kt.sibling=Gt,Kt=Gt);return o&&_t.forEach(function(fr){return r(W,fr)}),Ft&&Qo(W,Bt),Rt}function Ot(W,K,et,at){if(et==null)throw Error(i(151));for(var Rt=null,Kt=null,_t=K,Bt=K=0,Gt=null,Qt=et.next();_t!==null&&!Qt.done;Bt++,Qt=et.next()){_t.index>Bt?(Gt=_t,_t=null):Gt=_t.sibling;var fr=ot(W,_t,Qt.value,at);if(fr===null){_t===null&&(_t=Gt);break}o&&_t&&fr.alternate===null&&r(W,_t),K=v(fr,K,Bt),Kt===null?Rt=fr:Kt.sibling=fr,Kt=fr,_t=Gt}if(Qt.done)return l(W,_t),Ft&&Qo(W,Bt),Rt;if(_t===null){for(;!Qt.done;Bt++,Qt=et.next())Qt=ct(W,Qt.value,at),Qt!==null&&(K=v(Qt,K,Bt),Kt===null?Rt=Qt:Kt.sibling=Qt,Kt=Qt);return Ft&&Qo(W,Bt),Rt}for(_t=f(_t);!Qt.done;Bt++,Qt=et.next())Qt=rt(_t,W,Bt,Qt.value,at),Qt!==null&&(o&&Qt.alternate!==null&&_t.delete(Qt.key===null?Bt:Qt.key),K=v(Qt,K,Bt),Kt===null?Rt=Qt:Kt.sibling=Qt,Kt=Qt);return o&&_t.forEach(function(I7){return r(W,I7)}),Ft&&Qo(W,Bt),Rt}function ie(W,K,et,at){if(typeof et=="object"&&et!==null&&et.type===w&&et.key===null&&(et=et.props.children),typeof et=="object"&&et!==null){switch(et.$$typeof){case b:t:{for(var Rt=et.key;K!==null;){if(K.key===Rt){if(Rt=et.type,Rt===w){if(K.tag===7){l(W,K.sibling),at=g(K,et.props.children),at.return=W,W=at;break t}}else if(K.elementType===Rt||typeof Rt=="object"&&Rt!==null&&Rt.$$typeof===k&&Xr(Rt)===K.type){l(W,K.sibling),at=g(K,et.props),_l(at,et),at.return=W,W=at;break t}l(W,K);break}else r(W,K);K=K.sibling}et.type===w?(at=Ur(et.props.children,W.mode,at,et.key),at.return=W,W=at):(at=Ku(et.type,et.key,et.props,null,W.mode,at),_l(at,et),at.return=W,W=at)}return _(W);case x:t:{for(Rt=et.key;K!==null;){if(K.key===Rt)if(K.tag===4&&K.stateNode.containerInfo===et.containerInfo&&K.stateNode.implementation===et.implementation){l(W,K.sibling),at=g(K,et.children||[]),at.return=W,W=at;break t}else{l(W,K);break}else r(W,K);K=K.sibling}at=Um(et,W.mode,at),at.return=W,W=at}return _(W);case k:return et=Xr(et),ie(W,K,et,at)}if(P(et))return xt(W,K,et,at);if(F(et)){if(Rt=F(et),typeof Rt!="function")throw Error(i(150));return et=Rt.call(et),Ot(W,K,et,at)}if(typeof et.then=="function")return ie(W,K,of(et),at);if(et.$$typeof===T)return ie(W,K,Ju(W,et),at);rf(W,et)}return typeof et=="string"&&et!==""||typeof et=="number"||typeof et=="bigint"?(et=""+et,K!==null&&K.tag===6?(l(W,K.sibling),at=g(K,et),at.return=W,W=at):(l(W,K),at=Hm(et,W.mode,at),at.return=W,W=at),_(W)):l(W,K)}return function(W,K,et,at){try{Tl=0;var Rt=ie(W,K,et,at);return Ks=null,Rt}catch(_t){if(_t===Zs||_t===ef)throw _t;var Kt=xn(29,_t,null,W.mode);return Kt.lanes=at,Kt.return=W,Kt}}}var Zr=z2(!0),V2=z2(!1),Fi=!1;function tg(o){o.updateQueue={baseState:o.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function eg(o,r){o=o.updateQueue,r.updateQueue===o&&(r.updateQueue={baseState:o.baseState,firstBaseUpdate:o.firstBaseUpdate,lastBaseUpdate:o.lastBaseUpdate,shared:o.shared,callbacks:null})}function Zi(o){return{lane:o,tag:0,payload:null,callback:null,next:null}}function Ki(o,r,l){var f=o.updateQueue;if(f===null)return null;if(f=f.shared,(Wt&2)!==0){var g=f.pending;return g===null?r.next=r:(r.next=g.next,g.next=r),f.pending=r,r=Zu(o),b2(o,null,l),r}return Fu(o,f,r,l),Zu(o)}function Nl(o,r,l){if(r=r.updateQueue,r!==null&&(r=r.shared,(l&4194048)!==0)){var f=r.lanes;f&=o.pendingLanes,l|=f,r.lanes=l,ji(o,l)}}function ng(o,r){var l=o.updateQueue,f=o.alternate;if(f!==null&&(f=f.updateQueue,l===f)){var g=null,v=null;if(l=l.firstBaseUpdate,l!==null){do{var _={lane:l.lane,tag:l.tag,payload:l.payload,callback:null,next:null};v===null?g=v=_:v=v.next=_,l=l.next}while(l!==null);v===null?g=v=r:v=v.next=r}else g=v=r;l={baseState:f.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:f.shared,callbacks:f.callbacks},o.updateQueue=l;return}o=l.lastBaseUpdate,o===null?l.firstBaseUpdate=r:o.next=r,l.lastBaseUpdate=r}var og=!1;function Al(){if(og){var o=Fs;if(o!==null)throw o}}function Ml(o,r,l,f){og=!1;var g=o.updateQueue;Fi=!1;var v=g.firstBaseUpdate,_=g.lastBaseUpdate,V=g.shared.pending;if(V!==null){g.shared.pending=null;var X=V,nt=X.next;X.next=null,_===null?v=nt:_.next=nt,_=X;var st=o.alternate;st!==null&&(st=st.updateQueue,V=st.lastBaseUpdate,V!==_&&(V===null?st.firstBaseUpdate=nt:V.next=nt,st.lastBaseUpdate=X))}if(v!==null){var ct=g.baseState;_=0,st=nt=X=null,V=v;do{var ot=V.lane&-536870913,rt=ot!==V.lane;if(rt?(Yt&ot)===ot:(f&ot)===ot){ot!==0&&ot===Xs&&(og=!0),st!==null&&(st=st.next={lane:0,tag:V.tag,payload:V.payload,callback:null,next:null});t:{var xt=o,Ot=V;ot=r;var ie=l;switch(Ot.tag){case 1:if(xt=Ot.payload,typeof xt=="function"){ct=xt.call(ie,ct,ot);break t}ct=xt;break t;case 3:xt.flags=xt.flags&-65537|128;case 0:if(xt=Ot.payload,ot=typeof xt=="function"?xt.call(ie,ct,ot):xt,ot==null)break t;ct=m({},ct,ot);break t;case 2:Fi=!0}}ot=V.callback,ot!==null&&(o.flags|=64,rt&&(o.flags|=8192),rt=g.callbacks,rt===null?g.callbacks=[ot]:rt.push(ot))}else rt={lane:ot,tag:V.tag,payload:V.payload,callback:V.callback,next:null},st===null?(nt=st=rt,X=ct):st=st.next=rt,_|=ot;if(V=V.next,V===null){if(V=g.shared.pending,V===null)break;rt=V,V=rt.next,rt.next=null,g.lastBaseUpdate=rt,g.shared.pending=null}}while(!0);st===null&&(X=ct),g.baseState=X,g.firstBaseUpdate=nt,g.lastBaseUpdate=st,v===null&&(g.shared.lanes=0),er|=_,o.lanes=_,o.memoizedState=ct}}function L2(o,r){if(typeof o!="function")throw Error(i(191,o));o.call(r)}function I2(o,r){var l=o.callbacks;if(l!==null)for(o.callbacks=null,o=0;o<l.length;o++)L2(l[o],r)}var Qs=L(null),sf=L(0);function B2(o,r){o=li,tt(sf,o),tt(Qs,r),li=o|r.baseLanes}function ig(){tt(sf,li),tt(Qs,Qs.current)}function rg(){li=sf.current,G(Qs),G(sf)}var wn=L(null),In=null;function Qi(o){var r=o.alternate;tt(Ce,Ce.current&1),tt(wn,o),In===null&&(r===null||Qs.current!==null||r.memoizedState!==null)&&(In=o)}function sg(o){tt(Ce,Ce.current),tt(wn,o),In===null&&(In=o)}function P2(o){o.tag===22?(tt(Ce,Ce.current),tt(wn,o),In===null&&(In=o)):Wi()}function Wi(){tt(Ce,Ce.current),tt(wn,wn.current)}function Sn(o){G(wn),In===o&&(In=null),G(Ce)}var Ce=L(0);function af(o){for(var r=o;r!==null;){if(r.tag===13){var l=r.memoizedState;if(l!==null&&(l=l.dehydrated,l===null||d0(l)||h0(l)))return r}else if(r.tag===19&&(r.memoizedProps.revealOrder==="forwards"||r.memoizedProps.revealOrder==="backwards"||r.memoizedProps.revealOrder==="unstable_legacy-backwards"||r.memoizedProps.revealOrder==="together")){if((r.flags&128)!==0)return r}else if(r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break;for(;r.sibling===null;){if(r.return===null||r.return===o)return null;r=r.return}r.sibling.return=r.return,r=r.sibling}return null}var ti=0,It=null,ne=null,ke=null,lf=!1,Ws=!1,Kr=!1,cf=0,Rl=0,Js=null,A$=0;function we(){throw Error(i(321))}function ag(o,r){if(r===null)return!1;for(var l=0;l<r.length&&l<o.length;l++)if(!bn(o[l],r[l]))return!1;return!0}function lg(o,r,l,f,g,v){return ti=v,It=r,r.memoizedState=null,r.updateQueue=null,r.lanes=0,j.H=o===null||o.memoizedState===null?ET:Eg,Kr=!1,v=l(f,g),Kr=!1,Ws&&(v=U2(r,l,f,g)),H2(o),v}function H2(o){j.H=Dl;var r=ne!==null&&ne.next!==null;if(ti=0,ke=ne=It=null,lf=!1,Rl=0,Js=null,r)throw Error(i(300));o===null||Oe||(o=o.dependencies,o!==null&&Wu(o)&&(Oe=!0))}function U2(o,r,l,f){It=o;var g=0;do{if(Ws&&(Js=null),Rl=0,Ws=!1,25<=g)throw Error(i(301));if(g+=1,ke=ne=null,o.updateQueue!=null){var v=o.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}j.H=CT,v=r(l,f)}while(Ws);return v}function M$(){var o=j.H,r=o.useState()[0];return r=typeof r.then=="function"?kl(r):r,o=o.useState()[0],(ne!==null?ne.memoizedState:null)!==o&&(It.flags|=1024),r}function cg(){var o=cf!==0;return cf=0,o}function ug(o,r,l){r.updateQueue=o.updateQueue,r.flags&=-2053,o.lanes&=~l}function fg(o){if(lf){for(o=o.memoizedState;o!==null;){var r=o.queue;r!==null&&(r.pending=null),o=o.next}lf=!1}ti=0,ke=ne=It=null,Ws=!1,Rl=cf=0,Js=null}function Qe(){var o={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return ke===null?It.memoizedState=ke=o:ke=ke.next=o,ke}function Te(){if(ne===null){var o=It.alternate;o=o!==null?o.memoizedState:null}else o=ne.next;var r=ke===null?It.memoizedState:ke.next;if(r!==null)ke=r,ne=o;else{if(o===null)throw It.alternate===null?Error(i(467)):Error(i(310));ne=o,o={memoizedState:ne.memoizedState,baseState:ne.baseState,baseQueue:ne.baseQueue,queue:ne.queue,next:null},ke===null?It.memoizedState=ke=o:ke=ke.next=o}return ke}function uf(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function kl(o){var r=Rl;return Rl+=1,Js===null&&(Js=[]),o=O2(Js,o,r),r=It,(ke===null?r.memoizedState:ke.next)===null&&(r=r.alternate,j.H=r===null||r.memoizedState===null?ET:Eg),o}function ff(o){if(o!==null&&typeof o=="object"){if(typeof o.then=="function")return kl(o);if(o.$$typeof===T)return $e(o)}throw Error(i(438,String(o)))}function dg(o){var r=null,l=It.updateQueue;if(l!==null&&(r=l.memoCache),r==null){var f=It.alternate;f!==null&&(f=f.updateQueue,f!==null&&(f=f.memoCache,f!=null&&(r={data:f.data.map(function(g){return g.slice()}),index:0})))}if(r==null&&(r={data:[],index:0}),l===null&&(l=uf(),It.updateQueue=l),l.memoCache=r,l=r.data[r.index],l===void 0)for(l=r.data[r.index]=Array(o),f=0;f<o;f++)l[f]=$;return r.index++,l}function ei(o,r){return typeof r=="function"?r(o):r}function df(o){var r=Te();return hg(r,ne,o)}function hg(o,r,l){var f=o.queue;if(f===null)throw Error(i(311));f.lastRenderedReducer=l;var g=o.baseQueue,v=f.pending;if(v!==null){if(g!==null){var _=g.next;g.next=v.next,v.next=_}r.baseQueue=g=v,f.pending=null}if(v=o.baseState,g===null)o.memoizedState=v;else{r=g.next;var V=_=null,X=null,nt=r,st=!1;do{var ct=nt.lane&-536870913;if(ct!==nt.lane?(Yt&ct)===ct:(ti&ct)===ct){var ot=nt.revertLane;if(ot===0)X!==null&&(X=X.next={lane:0,revertLane:0,gesture:null,action:nt.action,hasEagerState:nt.hasEagerState,eagerState:nt.eagerState,next:null}),ct===Xs&&(st=!0);else if((ti&ot)===ot){nt=nt.next,ot===Xs&&(st=!0);continue}else ct={lane:0,revertLane:nt.revertLane,gesture:null,action:nt.action,hasEagerState:nt.hasEagerState,eagerState:nt.eagerState,next:null},X===null?(V=X=ct,_=v):X=X.next=ct,It.lanes|=ot,er|=ot;ct=nt.action,Kr&&l(v,ct),v=nt.hasEagerState?nt.eagerState:l(v,ct)}else ot={lane:ct,revertLane:nt.revertLane,gesture:nt.gesture,action:nt.action,hasEagerState:nt.hasEagerState,eagerState:nt.eagerState,next:null},X===null?(V=X=ot,_=v):X=X.next=ot,It.lanes|=ct,er|=ct;nt=nt.next}while(nt!==null&&nt!==r);if(X===null?_=v:X.next=V,!bn(v,o.memoizedState)&&(Oe=!0,st&&(l=Fs,l!==null)))throw l;o.memoizedState=v,o.baseState=_,o.baseQueue=X,f.lastRenderedState=v}return g===null&&(f.lanes=0),[o.memoizedState,f.dispatch]}function pg(o){var r=Te(),l=r.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=o;var f=l.dispatch,g=l.pending,v=r.memoizedState;if(g!==null){l.pending=null;var _=g=g.next;do v=o(v,_.action),_=_.next;while(_!==g);bn(v,r.memoizedState)||(Oe=!0),r.memoizedState=v,r.baseQueue===null&&(r.baseState=v),l.lastRenderedState=v}return[v,f]}function $2(o,r,l){var f=It,g=Te(),v=Ft;if(v){if(l===void 0)throw Error(i(407));l=l()}else l=r();var _=!bn((ne||g).memoizedState,l);if(_&&(g.memoizedState=l,Oe=!0),g=g.queue,yg(G2.bind(null,f,g,o),[o]),g.getSnapshot!==r||_||ke!==null&&ke.memoizedState.tag&1){if(f.flags|=2048,ta(9,{destroy:void 0},Y2.bind(null,f,g,l,r),null),se===null)throw Error(i(349));v||(ti&127)!==0||q2(f,r,l)}return l}function q2(o,r,l){o.flags|=16384,o={getSnapshot:r,value:l},r=It.updateQueue,r===null?(r=uf(),It.updateQueue=r,r.stores=[o]):(l=r.stores,l===null?r.stores=[o]:l.push(o))}function Y2(o,r,l,f){r.value=l,r.getSnapshot=f,X2(r)&&F2(o)}function G2(o,r,l){return l(function(){X2(r)&&F2(o)})}function X2(o){var r=o.getSnapshot;o=o.value;try{var l=r();return!bn(o,l)}catch{return!0}}function F2(o){var r=Hr(o,2);r!==null&&un(r,o,2)}function mg(o){var r=Qe();if(typeof o=="function"){var l=o;if(o=l(),Kr){ee(!0);try{l()}finally{ee(!1)}}}return r.memoizedState=r.baseState=o,r.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:o},r}function Z2(o,r,l,f){return o.baseState=l,hg(o,ne,typeof f=="function"?f:ei)}function R$(o,r,l,f,g){if(mf(o))throw Error(i(485));if(o=r.action,o!==null){var v={payload:g,action:o,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){v.listeners.push(_)}};j.T!==null?l(!0):v.isTransition=!1,f(v),l=r.pending,l===null?(v.next=r.pending=v,K2(r,v)):(v.next=l.next,r.pending=l.next=v)}}function K2(o,r){var l=r.action,f=r.payload,g=o.state;if(r.isTransition){var v=j.T,_={};j.T=_;try{var V=l(g,f),X=j.S;X!==null&&X(_,V),Q2(o,r,V)}catch(nt){gg(o,r,nt)}finally{v!==null&&_.types!==null&&(v.types=_.types),j.T=v}}else try{v=l(g,f),Q2(o,r,v)}catch(nt){gg(o,r,nt)}}function Q2(o,r,l){l!==null&&typeof l=="object"&&typeof l.then=="function"?l.then(function(f){W2(o,r,f)},function(f){return gg(o,r,f)}):W2(o,r,l)}function W2(o,r,l){r.status="fulfilled",r.value=l,J2(r),o.state=l,r=o.pending,r!==null&&(l=r.next,l===r?o.pending=null:(l=l.next,r.next=l,K2(o,l)))}function gg(o,r,l){var f=o.pending;if(o.pending=null,f!==null){f=f.next;do r.status="rejected",r.reason=l,J2(r),r=r.next;while(r!==f)}o.action=null}function J2(o){o=o.listeners;for(var r=0;r<o.length;r++)(0,o[r])()}function tT(o,r){return r}function eT(o,r){if(Ft){var l=se.formState;if(l!==null){t:{var f=It;if(Ft){if(fe){e:{for(var g=fe,v=Ln;g.nodeType!==8;){if(!v){g=null;break e}if(g=Bn(g.nextSibling),g===null){g=null;break e}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){fe=Bn(g.nextSibling),f=g.data==="F!";break t}}Gi(f)}f=!1}f&&(r=l[0])}}return l=Qe(),l.memoizedState=l.baseState=r,f={pending:null,lanes:0,dispatch:null,lastRenderedReducer:tT,lastRenderedState:r},l.queue=f,l=xT.bind(null,It,f),f.dispatch=l,f=mg(!1),v=Sg.bind(null,It,!1,f.queue),f=Qe(),g={state:r,dispatch:null,action:o,pending:null},f.queue=g,l=R$.bind(null,It,g,v,l),g.dispatch=l,f.memoizedState=o,[r,l,!1]}function nT(o){var r=Te();return oT(r,ne,o)}function oT(o,r,l){if(r=hg(o,r,tT)[0],o=df(ei)[0],typeof r=="object"&&r!==null&&typeof r.then=="function")try{var f=kl(r)}catch(_){throw _===Zs?ef:_}else f=r;r=Te();var g=r.queue,v=g.dispatch;return l!==r.memoizedState&&(It.flags|=2048,ta(9,{destroy:void 0},k$.bind(null,g,l),null)),[f,v,o]}function k$(o,r){o.action=r}function iT(o){var r=Te(),l=ne;if(l!==null)return oT(r,l,o);Te(),r=r.memoizedState,l=Te();var f=l.queue.dispatch;return l.memoizedState=o,[r,f,!1]}function ta(o,r,l,f){return o={tag:o,create:l,deps:f,inst:r,next:null},r=It.updateQueue,r===null&&(r=uf(),It.updateQueue=r),l=r.lastEffect,l===null?r.lastEffect=o.next=o:(f=l.next,l.next=o,o.next=f,r.lastEffect=o),o}function rT(){return Te().memoizedState}function hf(o,r,l,f){var g=Qe();It.flags|=o,g.memoizedState=ta(1|r,{destroy:void 0},l,f===void 0?null:f)}function pf(o,r,l,f){var g=Te();f=f===void 0?null:f;var v=g.memoizedState.inst;ne!==null&&f!==null&&ag(f,ne.memoizedState.deps)?g.memoizedState=ta(r,v,l,f):(It.flags|=o,g.memoizedState=ta(1|r,v,l,f))}function sT(o,r){hf(8390656,8,o,r)}function yg(o,r){pf(2048,8,o,r)}function O$(o){It.flags|=4;var r=It.updateQueue;if(r===null)r=uf(),It.updateQueue=r,r.events=[o];else{var l=r.events;l===null?r.events=[o]:l.push(o)}}function aT(o){var r=Te().memoizedState;return O$({ref:r,nextImpl:o}),function(){if((Wt&2)!==0)throw Error(i(440));return r.impl.apply(void 0,arguments)}}function lT(o,r){return pf(4,2,o,r)}function cT(o,r){return pf(4,4,o,r)}function uT(o,r){if(typeof r=="function"){o=o();var l=r(o);return function(){typeof l=="function"?l():r(null)}}if(r!=null)return o=o(),r.current=o,function(){r.current=null}}function fT(o,r,l){l=l!=null?l.concat([o]):null,pf(4,4,uT.bind(null,r,o),l)}function vg(){}function dT(o,r){var l=Te();r=r===void 0?null:r;var f=l.memoizedState;return r!==null&&ag(r,f[1])?f[0]:(l.memoizedState=[o,r],o)}function hT(o,r){var l=Te();r=r===void 0?null:r;var f=l.memoizedState;if(r!==null&&ag(r,f[1]))return f[0];if(f=o(),Kr){ee(!0);try{o()}finally{ee(!1)}}return l.memoizedState=[f,r],f}function bg(o,r,l){return l===void 0||(ti&1073741824)!==0&&(Yt&261930)===0?o.memoizedState=r:(o.memoizedState=l,o=p_(),It.lanes|=o,er|=o,l)}function pT(o,r,l,f){return bn(l,r)?l:Qs.current!==null?(o=bg(o,l,f),bn(o,r)||(Oe=!0),o):(ti&42)===0||(ti&1073741824)!==0&&(Yt&261930)===0?(Oe=!0,o.memoizedState=l):(o=p_(),It.lanes|=o,er|=o,r)}function mT(o,r,l,f,g){var v=I.p;I.p=v!==0&&8>v?v:8;var _=j.T,V={};j.T=V,Sg(o,!1,r,l);try{var X=g(),nt=j.S;if(nt!==null&&nt(V,X),X!==null&&typeof X=="object"&&typeof X.then=="function"){var st=N$(X,f);Ol(o,r,st,Tn(o))}else Ol(o,r,f,Tn(o))}catch(ct){Ol(o,r,{then:function(){},status:"rejected",reason:ct},Tn())}finally{I.p=v,_!==null&&V.types!==null&&(_.types=V.types),j.T=_}}function D$(){}function xg(o,r,l,f){if(o.tag!==5)throw Error(i(476));var g=gT(o).queue;mT(o,g,r,z,l===null?D$:function(){return yT(o),l(f)})}function gT(o){var r=o.memoizedState;if(r!==null)return r;r={memoizedState:z,baseState:z,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:z},next:null};var l={};return r.next={memoizedState:l,baseState:l,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:ei,lastRenderedState:l},next:null},o.memoizedState=r,o=o.alternate,o!==null&&(o.memoizedState=r),r}function yT(o){var r=gT(o);r.next===null&&(r=o.alternate.memoizedState),Ol(o,r.next.queue,{},Tn())}function wg(){return $e(Zl)}function vT(){return Te().memoizedState}function bT(){return Te().memoizedState}function j$(o){for(var r=o.return;r!==null;){switch(r.tag){case 24:case 3:var l=Tn();o=Zi(l);var f=Ki(r,o,l);f!==null&&(un(f,r,l),Nl(f,r,l)),r={cache:Km()},o.payload=r;return}r=r.return}}function z$(o,r,l){var f=Tn();l={lane:f,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null},mf(o)?wT(r,l):(l=Bm(o,r,l,f),l!==null&&(un(l,o,f),ST(l,r,f)))}function xT(o,r,l){var f=Tn();Ol(o,r,l,f)}function Ol(o,r,l,f){var g={lane:f,revertLane:0,gesture:null,action:l,hasEagerState:!1,eagerState:null,next:null};if(mf(o))wT(r,g);else{var v=o.alternate;if(o.lanes===0&&(v===null||v.lanes===0)&&(v=r.lastRenderedReducer,v!==null))try{var _=r.lastRenderedState,V=v(_,l);if(g.hasEagerState=!0,g.eagerState=V,bn(V,_))return Fu(o,r,g,0),se===null&&Xu(),!1}catch{}if(l=Bm(o,r,g,f),l!==null)return un(l,o,f),ST(l,r,f),!0}return!1}function Sg(o,r,l,f){if(f={lane:2,revertLane:t0(),gesture:null,action:f,hasEagerState:!1,eagerState:null,next:null},mf(o)){if(r)throw Error(i(479))}else r=Bm(o,l,f,2),r!==null&&un(r,o,2)}function mf(o){var r=o.alternate;return o===It||r!==null&&r===It}function wT(o,r){Ws=lf=!0;var l=o.pending;l===null?r.next=r:(r.next=l.next,l.next=r),o.pending=r}function ST(o,r,l){if((l&4194048)!==0){var f=r.lanes;f&=o.pendingLanes,l|=f,r.lanes=l,ji(o,l)}}var Dl={readContext:$e,use:ff,useCallback:we,useContext:we,useEffect:we,useImperativeHandle:we,useLayoutEffect:we,useInsertionEffect:we,useMemo:we,useReducer:we,useRef:we,useState:we,useDebugValue:we,useDeferredValue:we,useTransition:we,useSyncExternalStore:we,useId:we,useHostTransitionStatus:we,useFormState:we,useActionState:we,useOptimistic:we,useMemoCache:we,useCacheRefresh:we};Dl.useEffectEvent=we;var ET={readContext:$e,use:ff,useCallback:function(o,r){return Qe().memoizedState=[o,r===void 0?null:r],o},useContext:$e,useEffect:sT,useImperativeHandle:function(o,r,l){l=l!=null?l.concat([o]):null,hf(4194308,4,uT.bind(null,r,o),l)},useLayoutEffect:function(o,r){return hf(4194308,4,o,r)},useInsertionEffect:function(o,r){hf(4,2,o,r)},useMemo:function(o,r){var l=Qe();r=r===void 0?null:r;var f=o();if(Kr){ee(!0);try{o()}finally{ee(!1)}}return l.memoizedState=[f,r],f},useReducer:function(o,r,l){var f=Qe();if(l!==void 0){var g=l(r);if(Kr){ee(!0);try{l(r)}finally{ee(!1)}}}else g=r;return f.memoizedState=f.baseState=g,o={pending:null,lanes:0,dispatch:null,lastRenderedReducer:o,lastRenderedState:g},f.queue=o,o=o.dispatch=z$.bind(null,It,o),[f.memoizedState,o]},useRef:function(o){var r=Qe();return o={current:o},r.memoizedState=o},useState:function(o){o=mg(o);var r=o.queue,l=xT.bind(null,It,r);return r.dispatch=l,[o.memoizedState,l]},useDebugValue:vg,useDeferredValue:function(o,r){var l=Qe();return bg(l,o,r)},useTransition:function(){var o=mg(!1);return o=mT.bind(null,It,o.queue,!0,!1),Qe().memoizedState=o,[!1,o]},useSyncExternalStore:function(o,r,l){var f=It,g=Qe();if(Ft){if(l===void 0)throw Error(i(407));l=l()}else{if(l=r(),se===null)throw Error(i(349));(Yt&127)!==0||q2(f,r,l)}g.memoizedState=l;var v={value:l,getSnapshot:r};return g.queue=v,sT(G2.bind(null,f,v,o),[o]),f.flags|=2048,ta(9,{destroy:void 0},Y2.bind(null,f,v,l,r),null),l},useId:function(){var o=Qe(),r=se.identifierPrefix;if(Ft){var l=_o,f=To;l=(f&~(1<<32-Ee(f)-1)).toString(32)+l,r="_"+r+"R_"+l,l=cf++,0<l&&(r+="H"+l.toString(32)),r+="_"}else l=A$++,r="_"+r+"r_"+l.toString(32)+"_";return o.memoizedState=r},useHostTransitionStatus:wg,useFormState:eT,useActionState:eT,useOptimistic:function(o){var r=Qe();r.memoizedState=r.baseState=o;var l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return r.queue=l,r=Sg.bind(null,It,!0,l),l.dispatch=r,[o,r]},useMemoCache:dg,useCacheRefresh:function(){return Qe().memoizedState=j$.bind(null,It)},useEffectEvent:function(o){var r=Qe(),l={impl:o};return r.memoizedState=l,function(){if((Wt&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}},Eg={readContext:$e,use:ff,useCallback:dT,useContext:$e,useEffect:yg,useImperativeHandle:fT,useInsertionEffect:lT,useLayoutEffect:cT,useMemo:hT,useReducer:df,useRef:rT,useState:function(){return df(ei)},useDebugValue:vg,useDeferredValue:function(o,r){var l=Te();return pT(l,ne.memoizedState,o,r)},useTransition:function(){var o=df(ei)[0],r=Te().memoizedState;return[typeof o=="boolean"?o:kl(o),r]},useSyncExternalStore:$2,useId:vT,useHostTransitionStatus:wg,useFormState:nT,useActionState:nT,useOptimistic:function(o,r){var l=Te();return Z2(l,ne,o,r)},useMemoCache:dg,useCacheRefresh:bT};Eg.useEffectEvent=aT;var CT={readContext:$e,use:ff,useCallback:dT,useContext:$e,useEffect:yg,useImperativeHandle:fT,useInsertionEffect:lT,useLayoutEffect:cT,useMemo:hT,useReducer:pg,useRef:rT,useState:function(){return pg(ei)},useDebugValue:vg,useDeferredValue:function(o,r){var l=Te();return ne===null?bg(l,o,r):pT(l,ne.memoizedState,o,r)},useTransition:function(){var o=pg(ei)[0],r=Te().memoizedState;return[typeof o=="boolean"?o:kl(o),r]},useSyncExternalStore:$2,useId:vT,useHostTransitionStatus:wg,useFormState:iT,useActionState:iT,useOptimistic:function(o,r){var l=Te();return ne!==null?Z2(l,ne,o,r):(l.baseState=o,[o,l.queue.dispatch])},useMemoCache:dg,useCacheRefresh:bT};CT.useEffectEvent=aT;function Cg(o,r,l,f){r=o.memoizedState,l=l(f,r),l=l==null?r:m({},r,l),o.memoizedState=l,o.lanes===0&&(o.updateQueue.baseState=l)}var Tg={enqueueSetState:function(o,r,l){o=o._reactInternals;var f=Tn(),g=Zi(f);g.payload=r,l!=null&&(g.callback=l),r=Ki(o,g,f),r!==null&&(un(r,o,f),Nl(r,o,f))},enqueueReplaceState:function(o,r,l){o=o._reactInternals;var f=Tn(),g=Zi(f);g.tag=1,g.payload=r,l!=null&&(g.callback=l),r=Ki(o,g,f),r!==null&&(un(r,o,f),Nl(r,o,f))},enqueueForceUpdate:function(o,r){o=o._reactInternals;var l=Tn(),f=Zi(l);f.tag=2,r!=null&&(f.callback=r),r=Ki(o,f,l),r!==null&&(un(r,o,l),Nl(r,o,l))}};function TT(o,r,l,f,g,v,_){return o=o.stateNode,typeof o.shouldComponentUpdate=="function"?o.shouldComponentUpdate(f,v,_):r.prototype&&r.prototype.isPureReactComponent?!bl(l,f)||!bl(g,v):!0}function _T(o,r,l,f){o=r.state,typeof r.componentWillReceiveProps=="function"&&r.componentWillReceiveProps(l,f),typeof r.UNSAFE_componentWillReceiveProps=="function"&&r.UNSAFE_componentWillReceiveProps(l,f),r.state!==o&&Tg.enqueueReplaceState(r,r.state,null)}function Qr(o,r){var l=r;if("ref"in r){l={};for(var f in r)f!=="ref"&&(l[f]=r[f])}if(o=o.defaultProps){l===r&&(l=m({},l));for(var g in o)l[g]===void 0&&(l[g]=o[g])}return l}function NT(o){Gu(o)}function AT(o){console.error(o)}function MT(o){Gu(o)}function gf(o,r){try{var l=o.onUncaughtError;l(r.value,{componentStack:r.stack})}catch(f){setTimeout(function(){throw f})}}function RT(o,r,l){try{var f=o.onCaughtError;f(l.value,{componentStack:l.stack,errorBoundary:r.tag===1?r.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function _g(o,r,l){return l=Zi(l),l.tag=3,l.payload={element:null},l.callback=function(){gf(o,r)},l}function kT(o){return o=Zi(o),o.tag=3,o}function OT(o,r,l,f){var g=l.type.getDerivedStateFromError;if(typeof g=="function"){var v=f.value;o.payload=function(){return g(v)},o.callback=function(){RT(r,l,f)}}var _=l.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(o.callback=function(){RT(r,l,f),typeof g!="function"&&(nr===null?nr=new Set([this]):nr.add(this));var V=f.stack;this.componentDidCatch(f.value,{componentStack:V!==null?V:""})})}function V$(o,r,l,f,g){if(l.flags|=32768,f!==null&&typeof f=="object"&&typeof f.then=="function"){if(r=l.alternate,r!==null&&Gs(r,l,g,!0),l=wn.current,l!==null){switch(l.tag){case 31:case 13:return In===null?Af():l.alternate===null&&Se===0&&(Se=3),l.flags&=-257,l.flags|=65536,l.lanes=g,f===nf?l.flags|=16384:(r=l.updateQueue,r===null?l.updateQueue=new Set([f]):r.add(f),Qg(o,f,g)),!1;case 22:return l.flags|=65536,f===nf?l.flags|=16384:(r=l.updateQueue,r===null?(r={transitions:null,markerInstances:null,retryQueue:new Set([f])},l.updateQueue=r):(l=r.retryQueue,l===null?r.retryQueue=new Set([f]):l.add(f)),Qg(o,f,g)),!1}throw Error(i(435,l.tag))}return Qg(o,f,g),Af(),!1}if(Ft)return r=wn.current,r!==null?((r.flags&65536)===0&&(r.flags|=256),r.flags|=65536,r.lanes=g,f!==Ym&&(o=Error(i(422),{cause:f}),Sl(jn(o,l)))):(f!==Ym&&(r=Error(i(423),{cause:f}),Sl(jn(r,l))),o=o.current.alternate,o.flags|=65536,g&=-g,o.lanes|=g,f=jn(f,l),g=_g(o.stateNode,f,g),ng(o,g),Se!==4&&(Se=2)),!1;var v=Error(i(520),{cause:f});if(v=jn(v,l),Hl===null?Hl=[v]:Hl.push(v),Se!==4&&(Se=2),r===null)return!0;f=jn(f,l),l=r;do{switch(l.tag){case 3:return l.flags|=65536,o=g&-g,l.lanes|=o,o=_g(l.stateNode,f,o),ng(l,o),!1;case 1:if(r=l.type,v=l.stateNode,(l.flags&128)===0&&(typeof r.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(nr===null||!nr.has(v))))return l.flags|=65536,g&=-g,l.lanes|=g,g=kT(g),OT(g,o,l,f),ng(l,g),!1}l=l.return}while(l!==null);return!1}var Ng=Error(i(461)),Oe=!1;function qe(o,r,l,f){r.child=o===null?V2(r,null,l,f):Zr(r,o.child,l,f)}function DT(o,r,l,f,g){l=l.render;var v=r.ref;if("ref"in f){var _={};for(var V in f)V!=="ref"&&(_[V]=f[V])}else _=f;return Yr(r),f=lg(o,r,l,_,v,g),V=cg(),o!==null&&!Oe?(ug(o,r,g),ni(o,r,g)):(Ft&&V&&$m(r),r.flags|=1,qe(o,r,f,g),r.child)}function jT(o,r,l,f,g){if(o===null){var v=l.type;return typeof v=="function"&&!Pm(v)&&v.defaultProps===void 0&&l.compare===null?(r.tag=15,r.type=v,zT(o,r,v,f,g)):(o=Ku(l.type,null,f,r,r.mode,g),o.ref=r.ref,o.return=r,r.child=o)}if(v=o.child,!zg(o,g)){var _=v.memoizedProps;if(l=l.compare,l=l!==null?l:bl,l(_,f)&&o.ref===r.ref)return ni(o,r,g)}return r.flags|=1,o=Ko(v,f),o.ref=r.ref,o.return=r,r.child=o}function zT(o,r,l,f,g){if(o!==null){var v=o.memoizedProps;if(bl(v,f)&&o.ref===r.ref)if(Oe=!1,r.pendingProps=f=v,zg(o,g))(o.flags&131072)!==0&&(Oe=!0);else return r.lanes=o.lanes,ni(o,r,g)}return Ag(o,r,l,f,g)}function VT(o,r,l,f){var g=f.children,v=o!==null?o.memoizedState:null;if(o===null&&r.stateNode===null&&(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),f.mode==="hidden"){if((r.flags&128)!==0){if(v=v!==null?v.baseLanes|l:l,o!==null){for(f=r.child=o.child,g=0;f!==null;)g=g|f.lanes|f.childLanes,f=f.sibling;f=g&~v}else f=0,r.child=null;return LT(o,r,v,l,f)}if((l&536870912)!==0)r.memoizedState={baseLanes:0,cachePool:null},o!==null&&tf(r,v!==null?v.cachePool:null),v!==null?B2(r,v):ig(),P2(r);else return f=r.lanes=536870912,LT(o,r,v!==null?v.baseLanes|l:l,l,f)}else v!==null?(tf(r,v.cachePool),B2(r,v),Wi(),r.memoizedState=null):(o!==null&&tf(r,null),ig(),Wi());return qe(o,r,g,l),r.child}function jl(o,r){return o!==null&&o.tag===22||r.stateNode!==null||(r.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),r.sibling}function LT(o,r,l,f,g){var v=Wm();return v=v===null?null:{parent:Re._currentValue,pool:v},r.memoizedState={baseLanes:l,cachePool:v},o!==null&&tf(r,null),ig(),P2(r),o!==null&&Gs(o,r,f,!0),r.childLanes=g,null}function yf(o,r){return r=bf({mode:r.mode,children:r.children},o.mode),r.ref=o.ref,o.child=r,r.return=o,r}function IT(o,r,l){return Zr(r,o.child,null,l),o=yf(r,r.pendingProps),o.flags|=2,Sn(r),r.memoizedState=null,o}function L$(o,r,l){var f=r.pendingProps,g=(r.flags&128)!==0;if(r.flags&=-129,o===null){if(Ft){if(f.mode==="hidden")return o=yf(r,f),r.lanes=536870912,jl(null,o);if(sg(r),(o=fe)?(o=K_(o,Ln),o=o!==null&&o.data==="&"?o:null,o!==null&&(r.memoizedState={dehydrated:o,treeContext:qi!==null?{id:To,overflow:_o}:null,retryLane:536870912,hydrationErrors:null},l=w2(o),l.return=r,r.child=l,Ue=r,fe=null)):o=null,o===null)throw Gi(r);return r.lanes=536870912,null}return yf(r,f)}var v=o.memoizedState;if(v!==null){var _=v.dehydrated;if(sg(r),g)if(r.flags&256)r.flags&=-257,r=IT(o,r,l);else if(r.memoizedState!==null)r.child=o.child,r.flags|=128,r=null;else throw Error(i(558));else if(Oe||Gs(o,r,l,!1),g=(l&o.childLanes)!==0,Oe||g){if(f=se,f!==null&&(_=zi(f,l),_!==0&&_!==v.retryLane))throw v.retryLane=_,Hr(o,_),un(f,o,_),Ng;Af(),r=IT(o,r,l)}else o=v.treeContext,fe=Bn(_.nextSibling),Ue=r,Ft=!0,Yi=null,Ln=!1,o!==null&&C2(r,o),r=yf(r,f),r.flags|=4096;return r}return o=Ko(o.child,{mode:f.mode,children:f.children}),o.ref=r.ref,r.child=o,o.return=r,o}function vf(o,r){var l=r.ref;if(l===null)o!==null&&o.ref!==null&&(r.flags|=4194816);else{if(typeof l!="function"&&typeof l!="object")throw Error(i(284));(o===null||o.ref!==l)&&(r.flags|=4194816)}}function Ag(o,r,l,f,g){return Yr(r),l=lg(o,r,l,f,void 0,g),f=cg(),o!==null&&!Oe?(ug(o,r,g),ni(o,r,g)):(Ft&&f&&$m(r),r.flags|=1,qe(o,r,l,g),r.child)}function BT(o,r,l,f,g,v){return Yr(r),r.updateQueue=null,l=U2(r,f,l,g),H2(o),f=cg(),o!==null&&!Oe?(ug(o,r,v),ni(o,r,v)):(Ft&&f&&$m(r),r.flags|=1,qe(o,r,l,v),r.child)}function PT(o,r,l,f,g){if(Yr(r),r.stateNode===null){var v=Us,_=l.contextType;typeof _=="object"&&_!==null&&(v=$e(_)),v=new l(f,v),r.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=Tg,r.stateNode=v,v._reactInternals=r,v=r.stateNode,v.props=f,v.state=r.memoizedState,v.refs={},tg(r),_=l.contextType,v.context=typeof _=="object"&&_!==null?$e(_):Us,v.state=r.memoizedState,_=l.getDerivedStateFromProps,typeof _=="function"&&(Cg(r,l,_,f),v.state=r.memoizedState),typeof l.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(_=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),_!==v.state&&Tg.enqueueReplaceState(v,v.state,null),Ml(r,f,v,g),Al(),v.state=r.memoizedState),typeof v.componentDidMount=="function"&&(r.flags|=4194308),f=!0}else if(o===null){v=r.stateNode;var V=r.memoizedProps,X=Qr(l,V);v.props=X;var nt=v.context,st=l.contextType;_=Us,typeof st=="object"&&st!==null&&(_=$e(st));var ct=l.getDerivedStateFromProps;st=typeof ct=="function"||typeof v.getSnapshotBeforeUpdate=="function",V=r.pendingProps!==V,st||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(V||nt!==_)&&_T(r,v,f,_),Fi=!1;var ot=r.memoizedState;v.state=ot,Ml(r,f,v,g),Al(),nt=r.memoizedState,V||ot!==nt||Fi?(typeof ct=="function"&&(Cg(r,l,ct,f),nt=r.memoizedState),(X=Fi||TT(r,l,X,f,ot,nt,_))?(st||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(r.flags|=4194308)):(typeof v.componentDidMount=="function"&&(r.flags|=4194308),r.memoizedProps=f,r.memoizedState=nt),v.props=f,v.state=nt,v.context=_,f=X):(typeof v.componentDidMount=="function"&&(r.flags|=4194308),f=!1)}else{v=r.stateNode,eg(o,r),_=r.memoizedProps,st=Qr(l,_),v.props=st,ct=r.pendingProps,ot=v.context,nt=l.contextType,X=Us,typeof nt=="object"&&nt!==null&&(X=$e(nt)),V=l.getDerivedStateFromProps,(nt=typeof V=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(_!==ct||ot!==X)&&_T(r,v,f,X),Fi=!1,ot=r.memoizedState,v.state=ot,Ml(r,f,v,g),Al();var rt=r.memoizedState;_!==ct||ot!==rt||Fi||o!==null&&o.dependencies!==null&&Wu(o.dependencies)?(typeof V=="function"&&(Cg(r,l,V,f),rt=r.memoizedState),(st=Fi||TT(r,l,st,f,ot,rt,X)||o!==null&&o.dependencies!==null&&Wu(o.dependencies))?(nt||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(f,rt,X),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(f,rt,X)),typeof v.componentDidUpdate=="function"&&(r.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(r.flags|=1024)):(typeof v.componentDidUpdate!="function"||_===o.memoizedProps&&ot===o.memoizedState||(r.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||_===o.memoizedProps&&ot===o.memoizedState||(r.flags|=1024),r.memoizedProps=f,r.memoizedState=rt),v.props=f,v.state=rt,v.context=X,f=st):(typeof v.componentDidUpdate!="function"||_===o.memoizedProps&&ot===o.memoizedState||(r.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||_===o.memoizedProps&&ot===o.memoizedState||(r.flags|=1024),f=!1)}return v=f,vf(o,r),f=(r.flags&128)!==0,v||f?(v=r.stateNode,l=f&&typeof l.getDerivedStateFromError!="function"?null:v.render(),r.flags|=1,o!==null&&f?(r.child=Zr(r,o.child,null,g),r.child=Zr(r,null,l,g)):qe(o,r,l,g),r.memoizedState=v.state,o=r.child):o=ni(o,r,g),o}function HT(o,r,l,f){return $r(),r.flags|=256,qe(o,r,l,f),r.child}var Mg={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function Rg(o){return{baseLanes:o,cachePool:R2()}}function kg(o,r,l){return o=o!==null?o.childLanes&~l:0,r&&(o|=Cn),o}function UT(o,r,l){var f=r.pendingProps,g=!1,v=(r.flags&128)!==0,_;if((_=v)||(_=o!==null&&o.memoizedState===null?!1:(Ce.current&2)!==0),_&&(g=!0,r.flags&=-129),_=(r.flags&32)!==0,r.flags&=-33,o===null){if(Ft){if(g?Qi(r):Wi(),(o=fe)?(o=K_(o,Ln),o=o!==null&&o.data!=="&"?o:null,o!==null&&(r.memoizedState={dehydrated:o,treeContext:qi!==null?{id:To,overflow:_o}:null,retryLane:536870912,hydrationErrors:null},l=w2(o),l.return=r,r.child=l,Ue=r,fe=null)):o=null,o===null)throw Gi(r);return h0(o)?r.lanes=32:r.lanes=536870912,null}var V=f.children;return f=f.fallback,g?(Wi(),g=r.mode,V=bf({mode:"hidden",children:V},g),f=Ur(f,g,l,null),V.return=r,f.return=r,V.sibling=f,r.child=V,f=r.child,f.memoizedState=Rg(l),f.childLanes=kg(o,_,l),r.memoizedState=Mg,jl(null,f)):(Qi(r),Og(r,V))}var X=o.memoizedState;if(X!==null&&(V=X.dehydrated,V!==null)){if(v)r.flags&256?(Qi(r),r.flags&=-257,r=Dg(o,r,l)):r.memoizedState!==null?(Wi(),r.child=o.child,r.flags|=128,r=null):(Wi(),V=f.fallback,g=r.mode,f=bf({mode:"visible",children:f.children},g),V=Ur(V,g,l,null),V.flags|=2,f.return=r,V.return=r,f.sibling=V,r.child=f,Zr(r,o.child,null,l),f=r.child,f.memoizedState=Rg(l),f.childLanes=kg(o,_,l),r.memoizedState=Mg,r=jl(null,f));else if(Qi(r),h0(V)){if(_=V.nextSibling&&V.nextSibling.dataset,_)var nt=_.dgst;_=nt,f=Error(i(419)),f.stack="",f.digest=_,Sl({value:f,source:null,stack:null}),r=Dg(o,r,l)}else if(Oe||Gs(o,r,l,!1),_=(l&o.childLanes)!==0,Oe||_){if(_=se,_!==null&&(f=zi(_,l),f!==0&&f!==X.retryLane))throw X.retryLane=f,Hr(o,f),un(_,o,f),Ng;d0(V)||Af(),r=Dg(o,r,l)}else d0(V)?(r.flags|=192,r.child=o.child,r=null):(o=X.treeContext,fe=Bn(V.nextSibling),Ue=r,Ft=!0,Yi=null,Ln=!1,o!==null&&C2(r,o),r=Og(r,f.children),r.flags|=4096);return r}return g?(Wi(),V=f.fallback,g=r.mode,X=o.child,nt=X.sibling,f=Ko(X,{mode:"hidden",children:f.children}),f.subtreeFlags=X.subtreeFlags&65011712,nt!==null?V=Ko(nt,V):(V=Ur(V,g,l,null),V.flags|=2),V.return=r,f.return=r,f.sibling=V,r.child=f,jl(null,f),f=r.child,V=o.child.memoizedState,V===null?V=Rg(l):(g=V.cachePool,g!==null?(X=Re._currentValue,g=g.parent!==X?{parent:X,pool:X}:g):g=R2(),V={baseLanes:V.baseLanes|l,cachePool:g}),f.memoizedState=V,f.childLanes=kg(o,_,l),r.memoizedState=Mg,jl(o.child,f)):(Qi(r),l=o.child,o=l.sibling,l=Ko(l,{mode:"visible",children:f.children}),l.return=r,l.sibling=null,o!==null&&(_=r.deletions,_===null?(r.deletions=[o],r.flags|=16):_.push(o)),r.child=l,r.memoizedState=null,l)}function Og(o,r){return r=bf({mode:"visible",children:r},o.mode),r.return=o,o.child=r}function bf(o,r){return o=xn(22,o,null,r),o.lanes=0,o}function Dg(o,r,l){return Zr(r,o.child,null,l),o=Og(r,r.pendingProps.children),o.flags|=2,r.memoizedState=null,o}function $T(o,r,l){o.lanes|=r;var f=o.alternate;f!==null&&(f.lanes|=r),Fm(o.return,r,l)}function jg(o,r,l,f,g,v){var _=o.memoizedState;_===null?o.memoizedState={isBackwards:r,rendering:null,renderingStartTime:0,last:f,tail:l,tailMode:g,treeForkCount:v}:(_.isBackwards=r,_.rendering=null,_.renderingStartTime=0,_.last=f,_.tail=l,_.tailMode=g,_.treeForkCount=v)}function qT(o,r,l){var f=r.pendingProps,g=f.revealOrder,v=f.tail;f=f.children;var _=Ce.current,V=(_&2)!==0;if(V?(_=_&1|2,r.flags|=128):_&=1,tt(Ce,_),qe(o,r,f,l),f=Ft?wl:0,!V&&o!==null&&(o.flags&128)!==0)t:for(o=r.child;o!==null;){if(o.tag===13)o.memoizedState!==null&&$T(o,l,r);else if(o.tag===19)$T(o,l,r);else if(o.child!==null){o.child.return=o,o=o.child;continue}if(o===r)break t;for(;o.sibling===null;){if(o.return===null||o.return===r)break t;o=o.return}o.sibling.return=o.return,o=o.sibling}switch(g){case"forwards":for(l=r.child,g=null;l!==null;)o=l.alternate,o!==null&&af(o)===null&&(g=l),l=l.sibling;l=g,l===null?(g=r.child,r.child=null):(g=l.sibling,l.sibling=null),jg(r,!1,g,l,v,f);break;case"backwards":case"unstable_legacy-backwards":for(l=null,g=r.child,r.child=null;g!==null;){if(o=g.alternate,o!==null&&af(o)===null){r.child=g;break}o=g.sibling,g.sibling=l,l=g,g=o}jg(r,!0,l,null,v,f);break;case"together":jg(r,!1,null,null,void 0,f);break;default:r.memoizedState=null}return r.child}function ni(o,r,l){if(o!==null&&(r.dependencies=o.dependencies),er|=r.lanes,(l&r.childLanes)===0)if(o!==null){if(Gs(o,r,l,!1),(l&r.childLanes)===0)return null}else return null;if(o!==null&&r.child!==o.child)throw Error(i(153));if(r.child!==null){for(o=r.child,l=Ko(o,o.pendingProps),r.child=l,l.return=r;o.sibling!==null;)o=o.sibling,l=l.sibling=Ko(o,o.pendingProps),l.return=r;l.sibling=null}return r.child}function zg(o,r){return(o.lanes&r)!==0?!0:(o=o.dependencies,!!(o!==null&&Wu(o)))}function I$(o,r,l){switch(r.tag){case 3:ut(r,r.stateNode.containerInfo),Xi(r,Re,o.memoizedState.cache),$r();break;case 27:case 5:Mt(r);break;case 4:ut(r,r.stateNode.containerInfo);break;case 10:Xi(r,r.type,r.memoizedProps.value);break;case 31:if(r.memoizedState!==null)return r.flags|=128,sg(r),null;break;case 13:var f=r.memoizedState;if(f!==null)return f.dehydrated!==null?(Qi(r),r.flags|=128,null):(l&r.child.childLanes)!==0?UT(o,r,l):(Qi(r),o=ni(o,r,l),o!==null?o.sibling:null);Qi(r);break;case 19:var g=(o.flags&128)!==0;if(f=(l&r.childLanes)!==0,f||(Gs(o,r,l,!1),f=(l&r.childLanes)!==0),g){if(f)return qT(o,r,l);r.flags|=128}if(g=r.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),tt(Ce,Ce.current),f)break;return null;case 22:return r.lanes=0,VT(o,r,l,r.pendingProps);case 24:Xi(r,Re,o.memoizedState.cache)}return ni(o,r,l)}function YT(o,r,l){if(o!==null)if(o.memoizedProps!==r.pendingProps)Oe=!0;else{if(!zg(o,l)&&(r.flags&128)===0)return Oe=!1,I$(o,r,l);Oe=(o.flags&131072)!==0}else Oe=!1,Ft&&(r.flags&1048576)!==0&&E2(r,wl,r.index);switch(r.lanes=0,r.tag){case 16:t:{var f=r.pendingProps;if(o=Xr(r.elementType),r.type=o,typeof o=="function")Pm(o)?(f=Qr(o,f),r.tag=1,r=PT(null,r,o,f,l)):(r.tag=0,r=Ag(null,r,o,f,l));else{if(o!=null){var g=o.$$typeof;if(g===C){r.tag=11,r=DT(null,r,o,f,l);break t}else if(g===O){r.tag=14,r=jT(null,r,o,f,l);break t}}throw r=B(o)||o,Error(i(306,r,""))}}return r;case 0:return Ag(o,r,r.type,r.pendingProps,l);case 1:return f=r.type,g=Qr(f,r.pendingProps),PT(o,r,f,g,l);case 3:t:{if(ut(r,r.stateNode.containerInfo),o===null)throw Error(i(387));f=r.pendingProps;var v=r.memoizedState;g=v.element,eg(o,r),Ml(r,f,null,l);var _=r.memoizedState;if(f=_.cache,Xi(r,Re,f),f!==v.cache&&Zm(r,[Re],l,!0),Al(),f=_.element,v.isDehydrated)if(v={element:f,isDehydrated:!1,cache:_.cache},r.updateQueue.baseState=v,r.memoizedState=v,r.flags&256){r=HT(o,r,f,l);break t}else if(f!==g){g=jn(Error(i(424)),r),Sl(g),r=HT(o,r,f,l);break t}else for(o=r.stateNode.containerInfo,o.nodeType===9?o=o.body:o=o.nodeName==="HTML"?o.ownerDocument.body:o,fe=Bn(o.firstChild),Ue=r,Ft=!0,Yi=null,Ln=!0,l=V2(r,null,f,l),r.child=l;l;)l.flags=l.flags&-3|4096,l=l.sibling;else{if($r(),f===g){r=ni(o,r,l);break t}qe(o,r,f,l)}r=r.child}return r;case 26:return vf(o,r),o===null?(l=nN(r.type,null,r.pendingProps,null))?r.memoizedState=l:Ft||(l=r.type,o=r.pendingProps,f=zf(ht.current).createElement(l),f[ve]=r,f[Me]=o,Ye(f,l,o),me(f),r.stateNode=f):r.memoizedState=nN(r.type,o.memoizedProps,r.pendingProps,o.memoizedState),null;case 27:return Mt(r),o===null&&Ft&&(f=r.stateNode=J_(r.type,r.pendingProps,ht.current),Ue=r,Ln=!0,g=fe,sr(r.type)?(p0=g,fe=Bn(f.firstChild)):fe=g),qe(o,r,r.pendingProps.children,l),vf(o,r),o===null&&(r.flags|=4194304),r.child;case 5:return o===null&&Ft&&((g=f=fe)&&(f=p7(f,r.type,r.pendingProps,Ln),f!==null?(r.stateNode=f,Ue=r,fe=Bn(f.firstChild),Ln=!1,g=!0):g=!1),g||Gi(r)),Mt(r),g=r.type,v=r.pendingProps,_=o!==null?o.memoizedProps:null,f=v.children,c0(g,v)?f=null:_!==null&&c0(g,_)&&(r.flags|=32),r.memoizedState!==null&&(g=lg(o,r,M$,null,null,l),Zl._currentValue=g),vf(o,r),qe(o,r,f,l),r.child;case 6:return o===null&&Ft&&((o=l=fe)&&(l=m7(l,r.pendingProps,Ln),l!==null?(r.stateNode=l,Ue=r,fe=null,o=!0):o=!1),o||Gi(r)),null;case 13:return UT(o,r,l);case 4:return ut(r,r.stateNode.containerInfo),f=r.pendingProps,o===null?r.child=Zr(r,null,f,l):qe(o,r,f,l),r.child;case 11:return DT(o,r,r.type,r.pendingProps,l);case 7:return qe(o,r,r.pendingProps,l),r.child;case 8:return qe(o,r,r.pendingProps.children,l),r.child;case 12:return qe(o,r,r.pendingProps.children,l),r.child;case 10:return f=r.pendingProps,Xi(r,r.type,f.value),qe(o,r,f.children,l),r.child;case 9:return g=r.type._context,f=r.pendingProps.children,Yr(r),g=$e(g),f=f(g),r.flags|=1,qe(o,r,f,l),r.child;case 14:return jT(o,r,r.type,r.pendingProps,l);case 15:return zT(o,r,r.type,r.pendingProps,l);case 19:return qT(o,r,l);case 31:return L$(o,r,l);case 22:return VT(o,r,l,r.pendingProps);case 24:return Yr(r),f=$e(Re),o===null?(g=Wm(),g===null&&(g=se,v=Km(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=l),g=v),r.memoizedState={parent:f,cache:g},tg(r),Xi(r,Re,g)):((o.lanes&l)!==0&&(eg(o,r),Ml(r,null,null,l),Al()),g=o.memoizedState,v=r.memoizedState,g.parent!==f?(g={parent:f,cache:f},r.memoizedState=g,r.lanes===0&&(r.memoizedState=r.updateQueue.baseState=g),Xi(r,Re,f)):(f=v.cache,Xi(r,Re,f),f!==g.cache&&Zm(r,[Re],l,!0))),qe(o,r,r.pendingProps.children,l),r.child;case 29:throw r.pendingProps}throw Error(i(156,r.tag))}function oi(o){o.flags|=4}function Vg(o,r,l,f,g){if((r=(o.mode&32)!==0)&&(r=!1),r){if(o.flags|=16777216,(g&335544128)===g)if(o.stateNode.complete)o.flags|=8192;else if(v_())o.flags|=8192;else throw Fr=nf,Jm}else o.flags&=-16777217}function GT(o,r){if(r.type!=="stylesheet"||(r.state.loading&4)!==0)o.flags&=-16777217;else if(o.flags|=16777216,!aN(r))if(v_())o.flags|=8192;else throw Fr=nf,Jm}function xf(o,r){r!==null&&(o.flags|=4),o.flags&16384&&(r=o.tag!==22?ki():536870912,o.lanes|=r,ia|=r)}function zl(o,r){if(!Ft)switch(o.tailMode){case"hidden":r=o.tail;for(var l=null;r!==null;)r.alternate!==null&&(l=r),r=r.sibling;l===null?o.tail=null:l.sibling=null;break;case"collapsed":l=o.tail;for(var f=null;l!==null;)l.alternate!==null&&(f=l),l=l.sibling;f===null?r||o.tail===null?o.tail=null:o.tail.sibling=null:f.sibling=null}}function de(o){var r=o.alternate!==null&&o.alternate.child===o.child,l=0,f=0;if(r)for(var g=o.child;g!==null;)l|=g.lanes|g.childLanes,f|=g.subtreeFlags&65011712,f|=g.flags&65011712,g.return=o,g=g.sibling;else for(g=o.child;g!==null;)l|=g.lanes|g.childLanes,f|=g.subtreeFlags,f|=g.flags,g.return=o,g=g.sibling;return o.subtreeFlags|=f,o.childLanes=l,r}function B$(o,r,l){var f=r.pendingProps;switch(qm(r),r.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return de(r),null;case 1:return de(r),null;case 3:return l=r.stateNode,f=null,o!==null&&(f=o.memoizedState.cache),r.memoizedState.cache!==f&&(r.flags|=2048),Jo(Re),dt(),l.pendingContext&&(l.context=l.pendingContext,l.pendingContext=null),(o===null||o.child===null)&&(Ys(r)?oi(r):o===null||o.memoizedState.isDehydrated&&(r.flags&256)===0||(r.flags|=1024,Gm())),de(r),null;case 26:var g=r.type,v=r.memoizedState;return o===null?(oi(r),v!==null?(de(r),GT(r,v)):(de(r),Vg(r,g,null,f,l))):v?v!==o.memoizedState?(oi(r),de(r),GT(r,v)):(de(r),r.flags&=-16777217):(o=o.memoizedProps,o!==f&&oi(r),de(r),Vg(r,g,o,f,l)),null;case 27:if(Nt(r),l=ht.current,g=r.type,o!==null&&r.stateNode!=null)o.memoizedProps!==f&&oi(r);else{if(!f){if(r.stateNode===null)throw Error(i(166));return de(r),null}o=it.current,Ys(r)?T2(r):(o=J_(g,f,l),r.stateNode=o,oi(r))}return de(r),null;case 5:if(Nt(r),g=r.type,o!==null&&r.stateNode!=null)o.memoizedProps!==f&&oi(r);else{if(!f){if(r.stateNode===null)throw Error(i(166));return de(r),null}if(v=it.current,Ys(r))T2(r);else{var _=zf(ht.current);switch(v){case 1:v=_.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=_.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=_.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=_.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=_.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof f.is=="string"?_.createElement("select",{is:f.is}):_.createElement("select"),f.multiple?v.multiple=!0:f.size&&(v.size=f.size);break;default:v=typeof f.is=="string"?_.createElement(g,{is:f.is}):_.createElement(g)}}v[ve]=r,v[Me]=f;t:for(_=r.child;_!==null;){if(_.tag===5||_.tag===6)v.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===r)break t;for(;_.sibling===null;){if(_.return===null||_.return===r)break t;_=_.return}_.sibling.return=_.return,_=_.sibling}r.stateNode=v;t:switch(Ye(v,g,f),g){case"button":case"input":case"select":case"textarea":f=!!f.autoFocus;break t;case"img":f=!0;break t;default:f=!1}f&&oi(r)}}return de(r),Vg(r,r.type,o===null?null:o.memoizedProps,r.pendingProps,l),null;case 6:if(o&&r.stateNode!=null)o.memoizedProps!==f&&oi(r);else{if(typeof f!="string"&&r.stateNode===null)throw Error(i(166));if(o=ht.current,Ys(r)){if(o=r.stateNode,l=r.memoizedProps,f=null,g=Ue,g!==null)switch(g.tag){case 27:case 5:f=g.memoizedProps}o[ve]=r,o=!!(o.nodeValue===l||f!==null&&f.suppressHydrationWarning===!0||U_(o.nodeValue,l)),o||Gi(r,!0)}else o=zf(o).createTextNode(f),o[ve]=r,r.stateNode=o}return de(r),null;case 31:if(l=r.memoizedState,o===null||o.memoizedState!==null){if(f=Ys(r),l!==null){if(o===null){if(!f)throw Error(i(318));if(o=r.memoizedState,o=o!==null?o.dehydrated:null,!o)throw Error(i(557));o[ve]=r}else $r(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;de(r),o=!1}else l=Gm(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=l),o=!0;if(!o)return r.flags&256?(Sn(r),r):(Sn(r),null);if((r.flags&128)!==0)throw Error(i(558))}return de(r),null;case 13:if(f=r.memoizedState,o===null||o.memoizedState!==null&&o.memoizedState.dehydrated!==null){if(g=Ys(r),f!==null&&f.dehydrated!==null){if(o===null){if(!g)throw Error(i(318));if(g=r.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(i(317));g[ve]=r}else $r(),(r.flags&128)===0&&(r.memoizedState=null),r.flags|=4;de(r),g=!1}else g=Gm(),o!==null&&o.memoizedState!==null&&(o.memoizedState.hydrationErrors=g),g=!0;if(!g)return r.flags&256?(Sn(r),r):(Sn(r),null)}return Sn(r),(r.flags&128)!==0?(r.lanes=l,r):(l=f!==null,o=o!==null&&o.memoizedState!==null,l&&(f=r.child,g=null,f.alternate!==null&&f.alternate.memoizedState!==null&&f.alternate.memoizedState.cachePool!==null&&(g=f.alternate.memoizedState.cachePool.pool),v=null,f.memoizedState!==null&&f.memoizedState.cachePool!==null&&(v=f.memoizedState.cachePool.pool),v!==g&&(f.flags|=2048)),l!==o&&l&&(r.child.flags|=8192),xf(r,r.updateQueue),de(r),null);case 4:return dt(),o===null&&i0(r.stateNode.containerInfo),de(r),null;case 10:return Jo(r.type),de(r),null;case 19:if(G(Ce),f=r.memoizedState,f===null)return de(r),null;if(g=(r.flags&128)!==0,v=f.rendering,v===null)if(g)zl(f,!1);else{if(Se!==0||o!==null&&(o.flags&128)!==0)for(o=r.child;o!==null;){if(v=af(o),v!==null){for(r.flags|=128,zl(f,!1),o=v.updateQueue,r.updateQueue=o,xf(r,o),r.subtreeFlags=0,o=l,l=r.child;l!==null;)x2(l,o),l=l.sibling;return tt(Ce,Ce.current&1|2),Ft&&Qo(r,f.treeForkCount),r.child}o=o.sibling}f.tail!==null&&zt()>Tf&&(r.flags|=128,g=!0,zl(f,!1),r.lanes=4194304)}else{if(!g)if(o=af(v),o!==null){if(r.flags|=128,g=!0,o=o.updateQueue,r.updateQueue=o,xf(r,o),zl(f,!0),f.tail===null&&f.tailMode==="hidden"&&!v.alternate&&!Ft)return de(r),null}else 2*zt()-f.renderingStartTime>Tf&&l!==536870912&&(r.flags|=128,g=!0,zl(f,!1),r.lanes=4194304);f.isBackwards?(v.sibling=r.child,r.child=v):(o=f.last,o!==null?o.sibling=v:r.child=v,f.last=v)}return f.tail!==null?(o=f.tail,f.rendering=o,f.tail=o.sibling,f.renderingStartTime=zt(),o.sibling=null,l=Ce.current,tt(Ce,g?l&1|2:l&1),Ft&&Qo(r,f.treeForkCount),o):(de(r),null);case 22:case 23:return Sn(r),rg(),f=r.memoizedState!==null,o!==null?o.memoizedState!==null!==f&&(r.flags|=8192):f&&(r.flags|=8192),f?(l&536870912)!==0&&(r.flags&128)===0&&(de(r),r.subtreeFlags&6&&(r.flags|=8192)):de(r),l=r.updateQueue,l!==null&&xf(r,l.retryQueue),l=null,o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(l=o.memoizedState.cachePool.pool),f=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(f=r.memoizedState.cachePool.pool),f!==l&&(r.flags|=2048),o!==null&&G(Gr),null;case 24:return l=null,o!==null&&(l=o.memoizedState.cache),r.memoizedState.cache!==l&&(r.flags|=2048),Jo(Re),de(r),null;case 25:return null;case 30:return null}throw Error(i(156,r.tag))}function P$(o,r){switch(qm(r),r.tag){case 1:return o=r.flags,o&65536?(r.flags=o&-65537|128,r):null;case 3:return Jo(Re),dt(),o=r.flags,(o&65536)!==0&&(o&128)===0?(r.flags=o&-65537|128,r):null;case 26:case 27:case 5:return Nt(r),null;case 31:if(r.memoizedState!==null){if(Sn(r),r.alternate===null)throw Error(i(340));$r()}return o=r.flags,o&65536?(r.flags=o&-65537|128,r):null;case 13:if(Sn(r),o=r.memoizedState,o!==null&&o.dehydrated!==null){if(r.alternate===null)throw Error(i(340));$r()}return o=r.flags,o&65536?(r.flags=o&-65537|128,r):null;case 19:return G(Ce),null;case 4:return dt(),null;case 10:return Jo(r.type),null;case 22:case 23:return Sn(r),rg(),o!==null&&G(Gr),o=r.flags,o&65536?(r.flags=o&-65537|128,r):null;case 24:return Jo(Re),null;case 25:return null;default:return null}}function XT(o,r){switch(qm(r),r.tag){case 3:Jo(Re),dt();break;case 26:case 27:case 5:Nt(r);break;case 4:dt();break;case 31:r.memoizedState!==null&&Sn(r);break;case 13:Sn(r);break;case 19:G(Ce);break;case 10:Jo(r.type);break;case 22:case 23:Sn(r),rg(),o!==null&&G(Gr);break;case 24:Jo(Re)}}function Vl(o,r){try{var l=r.updateQueue,f=l!==null?l.lastEffect:null;if(f!==null){var g=f.next;l=g;do{if((l.tag&o)===o){f=void 0;var v=l.create,_=l.inst;f=v(),_.destroy=f}l=l.next}while(l!==g)}}catch(V){te(r,r.return,V)}}function Ji(o,r,l){try{var f=r.updateQueue,g=f!==null?f.lastEffect:null;if(g!==null){var v=g.next;f=v;do{if((f.tag&o)===o){var _=f.inst,V=_.destroy;if(V!==void 0){_.destroy=void 0,g=r;var X=l,nt=V;try{nt()}catch(st){te(g,X,st)}}}f=f.next}while(f!==v)}}catch(st){te(r,r.return,st)}}function FT(o){var r=o.updateQueue;if(r!==null){var l=o.stateNode;try{I2(r,l)}catch(f){te(o,o.return,f)}}}function ZT(o,r,l){l.props=Qr(o.type,o.memoizedProps),l.state=o.memoizedState;try{l.componentWillUnmount()}catch(f){te(o,r,f)}}function Ll(o,r){try{var l=o.ref;if(l!==null){switch(o.tag){case 26:case 27:case 5:var f=o.stateNode;break;case 30:f=o.stateNode;break;default:f=o.stateNode}typeof l=="function"?o.refCleanup=l(f):l.current=f}}catch(g){te(o,r,g)}}function No(o,r){var l=o.ref,f=o.refCleanup;if(l!==null)if(typeof f=="function")try{f()}catch(g){te(o,r,g)}finally{o.refCleanup=null,o=o.alternate,o!=null&&(o.refCleanup=null)}else if(typeof l=="function")try{l(null)}catch(g){te(o,r,g)}else l.current=null}function KT(o){var r=o.type,l=o.memoizedProps,f=o.stateNode;try{t:switch(r){case"button":case"input":case"select":case"textarea":l.autoFocus&&f.focus();break t;case"img":l.src?f.src=l.src:l.srcSet&&(f.srcset=l.srcSet)}}catch(g){te(o,o.return,g)}}function Lg(o,r,l){try{var f=o.stateNode;l7(f,o.type,l,r),f[Me]=r}catch(g){te(o,o.return,g)}}function QT(o){return o.tag===5||o.tag===3||o.tag===26||o.tag===27&&sr(o.type)||o.tag===4}function Ig(o){t:for(;;){for(;o.sibling===null;){if(o.return===null||QT(o.return))return null;o=o.return}for(o.sibling.return=o.return,o=o.sibling;o.tag!==5&&o.tag!==6&&o.tag!==18;){if(o.tag===27&&sr(o.type)||o.flags&2||o.child===null||o.tag===4)continue t;o.child.return=o,o=o.child}if(!(o.flags&2))return o.stateNode}}function Bg(o,r,l){var f=o.tag;if(f===5||f===6)o=o.stateNode,r?(l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l).insertBefore(o,r):(r=l.nodeType===9?l.body:l.nodeName==="HTML"?l.ownerDocument.body:l,r.appendChild(o),l=l._reactRootContainer,l!=null||r.onclick!==null||(r.onclick=Fo));else if(f!==4&&(f===27&&sr(o.type)&&(l=o.stateNode,r=null),o=o.child,o!==null))for(Bg(o,r,l),o=o.sibling;o!==null;)Bg(o,r,l),o=o.sibling}function wf(o,r,l){var f=o.tag;if(f===5||f===6)o=o.stateNode,r?l.insertBefore(o,r):l.appendChild(o);else if(f!==4&&(f===27&&sr(o.type)&&(l=o.stateNode),o=o.child,o!==null))for(wf(o,r,l),o=o.sibling;o!==null;)wf(o,r,l),o=o.sibling}function WT(o){var r=o.stateNode,l=o.memoizedProps;try{for(var f=o.type,g=r.attributes;g.length;)r.removeAttributeNode(g[0]);Ye(r,f,l),r[ve]=o,r[Me]=l}catch(v){te(o,o.return,v)}}var ii=!1,De=!1,Pg=!1,JT=typeof WeakSet=="function"?WeakSet:Set,Ie=null;function H$(o,r){if(o=o.containerInfo,a0=Uf,o=f2(o),Dm(o)){if("selectionStart"in o)var l={start:o.selectionStart,end:o.selectionEnd};else t:{l=(l=o.ownerDocument)&&l.defaultView||window;var f=l.getSelection&&l.getSelection();if(f&&f.rangeCount!==0){l=f.anchorNode;var g=f.anchorOffset,v=f.focusNode;f=f.focusOffset;try{l.nodeType,v.nodeType}catch{l=null;break t}var _=0,V=-1,X=-1,nt=0,st=0,ct=o,ot=null;e:for(;;){for(var rt;ct!==l||g!==0&&ct.nodeType!==3||(V=_+g),ct!==v||f!==0&&ct.nodeType!==3||(X=_+f),ct.nodeType===3&&(_+=ct.nodeValue.length),(rt=ct.firstChild)!==null;)ot=ct,ct=rt;for(;;){if(ct===o)break e;if(ot===l&&++nt===g&&(V=_),ot===v&&++st===f&&(X=_),(rt=ct.nextSibling)!==null)break;ct=ot,ot=ct.parentNode}ct=rt}l=V===-1||X===-1?null:{start:V,end:X}}else l=null}l=l||{start:0,end:0}}else l=null;for(l0={focusedElem:o,selectionRange:l},Uf=!1,Ie=r;Ie!==null;)if(r=Ie,o=r.child,(r.subtreeFlags&1028)!==0&&o!==null)o.return=r,Ie=o;else for(;Ie!==null;){switch(r=Ie,v=r.alternate,o=r.flags,r.tag){case 0:if((o&4)!==0&&(o=r.updateQueue,o=o!==null?o.events:null,o!==null))for(l=0;l<o.length;l++)g=o[l],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((o&1024)!==0&&v!==null){o=void 0,l=r,g=v.memoizedProps,v=v.memoizedState,f=l.stateNode;try{var xt=Qr(l.type,g);o=f.getSnapshotBeforeUpdate(xt,v),f.__reactInternalSnapshotBeforeUpdate=o}catch(Ot){te(l,l.return,Ot)}}break;case 3:if((o&1024)!==0){if(o=r.stateNode.containerInfo,l=o.nodeType,l===9)f0(o);else if(l===1)switch(o.nodeName){case"HEAD":case"HTML":case"BODY":f0(o);break;default:o.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((o&1024)!==0)throw Error(i(163))}if(o=r.sibling,o!==null){o.return=r.return,Ie=o;break}Ie=r.return}}function t_(o,r,l){var f=l.flags;switch(l.tag){case 0:case 11:case 15:si(o,l),f&4&&Vl(5,l);break;case 1:if(si(o,l),f&4)if(o=l.stateNode,r===null)try{o.componentDidMount()}catch(_){te(l,l.return,_)}else{var g=Qr(l.type,r.memoizedProps);r=r.memoizedState;try{o.componentDidUpdate(g,r,o.__reactInternalSnapshotBeforeUpdate)}catch(_){te(l,l.return,_)}}f&64&&FT(l),f&512&&Ll(l,l.return);break;case 3:if(si(o,l),f&64&&(o=l.updateQueue,o!==null)){if(r=null,l.child!==null)switch(l.child.tag){case 27:case 5:r=l.child.stateNode;break;case 1:r=l.child.stateNode}try{I2(o,r)}catch(_){te(l,l.return,_)}}break;case 27:r===null&&f&4&&WT(l);case 26:case 5:si(o,l),r===null&&f&4&&KT(l),f&512&&Ll(l,l.return);break;case 12:si(o,l);break;case 31:si(o,l),f&4&&o_(o,l);break;case 13:si(o,l),f&4&&i_(o,l),f&64&&(o=l.memoizedState,o!==null&&(o=o.dehydrated,o!==null&&(l=K$.bind(null,l),g7(o,l))));break;case 22:if(f=l.memoizedState!==null||ii,!f){r=r!==null&&r.memoizedState!==null||De,g=ii;var v=De;ii=f,(De=r)&&!v?ai(o,l,(l.subtreeFlags&8772)!==0):si(o,l),ii=g,De=v}break;case 30:break;default:si(o,l)}}function e_(o){var r=o.alternate;r!==null&&(o.alternate=null,e_(r)),o.child=null,o.deletions=null,o.sibling=null,o.tag===5&&(r=o.stateNode,r!==null&&qo(r)),o.stateNode=null,o.return=null,o.dependencies=null,o.memoizedProps=null,o.memoizedState=null,o.pendingProps=null,o.stateNode=null,o.updateQueue=null}var ge=null,sn=!1;function ri(o,r,l){for(l=l.child;l!==null;)n_(o,r,l),l=l.sibling}function n_(o,r,l){if(re&&typeof re.onCommitFiberUnmount=="function")try{re.onCommitFiberUnmount(pe,l)}catch{}switch(l.tag){case 26:De||No(l,r),ri(o,r,l),l.memoizedState?l.memoizedState.count--:l.stateNode&&(l=l.stateNode,l.parentNode.removeChild(l));break;case 27:De||No(l,r);var f=ge,g=sn;sr(l.type)&&(ge=l.stateNode,sn=!1),ri(o,r,l),Gl(l.stateNode),ge=f,sn=g;break;case 5:De||No(l,r);case 6:if(f=ge,g=sn,ge=null,ri(o,r,l),ge=f,sn=g,ge!==null)if(sn)try{(ge.nodeType===9?ge.body:ge.nodeName==="HTML"?ge.ownerDocument.body:ge).removeChild(l.stateNode)}catch(v){te(l,r,v)}else try{ge.removeChild(l.stateNode)}catch(v){te(l,r,v)}break;case 18:ge!==null&&(sn?(o=ge,F_(o.nodeType===9?o.body:o.nodeName==="HTML"?o.ownerDocument.body:o,l.stateNode),da(o)):F_(ge,l.stateNode));break;case 4:f=ge,g=sn,ge=l.stateNode.containerInfo,sn=!0,ri(o,r,l),ge=f,sn=g;break;case 0:case 11:case 14:case 15:Ji(2,l,r),De||Ji(4,l,r),ri(o,r,l);break;case 1:De||(No(l,r),f=l.stateNode,typeof f.componentWillUnmount=="function"&&ZT(l,r,f)),ri(o,r,l);break;case 21:ri(o,r,l);break;case 22:De=(f=De)||l.memoizedState!==null,ri(o,r,l),De=f;break;default:ri(o,r,l)}}function o_(o,r){if(r.memoizedState===null&&(o=r.alternate,o!==null&&(o=o.memoizedState,o!==null))){o=o.dehydrated;try{da(o)}catch(l){te(r,r.return,l)}}}function i_(o,r){if(r.memoizedState===null&&(o=r.alternate,o!==null&&(o=o.memoizedState,o!==null&&(o=o.dehydrated,o!==null))))try{da(o)}catch(l){te(r,r.return,l)}}function U$(o){switch(o.tag){case 31:case 13:case 19:var r=o.stateNode;return r===null&&(r=o.stateNode=new JT),r;case 22:return o=o.stateNode,r=o._retryCache,r===null&&(r=o._retryCache=new JT),r;default:throw Error(i(435,o.tag))}}function Sf(o,r){var l=U$(o);r.forEach(function(f){if(!l.has(f)){l.add(f);var g=Q$.bind(null,o,f);f.then(g,g)}})}function an(o,r){var l=r.deletions;if(l!==null)for(var f=0;f<l.length;f++){var g=l[f],v=o,_=r,V=_;t:for(;V!==null;){switch(V.tag){case 27:if(sr(V.type)){ge=V.stateNode,sn=!1;break t}break;case 5:ge=V.stateNode,sn=!1;break t;case 3:case 4:ge=V.stateNode.containerInfo,sn=!0;break t}V=V.return}if(ge===null)throw Error(i(160));n_(v,_,g),ge=null,sn=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(r.subtreeFlags&13886)for(r=r.child;r!==null;)r_(r,o),r=r.sibling}var so=null;function r_(o,r){var l=o.alternate,f=o.flags;switch(o.tag){case 0:case 11:case 14:case 15:an(r,o),ln(o),f&4&&(Ji(3,o,o.return),Vl(3,o),Ji(5,o,o.return));break;case 1:an(r,o),ln(o),f&512&&(De||l===null||No(l,l.return)),f&64&&ii&&(o=o.updateQueue,o!==null&&(f=o.callbacks,f!==null&&(l=o.shared.hiddenCallbacks,o.shared.hiddenCallbacks=l===null?f:l.concat(f))));break;case 26:var g=so;if(an(r,o),ln(o),f&512&&(De||l===null||No(l,l.return)),f&4){var v=l!==null?l.memoizedState:null;if(f=o.memoizedState,l===null)if(f===null)if(o.stateNode===null){t:{f=o.type,l=o.memoizedProps,g=g.ownerDocument||g;e:switch(f){case"title":v=g.getElementsByTagName("title")[0],(!v||v[oo]||v[ve]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(f),g.head.insertBefore(v,g.querySelector("head > title"))),Ye(v,f,l),v[ve]=o,me(v),f=v;break t;case"link":var _=rN("link","href",g).get(f+(l.href||""));if(_){for(var V=0;V<_.length;V++)if(v=_[V],v.getAttribute("href")===(l.href==null||l.href===""?null:l.href)&&v.getAttribute("rel")===(l.rel==null?null:l.rel)&&v.getAttribute("title")===(l.title==null?null:l.title)&&v.getAttribute("crossorigin")===(l.crossOrigin==null?null:l.crossOrigin)){_.splice(V,1);break e}}v=g.createElement(f),Ye(v,f,l),g.head.appendChild(v);break;case"meta":if(_=rN("meta","content",g).get(f+(l.content||""))){for(V=0;V<_.length;V++)if(v=_[V],v.getAttribute("content")===(l.content==null?null:""+l.content)&&v.getAttribute("name")===(l.name==null?null:l.name)&&v.getAttribute("property")===(l.property==null?null:l.property)&&v.getAttribute("http-equiv")===(l.httpEquiv==null?null:l.httpEquiv)&&v.getAttribute("charset")===(l.charSet==null?null:l.charSet)){_.splice(V,1);break e}}v=g.createElement(f),Ye(v,f,l),g.head.appendChild(v);break;default:throw Error(i(468,f))}v[ve]=o,me(v),f=v}o.stateNode=f}else sN(g,o.type,o.stateNode);else o.stateNode=iN(g,f,o.memoizedProps);else v!==f?(v===null?l.stateNode!==null&&(l=l.stateNode,l.parentNode.removeChild(l)):v.count--,f===null?sN(g,o.type,o.stateNode):iN(g,f,o.memoizedProps)):f===null&&o.stateNode!==null&&Lg(o,o.memoizedProps,l.memoizedProps)}break;case 27:an(r,o),ln(o),f&512&&(De||l===null||No(l,l.return)),l!==null&&f&4&&Lg(o,o.memoizedProps,l.memoizedProps);break;case 5:if(an(r,o),ln(o),f&512&&(De||l===null||No(l,l.return)),o.flags&32){g=o.stateNode;try{zs(g,"")}catch(xt){te(o,o.return,xt)}}f&4&&o.stateNode!=null&&(g=o.memoizedProps,Lg(o,g,l!==null?l.memoizedProps:g)),f&1024&&(Pg=!0);break;case 6:if(an(r,o),ln(o),f&4){if(o.stateNode===null)throw Error(i(162));f=o.memoizedProps,l=o.stateNode;try{l.nodeValue=f}catch(xt){te(o,o.return,xt)}}break;case 3:if(If=null,g=so,so=Vf(r.containerInfo),an(r,o),so=g,ln(o),f&4&&l!==null&&l.memoizedState.isDehydrated)try{da(r.containerInfo)}catch(xt){te(o,o.return,xt)}Pg&&(Pg=!1,s_(o));break;case 4:f=so,so=Vf(o.stateNode.containerInfo),an(r,o),ln(o),so=f;break;case 12:an(r,o),ln(o);break;case 31:an(r,o),ln(o),f&4&&(f=o.updateQueue,f!==null&&(o.updateQueue=null,Sf(o,f)));break;case 13:an(r,o),ln(o),o.child.flags&8192&&o.memoizedState!==null!=(l!==null&&l.memoizedState!==null)&&(Cf=zt()),f&4&&(f=o.updateQueue,f!==null&&(o.updateQueue=null,Sf(o,f)));break;case 22:g=o.memoizedState!==null;var X=l!==null&&l.memoizedState!==null,nt=ii,st=De;if(ii=nt||g,De=st||X,an(r,o),De=st,ii=nt,ln(o),f&8192)t:for(r=o.stateNode,r._visibility=g?r._visibility&-2:r._visibility|1,g&&(l===null||X||ii||De||Wr(o)),l=null,r=o;;){if(r.tag===5||r.tag===26){if(l===null){X=l=r;try{if(v=X.stateNode,g)_=v.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{V=X.stateNode;var ct=X.memoizedProps.style,ot=ct!=null&&ct.hasOwnProperty("display")?ct.display:null;V.style.display=ot==null||typeof ot=="boolean"?"":(""+ot).trim()}}catch(xt){te(X,X.return,xt)}}}else if(r.tag===6){if(l===null){X=r;try{X.stateNode.nodeValue=g?"":X.memoizedProps}catch(xt){te(X,X.return,xt)}}}else if(r.tag===18){if(l===null){X=r;try{var rt=X.stateNode;g?Z_(rt,!0):Z_(X.stateNode,!1)}catch(xt){te(X,X.return,xt)}}}else if((r.tag!==22&&r.tag!==23||r.memoizedState===null||r===o)&&r.child!==null){r.child.return=r,r=r.child;continue}if(r===o)break t;for(;r.sibling===null;){if(r.return===null||r.return===o)break t;l===r&&(l=null),r=r.return}l===r&&(l=null),r.sibling.return=r.return,r=r.sibling}f&4&&(f=o.updateQueue,f!==null&&(l=f.retryQueue,l!==null&&(f.retryQueue=null,Sf(o,l))));break;case 19:an(r,o),ln(o),f&4&&(f=o.updateQueue,f!==null&&(o.updateQueue=null,Sf(o,f)));break;case 30:break;case 21:break;default:an(r,o),ln(o)}}function ln(o){var r=o.flags;if(r&2){try{for(var l,f=o.return;f!==null;){if(QT(f)){l=f;break}f=f.return}if(l==null)throw Error(i(160));switch(l.tag){case 27:var g=l.stateNode,v=Ig(o);wf(o,v,g);break;case 5:var _=l.stateNode;l.flags&32&&(zs(_,""),l.flags&=-33);var V=Ig(o);wf(o,V,_);break;case 3:case 4:var X=l.stateNode.containerInfo,nt=Ig(o);Bg(o,nt,X);break;default:throw Error(i(161))}}catch(st){te(o,o.return,st)}o.flags&=-3}r&4096&&(o.flags&=-4097)}function s_(o){if(o.subtreeFlags&1024)for(o=o.child;o!==null;){var r=o;s_(r),r.tag===5&&r.flags&1024&&r.stateNode.reset(),o=o.sibling}}function si(o,r){if(r.subtreeFlags&8772)for(r=r.child;r!==null;)t_(o,r.alternate,r),r=r.sibling}function Wr(o){for(o=o.child;o!==null;){var r=o;switch(r.tag){case 0:case 11:case 14:case 15:Ji(4,r,r.return),Wr(r);break;case 1:No(r,r.return);var l=r.stateNode;typeof l.componentWillUnmount=="function"&&ZT(r,r.return,l),Wr(r);break;case 27:Gl(r.stateNode);case 26:case 5:No(r,r.return),Wr(r);break;case 22:r.memoizedState===null&&Wr(r);break;case 30:Wr(r);break;default:Wr(r)}o=o.sibling}}function ai(o,r,l){for(l=l&&(r.subtreeFlags&8772)!==0,r=r.child;r!==null;){var f=r.alternate,g=o,v=r,_=v.flags;switch(v.tag){case 0:case 11:case 15:ai(g,v,l),Vl(4,v);break;case 1:if(ai(g,v,l),f=v,g=f.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(nt){te(f,f.return,nt)}if(f=v,g=f.updateQueue,g!==null){var V=f.stateNode;try{var X=g.shared.hiddenCallbacks;if(X!==null)for(g.shared.hiddenCallbacks=null,g=0;g<X.length;g++)L2(X[g],V)}catch(nt){te(f,f.return,nt)}}l&&_&64&&FT(v),Ll(v,v.return);break;case 27:WT(v);case 26:case 5:ai(g,v,l),l&&f===null&&_&4&&KT(v),Ll(v,v.return);break;case 12:ai(g,v,l);break;case 31:ai(g,v,l),l&&_&4&&o_(g,v);break;case 13:ai(g,v,l),l&&_&4&&i_(g,v);break;case 22:v.memoizedState===null&&ai(g,v,l),Ll(v,v.return);break;case 30:break;default:ai(g,v,l)}r=r.sibling}}function Hg(o,r){var l=null;o!==null&&o.memoizedState!==null&&o.memoizedState.cachePool!==null&&(l=o.memoizedState.cachePool.pool),o=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(o=r.memoizedState.cachePool.pool),o!==l&&(o!=null&&o.refCount++,l!=null&&El(l))}function Ug(o,r){o=null,r.alternate!==null&&(o=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==o&&(r.refCount++,o!=null&&El(o))}function ao(o,r,l,f){if(r.subtreeFlags&10256)for(r=r.child;r!==null;)a_(o,r,l,f),r=r.sibling}function a_(o,r,l,f){var g=r.flags;switch(r.tag){case 0:case 11:case 15:ao(o,r,l,f),g&2048&&Vl(9,r);break;case 1:ao(o,r,l,f);break;case 3:ao(o,r,l,f),g&2048&&(o=null,r.alternate!==null&&(o=r.alternate.memoizedState.cache),r=r.memoizedState.cache,r!==o&&(r.refCount++,o!=null&&El(o)));break;case 12:if(g&2048){ao(o,r,l,f),o=r.stateNode;try{var v=r.memoizedProps,_=v.id,V=v.onPostCommit;typeof V=="function"&&V(_,r.alternate===null?"mount":"update",o.passiveEffectDuration,-0)}catch(X){te(r,r.return,X)}}else ao(o,r,l,f);break;case 31:ao(o,r,l,f);break;case 13:ao(o,r,l,f);break;case 23:break;case 22:v=r.stateNode,_=r.alternate,r.memoizedState!==null?v._visibility&2?ao(o,r,l,f):Il(o,r):v._visibility&2?ao(o,r,l,f):(v._visibility|=2,ea(o,r,l,f,(r.subtreeFlags&10256)!==0||!1)),g&2048&&Hg(_,r);break;case 24:ao(o,r,l,f),g&2048&&Ug(r.alternate,r);break;default:ao(o,r,l,f)}}function ea(o,r,l,f,g){for(g=g&&((r.subtreeFlags&10256)!==0||!1),r=r.child;r!==null;){var v=o,_=r,V=l,X=f,nt=_.flags;switch(_.tag){case 0:case 11:case 15:ea(v,_,V,X,g),Vl(8,_);break;case 23:break;case 22:var st=_.stateNode;_.memoizedState!==null?st._visibility&2?ea(v,_,V,X,g):Il(v,_):(st._visibility|=2,ea(v,_,V,X,g)),g&&nt&2048&&Hg(_.alternate,_);break;case 24:ea(v,_,V,X,g),g&&nt&2048&&Ug(_.alternate,_);break;default:ea(v,_,V,X,g)}r=r.sibling}}function Il(o,r){if(r.subtreeFlags&10256)for(r=r.child;r!==null;){var l=o,f=r,g=f.flags;switch(f.tag){case 22:Il(l,f),g&2048&&Hg(f.alternate,f);break;case 24:Il(l,f),g&2048&&Ug(f.alternate,f);break;default:Il(l,f)}r=r.sibling}}var Bl=8192;function na(o,r,l){if(o.subtreeFlags&Bl)for(o=o.child;o!==null;)l_(o,r,l),o=o.sibling}function l_(o,r,l){switch(o.tag){case 26:na(o,r,l),o.flags&Bl&&o.memoizedState!==null&&A7(l,so,o.memoizedState,o.memoizedProps);break;case 5:na(o,r,l);break;case 3:case 4:var f=so;so=Vf(o.stateNode.containerInfo),na(o,r,l),so=f;break;case 22:o.memoizedState===null&&(f=o.alternate,f!==null&&f.memoizedState!==null?(f=Bl,Bl=16777216,na(o,r,l),Bl=f):na(o,r,l));break;default:na(o,r,l)}}function c_(o){var r=o.alternate;if(r!==null&&(o=r.child,o!==null)){r.child=null;do r=o.sibling,o.sibling=null,o=r;while(o!==null)}}function Pl(o){var r=o.deletions;if((o.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var f=r[l];Ie=f,f_(f,o)}c_(o)}if(o.subtreeFlags&10256)for(o=o.child;o!==null;)u_(o),o=o.sibling}function u_(o){switch(o.tag){case 0:case 11:case 15:Pl(o),o.flags&2048&&Ji(9,o,o.return);break;case 3:Pl(o);break;case 12:Pl(o);break;case 22:var r=o.stateNode;o.memoizedState!==null&&r._visibility&2&&(o.return===null||o.return.tag!==13)?(r._visibility&=-3,Ef(o)):Pl(o);break;default:Pl(o)}}function Ef(o){var r=o.deletions;if((o.flags&16)!==0){if(r!==null)for(var l=0;l<r.length;l++){var f=r[l];Ie=f,f_(f,o)}c_(o)}for(o=o.child;o!==null;){switch(r=o,r.tag){case 0:case 11:case 15:Ji(8,r,r.return),Ef(r);break;case 22:l=r.stateNode,l._visibility&2&&(l._visibility&=-3,Ef(r));break;default:Ef(r)}o=o.sibling}}function f_(o,r){for(;Ie!==null;){var l=Ie;switch(l.tag){case 0:case 11:case 15:Ji(8,l,r);break;case 23:case 22:if(l.memoizedState!==null&&l.memoizedState.cachePool!==null){var f=l.memoizedState.cachePool.pool;f!=null&&f.refCount++}break;case 24:El(l.memoizedState.cache)}if(f=l.child,f!==null)f.return=l,Ie=f;else t:for(l=o;Ie!==null;){f=Ie;var g=f.sibling,v=f.return;if(e_(f),f===l){Ie=null;break t}if(g!==null){g.return=v,Ie=g;break t}Ie=v}}}var $$={getCacheForType:function(o){var r=$e(Re),l=r.data.get(o);return l===void 0&&(l=o(),r.data.set(o,l)),l},cacheSignal:function(){return $e(Re).controller.signal}},q$=typeof WeakMap=="function"?WeakMap:Map,Wt=0,se=null,Ut=null,Yt=0,Jt=0,En=null,tr=!1,oa=!1,$g=!1,li=0,Se=0,er=0,Jr=0,qg=0,Cn=0,ia=0,Hl=null,cn=null,Yg=!1,Cf=0,d_=0,Tf=1/0,_f=null,nr=null,Ve=0,or=null,ra=null,ci=0,Gg=0,Xg=null,h_=null,Ul=0,Fg=null;function Tn(){return(Wt&2)!==0&&Yt!==0?Yt&-Yt:j.T!==null?t0():$o()}function p_(){if(Cn===0)if((Yt&536870912)===0||Ft){var o=to;to<<=1,(to&3932160)===0&&(to=262144),Cn=o}else Cn=536870912;return o=wn.current,o!==null&&(o.flags|=32),Cn}function un(o,r,l){(o===se&&(Jt===2||Jt===9)||o.cancelPendingCommit!==null)&&(sa(o,0),ir(o,Yt,Cn,!1)),no(o,l),((Wt&2)===0||o!==se)&&(o===se&&((Wt&2)===0&&(Jr|=l),Se===4&&ir(o,Yt,Cn,!1)),Ao(o))}function m_(o,r,l){if((Wt&6)!==0)throw Error(i(327));var f=!l&&(r&127)===0&&(r&o.expiredLanes)===0||eo(o,r),g=f?X$(o,r):Kg(o,r,!0),v=f;do{if(g===0){oa&&!f&&ir(o,r,0,!1);break}else{if(l=o.current.alternate,v&&!Y$(l)){g=Kg(o,r,!1),v=!1;continue}if(g===2){if(v=r,o.errorRecoveryDisabledLanes&v)var _=0;else _=o.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){r=_;t:{var V=o;g=Hl;var X=V.current.memoizedState.isDehydrated;if(X&&(sa(V,_).flags|=256),_=Kg(V,_,!1),_!==2){if($g&&!X){V.errorRecoveryDisabledLanes|=v,Jr|=v,g=4;break t}v=cn,cn=g,v!==null&&(cn===null?cn=v:cn.push.apply(cn,v))}g=_}if(v=!1,g!==2)continue}}if(g===1){sa(o,0),ir(o,r,0,!0);break}t:{switch(f=o,v=g,v){case 0:case 1:throw Error(i(345));case 4:if((r&4194048)!==r)break;case 6:ir(f,r,Cn,!tr);break t;case 2:cn=null;break;case 3:case 5:break;default:throw Error(i(329))}if((r&62914560)===r&&(g=Cf+300-zt(),10<g)){if(ir(f,r,Cn,!tr),Ri(f,0,!0)!==0)break t;ci=r,f.timeoutHandle=G_(g_.bind(null,f,l,cn,_f,Yg,r,Cn,Jr,ia,tr,v,"Throttled",-0,0),g);break t}g_(f,l,cn,_f,Yg,r,Cn,Jr,ia,tr,v,null,-0,0)}}break}while(!0);Ao(o)}function g_(o,r,l,f,g,v,_,V,X,nt,st,ct,ot,rt){if(o.timeoutHandle=-1,ct=r.subtreeFlags,ct&8192||(ct&16785408)===16785408){ct={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Fo},l_(r,v,ct);var xt=(v&62914560)===v?Cf-zt():(v&4194048)===v?d_-zt():0;if(xt=M7(ct,xt),xt!==null){ci=v,o.cancelPendingCommit=xt(C_.bind(null,o,r,v,l,f,g,_,V,X,st,ct,null,ot,rt)),ir(o,v,_,!nt);return}}C_(o,r,v,l,f,g,_,V,X)}function Y$(o){for(var r=o;;){var l=r.tag;if((l===0||l===11||l===15)&&r.flags&16384&&(l=r.updateQueue,l!==null&&(l=l.stores,l!==null)))for(var f=0;f<l.length;f++){var g=l[f],v=g.getSnapshot;g=g.value;try{if(!bn(v(),g))return!1}catch{return!1}}if(l=r.child,r.subtreeFlags&16384&&l!==null)l.return=r,r=l;else{if(r===o)break;for(;r.sibling===null;){if(r.return===null||r.return===o)return!0;r=r.return}r.sibling.return=r.return,r=r.sibling}}return!0}function ir(o,r,l,f){r&=~qg,r&=~Jr,o.suspendedLanes|=r,o.pingedLanes&=~r,f&&(o.warmLanes|=r),f=o.expirationTimes;for(var g=r;0<g;){var v=31-Ee(g),_=1<<v;f[v]=-1,g&=~_}l!==0&&Di(o,l,r)}function Nf(){return(Wt&6)===0?($l(0),!1):!0}function Zg(){if(Ut!==null){if(Jt===0)var o=Ut.return;else o=Ut,Wo=qr=null,fg(o),Ks=null,Tl=0,o=Ut;for(;o!==null;)XT(o.alternate,o),o=o.return;Ut=null}}function sa(o,r){var l=o.timeoutHandle;l!==-1&&(o.timeoutHandle=-1,f7(l)),l=o.cancelPendingCommit,l!==null&&(o.cancelPendingCommit=null,l()),ci=0,Zg(),se=o,Ut=l=Ko(o.current,null),Yt=r,Jt=0,En=null,tr=!1,oa=eo(o,r),$g=!1,ia=Cn=qg=Jr=er=Se=0,cn=Hl=null,Yg=!1,(r&8)!==0&&(r|=r&32);var f=o.entangledLanes;if(f!==0)for(o=o.entanglements,f&=r;0<f;){var g=31-Ee(f),v=1<<g;r|=o[g],f&=~v}return li=r,Xu(),l}function y_(o,r){It=null,j.H=Dl,r===Zs||r===ef?(r=D2(),Jt=3):r===Jm?(r=D2(),Jt=4):Jt=r===Ng?8:r!==null&&typeof r=="object"&&typeof r.then=="function"?6:1,En=r,Ut===null&&(Se=1,gf(o,jn(r,o.current)))}function v_(){var o=wn.current;return o===null?!0:(Yt&4194048)===Yt?In===null:(Yt&62914560)===Yt||(Yt&536870912)!==0?o===In:!1}function b_(){var o=j.H;return j.H=Dl,o===null?Dl:o}function x_(){var o=j.A;return j.A=$$,o}function Af(){Se=4,tr||(Yt&4194048)!==Yt&&wn.current!==null||(oa=!0),(er&134217727)===0&&(Jr&134217727)===0||se===null||ir(se,Yt,Cn,!1)}function Kg(o,r,l){var f=Wt;Wt|=2;var g=b_(),v=x_();(se!==o||Yt!==r)&&(_f=null,sa(o,r)),r=!1;var _=Se;t:do try{if(Jt!==0&&Ut!==null){var V=Ut,X=En;switch(Jt){case 8:Zg(),_=6;break t;case 3:case 2:case 9:case 6:wn.current===null&&(r=!0);var nt=Jt;if(Jt=0,En=null,aa(o,V,X,nt),l&&oa){_=0;break t}break;default:nt=Jt,Jt=0,En=null,aa(o,V,X,nt)}}G$(),_=Se;break}catch(st){y_(o,st)}while(!0);return r&&o.shellSuspendCounter++,Wo=qr=null,Wt=f,j.H=g,j.A=v,Ut===null&&(se=null,Yt=0,Xu()),_}function G$(){for(;Ut!==null;)w_(Ut)}function X$(o,r){var l=Wt;Wt|=2;var f=b_(),g=x_();se!==o||Yt!==r?(_f=null,Tf=zt()+500,sa(o,r)):oa=eo(o,r);t:do try{if(Jt!==0&&Ut!==null){r=Ut;var v=En;e:switch(Jt){case 1:Jt=0,En=null,aa(o,r,v,1);break;case 2:case 9:if(k2(v)){Jt=0,En=null,S_(r);break}r=function(){Jt!==2&&Jt!==9||se!==o||(Jt=7),Ao(o)},v.then(r,r);break t;case 3:Jt=7;break t;case 4:Jt=5;break t;case 7:k2(v)?(Jt=0,En=null,S_(r)):(Jt=0,En=null,aa(o,r,v,7));break;case 5:var _=null;switch(Ut.tag){case 26:_=Ut.memoizedState;case 5:case 27:var V=Ut;if(_?aN(_):V.stateNode.complete){Jt=0,En=null;var X=V.sibling;if(X!==null)Ut=X;else{var nt=V.return;nt!==null?(Ut=nt,Mf(nt)):Ut=null}break e}}Jt=0,En=null,aa(o,r,v,5);break;case 6:Jt=0,En=null,aa(o,r,v,6);break;case 8:Zg(),Se=6;break t;default:throw Error(i(462))}}F$();break}catch(st){y_(o,st)}while(!0);return Wo=qr=null,j.H=f,j.A=g,Wt=l,Ut!==null?0:(se=null,Yt=0,Xu(),Se)}function F$(){for(;Ut!==null&&!Vt();)w_(Ut)}function w_(o){var r=YT(o.alternate,o,li);o.memoizedProps=o.pendingProps,r===null?Mf(o):Ut=r}function S_(o){var r=o,l=r.alternate;switch(r.tag){case 15:case 0:r=BT(l,r,r.pendingProps,r.type,void 0,Yt);break;case 11:r=BT(l,r,r.pendingProps,r.type.render,r.ref,Yt);break;case 5:fg(r);default:XT(l,r),r=Ut=x2(r,li),r=YT(l,r,li)}o.memoizedProps=o.pendingProps,r===null?Mf(o):Ut=r}function aa(o,r,l,f){Wo=qr=null,fg(r),Ks=null,Tl=0;var g=r.return;try{if(V$(o,g,r,l,Yt)){Se=1,gf(o,jn(l,o.current)),Ut=null;return}}catch(v){if(g!==null)throw Ut=g,v;Se=1,gf(o,jn(l,o.current)),Ut=null;return}r.flags&32768?(Ft||f===1?o=!0:oa||(Yt&536870912)!==0?o=!1:(tr=o=!0,(f===2||f===9||f===3||f===6)&&(f=wn.current,f!==null&&f.tag===13&&(f.flags|=16384))),E_(r,o)):Mf(r)}function Mf(o){var r=o;do{if((r.flags&32768)!==0){E_(r,tr);return}o=r.return;var l=B$(r.alternate,r,li);if(l!==null){Ut=l;return}if(r=r.sibling,r!==null){Ut=r;return}Ut=r=o}while(r!==null);Se===0&&(Se=5)}function E_(o,r){do{var l=P$(o.alternate,o);if(l!==null){l.flags&=32767,Ut=l;return}if(l=o.return,l!==null&&(l.flags|=32768,l.subtreeFlags=0,l.deletions=null),!r&&(o=o.sibling,o!==null)){Ut=o;return}Ut=o=l}while(o!==null);Se=6,Ut=null}function C_(o,r,l,f,g,v,_,V,X){o.cancelPendingCommit=null;do Rf();while(Ve!==0);if((Wt&6)!==0)throw Error(i(327));if(r!==null){if(r===o.current)throw Error(i(177));if(v=r.lanes|r.childLanes,v|=Im,Oi(o,l,v,_,V,X),o===se&&(Ut=se=null,Yt=0),ra=r,or=o,ci=l,Gg=v,Xg=g,h_=f,(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?(o.callbackNode=null,o.callbackPriority=0,W$(Pe,function(){return M_(),null})):(o.callbackNode=null,o.callbackPriority=0),f=(r.flags&13878)!==0,(r.subtreeFlags&13878)!==0||f){f=j.T,j.T=null,g=I.p,I.p=2,_=Wt,Wt|=4;try{H$(o,r,l)}finally{Wt=_,I.p=g,j.T=f}}Ve=1,T_(),__(),N_()}}function T_(){if(Ve===1){Ve=0;var o=or,r=ra,l=(r.flags&13878)!==0;if((r.subtreeFlags&13878)!==0||l){l=j.T,j.T=null;var f=I.p;I.p=2;var g=Wt;Wt|=4;try{r_(r,o);var v=l0,_=f2(o.containerInfo),V=v.focusedElem,X=v.selectionRange;if(_!==V&&V&&V.ownerDocument&&u2(V.ownerDocument.documentElement,V)){if(X!==null&&Dm(V)){var nt=X.start,st=X.end;if(st===void 0&&(st=nt),"selectionStart"in V)V.selectionStart=nt,V.selectionEnd=Math.min(st,V.value.length);else{var ct=V.ownerDocument||document,ot=ct&&ct.defaultView||window;if(ot.getSelection){var rt=ot.getSelection(),xt=V.textContent.length,Ot=Math.min(X.start,xt),ie=X.end===void 0?Ot:Math.min(X.end,xt);!rt.extend&&Ot>ie&&(_=ie,ie=Ot,Ot=_);var W=c2(V,Ot),K=c2(V,ie);if(W&&K&&(rt.rangeCount!==1||rt.anchorNode!==W.node||rt.anchorOffset!==W.offset||rt.focusNode!==K.node||rt.focusOffset!==K.offset)){var et=ct.createRange();et.setStart(W.node,W.offset),rt.removeAllRanges(),Ot>ie?(rt.addRange(et),rt.extend(K.node,K.offset)):(et.setEnd(K.node,K.offset),rt.addRange(et))}}}}for(ct=[],rt=V;rt=rt.parentNode;)rt.nodeType===1&&ct.push({element:rt,left:rt.scrollLeft,top:rt.scrollTop});for(typeof V.focus=="function"&&V.focus(),V=0;V<ct.length;V++){var at=ct[V];at.element.scrollLeft=at.left,at.element.scrollTop=at.top}}Uf=!!a0,l0=a0=null}finally{Wt=g,I.p=f,j.T=l}}o.current=r,Ve=2}}function __(){if(Ve===2){Ve=0;var o=or,r=ra,l=(r.flags&8772)!==0;if((r.subtreeFlags&8772)!==0||l){l=j.T,j.T=null;var f=I.p;I.p=2;var g=Wt;Wt|=4;try{t_(o,r.alternate,r)}finally{Wt=g,I.p=f,j.T=l}}Ve=3}}function N_(){if(Ve===4||Ve===3){Ve=0,jt();var o=or,r=ra,l=ci,f=h_;(r.subtreeFlags&10256)!==0||(r.flags&10256)!==0?Ve=5:(Ve=0,ra=or=null,A_(o,o.pendingLanes));var g=o.pendingLanes;if(g===0&&(nr=null),Uo(l),r=r.stateNode,re&&typeof re.onCommitFiberRoot=="function")try{re.onCommitFiberRoot(pe,r,void 0,(r.current.flags&128)===128)}catch{}if(f!==null){r=j.T,g=I.p,I.p=2,j.T=null;try{for(var v=o.onRecoverableError,_=0;_<f.length;_++){var V=f[_];v(V.value,{componentStack:V.stack})}}finally{j.T=r,I.p=g}}(ci&3)!==0&&Rf(),Ao(o),g=o.pendingLanes,(l&261930)!==0&&(g&42)!==0?o===Fg?Ul++:(Ul=0,Fg=o):Ul=0,$l(0)}}function A_(o,r){(o.pooledCacheLanes&=r)===0&&(r=o.pooledCache,r!=null&&(o.pooledCache=null,El(r)))}function Rf(){return T_(),__(),N_(),M_()}function M_(){if(Ve!==5)return!1;var o=or,r=Gg;Gg=0;var l=Uo(ci),f=j.T,g=I.p;try{I.p=32>l?32:l,j.T=null,l=Xg,Xg=null;var v=or,_=ci;if(Ve=0,ra=or=null,ci=0,(Wt&6)!==0)throw Error(i(331));var V=Wt;if(Wt|=4,u_(v.current),a_(v,v.current,_,l),Wt=V,$l(0,!1),re&&typeof re.onPostCommitFiberRoot=="function")try{re.onPostCommitFiberRoot(pe,v)}catch{}return!0}finally{I.p=g,j.T=f,A_(o,r)}}function R_(o,r,l){r=jn(l,r),r=_g(o.stateNode,r,2),o=Ki(o,r,2),o!==null&&(no(o,2),Ao(o))}function te(o,r,l){if(o.tag===3)R_(o,o,l);else for(;r!==null;){if(r.tag===3){R_(r,o,l);break}else if(r.tag===1){var f=r.stateNode;if(typeof r.type.getDerivedStateFromError=="function"||typeof f.componentDidCatch=="function"&&(nr===null||!nr.has(f))){o=jn(l,o),l=kT(2),f=Ki(r,l,2),f!==null&&(OT(l,f,r,o),no(f,2),Ao(f));break}}r=r.return}}function Qg(o,r,l){var f=o.pingCache;if(f===null){f=o.pingCache=new q$;var g=new Set;f.set(r,g)}else g=f.get(r),g===void 0&&(g=new Set,f.set(r,g));g.has(l)||($g=!0,g.add(l),o=Z$.bind(null,o,r,l),r.then(o,o))}function Z$(o,r,l){var f=o.pingCache;f!==null&&f.delete(r),o.pingedLanes|=o.suspendedLanes&l,o.warmLanes&=~l,se===o&&(Yt&l)===l&&(Se===4||Se===3&&(Yt&62914560)===Yt&&300>zt()-Cf?(Wt&2)===0&&sa(o,0):qg|=l,ia===Yt&&(ia=0)),Ao(o)}function k_(o,r){r===0&&(r=ki()),o=Hr(o,r),o!==null&&(no(o,r),Ao(o))}function K$(o){var r=o.memoizedState,l=0;r!==null&&(l=r.retryLane),k_(o,l)}function Q$(o,r){var l=0;switch(o.tag){case 31:case 13:var f=o.stateNode,g=o.memoizedState;g!==null&&(l=g.retryLane);break;case 19:f=o.stateNode;break;case 22:f=o.stateNode._retryCache;break;default:throw Error(i(314))}f!==null&&f.delete(r),k_(o,l)}function W$(o,r){return mt(o,r)}var kf=null,la=null,Wg=!1,Of=!1,Jg=!1,rr=0;function Ao(o){o!==la&&o.next===null&&(la===null?kf=la=o:la=la.next=o),Of=!0,Wg||(Wg=!0,t7())}function $l(o,r){if(!Jg&&Of){Jg=!0;do for(var l=!1,f=kf;f!==null;){if(o!==0){var g=f.pendingLanes;if(g===0)var v=0;else{var _=f.suspendedLanes,V=f.pingedLanes;v=(1<<31-Ee(42|o)+1)-1,v&=g&~(_&~V),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(l=!0,z_(f,v))}else v=Yt,v=Ri(f,f===se?v:0,f.cancelPendingCommit!==null||f.timeoutHandle!==-1),(v&3)===0||eo(f,v)||(l=!0,z_(f,v));f=f.next}while(l);Jg=!1}}function J$(){O_()}function O_(){Of=Wg=!1;var o=0;rr!==0&&u7()&&(o=rr);for(var r=zt(),l=null,f=kf;f!==null;){var g=f.next,v=D_(f,r);v===0?(f.next=null,l===null?kf=g:l.next=g,g===null&&(la=l)):(l=f,(o!==0||(v&3)!==0)&&(Of=!0)),f=g}Ve!==0&&Ve!==5||$l(o),rr!==0&&(rr=0)}function D_(o,r){for(var l=o.suspendedLanes,f=o.pingedLanes,g=o.expirationTimes,v=o.pendingLanes&-62914561;0<v;){var _=31-Ee(v),V=1<<_,X=g[_];X===-1?((V&l)===0||(V&f)!==0)&&(g[_]=tn(V,r)):X<=r&&(o.expiredLanes|=V),v&=~V}if(r=se,l=Yt,l=Ri(o,o===r?l:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),f=o.callbackNode,l===0||o===r&&(Jt===2||Jt===9)||o.cancelPendingCommit!==null)return f!==null&&f!==null&&Et(f),o.callbackNode=null,o.callbackPriority=0;if((l&3)===0||eo(o,l)){if(r=l&-l,r===o.callbackPriority)return r;switch(f!==null&&Et(f),Uo(l)){case 2:case 8:l=xe;break;case 32:l=Pe;break;case 268435456:l=Ae;break;default:l=Pe}return f=j_.bind(null,o),l=mt(l,f),o.callbackPriority=r,o.callbackNode=l,r}return f!==null&&f!==null&&Et(f),o.callbackPriority=2,o.callbackNode=null,2}function j_(o,r){if(Ve!==0&&Ve!==5)return o.callbackNode=null,o.callbackPriority=0,null;var l=o.callbackNode;if(Rf()&&o.callbackNode!==l)return null;var f=Yt;return f=Ri(o,o===se?f:0,o.cancelPendingCommit!==null||o.timeoutHandle!==-1),f===0?null:(m_(o,f,r),D_(o,zt()),o.callbackNode!=null&&o.callbackNode===l?j_.bind(null,o):null)}function z_(o,r){if(Rf())return null;m_(o,r,!0)}function t7(){d7(function(){(Wt&6)!==0?mt(Xt,J$):O_()})}function t0(){if(rr===0){var o=Xs;o===0&&(o=Jn,Jn<<=1,(Jn&261888)===0&&(Jn=256)),rr=o}return rr}function V_(o){return o==null||typeof o=="symbol"||typeof o=="boolean"?null:typeof o=="function"?o:Bu(""+o)}function L_(o,r){var l=r.ownerDocument.createElement("input");return l.name=r.name,l.value=r.value,o.id&&l.setAttribute("form",o.id),r.parentNode.insertBefore(l,r),o=new FormData(o),l.parentNode.removeChild(l),o}function e7(o,r,l,f,g){if(r==="submit"&&l&&l.stateNode===g){var v=V_((g[Me]||null).action),_=f.submitter;_&&(r=(r=_[Me]||null)?V_(r.formAction):_.getAttribute("formAction"),r!==null&&(v=r,_=null));var V=new $u("action","action",null,f,g);o.push({event:V,listeners:[{instance:null,listener:function(){if(f.defaultPrevented){if(rr!==0){var X=_?L_(g,_):new FormData(g);xg(l,{pending:!0,data:X,method:g.method,action:v},null,X)}}else typeof v=="function"&&(V.preventDefault(),X=_?L_(g,_):new FormData(g),xg(l,{pending:!0,data:X,method:g.method,action:v},v,X))},currentTarget:g}]})}}for(var e0=0;e0<Lm.length;e0++){var n0=Lm[e0],n7=n0.toLowerCase(),o7=n0[0].toUpperCase()+n0.slice(1);ro(n7,"on"+o7)}ro(p2,"onAnimationEnd"),ro(m2,"onAnimationIteration"),ro(g2,"onAnimationStart"),ro("dblclick","onDoubleClick"),ro("focusin","onFocus"),ro("focusout","onBlur"),ro(b$,"onTransitionRun"),ro(x$,"onTransitionStart"),ro(w$,"onTransitionCancel"),ro(y2,"onTransitionEnd"),On("onMouseEnter",["mouseout","mouseover"]),On("onMouseLeave",["mouseout","mouseover"]),On("onPointerEnter",["pointerout","pointerover"]),On("onPointerLeave",["pointerout","pointerover"]),vn("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),vn("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),vn("onBeforeInput",["compositionend","keypress","textInput","paste"]),vn("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),vn("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),vn("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ql="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),i7=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ql));function I_(o,r){r=(r&4)!==0;for(var l=0;l<o.length;l++){var f=o[l],g=f.event;f=f.listeners;t:{var v=void 0;if(r)for(var _=f.length-1;0<=_;_--){var V=f[_],X=V.instance,nt=V.currentTarget;if(V=V.listener,X!==v&&g.isPropagationStopped())break t;v=V,g.currentTarget=nt;try{v(g)}catch(st){Gu(st)}g.currentTarget=null,v=X}else for(_=0;_<f.length;_++){if(V=f[_],X=V.instance,nt=V.currentTarget,V=V.listener,X!==v&&g.isPropagationStopped())break t;v=V,g.currentTarget=nt;try{v(g)}catch(st){Gu(st)}g.currentTarget=null,v=X}}}}function $t(o,r){var l=r[Co];l===void 0&&(l=r[Co]=new Set);var f=o+"__bubble";l.has(f)||(B_(r,o,2,!1),l.add(f))}function o0(o,r,l){var f=0;r&&(f|=4),B_(l,o,f,r)}var Df="_reactListening"+Math.random().toString(36).slice(2);function i0(o){if(!o[Df]){o[Df]=!0,Bi.forEach(function(l){l!=="selectionchange"&&(i7.has(l)||o0(l,!1,o),o0(l,!0,o))});var r=o.nodeType===9?o:o.ownerDocument;r===null||r[Df]||(r[Df]=!0,o0("selectionchange",!1,r))}}function B_(o,r,l,f){switch(pN(r)){case 2:var g=O7;break;case 8:g=D7;break;default:g=b0}l=g.bind(null,r,l,o),g=void 0,!Cm||r!=="touchstart"&&r!=="touchmove"&&r!=="wheel"||(g=!0),f?g!==void 0?o.addEventListener(r,l,{capture:!0,passive:g}):o.addEventListener(r,l,!0):g!==void 0?o.addEventListener(r,l,{passive:g}):o.addEventListener(r,l,!1)}function r0(o,r,l,f,g){var v=f;if((r&1)===0&&(r&2)===0&&f!==null)t:for(;;){if(f===null)return;var _=f.tag;if(_===3||_===4){var V=f.stateNode.containerInfo;if(V===g)break;if(_===4)for(_=f.return;_!==null;){var X=_.tag;if((X===3||X===4)&&_.stateNode.containerInfo===g)return;_=_.return}for(;V!==null;){if(_=Mn(V),_===null)return;if(X=_.tag,X===5||X===6||X===26||X===27){f=v=_;continue t}V=V.parentNode}}f=f.return}qC(function(){var nt=v,st=Sm(l),ct=[];t:{var ot=v2.get(o);if(ot!==void 0){var rt=$u,xt=o;switch(o){case"keypress":if(Hu(l)===0)break t;case"keydown":case"keyup":rt=Q9;break;case"focusin":xt="focus",rt=Am;break;case"focusout":xt="blur",rt=Am;break;case"beforeblur":case"afterblur":rt=Am;break;case"click":if(l.button===2)break t;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":rt=XC;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":rt=B9;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":rt=t$;break;case p2:case m2:case g2:rt=U9;break;case y2:rt=n$;break;case"scroll":case"scrollend":rt=L9;break;case"wheel":rt=i$;break;case"copy":case"cut":case"paste":rt=q9;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":rt=ZC;break;case"toggle":case"beforetoggle":rt=s$}var Ot=(r&4)!==0,ie=!Ot&&(o==="scroll"||o==="scrollend"),W=Ot?ot!==null?ot+"Capture":null:ot;Ot=[];for(var K=nt,et;K!==null;){var at=K;if(et=at.stateNode,at=at.tag,at!==5&&at!==26&&at!==27||et===null||W===null||(at=dl(K,W),at!=null&&Ot.push(Yl(K,at,et))),ie)break;K=K.return}0<Ot.length&&(ot=new rt(ot,xt,null,l,st),ct.push({event:ot,listeners:Ot}))}}if((r&7)===0){t:{if(ot=o==="mouseover"||o==="pointerover",rt=o==="mouseout"||o==="pointerout",ot&&l!==wm&&(xt=l.relatedTarget||l.fromElement)&&(Mn(xt)||xt[gn]))break t;if((rt||ot)&&(ot=st.window===st?st:(ot=st.ownerDocument)?ot.defaultView||ot.parentWindow:window,rt?(xt=l.relatedTarget||l.toElement,rt=nt,xt=xt?Mn(xt):null,xt!==null&&(ie=a(xt),Ot=xt.tag,xt!==ie||Ot!==5&&Ot!==27&&Ot!==6)&&(xt=null)):(rt=null,xt=nt),rt!==xt)){if(Ot=XC,at="onMouseLeave",W="onMouseEnter",K="mouse",(o==="pointerout"||o==="pointerover")&&(Ot=ZC,at="onPointerLeave",W="onPointerEnter",K="pointer"),ie=rt==null?ot:Rn(rt),et=xt==null?ot:Rn(xt),ot=new Ot(at,K+"leave",rt,l,st),ot.target=ie,ot.relatedTarget=et,at=null,Mn(st)===nt&&(Ot=new Ot(W,K+"enter",xt,l,st),Ot.target=et,Ot.relatedTarget=ie,at=Ot),ie=at,rt&&xt)e:{for(Ot=r7,W=rt,K=xt,et=0,at=W;at;at=Ot(at))et++;at=0;for(var Rt=K;Rt;Rt=Ot(Rt))at++;for(;0<et-at;)W=Ot(W),et--;for(;0<at-et;)K=Ot(K),at--;for(;et--;){if(W===K||K!==null&&W===K.alternate){Ot=W;break e}W=Ot(W),K=Ot(K)}Ot=null}else Ot=null;rt!==null&&P_(ct,ot,rt,Ot,!1),xt!==null&&ie!==null&&P_(ct,ie,xt,Ot,!0)}}t:{if(ot=nt?Rn(nt):window,rt=ot.nodeName&&ot.nodeName.toLowerCase(),rt==="select"||rt==="input"&&ot.type==="file")var Kt=o2;else if(e2(ot))if(i2)Kt=g$;else{Kt=p$;var _t=h$}else rt=ot.nodeName,!rt||rt.toLowerCase()!=="input"||ot.type!=="checkbox"&&ot.type!=="radio"?nt&&xm(nt.elementType)&&(Kt=o2):Kt=m$;if(Kt&&(Kt=Kt(o,nt))){n2(ct,Kt,l,st);break t}_t&&_t(o,ot,nt),o==="focusout"&&nt&&ot.type==="number"&&nt.memoizedProps.value!=null&&fl(ot,"number",ot.value)}switch(_t=nt?Rn(nt):window,o){case"focusin":(e2(_t)||_t.contentEditable==="true")&&(Bs=_t,jm=nt,xl=null);break;case"focusout":xl=jm=Bs=null;break;case"mousedown":zm=!0;break;case"contextmenu":case"mouseup":case"dragend":zm=!1,d2(ct,l,st);break;case"selectionchange":if(v$)break;case"keydown":case"keyup":d2(ct,l,st)}var Bt;if(Rm)t:{switch(o){case"compositionstart":var Gt="onCompositionStart";break t;case"compositionend":Gt="onCompositionEnd";break t;case"compositionupdate":Gt="onCompositionUpdate";break t}Gt=void 0}else Is?JC(o,l)&&(Gt="onCompositionEnd"):o==="keydown"&&l.keyCode===229&&(Gt="onCompositionStart");Gt&&(KC&&l.locale!=="ko"&&(Is||Gt!=="onCompositionStart"?Gt==="onCompositionEnd"&&Is&&(Bt=YC()):($i=st,Tm="value"in $i?$i.value:$i.textContent,Is=!0)),_t=jf(nt,Gt),0<_t.length&&(Gt=new FC(Gt,o,null,l,st),ct.push({event:Gt,listeners:_t}),Bt?Gt.data=Bt:(Bt=t2(l),Bt!==null&&(Gt.data=Bt)))),(Bt=l$?c$(o,l):u$(o,l))&&(Gt=jf(nt,"onBeforeInput"),0<Gt.length&&(_t=new FC("onBeforeInput","beforeinput",null,l,st),ct.push({event:_t,listeners:Gt}),_t.data=Bt)),e7(ct,o,nt,l,st)}I_(ct,r)})}function Yl(o,r,l){return{instance:o,listener:r,currentTarget:l}}function jf(o,r){for(var l=r+"Capture",f=[];o!==null;){var g=o,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=dl(o,l),g!=null&&f.unshift(Yl(o,g,v)),g=dl(o,r),g!=null&&f.push(Yl(o,g,v))),o.tag===3)return f;o=o.return}return[]}function r7(o){if(o===null)return null;do o=o.return;while(o&&o.tag!==5&&o.tag!==27);return o||null}function P_(o,r,l,f,g){for(var v=r._reactName,_=[];l!==null&&l!==f;){var V=l,X=V.alternate,nt=V.stateNode;if(V=V.tag,X!==null&&X===f)break;V!==5&&V!==26&&V!==27||nt===null||(X=nt,g?(nt=dl(l,v),nt!=null&&_.unshift(Yl(l,nt,X))):g||(nt=dl(l,v),nt!=null&&_.push(Yl(l,nt,X)))),l=l.return}_.length!==0&&o.push({event:r,listeners:_})}var s7=/\r\n?/g,a7=/\u0000|\uFFFD/g;function H_(o){return(typeof o=="string"?o:""+o).replace(s7,`
9
+ `).replace(a7,"")}function U_(o,r){return r=H_(r),H_(o)===r}function oe(o,r,l,f,g,v){switch(l){case"children":typeof f=="string"?r==="body"||r==="textarea"&&f===""||zs(o,f):(typeof f=="number"||typeof f=="bigint")&&r!=="body"&&zs(o,""+f);break;case"className":Go(o,"class",f);break;case"tabIndex":Go(o,"tabindex",f);break;case"dir":case"role":case"viewBox":case"width":case"height":Go(o,l,f);break;case"style":UC(o,f,v);break;case"data":if(r!=="object"){Go(o,"data",f);break}case"src":case"href":if(f===""&&(r!=="a"||l!=="href")){o.removeAttribute(l);break}if(f==null||typeof f=="function"||typeof f=="symbol"||typeof f=="boolean"){o.removeAttribute(l);break}f=Bu(""+f),o.setAttribute(l,f);break;case"action":case"formAction":if(typeof f=="function"){o.setAttribute(l,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(l==="formAction"?(r!=="input"&&oe(o,r,"name",g.name,g,null),oe(o,r,"formEncType",g.formEncType,g,null),oe(o,r,"formMethod",g.formMethod,g,null),oe(o,r,"formTarget",g.formTarget,g,null)):(oe(o,r,"encType",g.encType,g,null),oe(o,r,"method",g.method,g,null),oe(o,r,"target",g.target,g,null)));if(f==null||typeof f=="symbol"||typeof f=="boolean"){o.removeAttribute(l);break}f=Bu(""+f),o.setAttribute(l,f);break;case"onClick":f!=null&&(o.onclick=Fo);break;case"onScroll":f!=null&&$t("scroll",o);break;case"onScrollEnd":f!=null&&$t("scrollend",o);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(l=f.__html,l!=null){if(g.children!=null)throw Error(i(60));o.innerHTML=l}}break;case"multiple":o.multiple=f&&typeof f!="function"&&typeof f!="symbol";break;case"muted":o.muted=f&&typeof f!="function"&&typeof f!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(f==null||typeof f=="function"||typeof f=="boolean"||typeof f=="symbol"){o.removeAttribute("xlink:href");break}l=Bu(""+f),o.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",l);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":f!=null&&typeof f!="function"&&typeof f!="symbol"?o.setAttribute(l,""+f):o.removeAttribute(l);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":f&&typeof f!="function"&&typeof f!="symbol"?o.setAttribute(l,""):o.removeAttribute(l);break;case"capture":case"download":f===!0?o.setAttribute(l,""):f!==!1&&f!=null&&typeof f!="function"&&typeof f!="symbol"?o.setAttribute(l,f):o.removeAttribute(l);break;case"cols":case"rows":case"size":case"span":f!=null&&typeof f!="function"&&typeof f!="symbol"&&!isNaN(f)&&1<=f?o.setAttribute(l,f):o.removeAttribute(l);break;case"rowSpan":case"start":f==null||typeof f=="function"||typeof f=="symbol"||isNaN(f)?o.removeAttribute(l):o.setAttribute(l,f);break;case"popover":$t("beforetoggle",o),$t("toggle",o),He(o,"popover",f);break;case"xlinkActuate":io(o,"http://www.w3.org/1999/xlink","xlink:actuate",f);break;case"xlinkArcrole":io(o,"http://www.w3.org/1999/xlink","xlink:arcrole",f);break;case"xlinkRole":io(o,"http://www.w3.org/1999/xlink","xlink:role",f);break;case"xlinkShow":io(o,"http://www.w3.org/1999/xlink","xlink:show",f);break;case"xlinkTitle":io(o,"http://www.w3.org/1999/xlink","xlink:title",f);break;case"xlinkType":io(o,"http://www.w3.org/1999/xlink","xlink:type",f);break;case"xmlBase":io(o,"http://www.w3.org/XML/1998/namespace","xml:base",f);break;case"xmlLang":io(o,"http://www.w3.org/XML/1998/namespace","xml:lang",f);break;case"xmlSpace":io(o,"http://www.w3.org/XML/1998/namespace","xml:space",f);break;case"is":He(o,"is",f);break;case"innerText":case"textContent":break;default:(!(2<l.length)||l[0]!=="o"&&l[0]!=="O"||l[1]!=="n"&&l[1]!=="N")&&(l=z9.get(l)||l,He(o,l,f))}}function s0(o,r,l,f,g,v){switch(l){case"style":UC(o,f,v);break;case"dangerouslySetInnerHTML":if(f!=null){if(typeof f!="object"||!("__html"in f))throw Error(i(61));if(l=f.__html,l!=null){if(g.children!=null)throw Error(i(60));o.innerHTML=l}}break;case"children":typeof f=="string"?zs(o,f):(typeof f=="number"||typeof f=="bigint")&&zs(o,""+f);break;case"onScroll":f!=null&&$t("scroll",o);break;case"onScrollEnd":f!=null&&$t("scrollend",o);break;case"onClick":f!=null&&(o.onclick=Fo);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pi.hasOwnProperty(l))t:{if(l[0]==="o"&&l[1]==="n"&&(g=l.endsWith("Capture"),r=l.slice(2,g?l.length-7:void 0),v=o[Me]||null,v=v!=null?v[l]:null,typeof v=="function"&&o.removeEventListener(r,v,g),typeof f=="function")){typeof v!="function"&&v!==null&&(l in o?o[l]=null:o.hasAttribute(l)&&o.removeAttribute(l)),o.addEventListener(r,f,g);break t}l in o?o[l]=f:f===!0?o.setAttribute(l,""):He(o,l,f)}}}function Ye(o,r,l){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":$t("error",o),$t("load",o);var f=!1,g=!1,v;for(v in l)if(l.hasOwnProperty(v)){var _=l[v];if(_!=null)switch(v){case"src":f=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:oe(o,r,v,_,l,null)}}g&&oe(o,r,"srcSet",l.srcSet,l,null),f&&oe(o,r,"src",l.src,l,null);return;case"input":$t("invalid",o);var V=v=_=g=null,X=null,nt=null;for(f in l)if(l.hasOwnProperty(f)){var st=l[f];if(st!=null)switch(f){case"name":g=st;break;case"type":_=st;break;case"checked":X=st;break;case"defaultChecked":nt=st;break;case"value":v=st;break;case"defaultValue":V=st;break;case"children":case"dangerouslySetInnerHTML":if(st!=null)throw Error(i(137,r));break;default:oe(o,r,f,st,l,null)}}Iu(o,v,V,X,nt,_,g,!1);return;case"select":$t("invalid",o),f=_=v=null;for(g in l)if(l.hasOwnProperty(g)&&(V=l[g],V!=null))switch(g){case"value":v=V;break;case"defaultValue":_=V;break;case"multiple":f=V;default:oe(o,r,g,V,l,null)}r=v,l=_,o.multiple=!!f,r!=null?Xo(o,!!f,r,!1):l!=null&&Xo(o,!!f,l,!0);return;case"textarea":$t("invalid",o),v=g=f=null;for(_ in l)if(l.hasOwnProperty(_)&&(V=l[_],V!=null))switch(_){case"value":f=V;break;case"defaultValue":g=V;break;case"children":v=V;break;case"dangerouslySetInnerHTML":if(V!=null)throw Error(i(91));break;default:oe(o,r,_,V,l,null)}PC(o,f,g,v);return;case"option":for(X in l)l.hasOwnProperty(X)&&(f=l[X],f!=null)&&(X==="selected"?o.selected=f&&typeof f!="function"&&typeof f!="symbol":oe(o,r,X,f,l,null));return;case"dialog":$t("beforetoggle",o),$t("toggle",o),$t("cancel",o),$t("close",o);break;case"iframe":case"object":$t("load",o);break;case"video":case"audio":for(f=0;f<ql.length;f++)$t(ql[f],o);break;case"image":$t("error",o),$t("load",o);break;case"details":$t("toggle",o);break;case"embed":case"source":case"link":$t("error",o),$t("load",o);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(nt in l)if(l.hasOwnProperty(nt)&&(f=l[nt],f!=null))switch(nt){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,r));default:oe(o,r,nt,f,l,null)}return;default:if(xm(r)){for(st in l)l.hasOwnProperty(st)&&(f=l[st],f!==void 0&&s0(o,r,st,f,l,void 0));return}}for(V in l)l.hasOwnProperty(V)&&(f=l[V],f!=null&&oe(o,r,V,f,l,null))}function l7(o,r,l,f){switch(r){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,v=null,_=null,V=null,X=null,nt=null,st=null;for(rt in l){var ct=l[rt];if(l.hasOwnProperty(rt)&&ct!=null)switch(rt){case"checked":break;case"value":break;case"defaultValue":X=ct;default:f.hasOwnProperty(rt)||oe(o,r,rt,null,f,ct)}}for(var ot in f){var rt=f[ot];if(ct=l[ot],f.hasOwnProperty(ot)&&(rt!=null||ct!=null))switch(ot){case"type":v=rt;break;case"name":g=rt;break;case"checked":nt=rt;break;case"defaultChecked":st=rt;break;case"value":_=rt;break;case"defaultValue":V=rt;break;case"children":case"dangerouslySetInnerHTML":if(rt!=null)throw Error(i(137,r));break;default:rt!==ct&&oe(o,r,ot,rt,f,ct)}}Lr(o,_,V,X,nt,st,v,g);return;case"select":rt=_=V=ot=null;for(v in l)if(X=l[v],l.hasOwnProperty(v)&&X!=null)switch(v){case"value":break;case"multiple":rt=X;default:f.hasOwnProperty(v)||oe(o,r,v,null,f,X)}for(g in f)if(v=f[g],X=l[g],f.hasOwnProperty(g)&&(v!=null||X!=null))switch(g){case"value":ot=v;break;case"defaultValue":V=v;break;case"multiple":_=v;default:v!==X&&oe(o,r,g,v,f,X)}r=V,l=_,f=rt,ot!=null?Xo(o,!!l,ot,!1):!!f!=!!l&&(r!=null?Xo(o,!!l,r,!0):Xo(o,!!l,l?[]:"",!1));return;case"textarea":rt=ot=null;for(V in l)if(g=l[V],l.hasOwnProperty(V)&&g!=null&&!f.hasOwnProperty(V))switch(V){case"value":break;case"children":break;default:oe(o,r,V,null,f,g)}for(_ in f)if(g=f[_],v=l[_],f.hasOwnProperty(_)&&(g!=null||v!=null))switch(_){case"value":ot=g;break;case"defaultValue":rt=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(i(91));break;default:g!==v&&oe(o,r,_,g,f,v)}BC(o,ot,rt);return;case"option":for(var xt in l)ot=l[xt],l.hasOwnProperty(xt)&&ot!=null&&!f.hasOwnProperty(xt)&&(xt==="selected"?o.selected=!1:oe(o,r,xt,null,f,ot));for(X in f)ot=f[X],rt=l[X],f.hasOwnProperty(X)&&ot!==rt&&(ot!=null||rt!=null)&&(X==="selected"?o.selected=ot&&typeof ot!="function"&&typeof ot!="symbol":oe(o,r,X,ot,f,rt));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ot in l)ot=l[Ot],l.hasOwnProperty(Ot)&&ot!=null&&!f.hasOwnProperty(Ot)&&oe(o,r,Ot,null,f,ot);for(nt in f)if(ot=f[nt],rt=l[nt],f.hasOwnProperty(nt)&&ot!==rt&&(ot!=null||rt!=null))switch(nt){case"children":case"dangerouslySetInnerHTML":if(ot!=null)throw Error(i(137,r));break;default:oe(o,r,nt,ot,f,rt)}return;default:if(xm(r)){for(var ie in l)ot=l[ie],l.hasOwnProperty(ie)&&ot!==void 0&&!f.hasOwnProperty(ie)&&s0(o,r,ie,void 0,f,ot);for(st in f)ot=f[st],rt=l[st],!f.hasOwnProperty(st)||ot===rt||ot===void 0&&rt===void 0||s0(o,r,st,ot,f,rt);return}}for(var W in l)ot=l[W],l.hasOwnProperty(W)&&ot!=null&&!f.hasOwnProperty(W)&&oe(o,r,W,null,f,ot);for(ct in f)ot=f[ct],rt=l[ct],!f.hasOwnProperty(ct)||ot===rt||ot==null&&rt==null||oe(o,r,ct,ot,f,rt)}function $_(o){switch(o){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function c7(){if(typeof performance.getEntriesByType=="function"){for(var o=0,r=0,l=performance.getEntriesByType("resource"),f=0;f<l.length;f++){var g=l[f],v=g.transferSize,_=g.initiatorType,V=g.duration;if(v&&V&&$_(_)){for(_=0,V=g.responseEnd,f+=1;f<l.length;f++){var X=l[f],nt=X.startTime;if(nt>V)break;var st=X.transferSize,ct=X.initiatorType;st&&$_(ct)&&(X=X.responseEnd,_+=st*(X<V?1:(V-nt)/(X-nt)))}if(--f,r+=8*(v+_)/(g.duration/1e3),o++,10<o)break}}if(0<o)return r/o/1e6}return navigator.connection&&(o=navigator.connection.downlink,typeof o=="number")?o:5}var a0=null,l0=null;function zf(o){return o.nodeType===9?o:o.ownerDocument}function q_(o){switch(o){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Y_(o,r){if(o===0)switch(r){case"svg":return 1;case"math":return 2;default:return 0}return o===1&&r==="foreignObject"?0:o}function c0(o,r){return o==="textarea"||o==="noscript"||typeof r.children=="string"||typeof r.children=="number"||typeof r.children=="bigint"||typeof r.dangerouslySetInnerHTML=="object"&&r.dangerouslySetInnerHTML!==null&&r.dangerouslySetInnerHTML.__html!=null}var u0=null;function u7(){var o=window.event;return o&&o.type==="popstate"?o===u0?!1:(u0=o,!0):(u0=null,!1)}var G_=typeof setTimeout=="function"?setTimeout:void 0,f7=typeof clearTimeout=="function"?clearTimeout:void 0,X_=typeof Promise=="function"?Promise:void 0,d7=typeof queueMicrotask=="function"?queueMicrotask:typeof X_<"u"?function(o){return X_.resolve(null).then(o).catch(h7)}:G_;function h7(o){setTimeout(function(){throw o})}function sr(o){return o==="head"}function F_(o,r){var l=r,f=0;do{var g=l.nextSibling;if(o.removeChild(l),g&&g.nodeType===8)if(l=g.data,l==="/$"||l==="/&"){if(f===0){o.removeChild(g),da(r);return}f--}else if(l==="$"||l==="$?"||l==="$~"||l==="$!"||l==="&")f++;else if(l==="html")Gl(o.ownerDocument.documentElement);else if(l==="head"){l=o.ownerDocument.head,Gl(l);for(var v=l.firstChild;v;){var _=v.nextSibling,V=v.nodeName;v[oo]||V==="SCRIPT"||V==="STYLE"||V==="LINK"&&v.rel.toLowerCase()==="stylesheet"||l.removeChild(v),v=_}}else l==="body"&&Gl(o.ownerDocument.body);l=g}while(l);da(r)}function Z_(o,r){var l=o;o=0;do{var f=l.nextSibling;if(l.nodeType===1?r?(l._stashedDisplay=l.style.display,l.style.display="none"):(l.style.display=l._stashedDisplay||"",l.getAttribute("style")===""&&l.removeAttribute("style")):l.nodeType===3&&(r?(l._stashedText=l.nodeValue,l.nodeValue=""):l.nodeValue=l._stashedText||""),f&&f.nodeType===8)if(l=f.data,l==="/$"){if(o===0)break;o--}else l!=="$"&&l!=="$?"&&l!=="$~"&&l!=="$!"||o++;l=f}while(l)}function f0(o){var r=o.firstChild;for(r&&r.nodeType===10&&(r=r.nextSibling);r;){var l=r;switch(r=r.nextSibling,l.nodeName){case"HTML":case"HEAD":case"BODY":f0(l),qo(l);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(l.rel.toLowerCase()==="stylesheet")continue}o.removeChild(l)}}function p7(o,r,l,f){for(;o.nodeType===1;){var g=l;if(o.nodeName.toLowerCase()!==r.toLowerCase()){if(!f&&(o.nodeName!=="INPUT"||o.type!=="hidden"))break}else if(f){if(!o[oo])switch(r){case"meta":if(!o.hasAttribute("itemprop"))break;return o;case"link":if(v=o.getAttribute("rel"),v==="stylesheet"&&o.hasAttribute("data-precedence"))break;if(v!==g.rel||o.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||o.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||o.getAttribute("title")!==(g.title==null?null:g.title))break;return o;case"style":if(o.hasAttribute("data-precedence"))break;return o;case"script":if(v=o.getAttribute("src"),(v!==(g.src==null?null:g.src)||o.getAttribute("type")!==(g.type==null?null:g.type)||o.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&o.hasAttribute("async")&&!o.hasAttribute("itemprop"))break;return o;default:return o}}else if(r==="input"&&o.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&o.getAttribute("name")===v)return o}else return o;if(o=Bn(o.nextSibling),o===null)break}return null}function m7(o,r,l){if(r==="")return null;for(;o.nodeType!==3;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!l||(o=Bn(o.nextSibling),o===null))return null;return o}function K_(o,r){for(;o.nodeType!==8;)if((o.nodeType!==1||o.nodeName!=="INPUT"||o.type!=="hidden")&&!r||(o=Bn(o.nextSibling),o===null))return null;return o}function d0(o){return o.data==="$?"||o.data==="$~"}function h0(o){return o.data==="$!"||o.data==="$?"&&o.ownerDocument.readyState!=="loading"}function g7(o,r){var l=o.ownerDocument;if(o.data==="$~")o._reactRetry=r;else if(o.data!=="$?"||l.readyState!=="loading")r();else{var f=function(){r(),l.removeEventListener("DOMContentLoaded",f)};l.addEventListener("DOMContentLoaded",f),o._reactRetry=f}}function Bn(o){for(;o!=null;o=o.nextSibling){var r=o.nodeType;if(r===1||r===3)break;if(r===8){if(r=o.data,r==="$"||r==="$!"||r==="$?"||r==="$~"||r==="&"||r==="F!"||r==="F")break;if(r==="/$"||r==="/&")return null}}return o}var p0=null;function Q_(o){o=o.nextSibling;for(var r=0;o;){if(o.nodeType===8){var l=o.data;if(l==="/$"||l==="/&"){if(r===0)return Bn(o.nextSibling);r--}else l!=="$"&&l!=="$!"&&l!=="$?"&&l!=="$~"&&l!=="&"||r++}o=o.nextSibling}return null}function W_(o){o=o.previousSibling;for(var r=0;o;){if(o.nodeType===8){var l=o.data;if(l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"){if(r===0)return o;r--}else l!=="/$"&&l!=="/&"||r++}o=o.previousSibling}return null}function J_(o,r,l){switch(r=zf(l),o){case"html":if(o=r.documentElement,!o)throw Error(i(452));return o;case"head":if(o=r.head,!o)throw Error(i(453));return o;case"body":if(o=r.body,!o)throw Error(i(454));return o;default:throw Error(i(451))}}function Gl(o){for(var r=o.attributes;r.length;)o.removeAttributeNode(r[0]);qo(o)}var Pn=new Map,tN=new Set;function Vf(o){return typeof o.getRootNode=="function"?o.getRootNode():o.nodeType===9?o:o.ownerDocument}var ui=I.d;I.d={f:y7,r:v7,D:b7,C:x7,L:w7,m:S7,X:C7,S:E7,M:T7};function y7(){var o=ui.f(),r=Nf();return o||r}function v7(o){var r=yn(o);r!==null&&r.tag===5&&r.type==="form"?yT(r):ui.r(o)}var ca=typeof document>"u"?null:document;function eN(o,r,l){var f=ca;if(f&&typeof r=="string"&&r){var g=on(r);g='link[rel="'+o+'"][href="'+g+'"]',typeof l=="string"&&(g+='[crossorigin="'+l+'"]'),tN.has(g)||(tN.add(g),o={rel:o,crossOrigin:l,href:r},f.querySelector(g)===null&&(r=f.createElement("link"),Ye(r,"link",o),me(r),f.head.appendChild(r)))}}function b7(o){ui.D(o),eN("dns-prefetch",o,null)}function x7(o,r){ui.C(o,r),eN("preconnect",o,r)}function w7(o,r,l){ui.L(o,r,l);var f=ca;if(f&&o&&r){var g='link[rel="preload"][as="'+on(r)+'"]';r==="image"&&l&&l.imageSrcSet?(g+='[imagesrcset="'+on(l.imageSrcSet)+'"]',typeof l.imageSizes=="string"&&(g+='[imagesizes="'+on(l.imageSizes)+'"]')):g+='[href="'+on(o)+'"]';var v=g;switch(r){case"style":v=ua(o);break;case"script":v=fa(o)}Pn.has(v)||(o=m({rel:"preload",href:r==="image"&&l&&l.imageSrcSet?void 0:o,as:r},l),Pn.set(v,o),f.querySelector(g)!==null||r==="style"&&f.querySelector(Xl(v))||r==="script"&&f.querySelector(Fl(v))||(r=f.createElement("link"),Ye(r,"link",o),me(r),f.head.appendChild(r)))}}function S7(o,r){ui.m(o,r);var l=ca;if(l&&o){var f=r&&typeof r.as=="string"?r.as:"script",g='link[rel="modulepreload"][as="'+on(f)+'"][href="'+on(o)+'"]',v=g;switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=fa(o)}if(!Pn.has(v)&&(o=m({rel:"modulepreload",href:o},r),Pn.set(v,o),l.querySelector(g)===null)){switch(f){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(l.querySelector(Fl(v)))return}f=l.createElement("link"),Ye(f,"link",o),me(f),l.head.appendChild(f)}}}function E7(o,r,l){ui.S(o,r,l);var f=ca;if(f&&o){var g=kn(f).hoistableStyles,v=ua(o);r=r||"default";var _=g.get(v);if(!_){var V={loading:0,preload:null};if(_=f.querySelector(Xl(v)))V.loading=5;else{o=m({rel:"stylesheet",href:o,"data-precedence":r},l),(l=Pn.get(v))&&m0(o,l);var X=_=f.createElement("link");me(X),Ye(X,"link",o),X._p=new Promise(function(nt,st){X.onload=nt,X.onerror=st}),X.addEventListener("load",function(){V.loading|=1}),X.addEventListener("error",function(){V.loading|=2}),V.loading|=4,Lf(_,r,f)}_={type:"stylesheet",instance:_,count:1,state:V},g.set(v,_)}}}function C7(o,r){ui.X(o,r);var l=ca;if(l&&o){var f=kn(l).hoistableScripts,g=fa(o),v=f.get(g);v||(v=l.querySelector(Fl(g)),v||(o=m({src:o,async:!0},r),(r=Pn.get(g))&&g0(o,r),v=l.createElement("script"),me(v),Ye(v,"link",o),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(g,v))}}function T7(o,r){ui.M(o,r);var l=ca;if(l&&o){var f=kn(l).hoistableScripts,g=fa(o),v=f.get(g);v||(v=l.querySelector(Fl(g)),v||(o=m({src:o,async:!0,type:"module"},r),(r=Pn.get(g))&&g0(o,r),v=l.createElement("script"),me(v),Ye(v,"link",o),l.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},f.set(g,v))}}function nN(o,r,l,f){var g=(g=ht.current)?Vf(g):null;if(!g)throw Error(i(446));switch(o){case"meta":case"title":return null;case"style":return typeof l.precedence=="string"&&typeof l.href=="string"?(r=ua(l.href),l=kn(g).hoistableStyles,f=l.get(r),f||(f={type:"style",instance:null,count:0,state:null},l.set(r,f)),f):{type:"void",instance:null,count:0,state:null};case"link":if(l.rel==="stylesheet"&&typeof l.href=="string"&&typeof l.precedence=="string"){o=ua(l.href);var v=kn(g).hoistableStyles,_=v.get(o);if(_||(g=g.ownerDocument||g,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(o,_),(v=g.querySelector(Xl(o)))&&!v._p&&(_.instance=v,_.state.loading=5),Pn.has(o)||(l={rel:"preload",as:"style",href:l.href,crossOrigin:l.crossOrigin,integrity:l.integrity,media:l.media,hrefLang:l.hrefLang,referrerPolicy:l.referrerPolicy},Pn.set(o,l),v||_7(g,o,l,_.state))),r&&f===null)throw Error(i(528,""));return _}if(r&&f!==null)throw Error(i(529,""));return null;case"script":return r=l.async,l=l.src,typeof l=="string"&&r&&typeof r!="function"&&typeof r!="symbol"?(r=fa(l),l=kn(g).hoistableScripts,f=l.get(r),f||(f={type:"script",instance:null,count:0,state:null},l.set(r,f)),f):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,o))}}function ua(o){return'href="'+on(o)+'"'}function Xl(o){return'link[rel="stylesheet"]['+o+"]"}function oN(o){return m({},o,{"data-precedence":o.precedence,precedence:null})}function _7(o,r,l,f){o.querySelector('link[rel="preload"][as="style"]['+r+"]")?f.loading=1:(r=o.createElement("link"),f.preload=r,r.addEventListener("load",function(){return f.loading|=1}),r.addEventListener("error",function(){return f.loading|=2}),Ye(r,"link",l),me(r),o.head.appendChild(r))}function fa(o){return'[src="'+on(o)+'"]'}function Fl(o){return"script[async]"+o}function iN(o,r,l){if(r.count++,r.instance===null)switch(r.type){case"style":var f=o.querySelector('style[data-href~="'+on(l.href)+'"]');if(f)return r.instance=f,me(f),f;var g=m({},l,{"data-href":l.href,"data-precedence":l.precedence,href:null,precedence:null});return f=(o.ownerDocument||o).createElement("style"),me(f),Ye(f,"style",g),Lf(f,l.precedence,o),r.instance=f;case"stylesheet":g=ua(l.href);var v=o.querySelector(Xl(g));if(v)return r.state.loading|=4,r.instance=v,me(v),v;f=oN(l),(g=Pn.get(g))&&m0(f,g),v=(o.ownerDocument||o).createElement("link"),me(v);var _=v;return _._p=new Promise(function(V,X){_.onload=V,_.onerror=X}),Ye(v,"link",f),r.state.loading|=4,Lf(v,l.precedence,o),r.instance=v;case"script":return v=fa(l.src),(g=o.querySelector(Fl(v)))?(r.instance=g,me(g),g):(f=l,(g=Pn.get(v))&&(f=m({},l),g0(f,g)),o=o.ownerDocument||o,g=o.createElement("script"),me(g),Ye(g,"link",f),o.head.appendChild(g),r.instance=g);case"void":return null;default:throw Error(i(443,r.type))}else r.type==="stylesheet"&&(r.state.loading&4)===0&&(f=r.instance,r.state.loading|=4,Lf(f,l.precedence,o));return r.instance}function Lf(o,r,l){for(var f=l.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=f.length?f[f.length-1]:null,v=g,_=0;_<f.length;_++){var V=f[_];if(V.dataset.precedence===r)v=V;else if(v!==g)break}v?v.parentNode.insertBefore(o,v.nextSibling):(r=l.nodeType===9?l.head:l,r.insertBefore(o,r.firstChild))}function m0(o,r){o.crossOrigin==null&&(o.crossOrigin=r.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=r.referrerPolicy),o.title==null&&(o.title=r.title)}function g0(o,r){o.crossOrigin==null&&(o.crossOrigin=r.crossOrigin),o.referrerPolicy==null&&(o.referrerPolicy=r.referrerPolicy),o.integrity==null&&(o.integrity=r.integrity)}var If=null;function rN(o,r,l){if(If===null){var f=new Map,g=If=new Map;g.set(l,f)}else g=If,f=g.get(l),f||(f=new Map,g.set(l,f));if(f.has(o))return f;for(f.set(o,null),l=l.getElementsByTagName(o),g=0;g<l.length;g++){var v=l[g];if(!(v[oo]||v[ve]||o==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var _=v.getAttribute(r)||"";_=o+_;var V=f.get(_);V?V.push(v):f.set(_,[v])}}return f}function sN(o,r,l){o=o.ownerDocument||o,o.head.insertBefore(l,r==="title"?o.querySelector("head > title"):null)}function N7(o,r,l){if(l===1||r.itemProp!=null)return!1;switch(o){case"meta":case"title":return!0;case"style":if(typeof r.precedence!="string"||typeof r.href!="string"||r.href==="")break;return!0;case"link":if(typeof r.rel!="string"||typeof r.href!="string"||r.href===""||r.onLoad||r.onError)break;return r.rel==="stylesheet"?(o=r.disabled,typeof r.precedence=="string"&&o==null):!0;case"script":if(r.async&&typeof r.async!="function"&&typeof r.async!="symbol"&&!r.onLoad&&!r.onError&&r.src&&typeof r.src=="string")return!0}return!1}function aN(o){return!(o.type==="stylesheet"&&(o.state.loading&3)===0)}function A7(o,r,l,f){if(l.type==="stylesheet"&&(typeof f.media!="string"||matchMedia(f.media).matches!==!1)&&(l.state.loading&4)===0){if(l.instance===null){var g=ua(f.href),v=r.querySelector(Xl(g));if(v){r=v._p,r!==null&&typeof r=="object"&&typeof r.then=="function"&&(o.count++,o=Bf.bind(o),r.then(o,o)),l.state.loading|=4,l.instance=v,me(v);return}v=r.ownerDocument||r,f=oN(f),(g=Pn.get(g))&&m0(f,g),v=v.createElement("link"),me(v);var _=v;_._p=new Promise(function(V,X){_.onload=V,_.onerror=X}),Ye(v,"link",f),l.instance=v}o.stylesheets===null&&(o.stylesheets=new Map),o.stylesheets.set(l,r),(r=l.state.preload)&&(l.state.loading&3)===0&&(o.count++,l=Bf.bind(o),r.addEventListener("load",l),r.addEventListener("error",l))}}var y0=0;function M7(o,r){return o.stylesheets&&o.count===0&&Hf(o,o.stylesheets),0<o.count||0<o.imgCount?function(l){var f=setTimeout(function(){if(o.stylesheets&&Hf(o,o.stylesheets),o.unsuspend){var v=o.unsuspend;o.unsuspend=null,v()}},6e4+r);0<o.imgBytes&&y0===0&&(y0=62500*c7());var g=setTimeout(function(){if(o.waitingForImages=!1,o.count===0&&(o.stylesheets&&Hf(o,o.stylesheets),o.unsuspend)){var v=o.unsuspend;o.unsuspend=null,v()}},(o.imgBytes>y0?50:800)+r);return o.unsuspend=l,function(){o.unsuspend=null,clearTimeout(f),clearTimeout(g)}}:null}function Bf(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Hf(this,this.stylesheets);else if(this.unsuspend){var o=this.unsuspend;this.unsuspend=null,o()}}}var Pf=null;function Hf(o,r){o.stylesheets=null,o.unsuspend!==null&&(o.count++,Pf=new Map,r.forEach(R7,o),Pf=null,Bf.call(o))}function R7(o,r){if(!(r.state.loading&4)){var l=Pf.get(o);if(l)var f=l.get(null);else{l=new Map,Pf.set(o,l);for(var g=o.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var _=g[v];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(l.set(_.dataset.precedence,_),f=_)}f&&l.set(null,f)}g=r.instance,_=g.getAttribute("data-precedence"),v=l.get(_)||f,v===f&&l.set(null,g),l.set(_,g),this.count++,f=Bf.bind(this),g.addEventListener("load",f),g.addEventListener("error",f),v?v.parentNode.insertBefore(g,v.nextSibling):(o=o.nodeType===9?o.head:o,o.insertBefore(g,o.firstChild)),r.state.loading|=4}}var Zl={$$typeof:T,Provider:null,Consumer:null,_currentValue:z,_currentValue2:z,_threadCount:0};function k7(o,r,l,f,g,v,_,V,X){this.tag=1,this.containerInfo=o,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ke(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ke(0),this.hiddenUpdates=Ke(null),this.identifierPrefix=f,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=X,this.incompleteTransitions=new Map}function lN(o,r,l,f,g,v,_,V,X,nt,st,ct){return o=new k7(o,r,l,_,X,nt,st,ct,V),r=1,v===!0&&(r|=24),v=xn(3,null,null,r),o.current=v,v.stateNode=o,r=Km(),r.refCount++,o.pooledCache=r,r.refCount++,v.memoizedState={element:f,isDehydrated:l,cache:r},tg(v),o}function cN(o){return o?(o=Us,o):Us}function uN(o,r,l,f,g,v){g=cN(g),f.context===null?f.context=g:f.pendingContext=g,f=Zi(r),f.payload={element:l},v=v===void 0?null:v,v!==null&&(f.callback=v),l=Ki(o,f,r),l!==null&&(un(l,o,r),Nl(l,o,r))}function fN(o,r){if(o=o.memoizedState,o!==null&&o.dehydrated!==null){var l=o.retryLane;o.retryLane=l!==0&&l<r?l:r}}function v0(o,r){fN(o,r),(o=o.alternate)&&fN(o,r)}function dN(o){if(o.tag===13||o.tag===31){var r=Hr(o,67108864);r!==null&&un(r,o,67108864),v0(o,67108864)}}function hN(o){if(o.tag===13||o.tag===31){var r=Tn();r=Ho(r);var l=Hr(o,r);l!==null&&un(l,o,r),v0(o,r)}}var Uf=!0;function O7(o,r,l,f){var g=j.T;j.T=null;var v=I.p;try{I.p=2,b0(o,r,l,f)}finally{I.p=v,j.T=g}}function D7(o,r,l,f){var g=j.T;j.T=null;var v=I.p;try{I.p=8,b0(o,r,l,f)}finally{I.p=v,j.T=g}}function b0(o,r,l,f){if(Uf){var g=x0(f);if(g===null)r0(o,r,f,$f,l),mN(o,f);else if(z7(g,o,r,l,f))f.stopPropagation();else if(mN(o,f),r&4&&-1<j7.indexOf(o)){for(;g!==null;){var v=yn(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var _=mn(v.pendingLanes);if(_!==0){var V=v;for(V.pendingLanes|=2,V.entangledLanes|=2;_;){var X=1<<31-Ee(_);V.entanglements[1]|=X,_&=~X}Ao(v),(Wt&6)===0&&(Tf=zt()+500,$l(0))}}break;case 31:case 13:V=Hr(v,2),V!==null&&un(V,v,2),Nf(),v0(v,2)}if(v=x0(f),v===null&&r0(o,r,f,$f,l),v===g)break;g=v}g!==null&&f.stopPropagation()}else r0(o,r,f,null,l)}}function x0(o){return o=Sm(o),w0(o)}var $f=null;function w0(o){if($f=null,o=Mn(o),o!==null){var r=a(o);if(r===null)o=null;else{var l=r.tag;if(l===13){if(o=c(r),o!==null)return o;o=null}else if(l===31){if(o=u(r),o!==null)return o;o=null}else if(l===3){if(r.stateNode.current.memoizedState.isDehydrated)return r.tag===3?r.stateNode.containerInfo:null;o=null}else r!==o&&(o=null)}}return $f=o,null}function pN(o){switch(o){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ue()){case Xt:return 2;case xe:return 8;case Pe:case Po:return 32;case Ae:return 268435456;default:return 32}default:return 32}}var S0=!1,ar=null,lr=null,cr=null,Kl=new Map,Ql=new Map,ur=[],j7="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function mN(o,r){switch(o){case"focusin":case"focusout":ar=null;break;case"dragenter":case"dragleave":lr=null;break;case"mouseover":case"mouseout":cr=null;break;case"pointerover":case"pointerout":Kl.delete(r.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ql.delete(r.pointerId)}}function Wl(o,r,l,f,g,v){return o===null||o.nativeEvent!==v?(o={blockedOn:r,domEventName:l,eventSystemFlags:f,nativeEvent:v,targetContainers:[g]},r!==null&&(r=yn(r),r!==null&&dN(r)),o):(o.eventSystemFlags|=f,r=o.targetContainers,g!==null&&r.indexOf(g)===-1&&r.push(g),o)}function z7(o,r,l,f,g){switch(r){case"focusin":return ar=Wl(ar,o,r,l,f,g),!0;case"dragenter":return lr=Wl(lr,o,r,l,f,g),!0;case"mouseover":return cr=Wl(cr,o,r,l,f,g),!0;case"pointerover":var v=g.pointerId;return Kl.set(v,Wl(Kl.get(v)||null,o,r,l,f,g)),!0;case"gotpointercapture":return v=g.pointerId,Ql.set(v,Wl(Ql.get(v)||null,o,r,l,f,g)),!0}return!1}function gN(o){var r=Mn(o.target);if(r!==null){var l=a(r);if(l!==null){if(r=l.tag,r===13){if(r=c(l),r!==null){o.blockedOn=r,Vi(o.priority,function(){hN(l)});return}}else if(r===31){if(r=u(l),r!==null){o.blockedOn=r,Vi(o.priority,function(){hN(l)});return}}else if(r===3&&l.stateNode.current.memoizedState.isDehydrated){o.blockedOn=l.tag===3?l.stateNode.containerInfo:null;return}}}o.blockedOn=null}function qf(o){if(o.blockedOn!==null)return!1;for(var r=o.targetContainers;0<r.length;){var l=x0(o.nativeEvent);if(l===null){l=o.nativeEvent;var f=new l.constructor(l.type,l);wm=f,l.target.dispatchEvent(f),wm=null}else return r=yn(l),r!==null&&dN(r),o.blockedOn=l,!1;r.shift()}return!0}function yN(o,r,l){qf(o)&&l.delete(r)}function V7(){S0=!1,ar!==null&&qf(ar)&&(ar=null),lr!==null&&qf(lr)&&(lr=null),cr!==null&&qf(cr)&&(cr=null),Kl.forEach(yN),Ql.forEach(yN)}function Yf(o,r){o.blockedOn===r&&(o.blockedOn=null,S0||(S0=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,V7)))}var Gf=null;function vN(o){Gf!==o&&(Gf=o,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){Gf===o&&(Gf=null);for(var r=0;r<o.length;r+=3){var l=o[r],f=o[r+1],g=o[r+2];if(typeof f!="function"){if(w0(f||l)===null)continue;break}var v=yn(l);v!==null&&(o.splice(r,3),r-=3,xg(v,{pending:!0,data:g,method:l.method,action:f},f,g))}}))}function da(o){function r(X){return Yf(X,o)}ar!==null&&Yf(ar,o),lr!==null&&Yf(lr,o),cr!==null&&Yf(cr,o),Kl.forEach(r),Ql.forEach(r);for(var l=0;l<ur.length;l++){var f=ur[l];f.blockedOn===o&&(f.blockedOn=null)}for(;0<ur.length&&(l=ur[0],l.blockedOn===null);)gN(l),l.blockedOn===null&&ur.shift();if(l=(o.ownerDocument||o).$$reactFormReplay,l!=null)for(f=0;f<l.length;f+=3){var g=l[f],v=l[f+1],_=g[Me]||null;if(typeof v=="function")_||vN(l);else if(_){var V=null;if(v&&v.hasAttribute("formAction")){if(g=v,_=v[Me]||null)V=_.formAction;else if(w0(g)!==null)continue}else V=_.action;typeof V=="function"?l[f+1]=V:(l.splice(f,3),f-=3),vN(l)}}}function bN(){function o(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(_){return g=_})},focusReset:"manual",scroll:"manual"})}function r(){g!==null&&(g(),g=null),f||setTimeout(l,20)}function l(){if(!f&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var f=!1,g=null;return navigation.addEventListener("navigate",o),navigation.addEventListener("navigatesuccess",r),navigation.addEventListener("navigateerror",r),setTimeout(l,100),function(){f=!0,navigation.removeEventListener("navigate",o),navigation.removeEventListener("navigatesuccess",r),navigation.removeEventListener("navigateerror",r),g!==null&&(g(),g=null)}}}function E0(o){this._internalRoot=o}Xf.prototype.render=E0.prototype.render=function(o){var r=this._internalRoot;if(r===null)throw Error(i(409));var l=r.current,f=Tn();uN(l,f,o,r,null,null)},Xf.prototype.unmount=E0.prototype.unmount=function(){var o=this._internalRoot;if(o!==null){this._internalRoot=null;var r=o.containerInfo;uN(o.current,2,null,o,null,null),Nf(),r[gn]=null}};function Xf(o){this._internalRoot=o}Xf.prototype.unstable_scheduleHydration=function(o){if(o){var r=$o();o={blockedOn:null,target:o,priority:r};for(var l=0;l<ur.length&&r!==0&&r<ur[l].priority;l++);ur.splice(l,0,o),l===0&&gN(o)}};var xN=e.version;if(xN!=="19.2.0")throw Error(i(527,xN,"19.2.0"));I.findDOMNode=function(o){var r=o._reactInternals;if(r===void 0)throw typeof o.render=="function"?Error(i(188)):(o=Object.keys(o).join(","),Error(i(268,o)));return o=h(r),o=o!==null?p(o):null,o=o===null?null:o.stateNode,o};var L7={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:j,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Ff=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Ff.isDisabled&&Ff.supportsFiber)try{pe=Ff.inject(L7),re=Ff}catch{}}return pa.createRoot=function(o,r){if(!s(o))throw Error(i(299));var l=!1,f="",g=NT,v=AT,_=MT;return r!=null&&(r.unstable_strictMode===!0&&(l=!0),r.identifierPrefix!==void 0&&(f=r.identifierPrefix),r.onUncaughtError!==void 0&&(g=r.onUncaughtError),r.onCaughtError!==void 0&&(v=r.onCaughtError),r.onRecoverableError!==void 0&&(_=r.onRecoverableError)),r=lN(o,1,!1,null,null,l,f,null,g,v,_,bN),o[gn]=r.current,i0(o),new E0(r)},pa.hydrateRoot=function(o,r,l){if(!s(o))throw Error(i(299));var f=!1,g="",v=NT,_=AT,V=MT,X=null;return l!=null&&(l.unstable_strictMode===!0&&(f=!0),l.identifierPrefix!==void 0&&(g=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(_=l.onCaughtError),l.onRecoverableError!==void 0&&(V=l.onRecoverableError),l.formState!==void 0&&(X=l.formState)),r=lN(o,1,!0,r,l??null,f,g,X,v,_,V,bN),r.context=cN(null),l=r.current,f=Tn(),f=Ho(f),g=Zi(f),g.callback=null,Ki(l,g,f),l=f,r.current.lanes=l,no(r,l),Ao(r),o[gn]=r.current,i0(o),new Xf(r)},pa.version="19.2.0",pa}var D0;function NN(){if(D0)return Jf.exports;D0=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),Jf.exports=_N(),Jf.exports}var AN=NN();const MN={stringify:t=>t?"true":"false",parse:t=>/^[ty1-9]/i.test(t)},RN={stringify:t=>t.name,parse:(t,e,n)=>{const i=(()=>{if(typeof window<"u"&&t in window)return window[t];if(typeof global<"u"&&t in global)return global[t]})();return typeof i=="function"?i.bind(n):void 0}},kN={stringify:t=>JSON.stringify(t),parse:t=>JSON.parse(t)};function ON(t){return t.replace(/([a-z0-9])([A-Z])/g,(e,n,i)=>`${n}-${i.toLowerCase()}`)}function DN(t){return t.replace(/[-:]([a-z])/g,(e,n)=>`${n.toUpperCase()}`)}const j0=Symbol.for("r2wc.bound"),jN={parse:(t,e,n)=>{const i=DN(e),s=n;if(typeof s<"u"&&i in s&&typeof s[i]<"u"){let a=s[i];return j0 in s[i]||(a=a.bind(s),Object.defineProperty(a,j0,{value:!0})),a}else return}},zN={stringify:t=>`${t}`,parse:t=>parseFloat(t)},VN={stringify:t=>t,parse:t=>t},od={string:VN,number:zN,boolean:MN,function:RN,method:jN,json:kN},Jl=Symbol.for("r2wc.render"),tc=Symbol.for("r2wc.connected"),hr=Symbol.for("r2wc.context"),lo=Symbol.for("r2wc.props");function LN(t,e,n){e.props||(e.props=t.propTypes?Object.keys(t.propTypes):[]),e.events||(e.events=[]);const i=Array.isArray(e.props)?e.props.slice():Object.keys(e.props),s=Array.isArray(e.events)?e.events.slice():Object.keys(e.events),a={},c={},u={},d={};for(const p of i){a[p]=Array.isArray(e.props)?"string":e.props[p];const m=ON(p);u[p]=m,d[m]=p}for(const p of s)c[p]=Array.isArray(e.events)?{}:e.events[p];class h extends HTMLElement{static get observedAttributes(){return Object.keys(d)}[tc]=!0;[hr];[lo]={};container;constructor(){super(),e.shadow?this.container=this.attachShadow({mode:e.shadow}):this.container=this,this[lo].container=this.container;for(const m of i){const y=u[m],b=this.getAttribute(y),x=a[m],w=x?od[x]:null;w?.parse&&(b||x==="method")&&(this[lo][m]=w.parse(b,y,this))}for(const m of s)this[lo][m]=y=>{const b=m.replace(/^on/,"").toLowerCase();this.dispatchEvent(new CustomEvent(b,{detail:y,...c[m]}))}}connectedCallback(){this[tc]=!0,this[Jl]()}disconnectedCallback(){this[tc]=!1,this[hr]&&n.unmount(this[hr]),delete this[hr]}attributeChangedCallback(m,y,b){const x=d[m],w=a[x],S=w?od[w]:null;x in a&&S?.parse&&(b||w==="method")&&(this[lo][x]=S.parse(b,m,this),this[Jl]())}[Jl](){this[tc]&&(this[hr]?n.update(this[hr],this[lo]):this[hr]=n.mount(this.container,t,this[lo]))}}for(const p of i){const m=u[p],y=a[p];Object.defineProperty(h.prototype,p,{enumerable:!0,configurable:!0,get(){return this[lo][p]},set(b){this[lo][p]=b;const x=y?od[y]:null;if(x?.stringify){const w=x.stringify(b,m,this);this.getAttribute(m)!==w&&(w==null?this.removeAttribute(m):this.setAttribute(m,w))}else p in a&&x?.parse&&(b||y==="method")&&(this[lo][p]=x.parse(b,m,this)),this[Jl]()}})}return h}function IN(t,e,n){const i=AN.createRoot(t),s=dr.createElement(e,n);return i.render(s),{root:i,ReactComponent:e}}function BN({root:t,ReactComponent:e},n){const i=dr.createElement(e,n);t.render(i)}function PN({root:t}){t.unmount()}function HN(t,e={}){return LN(t,e,{mount:IN,update:BN,unmount:PN})}var id={exports:{}},ma={};var z0;function UN(){if(z0)return ma;z0=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(i,s,a){var c=null;if(a!==void 0&&(c=""+a),s.key!==void 0&&(c=""+s.key),"key"in s){a={};for(var u in s)u!=="key"&&(a[u]=s[u])}else a=s;return s=a.ref,{$$typeof:t,type:i,key:c,ref:s!==void 0?s:null,props:a}}return ma.Fragment=e,ma.jsx=n,ma.jsxs=n,ma}var V0;function $N(){return V0||(V0=1,id.exports=UN()),id.exports}var M=$N();const qN={PROD:!0},L0=typeof{url:Kf&&Kf.tagName.toUpperCase()==="SCRIPT"&&Kf.src||new URL("circuit-embed.js",document.baseURI).href}<"u"?qN:void 0,rd=L0?.VITE_SANDBOX_ORIGIN||(L0?.PROD?"https://sandbox.simten.dev":"http://localhost:3002");function I0(t,e,n,i){t.iframe&&(t.iframe.remove(),t.iframe=null,t.ready=!1);const s=document.createElement("iframe");return s.src=rd,s.setAttribute("sandbox","allow-scripts allow-same-origin"),s.style.cssText="display:none;width:0;height:0;position:absolute;",s.setAttribute("aria-hidden","true"),s.onerror=i,e.appendChild(s),t.iframe=s,t.ready=!1,window.addEventListener("message",n),s}function YN(t){return`sb-${++t.idCounter}`}function GN(){const t=N.useRef({iframe:null,ready:!1,pending:new Map,readyQueue:[],idCounter:0}),e=N.useRef(null),n=N.useRef(()=>{}),i=N.useCallback(()=>{const C=t.current,R=e.current;if(R){for(const[,A]of C.pending)A({type:"error",error:"Sandbox restarted (crash)"});C.pending.clear(),C.readyQueue=[],window.removeEventListener("message",n.current),I0(C,R,n.current,a.current)}},[]),s=N.useCallback(C=>{if(C.origin!==rd)return;const R=t.current,A=C.data;if(A.type==="ready"){R.ready=!0;for(const k of R.readyQueue)k();R.readyQueue=[];return}if(!A.id)return;const O=R.pending.get(A.id);O&&(R.pending.delete(A.id),O(A))},[]);n.current=s;const a=N.useRef(i);a.current=i,N.useEffect(()=>{const C=document.createElement("div");C.style.cssText="position:absolute;left:-9999px;top:-9999px;",document.body.appendChild(C),e.current=C;const R=t.current;return I0(R,C,s,i),()=>{window.removeEventListener("message",s),C.remove(),e.current=null}},[s]);const c=N.useCallback(C=>new Promise(R=>{const A=t.current,O=YN(A),k={...C,id:O};A.pending.set(O,R);const H=()=>{const $=A.iframe;if(!$?.contentWindow){A.pending.delete(O),R({type:"error",error:"Sandbox iframe not available"});return}$.contentWindow.postMessage(k,rd)};A.ready?H():A.readyQueue.push(H)}),[]),u=N.useCallback(async(C,R="default")=>{const A=await c({type:"compile",source:C,slot:R});if("error"in A)return A;const O=A;return{circuits:O.circuits,libraryCircuits:O.libraryCircuits,portValues:O.portValues,peripheralState:O.peripheralState}},[c]),d=N.useCallback(async(C,R,A,O)=>{const k=await c({type:"compile-ir",circuit:C,libraryCircuits:R,slot:A,evalSources:O?.evalSources,snapshot:O?.snapshot});if("error"in k)return k;const H=k;return{portValues:H.portValues,peripheralState:H.peripheralState,snapshotId:H.snapshotId}},[c]),h=N.useCallback(async(C,R="default",A)=>{const O=await c({type:"tick",inputs:C,slot:R,snapshot:A?.snapshot});if("error"in O)return O;const k=O;return{portValues:k.portValues,cycle:k.cycle,peripheralState:k.peripheralState,snapshotId:k.snapshotId}},[c]),p=N.useCallback(async(C,R,A="default",O)=>{const k=await c({type:"tick-n",n:C,inputs:R,slot:A,snapshot:O?.snapshot});if("error"in k)return k;const H=k;return{portValues:H.portValues,cycle:H.cycle,peripheralState:H.peripheralState,snapshotId:H.snapshotId}},[c]),m=N.useCallback(async(C,R,A,O="default")=>{const k=await c({type:"scan-port",addrNodeId:C,valuePortKey:R,count:A,slot:O});return"error"in k?k:{values:k.values}},[c]),y=N.useCallback(async C=>{const R=await c({type:"simulate",...C});if("error"in R)return R;const A=R;return{circuitName:A.circuitName,signals:A.signals,vcd:A.vcd,ticks:A.ticks,steadyStateAt:A.steadyStateAt}},[c]),b=N.useCallback(async(C="default")=>{const R=await c({type:"reset",slot:C});if("error"in R)return R;const A=R;return{portValues:A.portValues,peripheralState:A.peripheralState}},[c]),x=N.useCallback(async(C,R,A="default",O)=>{const k=await c({type:"set-node",nodeId:C,value:R,slot:A,snapshot:O?.snapshot});if("error"in k)return k;const H=k;return{portValues:H.portValues,peripheralState:H.peripheralState,snapshotId:H.snapshotId}},[c]),w=N.useCallback(async(C="default")=>{const R=await c({type:"snapshot",slot:C});return"error"in R?R:{snapshotId:R.snapshotId}},[c]),S=N.useCallback(async(C,R="default")=>{const A=await c({type:"restore",snapshotId:C,slot:R});if("error"in A)return A;const O=A;return{portValues:O.portValues,cycle:O.cycle,peripheralState:O.peripheralState}},[c]),E=N.useCallback(async(C,R="default")=>{const A=await c({type:"prune-snapshots",keepAfterId:C,slot:R});return"error"in A,A},[c]),D=N.useCallback(async C=>{await c({type:"dispose",slot:C})},[c]),T=N.useCallback(()=>t.current.ready,[]);return{compile:u,compileIR:d,tick:h,tickN:p,scanPort:m,simulate:y,reset:b,setNode:x,snapshot:w,restore:S,pruneSnapshots:E,dispose:D,isReady:T}}const B0=N.createContext(null);function XN({children:t}){const e=GN();return M.jsx(B0.Provider,{value:e,children:t})}const FN={compile:async()=>({type:"error",error:"Sandbox not ready"}),compileIR:async()=>({type:"error",error:"Sandbox not ready"}),tick:async()=>({type:"error",error:"Sandbox not ready"}),tickN:async()=>({type:"error",error:"Sandbox not ready"}),scanPort:async()=>({type:"error",error:"Sandbox not ready"}),simulate:async()=>({type:"error",error:"Sandbox not ready"}),reset:async()=>({type:"error",error:"Sandbox not ready"}),setNode:async()=>({type:"error",error:"Sandbox not ready"}),snapshot:async()=>({type:"error",error:"Sandbox not ready"}),restore:async()=>({type:"error",error:"Sandbox not ready"}),pruneSnapshots:async()=>({type:"error",error:"Sandbox not ready"}),dispose:async()=>{},isReady:()=>!1};function sd(){return N.useContext(B0)??FN}function pr(t,e,n){if(t<1||!Number.isInteger(t))throw new Error(`Memory depth must be a positive integer, got ${t}`);if(e<1||!Number.isInteger(e))throw new Error(`Memory width must be a positive integer, got ${e}`);return{__stateKind:"mem",depth:t,width:e,initial:n??new Map}}function ZN(t){return t!=null&&typeof t=="object"&&t.__stateKind==="reg"}function KN(t){return t!=null&&typeof t=="object"&&t.__stateKind==="mem"}const J={kind:"bit"};function Z(t){if(t<1||!Number.isInteger(t))throw new Error(`Bus width must be a positive integer, got ${t}`);return{kind:"bus",width:t}}function P0(t){return typeof t=="number"?t===1?J:Z(t):t}const ec=new Map;function QN(t,e){ec.has(t)||ec.set(t,e)}function nc(t){return ec.get(t)}function WN(){return ec}function JN(t,e,n){return{_path:{nodeId:t,portName:e},_type:n,to(...i){return{source:{nodeId:t,portName:e},targets:i.map(s=>({nodeId:s._path.nodeId,portName:s._path.portName})),portType:n}}}}function ad(t,e,n){const i={};for(const[s,a]of e)i[s]=JN(t,s,a);return new Proxy(i,{get(s,a){if(a in s)return s[a];if(typeof a=="symbol"||a.startsWith("_"))return;const c=t===""?"circuit":`node '${t}'${n?` (${n})`:""}`,u=Object.keys(s).join(", ");throw new Error(`Port '${a}' does not exist on ${c}. Available ports: ${u||"none"}`)}})}function vt(t,e={}){if(typeof t!="string"){const z=t===null?"null":Array.isArray(t)?"array":typeof t;throw new Error(`circuit() expects a string name as the first argument, got ${z}. Usage: circuit('MyCircuit', { inputs, outputs, nodes, connect }). (A common cause is a stray import / variable being passed by mistake, e.g. circuit(React, {...}) — the first argument must be a literal string name.)`)}if(typeof e=="function"){const z=e;return U=>{const Y=z(U),L=vt(t,Y);L._args=U??{};for(const G of L.circuit.state)if(G.stateType.kind==="bit")G.initialValue=!1;else if(G.stateType.kind==="bus")typeof G.initialValue=="number"&&(G.initialValue=0);else if(G.stateType.kind==="memory"){const tt=G.initialValue;G.initialValue={data:new Map,addressWidth:tt?.addressWidth??G.stateType.addressWidth,dataWidth:tt?.dataWidth??G.stateType.dataWidth}}return L}}const n=e,i=new Map;if(n.inputs)for(const[z,U]of Object.entries(n.inputs))i.set(z,P0(U));const s=new Map;if(n.outputs)for(const[z,U]of Object.entries(n.outputs))s.set(z,P0(U));const a=n.nodes??{},c=[],u=new Set;for(const z of i.keys())u.has(z)&&c.push(`Duplicate port name: '${z}'`),u.add(z);for(const z of s.keys())u.has(z)&&c.push(`Port name '${z}' used for both input and output`),u.add(z);if(n.state)for(const z of Object.keys(n.state))i.has(z)&&c.push(`State name '${z}' collides with input port name`),s.has(z)&&c.push(`State name '${z}' collides with output port name`);for(const z of Object.keys(a))(z==="inputs"||z==="outputs"||z==="nodes")&&c.push(`Node name '${z}' is reserved`);n.onTick&&!n.state&&c.push(".onTick() requires state to be defined");let d=[];if(n.connect){const z={};for(const[Y,L]of Object.entries(a)){const G=new Map;for(const tt of L.circuit.inputs)G.set(tt.name,tt.portType);for(const tt of L.circuit.outputs)G.set(tt.name,tt.portType);z[Y]=ad(Y,G,L.circuit.name)}const U={inputs:ad("",i),outputs:ad("",s),nodes:z};try{d=n.connect(U)}catch(Y){c.push(Y instanceof Error?Y.message:String(Y))}}for(const z of d){H0(z.source,i,s,a,c);for(const U of z.targets)H0(U,i,s,a,c)}const h=z=>z.nodeId===""?z.portName:`${z.nodeId}.${z.portName}`,p=new Map,m=new Map,y=[];for(const z of d){const U=[];for(const Y of z.targets){const L=h(Y),G=p.get(L);if(G){if(G.nodeId===z.source.nodeId&&G.portName===z.source.portName)continue;let tt=m.get(L);tt||(tt=new Set([h(G)]),m.set(L,tt)),tt.add(h(z.source));continue}p.set(L,{nodeId:z.source.nodeId,portName:z.source.portName}),U.push(Y)}U.length>0&&y.push({...z,targets:U})}d=y;const b=[...m.keys()].sort();for(const z of b){const U=[...m.get(z)].join(", ");c.push(`${z} has multiple drivers: ${U}`)}if(c.length>0)throw new Error(`Circuit '${t}' validation failed:
10
10
  - ${c.join(`
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 uM(t){const e=new Set,n=[],i=s=>{if(e.has(s))return;e.add(s);const l=t.get(s);if(l){for(const c of l.nodes)t.has(c.componentRef)&&i(c.componentRef);n.push(l)}};for(const s of t.keys())i(s);return n}function L0(t){if(t.implementation.kind==="intrinsic")throw new jl(`Cannot serialize circuit '${t.name}': intrinsic implementations are not supported.`);if(t.implementation.kind==="primitive"&&Dl(t.name))throw new jl(`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: ${I0(t.inputs)},`),t.outputs.length>0&&e.push(` outputs: ${I0(t.outputs)},`),t.state.length>0&&e.push(` state: ${dM(t.state,t.name)},`),t.nodes.length>0&&e.push(` nodes: ${mM(t.nodes)},`),t.connections.length>0&&e.push(` connect: ${yM(t)},`),`const ${t.name} = circuit('${t.name}', {
11
+ - `)}`);const x=n.eval!=null,w=Object.keys(a).length>0;let S,E;x&&!w?(S={kind:"primitive"},E=n.state!=null?"sequential":"combinational"):w?(S={kind:"composite"},E=tA(a,n.state)?"sequential":"combinational"):(S={kind:"primitive"},E="combinational");const D=Array.from(i,([z,U])=>({name:z,portType:U})),T=Array.from(s,([z,U])=>({name:z,portType:U})),C=[];(n.state!=null||n.onTick!=null)&&C.push({name:"clk"});const R=[];if(n.state!=null)for(const[z,U]of Object.entries(n.state))if(KN(U)){const Y=Math.ceil(Math.log2(U.depth))||1;R.push({id:`${t}-${z}`,name:z,stateType:{kind:"memory",addressWidth:Y,dataWidth:U.width},initialValue:{data:new Map(U.initial),addressWidth:Y,dataWidth:U.width},clockRef:"clk",edge:"rising"})}else ZN(U)?R.push({id:`${t}-${z}`,name:z,stateType:U.width===1?{kind:"bit"}:{kind:"bus",width:U.width},initialValue:U.initial,clockRef:"clk",edge:"rising"}):U instanceof Map?R.push({id:`${t}-${z}`,name:z,stateType:{kind:"memory",addressWidth:16,dataWidth:8},initialValue:{data:new Map(U),addressWidth:16,dataWidth:8},clockRef:"clk",edge:"rising"}):typeof U=="boolean"?R.push({id:`${t}-${z}`,name:z,stateType:{kind:"bit"},initialValue:U,clockRef:"clk",edge:"rising"}):R.push({id:`${t}-${z}`,name:z,stateType:{kind:"bus",width:32},initialValue:U,clockRef:"clk",edge:"rising"});const A=[];for(const[z,U]of Object.entries(a)){const Y=U._args??{};A.push({id:z,componentRef:U.circuit.name,arguments:Y,inputs:U.circuit.inputs.map(L=>({id:`${z}.${L.name}`,name:L.name,portType:L.portType})),outputs:U.circuit.outputs.map(L=>({id:`${z}.${L.name}`,name:L.name,portType:L.portType})),clocks:U.circuit.clocks.map(L=>({id:`${z}.${L.name}`,name:L.name}))})}const O=[];let k=0;for(const z of d)for(const U of z.targets)O.push({id:`conn_${k++}`,source:{nodeId:z.source.nodeId,portName:z.source.portName},target:{nodeId:U.nodeId,portName:U.portName},portType:z.portType});const H={timing:E},$=n.meta;$&&($.description!==void 0&&(H.description=$.description),$.category!==void 0&&(H.category=$.category),$.icon!==void 0&&(H.icon=$.icon),$.tags!==void 0&&(H.tags=$.tags),$.author!==void 0&&(H.author=$.author),$.version!==void 0&&(H.version=$.version),$.synthesizable!==void 0&&(H.synthesizable=$.synthesizable),$.interactiveArg!==void 0&&(H.interactiveArg=$.interactiveArg));const q={version:1,name:t,inputs:D,outputs:T,clocks:C,state:R,nodes:A,connections:O,implementation:S,metadata:H};for(const[z,U]of i);for(const[z,U]of s);const F=new Map;for(const[,z]of Object.entries(a))if(F.has(z.circuit.name)||F.set(z.circuit.name,z),z._dependencies)for(const[U,Y]of z._dependencies)F.has(U)||F.set(U,Y);const Q={};for(const z of D)Q[z.name]=z;const B={};for(const z of T)B[z.name]=z;const P={};for(const z of A)P[z.id]=z;const j={circuit:q,inputs:Q,outputs:B,nodes:P,_dependencies:F};Object.defineProperty(j,"toJSON",{value:function(){const z={};for(const[U,Y]of this._dependencies)z[U]=Y;return{circuit:this.circuit,_dependencies:z}},enumerable:!1});const I=n.state?Object.keys(n.state):void 0;return QN(t,{inputNames:q.inputs.map(z=>z.name),outputNames:q.outputs.map(z=>z.name),evalFn:n.eval??(()=>({})),stateKeys:I,onTickFn:n.onTick}),j}function H0(t,e,n,i,s){if(t.nodeId==="")!e.has(t.portName)&&!n.has(t.portName)&&s.push(`Circuit port '${t.portName}' does not exist`);else{const a=i[t.nodeId];if(!a){s.push(`Node '${t.nodeId}' does not exist`);return}a.circuit.inputs.some(u=>u.name===t.portName)||a.circuit.outputs.some(u=>u.name===t.portName)||s.push(`Port '${t.portName}' does not exist on node '${t.nodeId}' (${a.circuit.name})`)}}function tA(t,e){if(e!=null)return!0;for(const n of Object.values(t))if(n.circuit.clocks.length>0||n.circuit.state.length>0)return!0;return!1}const U0=vt("And",{inputs:{a:J,b:J},outputs:{out:J},meta:{category:"logic-gates",icon:"&",description:"Logical AND gate"},eval:({a:t,b:e})=>({out:t&&e?1:0})}),ld=vt("Or",{inputs:{a:J,b:J},outputs:{out:J},meta:{category:"logic-gates",icon:"≥1",description:"Logical OR gate"},eval:({a:t,b:e})=>({out:t||e?1:0})}),$0=vt("Not",{inputs:{in:J},outputs:{out:J},meta:{category:"logic-gates",icon:"¬",description:"Logical NOT gate"},eval:({in:t})=>({out:t?0:1})}),eA=vt("Nand",{inputs:{a:J,b:J},outputs:{out:J},meta:{category:"logic-gates",icon:"⊼",description:"Logical NAND gate"},eval:({a:t,b:e})=>({out:t&&e?0:1})}),nA=vt("Nor",{inputs:{a:J,b:J},outputs:{out:J},meta:{category:"logic-gates",icon:"⊽",description:"Logical NOR gate"},eval:({a:t,b:e})=>({out:t||e?0:1})}),oA=vt("Xor",{inputs:{a:J,b:J},outputs:{out:J},meta:{category:"logic-gates",icon:"⊕",description:"Logical XOR gate"},eval:({a:t,b:e})=>({out:t!==e?1:0})}),iA=vt("Xnor",{inputs:{a:J,b:J},outputs:{out:J},meta:{category:"logic-gates",icon:"⊙",description:"Logical XNOR gate"},eval:({a:t,b:e})=>({out:t===e?1:0})}),rA=vt("Buffer",{inputs:{in:J},outputs:{out:J},meta:{category:"logic-gates",icon:"▷",description:"Buffer — passes input through unchanged"},eval:({in:t})=>({out:t})}),sA=Object.freeze(Object.defineProperty({__proto__:null,And:U0,Buffer:rA,Nand:eA,Nor:nA,Not:$0,Or:ld,Xnor:iA,Xor:oA},Symbol.toStringTag,{value:"Module"})),aA=vt("Incrementer",{inputs:{in:Z(8)},outputs:{out:Z(8)},meta:{category:"arithmetic",icon:"+1",description:"Adds 1 to the input"},eval:({in:t})=>({out:t+1&255})}),oc=vt("Adder",({width:t=8}={})=>({inputs:{a:Z(t),b:Z(t),carry_in:J},outputs:{sum:Z(t),carry_out:J},meta:{category:"arithmetic",icon:"+",description:"N-bit adder with carry"},eval:({a:e,b:n,carry_in:i,width:s=t})=>{const a=s,c=a>=32?4294967295:(1<<a)-1,u=(e>>>0)+(n>>>0)+i;return{sum:u&c,carry_out:u>c?1:0}}})),lA=vt("Subtractor",({width:t=8}={})=>({inputs:{a:Z(t),b:Z(t),borrow_in:J},outputs:{difference:Z(t),borrow_out:J},meta:{category:"arithmetic",icon:"−",description:"N-bit subtractor with borrow"},eval:({a:e,b:n,borrow_in:i,width:s=t})=>{const a=s,c=a>=32?4294967295:(1<<a)-1,u=(e>>>0)-(n>>>0)-i;return{difference:u&c,borrow_out:u<0?1:0}}})),cA=vt("Multiplier",{inputs:{a:Z(8),b:Z(8)},outputs:{product:Z(16)},meta:{category:"arithmetic",icon:"×",description:"N-bit multiplier"},eval:({a:t,b:e})=>({product:t*e&65535})}),uA=vt("Comparator",({width:t=8}={})=>({inputs:{a:Z(t),b:Z(t)},outputs:{eq:J,lt:J,gt:J},meta:{category:"arithmetic",icon:"⋚",description:"Unsigned comparator"},eval:({a:e,b:n})=>{const i=e>>>0,s=n>>>0;return{eq:i===s?1:0,lt:i<s?1:0,gt:i>s?1:0}}})),fA=vt("LeftShifter",({width:t=8}={})=>({inputs:{value:Z(t),shift:Z(t)},outputs:{result:Z(t)},meta:{category:"arithmetic",icon:"≪",description:"Left bit shifter"},eval:({value:e,shift:n,width:i=t})=>{const s=i,a=n,c=s>=32?4294967295:(1<<s)-1;return{result:a>=s?0:e<<a&c}}})),dA=vt("RightShifter",({width:t=8}={})=>({inputs:{value:Z(t),shift:Z(t)},outputs:{result:Z(t)},meta:{category:"arithmetic",icon:"≫",description:"Right bit shifter"},eval:({value:e,shift:n,width:i=t})=>{const s=i,a=n;return{result:a>=s?0:e>>>a}}})),hA=vt("SignedAdder",{inputs:{a:Z(8),b:Z(8),carry_in:J},outputs:{sum:Z(8),overflow:J,carry_out:J},meta:{category:"arithmetic",icon:"±+",description:"Signed adder with overflow detection"},eval:({a:t,b:e,carry_in:n})=>{const a=t>>>0,c=e>>>0,u=a+c+n,d=u&255,h=(a&128)!==0,p=(c&128)!==0,m=(d&128)!==0;return{sum:d,overflow:h===p&&h!==m?1:0,carry_out:u>255?1:0}}}),pA=vt("SignedComparator",{inputs:{a:Z(8),b:Z(8)},outputs:{eq:J,lt:J,gt:J,lte:J,gte:J},meta:{category:"arithmetic",icon:"±⋚",description:"Signed comparator"},eval:({a:t,b:e})=>{const s=t&255,a=e&255,c=s&128?s-256:s,u=a&128?a-256:a;return{eq:c===u?1:0,lt:c<u?1:0,gt:c>u?1:0,lte:c<=u?1:0,gte:c>=u?1:0}}}),mA=vt("SignedMultiplier",{inputs:{a:Z(8),b:Z(8)},outputs:{product:Z(16)},meta:{category:"arithmetic",icon:"±×",description:"Signed multiplier"},eval:({a:t,b:e})=>{const s=t&255,a=e&255,c=s&128?s-256:s,u=a&128?a-256:a,d=c*u;return{product:d>=0?d:d+65536}}}),q0=vt("BusAnd",({width:t=8}={})=>({inputs:{a:Z(t),b:Z(t)},outputs:{out:Z(t)},meta:{category:"bus-operations",icon:"&8",description:"Bitwise AND on buses"},eval:({a:e,b:n})=>({out:e&n})})),gA=vt("BusOr",({width:t=8}={})=>({inputs:{a:Z(t),b:Z(t)},outputs:{out:Z(t)},meta:{category:"bus-operations",icon:"|8",description:"Bitwise OR on buses"},eval:({a:e,b:n})=>({out:(e|n)>>>0})})),yA=vt("BusNot",{inputs:{in:Z(8)},outputs:{out:Z(8)},meta:{category:"bus-operations",icon:"¬8",description:"Bitwise NOT on bus"},eval:({in:t})=>({out:~t&255})}),vA=vt("BusXor",({width:t=8}={})=>({inputs:{a:Z(t),b:Z(t)},outputs:{out:Z(t)},meta:{category:"bus-operations",icon:"⊕8",description:"Bitwise XOR on buses"},eval:({a:e,b:n})=>({out:(e^n)>>>0})})),bA=Object.freeze(Object.defineProperty({__proto__:null,Adder:oc,BusAnd:q0,BusNot:yA,BusOr:gA,BusXor:vA,Comparator:uA,Incrementer:aA,LeftShifter:fA,Multiplier:cA,RightShifter:dA,SignedAdder:hA,SignedComparator:pA,SignedMultiplier:mA,Subtractor:lA},Symbol.toStringTag,{value:"Module"})),le=vt("Mux",({width:t=1}={})=>({inputs:{in0:t===1?J:Z(t),in1:t===1?J:Z(t),sel:J},outputs:{out:t===1?J:Z(t)},meta:{category:"plexers",icon:"MUX",description:"Multiplexer — sel=0 picks in0, sel=1 picks in1"},eval:({in0:e,in1:n,sel:i})=>({out:i?n:e})})),xA=vt("Decoder",{inputs:{in:Z(2)},outputs:{out0:J,out1:J,out2:J,out3:J},meta:{category:"plexers",icon:"DEC",description:"2-to-4 decoder"},eval:({in:t})=>({out0:t===0?1:0,out1:t===1?1:0,out2:t===2?1:0,out3:t===3?1:0})}),wA=vt("Splitter",{inputs:{in:Z(8)},outputs:{out0:Z(4),out1:Z(4)},meta:{category:"utilities",icon:"⊢",description:"Bus splitter"},eval:({in:t})=>({out0:t&15,out1:t>>4&15})}),SA=vt("Splitter8to8",{inputs:{in:Z(8)},outputs:{bit0:J,bit1:J,bit2:J,bit3:J,bit4:J,bit5:J,bit6:J,bit7:J},meta:{category:"utilities",icon:"⊢8",description:"Splits 8-bit bus into 8 individual bits"},eval:({in:t})=>({bit0:t>>0&1,bit1:t>>1&1,bit2:t>>2&1,bit3:t>>3&1,bit4:t>>4&1,bit5:t>>5&1,bit6:t>>6&1,bit7:t>>7&1})}),EA=vt("Combiner8to8",{inputs:{bit0:J,bit1:J,bit2:J,bit3:J,bit4:J,bit5:J,bit6:J,bit7:J},outputs:{out:Z(8)},meta:{category:"utilities",icon:"⊣8",description:"Combines 8 bits into an 8-bit bus"},eval:({bit0:t,bit1:e,bit2:n,bit3:i,bit4:s,bit5:a,bit6:c,bit7:u})=>({out:t&1|(e&1)<<1|(n&1)<<2|(i&1)<<3|(s&1)<<4|(a&1)<<5|(c&1)<<6|(u&1)<<7})}),CA=vt("Concat",{inputs:{high:Z(4),low:Z(4)},outputs:{out:Z(8)},meta:{category:"utilities",icon:"||",description:"Concatenate two buses"},eval:({high:t,low:e})=>({out:t<<4|e})}),mr=vt("BitSlice",t=>({inputs:{in:Z(8)},outputs:{out:Z(8)},meta:{category:"utilities",icon:"[]",description:"Extract bits [low..high] from input"},eval:({in:e,low:n=0,high:i=7})=>{const s=n,c=i-s+1,u=c>=32?4294967295:(1<<c)-1;return{out:e>>s&u}}})),TA=vt("AddressCombiner",{inputs:{lo:Z(8),hi:Z(8)},outputs:{out:Z(16)},meta:{category:"utilities",icon:"⊕16",description:"Combines two 8-bit buses into 16-bit"},eval:({lo:t,hi:e})=>({out:(e&255)<<8|t&255})}),_A=vt("Probe",{inputs:{in:J},outputs:{out:J},meta:{category:"utilities",icon:"🔍",description:"Debug observation point"},eval:({in:t})=>({out:t})}),NA=Object.freeze(Object.defineProperty({__proto__:null,AddressCombiner:TA,BitSlice:mr,Combiner8to8:EA,Concat:CA,Decoder:xA,Mux:le,Probe:_A,Splitter:wA,Splitter8to8:SA},Symbol.toStringTag,{value:"Module"})),AA=vt("DFlipFlop",({value:t=!1}={})=>({inputs:{d:J},outputs:{q:J,q_bar:J},state:{value:t},meta:{category:"sequential",icon:"D",description:"D Flip-Flop — stores 1 bit on rising clock edge"},eval:({value:e})=>({q:e?1:0,q_bar:e?0:1}),onTick:({d:e})=>({value:!!e})})),kt=vt("Register",({width:t=8,value:e=0}={})=>({inputs:{data:Z(t),we:J},outputs:{q:Z(t)},state:{value:e},meta:{category:"sequential",icon:"REG",description:"N-bit register — stores data on rising clock edge when write-enable is high"},eval:({value:n})=>({q:n}),onTick:({data:n,we:i,value:s})=>({value:i?n:s})})),MA=Object.freeze(Object.defineProperty({__proto__:null,DFlipFlop:AA,Register:kt},Symbol.toStringTag,{value:"Module"})),RA=vt("ROM",t=>({inputs:{addr:Z(16)},outputs:{data_out:Z(8)},state:{memory:pr(65536,8)},meta:{category:"memory",icon:"📀",description:"Read-only memory with address decoding"},eval:({addr:e,memory:n})=>({data_out:n[e]}),onTick:({memory:e})=>({memory:e})})),kA=vt("RAM",t=>({inputs:{addr:Z(8),data_in:Z(8),we:J},outputs:{data_out:Z(8)},state:{memory:pr(256,8)},meta:{category:"memory",icon:"📝",description:"Random access memory"},eval:({addr:e,memory:n})=>({data_out:n[e]}),onTick:({addr:e,data_in:n,we:i,memory:s})=>(i&&(s[e]=n),{memory:s})})),OA=vt("DualPortRAM",t=>({inputs:{addrA:Z(8),dataA:Z(8),weA:J,addrB:Z(8)},outputs:{outA:Z(8),outB:Z(8)},state:{memory:pr(256,8)},meta:{category:"memory",icon:"📝×2",description:"Dual-port RAM"},eval:({addrA:e,addrB:n,memory:i})=>({outA:i[e],outB:i[n]}),onTick:({addrA:e,dataA:n,weA:i,memory:s})=>(i&&(s[e]=n),{memory:s})}));function DA(t){const e={};for(let n=0;n<t.length;n++){const i=t[n]&255;i!==0&&(e[n]=i)}return e}function jA(t,e){if(!Number.isInteger(e)||e<1||e>32)throw new Error(`ROM word width must be an integer in 1..32, got ${e}`);const n=e===32?4294967295:(1<<e)-1>>>0,i={};for(let s=0;s<t.length;s++){const a=(t[s]>>>0&n)>>>0;a!==0&&(i[s]=a)}return i}function zA(t){const e={};for(const[n,i]of t){if(!Number.isInteger(n)||n<0)throw new Error(`ROM address must be a non-negative integer, got ${n}`);i!==0&&(e[n]=i)}return e}const VA=Object.freeze(Object.defineProperty({__proto__:null,DualPortRAM:OA,RAM:kA,ROM:RA,romFromBytes:DA,romFromEntries:zA,romFromWords:jA},Symbol.toStringTag,{value:"Module"})),cd=vt("Switch",t=>({outputs:{out:J},eval:({value:e})=>({out:e?1:0}),meta:{category:"input-output",icon:"⚡",description:"User-controllable 1-bit toggle",interactiveArg:"value"}})),ud=vt("Button",t=>({outputs:{out:J},eval:({value:e})=>({out:e?1:0}),meta:{category:"input-output",icon:"🔘",description:"Push button input (momentary)",interactiveArg:"value"}})),fd=vt("Led",{inputs:{in:J},eval:()=>({}),meta:{category:"input-output",icon:"💡",description:"Visual output LED indicator"}}),dd=vt("Input",t=>({outputs:{out:Z(8)},eval:({value:e})=>({out:typeof e=="number"?e:0}),meta:{category:"input-output",icon:"🔢",description:"Multi-bit numeric input",interactiveArg:"value"}})),hd=vt("Output",{inputs:{in:Z(8)},eval:()=>({}),meta:{category:"input-output",icon:"📤",description:"Multi-bit output sink"}}),Mo=vt("Constant",({width:t=1}={})=>({outputs:{out:t===1?J:Z(t)},eval:({value:e})=>({out:typeof e=="number"?e:0}),meta:{category:"utilities",icon:"K",description:"Fixed value source",interactiveArg:"value"}})),LA=Object.freeze(Object.defineProperty({__proto__:null,Button:ud,Constant:Mo,Input:dd,Led:fd,Output:hd,Switch:cd},Symbol.toStringTag,{value:"Module"})),IA=vt("SevenSegment",{inputs:{in:Z(4)},meta:{category:"display",icon:"7",description:"4-bit seven-segment display",synthesizable:!1}}),pd=vt("HexDisplay",{inputs:{in:Z(8)},meta:{category:"display",icon:"0xFF",description:"Hexadecimal display",synthesizable:!1}}),BA=vt("Screen",t=>({inputs:{dataIn:Z(8)},outputs:{addrB:Z(16)},state:{memory:new Map},meta:{category:"display",icon:"🖥️",description:"Pixel display",synthesizable:!1},eval:()=>({addrB:0})})),PA=vt("RasterDisplay",t=>({inputs:{dataIn:Z(8)},outputs:{addrB:Z(16),scanX:Z(8),scanY:Z(8),hblank:J,vblank:J},state:{memory:new Map},meta:{category:"display",icon:"📺",description:"Hardware-accurate raster display with scan counters",synthesizable:!1},eval:()=>({addrB:0,scanX:0,scanY:0,hblank:0,vblank:0})})),HA=vt("Console",{inputs:{data:Z(8),we:J},state:{text:""},onTick:({data:t,we:e,text:n})=>{if(!e)return{text:n};const i=t&255;if(i===0)return{text:n};if(i===12)return{text:""};const s=(n??"")+String.fromCharCode(i);return{text:s.length>4096?s.slice(-4096):s}},meta:{category:"display",icon:"📟",description:"Text console output",synthesizable:!1}}),UA=Object.freeze(Object.defineProperty({__proto__:null,Console:HA,HexDisplay:pd,RasterDisplay:PA,Screen:BA,SevenSegment:IA},Symbol.toStringTag,{value:"Module"})),md=vt("RV32I_Decode",{inputs:{instruction:Z(32)},outputs:{opcode:Z(7),rd:Z(5),funct3:Z(3),rs1:Z(5),rs2:Z(5),funct7:Z(7)},eval:({instruction:t})=>{const e=t>>>0;return{opcode:e&127,rd:e>>>7&31,funct3:e>>>12&7,rs1:e>>>15&31,rs2:e>>>20&31,funct7:e>>>25&127}},meta:{category:"rv32i",icon:"DEC",description:"RISC-V instruction decoder"}}),Y0=vt("RV32I_ALU",{inputs:{a:Z(32),b:Z(32),alu_op:Z(4)},outputs:{result:Z(32),zero:J},eval:({a:t,b:e,alu_op:n})=>{const i=t>>>0,s=e>>>0,a=n&15;let c;switch(a){case 0:c=i+s>>>0;break;case 1:c=i-s>>>0;break;case 2:c=(i&s)>>>0;break;case 3:c=(i|s)>>>0;break;case 4:c=(i^s)>>>0;break;case 5:c=i<<(s&31)>>>0;break;case 6:c=i>>>(s&31);break;case 7:c=(i|0)>>(s&31)>>>0;break;case 8:c=(i|0)<(s|0)?1:0;break;case 9:c=i<s?1:0;break;default:c=0}return{result:c,zero:c===0?1:0}},meta:{category:"rv32i",icon:"ALU",description:"RISC-V ALU"}}),G0=vt("RV32I_ImmGen",{inputs:{instruction:Z(32)},outputs:{immediate:Z(32)},eval:({instruction:t})=>{const e=t>>>0,n=e&127;let i;switch(n){case 19:case 3:case 103:i=e>>20|0;break;case 35:i=e>>25<<5|e>>>7&31|0,i=i<<20>>20;break;case 99:{const s=e>>>31&1,a=e>>>7&1,c=e>>>25&63,u=e>>>8&15;i=s<<12|a<<11|c<<5|u<<1,i=i<<19>>19;break}case 55:case 23:i=e&4294963200|0;break;case 111:{const s=e>>>31&1,a=e>>>12&255,c=e>>>20&1,u=e>>>21&1023;i=s<<20|a<<12|c<<11|u<<1,i=i<<11>>11;break}default:i=0}return{immediate:i>>>0}},meta:{category:"rv32i",icon:"IMM",description:"RISC-V immediate generator"}}),X0=vt("RV32I_Control",{inputs:{opcode:Z(7),funct3:Z(3),funct7_bit:J},outputs:{alu_op:Z(4),alu_src:J,mem_read:J,mem_write:J,reg_write:J,mem_to_reg:J,branch:J,jump:J,lui:J,auipc:J,is_jalr:J},eval:({opcode:t,funct3:e,funct7_bit:n})=>{const i=t&127,s=e&7,a=n?1:0;let c=0,u=0,d=0,h=0,p=0,m=0,y=0,b=0,x=0,w=0,S=0;switch(i){case 51:switch(p=1,s){case 0:c=a?1:0;break;case 1:c=5;break;case 2:c=8;break;case 3:c=9;break;case 4:c=4;break;case 5:c=a?7:6;break;case 6:c=3;break;case 7:c=2;break}break;case 19:switch(p=1,u=1,s){case 0:c=0;break;case 1:c=5;break;case 2:c=8;break;case 3:c=9;break;case 4:c=4;break;case 5:c=a?7:6;break;case 6:c=3;break;case 7:c=2;break}break;case 3:p=1,u=1,d=1,m=1,c=0;break;case 35:u=1,h=1,c=0;break;case 99:y=1,c=1;break;case 111:p=1,b=1;break;case 103:p=1,b=1,u=1,S=1,c=0;break;case 55:p=1,x=1;break;case 23:p=1,w=1;break}return{alu_op:c,alu_src:u,mem_read:d,mem_write:h,reg_write:p,mem_to_reg:m,branch:y,jump:b,lui:x,auipc:w,is_jalr:S}},meta:{category:"rv32i",icon:"CTL",description:"RISC-V control unit"}}),F0=vt("RV32I_BranchComp",{inputs:{a:Z(32),b:Z(32),funct3:Z(3)},outputs:{take_branch:J},eval:({a:t,b:e,funct3:n})=>{const i=t>>>0,s=e>>>0,a=i|0,c=s|0,u=n&7;let d=0;switch(u){case 0:d=i===s?1:0;break;case 1:d=i!==s?1:0;break;case 4:d=a<c?1:0;break;case 5:d=a>=c?1:0;break;case 6:d=i<s?1:0;break;case 7:d=i>=s?1:0;break}return{take_branch:d}},meta:{category:"rv32i",icon:"CMP",description:"RISC-V branch comparator"}}),Z0=vt("RV32I_RegisterFile",{inputs:{rs1:Z(5),rs2:Z(5),rd:Z(5),write_data:Z(32),we:J,debug_rs:Z(5)},outputs:{read1:Z(32),read2:Z(32),debug_read:Z(32)},state:{memory:pr(32,32)},eval:({rs1:t,rs2:e,debug_rs:n,memory:i})=>{const s=t&31,a=e&31,c=n&31;return{read1:s===0?0:i[s]>>>0,read2:a===0?0:i[a]>>>0,debug_read:c===0?0:i[c]>>>0}},onTick:({rd:t,write_data:e,we:n,memory:i})=>{const s=t&31;return n&&s!==0&&(i[s]=e>>>0),{memory:i}},meta:{category:"rv32i",icon:"RF",description:"RISC-V 32-register file"}}),$A=vt("RV32I_InstrMem",{inputs:{addr:Z(32)},outputs:{instruction:Z(32)},state:{memory:pr(65536,8)},eval:({addr:t,memory:e})=>{const n=t>>>0,i=e[n],s=e[n+1],a=e[n+2];return{instruction:(e[n+3]<<24|a<<16|s<<8|i)>>>0}},onTick:({memory:t})=>({memory:t}),meta:{category:"rv32i",icon:"IM",description:"RISC-V instruction memory"}}),qA=vt("RV32I_DataMem",{inputs:{addr:Z(32),write_data:Z(32),mem_read:J,mem_write:J,funct3:Z(3)},outputs:{read_data:Z(32),misalign:J},state:{memory:pr(65536,8)},eval:({addr:t,mem_read:e,mem_write:n,funct3:i,memory:s})=>{if(!e&&!n)return{read_data:0,misalign:0};const a=t>>>0,c=i&7;let u=0;if(((c===1||c===5)&&(a&1)!==0||c===2&&(a&3)!==0)&&(u=1),!e)return{read_data:0,misalign:u};let d;switch(c){case 0:{d=s[a]<<24>>24>>>0;break}case 1:{const h=s[a];d=(s[a+1]<<8|h)<<16>>16>>>0;break}case 2:{const h=s[a],p=s[a+1],m=s[a+2];d=(s[a+3]<<24|m<<16|p<<8|h)>>>0;break}case 4:d=s[a];break;case 5:{const h=s[a];d=(s[a+1]<<8|h)>>>0;break}default:d=0}return{read_data:d,misalign:u}},onTick:({addr:t,write_data:e,mem_write:n,funct3:i,memory:s})=>{if(!n)return{memory:s};const a=t>>>0,c=e>>>0;switch(i&7){case 0:s[a]=c&255;break;case 1:s[a]=c&255,s[a+1]=c>>>8&255;break;case 2:s[a]=c&255,s[a+1]=c>>>8&255,s[a+2]=c>>>16&255,s[a+3]=c>>>24&255;break}return{memory:s}},meta:{category:"rv32i",icon:"DM",description:"RISC-V data memory with byte/half/word access"}}),gd=vt("RV32I_WritebackMux",{inputs:{alu_result:Z(32),load_data:Z(32),pc_plus4:Z(32),immediate:Z(32),pc_plus_imm:Z(32),mem_to_reg:J,lui:J,auipc:J,jump:J},outputs:{write_data:Z(32)},eval:({alu_result:t,load_data:e,pc_plus4:n,immediate:i,pc_plus_imm:s,mem_to_reg:a,lui:c,auipc:u,jump:d})=>{let h;return d?h=n:u?h=s:c?h=i:a?h=e:h=t,{write_data:(h??0)>>>0}},meta:{category:"rv32i",icon:"WB",description:"RISC-V writeback mux"}}),K0=vt("RV32I_NextPCMux",{inputs:{pc_plus4:Z(32),branch_target:Z(32),jal_target:Z(32),jalr_target:Z(32),branch:J,take_branch:J,jump:J,is_jalr:J},outputs:{next_pc:Z(32)},eval:({pc_plus4:t,branch_target:e,jal_target:n,jalr_target:i,branch:s,take_branch:a,jump:c,is_jalr:u})=>{let d;return c?d=u?i&-2:n:s&&a?d=e:d=t,{next_pc:(d??0)>>>0}},meta:{category:"rv32i",icon:"PC",description:"RISC-V next PC mux"}}),Q0=vt("RV32I_ForwardingUnit",{inputs:{id_rs1:Z(5),id_rs2:Z(5),ex_rd:Z(5),ex_reg_write:J,mem_rd:Z(5),mem_reg_write:J},outputs:{forward_a:Z(2),forward_b:Z(2)},eval:({id_rs1:t,id_rs2:e,ex_rd:n,ex_reg_write:i,mem_rd:s,mem_reg_write:a})=>{const c=t&31,u=e&31,d=n&31,h=s&31;let p=0,m=0;return i&&d!==0&&d===c?p=1:a&&h!==0&&h===c&&(p=2),i&&d!==0&&d===u?m=1:a&&h!==0&&h===u&&(m=2),{forward_a:p,forward_b:m}},meta:{category:"rv32i",icon:"FWD",description:"RISC-V data forwarding unit"}}),yd=vt("RV32I_WBBypass",{inputs:{rs_val:Z(32),rs_addr:Z(5),wb_val:Z(32),wb_rd:Z(5),wb_we:J},outputs:{out:Z(32)},eval:({rs_val:t,rs_addr:e,wb_val:n,wb_rd:i,wb_we:s})=>{const a=e&31,c=i&31;return{out:(s&&c!==0&&c===a?n:t)>>>0}},meta:{category:"rv32i",icon:"BYP",description:"RISC-V writeback bypass"}}),YA=vt("RV32I_LoadAlign",{inputs:{data:Z(32),funct3:Z(3)},outputs:{out:Z(32)},eval:({data:t,funct3:e})=>{const n=t>>>0,i=e&7;let s;switch(i){case 0:{s=(n&255)<<24>>24>>>0;break}case 1:{s=(n&65535)<<16>>16>>>0;break}case 4:s=n&255;break;case 5:s=n&65535;break;default:s=n}return{out:s}},meta:{category:"rv32i",icon:"LA",description:"RISC-V load alignment (byte/half/word)"}}),W0=vt("RV32I_LoadAlignFull",{inputs:{data:Z(32),byte_offset:Z(2),funct3:Z(3)},outputs:{out:Z(32)},eval:({data:t,byte_offset:e,funct3:n})=>{const i=t>>>0,s=e&3,a=n&7,c=i>>>s*8&255,u=i>>>(s&2)*8&65535;let d;switch(a){case 0:d=c<<24>>24>>>0;break;case 1:d=u<<16>>16>>>0;break;case 4:d=c;break;case 5:d=u;break;default:d=i;break}return{out:d}},meta:{category:"rv32i",icon:"LA2",description:"RISC-V full load aligner (raw word + byte offset + funct3)"}}),J0=vt("RV32I_HazardUnit",{inputs:{if_rs1:Z(5),if_rs2:Z(5),id_rd:Z(5),id_mem_read:J,branch_taken:J,jump:J},outputs:{stall:J,flush:J},eval:({if_rs1:t,if_rs2:e,id_rd:n,id_mem_read:i,branch_taken:s,jump:a})=>{const c=t&31,u=e&31,d=n&31;return{stall:i&&d!==0&&(d===c||d===u)?1:0,flush:s||a?1:0}},meta:{category:"rv32i",icon:"HAZ",description:"RISC-V hazard detection unit"}}),GA=vt("DualPortROM",t=>({inputs:{addrA:Z(32),addrB:Z(32)},outputs:{dataA:Z(32),dataB:Z(32)},state:{memory:pr(65536,8)},eval:({addrA:e,addrB:n,memory:i})=>{const s=e>>>0,a=n>>>0;return{dataA:(i[s+3]<<24|i[s+2]<<16|i[s+1]<<8|i[s])>>>0,dataB:(i[a+3]<<24|i[a+2]<<16|i[a+1]<<8|i[a])>>>0}},onTick:({memory:e})=>({memory:e}),meta:{category:"memory",description:"Dual-port read-only memory"}})),XA=Object.freeze(Object.defineProperty({__proto__:null,DualPortROM:GA,RV32I_ALU:Y0,RV32I_BranchComp:F0,RV32I_Control:X0,RV32I_DataMem:qA,RV32I_Decode:md,RV32I_ForwardingUnit:Q0,RV32I_HazardUnit:J0,RV32I_ImmGen:G0,RV32I_InstrMem:$A,RV32I_LoadAlign:YA,RV32I_LoadAlignFull:W0,RV32I_NextPCMux:K0,RV32I_RegisterFile:Z0,RV32I_WBBypass:yd,RV32I_WritebackMux:gd},Symbol.toStringTag,{value:"Module"})),FA=vt("RV32I_Core",({debug:t=!1}={})=>{const e={instruction:Z(32),data_read:Z(32),net_rx_data:Z(32),net_rx_valid:J,net_rx_frame:J,...t?{debug_addr:Z(5)}:{}},n={instr_addr:Z(32),data_addr:Z(32),data_write:Z(32),data_mem_read:J,data_mem_write:J,data_funct3:Z(3),net_tx_data:Z(32),net_tx_valid:J,net_tx_frame:J,pc_out:Z(32),...t?{debug_value:Z(32),if_pc:Z(32),id_pc:Z(32),ex_pc:Z(32),mem_pc4:Z(32),wb_pc4:Z(32)}:{}};return{inputs:e,outputs:n,nodes:{four:Mo({value:4,width:32}),zero32:Mo({value:0,width:32}),zero5:Mo({value:0,width:5}),zero4:Mo({value:0,width:4}),zero3:Mo({value:0,width:3}),zero1:Mo({value:0,width:1}),one1:Mo({value:1,width:1}),hazard:J0,stall_inv:$0,pc:kt({width:32}),pc_plus4:oc({width:32}),ifid_instr_mux:le({width:32}),ifid_instr:kt({width:32}),ifid_pc_mux:le({width:32}),ifid_pc:kt({width:32}),ifid_pc4_mux:le({width:32}),ifid_pc4:kt({width:32}),decode:md,immgen:G0,control:X0,funct7_splitter:mr({low:5,high:5}),regfile:Z0,ifid_decode_for_hazard:md,idex_flush:ld,idex_pc:kt({width:32}),idex_pc4:kt({width:32}),wb_bypass1:yd,wb_bypass2:yd,idex_read1:kt({width:32}),idex_read2:kt({width:32}),idex_imm:kt({width:32}),idex_rs1_mux:le({width:5}),idex_rs1:kt({width:5}),idex_rs2_mux:le({width:5}),idex_rs2:kt({width:5}),idex_rd_mux:le({width:5}),idex_rd:kt({width:5}),idex_funct3_mux:le({width:3}),idex_funct3:kt({width:3}),idex_alu_op_mux:le({width:4}),idex_alu_op:kt({width:4}),idex_alu_src_mux:le({width:1}),idex_alu_src:kt({width:1}),idex_mem_read_mux:le({width:1}),idex_mem_read:kt({width:1}),idex_mem_write_mux:le({width:1}),idex_mem_write:kt({width:1}),idex_reg_write_mux:le({width:1}),idex_reg_write:kt({width:1}),idex_mem_to_reg_mux:le({width:1}),idex_mem_to_reg:kt({width:1}),idex_branch_mux:le({width:1}),idex_branch:kt({width:1}),idex_jump_mux:le({width:1}),idex_jump:kt({width:1}),idex_lui_mux:le({width:1}),idex_lui:kt({width:1}),idex_auipc_mux:le({width:1}),idex_auipc:kt({width:1}),idex_is_jalr_mux:le({width:1}),idex_is_jalr:kt({width:1}),forward:Q0,fwd_a_bit0:mr({low:0,high:0}),fwd_a_bit1:mr({low:1,high:1}),fwd_a_mux1:le({width:32}),fwd_a_mux2:le({width:32}),fwd_b_bit0:mr({low:0,high:0}),fwd_b_bit1:mr({low:1,high:1}),fwd_b_mux1:le({width:32}),fwd_b_mux2:le({width:32}),alu_src_mux:le({width:32}),alu:Y0,branch_comp:F0,branch_target:oc({width:32}),jalr_target:q0({width:32}),jalr_mask:Mo({value:4294967294,width:32}),pc_plus_imm:oc({width:32}),ex_result:gd,branch_and:U0,next_pc:K0,pc_src_taken:ld,pc_next_mux:le({width:32}),exmem_alu_result:kt({width:32}),exmem_result:kt({width:32}),exmem_read2:kt({width:32}),exmem_rd:kt({width:5}),exmem_funct3:kt({width:3}),exmem_pc4:kt({width:32}),exmem_imm:kt({width:32}),exmem_pc_plus_imm:kt({width:32}),exmem_mem_read:kt({width:1}),exmem_mem_write:kt({width:1}),exmem_reg_write:kt({width:1}),exmem_mem_to_reg:kt({width:1}),exmem_lui:kt({width:1}),exmem_auipc:kt({width:1}),exmem_jump:kt({width:1}),memwb_alu_result:kt({width:32}),memwb_load_data:kt({width:32}),memwb_rd:kt({width:5}),memwb_pc4:kt({width:32}),memwb_imm:kt({width:32}),memwb_pc_plus_imm:kt({width:32}),memwb_reg_write:kt({width:1}),memwb_mem_to_reg:kt({width:1}),memwb_lui:kt({width:1}),memwb_auipc:kt({width:1}),memwb_jump:kt({width:1}),exmem_lo2:mr({low:0,high:1}),memwb_byte_offset:kt({width:2}),memwb_funct3:kt({width:3}),load_align:W0,wb_mux:gd},connect:({inputs:i,outputs:s,nodes:{four:a,zero32:c,zero5:u,zero4:d,zero3:h,zero1:p,one1:m,hazard:y,stall_inv:b,pc:x,pc_plus4:w,ifid_instr_mux:S,ifid_instr:E,ifid_pc_mux:D,ifid_pc:T,ifid_pc4_mux:C,ifid_pc4:R,decode:A,immgen:O,control:k,funct7_splitter:H,regfile:$,ifid_decode_for_hazard:q,idex_flush:F,idex_pc:Q,idex_pc4:B,wb_bypass1:P,wb_bypass2:j,idex_read1:I,idex_read2:z,idex_imm:U,idex_rs1_mux:Y,idex_rs1:L,idex_rs2_mux:G,idex_rs2:tt,idex_rd_mux:it,idex_rd:lt,idex_funct3_mux:ht,idex_funct3:ft,idex_alu_op_mux:ut,idex_alu_op:dt,idex_alu_src_mux:Mt,idex_alu_src:Nt,idex_mem_read_mux:bt,idex_mem_read:Tt,idex_mem_write_mux:Dt,idex_mem_write:qt,idex_reg_write_mux:Ht,idex_reg_write:pt,idex_mem_to_reg_mux:gt,idex_mem_to_reg:yt,idex_branch_mux:mt,idex_branch:Et,idex_jump_mux:Vt,idex_jump:jt,idex_lui_mux:zt,idex_lui:ue,idex_auipc_mux:Xt,idex_auipc:xe,idex_is_jalr_mux:Pe,idex_is_jalr:Po,forward:Ae,fwd_a_bit0:So,fwd_a_bit1:_i,fwd_a_mux1:pe,fwd_a_mux2:re,fwd_b_bit0:ee,fwd_b_bit1:Ee,fwd_b_mux1:Ni,fwd_b_mux2:Ai,alu_src_mux:Mi,alu:Jn,branch_comp:to,branch_target:Eo,jalr_target:mn,jalr_mask:Ri,pc_plus_imm:eo,ex_result:tn,branch_and:ki,next_pc:Ke,pc_src_taken:no,pc_next_mux:Oi,exmem_alu_result:Di,exmem_result:ji,exmem_read2:zi,exmem_rd:Ho,exmem_funct3:Uo,exmem_pc4:$o,exmem_imm:Vi,exmem_pc_plus_imm:en,exmem_mem_read:ve,exmem_mem_write:Me,exmem_reg_write:gn,exmem_mem_to_reg:Co,exmem_lui:Li,exmem_auipc:zr,exmem_jump:Ii,memwb_alu_result:oo,memwb_load_data:qo,memwb_rd:Mn,memwb_pc4:yn,memwb_imm:Rn,memwb_pc_plus_imm:kn,memwb_reg_write:me,memwb_mem_to_reg:Bi,memwb_lui:Pi,memwb_auipc:vn,memwb_jump:On,exmem_lo2:Ds,memwb_byte_offset:Yo,memwb_funct3:Hi,load_align:Ui,wb_mux:He}})=>{const Go=[y.stall.to(b.in,F.b),x.q.to(w.a,s.instr_addr,D.in0,s.pc_out),a.out.to(w.b),b.out.to(x.we,E.we,T.we,R.we),i.instruction.to(S.in0),c.out.to(S.in1,D.in1,C.in1,tn.load_data),y.flush.to(S.sel,D.sel,C.sel,F.a),S.out.to(E.data),D.out.to(T.data),w.sum.to(C.in0,Oi.in0),C.out.to(R.data),E.q.to(A.instruction,O.instruction,q.instruction),A.opcode.to(k.opcode),A.funct3.to(k.funct3,ht.in0),A.funct7.to(H.in),H.out.to(k.funct7_bit),A.rs1.to($.rs1,P.rs_addr,Y.in0),A.rs2.to($.rs2,j.rs_addr,G.in0),q.rs1.to(y.if_rs1),q.rs2.to(y.if_rs2),T.q.to(Q.data),m.out.to(Q.we,B.we,I.we,z.we,U.we,L.we,tt.we,lt.we,ft.we,dt.we,Nt.we,Tt.we,qt.we,pt.we,yt.we,Et.we,jt.we,ue.we,xe.we,Po.we,Di.we,ji.we,zi.we,Ho.we,Uo.we,$o.we,Vi.we,en.we,ve.we,Me.we,gn.we,Co.we,Li.we,zr.we,Ii.we,oo.we,qo.we,Mn.we,yn.we,Rn.we,kn.we,me.we,Bi.we,Pi.we,vn.we,On.we,Yo.we,Hi.we),R.q.to(B.data),$.read1.to(P.rs_val),He.write_data.to(P.wb_val,j.wb_val,$.write_data,re.in1,Ai.in1),Mn.q.to(P.wb_rd,j.wb_rd,Ae.mem_rd,$.rd),me.q.to(P.wb_we,j.wb_we,Ae.mem_reg_write,$.we),$.read2.to(j.rs_val),P.out.to(I.data),j.out.to(z.data),O.immediate.to(U.data),u.out.to(Y.in1,G.in1,it.in1),F.out.to(Y.sel,G.sel,it.sel,ht.sel,ut.sel,Mt.sel,bt.sel,Dt.sel,Ht.sel,gt.sel,mt.sel,Vt.sel,zt.sel,Xt.sel,Pe.sel),Y.out.to(L.data),G.out.to(tt.data),A.rd.to(it.in0),it.out.to(lt.data),h.out.to(ht.in1),ht.out.to(ft.data),k.alu_op.to(ut.in0),d.out.to(ut.in1),ut.out.to(dt.data),k.alu_src.to(Mt.in0),p.out.to(Mt.in1,bt.in1,Dt.in1,Ht.in1,gt.in1,mt.in1,Vt.in1,zt.in1,Xt.in1,Pe.in1),Mt.out.to(Nt.data),k.mem_read.to(bt.in0),bt.out.to(Tt.data),k.mem_write.to(Dt.in0),Dt.out.to(qt.data),k.reg_write.to(Ht.in0),Ht.out.to(pt.data),k.mem_to_reg.to(gt.in0),gt.out.to(yt.data),k.branch.to(mt.in0),mt.out.to(Et.data),k.jump.to(Vt.in0),Vt.out.to(jt.data),k.lui.to(zt.in0),zt.out.to(ue.data),k.auipc.to(Xt.in0),Xt.out.to(xe.data),k.is_jalr.to(Pe.in0),Pe.out.to(Po.data),L.q.to(Ae.id_rs1),tt.q.to(Ae.id_rs2),Ae.forward_a.to(So.in,_i.in),I.q.to(pe.in0),So.out.to(pe.sel),pe.out.to(re.in0),_i.out.to(re.sel),Ae.forward_b.to(ee.in,Ee.in),z.q.to(Ni.in0),ee.out.to(Ni.sel),Ni.out.to(Ai.in0),Ee.out.to(Ai.sel),Ai.out.to(Mi.in0,to.b,zi.data),U.q.to(Mi.in1,Eo.b,eo.b,tn.immediate,Vi.data),Nt.q.to(Mi.sel),re.out.to(Jn.a,to.a),Mi.out.to(Jn.b),dt.q.to(Jn.alu_op),ft.q.to(to.funct3,Uo.data),Q.q.to(Eo.a,eo.a),Jn.result.to(mn.a,tn.alu_result,Di.data),Ri.out.to(mn.b),B.q.to(tn.pc_plus4,Ke.pc_plus4,$o.data),eo.sum.to(tn.pc_plus_imm,en.data),yt.q.to(tn.mem_to_reg,Co.data),ue.q.to(tn.lui,Li.data),xe.q.to(tn.auipc,zr.data),jt.q.to(tn.jump,Ke.jump,no.b,y.jump,Ii.data),Et.q.to(ki.a,Ke.branch),to.take_branch.to(ki.b,Ke.take_branch),Eo.sum.to(Ke.branch_target,Ke.jal_target),mn.out.to(Ke.jalr_target),Po.q.to(Ke.is_jalr),ki.out.to(no.a,y.branch_taken),Ke.next_pc.to(Oi.in1),no.out.to(Oi.sel),Oi.out.to(x.data),lt.q.to(y.id_rd,Ho.data),Tt.q.to(y.id_mem_read,ve.data),tn.write_data.to(ji.data),qt.q.to(Me.data),pt.q.to(gn.data),Ho.q.to(Ae.ex_rd,Mn.data),gn.q.to(Ae.ex_reg_write,me.data),ji.q.to(pe.in1,Ni.in1),Di.q.to(s.data_addr,oo.data,Ds.in),Ds.out.to(Yo.data),zi.q.to(s.data_write),ve.q.to(s.data_mem_read),Me.q.to(s.data_mem_write),Uo.q.to(s.data_funct3,Hi.data),i.data_read.to(qo.data),$o.q.to(yn.data),Vi.q.to(Rn.data),en.q.to(kn.data),Co.q.to(Bi.data),Li.q.to(Pi.data),zr.q.to(vn.data),Ii.q.to(On.data),oo.q.to(He.alu_result),qo.q.to(Ui.data),Yo.q.to(Ui.byte_offset),Hi.q.to(Ui.funct3),Ui.out.to(He.load_data),yn.q.to(He.pc_plus4),Rn.q.to(He.immediate),kn.q.to(He.pc_plus_imm),Bi.q.to(He.mem_to_reg),Pi.q.to(He.lui),vn.q.to(He.auipc),On.q.to(He.jump)];return t&&Go.push(i.debug_addr.to($.debug_rs),$.debug_read.to(s.debug_value),x.q.to(s.if_pc),T.q.to(s.id_pc),Q.q.to(s.ex_pc),$o.q.to(s.mem_pc4),yn.q.to(s.wb_pc4)),Go}}}),ZA=Object.freeze(Object.defineProperty({__proto__:null,RV32I_Core:FA},Symbol.toStringTag,{value:"Module"})),KA=(()=>{const t=new Array(256);for(let e=0;e<256;e++){let n=e;for(let i=0;i<8;i++)n=n&1?(n>>>1^3988292384)>>>0:n>>>1>>>0;t[e]=n>>>0}return t})(),QA=vt("Eth_ProtocolDecoder",{inputs:{ethertype:Z(16)},outputs:{is_ipv4:J,is_ipv6:J,is_arp:J,is_vlan:J,is_mpls:J},eval:({ethertype:t})=>{const e=t&65535;return{is_ipv4:e===2048?1:0,is_ipv6:e===34525?1:0,is_arp:e===2054?1:0,is_vlan:e===33024?1:0,is_mpls:e===34887?1:0}},meta:{category:"networking",icon:"EP",description:"EtherType → protocol flags"}}),WA=vt("Eth_AddrClassifier",{inputs:{dst_mac_hi:Z(16),dst_mac_lo:Z(32)},outputs:{is_broadcast:J,is_multicast:J,is_unicast:J},eval:({dst_mac_hi:t,dst_mac_lo:e})=>{const n=t&65535,i=(e&4294967295)>>>0,s=n===65535&&i===4294967295?1:0,a=!s&&(i>>>24&1)===1?1:0;return{is_broadcast:s,is_multicast:a,is_unicast:!s&&!a?1:0}},meta:{category:"networking",icon:"EA",description:"MAC address classifier"}}),JA=vt("Eth_FrameInput",{inputs:{enable:J,reset:J},outputs:{tdata:Z(32),tkeep:Z(4),tvalid:J,tlast:J,byte_offset:Z(16)},state:{memory:new Map},eval:({memory:t})=>{const e=t??new Map,n=(e.get(65539)??0)>>>0,i=(e.get(65540)??0)&15,s=(e.get(65541)??0)!==0?1:0,a=(e.get(65542)??0)!==0?1:0,c=(e.get(65543)??0)&65535;return{tdata:n,tkeep:i,tvalid:s,tlast:a,byte_offset:c}},onTick:({enable:t,reset:e,memory:n})=>{const i=n??new Map,s=65536,a=65537,c=65538,u=65539,d=65540,h=65541,p=65542,m=65543;if(e){const C=new Map(i);return C.set(s,0),C.set(c,0),C.set(h,0),C.set(p,0),{memory:C}}if(!t){const C=new Map(i);return C.set(h,0),{memory:C}}const y=new Map(i);if(!(i.get(c)??0)){let C=-1;for(const R of i.keys())R<65536&&R>C&&(C=R);y.set(a,C+1),y.set(c,1)}const b=y.get(a)??0,x=i.get(s)??0;if(x>=b||b===0)return y.set(u,0),y.set(d,0),y.set(h,0),y.set(p,0),y.set(m,x&65535),{memory:y};const w=b-x,S=Math.min(4,w);let E=0,D=0;for(let C=0;C<S;C++)E=(E|((i.get(x+C)??0)&255)<<24-C*8)>>>0,D|=1<<3-C;const T=x+S>=b;return y.set(u,E),y.set(d,D),y.set(h,1),y.set(p,T?1:0),y.set(m,x&65535),y.set(s,x+S),{memory:y}},meta:{category:"networking",icon:"EI",description:"Ethernet frame input (AXI-Stream)"}}),tM=vt("Eth_FrameParser",{inputs:{tdata:Z(32),tkeep:Z(4),tvalid:J,tlast:J},outputs:{dst_mac_hi:Z(16),dst_mac_lo:Z(32),dst_mac_valid:J,src_mac_hi:Z(16),src_mac_lo:Z(32),src_mac_valid:J,ethertype:Z(16),ethertype_valid:J,has_vlan:J,vlan_tci:Z(16),vlan_valid:J,payload_valid:J,frame_done:J,frame_length:Z(16),parse_state:Z(4)},state:{memory:new Map},eval:({memory:t})=>{const e=t??new Map,n=e.get(0)??0,i=(e.get(1)??0)>>>0,s=(e.get(2)??0)&65535,a=(e.get(3)??0)>>>0,c=(e.get(4)??0)&65535,u=(e.get(5)??0)&65535,d=(e.get(6)??0)&65535,h=(e.get(7)??0)!==0,p=(e.get(8)??0)&65535;return{dst_mac_hi:s,dst_mac_lo:i,dst_mac_valid:n>=2?1:0,src_mac_hi:c,src_mac_lo:a,src_mac_valid:n>=4?1:0,ethertype:u,ethertype_valid:n>=6?1:0,has_vlan:h?1:0,vlan_tci:d,vlan_valid:h&&n>=6?1:0,payload_valid:n===6||n===7?1:0,frame_done:n===7?1:0,frame_length:p,parse_state:n}},onTick:({tdata:t,tkeep:e,tvalid:n,tlast:i,memory:s})=>{const a=s??new Map;if(!n)return{memory:a};const c=t>>>0,u=e&15,d=!!i,h=0,p=1,m=2,y=3,b=4,x=5,w=6,S=7,E=8,D=0,T=2,C=3,R=4,A=5,O=6,k=7,H=new Map(a);let $=a.get(h)??D;const q=(u>>3&1)+(u>>2&1)+(u>>1&1)+(u&1),F=a.get(E)??0;H.set(E,F+q);const Q=c>>>24&255,B=c>>>16&255,P=c>>>8&255,j=c&255;switch($){case D:H.set(p,c),H.set(h,T);break;case T:H.set(m,Q<<8|B),H.set(y,P<<8|j),H.set(h,C);break;case C:H.set(b,a.get(y)??0),H.set(y,c),H.set(h,R);break;case R:{const I=(Q<<8|B)&65535;I===33024?(H.set(w,(P<<8|j)&65535),H.set(S,1),H.set(x,I),H.set(h,A)):(H.set(x,I),H.set(h,d?k:O));break}case A:H.set(x,(Q<<8|B)&65535),H.set(h,d?k:O);break;case O:d&&H.set(h,k);break}return d&&$!==k&&H.set(E,F+q),{memory:H}},meta:{category:"networking",icon:"EF",description:"Ethernet frame parser FSM"}}),eM=vt("Eth_CRC32",{inputs:{data:Z(32),data_valid:J,tkeep:Z(4),tlast:J,reset:J},outputs:{crc:Z(32),crc_ok:J},state:{memory:new Map},eval:({memory:t})=>{const e=t??new Map,n=(e.get(0)??4294967295)>>>0,i=(e.get(1)??0)!==0;return{crc:~n>>>0,crc_ok:i&&n===3736805603?1:0}},onTick:({data:t,data_valid:e,tkeep:n,tlast:i,reset:s,memory:a})=>{const c=a??new Map;if(s){const m=new Map(c);return m.set(0,4294967295),m.set(1,0),{memory:m}}if(!e)return{memory:c};const u=t>>>0,d=n&15;let h=(c.get(0)??4294967295)>>>0;for(let m=3;m>=0;m--)if(d>>m&1){const y=u>>>m*8&255;h=(KA[(h^y)&255]^h>>>8)>>>0}const p=new Map(c);return p.set(0,h),i&&p.set(1,1),{memory:p}},meta:{category:"networking",icon:"EC",description:"IEEE 802.3 CRC-32 checker"}}),nM=vt("MemBusMux",{inputs:{addr:Z(32),write_data:Z(32),mem_read:J,mem_write:J,funct3:Z(3),read_data_0:Z(32),read_data_1:Z(32),read_data_2:Z(32),read_data_3:Z(32),read_data_4:Z(32)},outputs:{local_addr:Z(32),write_data_out:Z(32),funct3_out:Z(3),read_data:Z(32),p0_read:J,p0_write:J,p1_read:J,p1_write:J,p2_read:J,p2_write:J,p3_read:J,p3_write:J,p4_read:J,p4_write:J},eval:({addr:t,write_data:e,mem_read:n,mem_write:i,funct3:s,read_data_0:a,read_data_1:c,read_data_2:u,read_data_3:d,read_data_4:h,base0:p,base1:m,base2:y,base3:b,base4:x,end0:w,end1:S,end2:E,end3:D,end4:T})=>{const C=(t??0)>>>0,R=(e??0)>>>0,A=(s??0)&7,O=[{base:(p??65536)>>>0,end:(w??131071)>>>0},{base:(m??2147483648)>>>0,end:(S??2147487743)>>>0},{base:(y??2147487744)>>>0,end:(E??2147491839)>>>0},{base:(b??2147491840)>>>0,end:(D??2147495935)>>>0},{base:(x??0)>>>0,end:(T??65535)>>>0}];let k=-1;for(let B=0;B<5;B++)if(C>=O[B].base&&C<=O[B].end){k=B;break}const H=k>=0?C-O[k].base>>>0:0,$=[a,c,u,d,h].map(B=>(B??0)>>>0),q=k>=0?$[k]:0,F=!!n,Q=!!i;return{local_addr:H,write_data_out:R,funct3_out:A,read_data:q,p0_read:k===0&&F?1:0,p0_write:k===0&&Q?1:0,p1_read:k===1&&F?1:0,p1_write:k===1&&Q?1:0,p2_read:k===2&&F?1:0,p2_write:k===2&&Q?1:0,p3_read:k===3&&F?1:0,p3_write:k===3&&Q?1:0,p4_read:k===4&&F?1:0,p4_write:k===4&&Q?1:0}},meta:{category:"rv32i",icon:"BUS",description:"Memory bus multiplexer"}}),oM=vt("UART_TX",{inputs:{addr:Z(32),write_data:Z(32),mem_read:J,mem_write:J},outputs:{read_data:Z(32)},state:{text:""},eval:({mem_read:t})=>({read_data:t?1:0}),onTick:({addr:t,write_data:e,mem_write:n,text:i})=>{if(!n)return{text:i};if(t>>>0!==0)return{text:i};const a=String.fromCharCode(e&255),c=(i??"")+a;return{text:c.length>4096?c.slice(-4096):c}},meta:{category:"io",icon:"TX",description:"UART transmitter",synthesizable:!1}}),iM=vt("NIC_FIFO",{inputs:{tx_addr:Z(32),tx_write_data:Z(32),tx_mem_read:J,tx_mem_write:J,rx_addr:Z(32),rx_mem_read:J,rx_mem_write:J,net_rx_data:Z(32),net_rx_valid:J,net_rx_frame:J},outputs:{tx_read_data:Z(32),rx_read_data:Z(32),net_tx_data:Z(32),net_tx_valid:J,net_tx_frame:J},state:{memory:new Map},eval:({tx_mem_read:t,rx_mem_read:e,tx_addr:n,rx_addr:i,memory:s})=>{const a=s??new Map;let c=0;t&&(n??0)>>>0===8&&(c=(a.get(8192)??0)-(a.get(8193)??0));let u=0;if(e){const x=(i??0)>>>0;x===0?u=(a.get(4096+(a.get(8209)??0))??0)>>>0:x===8&&(u=a.get(8210)??0)}const d=a.get(8196)??0,h=a.get(8195)??0,p=a.get(8192)??0;let m=0,y=0,b=0;return d&&h<p&&(m=(a.get(0+h)??0)>>>0,y=1,b=h+1>=p?1:0),{tx_read_data:c,rx_read_data:u,net_tx_data:m,net_tx_valid:y,net_tx_frame:b}},onTick:({tx_addr:t,tx_write_data:e,tx_mem_write:n,rx_addr:i,rx_mem_write:s,net_rx_data:a,net_rx_valid:c,memory:u})=>{const d=u??new Map,h=new Map(d);if(n){const m=(t??0)>>>0,y=(e??0)>>>0;if(m===0){const b=h.get(8192)??0;h.set(0+b,y),h.set(8192,b+1)}else m===12&&(h.set(8194,1),h.set(8195,0),h.set(8196,1))}if(d.get(8196)??0){const m=h.get(8195)??0,y=h.get(8192)??0;m<y&&(h.set(8195,m+1),m+1>=y&&(h.set(8196,0),h.set(8192,0),h.set(8193,0),h.set(8194,0)))}if(c){const m=(a??0)>>>0,y=h.get(8208)??0;h.set(4096+y,m),h.set(8208,y+1),h.set(8210,(h.get(8210)??0)+1)}if(s&&(i??0)>>>0===4){const y=h.get(8209)??0,b=h.get(8210)??0;b>0&&(h.set(8209,y+1),h.set(8210,b-1))}return{memory:h}},meta:{category:"networking",icon:"NIC",description:"Network interface FIFO",synthesizable:!1}}),rM=Object.freeze(Object.defineProperty({__proto__:null,Eth_AddrClassifier:WA,Eth_CRC32:eM,Eth_FrameInput:JA,Eth_FrameParser:tM,Eth_ProtocolDecoder:QA,MemBusMux:nM,NIC_FIFO:iM,UART_TX:oM},Symbol.toStringTag,{value:"Module"})),ty=t=>!!t&&typeof t=="object"&&"circuit"in t,sM=[...Object.values(sA),...Object.values(bA),...Object.values(NA),...Object.values(MA),...Object.values(VA),...Object.values(LA),...Object.values(UA),...Object.values(XA),...Object.values(ZA),...Object.values(rM)],aM=t=>{if(ty(t))return t;if(typeof t=="function")try{const e=t();return ty(e)?e:null}catch{return null}return null},lM=Object.freeze(sM.map(aM).filter(t=>t!==null));function cM(t,e){const n=new Map;for(const i of e)n.set(i.name,ny(ey(i,new Map)));return ny(ey(t,n))}function ey(t,e){const n={};for(const a of t.inputs)n[a.name]=a;const i={};for(const a of t.outputs)i[a.name]=a;const s={};for(const a of t.nodes)s[a.id]=a;return{circuit:t,inputs:n,outputs:i,nodes:s,_dependencies:e}}function ny(t){return Object.defineProperty(t,"toJSON",{value:function(){const e={};for(const[n,i]of this._dependencies)e[n]=i;return{circuit:this.circuit,_dependencies:e}},enumerable:!1}),t}function uM(t,e,n){if(t.inputs.length===0&&t.outputs.length===0)return t;e.resolveCircuit(t.name)||e.addCircuit(t);const i=`${t.name}Demo`,s=[],a=[];let c=0;s.push({id:"dut",componentRef:t.name,arguments:{},inputs:t.inputs.map(u=>({id:`dut.${u.name}`,name:u.name,portType:u.portType})),outputs:t.outputs.map(u=>({id:`dut.${u.name}`,name:u.name,portType:u.portType})),clocks:t.clocks.map(u=>({id:`dut.${u.name}`,name:u.name}))});for(const u of t.inputs){const d=u.portType.kind==="bit",h={};!d&&u.portType.kind==="bus"&&(h.width=u.portType.width),n&&u.name in n&&(h.value=n[u.name]),s.push({id:u.name,label:u.name,componentRef:d?"Switch":"Input",arguments:h,inputs:[],outputs:[{id:`${u.name}.out`,name:"out",portType:u.portType}],clocks:[]}),a.push({id:`c${c++}`,source:{nodeId:u.name,portName:"out"},target:{nodeId:"dut",portName:u.name},portType:u.portType})}for(const u of t.outputs){const d=u.portType.kind==="bit",h={};!d&&u.portType.kind==="bus"&&(h.width=u.portType.width),s.push({id:u.name,label:u.name,componentRef:d?"Led":"HexDisplay",arguments:h,inputs:[{id:`${u.name}.in`,name:"in",portType:u.portType}],outputs:[],clocks:[]}),a.push({id:`c${c++}`,source:{nodeId:"dut",portName:u.name},target:{nodeId:u.name,portName:"in"},portType:u.portType})}return{version:1,name:i,inputs:[],outputs:[],clocks:[],state:[],nodes:s,connections:a,implementation:{kind:"composite"},metadata:{description:`Auto-generated harness for ${t.name}`}}}function vd(t,e,n=new Set){if(!t||n.has(t.name))return!1;if(n.add(t.name),t.clocks?.length>0||t.state?.length>0)return!0;for(const i of t.nodes){const s=e(i.componentRef);if(s&&vd(s,e,n))return!0}return!1}const oy=new Set(lM.map(t=>t.circuit.name));class ic extends Error{constructor(e){super(e),this.name="CircuitToSourceError"}}function fM(t){const e=new Map;for(const[s,a]of t._dependencies)oy.has(s)||e.set(s,a.circuit);for(const s of t.circuit.nodes)if(!oy.has(s.componentRef)&&!e.has(s.componentRef)){const a=t._dependencies.get(s.componentRef);a&&e.set(s.componentRef,a.circuit)}const n=[],i=dM(e);for(const s of i)n.push(iy(s)),n.push("");return n.push(iy(t.circuit)),n.join(`
12
+ `)}function dM(t){const e=new Set,n=[],i=s=>{if(e.has(s))return;e.add(s);const a=t.get(s);if(a){for(const c of a.nodes)t.has(c.componentRef)&&i(c.componentRef);n.push(a)}};for(const s of t.keys())i(s);return n}function iy(t){if(t.implementation.kind==="intrinsic")throw new ic(`Cannot serialize circuit '${t.name}': intrinsic implementations are not supported.`);if(t.implementation.kind==="primitive"&&nc(t.name))throw new ic(`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: ${pM(t.state,t.name)},`),t.nodes.length>0&&e.push(` nodes: ${yM(t.nodes)},`),t.connections.length>0&&e.push(` connect: ${bM(t)},`),`const ${t.name} = circuit('${t.name}', {
13
13
  ${e.join(`
14
14
  `)}
15
- });`}function I0(t){return`{ ${t.map(n=>`${n.name}: ${fM(n.portType)}`).join(", ")} }`}function fM(t){if(t.kind==="bit")return"bit";if(t.kind==="bus")return`bus(${t.width})`;throw new jl(`Unsupported port type kind: ${t.kind}`)}function dM(t,e){return`{ ${t.map(i=>{if(i.stateType.kind==="bit")return`${i.name}: ${B0(i.initialValue)}`;if(i.stateType.kind==="bus"){const s=i.initialValue;return s===0?`${i.name}: reg(${i.stateType.width})`:`${i.name}: reg(${i.stateType.width}, ${s})`}if(i.stateType.kind==="memory"){const s=i.initialValue,l=1<<i.stateType.addressWidth,c=s.data.size>0?`, ${hM(s.data)}`:"";return`${i.name}: mem(${l}, ${i.stateType.dataWidth}${c})`}throw new jl(`Cannot serialize state '${i.name}' on circuit '${e}': unsupported state type.`)}).join(", ")} }`}function hM(t){return`new Map([${[...t.entries()].sort((n,i)=>n[0]-i[0]).map(([n,i])=>`[${n}, ${i}]`).join(", ")}])`}const pM=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 mM(t){return`{ ${t.map(n=>n.arguments&&Object.keys(n.arguments).length>0?`${n.id}: ${n.componentRef}(${gM(n.arguments)})`:pM.has(n.componentRef)?`${n.id}: ${n.componentRef}()`:`${n.id}: ${n.componentRef}`).join(", ")} }`}function gM(t){return`{ ${Object.entries(t).map(([n,i])=>`${n}: ${B0(i)}`).join(", ")} }`}function B0(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,i])=>`${n}: ${i}`).join(", ")} }`}function yM(t){const e=new Map;for(const i of t.connections){const s=`${i.source.nodeId}|${i.source.portName}`,l=e.get(s);l?l.targets.push(i.target):e.set(s,{source:i.source,targets:[i.target]})}const n=[];for(const{source:i,targets:s}of e.values()){const l=P0(i,"source"),c=s.map(u=>P0(u,"target")).join(", ");n.push(` ${l}.to(${c}),`)}return`({ inputs, outputs, nodes }) => [
15
+ });`}function ry(t){return`{ ${t.map(n=>`${n.name}: ${hM(n.portType)}`).join(", ")} }`}function hM(t){if(t.kind==="bit")return"bit";if(t.kind==="bus")return`bus(${t.width})`;throw new ic(`Unsupported port type kind: ${t.kind}`)}function pM(t,e){return`{ ${t.map(i=>{if(i.stateType.kind==="bit")return`${i.name}: ${sy(i.initialValue)}`;if(i.stateType.kind==="bus"){const s=i.initialValue;return s===0?`${i.name}: reg(${i.stateType.width})`:`${i.name}: reg(${i.stateType.width}, ${s})`}if(i.stateType.kind==="memory"){const s=i.initialValue,a=1<<i.stateType.addressWidth,c=s.data.size>0?`, ${mM(s.data)}`:"";return`${i.name}: mem(${a}, ${i.stateType.dataWidth}${c})`}throw new ic(`Cannot serialize state '${i.name}' on circuit '${e}': unsupported state type.`)}).join(", ")} }`}function mM(t){return`new Map([${[...t.entries()].sort((n,i)=>n[0]-i[0]).map(([n,i])=>`[${n}, ${i}]`).join(", ")}])`}const gM=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 yM(t){return`{ ${t.map(n=>n.arguments&&Object.keys(n.arguments).length>0?`${n.id}: ${n.componentRef}(${vM(n.arguments)})`:gM.has(n.componentRef)?`${n.id}: ${n.componentRef}()`:`${n.id}: ${n.componentRef}`).join(", ")} }`}function vM(t){return`{ ${Object.entries(t).map(([n,i])=>`${n}: ${sy(i)}`).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,i])=>`${n}: ${i}`).join(", ")} }`}function bM(t){const e=new Map;for(const i of t.connections){const s=`${i.source.nodeId}|${i.source.portName}`,a=e.get(s);a?a.targets.push(i.target):e.set(s,{source:i.source,targets:[i.target]})}const n=[];for(const{source:i,targets:s}of e.values()){const a=ay(i,"source"),c=s.map(u=>ay(u,"target")).join(", ");n.push(` ${a}.to(${c}),`)}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&&gt.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 xM="__top__";function wM(t){const e={},n=new Set;function i(s){const a=s.circuit.name;if(n.has(a))return;n.add(a);const c=nc(a);c&&(e[a]={evalSource:c.evalFn.toString(),onTickSource:c.onTickFn?.toString(),inputNames:c.inputNames,outputNames:c.outputNames,stateKeys:c.stateKeys});for(const[,u]of s._dependencies)u&&i(u)}return i(t),e}function SM(t,e){const n=sd(),i=N.useMemo(()=>`embed-${typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2)}`,[]),{rawCircuit:s,componentLibrary:a}=N.useMemo(()=>{const pt=new Map,gt={resolveCircuit:yt=>pt.get(yt),getAllPrimitiveNames:()=>[...pt.entries()].filter(([,yt])=>yt.implementation.kind==="primitive").map(([yt])=>yt),addCircuit:yt=>{pt.set(yt.name,yt)}};for(const yt of[cd(),ud(),fd,dd(),hd,pd])gt.addCircuit(yt.circuit);if(t&&(gt.addCircuit(t.circuit),t._dependencies))for(const[,yt]of t._dependencies)yt?.circuit&&gt.addCircuit(yt.circuit);return{rawCircuit:t?.circuit??null,componentLibrary:gt}},[t]),c=N.useMemo(()=>s?e?.autoHarness?uM(s,a,e.initialInputs):s:null,[s,a,e?.autoHarness,e?.initialInputs]),u=N.useMemo(()=>vd(c,a.resolveCircuit),[c,a]),[d,h]=N.useState(new Map),[p,m]=N.useState({}),[y,b]=N.useState(0),[x,w]=N.useState(!1),[S,E]=N.useState(!1),[D,T]=N.useState(5),C=N.useRef(null),R=N.useRef([]),[A,O]=N.useState(-1),[k,H]=N.useState(0),$=200,q=N.useMemo(()=>{const pt={};if(!c)return pt;for(const gt of c.inputs)pt[gt.name]=gt.portType.kind==="bit"?!1:0;return pt},[c]),[F,Q]=N.useState({}),[B,P]=N.useState(q),j=N.useRef(B);N.useEffect(()=>{j.current=B},[B]),N.useEffect(()=>{if(!t||!c){w(!1),h(new Map);return}let pt=!1;async function gt(){if(!t||!c)return;const yt=wM(t),mt=[],Et=new Set,Vt=Xt=>{Et.has(Xt.name)||(Et.add(Xt.name),mt.push(Xt))};Vt(t.circuit);for(const[,Xt]of t._dependencies)Xt?.circuit&&Vt(Xt.circuit);for(const Xt of[cd(),ud(),fd,dd(),hd,pd])Vt(Xt.circuit);const jt=a.getAllPrimitiveNames();for(const Xt of jt){const xe=a.resolveCircuit(Xt);xe&&Vt(xe)}const zt=await n.compileIR(c,mt,i,{evalSources:yt,snapshot:u});if(pt)return;if("error"in zt){console.error("[useCircuitSimulator] compileIR failed:",zt.error),w(!1);return}const ue=new Map;for(const[Xt,xe]of Object.entries(zt.portValues))ue.set(Xt,xe);h(ue),zt.peripheralState&&m(zt.peripheralState),b(0),R.current=zt.snapshotId!==void 0?[{snapshotId:zt.snapshotId,cycle:0,inputs:{...q}}]:[],O(zt.snapshotId!==void 0?0:-1),H(R.current.length),w(!0)}return gt(),()=>{pt=!0,n.dispose(i).catch(()=>{})}},[t,c,a,n,i,u]),N.useEffect(()=>{P(q)},[q]),N.useEffect(()=>{if(!x||d.size===0||!c)return;const pt={};for(const gt of c.outputs){const yt=`${xM}.${gt.name}`,mt=d.get(yt);mt!==void 0&&(pt[gt.name]=typeof mt=="number"?mt:!!mt)}Q(pt)},[x,d,c]);const I=N.useCallback((pt,gt,yt)=>{if(pt===void 0)return;const mt=R.current,Et=z.current;if(Et>=0&&Et<mt.length-1&&(mt.length=Et+1),mt.push({snapshotId:pt,cycle:gt,inputs:{...yt}}),mt.length>$){const Vt=mt.length-$,jt=mt[Vt-1].snapshotId;mt.splice(0,Vt),n.pruneSnapshots(jt,i).catch(()=>{})}z.current=mt.length-1,O(mt.length-1),H(mt.length)},[n,i]),z=N.useRef(-1);N.useEffect(()=>{z.current=A},[A]);const U=N.useCallback(async(pt,gt)=>{const yt={...j.current,[pt]:gt};if(j.current=yt,P(yt),!x)return;const mt=await n.setNode(pt,gt,i);if("error"in mt)return;const Et=new Map;for(const[Vt,jt]of Object.entries(mt.portValues))Et.set(Vt,jt);h(Et),mt.peripheralState&&m(mt.peripheralState)},[x,n,i]),Y=N.useCallback(pt=>{const gt=B[pt];U(pt,typeof gt=="boolean"?!gt:gt===0?1:0)},[B,U]),L=N.useCallback(async pt=>{if(!x)return;const gt=`${pt}.out`,yt=d.get(gt),mt=typeof yt=="boolean"?!yt:yt===1?0:1,Et=await n.setNode(pt,mt,i);if("error"in Et)return;const Vt=new Map;for(const[jt,zt]of Object.entries(Et.portValues))Vt.set(jt,zt);h(Vt),Et.peripheralState&&m(Et.peripheralState)},[x,d,n,i]),G=N.useCallback(async(pt,gt)=>{if(!x)return null;const yt=await n.setNode(pt,gt,i);if("error"in yt)return null;const mt=new Map;for(const[Et,Vt]of Object.entries(yt.portValues))mt.set(Et,Vt);return h(mt),yt.peripheralState&&m(yt.peripheralState),mt},[x,n,i]),tt=N.useCallback(async()=>{if(!x)return;const pt=await n.tick(void 0,i,{snapshot:u});if("error"in pt)return;const gt=new Map;for(const[yt,mt]of Object.entries(pt.portValues))gt.set(yt,mt);h(gt),b(pt.cycle),pt.peripheralState&&m(pt.peripheralState),I(pt.snapshotId,pt.cycle,j.current)},[x,n,i,u,I]),it=N.useCallback(async pt=>{if(!x||pt<=0)return;const gt=await n.tickN(pt,void 0,i,{snapshot:u});if("error"in gt)return;const yt=new Map;for(const[mt,Et]of Object.entries(gt.portValues))yt.set(mt,Et);h(yt),b(gt.cycle),gt.peripheralState&&m(gt.peripheralState),I(gt.snapshotId,gt.cycle,j.current)},[x,n,i,u,I]),lt=N.useCallback(async(pt,gt,yt)=>{if(!x||yt<=0)return null;const mt=await n.scanPort(pt,gt,yt,i);return"error"in mt?null:mt.values},[x,n,i]),ht=N.useCallback(async()=>{const pt=await n.reset(i);if("error"in pt)return;const gt=new Map;for(const[yt,mt]of Object.entries(pt.portValues))gt.set(yt,mt);if(h(gt),b(0),P(q),pt.peripheralState?m(pt.peripheralState):m({}),R.current=[],u){const yt=await n.snapshot(i);!("error"in yt)&&yt.snapshotId!==void 0&&(R.current=[{snapshotId:yt.snapshotId,cycle:0,inputs:{...q}}])}z.current=R.current.length>0?0:-1,O(R.current.length>0?0:-1),H(R.current.length)},[n,i,q,u]),ft=N.useCallback(async(pt,gt)=>{const yt=await n.restore(pt.snapshotId,i);if("error"in yt)return;const mt=new Map;for(const[Vt,jt]of Object.entries(yt.portValues))mt.set(Vt,jt);h(mt),b(yt.cycle),yt.peripheralState?m(yt.peripheralState):m({});const Et={...pt.inputs};j.current=Et,P(Et),z.current=gt,O(gt)},[n,i]),ut=N.useCallback(async()=>{if(!x)return;const pt=R.current,gt=z.current;gt<=0||await ft(pt[gt-1],gt-1)},[x,ft]),dt=N.useCallback(async()=>{if(!x)return;const pt=R.current,gt=z.current;gt>=pt.length-1||await ft(pt[gt+1],gt+1)},[x,ft]),Mt=N.useCallback(async pt=>{if(!x)return;const gt=R.current;pt<0||pt>=gt.length||await ft(gt[pt],pt)},[x,ft]),Nt=N.useRef(tt);N.useEffect(()=>{Nt.current=tt},[tt]);const bt=N.useCallback((pt,gt)=>{C.current&&clearInterval(C.current),T(pt),E(!0);const yt=Math.max(1,Math.floor(1e3/pt));C.current=setInterval(()=>{Nt.current()},yt)},[]),Tt=N.useCallback(()=>{C.current&&(clearInterval(C.current),C.current=null),E(!1)},[]),Dt=N.useCallback(pt=>{if(T(pt),C.current){clearInterval(C.current);const gt=Math.max(1,Math.floor(1e3/pt));C.current=setInterval(()=>{Nt.current()},gt)}},[]);N.useEffect(()=>()=>{C.current&&clearInterval(C.current)},[]);const qt=N.useMemo(()=>{const pt=Object.entries(p);if(pt.length===0)return null;const gt=new Map;for(const[yt,mt]of pt)gt.set(yt,mt);return{currentState:gt,nextState:new Map,clocks:new Map,cycleCount:y}},[p,y]),Ht=N.useMemo(()=>R.current.slice(0,k).map(pt=>({engineSnapshot:pt.snapshotId,metadata:pt.cycle})),[k]);return{outputs:F,inputs:B,cycleCount:y,ready:x,error:null,isSequential:u,circuit:c,portValues:d.size>0?d:null,sequentialState:qt,componentLibrary:a,history:Ht,historyIndex:A,isViewingPast:A>=0&&A<k-1,isRunning:S,speed:D,setNode:U,toggleInput:Y,toggleNode:L,setNodeValue:G,tick:tt,tickN:it,scanPort:lt,reset:ht,stepBack:ut,stepForward:dt,seek:Mt,startAutoRun:bt,stopAutoRun:Tt,setSpeed:Dt,runCombinational:()=>{},getSimulator:()=>null}}function _e(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,i;n<t.length;n++)(i=_e(t[n]))!==""&&(e+=(e&&" ")+i);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var EM={value:()=>{}};function rc(){for(var t=0,e=arguments.length,n={},i;t<e;++t){if(!(i=arguments[t]+"")||i in n||/[\s.]/.test(i))throw new Error("illegal type: "+i);n[i]=[]}return new sc(n)}function sc(t){this._=t}function CM(t,e){return t.trim().split(/^|\s+/).map(function(n){var i="",s=n.indexOf(".");if(s>=0&&(i=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:i}})}sc.prototype=rc.prototype={constructor:sc,on:function(t,e){var n=this._,i=CM(t+"",n),s,a=-1,c=i.length;if(arguments.length<2){for(;++a<c;)if((s=(t=i[a]).type)&&(s=TM(n[s],t.name)))return s;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++a<c;)if(s=(t=i[a]).type)n[s]=ly(n[s],t.name,e);else if(e==null)for(s in n)n[s]=ly(n[s],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new sc(t)},call:function(t,e){if((s=arguments.length-2)>0)for(var n=new Array(s),i=0,s,a;i<s;++i)n[i]=arguments[i+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=this._[t],i=0,s=a.length;i<s;++i)a[i].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],s=0,a=i.length;s<a;++s)i[s].value.apply(e,n)}};function TM(t,e){for(var n=0,i=t.length,s;n<i;++n)if((s=t[n]).name===e)return s.value}function ly(t,e,n){for(var i=0,s=t.length;i<s;++i)if(t[i].name===e){t[i]=EM,t=t.slice(0,i).concat(t.slice(i+1));break}return n!=null&&t.push({name:e,value:n}),t}var bd="http://www.w3.org/1999/xhtml";const cy={svg:"http://www.w3.org/2000/svg",xhtml:bd,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function ac(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),cy.hasOwnProperty(e)?{space:cy[e],local:t}:t}function _M(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===bd&&e.documentElement.namespaceURI===bd?e.createElement(t):e.createElementNS(n,t)}}function NM(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function uy(t){var e=ac(t);return(e.local?NM:_M)(e)}function AM(){}function xd(t){return t==null?AM:function(){return this.querySelector(t)}}function MM(t){typeof t!="function"&&(t=xd(t));for(var e=this._groups,n=e.length,i=new Array(n),s=0;s<n;++s)for(var a=e[s],c=a.length,u=i[s]=new Array(c),d,h,p=0;p<c;++p)(d=a[p])&&(h=t.call(d,d.__data__,p,a))&&("__data__"in d&&(h.__data__=d.__data__),u[p]=h);return new fn(i,this._parents)}function RM(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function kM(){return[]}function fy(t){return t==null?kM:function(){return this.querySelectorAll(t)}}function OM(t){return function(){return RM(t.apply(this,arguments))}}function DM(t){typeof t=="function"?t=OM(t):t=fy(t);for(var e=this._groups,n=e.length,i=[],s=[],a=0;a<n;++a)for(var c=e[a],u=c.length,d,h=0;h<u;++h)(d=c[h])&&(i.push(t.call(d,d.__data__,h,c)),s.push(d));return new fn(i,s)}function dy(t){return function(){return this.matches(t)}}function hy(t){return function(e){return e.matches(t)}}var jM=Array.prototype.find;function zM(t){return function(){return jM.call(this.children,t)}}function VM(){return this.firstElementChild}function LM(t){return this.select(t==null?VM:zM(typeof t=="function"?t:hy(t)))}var IM=Array.prototype.filter;function BM(){return Array.from(this.children)}function PM(t){return function(){return IM.call(this.children,t)}}function HM(t){return this.selectAll(t==null?BM:PM(typeof t=="function"?t:hy(t)))}function UM(t){typeof t!="function"&&(t=dy(t));for(var e=this._groups,n=e.length,i=new Array(n),s=0;s<n;++s)for(var a=e[s],c=a.length,u=i[s]=[],d,h=0;h<c;++h)(d=a[h])&&t.call(d,d.__data__,h,a)&&u.push(d);return new fn(i,this._parents)}function py(t){return new Array(t.length)}function $M(){return new fn(this._enter||this._groups.map(py),this._parents)}function lc(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}lc.prototype={constructor:lc,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function qM(t){return function(){return t}}function YM(t,e,n,i,s,a){for(var c=0,u,d=e.length,h=a.length;c<h;++c)(u=e[c])?(u.__data__=a[c],i[c]=u):n[c]=new lc(t,a[c]);for(;c<d;++c)(u=e[c])&&(s[c]=u)}function GM(t,e,n,i,s,a,c){var u,d,h=new Map,p=e.length,m=a.length,y=new Array(p),b;for(u=0;u<p;++u)(d=e[u])&&(y[u]=b=c.call(d,d.__data__,u,e)+"",h.has(b)?s[u]=d:h.set(b,d));for(u=0;u<m;++u)b=c.call(t,a[u],u,a)+"",(d=h.get(b))?(i[u]=d,d.__data__=a[u],h.delete(b)):n[u]=new lc(t,a[u]);for(u=0;u<p;++u)(d=e[u])&&h.get(y[u])===d&&(s[u]=d)}function XM(t){return t.__data__}function FM(t,e){if(!arguments.length)return Array.from(this,XM);var n=e?GM:YM,i=this._parents,s=this._groups;typeof t!="function"&&(t=qM(t));for(var a=s.length,c=new Array(a),u=new Array(a),d=new Array(a),h=0;h<a;++h){var p=i[h],m=s[h],y=m.length,b=ZM(t.call(p,p&&p.__data__,h,i)),x=b.length,w=u[h]=new Array(x),S=c[h]=new Array(x),E=d[h]=new Array(y);n(p,m,w,S,E,b,e);for(var D=0,T=0,C,R;D<x;++D)if(C=w[D]){for(D>=T&&(T=D+1);!(R=S[T])&&++T<x;);C._next=R||null}}return c=new fn(c,i),c._enter=u,c._exit=d,c}function ZM(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function KM(){return new fn(this._exit||this._groups.map(py),this._parents)}function QM(t,e,n){var i=this.enter(),s=this,a=this.exit();return typeof t=="function"?(i=t(i),i&&(i=i.selection())):i=i.append(t+""),e!=null&&(s=e(s),s&&(s=s.selection())),n==null?a.remove():n(a),i&&s?i.merge(s).order():s}function WM(t){for(var e=t.selection?t.selection():t,n=this._groups,i=e._groups,s=n.length,a=i.length,c=Math.min(s,a),u=new Array(s),d=0;d<c;++d)for(var h=n[d],p=i[d],m=h.length,y=u[d]=new Array(m),b,x=0;x<m;++x)(b=h[x]||p[x])&&(y[x]=b);for(;d<s;++d)u[d]=n[d];return new fn(u,this._parents)}function JM(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i=t[e],s=i.length-1,a=i[s],c;--s>=0;)(c=i[s])&&(a&&c.compareDocumentPosition(a)^4&&a.parentNode.insertBefore(c,a),a=c);return this}function tR(t){t||(t=eR);function e(m,y){return m&&y?t(m.__data__,y.__data__):!m-!y}for(var n=this._groups,i=n.length,s=new Array(i),a=0;a<i;++a){for(var c=n[a],u=c.length,d=s[a]=new Array(u),h,p=0;p<u;++p)(h=c[p])&&(d[p]=h);d.sort(e)}return new fn(s,this._parents).order()}function eR(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function nR(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function oR(){return Array.from(this)}function iR(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],s=0,a=i.length;s<a;++s){var c=i[s];if(c)return c}return null}function rR(){let t=0;for(const e of this)++t;return t}function sR(){return!this.node()}function aR(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var s=e[n],a=0,c=s.length,u;a<c;++a)(u=s[a])&&t.call(u,u.__data__,a,s);return this}function lR(t){return function(){this.removeAttribute(t)}}function cR(t){return function(){this.removeAttributeNS(t.space,t.local)}}function uR(t,e){return function(){this.setAttribute(t,e)}}function fR(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function dR(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function hR(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function pR(t,e){var n=ac(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((e==null?n.local?cR:lR:typeof e=="function"?n.local?hR:dR:n.local?fR:uR)(n,e))}function my(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function mR(t){return function(){this.style.removeProperty(t)}}function gR(t,e,n){return function(){this.style.setProperty(t,e,n)}}function yR(t,e,n){return function(){var i=e.apply(this,arguments);i==null?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}function vR(t,e,n){return arguments.length>1?this.each((e==null?mR:typeof e=="function"?yR:gR)(t,e,n??"")):ts(this.node(),t)}function ts(t,e){return t.style.getPropertyValue(e)||my(t).getComputedStyle(t,null).getPropertyValue(e)}function bR(t){return function(){delete this[t]}}function xR(t,e){return function(){this[t]=e}}function wR(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function SR(t,e){return arguments.length>1?this.each((e==null?bR:typeof e=="function"?wR:xR)(t,e)):this.node()[t]}function gy(t){return t.trim().split(/^|\s+/)}function wd(t){return t.classList||new yy(t)}function yy(t){this._node=t,this._names=gy(t.getAttribute("class")||"")}yy.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function vy(t,e){for(var n=wd(t),i=-1,s=e.length;++i<s;)n.add(e[i])}function by(t,e){for(var n=wd(t),i=-1,s=e.length;++i<s;)n.remove(e[i])}function ER(t){return function(){vy(this,t)}}function CR(t){return function(){by(this,t)}}function TR(t,e){return function(){(e.apply(this,arguments)?vy:by)(this,t)}}function _R(t,e){var n=gy(t+"");if(arguments.length<2){for(var i=wd(this.node()),s=-1,a=n.length;++s<a;)if(!i.contains(n[s]))return!1;return!0}return this.each((typeof e=="function"?TR:e?ER:CR)(n,e))}function NR(){this.textContent=""}function AR(t){return function(){this.textContent=t}}function MR(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function RR(t){return arguments.length?this.each(t==null?NR:(typeof t=="function"?MR:AR)(t)):this.node().textContent}function kR(){this.innerHTML=""}function OR(t){return function(){this.innerHTML=t}}function DR(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function jR(t){return arguments.length?this.each(t==null?kR:(typeof t=="function"?DR:OR)(t)):this.node().innerHTML}function zR(){this.nextSibling&&this.parentNode.appendChild(this)}function VR(){return this.each(zR)}function LR(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function IR(){return this.each(LR)}function BR(t){var e=typeof t=="function"?t:uy(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function PR(){return null}function HR(t,e){var n=typeof t=="function"?t:uy(t),i=e==null?PR:typeof e=="function"?e:xd(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})}function UR(){var t=this.parentNode;t&&t.removeChild(this)}function $R(){return this.each(UR)}function qR(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function YR(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function GR(t){return this.select(t?YR:qR)}function XR(t){return arguments.length?this.property("__data__",t):this.node().__data__}function FR(t){return function(e){t.call(this,e,this.__data__)}}function ZR(t){return t.trim().split(/^|\s+/).map(function(e){var n="",i=e.indexOf(".");return i>=0&&(n=e.slice(i+1),e=e.slice(0,i)),{type:e,name:n}})}function KR(t){return function(){var e=this.__on;if(e){for(var n=0,i=-1,s=e.length,a;n<s;++n)a=e[n],(!t.type||a.type===t.type)&&a.name===t.name?this.removeEventListener(a.type,a.listener,a.options):e[++i]=a;++i?e.length=i:delete this.__on}}}function QR(t,e,n){return function(){var i=this.__on,s,a=FR(e);if(i){for(var c=0,u=i.length;c<u;++c)if((s=i[c]).type===t.type&&s.name===t.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=a,s.options=n),s.value=e;return}}this.addEventListener(t.type,a,n),s={type:t.type,name:t.name,value:e,listener:a,options:n},i?i.push(s):this.__on=[s]}}function WR(t,e,n){var i=ZR(t+""),s,a=i.length,c;if(arguments.length<2){var u=this.node().__on;if(u){for(var d=0,h=u.length,p;d<h;++d)for(s=0,p=u[d];s<a;++s)if((c=i[s]).type===p.type&&c.name===p.name)return p.value}return}for(u=e?QR:KR,s=0;s<a;++s)this.each(u(i[s],e,n));return this}function xy(t,e,n){var i=my(t),s=i.CustomEvent;typeof s=="function"?s=new s(e,n):(s=i.document.createEvent("Event"),n?(s.initEvent(e,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(e,!1,!1)),t.dispatchEvent(s)}function JR(t,e){return function(){return xy(this,t,e)}}function t3(t,e){return function(){return xy(this,t,e.apply(this,arguments))}}function e3(t,e){return this.each((typeof e=="function"?t3:JR)(t,e))}function*n3(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],s=0,a=i.length,c;s<a;++s)(c=i[s])&&(yield c)}var wy=[null];function fn(t,e){this._groups=t,this._parents=e}function ga(){return new fn([[document.documentElement]],wy)}function o3(){return this}fn.prototype=ga.prototype={constructor:fn,select:MM,selectAll:DM,selectChild:LM,selectChildren:HM,filter:UM,data:FM,enter:$M,exit:KM,join:QM,merge:WM,selection:o3,order:JM,sort:tR,call:nR,nodes:oR,node:iR,size:rR,empty:sR,each:aR,attr:pR,style:vR,property:SR,classed:_R,text:RR,html:jR,raise:VR,lower:IR,append:BR,insert:HR,remove:$R,clone:GR,datum:XR,on:WR,dispatch:e3,[Symbol.iterator]:n3};function dn(t){return typeof t=="string"?new fn([[document.querySelector(t)]],[document.documentElement]):new fn([[t]],wy)}function i3(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Hn(t,e){if(t=i3(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=t.clientX,i.y=t.clientY,i=i.matrixTransform(e.getScreenCTM().inverse()),[i.x,i.y]}if(e.getBoundingClientRect){var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}}return[t.pageX,t.pageY]}const r3={passive:!1},ya={capture:!0,passive:!1};function Sd(t){t.stopImmediatePropagation()}function es(t){t.preventDefault(),t.stopImmediatePropagation()}function Sy(t){var e=t.document.documentElement,n=dn(t).on("dragstart.drag",es,ya);"onselectstart"in e?n.on("selectstart.drag",es,ya):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function Ey(t,e){var n=t.document.documentElement,i=dn(t).on("dragstart.drag",null);e&&(i.on("click.drag",es,ya),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const cc=t=>()=>t;function Ed(t,{sourceEvent:e,subject:n,target:i,identifier:s,active:a,x:c,y:u,dx:d,dy:h,dispatch:p}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:a,enumerable:!0,configurable:!0},x:{value:c,enumerable:!0,configurable:!0},y:{value:u,enumerable:!0,configurable:!0},dx:{value:d,enumerable:!0,configurable:!0},dy:{value:h,enumerable:!0,configurable:!0},_:{value:p}})}Ed.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function s3(t){return!t.ctrlKey&&!t.button}function a3(){return this.parentNode}function l3(t,e){return e??{x:t.x,y:t.y}}function c3(){return navigator.maxTouchPoints||"ontouchstart"in this}function Cy(){var t=s3,e=a3,n=l3,i=c3,s={},a=rc("start","drag","end"),c=0,u,d,h,p,m=0;function y(C){C.on("mousedown.drag",b).filter(i).on("touchstart.drag",S).on("touchmove.drag",E,r3).on("touchend.drag touchcancel.drag",D).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function b(C,R){if(!(p||!t.call(this,C,R))){var A=T(this,e.call(this,C,R),C,R,"mouse");A&&(dn(C.view).on("mousemove.drag",x,ya).on("mouseup.drag",w,ya),Sy(C.view),Sd(C),h=!1,u=C.clientX,d=C.clientY,A("start",C))}}function x(C){if(es(C),!h){var R=C.clientX-u,A=C.clientY-d;h=R*R+A*A>m}s.mouse("drag",C)}function w(C){dn(C.view).on("mousemove.drag mouseup.drag",null),Ey(C.view,h),es(C),s.mouse("end",C)}function S(C,R){if(t.call(this,C,R)){var A=C.changedTouches,O=e.call(this,C,R),k=A.length,H,$;for(H=0;H<k;++H)($=T(this,O,C,R,A[H].identifier,A[H]))&&(Sd(C),$("start",C,A[H]))}}function E(C){var R=C.changedTouches,A=R.length,O,k;for(O=0;O<A;++O)(k=s[R[O].identifier])&&(es(C),k("drag",C,R[O]))}function D(C){var R=C.changedTouches,A=R.length,O,k;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),O=0;O<A;++O)(k=s[R[O].identifier])&&(Sd(C),k("end",C,R[O]))}function T(C,R,A,O,k,H){var $=a.copy(),q=Hn(H||A,R),F,Q,B;if((B=n.call(C,new Ed("beforestart",{sourceEvent:A,target:y,identifier:k,active:c,x:q[0],y:q[1],dx:0,dy:0,dispatch:$}),O))!=null)return F=B.x-q[0]||0,Q=B.y-q[1]||0,function P(j,I,z){var U=q,Y;switch(j){case"start":s[k]=P,Y=c++;break;case"end":delete s[k],--c;case"drag":q=Hn(z||I,R),Y=c;break}$.call(j,C,new Ed(j,{sourceEvent:I,subject:B,target:y,identifier:k,active:Y,x:q[0]+F,y:q[1]+Q,dx:q[0]-U[0],dy:q[1]-U[1],dispatch:$}),O)}}return y.filter=function(C){return arguments.length?(t=typeof C=="function"?C:cc(!!C),y):t},y.container=function(C){return arguments.length?(e=typeof C=="function"?C:cc(C),y):e},y.subject=function(C){return arguments.length?(n=typeof C=="function"?C:cc(C),y):n},y.touchable=function(C){return arguments.length?(i=typeof C=="function"?C:cc(!!C),y):i},y.on=function(){var C=a.on.apply(a,arguments);return C===a?y:C},y.clickDistance=function(C){return arguments.length?(m=(C=+C)*C,y):Math.sqrt(m)},y}function Cd(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function Ty(t,e){var n=Object.create(t.prototype);for(var i in e)n[i]=e[i];return n}function va(){}var ba=.7,uc=1/ba,ns="\\s*([+-]?\\d+)\\s*",xa="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",co="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",u3=/^#([0-9a-f]{3,8})$/,f3=new RegExp(`^rgb\\(${ns},${ns},${ns}\\)$`),d3=new RegExp(`^rgb\\(${co},${co},${co}\\)$`),h3=new RegExp(`^rgba\\(${ns},${ns},${ns},${xa}\\)$`),p3=new RegExp(`^rgba\\(${co},${co},${co},${xa}\\)$`),m3=new RegExp(`^hsl\\(${xa},${co},${co}\\)$`),g3=new RegExp(`^hsla\\(${xa},${co},${co},${xa}\\)$`),_y={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};Cd(va,gr,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:Ny,formatHex:Ny,formatHex8:y3,formatHsl:v3,formatRgb:Ay,toString:Ay});function Ny(){return this.rgb().formatHex()}function y3(){return this.rgb().formatHex8()}function v3(){return Dy(this).formatHsl()}function Ay(){return this.rgb().formatRgb()}function gr(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=u3.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?My(e):n===3?new We(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?fc(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?fc(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=f3.exec(t))?new We(e[1],e[2],e[3],1):(e=d3.exec(t))?new We(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=h3.exec(t))?fc(e[1],e[2],e[3],e[4]):(e=p3.exec(t))?fc(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=m3.exec(t))?Oy(e[1],e[2]/100,e[3]/100,1):(e=g3.exec(t))?Oy(e[1],e[2]/100,e[3]/100,e[4]):_y.hasOwnProperty(t)?My(_y[t]):t==="transparent"?new We(NaN,NaN,NaN,0):null}function My(t){return new We(t>>16&255,t>>8&255,t&255,1)}function fc(t,e,n,i){return i<=0&&(t=e=n=NaN),new We(t,e,n,i)}function b3(t){return t instanceof va||(t=gr(t)),t?(t=t.rgb(),new We(t.r,t.g,t.b,t.opacity)):new We}function Td(t,e,n,i){return arguments.length===1?b3(t):new We(t,e,n,i??1)}function We(t,e,n,i){this.r=+t,this.g=+e,this.b=+n,this.opacity=+i}Cd(We,Td,Ty(va,{brighter(t){return t=t==null?uc:Math.pow(uc,t),new We(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?ba:Math.pow(ba,t),new We(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new We(yr(this.r),yr(this.g),yr(this.b),dc(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:Ry,formatHex:Ry,formatHex8:x3,formatRgb:ky,toString:ky}));function Ry(){return`#${vr(this.r)}${vr(this.g)}${vr(this.b)}`}function x3(){return`#${vr(this.r)}${vr(this.g)}${vr(this.b)}${vr((isNaN(this.opacity)?1:this.opacity)*255)}`}function ky(){const t=dc(this.opacity);return`${t===1?"rgb(":"rgba("}${yr(this.r)}, ${yr(this.g)}, ${yr(this.b)}${t===1?")":`, ${t})`}`}function dc(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function yr(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function vr(t){return t=yr(t),(t<16?"0":"")+t.toString(16)}function Oy(t,e,n,i){return i<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new Un(t,e,n,i)}function Dy(t){if(t instanceof Un)return new Un(t.h,t.s,t.l,t.opacity);if(t instanceof va||(t=gr(t)),!t)return new Un;if(t instanceof Un)return t;t=t.rgb();var e=t.r/255,n=t.g/255,i=t.b/255,s=Math.min(e,n,i),a=Math.max(e,n,i),c=NaN,u=a-s,d=(a+s)/2;return u?(e===a?c=(n-i)/u+(n<i)*6:n===a?c=(i-e)/u+2:c=(e-n)/u+4,u/=d<.5?a+s:2-a-s,c*=60):u=d>0&&d<1?0:c,new Un(c,u,d,t.opacity)}function w3(t,e,n,i){return arguments.length===1?Dy(t):new Un(t,e,n,i??1)}function Un(t,e,n,i){this.h=+t,this.s=+e,this.l=+n,this.opacity=+i}Cd(Un,w3,Ty(va,{brighter(t){return t=t==null?uc:Math.pow(uc,t),new Un(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?ba:Math.pow(ba,t),new Un(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,i=n+(n<.5?n:1-n)*e,s=2*n-i;return new We(_d(t>=240?t-240:t+120,s,i),_d(t,s,i),_d(t<120?t+240:t-120,s,i),this.opacity)},clamp(){return new Un(jy(this.h),hc(this.s),hc(this.l),dc(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=dc(this.opacity);return`${t===1?"hsl(":"hsla("}${jy(this.h)}, ${hc(this.s)*100}%, ${hc(this.l)*100}%${t===1?")":`, ${t})`}`}}));function jy(t){return t=(t||0)%360,t<0?t+360:t}function hc(t){return Math.max(0,Math.min(1,t||0))}function _d(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Nd=t=>()=>t;function S3(t,e){return function(n){return t+n*e}}function E3(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(i){return Math.pow(t+i*e,n)}}function C3(t){return(t=+t)==1?zy:function(e,n){return n-e?E3(e,n,t):Nd(isNaN(e)?n:e)}}function zy(t,e){var n=e-t;return n?S3(t,n):Nd(isNaN(t)?e:t)}const pc=(function t(e){var n=C3(e);function i(s,a){var c=n((s=Td(s)).r,(a=Td(a)).r),u=n(s.g,a.g),d=n(s.b,a.b),h=zy(s.opacity,a.opacity);return function(p){return s.r=c(p),s.g=u(p),s.b=d(p),s.opacity=h(p),s+""}}return i.gamma=t,i})(1);function T3(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,i=e.slice(),s;return function(a){for(s=0;s<n;++s)i[s]=t[s]*(1-a)+e[s]*a;return i}}function _3(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function N3(t,e){var n=e?e.length:0,i=t?Math.min(n,t.length):0,s=new Array(i),a=new Array(n),c;for(c=0;c<i;++c)s[c]=wa(t[c],e[c]);for(;c<n;++c)a[c]=e[c];return function(u){for(c=0;c<i;++c)a[c]=s[c](u);return a}}function A3(t,e){var n=new Date;return t=+t,e=+e,function(i){return n.setTime(t*(1-i)+e*i),n}}function uo(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function M3(t,e){var n={},i={},s;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(s in e)s in t?n[s]=wa(t[s],e[s]):i[s]=e[s];return function(a){for(s in n)i[s]=n[s](a);return i}}var Ad=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Md=new RegExp(Ad.source,"g");function R3(t){return function(){return t}}function k3(t){return function(e){return t(e)+""}}function Vy(t,e){var n=Ad.lastIndex=Md.lastIndex=0,i,s,a,c=-1,u=[],d=[];for(t=t+"",e=e+"";(i=Ad.exec(t))&&(s=Md.exec(e));)(a=s.index)>n&&(a=e.slice(n,a),u[c]?u[c]+=a:u[++c]=a),(i=i[0])===(s=s[0])?u[c]?u[c]+=s:u[++c]=s:(u[++c]=null,d.push({i:c,x:uo(i,s)})),n=Md.lastIndex;return n<e.length&&(a=e.slice(n),u[c]?u[c]+=a:u[++c]=a),u.length<2?d[0]?k3(d[0].x):R3(e):(e=d.length,function(h){for(var p=0,m;p<e;++p)u[(m=d[p]).i]=m.x(h);return u.join("")})}function wa(t,e){var n=typeof e,i;return e==null||n==="boolean"?Nd(e):(n==="number"?uo:n==="string"?(i=gr(e))?(e=i,pc):Vy:e instanceof gr?pc:e instanceof Date?A3:_3(e)?T3:Array.isArray(e)?N3:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?M3:uo)(t,e)}var Ly=180/Math.PI,Rd={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function Iy(t,e,n,i,s,a){var c,u,d;return(c=Math.sqrt(t*t+e*e))&&(t/=c,e/=c),(d=t*n+e*i)&&(n-=t*d,i-=e*d),(u=Math.sqrt(n*n+i*i))&&(n/=u,i/=u,d/=u),t*i<e*n&&(t=-t,e=-e,d=-d,c=-c),{translateX:s,translateY:a,rotate:Math.atan2(e,t)*Ly,skewX:Math.atan(d)*Ly,scaleX:c,scaleY:u}}var mc;function O3(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Rd:Iy(e.a,e.b,e.c,e.d,e.e,e.f)}function D3(t){return t==null||(mc||(mc=document.createElementNS("http://www.w3.org/2000/svg","g")),mc.setAttribute("transform",t),!(t=mc.transform.baseVal.consolidate()))?Rd:(t=t.matrix,Iy(t.a,t.b,t.c,t.d,t.e,t.f))}function By(t,e,n,i){function s(h){return h.length?h.pop()+" ":""}function a(h,p,m,y,b,x){if(h!==m||p!==y){var w=b.push("translate(",null,e,null,n);x.push({i:w-4,x:uo(h,m)},{i:w-2,x:uo(p,y)})}else(m||y)&&b.push("translate("+m+e+y+n)}function c(h,p,m,y){h!==p?(h-p>180?p+=360:p-h>180&&(h+=360),y.push({i:m.push(s(m)+"rotate(",null,i)-2,x:uo(h,p)})):p&&m.push(s(m)+"rotate("+p+i)}function u(h,p,m,y){h!==p?y.push({i:m.push(s(m)+"skewX(",null,i)-2,x:uo(h,p)}):p&&m.push(s(m)+"skewX("+p+i)}function d(h,p,m,y,b,x){if(h!==m||p!==y){var w=b.push(s(b)+"scale(",null,",",null,")");x.push({i:w-4,x:uo(h,m)},{i:w-2,x:uo(p,y)})}else(m!==1||y!==1)&&b.push(s(b)+"scale("+m+","+y+")")}return function(h,p){var m=[],y=[];return h=t(h),p=t(p),a(h.translateX,h.translateY,p.translateX,p.translateY,m,y),c(h.rotate,p.rotate,m,y),u(h.skewX,p.skewX,m,y),d(h.scaleX,h.scaleY,p.scaleX,p.scaleY,m,y),h=p=null,function(b){for(var x=-1,w=y.length,S;++x<w;)m[(S=y[x]).i]=S.x(b);return m.join("")}}}var j3=By(O3,"px, ","px)","deg)"),z3=By(D3,", ",")",")"),V3=1e-12;function Py(t){return((t=Math.exp(t))+1/t)/2}function L3(t){return((t=Math.exp(t))-1/t)/2}function I3(t){return((t=Math.exp(2*t))-1)/(t+1)}const gc=(function t(e,n,i){function s(a,c){var u=a[0],d=a[1],h=a[2],p=c[0],m=c[1],y=c[2],b=p-u,x=m-d,w=b*b+x*x,S,E;if(w<V3)E=Math.log(y/h)/e,S=function(O){return[u+O*b,d+O*x,h*Math.exp(e*O*E)]};else{var D=Math.sqrt(w),T=(y*y-h*h+i*w)/(2*h*n*D),C=(y*y-h*h-i*w)/(2*y*n*D),R=Math.log(Math.sqrt(T*T+1)-T),A=Math.log(Math.sqrt(C*C+1)-C);E=(A-R)/e,S=function(O){var k=O*E,H=Py(R),$=h/(n*D)*(H*I3(e*k+R)-L3(R));return[u+$*b,d+$*x,h*H/Py(e*k+R)]}}return S.duration=E*1e3*e/Math.SQRT2,S}return s.rho=function(a){var c=Math.max(.001,+a),u=c*c,d=u*u;return t(c,u,d)},s})(Math.SQRT2,2,4);var os=0,Sa=0,Ea=0,Hy=1e3,yc,Ca,vc=0,br=0,bc=0,Ta=typeof performance=="object"&&performance.now?performance:Date,Uy=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function kd(){return br||(Uy(B3),br=Ta.now()+bc)}function B3(){br=0}function xc(){this._call=this._time=this._next=null}xc.prototype=$y.prototype={constructor:xc,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?kd():+n)+(e==null?0:+e),!this._next&&Ca!==this&&(Ca?Ca._next=this:yc=this,Ca=this),this._call=t,this._time=n,Od()},stop:function(){this._call&&(this._call=null,this._time=1/0,Od())}};function $y(t,e,n){var i=new xc;return i.restart(t,e,n),i}function P3(){kd(),++os;for(var t=yc,e;t;)(e=br-t._time)>=0&&t._call.call(void 0,e),t=t._next;--os}function qy(){br=(vc=Ta.now())+bc,os=Sa=0;try{P3()}finally{os=0,U3(),br=0}}function H3(){var t=Ta.now(),e=t-vc;e>Hy&&(bc-=e,vc=t)}function U3(){for(var t,e=yc,n,i=1/0;e;)e._call?(i>e._time&&(i=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:yc=n);Ca=t,Od(i)}function Od(t){if(!os){Sa&&(Sa=clearTimeout(Sa));var e=t-br;e>24?(t<1/0&&(Sa=setTimeout(qy,t-Ta.now()-bc)),Ea&&(Ea=clearInterval(Ea))):(Ea||(vc=Ta.now(),Ea=setInterval(H3,Hy)),os=1,Uy(qy))}}function Yy(t,e,n){var i=new xc;return e=e==null?0:+e,i.restart(s=>{i.stop(),t(s+e)},e,n),i}var $3=rc("start","end","cancel","interrupt"),q3=[],Gy=0,Xy=1,Dd=2,wc=3,Fy=4,jd=5,Sc=6;function Ec(t,e,n,i,s,a){var c=t.__transition;if(!c)t.__transition={};else if(n in c)return;Y3(t,n,{name:e,index:i,group:s,on:$3,tween:q3,time:a.time,delay:a.delay,duration:a.duration,ease:a.ease,timer:null,state:Gy})}function zd(t,e){var n=$n(t,e);if(n.state>Gy)throw new Error("too late; already scheduled");return n}function fo(t,e){var n=$n(t,e);if(n.state>wc)throw new Error("too late; already running");return n}function $n(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Y3(t,e,n){var i=t.__transition,s;i[e]=n,n.timer=$y(a,0,n.time);function a(h){n.state=Xy,n.timer.restart(c,n.delay,n.time),n.delay<=h&&c(h-n.delay)}function c(h){var p,m,y,b;if(n.state!==Xy)return d();for(p in i)if(b=i[p],b.name===n.name){if(b.state===wc)return Yy(c);b.state===Fy?(b.state=Sc,b.timer.stop(),b.on.call("interrupt",t,t.__data__,b.index,b.group),delete i[p]):+p<e&&(b.state=Sc,b.timer.stop(),b.on.call("cancel",t,t.__data__,b.index,b.group),delete i[p])}if(Yy(function(){n.state===wc&&(n.state=Fy,n.timer.restart(u,n.delay,n.time),u(h))}),n.state=Dd,n.on.call("start",t,t.__data__,n.index,n.group),n.state===Dd){for(n.state=wc,s=new Array(y=n.tween.length),p=0,m=-1;p<y;++p)(b=n.tween[p].value.call(t,t.__data__,n.index,n.group))&&(s[++m]=b);s.length=m+1}}function u(h){for(var p=h<n.duration?n.ease.call(null,h/n.duration):(n.timer.restart(d),n.state=jd,1),m=-1,y=s.length;++m<y;)s[m].call(t,p);n.state===jd&&(n.on.call("end",t,t.__data__,n.index,n.group),d())}function d(){n.state=Sc,n.timer.stop(),delete i[e];for(var h in i)return;delete t.__transition}}function Cc(t,e){var n=t.__transition,i,s,a=!0,c;if(n){e=e==null?null:e+"";for(c in n){if((i=n[c]).name!==e){a=!1;continue}s=i.state>Dd&&i.state<jd,i.state=Sc,i.timer.stop(),i.on.call(s?"interrupt":"cancel",t,t.__data__,i.index,i.group),delete n[c]}a&&delete t.__transition}}function G3(t){return this.each(function(){Cc(this,t)})}function X3(t,e){var n,i;return function(){var s=fo(this,t),a=s.tween;if(a!==n){i=n=a;for(var c=0,u=i.length;c<u;++c)if(i[c].name===e){i=i.slice(),i.splice(c,1);break}}s.tween=i}}function F3(t,e,n){var i,s;if(typeof n!="function")throw new Error;return function(){var a=fo(this,t),c=a.tween;if(c!==i){s=(i=c).slice();for(var u={name:e,value:n},d=0,h=s.length;d<h;++d)if(s[d].name===e){s[d]=u;break}d===h&&s.push(u)}a.tween=s}}function Z3(t,e){var n=this._id;if(t+="",arguments.length<2){for(var i=$n(this.node(),n).tween,s=0,a=i.length,c;s<a;++s)if((c=i[s]).name===t)return c.value;return null}return this.each((e==null?X3:F3)(n,t,e))}function Vd(t,e,n){var i=t._id;return t.each(function(){var s=fo(this,i);(s.value||(s.value={}))[e]=n.apply(this,arguments)}),function(s){return $n(s,i).value[e]}}function Zy(t,e){var n;return(typeof e=="number"?uo:e instanceof gr?pc:(n=gr(e))?(e=n,pc):Vy)(t,e)}function K3(t){return function(){this.removeAttribute(t)}}function Q3(t){return function(){this.removeAttributeNS(t.space,t.local)}}function W3(t,e,n){var i,s=n+"",a;return function(){var c=this.getAttribute(t);return c===s?null:c===i?a:a=e(i=c,n)}}function J3(t,e,n){var i,s=n+"",a;return function(){var c=this.getAttributeNS(t.space,t.local);return c===s?null:c===i?a:a=e(i=c,n)}}function tk(t,e,n){var i,s,a;return function(){var c,u=n(this),d;return u==null?void this.removeAttribute(t):(c=this.getAttribute(t),d=u+"",c===d?null:c===i&&d===s?a:(s=d,a=e(i=c,u)))}}function ek(t,e,n){var i,s,a;return function(){var c,u=n(this),d;return u==null?void this.removeAttributeNS(t.space,t.local):(c=this.getAttributeNS(t.space,t.local),d=u+"",c===d?null:c===i&&d===s?a:(s=d,a=e(i=c,u)))}}function nk(t,e){var n=ac(t),i=n==="transform"?z3:Zy;return this.attrTween(t,typeof e=="function"?(n.local?ek:tk)(n,i,Vd(this,"attr."+t,e)):e==null?(n.local?Q3:K3)(n):(n.local?J3:W3)(n,i,e))}function ok(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function ik(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function rk(t,e){var n,i;function s(){var a=e.apply(this,arguments);return a!==i&&(n=(i=a)&&ik(t,a)),n}return s._value=e,s}function sk(t,e){var n,i;function s(){var a=e.apply(this,arguments);return a!==i&&(n=(i=a)&&ok(t,a)),n}return s._value=e,s}function ak(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var i=ac(t);return this.tween(n,(i.local?rk:sk)(i,e))}function lk(t,e){return function(){zd(this,t).delay=+e.apply(this,arguments)}}function ck(t,e){return e=+e,function(){zd(this,t).delay=e}}function uk(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?lk:ck)(e,t)):$n(this.node(),e).delay}function fk(t,e){return function(){fo(this,t).duration=+e.apply(this,arguments)}}function dk(t,e){return e=+e,function(){fo(this,t).duration=e}}function hk(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?fk:dk)(e,t)):$n(this.node(),e).duration}function pk(t,e){if(typeof e!="function")throw new Error;return function(){fo(this,t).ease=e}}function mk(t){var e=this._id;return arguments.length?this.each(pk(e,t)):$n(this.node(),e).ease}function gk(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;fo(this,t).ease=n}}function yk(t){if(typeof t!="function")throw new Error;return this.each(gk(this._id,t))}function vk(t){typeof t!="function"&&(t=dy(t));for(var e=this._groups,n=e.length,i=new Array(n),s=0;s<n;++s)for(var a=e[s],c=a.length,u=i[s]=[],d,h=0;h<c;++h)(d=a[h])&&t.call(d,d.__data__,h,a)&&u.push(d);return new Ro(i,this._parents,this._name,this._id)}function bk(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,i=e.length,s=n.length,a=Math.min(i,s),c=new Array(i),u=0;u<a;++u)for(var d=e[u],h=n[u],p=d.length,m=c[u]=new Array(p),y,b=0;b<p;++b)(y=d[b]||h[b])&&(m[b]=y);for(;u<i;++u)c[u]=e[u];return new Ro(c,this._parents,this._name,this._id)}function xk(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function wk(t,e,n){var i,s,a=xk(e)?zd:fo;return function(){var c=a(this,t),u=c.on;u!==i&&(s=(i=u).copy()).on(e,n),c.on=s}}function Sk(t,e){var n=this._id;return arguments.length<2?$n(this.node(),n).on.on(t):this.each(wk(n,t,e))}function Ek(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function Ck(){return this.on("end.remove",Ek(this._id))}function Tk(t){var e=this._name,n=this._id;typeof t!="function"&&(t=xd(t));for(var i=this._groups,s=i.length,a=new Array(s),c=0;c<s;++c)for(var u=i[c],d=u.length,h=a[c]=new Array(d),p,m,y=0;y<d;++y)(p=u[y])&&(m=t.call(p,p.__data__,y,u))&&("__data__"in p&&(m.__data__=p.__data__),h[y]=m,Ec(h[y],e,n,y,h,$n(p,n)));return new Ro(a,this._parents,e,n)}function _k(t){var e=this._name,n=this._id;typeof t!="function"&&(t=fy(t));for(var i=this._groups,s=i.length,a=[],c=[],u=0;u<s;++u)for(var d=i[u],h=d.length,p,m=0;m<h;++m)if(p=d[m]){for(var y=t.call(p,p.__data__,m,d),b,x=$n(p,n),w=0,S=y.length;w<S;++w)(b=y[w])&&Ec(b,e,n,w,y,x);a.push(y),c.push(p)}return new Ro(a,c,e,n)}var Nk=ga.prototype.constructor;function Ak(){return new Nk(this._groups,this._parents)}function Mk(t,e){var n,i,s;return function(){var a=ts(this,t),c=(this.style.removeProperty(t),ts(this,t));return a===c?null:a===n&&c===i?s:s=e(n=a,i=c)}}function Ky(t){return function(){this.style.removeProperty(t)}}function Rk(t,e,n){var i,s=n+"",a;return function(){var c=ts(this,t);return c===s?null:c===i?a:a=e(i=c,n)}}function kk(t,e,n){var i,s,a;return function(){var c=ts(this,t),u=n(this),d=u+"";return u==null&&(d=u=(this.style.removeProperty(t),ts(this,t))),c===d?null:c===i&&d===s?a:(s=d,a=e(i=c,u))}}function Ok(t,e){var n,i,s,a="style."+e,c="end."+a,u;return function(){var d=fo(this,t),h=d.on,p=d.value[a]==null?u||(u=Ky(e)):void 0;(h!==n||s!==p)&&(i=(n=h).copy()).on(c,s=p),d.on=i}}function Dk(t,e,n){var i=(t+="")=="transform"?j3:Zy;return e==null?this.styleTween(t,Mk(t,i)).on("end.style."+t,Ky(t)):typeof e=="function"?this.styleTween(t,kk(t,i,Vd(this,"style."+t,e))).each(Ok(this._id,t)):this.styleTween(t,Rk(t,i,e),n).on("end.style."+t,null)}function jk(t,e,n){return function(i){this.style.setProperty(t,e.call(this,i),n)}}function zk(t,e,n){var i,s;function a(){var c=e.apply(this,arguments);return c!==s&&(i=(s=c)&&jk(t,c,n)),i}return a._value=e,a}function Vk(t,e,n){var i="style."+(t+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(e==null)return this.tween(i,null);if(typeof e!="function")throw new Error;return this.tween(i,zk(t,e,n??""))}function Lk(t){return function(){this.textContent=t}}function Ik(t){return function(){var e=t(this);this.textContent=e??""}}function Bk(t){return this.tween("text",typeof t=="function"?Ik(Vd(this,"text",t)):Lk(t==null?"":t+""))}function Pk(t){return function(e){this.textContent=t.call(this,e)}}function Hk(t){var e,n;function i(){var s=t.apply(this,arguments);return s!==n&&(e=(n=s)&&Pk(s)),e}return i._value=t,i}function Uk(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,Hk(t))}function $k(){for(var t=this._name,e=this._id,n=Qy(),i=this._groups,s=i.length,a=0;a<s;++a)for(var c=i[a],u=c.length,d,h=0;h<u;++h)if(d=c[h]){var p=$n(d,e);Ec(d,t,n,h,c,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new Ro(i,this._parents,t,n)}function qk(){var t,e,n=this,i=n._id,s=n.size();return new Promise(function(a,c){var u={value:c},d={value:function(){--s===0&&a()}};n.each(function(){var h=fo(this,i),p=h.on;p!==t&&(e=(t=p).copy(),e._.cancel.push(u),e._.interrupt.push(u),e._.end.push(d)),h.on=e}),s===0&&a()})}var Yk=0;function Ro(t,e,n,i){this._groups=t,this._parents=e,this._name=n,this._id=i}function Qy(){return++Yk}var ko=ga.prototype;Ro.prototype={constructor:Ro,select:Tk,selectAll:_k,selectChild:ko.selectChild,selectChildren:ko.selectChildren,filter:vk,merge:bk,selection:Ak,transition:$k,call:ko.call,nodes:ko.nodes,node:ko.node,size:ko.size,empty:ko.empty,each:ko.each,on:Sk,attr:nk,attrTween:ak,style:Dk,styleTween:Vk,text:Bk,textTween:Uk,remove:Ck,tween:Z3,delay:uk,duration:hk,ease:mk,easeVarying:yk,end:qk,[Symbol.iterator]:ko[Symbol.iterator]};function Gk(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Xk={time:null,delay:0,duration:250,ease:Gk};function Fk(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Zk(t){var e,n;t instanceof Ro?(e=t._id,t=t._name):(e=Qy(),(n=Xk).time=kd(),t=t==null?null:t+"");for(var i=this._groups,s=i.length,a=0;a<s;++a)for(var c=i[a],u=c.length,d,h=0;h<u;++h)(d=c[h])&&Ec(d,t,e,h,c,n||Fk(d,e));return new Ro(i,this._parents,t,e)}ga.prototype.interrupt=G3,ga.prototype.transition=Zk;const Tc=t=>()=>t;function Kk(t,{sourceEvent:e,target:n,transform:i,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:s}})}function Oo(t,e,n){this.k=t,this.x=e,this.y=n}Oo.prototype={constructor:Oo,scale:function(t){return t===1?this:new Oo(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new Oo(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var _c=new Oo(1,0,0);Wy.prototype=Oo.prototype;function Wy(t){for(;!t.__zoom;)if(!(t=t.parentNode))return _c;return t.__zoom}function Ld(t){t.stopImmediatePropagation()}function _a(t){t.preventDefault(),t.stopImmediatePropagation()}function Qk(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Wk(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function Jy(){return this.__zoom||_c}function Jk(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function tO(){return navigator.maxTouchPoints||"ontouchstart"in this}function eO(t,e,n){var i=t.invertX(e[0][0])-n[0][0],s=t.invertX(e[1][0])-n[1][0],a=t.invertY(e[0][1])-n[0][1],c=t.invertY(e[1][1])-n[1][1];return t.translate(s>i?(i+s)/2:Math.min(0,i)||Math.max(0,s),c>a?(a+c)/2:Math.min(0,a)||Math.max(0,c))}function tv(){var t=Qk,e=Wk,n=eO,i=Jk,s=tO,a=[0,1/0],c=[[-1/0,-1/0],[1/0,1/0]],u=250,d=gc,h=rc("start","zoom","end"),p,m,y,b=500,x=150,w=0,S=10;function E(B){B.property("__zoom",Jy).on("wheel.zoom",k,{passive:!1}).on("mousedown.zoom",H).on("dblclick.zoom",$).filter(s).on("touchstart.zoom",q).on("touchmove.zoom",F).on("touchend.zoom touchcancel.zoom",Q).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}E.transform=function(B,P,j,I){var z=B.selection?B.selection():B;z.property("__zoom",Jy),B!==z?R(B,P,j,I):z.interrupt().each(function(){A(this,arguments).event(I).start().zoom(null,typeof P=="function"?P.apply(this,arguments):P).end()})},E.scaleBy=function(B,P,j,I){E.scaleTo(B,function(){var z=this.__zoom.k,U=typeof P=="function"?P.apply(this,arguments):P;return z*U},j,I)},E.scaleTo=function(B,P,j,I){E.transform(B,function(){var z=e.apply(this,arguments),U=this.__zoom,Y=j==null?C(z):typeof j=="function"?j.apply(this,arguments):j,L=U.invert(Y),G=typeof P=="function"?P.apply(this,arguments):P;return n(T(D(U,G),Y,L),z,c)},j,I)},E.translateBy=function(B,P,j,I){E.transform(B,function(){return n(this.__zoom.translate(typeof P=="function"?P.apply(this,arguments):P,typeof j=="function"?j.apply(this,arguments):j),e.apply(this,arguments),c)},null,I)},E.translateTo=function(B,P,j,I,z){E.transform(B,function(){var U=e.apply(this,arguments),Y=this.__zoom,L=I==null?C(U):typeof I=="function"?I.apply(this,arguments):I;return n(_c.translate(L[0],L[1]).scale(Y.k).translate(typeof P=="function"?-P.apply(this,arguments):-P,typeof j=="function"?-j.apply(this,arguments):-j),U,c)},I,z)};function D(B,P){return P=Math.max(a[0],Math.min(a[1],P)),P===B.k?B:new Oo(P,B.x,B.y)}function T(B,P,j){var I=P[0]-j[0]*B.k,z=P[1]-j[1]*B.k;return I===B.x&&z===B.y?B:new Oo(B.k,I,z)}function C(B){return[(+B[0][0]+ +B[1][0])/2,(+B[0][1]+ +B[1][1])/2]}function R(B,P,j,I){B.on("start.zoom",function(){A(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){A(this,arguments).event(I).end()}).tween("zoom",function(){var z=this,U=arguments,Y=A(z,U).event(I),L=e.apply(z,U),G=j==null?C(L):typeof j=="function"?j.apply(z,U):j,tt=Math.max(L[1][0]-L[0][0],L[1][1]-L[0][1]),it=z.__zoom,lt=typeof P=="function"?P.apply(z,U):P,ht=d(it.invert(G).concat(tt/it.k),lt.invert(G).concat(tt/lt.k));return function(ft){if(ft===1)ft=lt;else{var ut=ht(ft),dt=tt/ut[2];ft=new Oo(dt,G[0]-ut[0]*dt,G[1]-ut[1]*dt)}Y.zoom(null,ft)}})}function A(B,P,j){return!j&&B.__zooming||new O(B,P)}function O(B,P){this.that=B,this.args=P,this.active=0,this.sourceEvent=null,this.extent=e.apply(B,P),this.taps=0}O.prototype={event:function(B){return B&&(this.sourceEvent=B),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(B,P){return this.mouse&&B!=="mouse"&&(this.mouse[1]=P.invert(this.mouse[0])),this.touch0&&B!=="touch"&&(this.touch0[1]=P.invert(this.touch0[0])),this.touch1&&B!=="touch"&&(this.touch1[1]=P.invert(this.touch1[0])),this.that.__zoom=P,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(B){var P=dn(this.that).datum();h.call(B,this.that,new Kk(B,{sourceEvent:this.sourceEvent,target:E,transform:this.that.__zoom,dispatch:h}),P)}};function k(B,...P){if(!t.apply(this,arguments))return;var j=A(this,P).event(B),I=this.__zoom,z=Math.max(a[0],Math.min(a[1],I.k*Math.pow(2,i.apply(this,arguments)))),U=Hn(B);if(j.wheel)(j.mouse[0][0]!==U[0]||j.mouse[0][1]!==U[1])&&(j.mouse[1]=I.invert(j.mouse[0]=U)),clearTimeout(j.wheel);else{if(I.k===z)return;j.mouse=[U,I.invert(U)],Cc(this),j.start()}_a(B),j.wheel=setTimeout(Y,x),j.zoom("mouse",n(T(D(I,z),j.mouse[0],j.mouse[1]),j.extent,c));function Y(){j.wheel=null,j.end()}}function H(B,...P){if(y||!t.apply(this,arguments))return;var j=B.currentTarget,I=A(this,P,!0).event(B),z=dn(B.view).on("mousemove.zoom",G,!0).on("mouseup.zoom",tt,!0),U=Hn(B,j),Y=B.clientX,L=B.clientY;Sy(B.view),Ld(B),I.mouse=[U,this.__zoom.invert(U)],Cc(this),I.start();function G(it){if(_a(it),!I.moved){var lt=it.clientX-Y,ht=it.clientY-L;I.moved=lt*lt+ht*ht>w}I.event(it).zoom("mouse",n(T(I.that.__zoom,I.mouse[0]=Hn(it,j),I.mouse[1]),I.extent,c))}function tt(it){z.on("mousemove.zoom mouseup.zoom",null),Ey(it.view,I.moved),_a(it),I.event(it).end()}}function $(B,...P){if(t.apply(this,arguments)){var j=this.__zoom,I=Hn(B.changedTouches?B.changedTouches[0]:B,this),z=j.invert(I),U=j.k*(B.shiftKey?.5:2),Y=n(T(D(j,U),I,z),e.apply(this,P),c);_a(B),u>0?dn(this).transition().duration(u).call(R,Y,I,B):dn(this).call(E.transform,Y,I,B)}}function q(B,...P){if(t.apply(this,arguments)){var j=B.touches,I=j.length,z=A(this,P,B.changedTouches.length===I).event(B),U,Y,L,G;for(Ld(B),Y=0;Y<I;++Y)L=j[Y],G=Hn(L,this),G=[G,this.__zoom.invert(G),L.identifier],z.touch0?!z.touch1&&z.touch0[2]!==G[2]&&(z.touch1=G,z.taps=0):(z.touch0=G,U=!0,z.taps=1+!!p);p&&(p=clearTimeout(p)),U&&(z.taps<2&&(m=G[0],p=setTimeout(function(){p=null},b)),Cc(this),z.start())}}function F(B,...P){if(this.__zooming){var j=A(this,P).event(B),I=B.changedTouches,z=I.length,U,Y,L,G;for(_a(B),U=0;U<z;++U)Y=I[U],L=Hn(Y,this),j.touch0&&j.touch0[2]===Y.identifier?j.touch0[0]=L:j.touch1&&j.touch1[2]===Y.identifier&&(j.touch1[0]=L);if(Y=j.that.__zoom,j.touch1){var tt=j.touch0[0],it=j.touch0[1],lt=j.touch1[0],ht=j.touch1[1],ft=(ft=lt[0]-tt[0])*ft+(ft=lt[1]-tt[1])*ft,ut=(ut=ht[0]-it[0])*ut+(ut=ht[1]-it[1])*ut;Y=D(Y,Math.sqrt(ft/ut)),L=[(tt[0]+lt[0])/2,(tt[1]+lt[1])/2],G=[(it[0]+ht[0])/2,(it[1]+ht[1])/2]}else if(j.touch0)L=j.touch0[0],G=j.touch0[1];else return;j.zoom("touch",n(T(Y,L,G),j.extent,c))}}function Q(B,...P){if(this.__zooming){var j=A(this,P).event(B),I=B.changedTouches,z=I.length,U,Y;for(Ld(B),y&&clearTimeout(y),y=setTimeout(function(){y=null},b),U=0;U<z;++U)Y=I[U],j.touch0&&j.touch0[2]===Y.identifier?delete j.touch0:j.touch1&&j.touch1[2]===Y.identifier&&delete j.touch1;if(j.touch1&&!j.touch0&&(j.touch0=j.touch1,delete j.touch1),j.touch0)j.touch0[1]=this.__zoom.invert(j.touch0[0]);else if(j.end(),j.taps===2&&(Y=Hn(Y,this),Math.hypot(m[0]-Y[0],m[1]-Y[1])<S)){var L=dn(this).on("dblclick.zoom");L&&L.apply(this,arguments)}}}return E.wheelDelta=function(B){return arguments.length?(i=typeof B=="function"?B:Tc(+B),E):i},E.filter=function(B){return arguments.length?(t=typeof B=="function"?B:Tc(!!B),E):t},E.touchable=function(B){return arguments.length?(s=typeof B=="function"?B:Tc(!!B),E):s},E.extent=function(B){return arguments.length?(e=typeof B=="function"?B:Tc([[+B[0][0],+B[0][1]],[+B[1][0],+B[1][1]]]),E):e},E.scaleExtent=function(B){return arguments.length?(a[0]=+B[0],a[1]=+B[1],E):[a[0],a[1]]},E.translateExtent=function(B){return arguments.length?(c[0][0]=+B[0][0],c[1][0]=+B[1][0],c[0][1]=+B[0][1],c[1][1]=+B[1][1],E):[[c[0][0],c[0][1]],[c[1][0],c[1][1]]]},E.constrain=function(B){return arguments.length?(n=B,E):n},E.duration=function(B){return arguments.length?(u=+B,E):u},E.interpolate=function(B){return arguments.length?(d=B,E):d},E.on=function(){var B=h.on.apply(h,arguments);return B===h?E:B},E.clickDistance=function(B){return arguments.length?(w=(B=+B)*B,E):Math.sqrt(w)},E.tapDistance=function(B){return arguments.length?(S=+B,E):S},E}const ho={error001:()=>"[React Flow]: Seems like you have not used zustand provider as an ancestor. Help: https://reactflow.dev/error#001",error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The React Flow parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:i})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:i}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs."},Na=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],ev=["Enter"," ","Escape"],nv={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var is;(function(t){t.Strict="strict",t.Loose="loose"})(is||(is={}));var xr;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(xr||(xr={}));var Aa;(function(t){t.Partial="partial",t.Full="full"})(Aa||(Aa={}));const ov={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var fi;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(fi||(fi={}));var Nc;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(Nc||(Nc={}));var At;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(At||(At={}));const iv={[At.Left]:At.Right,[At.Right]:At.Left,[At.Top]:At.Bottom,[At.Bottom]:At.Top};function rv(t){return t===null?null:t?"valid":"invalid"}const sv=t=>"id"in t&&"source"in t&&"target"in t,nO=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),Id=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),Ma=(t,e=[0,0])=>{const{width:n,height:i}=Do(t),s=t.origin??e,a=n*s[0],c=i*s[1];return{x:t.position.x-a,y:t.position.y-c}},oO=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((i,s)=>{const a=typeof s=="string";let c=!e.nodeLookup&&!a?s:void 0;e.nodeLookup&&(c=a?e.nodeLookup.get(s):Id(s)?s:e.nodeLookup.get(s.id));const u=c?Rc(c,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return Ac(i,u)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return Mc(n)},Ra=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},i=!1;return t.forEach(s=>{(e.filter===void 0||e.filter(s))&&(n=Ac(n,Rc(s)),i=!0)}),i?Mc(n):{x:0,y:0,width:0,height:0}},Bd=(t,e,[n,i,s]=[0,0,1],a=!1,c=!1)=>{const u={...Da(e,[n,i,s]),width:e.width/s,height:e.height/s},d=[];for(const h of t.values()){const{measured:p,selectable:m=!0,hidden:y=!1}=h;if(c&&!m||y)continue;const b=p.width??h.width??h.initialWidth??null,x=p.height??h.height??h.initialHeight??null,w=ka(u,ss(h)),S=(b??0)*(x??0),E=a&&w>0;(!h.internals.handleBounds||E||w>=S||h.dragging)&&d.push(h)}return d},iO=(t,e)=>{const n=new Set;return t.forEach(i=>{n.add(i.id)}),e.filter(i=>n.has(i.source)||n.has(i.target))};function rO(t,e){const n=new Map,i=e?.nodes?new Set(e.nodes.map(s=>s.id)):null;return t.forEach(s=>{s.measured.width&&s.measured.height&&(e?.includeHiddenNodes||!s.hidden)&&(!i||i.has(s.id))&&n.set(s.id,s)}),n}async function sO({nodes:t,width:e,height:n,panZoom:i,minZoom:s,maxZoom:a},c){if(t.size===0)return Promise.resolve(!0);const u=rO(t,c),d=Ra(u),h=Hd(d,e,n,c?.minZoom??s,c?.maxZoom??a,c?.padding??.1);return await i.setViewport(h,{duration:c?.duration,ease:c?.ease,interpolate:c?.interpolate}),Promise.resolve(!0)}function av({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:i=[0,0],nodeExtent:s,onError:a}){const c=n.get(t),u=c.parentId?n.get(c.parentId):void 0,{x:d,y:h}=u?u.internals.positionAbsolute:{x:0,y:0},p=c.origin??i;let m=c.extent||s;if(c.extent==="parent"&&!c.expandParent)if(!u)a?.("005",ho.error005());else{const b=u.measured.width,x=u.measured.height;b&&x&&(m=[[d,h],[d+b,h+x]])}else u&&ls(c.extent)&&(m=[[c.extent[0][0]+d,c.extent[0][1]+h],[c.extent[1][0]+d,c.extent[1][1]+h]]);const y=ls(m)?wr(e,m,c.measured):e;return(c.measured.width===void 0||c.measured.height===void 0)&&a?.("015",ho.error015()),{position:{x:y.x-d+(c.measured.width??0)*p[0],y:y.y-h+(c.measured.height??0)*p[1]},positionAbsolute:y}}async function aO({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:i,onBeforeDelete:s}){const a=new Set(t.map(y=>y.id)),c=[];for(const y of n){if(y.deletable===!1)continue;const b=a.has(y.id),x=!b&&y.parentId&&c.find(w=>w.id===y.parentId);(b||x)&&c.push(y)}const u=new Set(e.map(y=>y.id)),d=i.filter(y=>y.deletable!==!1),p=iO(c,d);for(const y of d)u.has(y.id)&&!p.find(x=>x.id===y.id)&&p.push(y);if(!s)return{edges:p,nodes:c};const m=await s({nodes:c,edges:p});return typeof m=="boolean"?m?{edges:p,nodes:c}:{edges:[],nodes:[]}:m}const rs=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),wr=(t={x:0,y:0},e,n)=>({x:rs(t.x,e[0][0],e[1][0]-(n?.width??0)),y:rs(t.y,e[0][1],e[1][1]-(n?.height??0))});function lv(t,e,n){const{width:i,height:s}=Do(n),{x:a,y:c}=n.internals.positionAbsolute;return wr(t,[[a,c],[a+i,c+s]],e)}const cv=(t,e,n)=>t<e?rs(Math.abs(t-e),1,e)/e:t>n?-rs(Math.abs(t-n),1,e)/e:0,uv=(t,e,n=15,i=40)=>{const s=cv(t.x,i,e.width-i)*n,a=cv(t.y,i,e.height-i)*n;return[s,a]},Ac=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),Pd=({x:t,y:e,width:n,height:i})=>({x:t,y:e,x2:t+n,y2:e+i}),Mc=({x:t,y:e,x2:n,y2:i})=>({x:t,y:e,width:n-t,height:i-e}),ss=(t,e=[0,0])=>{const{x:n,y:i}=Id(t)?t.internals.positionAbsolute:Ma(t,e);return{x:n,y:i,width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}},Rc=(t,e=[0,0])=>{const{x:n,y:i}=Id(t)?t.internals.positionAbsolute:Ma(t,e);return{x:n,y:i,x2:n+(t.measured?.width??t.width??t.initialWidth??0),y2:i+(t.measured?.height??t.height??t.initialHeight??0)}},fv=(t,e)=>Mc(Ac(Pd(t),Pd(e))),ka=(t,e)=>{const n=Math.max(0,Math.min(t.x+t.width,e.x+e.width)-Math.max(t.x,e.x)),i=Math.max(0,Math.min(t.y+t.height,e.y+e.height)-Math.max(t.y,e.y));return Math.ceil(n*i)},dv=t=>qn(t.width)&&qn(t.height)&&qn(t.x)&&qn(t.y),qn=t=>!isNaN(t)&&isFinite(t),lO=(t,e)=>{},Oa=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),Da=({x:t,y:e},[n,i,s],a=!1,c=[1,1])=>{const u={x:(t-n)/s,y:(e-i)/s};return a?Oa(u,c):u},kc=({x:t,y:e},[n,i,s])=>({x:t*s+n,y:e*s+i});function as(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`[React Flow] The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function cO(t,e,n){if(typeof t=="string"||typeof t=="number"){const i=as(t,n),s=as(t,e);return{top:i,right:s,bottom:i,left:s,x:s*2,y:i*2}}if(typeof t=="object"){const i=as(t.top??t.y??0,n),s=as(t.bottom??t.y??0,n),a=as(t.left??t.x??0,e),c=as(t.right??t.x??0,e);return{top:i,right:c,bottom:s,left:a,x:a+c,y:i+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function uO(t,e,n,i,s,a){const{x:c,y:u}=kc(t,[e,n,i]),{x:d,y:h}=kc({x:t.x+t.width,y:t.y+t.height},[e,n,i]),p=s-d,m=a-h;return{left:Math.floor(c),top:Math.floor(u),right:Math.floor(p),bottom:Math.floor(m)}}const Hd=(t,e,n,i,s,a)=>{const c=cO(a,e,n),u=(e-c.x)/t.width,d=(n-c.y)/t.height,h=Math.min(u,d),p=rs(h,i,s),m=t.x+t.width/2,y=t.y+t.height/2,b=e/2-m*p,x=n/2-y*p,w=uO(t,b,x,p,e,n),S={left:Math.min(w.left-c.left,0),top:Math.min(w.top-c.top,0),right:Math.min(w.right-c.right,0),bottom:Math.min(w.bottom-c.bottom,0)};return{x:b-S.left+S.right,y:x-S.top+S.bottom,zoom:p}},ja=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0;function ls(t){return t!=null&&t!=="parent"}function Do(t){return{width:t.measured?.width??t.width??t.initialWidth??0,height:t.measured?.height??t.height??t.initialHeight??0}}function hv(t){return(t.measured?.width??t.width??t.initialWidth)!==void 0&&(t.measured?.height??t.height??t.initialHeight)!==void 0}function pv(t,e={width:0,height:0},n,i,s){const a={...t},c=i.get(n);if(c){const u=c.origin||s;a.x+=c.internals.positionAbsolute.x-(e.width??0)*u[0],a.y+=c.internals.positionAbsolute.y-(e.height??0)*u[1]}return a}function mv(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function fO(){let t,e;return{promise:new Promise((i,s)=>{t=i,e=s}),resolve:t,reject:e}}function dO(t){return{...nv,...t||{}}}function za(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:i,containerBounds:s}){const{x:a,y:c}=Yn(t),u=Da({x:a-(s?.left??0),y:c-(s?.top??0)},i),{x:d,y:h}=n?Oa(u,e):u;return{xSnapped:d,ySnapped:h,...u}}const Ud=t=>({width:t.offsetWidth,height:t.offsetHeight}),gv=t=>t?.getRootNode?.()||window?.document,hO=["INPUT","SELECT","TEXTAREA"];function yv(t){const e=t.composedPath?.()?.[0]||t.target;return e?.nodeType!==1?!1:hO.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const vv=t=>"clientX"in t,Yn=(t,e)=>{const n=vv(t),i=n?t.clientX:t.touches?.[0].clientX,s=n?t.clientY:t.touches?.[0].clientY;return{x:i-(e?.left??0),y:s-(e?.top??0)}},bv=(t,e,n,i,s)=>{const a=e.querySelectorAll(`.${t}`);return!a||!a.length?null:Array.from(a).map(c=>{const u=c.getBoundingClientRect();return{id:c.getAttribute("data-handleid"),type:t,nodeId:s,position:c.getAttribute("data-handlepos"),x:(u.left-n.left)/i,y:(u.top-n.top)/i,...Ud(c)}})};function xv({sourceX:t,sourceY:e,targetX:n,targetY:i,sourceControlX:s,sourceControlY:a,targetControlX:c,targetControlY:u}){const d=t*.125+s*.375+c*.375+n*.125,h=e*.125+a*.375+u*.375+i*.125,p=Math.abs(d-t),m=Math.abs(h-e);return[d,h,p,m]}function Oc(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function wv({pos:t,x1:e,y1:n,x2:i,y2:s,c:a}){switch(t){case At.Left:return[e-Oc(e-i,a),n];case At.Right:return[e+Oc(i-e,a),n];case At.Top:return[e,n-Oc(n-s,a)];case At.Bottom:return[e,n+Oc(s-n,a)]}}function Sv({sourceX:t,sourceY:e,sourcePosition:n=At.Bottom,targetX:i,targetY:s,targetPosition:a=At.Top,curvature:c=.25}){const[u,d]=wv({pos:n,x1:t,y1:e,x2:i,y2:s,c}),[h,p]=wv({pos:a,x1:i,y1:s,x2:t,y2:e,c}),[m,y,b,x]=xv({sourceX:t,sourceY:e,targetX:i,targetY:s,sourceControlX:u,sourceControlY:d,targetControlX:h,targetControlY:p});return[`M${t},${e} C${u},${d} ${h},${p} ${i},${s}`,m,y,b,x]}function Ev({sourceX:t,sourceY:e,targetX:n,targetY:i}){const s=Math.abs(n-t)/2,a=n<t?n+s:n-s,c=Math.abs(i-e)/2,u=i<e?i+c:i-c;return[a,u,s,c]}function pO({sourceNode:t,targetNode:e,selected:n=!1,zIndex:i=0,elevateOnSelect:s=!1,zIndexMode:a="basic"}){if(a==="manual")return i;const c=s&&n?i+1e3:i,u=Math.max(t.parentId||s&&t.selected?t.internals.z:0,e.parentId||s&&e.selected?e.internals.z:0);return c+u}function mO({sourceNode:t,targetNode:e,width:n,height:i,transform:s}){const a=Ac(Rc(t),Rc(e));a.x===a.x2&&(a.x2+=1),a.y===a.y2&&(a.y2+=1);const c={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:i/s[2]};return ka(c,Mc(a))>0}const gO=({source:t,sourceHandle:e,target:n,targetHandle:i})=>`xy-edge__${t}${e||""}-${n}${i||""}`,yO=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),vO=(t,e,n={})=>{if(!t.source||!t.target)return e;const i=n.getEdgeId||gO;let s;return sv(t)?s={...t}:s={...t,id:i(t)},yO(s,e)?e:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,e.concat(s))};function Cv({sourceX:t,sourceY:e,targetX:n,targetY:i}){const[s,a,c,u]=Ev({sourceX:t,sourceY:e,targetX:n,targetY:i});return[`M ${t},${e}L ${n},${i}`,s,a,c,u]}const Tv={[At.Left]:{x:-1,y:0},[At.Right]:{x:1,y:0},[At.Top]:{x:0,y:-1},[At.Bottom]:{x:0,y:1}},bO=({source:t,sourcePosition:e=At.Bottom,target:n})=>e===At.Left||e===At.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},_v=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function xO({source:t,sourcePosition:e=At.Bottom,target:n,targetPosition:i=At.Top,center:s,offset:a,stepPosition:c}){const u=Tv[e],d=Tv[i],h={x:t.x+u.x*a,y:t.y+u.y*a},p={x:n.x+d.x*a,y:n.y+d.y*a},m=bO({source:h,sourcePosition:e,target:p}),y=m.x!==0?"x":"y",b=m[y];let x=[],w,S;const E={x:0,y:0},D={x:0,y:0},[,,T,C]=Ev({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(u[y]*d[y]===-1){y==="x"?(w=s.x??h.x+(p.x-h.x)*c,S=s.y??(h.y+p.y)/2):(w=s.x??(h.x+p.x)/2,S=s.y??h.y+(p.y-h.y)*c);const A=[{x:w,y:h.y},{x:w,y:p.y}],O=[{x:h.x,y:S},{x:p.x,y:S}];u[y]===b?x=y==="x"?A:O:x=y==="x"?O:A}else{const A=[{x:h.x,y:p.y}],O=[{x:p.x,y:h.y}];if(y==="x"?x=u.x===b?O:A:x=u.y===b?A:O,e===i){const F=Math.abs(t[y]-n[y]);if(F<=a){const Q=Math.min(a-1,a-F);u[y]===b?E[y]=(h[y]>t[y]?-1:1)*Q:D[y]=(p[y]>n[y]?-1:1)*Q}}if(e!==i){const F=y==="x"?"y":"x",Q=u[y]===d[F],B=h[F]>p[F],P=h[F]<p[F];(u[y]===1&&(!Q&&B||Q&&P)||u[y]!==1&&(!Q&&P||Q&&B))&&(x=y==="x"?A:O)}const k={x:h.x+E.x,y:h.y+E.y},H={x:p.x+D.x,y:p.y+D.y},$=Math.max(Math.abs(k.x-x[0].x),Math.abs(H.x-x[0].x)),q=Math.max(Math.abs(k.y-x[0].y),Math.abs(H.y-x[0].y));$>=q?(w=(k.x+H.x)/2,S=x[0].y):(w=x[0].x,S=(k.y+H.y)/2)}return[[t,{x:h.x+E.x,y:h.y+E.y},...x,{x:p.x+D.x,y:p.y+D.y},n],w,S,T,C]}function wO(t,e,n,i){const s=Math.min(_v(t,e)/2,_v(e,n)/2,i),{x:a,y:c}=e;if(t.x===a&&a===n.x||t.y===c&&c===n.y)return`L${a} ${c}`;if(t.y===c){const h=t.x<n.x?-1:1,p=t.y<n.y?1:-1;return`L ${a+s*h},${c}Q ${a},${c} ${a},${c+s*p}`}const u=t.x<n.x?1:-1,d=t.y<n.y?-1:1;return`L ${a},${c+s*d}Q ${a},${c} ${a+s*u},${c}`}function $d({sourceX:t,sourceY:e,sourcePosition:n=At.Bottom,targetX:i,targetY:s,targetPosition:a=At.Top,borderRadius:c=5,centerX:u,centerY:d,offset:h=20,stepPosition:p=.5}){const[m,y,b,x,w]=xO({source:{x:t,y:e},sourcePosition:n,target:{x:i,y:s},targetPosition:a,center:{x:u,y:d},offset:h,stepPosition:p});return[m.reduce((E,D,T)=>{let C="";return T>0&&T<m.length-1?C=wO(m[T-1],D,m[T+1],c):C=`${T===0?"M":"L"}${D.x} ${D.y}`,E+=C,E},""),y,b,x,w]}function Nv(t){return t&&!!(t.internals.handleBounds||t.handles?.length)&&!!(t.measured.width||t.width||t.initialWidth)}function SO(t){const{sourceNode:e,targetNode:n}=t;if(!Nv(e)||!Nv(n))return null;const i=e.internals.handleBounds||Av(e.handles),s=n.internals.handleBounds||Av(n.handles),a=Mv(i?.source??[],t.sourceHandle),c=Mv(t.connectionMode===is.Strict?s?.target??[]:(s?.target??[]).concat(s?.source??[]),t.targetHandle);if(!a||!c)return t.onError?.("008",ho.error008(a?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const u=a?.position||At.Bottom,d=c?.position||At.Top,h=Sr(e,a,u),p=Sr(n,c,d);return{sourceX:h.x,sourceY:h.y,targetX:p.x,targetY:p.y,sourcePosition:u,targetPosition:d}}function Av(t){if(!t)return null;const e=[],n=[];for(const i of t)i.width=i.width??1,i.height=i.height??1,i.type==="source"?e.push(i):i.type==="target"&&n.push(i);return{source:e,target:n}}function Sr(t,e,n=At.Left,i=!1){const s=(e?.x??0)+t.internals.positionAbsolute.x,a=(e?.y??0)+t.internals.positionAbsolute.y,{width:c,height:u}=e??Do(t);if(i)return{x:s+c/2,y:a+u/2};switch(e?.position??n){case At.Top:return{x:s+c/2,y:a};case At.Right:return{x:s+c,y:a+u/2};case At.Bottom:return{x:s+c/2,y:a+u};case At.Left:return{x:s,y:a+u/2}}}function Mv(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function qd(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(i=>`${i}=${t[i]}`).join("&")}`:""}function EO(t,{id:e,defaultColor:n,defaultMarkerStart:i,defaultMarkerEnd:s}){const a=new Set;return t.reduce((c,u)=>([u.markerStart||i,u.markerEnd||s].forEach(d=>{if(d&&typeof d=="object"){const h=qd(d,e);a.has(h)||(c.push({id:h,color:d.color||n,...d}),a.add(h))}}),c),[]).sort((c,u)=>c.id.localeCompare(u.id))}const Rv=1e3,CO=10,Yd={nodeOrigin:[0,0],nodeExtent:Na,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},TO={...Yd,checkEquality:!0};function Gd(t,e){const n={...t};for(const i in e)e[i]!==void 0&&(n[i]=e[i]);return n}function _O(t,e,n){const i=Gd(Yd,n);for(const s of t.values())if(s.parentId)Zd(s,t,e,i);else{const a=Ma(s,i.nodeOrigin),c=ls(s.extent)?s.extent:i.nodeExtent,u=wr(a,c,Do(s));s.internals.positionAbsolute=u}}function NO(t,e){if(!t.handles)return t.measured?e?.internals.handleBounds:void 0;const n=[],i=[];for(const s of t.handles){const a={id:s.id,width:s.width??1,height:s.height??1,nodeId:t.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(a):s.type==="target"&&i.push(a)}return{source:n,target:i}}function Xd(t){return t==="manual"}function Fd(t,e,n,i={}){const s=Gd(TO,i),a={i:0},c=new Map(e),u=s?.elevateNodesOnSelect&&!Xd(s.zIndexMode)?Rv:0;let d=t.length>0;e.clear(),n.clear();for(const h of t){let p=c.get(h.id);if(s.checkEquality&&h===p?.internals.userNode)e.set(h.id,p);else{const m=Ma(h,s.nodeOrigin),y=ls(h.extent)?h.extent:s.nodeExtent,b=wr(m,y,Do(h));p={...s.defaults,...h,measured:{width:h.measured?.width,height:h.measured?.height},internals:{positionAbsolute:b,handleBounds:NO(h,p),z:kv(h,u,s.zIndexMode),userNode:h}},e.set(h.id,p)}(p.measured===void 0||p.measured.width===void 0||p.measured.height===void 0)&&!p.hidden&&(d=!1),h.parentId&&Zd(p,e,n,i,a)}return d}function AO(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function Zd(t,e,n,i,s){const{elevateNodesOnSelect:a,nodeOrigin:c,nodeExtent:u,zIndexMode:d}=Gd(Yd,i),h=t.parentId,p=e.get(h);if(!p){console.warn(`Parent node ${h} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}AO(t,n),s&&!p.parentId&&p.internals.rootParentIndex===void 0&&d==="auto"&&(p.internals.rootParentIndex=++s.i,p.internals.z=p.internals.z+s.i*CO),s&&p.internals.rootParentIndex!==void 0&&(s.i=p.internals.rootParentIndex);const m=a&&!Xd(d)?Rv:0,{x:y,y:b,z:x}=MO(t,p,c,u,m,d),{positionAbsolute:w}=t.internals,S=y!==w.x||b!==w.y;(S||x!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:S?{x:y,y:b}:w,z:x}})}function kv(t,e,n){const i=qn(t.zIndex)?t.zIndex:0;return Xd(n)?i:i+(t.selected?e:0)}function MO(t,e,n,i,s,a){const{x:c,y:u}=e.internals.positionAbsolute,d=Do(t),h=Ma(t,n),p=ls(t.extent)?wr(h,t.extent,d):h;let m=wr({x:c+p.x,y:u+p.y},i,d);t.extent==="parent"&&(m=lv(m,d,e));const y=kv(t,s,a),b=e.internals.z??0;return{x:m.x,y:m.y,z:b>=y?b+1:y}}function Kd(t,e,n,i=[0,0]){const s=[],a=new Map;for(const c of t){const u=e.get(c.parentId);if(!u)continue;const d=a.get(c.parentId)?.expandedRect??ss(u),h=fv(d,c.rect);a.set(c.parentId,{expandedRect:h,parent:u})}return a.size>0&&a.forEach(({expandedRect:c,parent:u},d)=>{const h=u.internals.positionAbsolute,p=Do(u),m=u.origin??i,y=c.x<h.x?Math.round(Math.abs(h.x-c.x)):0,b=c.y<h.y?Math.round(Math.abs(h.y-c.y)):0,x=Math.max(p.width,Math.round(c.width)),w=Math.max(p.height,Math.round(c.height)),S=(x-p.width)*m[0],E=(w-p.height)*m[1];(y>0||b>0||S||E)&&(s.push({id:d,type:"position",position:{x:u.position.x-y+S,y:u.position.y-b+E}}),n.get(d)?.forEach(D=>{t.some(T=>T.id===D.id)||s.push({id:D.id,type:"position",position:{x:D.position.x+y,y:D.position.y+b}})})),(p.width<c.width||p.height<c.height||y||b)&&s.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:x+(y?m[0]*y-S:0),height:w+(b?m[1]*b-E:0)}})}),s}function RO(t,e,n,i,s,a,c){const u=i?.querySelector(".xyflow__viewport");let d=!1;if(!u)return{changes:[],updatedInternals:d};const h=[],p=window.getComputedStyle(u),{m22:m}=new window.DOMMatrixReadOnly(p.transform),y=[];for(const b of t.values()){const x=e.get(b.id);if(!x)continue;if(x.hidden){e.set(x.id,{...x,internals:{...x.internals,handleBounds:void 0}}),d=!0;continue}const w=Ud(b.nodeElement),S=x.measured.width!==w.width||x.measured.height!==w.height;if(!!(w.width&&w.height&&(S||!x.internals.handleBounds||b.force))){const D=b.nodeElement.getBoundingClientRect(),T=ls(x.extent)?x.extent:a;let{positionAbsolute:C}=x.internals;x.parentId&&x.extent==="parent"?C=lv(C,w,e.get(x.parentId)):T&&(C=wr(C,T,w));const R={...x,measured:w,internals:{...x.internals,positionAbsolute:C,handleBounds:{source:bv("source",b.nodeElement,D,m,x.id),target:bv("target",b.nodeElement,D,m,x.id)}}};e.set(x.id,R),x.parentId&&Zd(R,e,n,{nodeOrigin:s,zIndexMode:c}),d=!0,S&&(h.push({id:x.id,type:"dimensions",dimensions:w}),x.expandParent&&x.parentId&&y.push({id:x.id,parentId:x.parentId,rect:ss(R,s)}))}}if(y.length>0){const b=Kd(y,e,n,s);h.push(...b)}return{changes:h,updatedInternals:d}}async function kO({delta:t,panZoom:e,transform:n,translateExtent:i,width:s,height:a}){if(!e||!t.x&&!t.y)return Promise.resolve(!1);const c=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[s,a]],i),u=!!c&&(c.x!==n[0]||c.y!==n[1]||c.k!==n[2]);return Promise.resolve(u)}function Ov(t,e,n,i,s,a){let c=s;const u=i.get(c)||new Map;i.set(c,u.set(n,e)),c=`${s}-${t}`;const d=i.get(c)||new Map;if(i.set(c,d.set(n,e)),a){c=`${s}-${t}-${a}`;const h=i.get(c)||new Map;i.set(c,h.set(n,e))}}function Dv(t,e,n){t.clear(),e.clear();for(const i of n){const{source:s,target:a,sourceHandle:c=null,targetHandle:u=null}=i,d={edgeId:i.id,source:s,target:a,sourceHandle:c,targetHandle:u},h=`${s}-${c}--${a}-${u}`,p=`${a}-${u}--${s}-${c}`;Ov("source",d,p,t,s,c),Ov("target",d,h,t,a,u),e.set(i.id,i)}}function jv(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:jv(n,e):!1}function zv(t,e,n){let i=t;do{if(i?.matches?.(e))return!0;if(i===n)return!1;i=i?.parentElement}while(i);return!1}function OO(t,e,n,i){const s=new Map;for(const[a,c]of t)if((c.selected||c.id===i)&&(!c.parentId||!jv(c,t))&&(c.draggable||e&&typeof c.draggable>"u")){const u=t.get(a);u&&s.set(a,{id:a,position:u.position||{x:0,y:0},distance:{x:n.x-u.internals.positionAbsolute.x,y:n.y-u.internals.positionAbsolute.y},extent:u.extent,parentId:u.parentId,origin:u.origin,expandParent:u.expandParent,internals:{positionAbsolute:u.internals.positionAbsolute||{x:0,y:0}},measured:{width:u.measured.width??0,height:u.measured.height??0}})}return s}function Qd({nodeId:t,dragItems:e,nodeLookup:n,dragging:i=!0}){const s=[];for(const[c,u]of e){const d=n.get(c)?.internals.userNode;d&&s.push({...d,position:u.position,dragging:i})}if(!t)return[s[0],s];const a=n.get(t)?.internals.userNode;return[a?{...a,position:e.get(t)?.position||a.position,dragging:i}:s[0],s]}function DO({dragItems:t,snapGrid:e,x:n,y:i}){const s=t.values().next().value;if(!s)return null;const a={x:n-s.distance.x,y:i-s.distance.y},c=Oa(a,e);return{x:c.x-a.x,y:c.y-a.y}}function jO({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:i,onDragStop:s}){let a={x:null,y:null},c=0,u=new Map,d=!1,h={x:0,y:0},p=null,m=!1,y=null,b=!1,x=!1,w=null;function S({noDragClassName:D,handleSelector:T,domNode:C,isSelectable:R,nodeId:A,nodeClickDistance:O=0}){y=dn(C);function k({x:F,y:Q}){const{nodeLookup:B,nodeExtent:P,snapGrid:j,snapToGrid:I,nodeOrigin:z,onNodeDrag:U,onSelectionDrag:Y,onError:L,updateNodePositions:G}=e();a={x:F,y:Q};let tt=!1;const it=u.size>1,lt=it&&P?Pd(Ra(u)):null,ht=it&&I?DO({dragItems:u,snapGrid:j,x:F,y:Q}):null;for(const[ft,ut]of u){if(!B.has(ft))continue;let dt={x:F-ut.distance.x,y:Q-ut.distance.y};I&&(dt=ht?{x:Math.round(dt.x+ht.x),y:Math.round(dt.y+ht.y)}:Oa(dt,j));let Mt=null;if(it&&P&&!ut.extent&&lt){const{positionAbsolute:Tt}=ut.internals,Dt=Tt.x-lt.x+P[0][0],qt=Tt.x+ut.measured.width-lt.x2+P[1][0],Ht=Tt.y-lt.y+P[0][1],pt=Tt.y+ut.measured.height-lt.y2+P[1][1];Mt=[[Dt,Ht],[qt,pt]]}const{position:Nt,positionAbsolute:bt}=av({nodeId:ft,nextPosition:dt,nodeLookup:B,nodeExtent:Mt||P,nodeOrigin:z,onError:L});tt=tt||ut.position.x!==Nt.x||ut.position.y!==Nt.y,ut.position=Nt,ut.internals.positionAbsolute=bt}if(x=x||tt,!!tt&&(G(u,!0),w&&(i||U||!A&&Y))){const[ft,ut]=Qd({nodeId:A,dragItems:u,nodeLookup:B});i?.(w,u,ft,ut),U?.(w,ft,ut),A||Y?.(w,ut)}}async function H(){if(!p)return;const{transform:F,panBy:Q,autoPanSpeed:B,autoPanOnNodeDrag:P}=e();if(!P){d=!1,cancelAnimationFrame(c);return}const[j,I]=uv(h,p,B);(j!==0||I!==0)&&(a.x=(a.x??0)-j/F[2],a.y=(a.y??0)-I/F[2],await Q({x:j,y:I})&&k(a)),c=requestAnimationFrame(H)}function $(F){const{nodeLookup:Q,multiSelectionActive:B,nodesDraggable:P,transform:j,snapGrid:I,snapToGrid:z,selectNodesOnDrag:U,onNodeDragStart:Y,onSelectionDragStart:L,unselectNodesAndEdges:G}=e();m=!0,(!U||!R)&&!B&&A&&(Q.get(A)?.selected||G()),R&&U&&A&&t?.(A);const tt=za(F.sourceEvent,{transform:j,snapGrid:I,snapToGrid:z,containerBounds:p});if(a=tt,u=OO(Q,P,tt,A),u.size>0&&(n||Y||!A&&L)){const[it,lt]=Qd({nodeId:A,dragItems:u,nodeLookup:Q});n?.(F.sourceEvent,u,it,lt),Y?.(F.sourceEvent,it,lt),A||L?.(F.sourceEvent,lt)}}const q=Cy().clickDistance(O).on("start",F=>{const{domNode:Q,nodeDragThreshold:B,transform:P,snapGrid:j,snapToGrid:I}=e();p=Q?.getBoundingClientRect()||null,b=!1,x=!1,w=F.sourceEvent,B===0&&$(F),a=za(F.sourceEvent,{transform:P,snapGrid:j,snapToGrid:I,containerBounds:p}),h=Yn(F.sourceEvent,p)}).on("drag",F=>{const{autoPanOnNodeDrag:Q,transform:B,snapGrid:P,snapToGrid:j,nodeDragThreshold:I,nodeLookup:z}=e(),U=za(F.sourceEvent,{transform:B,snapGrid:P,snapToGrid:j,containerBounds:p});if(w=F.sourceEvent,(F.sourceEvent.type==="touchmove"&&F.sourceEvent.touches.length>1||A&&!z.has(A))&&(b=!0),!b){if(!d&&Q&&m&&(d=!0,H()),!m){const Y=Yn(F.sourceEvent,p),L=Y.x-h.x,G=Y.y-h.y;Math.sqrt(L*L+G*G)>I&&$(F)}(a.x!==U.xSnapped||a.y!==U.ySnapped)&&u&&m&&(h=Yn(F.sourceEvent,p),k(U))}}).on("end",F=>{if(!(!m||b)&&(d=!1,m=!1,cancelAnimationFrame(c),u.size>0)){const{nodeLookup:Q,updateNodePositions:B,onNodeDragStop:P,onSelectionDragStop:j}=e();if(x&&(B(u,!1),x=!1),s||P||!A&&j){const[I,z]=Qd({nodeId:A,dragItems:u,nodeLookup:Q,dragging:!1});s?.(F.sourceEvent,u,I,z),P?.(F.sourceEvent,I,z),A||j?.(F.sourceEvent,z)}}}).filter(F=>{const Q=F.target;return!F.button&&(!D||!zv(Q,`.${D}`,C))&&(!T||zv(Q,T,C))});y.call(q)}function E(){y?.on(".drag",null)}return{update:S,destroy:E}}function zO(t,e,n){const i=[],s={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const a of e.values())ka(s,ss(a))>0&&i.push(a);return i}const VO=250;function LO(t,e,n,i){let s=[],a=1/0;const c=zO(t,n,e+VO);for(const u of c){const d=[...u.internals.handleBounds?.source??[],...u.internals.handleBounds?.target??[]];for(const h of d){if(i.nodeId===h.nodeId&&i.type===h.type&&i.id===h.id)continue;const{x:p,y:m}=Sr(u,h,h.position,!0),y=Math.sqrt(Math.pow(p-t.x,2)+Math.pow(m-t.y,2));y>e||(y<a?(s=[{...h,x:p,y:m}],a=y):y===a&&s.push({...h,x:p,y:m}))}}if(!s.length)return null;if(s.length>1){const u=i.type==="source"?"target":"source";return s.find(d=>d.type===u)??s[0]}return s[0]}function Vv(t,e,n,i,s,a=!1){const c=i.get(t);if(!c)return null;const u=s==="strict"?c.internals.handleBounds?.[e]:[...c.internals.handleBounds?.source??[],...c.internals.handleBounds?.target??[]],d=(n?u?.find(h=>h.id===n):u?.[0])??null;return d&&a?{...d,...Sr(c,d,d.position,!0)}:d}function Lv(t,e){return t||(e?.classList.contains("target")?"target":e?.classList.contains("source")?"source":null)}function IO(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const Iv=()=>!0;function BO(t,{connectionMode:e,connectionRadius:n,handleId:i,nodeId:s,edgeUpdaterType:a,isTarget:c,domNode:u,nodeLookup:d,lib:h,autoPanOnConnect:p,flowId:m,panBy:y,cancelConnection:b,onConnectStart:x,onConnect:w,onConnectEnd:S,isValidConnection:E=Iv,onReconnectEnd:D,updateConnection:T,getTransform:C,getFromHandle:R,autoPanSpeed:A,dragThreshold:O=1,handleDomNode:k}){const H=gv(t.target);let $=0,q;const{x:F,y:Q}=Yn(t),B=Lv(a,k),P=u?.getBoundingClientRect();let j=!1;if(!P||!B)return;const I=Vv(s,B,i,d,e);if(!I)return;let z=Yn(t,P),U=!1,Y=null,L=!1,G=null;function tt(){if(!p||!P)return;const[Nt,bt]=uv(z,P,A);y({x:Nt,y:bt}),$=requestAnimationFrame(tt)}const it={...I,nodeId:s,type:B,position:I.position},lt=d.get(s);let ft={inProgress:!0,isValid:null,from:Sr(lt,it,At.Left,!0),fromHandle:it,fromPosition:it.position,fromNode:lt,to:z,toHandle:null,toPosition:iv[it.position],toNode:null,pointer:z};function ut(){j=!0,T(ft),x?.(t,{nodeId:s,handleId:i,handleType:B})}O===0&&ut();function dt(Nt){if(!j){const{x:pt,y:gt}=Yn(Nt),yt=pt-F,mt=gt-Q;if(!(yt*yt+mt*mt>O*O))return;ut()}if(!R()||!it){Mt(Nt);return}const bt=C();z=Yn(Nt,P),q=LO(Da(z,bt,!1,[1,1]),n,d,it),U||(tt(),U=!0);const Tt=Bv(Nt,{handle:q,connectionMode:e,fromNodeId:s,fromHandleId:i,fromType:c?"target":"source",isValidConnection:E,doc:H,lib:h,flowId:m,nodeLookup:d});G=Tt.handleDomNode,Y=Tt.connection,L=IO(!!q,Tt.isValid);const Dt=d.get(s),qt=Dt?Sr(Dt,it,At.Left,!0):ft.from,Ht={...ft,from:qt,isValid:L,to:Tt.toHandle&&L?kc({x:Tt.toHandle.x,y:Tt.toHandle.y},bt):z,toHandle:Tt.toHandle,toPosition:L&&Tt.toHandle?Tt.toHandle.position:iv[it.position],toNode:Tt.toHandle?d.get(Tt.toHandle.nodeId):null,pointer:z};T(Ht),ft=Ht}function Mt(Nt){if(!("touches"in Nt&&Nt.touches.length>0)){if(j){(q||G)&&Y&&L&&w?.(Y);const{inProgress:bt,...Tt}=ft,Dt={...Tt,toPosition:ft.toHandle?ft.toPosition:null};S?.(Nt,Dt),a&&D?.(Nt,Dt)}b(),cancelAnimationFrame($),U=!1,L=!1,Y=null,G=null,H.removeEventListener("mousemove",dt),H.removeEventListener("mouseup",Mt),H.removeEventListener("touchmove",dt),H.removeEventListener("touchend",Mt)}}H.addEventListener("mousemove",dt),H.addEventListener("mouseup",Mt),H.addEventListener("touchmove",dt),H.addEventListener("touchend",Mt)}function Bv(t,{handle:e,connectionMode:n,fromNodeId:i,fromHandleId:s,fromType:a,doc:c,lib:u,flowId:d,isValidConnection:h=Iv,nodeLookup:p}){const m=a==="target",y=e?c.querySelector(`.${u}-flow__handle[data-id="${d}-${e?.nodeId}-${e?.id}-${e?.type}"]`):null,{x:b,y:x}=Yn(t),w=c.elementFromPoint(b,x),S=w?.classList.contains(`${u}-flow__handle`)?w:y,E={handleDomNode:S,isValid:!1,connection:null,toHandle:null};if(S){const D=Lv(void 0,S),T=S.getAttribute("data-nodeid"),C=S.getAttribute("data-handleid"),R=S.classList.contains("connectable"),A=S.classList.contains("connectableend");if(!T||!D)return E;const O={source:m?T:i,sourceHandle:m?C:s,target:m?i:T,targetHandle:m?s:C};E.connection=O;const H=R&&A&&(n===is.Strict?m&&D==="source"||!m&&D==="target":T!==i||C!==s);E.isValid=H&&h(O),E.toHandle=Vv(T,D,C,p,n,!0)}return E}const Wd={onPointerDown:BO,isValid:Bv};function PO({domNode:t,panZoom:e,getTransform:n,getViewScale:i}){const s=dn(t);function a({translateExtent:u,width:d,height:h,zoomStep:p=1,pannable:m=!0,zoomable:y=!0,inversePan:b=!1}){const x=T=>{if(T.sourceEvent.type!=="wheel"||!e)return;const C=n(),R=T.sourceEvent.ctrlKey&&ja()?10:1,A=-T.sourceEvent.deltaY*(T.sourceEvent.deltaMode===1?.05:T.sourceEvent.deltaMode?1:.002)*p,O=C[2]*Math.pow(2,A*R);e.scaleTo(O)};let w=[0,0];const S=T=>{(T.sourceEvent.type==="mousedown"||T.sourceEvent.type==="touchstart")&&(w=[T.sourceEvent.clientX??T.sourceEvent.touches[0].clientX,T.sourceEvent.clientY??T.sourceEvent.touches[0].clientY])},E=T=>{const C=n();if(T.sourceEvent.type!=="mousemove"&&T.sourceEvent.type!=="touchmove"||!e)return;const R=[T.sourceEvent.clientX??T.sourceEvent.touches[0].clientX,T.sourceEvent.clientY??T.sourceEvent.touches[0].clientY],A=[R[0]-w[0],R[1]-w[1]];w=R;const O=i()*Math.max(C[2],Math.log(C[2]))*(b?-1:1),k={x:C[0]-A[0]*O,y:C[1]-A[1]*O},H=[[0,0],[d,h]];e.setViewportConstrained({x:k.x,y:k.y,zoom:C[2]},H,u)},D=tv().on("start",S).on("zoom",m?E:null).on("zoom.wheel",y?x:null);s.call(D,{})}function c(){s.on("zoom",null)}return{update:a,destroy:c,pointer:Hn}}const Dc=t=>({x:t.x,y:t.y,zoom:t.k}),Jd=({x:t,y:e,zoom:n})=>_c.translate(t,e).scale(n),cs=(t,e)=>t.target.closest(`.${e}`),Pv=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),HO=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,th=(t,e=0,n=HO,i=()=>{})=>{const s=typeof e=="number"&&e>0;return s||i(),s?t.transition().duration(e).ease(n).on("end",i):t},Hv=t=>{const e=t.ctrlKey&&ja()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function UO({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:i,panOnScrollMode:s,panOnScrollSpeed:a,zoomOnPinch:c,onPanZoomStart:u,onPanZoom:d,onPanZoomEnd:h}){return p=>{if(cs(p,e))return p.ctrlKey&&p.preventDefault(),!1;p.preventDefault(),p.stopImmediatePropagation();const m=n.property("__zoom").k||1;if(p.ctrlKey&&c){const S=Hn(p),E=Hv(p),D=m*Math.pow(2,E);i.scaleTo(n,D,S,p);return}const y=p.deltaMode===1?20:1;let b=s===xr.Vertical?0:p.deltaX*y,x=s===xr.Horizontal?0:p.deltaY*y;!ja()&&p.shiftKey&&s!==xr.Vertical&&(b=p.deltaY*y,x=0),i.translateBy(n,-(b/m)*a,-(x/m)*a,{internal:!0});const w=Dc(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(d?.(p,w),t.panScrollTimeout=setTimeout(()=>{h?.(p,w),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,u?.(p,w))}}function $O({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(i,s){const a=i.type==="wheel",c=!e&&a&&!i.ctrlKey,u=cs(i,t);if(i.ctrlKey&&a&&u&&i.preventDefault(),c||u)return null;i.preventDefault(),n.call(this,i,s)}}function qO({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return i=>{if(i.sourceEvent?.internal)return;const s=Dc(i.transform);t.mouseButton=i.sourceEvent?.button||0,t.isZoomingOrPanning=!0,t.prevViewport=s,i.sourceEvent?.type==="mousedown"&&e(!0),n&&n?.(i.sourceEvent,s)}}function YO({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:i,onPanZoom:s}){return a=>{t.usedRightMouseButton=!!(n&&Pv(e,t.mouseButton??0)),a.sourceEvent?.sync||i([a.transform.x,a.transform.y,a.transform.k]),s&&!a.sourceEvent?.internal&&s?.(a.sourceEvent,Dc(a.transform))}}function GO({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:i,onPanZoomEnd:s,onPaneContextMenu:a}){return c=>{if(!c.sourceEvent?.internal&&(t.isZoomingOrPanning=!1,a&&Pv(e,t.mouseButton??0)&&!t.usedRightMouseButton&&c.sourceEvent&&a(c.sourceEvent),t.usedRightMouseButton=!1,i(!1),s)){const u=Dc(c.transform);t.prevViewport=u,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{s?.(c.sourceEvent,u)},n?150:0)}}}function XO({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:i,panOnScroll:s,zoomOnDoubleClick:a,userSelectionActive:c,noWheelClassName:u,noPanClassName:d,lib:h,connectionInProgress:p}){return m=>{const y=t||e,b=n&&m.ctrlKey,x=m.type==="wheel";if(m.button===1&&m.type==="mousedown"&&(cs(m,`${h}-flow__node`)||cs(m,`${h}-flow__edge`)))return!0;if(!i&&!y&&!s&&!a&&!n||c||p&&!x||cs(m,u)&&x||cs(m,d)&&(!x||s&&x&&!t)||!n&&m.ctrlKey&&x)return!1;if(!n&&m.type==="touchstart"&&m.touches?.length>1)return m.preventDefault(),!1;if(!y&&!s&&!b&&x||!i&&(m.type==="mousedown"||m.type==="touchstart")||Array.isArray(i)&&!i.includes(m.button)&&m.type==="mousedown")return!1;const w=Array.isArray(i)&&i.includes(m.button)||!m.button||m.button<=1;return(!m.ctrlKey||x)&&w}}function FO({domNode:t,minZoom:e,maxZoom:n,translateExtent:i,viewport:s,onPanZoom:a,onPanZoomStart:c,onPanZoomEnd:u,onDraggingChange:d}){const h={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},p=t.getBoundingClientRect(),m=tv().scaleExtent([e,n]).translateExtent(i),y=dn(t).call(m);D({x:s.x,y:s.y,zoom:rs(s.zoom,e,n)},[[0,0],[p.width,p.height]],i);const b=y.on("wheel.zoom"),x=y.on("dblclick.zoom");m.wheelDelta(Hv);function w(q,F){return y?new Promise(Q=>{m?.interpolate(F?.interpolate==="linear"?wa:gc).transform(th(y,F?.duration,F?.ease,()=>Q(!0)),q)}):Promise.resolve(!1)}function S({noWheelClassName:q,noPanClassName:F,onPaneContextMenu:Q,userSelectionActive:B,panOnScroll:P,panOnDrag:j,panOnScrollMode:I,panOnScrollSpeed:z,preventScrolling:U,zoomOnPinch:Y,zoomOnScroll:L,zoomOnDoubleClick:G,zoomActivationKeyPressed:tt,lib:it,onTransformChange:lt,connectionInProgress:ht,paneClickDistance:ft,selectionOnDrag:ut}){B&&!h.isZoomingOrPanning&&E();const dt=P&&!tt&&!B;m.clickDistance(ut?1/0:!qn(ft)||ft<0?0:ft);const Mt=dt?UO({zoomPanValues:h,noWheelClassName:q,d3Selection:y,d3Zoom:m,panOnScrollMode:I,panOnScrollSpeed:z,zoomOnPinch:Y,onPanZoomStart:c,onPanZoom:a,onPanZoomEnd:u}):$O({noWheelClassName:q,preventScrolling:U,d3ZoomHandler:b});if(y.on("wheel.zoom",Mt,{passive:!1}),!B){const bt=qO({zoomPanValues:h,onDraggingChange:d,onPanZoomStart:c});m.on("start",bt);const Tt=YO({zoomPanValues:h,panOnDrag:j,onPaneContextMenu:!!Q,onPanZoom:a,onTransformChange:lt});m.on("zoom",Tt);const Dt=GO({zoomPanValues:h,panOnDrag:j,panOnScroll:P,onPaneContextMenu:Q,onPanZoomEnd:u,onDraggingChange:d});m.on("end",Dt)}const Nt=XO({zoomActivationKeyPressed:tt,panOnDrag:j,zoomOnScroll:L,panOnScroll:P,zoomOnDoubleClick:G,zoomOnPinch:Y,userSelectionActive:B,noPanClassName:F,noWheelClassName:q,lib:it,connectionInProgress:ht});m.filter(Nt),G?y.on("dblclick.zoom",x):y.on("dblclick.zoom",null)}function E(){m.on("zoom",null)}async function D(q,F,Q){const B=Jd(q),P=m?.constrain()(B,F,Q);return P&&await w(P),new Promise(j=>j(P))}async function T(q,F){const Q=Jd(q);return await w(Q,F),new Promise(B=>B(Q))}function C(q){if(y){const F=Jd(q),Q=y.property("__zoom");(Q.k!==q.zoom||Q.x!==q.x||Q.y!==q.y)&&m?.transform(y,F,null,{sync:!0})}}function R(){const q=y?Wy(y.node()):{x:0,y:0,k:1};return{x:q.x,y:q.y,zoom:q.k}}function A(q,F){return y?new Promise(Q=>{m?.interpolate(F?.interpolate==="linear"?wa:gc).scaleTo(th(y,F?.duration,F?.ease,()=>Q(!0)),q)}):Promise.resolve(!1)}function O(q,F){return y?new Promise(Q=>{m?.interpolate(F?.interpolate==="linear"?wa:gc).scaleBy(th(y,F?.duration,F?.ease,()=>Q(!0)),q)}):Promise.resolve(!1)}function k(q){m?.scaleExtent(q)}function H(q){m?.translateExtent(q)}function $(q){const F=!qn(q)||q<0?0:q;m?.clickDistance(F)}return{update:S,destroy:E,setViewport:T,setViewportConstrained:D,getViewport:R,scaleTo:A,scaleBy:O,setScaleExtent:k,setTranslateExtent:H,syncViewport:C,setClickDistance:$}}var us;(function(t){t.Line="line",t.Handle="handle"})(us||(us={}));function ZO({width:t,prevWidth:e,height:n,prevHeight:i,affectsX:s,affectsY:a}){const c=t-e,u=n-i,d=[c>0?1:c<0?-1:0,u>0?1:u<0?-1:0];return c&&s&&(d[0]=d[0]*-1),u&&a&&(d[1]=d[1]*-1),d}function Uv(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),i=t.includes("left"),s=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:i,affectsY:s}}function di(t,e){return Math.max(0,e-t)}function hi(t,e){return Math.max(0,t-e)}function jc(t,e,n){return Math.max(0,e-t,t-n)}function $v(t,e){return t?!e:e}function KO(t,e,n,i,s,a,c,u){let{affectsX:d,affectsY:h}=e;const{isHorizontal:p,isVertical:m}=e,y=p&&m,{xSnapped:b,ySnapped:x}=n,{minWidth:w,maxWidth:S,minHeight:E,maxHeight:D}=i,{x:T,y:C,width:R,height:A,aspectRatio:O}=t;let k=Math.floor(p?b-t.pointerX:0),H=Math.floor(m?x-t.pointerY:0);const $=R+(d?-k:k),q=A+(h?-H:H),F=-a[0]*R,Q=-a[1]*A;let B=jc($,w,S),P=jc(q,E,D);if(c){let z=0,U=0;d&&k<0?z=di(T+k+F,c[0][0]):!d&&k>0&&(z=hi(T+$+F,c[1][0])),h&&H<0?U=di(C+H+Q,c[0][1]):!h&&H>0&&(U=hi(C+q+Q,c[1][1])),B=Math.max(B,z),P=Math.max(P,U)}if(u){let z=0,U=0;d&&k>0?z=hi(T+k,u[0][0]):!d&&k<0&&(z=di(T+$,u[1][0])),h&&H>0?U=hi(C+H,u[0][1]):!h&&H<0&&(U=di(C+q,u[1][1])),B=Math.max(B,z),P=Math.max(P,U)}if(s){if(p){const z=jc($/O,E,D)*O;if(B=Math.max(B,z),c){let U=0;!d&&!h||d&&!h&&y?U=hi(C+Q+$/O,c[1][1])*O:U=di(C+Q+(d?k:-k)/O,c[0][1])*O,B=Math.max(B,U)}if(u){let U=0;!d&&!h||d&&!h&&y?U=di(C+$/O,u[1][1])*O:U=hi(C+(d?k:-k)/O,u[0][1])*O,B=Math.max(B,U)}}if(m){const z=jc(q*O,w,S)/O;if(P=Math.max(P,z),c){let U=0;!d&&!h||h&&!d&&y?U=hi(T+q*O+F,c[1][0])/O:U=di(T+(h?H:-H)*O+F,c[0][0])/O,P=Math.max(P,U)}if(u){let U=0;!d&&!h||h&&!d&&y?U=di(T+q*O,u[1][0])/O:U=hi(T+(h?H:-H)*O,u[0][0])/O,P=Math.max(P,U)}}}H=H+(H<0?P:-P),k=k+(k<0?B:-B),s&&(y?$>q*O?H=($v(d,h)?-k:k)/O:k=($v(d,h)?-H:H)*O:p?(H=k/O,h=d):(k=H*O,d=h));const j=d?T+k:T,I=h?C+H:C;return{width:R+(d?-k:k),height:A+(h?-H:H),x:a[0]*k*(d?-1:1)+j,y:a[1]*H*(h?-1:1)+I}}const qv={width:0,height:0,x:0,y:0},QO={...qv,pointerX:0,pointerY:0,aspectRatio:1};function WO(t){return[[0,0],[t.measured.width,t.measured.height]]}function JO(t,e,n){const i=e.position.x+t.position.x,s=e.position.y+t.position.y,a=t.measured.width??0,c=t.measured.height??0,u=n[0]*a,d=n[1]*c;return[[i-u,s-d],[i+a-u,s+c-d]]}function tD({domNode:t,nodeId:e,getStoreItems:n,onChange:i,onEnd:s}){const a=dn(t);let c={controlDirection:Uv("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function u({controlPosition:h,boundaries:p,keepAspectRatio:m,resizeDirection:y,onResizeStart:b,onResize:x,onResizeEnd:w,shouldResize:S}){let E={...qv},D={...QO};c={boundaries:p,resizeDirection:y,keepAspectRatio:m,controlDirection:Uv(h)};let T,C=null,R=[],A,O,k,H=!1;const $=Cy().on("start",q=>{const{nodeLookup:F,transform:Q,snapGrid:B,snapToGrid:P,nodeOrigin:j,paneDomNode:I}=n();if(T=F.get(e),!T)return;C=I?.getBoundingClientRect()??null;const{xSnapped:z,ySnapped:U}=za(q.sourceEvent,{transform:Q,snapGrid:B,snapToGrid:P,containerBounds:C});E={width:T.measured.width??0,height:T.measured.height??0,x:T.position.x??0,y:T.position.y??0},D={...E,pointerX:z,pointerY:U,aspectRatio:E.width/E.height},A=void 0,T.parentId&&(T.extent==="parent"||T.expandParent)&&(A=F.get(T.parentId),O=A&&T.extent==="parent"?WO(A):void 0),R=[],k=void 0;for(const[Y,L]of F)if(L.parentId===e&&(R.push({id:Y,position:{...L.position},extent:L.extent}),L.extent==="parent"||L.expandParent)){const G=JO(L,T,L.origin??j);k?k=[[Math.min(G[0][0],k[0][0]),Math.min(G[0][1],k[0][1])],[Math.max(G[1][0],k[1][0]),Math.max(G[1][1],k[1][1])]]:k=G}b?.(q,{...E})}).on("drag",q=>{const{transform:F,snapGrid:Q,snapToGrid:B,nodeOrigin:P}=n(),j=za(q.sourceEvent,{transform:F,snapGrid:Q,snapToGrid:B,containerBounds:C}),I=[];if(!T)return;const{x:z,y:U,width:Y,height:L}=E,G={},tt=T.origin??P,{width:it,height:lt,x:ht,y:ft}=KO(D,c.controlDirection,j,c.boundaries,c.keepAspectRatio,tt,O,k),ut=it!==Y,dt=lt!==L,Mt=ht!==z&&ut,Nt=ft!==U&&dt;if(!Mt&&!Nt&&!ut&&!dt)return;if((Mt||Nt||tt[0]===1||tt[1]===1)&&(G.x=Mt?ht:E.x,G.y=Nt?ft:E.y,E.x=G.x,E.y=G.y,R.length>0)){const qt=ht-z,Ht=ft-U;for(const pt of R)pt.position={x:pt.position.x-qt+tt[0]*(it-Y),y:pt.position.y-Ht+tt[1]*(lt-L)},I.push(pt)}if((ut||dt)&&(G.width=ut&&(!c.resizeDirection||c.resizeDirection==="horizontal")?it:E.width,G.height=dt&&(!c.resizeDirection||c.resizeDirection==="vertical")?lt:E.height,E.width=G.width,E.height=G.height),A&&T.expandParent){const qt=tt[0]*(G.width??0);G.x&&G.x<qt&&(E.x=qt,D.x=D.x-(G.x-qt));const Ht=tt[1]*(G.height??0);G.y&&G.y<Ht&&(E.y=Ht,D.y=D.y-(G.y-Ht))}const bt=ZO({width:E.width,prevWidth:Y,height:E.height,prevHeight:L,affectsX:c.controlDirection.affectsX,affectsY:c.controlDirection.affectsY}),Tt={...E,direction:bt};S?.(q,Tt)!==!1&&(H=!0,x?.(q,Tt),i(G,I))}).on("end",q=>{H&&(w?.(q,{...E}),s?.({...E}),H=!1)});a.call($)}function d(){a.on(".drag",null)}return{update:u,destroy:d}}var eh={exports:{}},nh={},oh={exports:{}},ih={};var Yv;function eD(){if(Yv)return ih;Yv=1;var t=ha();function e(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:e,i=t.useState,s=t.useEffect,a=t.useLayoutEffect,c=t.useDebugValue;function u(m,y){var b=y(),x=i({inst:{value:b,getSnapshot:y}}),w=x[0].inst,S=x[1];return a(function(){w.value=b,w.getSnapshot=y,d(w)&&S({inst:w})},[m,b,y]),s(function(){return d(w)&&S({inst:w}),m(function(){d(w)&&S({inst:w})})},[m]),c(b),b}function d(m){var y=m.getSnapshot;m=m.value;try{var b=y();return!n(m,b)}catch{return!0}}function h(m,y){return y()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?h:u;return ih.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,ih}var Gv;function nD(){return Gv||(Gv=1,oh.exports=eD()),oh.exports}var Xv;function oD(){if(Xv)return nh;Xv=1;var t=ha(),e=nD();function n(h,p){return h===p&&(h!==0||1/h===1/p)||h!==h&&p!==p}var i=typeof Object.is=="function"?Object.is:n,s=e.useSyncExternalStore,a=t.useRef,c=t.useEffect,u=t.useMemo,d=t.useDebugValue;return nh.useSyncExternalStoreWithSelector=function(h,p,m,y,b){var x=a(null);if(x.current===null){var w={hasValue:!1,value:null};x.current=w}else w=x.current;x=u(function(){function E(A){if(!D){if(D=!0,T=A,A=y(A),b!==void 0&&w.hasValue){var O=w.value;if(b(O,A))return C=O}return C=A}if(O=C,i(T,A))return O;var k=y(A);return b!==void 0&&b(O,k)?(T=A,O):(T=A,C=k)}var D=!1,T,C,R=m===void 0?null:m;return[function(){return E(p())},R===null?void 0:function(){return E(R())}]},[p,m,y,b]);var S=s(h,x[0],x[1]);return c(function(){w.hasValue=!0,w.value=S},[S]),d(S),S},nh}var Fv;function iD(){return Fv||(Fv=1,eh.exports=oD()),eh.exports}var rD=iD();const sD=Qf(rD),aD={},Zv=t=>{let e;const n=new Set,i=(p,m)=>{const y=typeof p=="function"?p(e):p;if(!Object.is(y,e)){const b=e;e=m??(typeof y!="object"||y===null)?y:Object.assign({},e,y),n.forEach(x=>x(e,b))}},s=()=>e,d={setState:i,getState:s,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p)),destroy:()=>{(aD?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},h=e=t(i,s,d);return d},lD=t=>t?Zv(t):Zv,{useDebugValue:cD}=dr,{useSyncExternalStoreWithSelector:uD}=sD,fD=t=>t;function Kv(t,e=fD,n){const i=uD(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return cD(i),i}const Qv=(t,e)=>{const n=lD(t),i=(s,a=e)=>Kv(n,s,a);return Object.assign(i,n),i},dD=(t,e)=>t?Qv(t,e):Qv;function he(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[i,s]of t)if(!Object.is(s,e.get(i)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const i of t)if(!e.has(i))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const i of n)if(!Object.prototype.hasOwnProperty.call(e,i)||!Object.is(t[i],e[i]))return!1;return!0}var rh=k0();const hD=Qf(rh),zc=N.createContext(null),pD=zc.Provider,Wv=ho.error001();function Zt(t,e){const n=N.useContext(zc);if(n===null)throw new Error(Wv);return Kv(n,t,e)}function ce(){const t=N.useContext(zc);if(t===null)throw new Error(Wv);return N.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const Jv={display:"none"},mD={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},tb="react-flow__node-desc",eb="react-flow__edge-desc",gD="react-flow__aria-live",yD=t=>t.ariaLiveMessage,vD=t=>t.ariaLabelConfig;function bD({rfId:t}){const e=Zt(yD);return M.jsx("div",{id:`${gD}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:mD,children:e})}function xD({rfId:t,disableKeyboardA11y:e}){const n=Zt(vD);return M.jsxs(M.Fragment,{children:[M.jsx("div",{id:`${tb}-${t}`,style:Jv,children:e?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),M.jsx("div",{id:`${eb}-${t}`,style:Jv,children:n["edge.a11yDescription.default"]}),!e&&M.jsx(bD,{rfId:t})]})}const Va=N.forwardRef(({position:t="top-left",children:e,className:n,style:i,...s},a)=>{const c=`${t}`.split("-");return M.jsx("div",{className:_e(["react-flow__panel",n,...c]),style:i,ref:a,...s,children:e})});Va.displayName="Panel";function wD({proOptions:t,position:e="bottom-right"}){return t?.hideAttribution?null:M.jsx(Va,{position:e,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://pro.reactflow.dev",children:M.jsx("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const SD=t=>{const e=[],n=[];for(const[,i]of t.nodeLookup)i.selected&&e.push(i.internals.userNode);for(const[,i]of t.edgeLookup)i.selected&&n.push(i);return{selectedNodes:e,selectedEdges:n}},Vc=t=>t.id;function ED(t,e){return he(t.selectedNodes.map(Vc),e.selectedNodes.map(Vc))&&he(t.selectedEdges.map(Vc),e.selectedEdges.map(Vc))}function CD({onSelectionChange:t}){const e=ce(),{selectedNodes:n,selectedEdges:i}=Zt(SD,ED);return N.useEffect(()=>{const s={nodes:n,edges:i};t?.(s),e.getState().onSelectionChangeHandlers.forEach(a=>a(s))},[n,i,t]),null}const TD=t=>!!t.onSelectionChangeHandlers;function _D({onSelectionChange:t}){const e=Zt(TD);return t||e?M.jsx(CD,{onSelectionChange:t}):null}const nb=[0,0],ND={x:0,y:0,zoom:1},ob=[...["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],"rfId"],AD=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges}),ib={translateExtent:Na,nodeOrigin:nb,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function MD(t){const{setNodes:e,setEdges:n,setMinZoom:i,setMaxZoom:s,setTranslateExtent:a,setNodeExtent:c,reset:u,setDefaultNodesAndEdges:d}=Zt(AD,he),h=ce();N.useEffect(()=>(d(t.defaultNodes,t.defaultEdges),()=>{p.current=ib,u()}),[]);const p=N.useRef(ib);return N.useEffect(()=>{for(const m of ob){const y=t[m],b=p.current[m];y!==b&&(typeof t[m]>"u"||(m==="nodes"?e(y):m==="edges"?n(y):m==="minZoom"?i(y):m==="maxZoom"?s(y):m==="translateExtent"?a(y):m==="nodeExtent"?c(y):m==="ariaLabelConfig"?h.setState({ariaLabelConfig:dO(y)}):m==="fitView"?h.setState({fitViewQueued:y}):m==="fitViewOptions"?h.setState({fitViewOptions:y}):h.setState({[m]:y})))}p.current=t},ob.map(m=>t[m])),null}function rb(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function RD(t){const[e,n]=N.useState(t==="system"?null:t);return N.useEffect(()=>{if(t!=="system"){n(t);return}const i=rb(),s=()=>n(i?.matches?"dark":"light");return s(),i?.addEventListener("change",s),()=>{i?.removeEventListener("change",s)}},[t]),e!==null?e:rb()?.matches?"dark":"light"}const sb=typeof document<"u"?document:null;function La(t=null,e={target:sb,actInsideInputWithModifier:!0}){const[n,i]=N.useState(!1),s=N.useRef(!1),a=N.useRef(new Set([])),[c,u]=N.useMemo(()=>{if(t!==null){const h=(Array.isArray(t)?t:[t]).filter(m=>typeof m=="string").map(m=>m.replace("+",`
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,l=i.length;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-[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:i||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:[l," chars, ",s," lines"]})]})})}function Y4({data:t,selected:e}){const n=N.useRef(null),i=t.__uartText??"";N.useEffect(()=>{n.current&&(n.current.scrollTop=n.current.scrollHeight)},[i]);const s=i?i.split(`
26
- `).length:0,l=i.length;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-[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:i||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:[l," chars, ",s," lines"]})]})})}const G4=new Set(["And","Or","Not","Nand","Nor","Xor","Xnor","Buffer"]);function q4(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 X4({data:t,selected:e}){const n=t.value??!1,i=t.inputNames.map((c,u)=>({name:c,index:u,type:"input"})),s=t.outputNames.map((c,u)=>({name:c,index:u,type:"output",value:n})),l=()=>{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 q4(t.componentRef,t.arguments)}})(),d=G4.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(Xe,{inputPorts:i,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(Vr,{}),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:l()}),t.isComposite&&M.jsx("div",{className:"text-[9px] text-[var(--embed-text-muted)] italic",children:"double-click to inspect"})]})})}function F4({data:t,selected:e}){const n=typeof t.arguments?.initial=="number"?t.arguments.initial:0,i=t.inputNames.map((l,c)=>({name:l,index:c,type:"input"})),s=t.outputNames.map((l,c)=>({name:l,index:c,type:"output"}));return M.jsx(Xe,{inputPorts:i,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(Vr,{}),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 Z4({data:t,selected:e}){const n=t.arguments?.init,i=()=>n?Array.isArray(n)?`[${n.length} values]`:typeof n=="object"?`{${Object.keys(n).length} entries}`:"empty":"empty",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-[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(Vr,{}),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:i()})]})]})})}function K4({data:t,selected:e}){const n=t.arguments?.init,i=()=>n?Array.isArray(n)?`[${n.length} values]`:typeof n=="object"?`{${Object.keys(n).length} entries}`:"empty":"empty",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-[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(Vr,{}),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:i()})]})})}function Q4({data:t,selected:e}){const n=t.__nicState,i=n?.txCount??0,s=n?.rxCount??0,l=n?.draining??!1;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||"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:[i," 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"]})]}),l&&M.jsx("div",{className:"text-center text-yellow-400 font-bold",children:"TRANSMITTING"})]})]})})}const W4=[{value:"c",label:"C"},{value:"cpp",label:"C++"},{value:"rust",label:"Rust"},{value:"asm",label:"ASM"}],iw={c:`void _start() {
23
+ `)),p=h.reduce((m,y)=>m.concat(...y),[]);return[h,p]}return[[],[]]},[t]);return N.useEffect(()=>{const d=e?.target??sb,h=e?.actInsideInputWithModifier??!0;if(t!==null){const p=b=>{if(s.current=b.ctrlKey||b.metaKey||b.shiftKey||b.altKey,(!s.current||s.current&&!h)&&yv(b))return!1;const w=lb(b.code,u);if(a.current.add(b[w]),ab(c,a.current,!1)){const S=b.composedPath?.()?.[0]||b.target,E=S?.nodeName==="BUTTON"||S?.nodeName==="A";e.preventDefault!==!1&&(s.current||!E)&&b.preventDefault(),i(!0)}},m=b=>{const x=lb(b.code,u);ab(c,a.current,!0)?(i(!1),a.current.clear()):a.current.delete(b[x]),b.key==="Meta"&&a.current.clear(),s.current=!1},y=()=>{a.current.clear(),i(!1)};return d?.addEventListener("keydown",p),d?.addEventListener("keyup",m),window.addEventListener("blur",y),window.addEventListener("contextmenu",y),()=>{d?.removeEventListener("keydown",p),d?.removeEventListener("keyup",m),window.removeEventListener("blur",y),window.removeEventListener("contextmenu",y)}}},[t,i]),n}function ab(t,e,n){return t.filter(i=>n||i.length===e.size).some(i=>i.every(s=>e.has(s)))}function lb(t,e){return e.includes(t)?"code":"key"}const kD=()=>{const t=ce();return N.useMemo(()=>({zoomIn:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1.2,{duration:e?.duration}):Promise.resolve(!1)},zoomOut:e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1/1.2,{duration:e?.duration}):Promise.resolve(!1)},zoomTo:(e,n)=>{const{panZoom:i}=t.getState();return i?i.scaleTo(e,{duration:n?.duration}):Promise.resolve(!1)},getZoom:()=>t.getState().transform[2],setViewport:async(e,n)=>{const{transform:[i,s,a],panZoom:c}=t.getState();return c?(await c.setViewport({x:e.x??i,y:e.y??s,zoom:e.zoom??a},n),Promise.resolve(!0)):Promise.resolve(!1)},getViewport:()=>{const[e,n,i]=t.getState().transform;return{x:e,y:n,zoom:i}},setCenter:async(e,n,i)=>t.getState().setCenter(e,n,i),fitBounds:async(e,n)=>{const{width:i,height:s,minZoom:a,maxZoom:c,panZoom:u}=t.getState(),d=Hd(e,i,s,a,c,n?.padding??.1);return u?(await u.setViewport(d,{duration:n?.duration,ease:n?.ease,interpolate:n?.interpolate}),Promise.resolve(!0)):Promise.resolve(!1)},screenToFlowPosition:(e,n={})=>{const{transform:i,snapGrid:s,snapToGrid:a,domNode:c}=t.getState();if(!c)return e;const{x:u,y:d}=c.getBoundingClientRect(),h={x:e.x-u,y:e.y-d},p=n.snapGrid??s,m=n.snapToGrid??a;return Da(h,i,m,p)},flowToScreenPosition:e=>{const{transform:n,domNode:i}=t.getState();if(!i)return e;const{x:s,y:a}=i.getBoundingClientRect(),c=kc(e,n);return{x:c.x+s,y:c.y+a}}}),[])};function cb(t,e){const n=[],i=new Map,s=[];for(const a of t)if(a.type==="add"){s.push(a);continue}else if(a.type==="remove"||a.type==="replace")i.set(a.id,[a]);else{const c=i.get(a.id);c?c.push(a):i.set(a.id,[a])}for(const a of e){const c=i.get(a.id);if(!c){n.push(a);continue}if(c[0].type==="remove")continue;if(c[0].type==="replace"){n.push({...c[0].item});continue}const u={...a};for(const d of c)OD(d,u);n.push(u)}return s.length&&s.forEach(a=>{a.index!==void 0?n.splice(a.index,0,{...a.item}):n.push({...a.item})}),n}function OD(t,e){switch(t.type){case"select":{e.selected=t.selected;break}case"position":{typeof t.position<"u"&&(e.position=t.position),typeof t.dragging<"u"&&(e.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(e.measured={...t.dimensions},t.setAttributes&&((t.setAttributes===!0||t.setAttributes==="width")&&(e.width=t.dimensions.width),(t.setAttributes===!0||t.setAttributes==="height")&&(e.height=t.dimensions.height))),typeof t.resizing=="boolean"&&(e.resizing=t.resizing);break}}}function ub(t,e){return cb(t,e)}function DD(t,e){return cb(t,e)}function Er(t,e){return{id:t,type:"select",selected:e}}function fs(t,e=new Set,n=!1){const i=[];for(const[s,a]of t){const c=e.has(s);!(a.selected===void 0&&!c)&&a.selected!==c&&(n&&(a.selected=c),i.push(Er(a.id,c)))}return i}function fb({items:t=[],lookup:e}){const n=[],i=new Map(t.map(s=>[s.id,s]));for(const[s,a]of t.entries()){const c=e.get(a.id),u=c?.internals?.userNode??c;u!==void 0&&u!==a&&n.push({id:a.id,item:a,type:"replace"}),u===void 0&&n.push({item:a,type:"add",index:s})}for(const[s]of e)i.get(s)===void 0&&n.push({id:s,type:"remove"});return n}function db(t){return{id:t.id,type:"remove"}}const hb=t=>nO(t),jD=t=>sv(t);function pb(t){return N.forwardRef(t)}const zD=typeof window<"u"?N.useLayoutEffect:N.useEffect;function mb(t){const[e,n]=N.useState(BigInt(0)),[i]=N.useState(()=>VD(()=>n(s=>s+BigInt(1))));return zD(()=>{const s=i.get();s.length&&(t(s),i.reset())},[e]),i}function VD(t){let e=[];return{get:()=>e,reset:()=>{e=[]},push:n=>{e.push(n),t()}}}const gb=N.createContext(null);function LD({children:t}){const e=ce(),n=N.useCallback(u=>{const{nodes:d=[],setNodes:h,hasDefaultNodes:p,onNodesChange:m,nodeLookup:y,fitViewQueued:b,onNodesChangeMiddlewareMap:x}=e.getState();let w=d;for(const E of u)w=typeof E=="function"?E(w):E;let S=fb({items:w,lookup:y});for(const E of x.values())S=E(S);p&&h(w),S.length>0?m?.(S):b&&window.requestAnimationFrame(()=>{const{fitViewQueued:E,nodes:D,setNodes:T}=e.getState();E&&T(D)})},[]),i=mb(n),s=N.useCallback(u=>{const{edges:d=[],setEdges:h,hasDefaultEdges:p,onEdgesChange:m,edgeLookup:y}=e.getState();let b=d;for(const x of u)b=typeof x=="function"?x(b):x;p?h(b):m&&m(fb({items:b,lookup:y}))},[]),a=mb(s),c=N.useMemo(()=>({nodeQueue:i,edgeQueue:a}),[]);return M.jsx(gb.Provider,{value:c,children:t})}function ID(){const t=N.useContext(gb);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const BD=t=>!!t.panZoom;function Ia(){const t=kD(),e=ce(),n=ID(),i=Zt(BD),s=N.useMemo(()=>{const a=m=>e.getState().nodeLookup.get(m),c=m=>{n.nodeQueue.push(m)},u=m=>{n.edgeQueue.push(m)},d=m=>{const{nodeLookup:y,nodeOrigin:b}=e.getState(),x=hb(m)?m:y.get(m.id),w=x.parentId?pv(x.position,x.measured,x.parentId,y,b):x.position,S={...x,position:w,width:x.measured?.width??x.width,height:x.measured?.height??x.height};return ss(S)},h=(m,y,b={replace:!1})=>{c(x=>x.map(w=>{if(w.id===m){const S=typeof y=="function"?y(w):y;return b.replace&&hb(S)?S:{...w,...S}}return w}))},p=(m,y,b={replace:!1})=>{u(x=>x.map(w=>{if(w.id===m){const S=typeof y=="function"?y(w):y;return b.replace&&jD(S)?S:{...w,...S}}return w}))};return{getNodes:()=>e.getState().nodes.map(m=>({...m})),getNode:m=>a(m)?.internals.userNode,getInternalNode:a,getEdges:()=>{const{edges:m=[]}=e.getState();return m.map(y=>({...y}))},getEdge:m=>e.getState().edgeLookup.get(m),setNodes:c,setEdges:u,addNodes:m=>{const y=Array.isArray(m)?m:[m];n.nodeQueue.push(b=>[...b,...y])},addEdges:m=>{const y=Array.isArray(m)?m:[m];n.edgeQueue.push(b=>[...b,...y])},toObject:()=>{const{nodes:m=[],edges:y=[],transform:b}=e.getState(),[x,w,S]=b;return{nodes:m.map(E=>({...E})),edges:y.map(E=>({...E})),viewport:{x,y:w,zoom:S}}},deleteElements:async({nodes:m=[],edges:y=[]})=>{const{nodes:b,edges:x,onNodesDelete:w,onEdgesDelete:S,triggerNodeChanges:E,triggerEdgeChanges:D,onDelete:T,onBeforeDelete:C}=e.getState(),{nodes:R,edges:A}=await aO({nodesToRemove:m,edgesToRemove:y,nodes:b,edges:x,onBeforeDelete:C}),O=A.length>0,k=R.length>0;if(O){const H=A.map(db);S?.(A),D(H)}if(k){const H=R.map(db);w?.(R),E(H)}return(k||O)&&T?.({nodes:R,edges:A}),{deletedNodes:R,deletedEdges:A}},getIntersectingNodes:(m,y=!0,b)=>{const x=dv(m),w=x?m:d(m),S=b!==void 0;return w?(b||e.getState().nodes).filter(E=>{const D=e.getState().nodeLookup.get(E.id);if(D&&!x&&(E.id===m.id||!D.internals.positionAbsolute))return!1;const T=ss(S?E:D),C=ka(T,w);return y&&C>0||C>=T.width*T.height||C>=w.width*w.height}):[]},isNodeIntersecting:(m,y,b=!0)=>{const w=dv(m)?m:d(m);if(!w)return!1;const S=ka(w,y);return b&&S>0||S>=y.width*y.height||S>=w.width*w.height},updateNode:h,updateNodeData:(m,y,b={replace:!1})=>{h(m,x=>{const w=typeof y=="function"?y(x):y;return b.replace?{...x,data:w}:{...x,data:{...x.data,...w}}},b)},updateEdge:p,updateEdgeData:(m,y,b={replace:!1})=>{p(m,x=>{const w=typeof y=="function"?y(x):y;return b.replace?{...x,data:w}:{...x,data:{...x.data,...w}}},b)},getNodesBounds:m=>{const{nodeLookup:y,nodeOrigin:b}=e.getState();return oO(m,{nodeLookup:y,nodeOrigin:b})},getHandleConnections:({type:m,id:y,nodeId:b})=>Array.from(e.getState().connectionLookup.get(`${b}-${m}${y?`-${y}`:""}`)?.values()??[]),getNodeConnections:({type:m,handleId:y,nodeId:b})=>Array.from(e.getState().connectionLookup.get(`${b}${m?y?`-${m}-${y}`:`-${m}`:""}`)?.values()??[]),fitView:async m=>{const y=e.getState().fitViewResolver??fO();return e.setState({fitViewQueued:!0,fitViewOptions:m,fitViewResolver:y}),n.nodeQueue.push(b=>[...b]),y.promise}}},[]);return N.useMemo(()=>({...s,...t,viewportInitialized:i}),[i])}const yb=t=>t.selected,PD=typeof window<"u"?window:void 0;function HD({deleteKeyCode:t,multiSelectionKeyCode:e}){const n=ce(),{deleteElements:i}=Ia(),s=La(t,{actInsideInputWithModifier:!1}),a=La(e,{target:PD});N.useEffect(()=>{if(s){const{edges:c,nodes:u}=n.getState();i({nodes:u.filter(yb),edges:c.filter(yb)}),n.setState({nodesSelectionActive:!1})}},[s]),N.useEffect(()=>{n.setState({multiSelectionActive:a})},[a])}function UD(t){const e=ce();N.useEffect(()=>{const n=()=>{if(!t.current||!(t.current.checkVisibility?.()??!0))return!1;const i=Ud(t.current);(i.height===0||i.width===0)&&e.getState().onError?.("004",ho.error004()),e.setState({width:i.width||500,height:i.height||500})};if(t.current){n(),window.addEventListener("resize",n);const i=new ResizeObserver(()=>n());return i.observe(t.current),()=>{window.removeEventListener("resize",n),i&&t.current&&i.unobserve(t.current)}}},[])}const Lc={position:"absolute",width:"100%",height:"100%",top:0,left:0},$D=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function qD({onPaneContextMenu:t,zoomOnScroll:e=!0,zoomOnPinch:n=!0,panOnScroll:i=!1,panOnScrollSpeed:s=.5,panOnScrollMode:a=xr.Free,zoomOnDoubleClick:c=!0,panOnDrag:u=!0,defaultViewport:d,translateExtent:h,minZoom:p,maxZoom:m,zoomActivationKeyCode:y,preventScrolling:b=!0,children:x,noWheelClassName:w,noPanClassName:S,onViewportChange:E,isControlledViewport:D,paneClickDistance:T,selectionOnDrag:C}){const R=ce(),A=N.useRef(null),{userSelectionActive:O,lib:k,connectionInProgress:H}=Zt($D,he),$=La(y),q=N.useRef();UD(A);const F=N.useCallback(Q=>{E?.({x:Q[0],y:Q[1],zoom:Q[2]}),D||R.setState({transform:Q})},[E,D]);return N.useEffect(()=>{if(A.current){q.current=FO({domNode:A.current,minZoom:p,maxZoom:m,translateExtent:h,viewport:d,onDraggingChange:j=>R.setState(I=>I.paneDragging===j?I:{paneDragging:j}),onPanZoomStart:(j,I)=>{const{onViewportChangeStart:z,onMoveStart:U}=R.getState();U?.(j,I),z?.(I)},onPanZoom:(j,I)=>{const{onViewportChange:z,onMove:U}=R.getState();U?.(j,I),z?.(I)},onPanZoomEnd:(j,I)=>{const{onViewportChangeEnd:z,onMoveEnd:U}=R.getState();U?.(j,I),z?.(I)}});const{x:Q,y:B,zoom:P}=q.current.getViewport();return R.setState({panZoom:q.current,transform:[Q,B,P],domNode:A.current.closest(".react-flow")}),()=>{q.current?.destroy()}}},[]),N.useEffect(()=>{q.current?.update({onPaneContextMenu:t,zoomOnScroll:e,zoomOnPinch:n,panOnScroll:i,panOnScrollSpeed:s,panOnScrollMode:a,zoomOnDoubleClick:c,panOnDrag:u,zoomActivationKeyPressed:$,preventScrolling:b,noPanClassName:S,userSelectionActive:O,noWheelClassName:w,lib:k,onTransformChange:F,connectionInProgress:H,selectionOnDrag:C,paneClickDistance:T})},[t,e,n,i,s,a,c,u,$,b,S,O,w,k,F,H,C,T]),M.jsx("div",{className:"react-flow__renderer",ref:A,style:Lc,children:x})}const YD=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function GD(){const{userSelectionActive:t,userSelectionRect:e}=Zt(YD,he);return t&&e?M.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}const sh=(t,e)=>n=>{n.target===e.current&&t?.(n)},XD=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,connectionInProgress:t.connection.inProgress,dragging:t.paneDragging});function FD({isSelecting:t,selectionKeyPressed:e,selectionMode:n=Aa.Full,panOnDrag:i,paneClickDistance:s,selectionOnDrag:a,onSelectionStart:c,onSelectionEnd:u,onPaneClick:d,onPaneContextMenu:h,onPaneScroll:p,onPaneMouseEnter:m,onPaneMouseMove:y,onPaneMouseLeave:b,children:x}){const w=ce(),{userSelectionActive:S,elementsSelectable:E,dragging:D,connectionInProgress:T}=Zt(XD,he),C=E&&(t||S),R=N.useRef(null),A=N.useRef(),O=N.useRef(new Set),k=N.useRef(new Set),H=N.useRef(!1),$=z=>{if(H.current||T){H.current=!1;return}d?.(z),w.getState().resetSelectedElements(),w.setState({nodesSelectionActive:!1})},q=z=>{if(Array.isArray(i)&&i?.includes(2)){z.preventDefault();return}h?.(z)},F=p?z=>p(z):void 0,Q=z=>{H.current&&(z.stopPropagation(),H.current=!1)},B=z=>{const{domNode:U}=w.getState();if(A.current=U?.getBoundingClientRect(),!A.current)return;const Y=z.target===R.current;if(!Y&&!!z.target.closest(".nokey")||!t||!(a&&Y||e)||z.button!==0||!z.isPrimary)return;z.target?.setPointerCapture?.(z.pointerId),H.current=!1;const{x:tt,y:it}=Yn(z.nativeEvent,A.current);w.setState({userSelectionRect:{width:0,height:0,startX:tt,startY:it,x:tt,y:it}}),Y||(z.stopPropagation(),z.preventDefault())},P=z=>{const{userSelectionRect:U,transform:Y,nodeLookup:L,edgeLookup:G,connectionLookup:tt,triggerNodeChanges:it,triggerEdgeChanges:lt,defaultEdgeOptions:ht,resetSelectedElements:ft}=w.getState();if(!A.current||!U)return;const{x:ut,y:dt}=Yn(z.nativeEvent,A.current),{startX:Mt,startY:Nt}=U;if(!H.current){const Ht=e?0:s;if(Math.hypot(ut-Mt,dt-Nt)<=Ht)return;ft(),c?.(z)}H.current=!0;const bt={startX:Mt,startY:Nt,x:ut<Mt?ut:Mt,y:dt<Nt?dt:Nt,width:Math.abs(ut-Mt),height:Math.abs(dt-Nt)},Tt=O.current,Dt=k.current;O.current=new Set(Bd(L,bt,Y,n===Aa.Partial,!0).map(Ht=>Ht.id)),k.current=new Set;const qt=ht?.selectable??!0;for(const Ht of O.current){const pt=tt.get(Ht);if(pt)for(const{edgeId:gt}of pt.values()){const yt=G.get(gt);yt&&(yt.selectable??qt)&&k.current.add(gt)}}if(!mv(Tt,O.current)){const Ht=fs(L,O.current,!0);it(Ht)}if(!mv(Dt,k.current)){const Ht=fs(G,k.current);lt(Ht)}w.setState({userSelectionRect:bt,userSelectionActive:!0,nodesSelectionActive:!1})},j=z=>{z.button===0&&(z.target?.releasePointerCapture?.(z.pointerId),!S&&z.target===R.current&&w.getState().userSelectionRect&&$?.(z),w.setState({userSelectionActive:!1,userSelectionRect:null}),H.current&&(u?.(z),w.setState({nodesSelectionActive:O.current.size>0})))},I=i===!0||Array.isArray(i)&&i.includes(0);return M.jsxs("div",{className:_e(["react-flow__pane",{draggable:I,dragging:D,selection:t}]),onClick:C?void 0:sh($,R),onContextMenu:sh(q,R),onWheel:sh(F,R),onPointerEnter:C?void 0:m,onPointerMove:C?P:y,onPointerUp:C?j:void 0,onPointerDownCapture:C?B:void 0,onClickCapture:C?Q:void 0,onPointerLeave:b,ref:R,style:Lc,children:[x,M.jsx(GD,{})]})}function ah({id:t,store:e,unselect:n=!1,nodeRef:i}){const{addSelectedNodes:s,unselectNodesAndEdges:a,multiSelectionActive:c,nodeLookup:u,onError:d}=e.getState(),h=u.get(t);if(!h){d?.("012",ho.error012(t));return}e.setState({nodesSelectionActive:!1}),h.selected?(n||h.selected&&c)&&(a({nodes:[h],edges:[]}),requestAnimationFrame(()=>i?.current?.blur())):s([t])}function vb({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:i,nodeId:s,isSelectable:a,nodeClickDistance:c}){const u=ce(),[d,h]=N.useState(!1),p=N.useRef();return N.useEffect(()=>{p.current=jO({getStoreItems:()=>u.getState(),onNodeMouseDown:m=>{ah({id:m,store:u,nodeRef:t})},onDragStart:()=>{h(!0)},onDragStop:()=>{h(!1)}})},[]),N.useEffect(()=>{if(!(e||!t.current||!p.current))return p.current.update({noDragClassName:n,handleSelector:i,domNode:t.current,isSelectable:a,nodeId:s,nodeClickDistance:c}),()=>{p.current?.destroy()}},[n,i,e,a,t,s,c]),d}const ZD=t=>e=>e.selected&&(e.draggable||t&&typeof e.draggable>"u");function bb(){const t=ce();return N.useCallback(n=>{const{nodeExtent:i,snapToGrid:s,snapGrid:a,nodesDraggable:c,onError:u,updateNodePositions:d,nodeLookup:h,nodeOrigin:p}=t.getState(),m=new Map,y=ZD(c),b=s?a[0]:5,x=s?a[1]:5,w=n.direction.x*b*n.factor,S=n.direction.y*x*n.factor;for(const[,E]of h){if(!y(E))continue;let D={x:E.internals.positionAbsolute.x+w,y:E.internals.positionAbsolute.y+S};s&&(D=Oa(D,a));const{position:T,positionAbsolute:C}=av({nodeId:E.id,nextPosition:D,nodeLookup:h,nodeExtent:i,nodeOrigin:p,onError:u});E.position=T,E.internals.positionAbsolute=C,m.set(E.id,E)}d(m)},[])}const lh=N.createContext(null),KD=lh.Provider;lh.Consumer;const xb=()=>N.useContext(lh),QD=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),WD=(t,e,n)=>i=>{const{connectionClickStartHandle:s,connectionMode:a,connection:c}=i,{fromHandle:u,toHandle:d,isValid:h}=c,p=d?.nodeId===t&&d?.id===e&&d?.type===n;return{connectingFrom:u?.nodeId===t&&u?.id===e&&u?.type===n,connectingTo:p,clickConnecting:s?.nodeId===t&&s?.id===e&&s?.type===n,isPossibleEndHandle:a===is.Strict?u?.type!==n:t!==u?.nodeId||e!==u?.id,connectionInProcess:!!u,clickConnectionInProcess:!!s,valid:p&&h}};function JD({type:t="source",position:e=At.Top,isValidConnection:n,isConnectable:i=!0,isConnectableStart:s=!0,isConnectableEnd:a=!0,id:c,onConnect:u,children:d,className:h,onMouseDown:p,onTouchStart:m,...y},b){const x=c||null,w=t==="target",S=ce(),E=xb(),{connectOnClick:D,noPanClassName:T,rfId:C}=Zt(QD,he),{connectingFrom:R,connectingTo:A,clickConnecting:O,isPossibleEndHandle:k,connectionInProcess:H,clickConnectionInProcess:$,valid:q}=Zt(WD(E,x,t),he);E||S.getState().onError?.("010",ho.error010());const F=P=>{const{defaultEdgeOptions:j,onConnect:I,hasDefaultEdges:z}=S.getState(),U={...j,...P};if(z){const{edges:Y,setEdges:L}=S.getState();L(vO(U,Y))}I?.(U),u?.(U)},Q=P=>{if(!E)return;const j=vv(P.nativeEvent);if(s&&(j&&P.button===0||!j)){const I=S.getState();Wd.onPointerDown(P.nativeEvent,{handleDomNode:P.currentTarget,autoPanOnConnect:I.autoPanOnConnect,connectionMode:I.connectionMode,connectionRadius:I.connectionRadius,domNode:I.domNode,nodeLookup:I.nodeLookup,lib:I.lib,isTarget:w,handleId:x,nodeId:E,flowId:I.rfId,panBy:I.panBy,cancelConnection:I.cancelConnection,onConnectStart:I.onConnectStart,onConnectEnd:(...z)=>S.getState().onConnectEnd?.(...z),updateConnection:I.updateConnection,onConnect:F,isValidConnection:n||((...z)=>S.getState().isValidConnection?.(...z)??!0),getTransform:()=>S.getState().transform,getFromHandle:()=>S.getState().connection.fromHandle,autoPanSpeed:I.autoPanSpeed,dragThreshold:I.connectionDragThreshold})}j?p?.(P):m?.(P)},B=P=>{const{onClickConnectStart:j,onClickConnectEnd:I,connectionClickStartHandle:z,connectionMode:U,isValidConnection:Y,lib:L,rfId:G,nodeLookup:tt,connection:it}=S.getState();if(!E||!z&&!s)return;if(!z){j?.(P.nativeEvent,{nodeId:E,handleId:x,handleType:t}),S.setState({connectionClickStartHandle:{nodeId:E,type:t,id:x}});return}const lt=gv(P.target),ht=n||Y,{connection:ft,isValid:ut}=Wd.isValid(P.nativeEvent,{handle:{nodeId:E,id:x,type:t},connectionMode:U,fromNodeId:z.nodeId,fromHandleId:z.id||null,fromType:z.type,isValidConnection:ht,flowId:G,doc:lt,lib:L,nodeLookup:tt});ut&&ft&&F(ft);const dt=structuredClone(it);delete dt.inProgress,dt.toPosition=dt.toHandle?dt.toHandle.position:null,I?.(P,dt),S.setState({connectionClickStartHandle:null})};return M.jsx("div",{"data-handleid":x,"data-nodeid":E,"data-handlepos":e,"data-id":`${C}-${E}-${x}-${t}`,className:_e(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",T,h,{source:!w,target:w,connectable:i,connectablestart:s,connectableend:a,clickconnecting:O,connectingfrom:R,connectingto:A,valid:q,connectionindicator:i&&(!H||k)&&(H||$?a:s)}]),onMouseDown:Q,onTouchStart:Q,onClick:D?B:void 0,ref:b,...y,children:d})}const ds=N.memo(pb(JD));function t5({data:t,isConnectable:e,sourcePosition:n=At.Bottom}){return M.jsxs(M.Fragment,{children:[t?.label,M.jsx(ds,{type:"source",position:n,isConnectable:e})]})}function e5({data:t,isConnectable:e,targetPosition:n=At.Top,sourcePosition:i=At.Bottom}){return M.jsxs(M.Fragment,{children:[M.jsx(ds,{type:"target",position:n,isConnectable:e}),t?.label,M.jsx(ds,{type:"source",position:i,isConnectable:e})]})}function n5(){return null}function o5({data:t,isConnectable:e,targetPosition:n=At.Top}){return M.jsxs(M.Fragment,{children:[M.jsx(ds,{type:"target",position:n,isConnectable:e}),t?.label]})}const Ic={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},wb={input:t5,default:e5,output:o5,group:n5};function i5(t){return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??t.style?.width,height:t.height??t.initialHeight??t.style?.height}:{width:t.width??t.style?.width,height:t.height??t.style?.height}}const r5=t=>{const{width:e,height:n,x:i,y:s}=Ra(t.nodeLookup,{filter:a=>!!a.selected});return{width:qn(e)?e:null,height:qn(n)?n:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${i}px,${s}px)`}};function s5({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const i=ce(),{width:s,height:a,transformString:c,userSelectionActive:u}=Zt(r5,he),d=bb(),h=N.useRef(null);N.useEffect(()=>{n||h.current?.focus({preventScroll:!0})},[n]);const p=!u&&s!==null&&a!==null;if(vb({nodeRef:h,disabled:!p}),!p)return null;const m=t?b=>{const x=i.getState().nodes.filter(w=>w.selected);t(b,x)}:void 0,y=b=>{Object.prototype.hasOwnProperty.call(Ic,b.key)&&(b.preventDefault(),d({direction:Ic[b.key],factor:b.shiftKey?4:1}))};return M.jsx("div",{className:_e(["react-flow__nodesselection","react-flow__container",e]),style:{transform:c},children:M.jsx("div",{ref:h,className:"react-flow__nodesselection-rect",onContextMenu:m,tabIndex:n?void 0:-1,onKeyDown:n?void 0:y,style:{width:s,height:a}})})}const Sb=typeof window<"u"?window:void 0,a5=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function Eb({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:c,paneClickDistance:u,deleteKeyCode:d,selectionKeyCode:h,selectionOnDrag:p,selectionMode:m,onSelectionStart:y,onSelectionEnd:b,multiSelectionKeyCode:x,panActivationKeyCode:w,zoomActivationKeyCode:S,elementsSelectable:E,zoomOnScroll:D,zoomOnPinch:T,panOnScroll:C,panOnScrollSpeed:R,panOnScrollMode:A,zoomOnDoubleClick:O,panOnDrag:k,defaultViewport:H,translateExtent:$,minZoom:q,maxZoom:F,preventScrolling:Q,onSelectionContextMenu:B,noWheelClassName:P,noPanClassName:j,disableKeyboardA11y:I,onViewportChange:z,isControlledViewport:U}){const{nodesSelectionActive:Y,userSelectionActive:L}=Zt(a5,he),G=La(h,{target:Sb}),tt=La(w,{target:Sb}),it=tt||k,lt=tt||C,ht=p&&it!==!0,ft=G||L||ht;return HD({deleteKeyCode:d,multiSelectionKeyCode:x}),M.jsx(qD,{onPaneContextMenu:a,elementsSelectable:E,zoomOnScroll:D,zoomOnPinch:T,panOnScroll:lt,panOnScrollSpeed:R,panOnScrollMode:A,zoomOnDoubleClick:O,panOnDrag:!G&&it,defaultViewport:H,translateExtent:$,minZoom:q,maxZoom:F,zoomActivationKeyCode:S,preventScrolling:Q,noWheelClassName:P,noPanClassName:j,onViewportChange:z,isControlledViewport:U,paneClickDistance:u,selectionOnDrag:ht,children:M.jsxs(FD,{onSelectionStart:y,onSelectionEnd:b,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:i,onPaneMouseLeave:s,onPaneContextMenu:a,onPaneScroll:c,panOnDrag:it,isSelecting:!!ft,selectionMode:m,selectionKeyPressed:G,paneClickDistance:u,selectionOnDrag:ht,children:[t,Y&&M.jsx(s5,{onSelectionContextMenu:B,noPanClassName:j,disableKeyboardA11y:I})]})})}Eb.displayName="FlowRenderer";const l5=N.memo(Eb),c5=t=>e=>t?Bd(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(n=>n.id):Array.from(e.nodeLookup.keys());function u5(t){return Zt(N.useCallback(c5(t),[t]),he)}const f5=t=>t.updateNodeInternals;function d5(){const t=Zt(f5),[e]=N.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const i=new Map;n.forEach(s=>{const a=s.target.getAttribute("data-id");i.set(a,{id:a,nodeElement:s.target,force:!0})}),t(i)}));return N.useEffect(()=>()=>{e?.disconnect()},[e]),e}function h5({node:t,nodeType:e,hasDimensions:n,resizeObserver:i}){const s=ce(),a=N.useRef(null),c=N.useRef(null),u=N.useRef(t.sourcePosition),d=N.useRef(t.targetPosition),h=N.useRef(e),p=n&&!!t.internals.handleBounds;return N.useEffect(()=>{a.current&&!t.hidden&&(!p||c.current!==a.current)&&(c.current&&i?.unobserve(c.current),i?.observe(a.current),c.current=a.current)},[p,t.hidden]),N.useEffect(()=>()=>{c.current&&(i?.unobserve(c.current),c.current=null)},[]),N.useEffect(()=>{if(a.current){const m=h.current!==e,y=u.current!==t.sourcePosition,b=d.current!==t.targetPosition;(m||y||b)&&(h.current=e,u.current=t.sourcePosition,d.current=t.targetPosition,s.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:a.current,force:!0}]])))}},[t.id,e,t.sourcePosition,t.targetPosition]),a}function p5({id:t,onClick:e,onMouseEnter:n,onMouseMove:i,onMouseLeave:s,onContextMenu:a,onDoubleClick:c,nodesDraggable:u,elementsSelectable:d,nodesConnectable:h,nodesFocusable:p,resizeObserver:m,noDragClassName:y,noPanClassName:b,disableKeyboardA11y:x,rfId:w,nodeTypes:S,nodeClickDistance:E,onError:D}){const{node:T,internals:C,isParent:R}=Zt(ut=>{const dt=ut.nodeLookup.get(t),Mt=ut.parentLookup.has(t);return{node:dt,internals:dt.internals,isParent:Mt}},he);let A=T.type||"default",O=S?.[A]||wb[A];O===void 0&&(D?.("003",ho.error003(A)),A="default",O=S?.default||wb.default);const k=!!(T.draggable||u&&typeof T.draggable>"u"),H=!!(T.selectable||d&&typeof T.selectable>"u"),$=!!(T.connectable||h&&typeof T.connectable>"u"),q=!!(T.focusable||p&&typeof T.focusable>"u"),F=ce(),Q=hv(T),B=h5({node:T,nodeType:A,hasDimensions:Q,resizeObserver:m}),P=vb({nodeRef:B,disabled:T.hidden||!k,noDragClassName:y,handleSelector:T.dragHandle,nodeId:t,isSelectable:H,nodeClickDistance:E}),j=bb();if(T.hidden)return null;const I=Do(T),z=i5(T),U=H||k||e||n||i||s,Y=n?ut=>n(ut,{...C.userNode}):void 0,L=i?ut=>i(ut,{...C.userNode}):void 0,G=s?ut=>s(ut,{...C.userNode}):void 0,tt=a?ut=>a(ut,{...C.userNode}):void 0,it=c?ut=>c(ut,{...C.userNode}):void 0,lt=ut=>{const{selectNodesOnDrag:dt,nodeDragThreshold:Mt}=F.getState();H&&(!dt||!k||Mt>0)&&ah({id:t,store:F,nodeRef:B}),e&&e(ut,{...C.userNode})},ht=ut=>{if(!(yv(ut.nativeEvent)||x)){if(ev.includes(ut.key)&&H){const dt=ut.key==="Escape";ah({id:t,store:F,unselect:dt,nodeRef:B})}else if(k&&T.selected&&Object.prototype.hasOwnProperty.call(Ic,ut.key)){ut.preventDefault();const{ariaLabelConfig:dt}=F.getState();F.setState({ariaLiveMessage:dt["node.a11yDescription.ariaLiveMessage"]({direction:ut.key.replace("Arrow","").toLowerCase(),x:~~C.positionAbsolute.x,y:~~C.positionAbsolute.y})}),j({direction:Ic[ut.key],factor:ut.shiftKey?4:1})}}},ft=()=>{if(x||!B.current?.matches(":focus-visible"))return;const{transform:ut,width:dt,height:Mt,autoPanOnNodeFocus:Nt,setCenter:bt}=F.getState();if(!Nt)return;Bd(new Map([[t,T]]),{x:0,y:0,width:dt,height:Mt},ut,!0).length>0||bt(T.position.x+I.width/2,T.position.y+I.height/2,{zoom:ut[2]})};return M.jsx("div",{className:_e(["react-flow__node",`react-flow__node-${A}`,{[b]:k},T.className,{selected:T.selected,selectable:H,parent:R,draggable:k,dragging:P}]),ref:B,style:{zIndex:C.z,transform:`translate(${C.positionAbsolute.x}px,${C.positionAbsolute.y}px)`,pointerEvents:U?"all":"none",visibility:Q?"visible":"hidden",...T.style,...z},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:Y,onMouseMove:L,onMouseLeave:G,onContextMenu:tt,onClick:lt,onDoubleClick:it,onKeyDown:q?ht:void 0,tabIndex:q?0:void 0,onFocus:q?ft:void 0,role:T.ariaRole??(q?"group":void 0),"aria-roledescription":"node","aria-describedby":x?void 0:`${tb}-${w}`,"aria-label":T.ariaLabel,...T.domAttributes,children:M.jsx(KD,{value:t,children:M.jsx(O,{id:t,data:T.data,type:A,positionAbsoluteX:C.positionAbsolute.x,positionAbsoluteY:C.positionAbsolute.y,selected:T.selected??!1,selectable:H,draggable:k,deletable:T.deletable??!0,isConnectable:$,sourcePosition:T.sourcePosition,targetPosition:T.targetPosition,dragging:P,dragHandle:T.dragHandle,zIndex:C.z,parentId:T.parentId,...I})})})}var m5=N.memo(p5);const g5=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function Cb(t){const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:i,elementsSelectable:s,onError:a}=Zt(g5,he),c=u5(t.onlyRenderVisibleElements),u=d5();return M.jsx("div",{className:"react-flow__nodes",style:Lc,children:c.map(d=>M.jsx(m5,{id:d,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:u,nodesDraggable:e,nodesConnectable:n,nodesFocusable:i,elementsSelectable:s,nodeClickDistance:t.nodeClickDistance,onError:a},d))})}Cb.displayName="NodeRenderer";const y5=N.memo(Cb);function v5(t){return Zt(N.useCallback(n=>{if(!t)return n.edges.map(s=>s.id);const i=[];if(n.width&&n.height)for(const s of n.edges){const a=n.nodeLookup.get(s.source),c=n.nodeLookup.get(s.target);a&&c&&mO({sourceNode:a,targetNode:c,width:n.width,height:n.height,transform:n.transform})&&i.push(s.id)}return i},[t]),he)}const b5=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t}};return M.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},x5=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t,fill:t}};return M.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},Tb={[Nc.Arrow]:b5,[Nc.ArrowClosed]:x5};function w5(t){const e=ce();return N.useMemo(()=>Object.prototype.hasOwnProperty.call(Tb,t)?Tb[t]:(e.getState().onError?.("009",ho.error009(t)),null),[t])}const S5=({id:t,type:e,color:n,width:i=12.5,height:s=12.5,markerUnits:a="strokeWidth",strokeWidth:c,orient:u="auto-start-reverse"})=>{const d=w5(e);return d?M.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${i}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:a,orient:u,refX:"0",refY:"0",children:M.jsx(d,{color:n,strokeWidth:c})}):null},_b=({defaultColor:t,rfId:e})=>{const n=Zt(a=>a.edges),i=Zt(a=>a.defaultEdgeOptions),s=N.useMemo(()=>EO(n,{id:e,defaultColor:t,defaultMarkerStart:i?.markerStart,defaultMarkerEnd:i?.markerEnd}),[n,i,e,t]);return s.length?M.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:M.jsx("defs",{children:s.map(a=>M.jsx(S5,{id:a.id,type:a.type,color:a.color,width:a.width,height:a.height,markerUnits:a.markerUnits,strokeWidth:a.strokeWidth,orient:a.orient},a.id))})}):null};_b.displayName="MarkerDefinitions";var E5=N.memo(_b);function Nb({x:t,y:e,label:n,labelStyle:i,labelShowBg:s=!0,labelBgStyle:a,labelBgPadding:c=[2,4],labelBgBorderRadius:u=2,children:d,className:h,...p}){const[m,y]=N.useState({x:1,y:0,width:0,height:0}),b=_e(["react-flow__edge-textwrapper",h]),x=N.useRef(null);return N.useEffect(()=>{if(x.current){const w=x.current.getBBox();y({x:w.x,y:w.y,width:w.width,height:w.height})}},[n]),n?M.jsxs("g",{transform:`translate(${t-m.width/2} ${e-m.height/2})`,className:b,visibility:m.width?"visible":"hidden",...p,children:[s&&M.jsx("rect",{width:m.width+2*c[0],x:-c[0],y:-c[1],height:m.height+2*c[1],className:"react-flow__edge-textbg",style:a,rx:u,ry:u}),M.jsx("text",{className:"react-flow__edge-text",y:m.height/2,dy:"0.3em",ref:x,style:i,children:n}),d]}):null}Nb.displayName="EdgeText";const C5=N.memo(Nb);function Bc({path:t,labelX:e,labelY:n,label:i,labelStyle:s,labelShowBg:a,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d,interactionWidth:h=20,...p}){return M.jsxs(M.Fragment,{children:[M.jsx("path",{...p,d:t,fill:"none",className:_e(["react-flow__edge-path",p.className])}),h?M.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:h,className:"react-flow__edge-interaction"}):null,i&&qn(e)&&qn(n)?M.jsx(C5,{x:e,y:n,label:i,labelStyle:s,labelShowBg:a,labelBgStyle:c,labelBgPadding:u,labelBgBorderRadius:d}):null]})}function Ab({pos:t,x1:e,y1:n,x2:i,y2:s}){return t===At.Left||t===At.Right?[.5*(e+i),n]:[e,.5*(n+s)]}function Mb({sourceX:t,sourceY:e,sourcePosition:n=At.Bottom,targetX:i,targetY:s,targetPosition:a=At.Top}){const[c,u]=Ab({pos:n,x1:t,y1:e,x2:i,y2:s}),[d,h]=Ab({pos:a,x1:i,y1:s,x2:t,y2:e}),[p,m,y,b]=xv({sourceX:t,sourceY:e,targetX:i,targetY:s,sourceControlX:c,sourceControlY:u,targetControlX:d,targetControlY:h});return[`M${t},${e} C${c},${u} ${d},${h} ${i},${s}`,p,m,y,b]}function Rb(t){return N.memo(({id:e,sourceX:n,sourceY:i,targetX:s,targetY:a,sourcePosition:c,targetPosition:u,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:S,interactionWidth:E})=>{const[D,T,C]=Mb({sourceX:n,sourceY:i,sourcePosition:c,targetX:s,targetY:a,targetPosition:u}),R=t.isInternal?void 0:e;return M.jsx(Bc,{id:R,path:D,labelX:T,labelY:C,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:S,interactionWidth:E})})}const T5=Rb({isInternal:!1}),kb=Rb({isInternal:!0});T5.displayName="SimpleBezierEdge",kb.displayName="SimpleBezierEdgeInternal";function Ob(t){return N.memo(({id:e,sourceX:n,sourceY:i,targetX:s,targetY:a,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,sourcePosition:b=At.Bottom,targetPosition:x=At.Top,markerEnd:w,markerStart:S,pathOptions:E,interactionWidth:D})=>{const[T,C,R]=$d({sourceX:n,sourceY:i,sourcePosition:b,targetX:s,targetY:a,targetPosition:x,borderRadius:E?.borderRadius,offset:E?.offset,stepPosition:E?.stepPosition}),A=t.isInternal?void 0:e;return M.jsx(Bc,{id:A,path:T,labelX:C,labelY:R,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:w,markerStart:S,interactionWidth:D})})}const ch=Ob({isInternal:!1}),Db=Ob({isInternal:!0});ch.displayName="SmoothStepEdge",Db.displayName="SmoothStepEdgeInternal";function jb(t){return N.memo(({id:e,...n})=>{const i=t.isInternal?void 0:e;return M.jsx(ch,{...n,id:i,pathOptions:N.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])})})}const _5=jb({isInternal:!1}),zb=jb({isInternal:!0});_5.displayName="StepEdge",zb.displayName="StepEdgeInternal";function Vb(t){return N.memo(({id:e,sourceX:n,sourceY:i,targetX:s,targetY:a,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:x,interactionWidth:w})=>{const[S,E,D]=Cv({sourceX:n,sourceY:i,targetX:s,targetY:a}),T=t.isInternal?void 0:e;return M.jsx(Bc,{id:T,path:S,labelX:E,labelY:D,label:c,labelStyle:u,labelShowBg:d,labelBgStyle:h,labelBgPadding:p,labelBgBorderRadius:m,style:y,markerEnd:b,markerStart:x,interactionWidth:w})})}const N5=Vb({isInternal:!1}),Lb=Vb({isInternal:!0});N5.displayName="StraightEdge",Lb.displayName="StraightEdgeInternal";function Ib(t){return N.memo(({id:e,sourceX:n,sourceY:i,targetX:s,targetY:a,sourcePosition:c=At.Bottom,targetPosition:u=At.Top,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:S,pathOptions:E,interactionWidth:D})=>{const[T,C,R]=Sv({sourceX:n,sourceY:i,sourcePosition:c,targetX:s,targetY:a,targetPosition:u,curvature:E?.curvature}),A=t.isInternal?void 0:e;return M.jsx(Bc,{id:A,path:T,labelX:C,labelY:R,label:d,labelStyle:h,labelShowBg:p,labelBgStyle:m,labelBgPadding:y,labelBgBorderRadius:b,style:x,markerEnd:w,markerStart:S,interactionWidth:D})})}const A5=Ib({isInternal:!1}),Bb=Ib({isInternal:!0});A5.displayName="BezierEdge",Bb.displayName="BezierEdgeInternal";const Pb={default:Bb,straight:Lb,step:zb,smoothstep:Db,simplebezier:kb},Hb={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null},M5=(t,e,n)=>n===At.Left?t-e:n===At.Right?t+e:t,R5=(t,e,n)=>n===At.Top?t-e:n===At.Bottom?t+e:t,Ub="react-flow__edgeupdater";function $b({position:t,centerX:e,centerY:n,radius:i=10,onMouseDown:s,onMouseEnter:a,onMouseOut:c,type:u}){return M.jsx("circle",{onMouseDown:s,onMouseEnter:a,onMouseOut:c,className:_e([Ub,`${Ub}-${u}`]),cx:M5(e,i,t),cy:R5(n,i,t),r:i,stroke:"transparent",fill:"transparent"})}function k5({isReconnectable:t,reconnectRadius:e,edge:n,sourceX:i,sourceY:s,targetX:a,targetY:c,sourcePosition:u,targetPosition:d,onReconnect:h,onReconnectStart:p,onReconnectEnd:m,setReconnecting:y,setUpdateHover:b}){const x=ce(),w=(C,R)=>{if(C.button!==0)return;const{autoPanOnConnect:A,domNode:O,connectionMode:k,connectionRadius:H,lib:$,onConnectStart:q,cancelConnection:F,nodeLookup:Q,rfId:B,panBy:P,updateConnection:j}=x.getState(),I=R.type==="target",z=(L,G)=>{y(!1),m?.(L,n,R.type,G)},U=L=>h?.(n,L),Y=(L,G)=>{y(!0),p?.(C,n,R.type),q?.(L,G)};Wd.onPointerDown(C.nativeEvent,{autoPanOnConnect:A,connectionMode:k,connectionRadius:H,domNode:O,handleId:R.id,nodeId:R.nodeId,nodeLookup:Q,isTarget:I,edgeUpdaterType:R.type,lib:$,flowId:B,cancelConnection:F,panBy:P,isValidConnection:(...L)=>x.getState().isValidConnection?.(...L)??!0,onConnect:U,onConnectStart:Y,onConnectEnd:(...L)=>x.getState().onConnectEnd?.(...L),onReconnectEnd:z,updateConnection:j,getTransform:()=>x.getState().transform,getFromHandle:()=>x.getState().connection.fromHandle,dragThreshold:x.getState().connectionDragThreshold,handleDomNode:C.currentTarget})},S=C=>w(C,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),E=C=>w(C,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),D=()=>b(!0),T=()=>b(!1);return M.jsxs(M.Fragment,{children:[(t===!0||t==="source")&&M.jsx($b,{position:u,centerX:i,centerY:s,radius:e,onMouseDown:S,onMouseEnter:D,onMouseOut:T,type:"source"}),(t===!0||t==="target")&&M.jsx($b,{position:d,centerX:a,centerY:c,radius:e,onMouseDown:E,onMouseEnter:D,onMouseOut:T,type:"target"})]})}function O5({id:t,edgesFocusable:e,edgesReconnectable:n,elementsSelectable:i,onClick:s,onDoubleClick:a,onContextMenu:c,onMouseEnter:u,onMouseMove:d,onMouseLeave:h,reconnectRadius:p,onReconnect:m,onReconnectStart:y,onReconnectEnd:b,rfId:x,edgeTypes:w,noPanClassName:S,onError:E,disableKeyboardA11y:D}){let T=Zt(bt=>bt.edgeLookup.get(t));const C=Zt(bt=>bt.defaultEdgeOptions);T=C?{...C,...T}:T;let R=T.type||"default",A=w?.[R]||Pb[R];A===void 0&&(E?.("011",ho.error011(R)),R="default",A=w?.default||Pb.default);const O=!!(T.focusable||e&&typeof T.focusable>"u"),k=typeof m<"u"&&(T.reconnectable||n&&typeof T.reconnectable>"u"),H=!!(T.selectable||i&&typeof T.selectable>"u"),$=N.useRef(null),[q,F]=N.useState(!1),[Q,B]=N.useState(!1),P=ce(),{zIndex:j,sourceX:I,sourceY:z,targetX:U,targetY:Y,sourcePosition:L,targetPosition:G}=Zt(N.useCallback(bt=>{const Tt=bt.nodeLookup.get(T.source),Dt=bt.nodeLookup.get(T.target);if(!Tt||!Dt)return{zIndex:T.zIndex,...Hb};const qt=SO({id:t,sourceNode:Tt,targetNode:Dt,sourceHandle:T.sourceHandle||null,targetHandle:T.targetHandle||null,connectionMode:bt.connectionMode,onError:E});return{zIndex:pO({selected:T.selected,zIndex:T.zIndex,sourceNode:Tt,targetNode:Dt,elevateOnSelect:bt.elevateEdgesOnSelect,zIndexMode:bt.zIndexMode}),...qt||Hb}},[T.source,T.target,T.sourceHandle,T.targetHandle,T.selected,T.zIndex]),he),tt=N.useMemo(()=>T.markerStart?`url('#${qd(T.markerStart,x)}')`:void 0,[T.markerStart,x]),it=N.useMemo(()=>T.markerEnd?`url('#${qd(T.markerEnd,x)}')`:void 0,[T.markerEnd,x]);if(T.hidden||I===null||z===null||U===null||Y===null)return null;const lt=bt=>{const{addSelectedEdges:Tt,unselectNodesAndEdges:Dt,multiSelectionActive:qt}=P.getState();H&&(P.setState({nodesSelectionActive:!1}),T.selected&&qt?(Dt({nodes:[],edges:[T]}),$.current?.blur()):Tt([t])),s&&s(bt,T)},ht=a?bt=>{a(bt,{...T})}:void 0,ft=c?bt=>{c(bt,{...T})}:void 0,ut=u?bt=>{u(bt,{...T})}:void 0,dt=d?bt=>{d(bt,{...T})}:void 0,Mt=h?bt=>{h(bt,{...T})}:void 0,Nt=bt=>{if(!D&&ev.includes(bt.key)&&H){const{unselectNodesAndEdges:Tt,addSelectedEdges:Dt}=P.getState();bt.key==="Escape"?($.current?.blur(),Tt({edges:[T]})):Dt([t])}};return M.jsx("svg",{style:{zIndex:j},children:M.jsxs("g",{className:_e(["react-flow__edge",`react-flow__edge-${R}`,T.className,S,{selected:T.selected,animated:T.animated,inactive:!H&&!s,updating:q,selectable:H}]),onClick:lt,onDoubleClick:ht,onContextMenu:ft,onMouseEnter:ut,onMouseMove:dt,onMouseLeave:Mt,onKeyDown:O?Nt:void 0,tabIndex:O?0:void 0,role:T.ariaRole??(O?"group":"img"),"aria-roledescription":"edge","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":T.ariaLabel===null?void 0:T.ariaLabel||`Edge from ${T.source} to ${T.target}`,"aria-describedby":O?`${eb}-${x}`:void 0,ref:$,...T.domAttributes,children:[!Q&&M.jsx(A,{id:t,source:T.source,target:T.target,type:T.type,selected:T.selected,animated:T.animated,selectable:H,deletable:T.deletable??!0,label:T.label,labelStyle:T.labelStyle,labelShowBg:T.labelShowBg,labelBgStyle:T.labelBgStyle,labelBgPadding:T.labelBgPadding,labelBgBorderRadius:T.labelBgBorderRadius,sourceX:I,sourceY:z,targetX:U,targetY:Y,sourcePosition:L,targetPosition:G,data:T.data,style:T.style,sourceHandleId:T.sourceHandle,targetHandleId:T.targetHandle,markerStart:tt,markerEnd:it,pathOptions:"pathOptions"in T?T.pathOptions:void 0,interactionWidth:T.interactionWidth}),k&&M.jsx(k5,{edge:T,isReconnectable:k,reconnectRadius:p,onReconnect:m,onReconnectStart:y,onReconnectEnd:b,sourceX:I,sourceY:z,targetX:U,targetY:Y,sourcePosition:L,targetPosition:G,setUpdateHover:F,setReconnecting:B})]})})}var D5=N.memo(O5);const j5=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function qb({defaultMarkerColor:t,onlyRenderVisibleElements:e,rfId:n,edgeTypes:i,noPanClassName:s,onReconnect:a,onEdgeContextMenu:c,onEdgeMouseEnter:u,onEdgeMouseMove:d,onEdgeMouseLeave:h,onEdgeClick:p,reconnectRadius:m,onEdgeDoubleClick:y,onReconnectStart:b,onReconnectEnd:x,disableKeyboardA11y:w}){const{edgesFocusable:S,edgesReconnectable:E,elementsSelectable:D,onError:T}=Zt(j5,he),C=v5(e);return M.jsxs("div",{className:"react-flow__edges",children:[M.jsx(E5,{defaultColor:t,rfId:n}),C.map(R=>M.jsx(D5,{id:R,edgesFocusable:S,edgesReconnectable:E,elementsSelectable:D,noPanClassName:s,onReconnect:a,onContextMenu:c,onMouseEnter:u,onMouseMove:d,onMouseLeave:h,onClick:p,reconnectRadius:m,onDoubleClick:y,onReconnectStart:b,onReconnectEnd:x,rfId:n,onError:T,edgeTypes:i,disableKeyboardA11y:w},R))]})}qb.displayName="EdgeRenderer";const z5=N.memo(qb),V5=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function L5({children:t}){const e=Zt(V5);return M.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:e},children:t})}function I5(t){const e=Ia(),n=N.useRef(!1);N.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const B5=t=>t.panZoom?.syncViewport;function P5(t){const e=Zt(B5),n=ce();return N.useEffect(()=>{t&&(e?.(t),n.setState({transform:[t.x,t.y,t.zoom]}))},[t,e]),null}function H5(t){return t.connection.inProgress?{...t.connection,to:Da(t.connection.to,t.transform)}:{...t.connection}}function U5(t){return H5}function $5(t){const e=U5();return Zt(e,he)}const q5=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function Y5({containerStyle:t,style:e,type:n,component:i}){const{nodesConnectable:s,width:a,height:c,isValid:u,inProgress:d}=Zt(q5,he);return!(a&&s&&d)?null:M.jsx("svg",{style:t,width:a,height:c,className:"react-flow__connectionline react-flow__container",children:M.jsx("g",{className:_e(["react-flow__connection",rv(u)]),children:M.jsx(Yb,{style:e,type:n,CustomComponent:i,isValid:u})})})}const Yb=({style:t,type:e=fi.Bezier,CustomComponent:n,isValid:i})=>{const{inProgress:s,from:a,fromNode:c,fromHandle:u,fromPosition:d,to:h,toNode:p,toHandle:m,toPosition:y,pointer:b}=$5();if(!s)return;if(n)return M.jsx(n,{connectionLineType:e,connectionLineStyle:t,fromNode:c,fromHandle:u,fromX:a.x,fromY:a.y,toX:h.x,toY:h.y,fromPosition:d,toPosition:y,connectionStatus:rv(i),toNode:p,toHandle:m,pointer:b});let x="";const w={sourceX:a.x,sourceY:a.y,sourcePosition:d,targetX:h.x,targetY:h.y,targetPosition:y};switch(e){case fi.Bezier:[x]=Sv(w);break;case fi.SimpleBezier:[x]=Mb(w);break;case fi.Step:[x]=$d({...w,borderRadius:0});break;case fi.SmoothStep:[x]=$d(w);break;default:[x]=Cv(w)}return M.jsx("path",{d:x,fill:"none",className:"react-flow__connection-path",style:t})};Yb.displayName="ConnectionLine";const G5={};function Gb(t=G5){N.useRef(t),ce(),N.useEffect(()=>{},[t])}function X5(){ce(),N.useRef(!1),N.useEffect(()=>{},[])}function Xb({nodeTypes:t,edgeTypes:e,onInit:n,onNodeClick:i,onEdgeClick:s,onNodeDoubleClick:a,onEdgeDoubleClick:c,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:p,onSelectionContextMenu:m,onSelectionStart:y,onSelectionEnd:b,connectionLineType:x,connectionLineStyle:w,connectionLineComponent:S,connectionLineContainerStyle:E,selectionKeyCode:D,selectionOnDrag:T,selectionMode:C,multiSelectionKeyCode:R,panActivationKeyCode:A,zoomActivationKeyCode:O,deleteKeyCode:k,onlyRenderVisibleElements:H,elementsSelectable:$,defaultViewport:q,translateExtent:F,minZoom:Q,maxZoom:B,preventScrolling:P,defaultMarkerColor:j,zoomOnScroll:I,zoomOnPinch:z,panOnScroll:U,panOnScrollSpeed:Y,panOnScrollMode:L,zoomOnDoubleClick:G,panOnDrag:tt,onPaneClick:it,onPaneMouseEnter:lt,onPaneMouseMove:ht,onPaneMouseLeave:ft,onPaneScroll:ut,onPaneContextMenu:dt,paneClickDistance:Mt,nodeClickDistance:Nt,onEdgeContextMenu:bt,onEdgeMouseEnter:Tt,onEdgeMouseMove:Dt,onEdgeMouseLeave:qt,reconnectRadius:Ht,onReconnect:pt,onReconnectStart:gt,onReconnectEnd:yt,noDragClassName:mt,noWheelClassName:Et,noPanClassName:Vt,disableKeyboardA11y:jt,nodeExtent:zt,rfId:ue,viewport:Xt,onViewportChange:xe}){return Gb(t),Gb(e),X5(),I5(n),P5(Xt),M.jsx(l5,{onPaneClick:it,onPaneMouseEnter:lt,onPaneMouseMove:ht,onPaneMouseLeave:ft,onPaneContextMenu:dt,onPaneScroll:ut,paneClickDistance:Mt,deleteKeyCode:k,selectionKeyCode:D,selectionOnDrag:T,selectionMode:C,onSelectionStart:y,onSelectionEnd:b,multiSelectionKeyCode:R,panActivationKeyCode:A,zoomActivationKeyCode:O,elementsSelectable:$,zoomOnScroll:I,zoomOnPinch:z,zoomOnDoubleClick:G,panOnScroll:U,panOnScrollSpeed:Y,panOnScrollMode:L,panOnDrag:tt,defaultViewport:q,translateExtent:F,minZoom:Q,maxZoom:B,onSelectionContextMenu:m,preventScrolling:P,noDragClassName:mt,noWheelClassName:Et,noPanClassName:Vt,disableKeyboardA11y:jt,onViewportChange:xe,isControlledViewport:!!Xt,children:M.jsxs(L5,{children:[M.jsx(z5,{edgeTypes:e,onEdgeClick:s,onEdgeDoubleClick:c,onReconnect:pt,onReconnectStart:gt,onReconnectEnd:yt,onlyRenderVisibleElements:H,onEdgeContextMenu:bt,onEdgeMouseEnter:Tt,onEdgeMouseMove:Dt,onEdgeMouseLeave:qt,reconnectRadius:Ht,defaultMarkerColor:j,noPanClassName:Vt,disableKeyboardA11y:jt,rfId:ue}),M.jsx(Y5,{style:w,type:x,component:S,containerStyle:E}),M.jsx("div",{className:"react-flow__edgelabel-renderer"}),M.jsx(y5,{nodeTypes:t,onNodeClick:i,onNodeDoubleClick:a,onNodeMouseEnter:u,onNodeMouseMove:d,onNodeMouseLeave:h,onNodeContextMenu:p,nodeClickDistance:Nt,onlyRenderVisibleElements:H,noPanClassName:Vt,noDragClassName:mt,disableKeyboardA11y:jt,nodeExtent:zt,rfId:ue}),M.jsx("div",{className:"react-flow__viewport-portal"})]})})}Xb.displayName="GraphView";const F5=N.memo(Xb),Fb=({nodes:t,edges:e,defaultNodes:n,defaultEdges:i,width:s,height:a,fitView:c,fitViewOptions:u,minZoom:d=.5,maxZoom:h=2,nodeOrigin:p,nodeExtent:m,zIndexMode:y="basic"}={})=>{const b=new Map,x=new Map,w=new Map,S=new Map,E=i??e??[],D=n??t??[],T=p??[0,0],C=m??Na;Dv(w,S,E);const R=Fd(D,b,x,{nodeOrigin:T,nodeExtent:C,zIndexMode:y});let A=[0,0,1];if(c&&s&&a){const O=Ra(b,{filter:q=>!!((q.width||q.initialWidth)&&(q.height||q.initialHeight))}),{x:k,y:H,zoom:$}=Hd(O,s,a,d,h,u?.padding??.1);A=[k,H,$]}return{rfId:"1",width:s??0,height:a??0,transform:A,nodes:D,nodesInitialized:R,nodeLookup:b,parentLookup:x,edges:E,edgeLookup:S,connectionLookup:w,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:i!==void 0,panZoom:null,minZoom:d,maxZoom:h,translateExtent:Na,nodeExtent:C,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:is.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:T,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:c??!1,fitViewOptions:u,fitViewResolver:null,connection:{...ov},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:lO,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:nv,zIndexMode:y,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Z5=({nodes:t,edges:e,defaultNodes:n,defaultEdges:i,width:s,height:a,fitView:c,fitViewOptions:u,minZoom:d,maxZoom:h,nodeOrigin:p,nodeExtent:m,zIndexMode:y})=>dD((b,x)=>{async function w(){const{nodeLookup:S,panZoom:E,fitViewOptions:D,fitViewResolver:T,width:C,height:R,minZoom:A,maxZoom:O}=x();E&&(await sO({nodes:S,width:C,height:R,panZoom:E,minZoom:A,maxZoom:O},D),T?.resolve(!0),b({fitViewResolver:null}))}return{...Fb({nodes:t,edges:e,width:s,height:a,fitView:c,fitViewOptions:u,minZoom:d,maxZoom:h,nodeOrigin:p,nodeExtent:m,defaultNodes:n,defaultEdges:i,zIndexMode:y}),setNodes:S=>{const{nodeLookup:E,parentLookup:D,nodeOrigin:T,elevateNodesOnSelect:C,fitViewQueued:R,zIndexMode:A}=x(),O=Fd(S,E,D,{nodeOrigin:T,nodeExtent:m,elevateNodesOnSelect:C,checkEquality:!0,zIndexMode:A});R&&O?(w(),b({nodes:S,nodesInitialized:O,fitViewQueued:!1,fitViewOptions:void 0})):b({nodes:S,nodesInitialized:O})},setEdges:S=>{const{connectionLookup:E,edgeLookup:D}=x();Dv(E,D,S),b({edges:S})},setDefaultNodesAndEdges:(S,E)=>{if(S){const{setNodes:D}=x();D(S),b({hasDefaultNodes:!0})}if(E){const{setEdges:D}=x();D(E),b({hasDefaultEdges:!0})}},updateNodeInternals:S=>{const{triggerNodeChanges:E,nodeLookup:D,parentLookup:T,domNode:C,nodeOrigin:R,nodeExtent:A,debug:O,fitViewQueued:k,zIndexMode:H}=x(),{changes:$,updatedInternals:q}=RO(S,D,T,C,R,A,H);q&&(_O(D,T,{nodeOrigin:R,nodeExtent:A,zIndexMode:H}),k?(w(),b({fitViewQueued:!1,fitViewOptions:void 0})):b({}),$?.length>0&&(O&&console.log("React Flow: trigger node changes",$),E?.($)))},updateNodePositions:(S,E=!1)=>{const D=[];let T=[];const{nodeLookup:C,triggerNodeChanges:R,connection:A,updateConnection:O,onNodesChangeMiddlewareMap:k}=x();for(const[H,$]of S){const q=C.get(H),F=!!(q?.expandParent&&q?.parentId&&$?.position),Q={id:H,type:"position",position:F?{x:Math.max(0,$.position.x),y:Math.max(0,$.position.y)}:$.position,dragging:E};if(q&&A.inProgress&&A.fromNode.id===q.id){const B=Sr(q,A.fromHandle,At.Left,!0);O({...A,from:B})}F&&q.parentId&&D.push({id:H,parentId:q.parentId,rect:{...$.internals.positionAbsolute,width:$.measured.width??0,height:$.measured.height??0}}),T.push(Q)}if(D.length>0){const{parentLookup:H,nodeOrigin:$}=x(),q=Kd(D,C,H,$);T.push(...q)}for(const H of k.values())T=H(T);R(T)},triggerNodeChanges:S=>{const{onNodesChange:E,setNodes:D,nodes:T,hasDefaultNodes:C,debug:R}=x();if(S?.length){if(C){const A=ub(S,T);D(A)}R&&console.log("React Flow: trigger node changes",S),E?.(S)}},triggerEdgeChanges:S=>{const{onEdgesChange:E,setEdges:D,edges:T,hasDefaultEdges:C,debug:R}=x();if(S?.length){if(C){const A=DD(S,T);D(A)}R&&console.log("React Flow: trigger edge changes",S),E?.(S)}},addSelectedNodes:S=>{const{multiSelectionActive:E,edgeLookup:D,nodeLookup:T,triggerNodeChanges:C,triggerEdgeChanges:R}=x();if(E){const A=S.map(O=>Er(O,!0));C(A);return}C(fs(T,new Set([...S]),!0)),R(fs(D))},addSelectedEdges:S=>{const{multiSelectionActive:E,edgeLookup:D,nodeLookup:T,triggerNodeChanges:C,triggerEdgeChanges:R}=x();if(E){const A=S.map(O=>Er(O,!0));R(A);return}R(fs(D,new Set([...S]))),C(fs(T,new Set,!0))},unselectNodesAndEdges:({nodes:S,edges:E}={})=>{const{edges:D,nodes:T,nodeLookup:C,triggerNodeChanges:R,triggerEdgeChanges:A}=x(),O=S||T,k=E||D,H=[];for(const q of O){if(!q.selected)continue;const F=C.get(q.id);F&&(F.selected=!1),H.push(Er(q.id,!1))}const $=[];for(const q of k)q.selected&&$.push(Er(q.id,!1));R(H),A($)},setMinZoom:S=>{const{panZoom:E,maxZoom:D}=x();E?.setScaleExtent([S,D]),b({minZoom:S})},setMaxZoom:S=>{const{panZoom:E,minZoom:D}=x();E?.setScaleExtent([D,S]),b({maxZoom:S})},setTranslateExtent:S=>{x().panZoom?.setTranslateExtent(S),b({translateExtent:S})},resetSelectedElements:()=>{const{edges:S,nodes:E,triggerNodeChanges:D,triggerEdgeChanges:T,elementsSelectable:C}=x();if(!C)return;const R=E.reduce((O,k)=>k.selected?[...O,Er(k.id,!1)]:O,[]),A=S.reduce((O,k)=>k.selected?[...O,Er(k.id,!1)]:O,[]);D(R),T(A)},setNodeExtent:S=>{const{nodes:E,nodeLookup:D,parentLookup:T,nodeOrigin:C,elevateNodesOnSelect:R,nodeExtent:A,zIndexMode:O}=x();S[0][0]===A[0][0]&&S[0][1]===A[0][1]&&S[1][0]===A[1][0]&&S[1][1]===A[1][1]||(Fd(E,D,T,{nodeOrigin:C,nodeExtent:S,elevateNodesOnSelect:R,checkEquality:!1,zIndexMode:O}),b({nodeExtent:S}))},panBy:S=>{const{transform:E,width:D,height:T,panZoom:C,translateExtent:R}=x();return kO({delta:S,panZoom:C,transform:E,translateExtent:R,width:D,height:T})},setCenter:async(S,E,D)=>{const{width:T,height:C,maxZoom:R,panZoom:A}=x();if(!A)return Promise.resolve(!1);const O=typeof D?.zoom<"u"?D.zoom:R;return await A.setViewport({x:T/2-S*O,y:C/2-E*O,zoom:O},{duration:D?.duration,ease:D?.ease,interpolate:D?.interpolate}),Promise.resolve(!0)},cancelConnection:()=>{b({connection:{...ov}})},updateConnection:S=>{b({connection:S})},reset:()=>b({...Fb()})}},Object.is);function Zb({initialNodes:t,initialEdges:e,defaultNodes:n,defaultEdges:i,initialWidth:s,initialHeight:a,initialMinZoom:c,initialMaxZoom:u,initialFitViewOptions:d,fitView:h,nodeOrigin:p,nodeExtent:m,zIndexMode:y,children:b}){const[x]=N.useState(()=>Z5({nodes:t,edges:e,defaultNodes:n,defaultEdges:i,width:s,height:a,fitView:h,minZoom:c,maxZoom:u,fitViewOptions:d,nodeOrigin:p,nodeExtent:m,zIndexMode:y}));return M.jsx(pD,{value:x,children:M.jsx(LD,{children:b})})}function K5({children:t,nodes:e,edges:n,defaultNodes:i,defaultEdges:s,width:a,height:c,fitView:u,fitViewOptions:d,minZoom:h,maxZoom:p,nodeOrigin:m,nodeExtent:y,zIndexMode:b}){return N.useContext(zc)?M.jsx(M.Fragment,{children:t}):M.jsx(Zb,{initialNodes:e,initialEdges:n,defaultNodes:i,defaultEdges:s,initialWidth:a,initialHeight:c,fitView:u,initialFitViewOptions:d,initialMinZoom:h,initialMaxZoom:p,nodeOrigin:m,nodeExtent:y,zIndexMode:b,children:t})}const Q5={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function W5({nodes:t,edges:e,defaultNodes:n,defaultEdges:i,className:s,nodeTypes:a,edgeTypes:c,onNodeClick:u,onEdgeClick:d,onInit:h,onMove:p,onMoveStart:m,onMoveEnd:y,onConnect:b,onConnectStart:x,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:E,onNodeMouseEnter:D,onNodeMouseMove:T,onNodeMouseLeave:C,onNodeContextMenu:R,onNodeDoubleClick:A,onNodeDragStart:O,onNodeDrag:k,onNodeDragStop:H,onNodesDelete:$,onEdgesDelete:q,onDelete:F,onSelectionChange:Q,onSelectionDragStart:B,onSelectionDrag:P,onSelectionDragStop:j,onSelectionContextMenu:I,onSelectionStart:z,onSelectionEnd:U,onBeforeDelete:Y,connectionMode:L,connectionLineType:G=fi.Bezier,connectionLineStyle:tt,connectionLineComponent:it,connectionLineContainerStyle:lt,deleteKeyCode:ht="Backspace",selectionKeyCode:ft="Shift",selectionOnDrag:ut=!1,selectionMode:dt=Aa.Full,panActivationKeyCode:Mt="Space",multiSelectionKeyCode:Nt=ja()?"Meta":"Control",zoomActivationKeyCode:bt=ja()?"Meta":"Control",snapToGrid:Tt,snapGrid:Dt,onlyRenderVisibleElements:qt=!1,selectNodesOnDrag:Ht,nodesDraggable:pt,autoPanOnNodeFocus:gt,nodesConnectable:yt,nodesFocusable:mt,nodeOrigin:Et=nb,edgesFocusable:Vt,edgesReconnectable:jt,elementsSelectable:zt=!0,defaultViewport:ue=ND,minZoom:Xt=.5,maxZoom:xe=2,translateExtent:Pe=Na,preventScrolling:Po=!0,nodeExtent:Ae,defaultMarkerColor:So="#b1b1b7",zoomOnScroll:_i=!0,zoomOnPinch:pe=!0,panOnScroll:re=!1,panOnScrollSpeed:ee=.5,panOnScrollMode:Ee=xr.Free,zoomOnDoubleClick:Ni=!0,panOnDrag:Ai=!0,onPaneClick:Mi,onPaneMouseEnter:Jn,onPaneMouseMove:to,onPaneMouseLeave:Eo,onPaneScroll:mn,onPaneContextMenu:Ri,paneClickDistance:eo=1,nodeClickDistance:tn=0,children:ki,onReconnect:Ke,onReconnectStart:no,onReconnectEnd:Oi,onEdgeContextMenu:Di,onEdgeDoubleClick:ji,onEdgeMouseEnter:zi,onEdgeMouseMove:Ho,onEdgeMouseLeave:Uo,reconnectRadius:$o=10,onNodesChange:Vi,onEdgesChange:en,noDragClassName:ve="nodrag",noWheelClassName:Me="nowheel",noPanClassName:gn="nopan",fitView:Co,fitViewOptions:Li,connectOnClick:zr,attributionPosition:Ii,proOptions:oo,defaultEdgeOptions:qo,elevateNodesOnSelect:Mn=!0,elevateEdgesOnSelect:yn=!1,disableKeyboardA11y:Rn=!1,autoPanOnConnect:kn,autoPanOnNodeDrag:me,autoPanSpeed:Bi,connectionRadius:Pi,isValidConnection:vn,onError:On,style:Ds,id:Yo,nodeDragThreshold:Hi,connectionDragThreshold:Ui,viewport:He,onViewportChange:Go,width:io,height:nn,colorMode:Vu="light",debug:vm,onScroll:js,ariaLabelConfig:Lu,zIndexMode:Vr="basic",...bm},on){const Lr=Yo||"1",Iu=RD(Vu),fl=N.useCallback(Xo=>{Xo.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),js?.(Xo)},[js]);return M.jsx("div",{"data-testid":"rf__wrapper",...bm,onScroll:fl,style:{...Ds,...Q5},ref:on,className:_e(["react-flow",s,Iu]),id:Yo,role:"application",children:M.jsxs(K5,{nodes:t,edges:e,width:io,height:nn,fitView:Co,fitViewOptions:Li,minZoom:Xt,maxZoom:xe,nodeOrigin:Et,nodeExtent:Ae,zIndexMode:Vr,children:[M.jsx(F5,{onInit:h,onNodeClick:u,onEdgeClick:d,onNodeMouseEnter:D,onNodeMouseMove:T,onNodeMouseLeave:C,onNodeContextMenu:R,onNodeDoubleClick:A,nodeTypes:a,edgeTypes:c,connectionLineType:G,connectionLineStyle:tt,connectionLineComponent:it,connectionLineContainerStyle:lt,selectionKeyCode:ft,selectionOnDrag:ut,selectionMode:dt,deleteKeyCode:ht,multiSelectionKeyCode:Nt,panActivationKeyCode:Mt,zoomActivationKeyCode:bt,onlyRenderVisibleElements:qt,defaultViewport:ue,translateExtent:Pe,minZoom:Xt,maxZoom:xe,preventScrolling:Po,zoomOnScroll:_i,zoomOnPinch:pe,zoomOnDoubleClick:Ni,panOnScroll:re,panOnScrollSpeed:ee,panOnScrollMode:Ee,panOnDrag:Ai,onPaneClick:Mi,onPaneMouseEnter:Jn,onPaneMouseMove:to,onPaneMouseLeave:Eo,onPaneScroll:mn,onPaneContextMenu:Ri,paneClickDistance:eo,nodeClickDistance:tn,onSelectionContextMenu:I,onSelectionStart:z,onSelectionEnd:U,onReconnect:Ke,onReconnectStart:no,onReconnectEnd:Oi,onEdgeContextMenu:Di,onEdgeDoubleClick:ji,onEdgeMouseEnter:zi,onEdgeMouseMove:Ho,onEdgeMouseLeave:Uo,reconnectRadius:$o,defaultMarkerColor:So,noDragClassName:ve,noWheelClassName:Me,noPanClassName:gn,rfId:Lr,disableKeyboardA11y:Rn,nodeExtent:Ae,viewport:He,onViewportChange:Go}),M.jsx(MD,{nodes:t,edges:e,defaultNodes:n,defaultEdges:i,onConnect:b,onConnectStart:x,onConnectEnd:w,onClickConnectStart:S,onClickConnectEnd:E,nodesDraggable:pt,autoPanOnNodeFocus:gt,nodesConnectable:yt,nodesFocusable:mt,edgesFocusable:Vt,edgesReconnectable:jt,elementsSelectable:zt,elevateNodesOnSelect:Mn,elevateEdgesOnSelect:yn,minZoom:Xt,maxZoom:xe,nodeExtent:Ae,onNodesChange:Vi,onEdgesChange:en,snapToGrid:Tt,snapGrid:Dt,connectionMode:L,translateExtent:Pe,connectOnClick:zr,defaultEdgeOptions:qo,fitView:Co,fitViewOptions:Li,onNodesDelete:$,onEdgesDelete:q,onDelete:F,onNodeDragStart:O,onNodeDrag:k,onNodeDragStop:H,onSelectionDrag:P,onSelectionDragStart:B,onSelectionDragStop:j,onMove:p,onMoveStart:m,onMoveEnd:y,noPanClassName:gn,nodeOrigin:Et,rfId:Lr,autoPanOnConnect:kn,autoPanOnNodeDrag:me,autoPanSpeed:Bi,onError:On,connectionRadius:Pi,isValidConnection:vn,selectNodesOnDrag:Ht,nodeDragThreshold:Hi,connectionDragThreshold:Ui,onBeforeDelete:Y,debug:vm,ariaLabelConfig:Lu,zIndexMode:Vr}),M.jsx(_D,{onSelectionChange:Q}),ki,M.jsx(wD,{proOptions:oo,position:Ii}),M.jsx(xD,{rfId:Lr,disableKeyboardA11y:Rn})]})})}var J5=pb(W5);function tj(){const t=ce();return N.useCallback(e=>{const{domNode:n,updateNodeInternals:i}=t.getState(),s=Array.isArray(e)?e:[e],a=new Map;s.forEach(c=>{const u=n?.querySelector(`.react-flow__node[data-id="${c}"]`);u&&a.set(c,{id:c,nodeElement:u,force:!0})}),requestAnimationFrame(()=>i(a,{triggerFitView:!1}))},[])}function ej({dimensions:t,lineWidth:e,variant:n,className:i}){return M.jsx("path",{strokeWidth:e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:_e(["react-flow__background-pattern",n,i])})}function nj({radius:t,className:e}){return M.jsx("circle",{cx:t,cy:t,r:t,className:_e(["react-flow__background-pattern","dots",e])})}var jo;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(jo||(jo={}));const oj={[jo.Dots]:1,[jo.Lines]:1,[jo.Cross]:6},ij=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function Kb({id:t,variant:e=jo.Dots,gap:n=20,size:i,lineWidth:s=1,offset:a=0,color:c,bgColor:u,style:d,className:h,patternClassName:p}){const m=N.useRef(null),{transform:y,patternId:b}=Zt(ij,he),x=i||oj[e],w=e===jo.Dots,S=e===jo.Cross,E=Array.isArray(n)?n:[n,n],D=[E[0]*y[2]||1,E[1]*y[2]||1],T=x*y[2],C=Array.isArray(a)?a:[a,a],R=S?[T,T]:D,A=[C[0]*y[2]||1+R[0]/2,C[1]*y[2]||1+R[1]/2],O=`${b}${t||""}`;return M.jsxs("svg",{className:_e(["react-flow__background",h]),style:{...d,...Lc,"--xy-background-color-props":u,"--xy-background-pattern-color-props":c},ref:m,"data-testid":"rf__background",children:[M.jsx("pattern",{id:O,x:y[0]%D[0],y:y[1]%D[1],width:D[0],height:D[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${A[0]},-${A[1]})`,children:w?M.jsx(nj,{radius:T/2,className:p}):M.jsx(ej,{dimensions:R,lineWidth:s,variant:e,className:p})}),M.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${O})`})]})}Kb.displayName="Background";const rj=N.memo(Kb);function sj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:M.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function aj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:M.jsx("path",{d:"M0 0h32v4.2H0z"})})}function lj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:M.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function cj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:M.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function uj(){return M.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:M.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function Pc({children:t,className:e,...n}){return M.jsx("button",{type:"button",className:_e(["react-flow__controls-button",e]),...n,children:t})}const fj=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function Qb({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:i=!0,fitViewOptions:s,onZoomIn:a,onZoomOut:c,onFitView:u,onInteractiveChange:d,className:h,children:p,position:m="bottom-left",orientation:y="vertical","aria-label":b}){const x=ce(),{isInteractive:w,minZoomReached:S,maxZoomReached:E,ariaLabelConfig:D}=Zt(fj,he),{zoomIn:T,zoomOut:C,fitView:R}=Ia(),A=()=>{T(),a?.()},O=()=>{C(),c?.()},k=()=>{R(s),u?.()},H=()=>{x.setState({nodesDraggable:!w,nodesConnectable:!w,elementsSelectable:!w}),d?.(!w)},$=y==="horizontal"?"horizontal":"vertical";return M.jsxs(Va,{className:_e(["react-flow__controls",$,h]),position:m,style:t,"data-testid":"rf__controls","aria-label":b??D["controls.ariaLabel"],children:[e&&M.jsxs(M.Fragment,{children:[M.jsx(Pc,{onClick:A,className:"react-flow__controls-zoomin",title:D["controls.zoomIn.ariaLabel"],"aria-label":D["controls.zoomIn.ariaLabel"],disabled:E,children:M.jsx(sj,{})}),M.jsx(Pc,{onClick:O,className:"react-flow__controls-zoomout",title:D["controls.zoomOut.ariaLabel"],"aria-label":D["controls.zoomOut.ariaLabel"],disabled:S,children:M.jsx(aj,{})})]}),n&&M.jsx(Pc,{className:"react-flow__controls-fitview",onClick:k,title:D["controls.fitView.ariaLabel"],"aria-label":D["controls.fitView.ariaLabel"],children:M.jsx(lj,{})}),i&&M.jsx(Pc,{className:"react-flow__controls-interactive",onClick:H,title:D["controls.interactive.ariaLabel"],"aria-label":D["controls.interactive.ariaLabel"],children:w?M.jsx(uj,{}):M.jsx(cj,{})}),p]})}Qb.displayName="Controls",N.memo(Qb);function dj({id:t,x:e,y:n,width:i,height:s,style:a,color:c,strokeColor:u,strokeWidth:d,className:h,borderRadius:p,shapeRendering:m,selected:y,onClick:b}){const{background:x,backgroundColor:w}=a||{},S=c||x||w;return M.jsx("rect",{className:_e(["react-flow__minimap-node",{selected:y},h]),x:e,y:n,rx:p,ry:p,width:i,height:s,style:{fill:S,stroke:u,strokeWidth:d},shapeRendering:m,onClick:b?E=>b(E,t):void 0})}const hj=N.memo(dj),pj=t=>t.nodes.map(e=>e.id),uh=t=>t instanceof Function?t:()=>t;function mj({nodeStrokeColor:t,nodeColor:e,nodeClassName:n="",nodeBorderRadius:i=5,nodeStrokeWidth:s,nodeComponent:a=hj,onClick:c}){const u=Zt(pj,he),d=uh(e),h=uh(t),p=uh(n),m=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return M.jsx(M.Fragment,{children:u.map(y=>M.jsx(yj,{id:y,nodeColorFunc:d,nodeStrokeColorFunc:h,nodeClassNameFunc:p,nodeBorderRadius:i,nodeStrokeWidth:s,NodeComponent:a,onClick:c,shapeRendering:m},y))})}function gj({id:t,nodeColorFunc:e,nodeStrokeColorFunc:n,nodeClassNameFunc:i,nodeBorderRadius:s,nodeStrokeWidth:a,shapeRendering:c,NodeComponent:u,onClick:d}){const{node:h,x:p,y:m,width:y,height:b}=Zt(x=>{const w=x.nodeLookup.get(t);if(!w)return{node:void 0,x:0,y:0,width:0,height:0};const S=w.internals.userNode,{x:E,y:D}=w.internals.positionAbsolute,{width:T,height:C}=Do(S);return{node:S,x:E,y:D,width:T,height:C}},he);return!h||h.hidden||!hv(h)?null:M.jsx(u,{x:p,y:m,width:y,height:b,style:h.style,selected:!!h.selected,className:i(h),color:e(h),borderRadius:s,strokeColor:n(h),strokeWidth:a,shapeRendering:c,onClick:d,id:h.id})}const yj=N.memo(gj);var vj=N.memo(mj);const bj=200,xj=150,wj=t=>!t.hidden,Sj=t=>{const e={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:e,boundingRect:t.nodeLookup.size>0?fv(Ra(t.nodeLookup,{filter:wj}),e):e,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},Ej="react-flow__minimap-desc";function Wb({style:t,className:e,nodeStrokeColor:n,nodeColor:i,nodeClassName:s="",nodeBorderRadius:a=5,nodeStrokeWidth:c,nodeComponent:u,bgColor:d,maskColor:h,maskStrokeColor:p,maskStrokeWidth:m,position:y="bottom-right",onClick:b,onNodeClick:x,pannable:w=!1,zoomable:S=!1,ariaLabel:E,inversePan:D,zoomStep:T=1,offsetScale:C=5}){const R=ce(),A=N.useRef(null),{boundingRect:O,viewBB:k,rfId:H,panZoom:$,translateExtent:q,flowWidth:F,flowHeight:Q,ariaLabelConfig:B}=Zt(Sj,he),P=t?.width??bj,j=t?.height??xj,I=O.width/P,z=O.height/j,U=Math.max(I,z),Y=U*P,L=U*j,G=C*U,tt=O.x-(Y-O.width)/2-G,it=O.y-(L-O.height)/2-G,lt=Y+G*2,ht=L+G*2,ft=`${Ej}-${H}`,ut=N.useRef(0),dt=N.useRef();ut.current=U,N.useEffect(()=>{if(A.current&&$)return dt.current=PO({domNode:A.current,panZoom:$,getTransform:()=>R.getState().transform,getViewScale:()=>ut.current}),()=>{dt.current?.destroy()}},[$]),N.useEffect(()=>{dt.current?.update({translateExtent:q,width:F,height:Q,inversePan:D,pannable:w,zoomStep:T,zoomable:S})},[w,S,D,T,q,F,Q]);const Mt=b?Tt=>{const[Dt,qt]=dt.current?.pointer(Tt)||[0,0];b(Tt,{x:Dt,y:qt})}:void 0,Nt=x?N.useCallback((Tt,Dt)=>{const qt=R.getState().nodeLookup.get(Dt).internals.userNode;x(Tt,qt)},[]):void 0,bt=E??B["minimap.ariaLabel"];return M.jsx(Va,{position:y,style:{...t,"--xy-minimap-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-background-color-props":typeof h=="string"?h:void 0,"--xy-minimap-mask-stroke-color-props":typeof p=="string"?p:void 0,"--xy-minimap-mask-stroke-width-props":typeof m=="number"?m*U:void 0,"--xy-minimap-node-background-color-props":typeof i=="string"?i:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof c=="number"?c:void 0},className:_e(["react-flow__minimap",e]),"data-testid":"rf__minimap",children:M.jsxs("svg",{width:P,height:j,viewBox:`${tt} ${it} ${lt} ${ht}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ft,ref:A,onClick:Mt,children:[bt&&M.jsx("title",{id:ft,children:bt}),M.jsx(vj,{onClick:Nt,nodeColor:i,nodeStrokeColor:n,nodeBorderRadius:a,nodeClassName:s,nodeStrokeWidth:c,nodeComponent:u}),M.jsx("path",{className:"react-flow__minimap-mask",d:`M${tt-G},${it-G}h${lt+G*2}v${ht+G*2}h${-lt-G*2}z
24
+ M${k.x},${k.y}h${k.width}v${k.height}h${-k.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}Wb.displayName="MiniMap",N.memo(Wb);const Cj=t=>e=>t?`${Math.max(1/e.transform[2],1)}`:void 0,Tj={[us.Line]:"right",[us.Handle]:"bottom-right"};function _j({nodeId:t,position:e,variant:n=us.Handle,className:i,style:s=void 0,children:a,color:c,minWidth:u=10,minHeight:d=10,maxWidth:h=Number.MAX_VALUE,maxHeight:p=Number.MAX_VALUE,keepAspectRatio:m=!1,resizeDirection:y,autoScale:b=!0,shouldResize:x,onResizeStart:w,onResize:S,onResizeEnd:E}){const D=xb(),T=typeof t=="string"?t:D,C=ce(),R=N.useRef(null),A=n===us.Handle,O=Zt(N.useCallback(Cj(A&&b),[A,b]),he),k=N.useRef(null),H=e??Tj[n];N.useEffect(()=>{if(!(!R.current||!T))return k.current||(k.current=tD({domNode:R.current,nodeId:T,getStoreItems:()=>{const{nodeLookup:q,transform:F,snapGrid:Q,snapToGrid:B,nodeOrigin:P,domNode:j}=C.getState();return{nodeLookup:q,transform:F,snapGrid:Q,snapToGrid:B,nodeOrigin:P,paneDomNode:j}},onChange:(q,F)=>{const{triggerNodeChanges:Q,nodeLookup:B,parentLookup:P,nodeOrigin:j}=C.getState(),I=[],z={x:q.x,y:q.y},U=B.get(T);if(U&&U.expandParent&&U.parentId){const Y=U.origin??j,L=q.width??U.measured.width??0,G=q.height??U.measured.height??0,tt={id:U.id,parentId:U.parentId,rect:{width:L,height:G,...pv({x:q.x??U.position.x,y:q.y??U.position.y},{width:L,height:G},U.parentId,B,Y)}},it=Kd([tt],B,P,j);I.push(...it),z.x=q.x?Math.max(Y[0]*L,q.x):void 0,z.y=q.y?Math.max(Y[1]*G,q.y):void 0}if(z.x!==void 0&&z.y!==void 0){const Y={id:T,type:"position",position:{...z}};I.push(Y)}if(q.width!==void 0&&q.height!==void 0){const L={id:T,type:"dimensions",resizing:!0,setAttributes:y?y==="horizontal"?"width":"height":!0,dimensions:{width:q.width,height:q.height}};I.push(L)}for(const Y of F){const L={...Y,type:"position"};I.push(L)}Q(I)},onEnd:({width:q,height:F})=>{const Q={id:T,type:"dimensions",resizing:!1,dimensions:{width:q,height:F}};C.getState().triggerNodeChanges([Q])}})),k.current.update({controlPosition:H,boundaries:{minWidth:u,minHeight:d,maxWidth:h,maxHeight:p},keepAspectRatio:m,resizeDirection:y,onResizeStart:w,onResize:S,onResizeEnd:E,shouldResize:x}),()=>{k.current?.destroy()}},[H,u,d,h,p,m,w,S,E,x]);const $=H.split("-");return M.jsx("div",{className:_e(["react-flow__resize-control","nodrag",...$,n,i]),ref:R,style:{...s,scale:O,...c&&{[A?"backgroundColor":"borderColor"]:c}},children:a})}N.memo(_j);function Jb(t){if(t.includes("."))return Jb(t.split(".").pop()||t);const e=t.split("_");for(let n=0;n<e.length;n++)if(/^\d{10,}$/.test(e[n])){const i=e.slice(0,n);return i.length>1&&/^[A-Z]/.test(i[0])?i.slice(1).join("_")||i[0]:i.join("_")||t}return t}function Nj(t){return{...t,nodes:t.nodes.map(e=>({...e,label:Jb(e.label||e.id)}))}}function tx(t){var e,n,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=tx(t[e]))&&(i&&(i+=" "),i+=n)}else for(n in t)t[n]&&(i&&(i+=" "),i+=n);return i}function ex(){for(var t,e,n=0,i="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=tx(t))&&(i&&(i+=" "),i+=e);return i}const Aj=(t,e)=>{const n=new Array(t.length+e.length);for(let i=0;i<t.length;i++)n[i]=t[i];for(let i=0;i<e.length;i++)n[t.length+i]=e[i];return n},Mj=(t,e)=>({classGroupId:t,validator:e}),nx=(t=new Map,e=null,n)=>({nextPart:t,validators:e,classGroupId:n}),Hc="-",ox=[],Rj="arbitrary..",kj=t=>{const e=Dj(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:i}=t;return{getClassGroupId:c=>{if(c.startsWith("[")&&c.endsWith("]"))return Oj(c);const u=c.split(Hc),d=u[0]===""&&u.length>1?1:0;return ix(u,d,e)},getConflictingClassGroupIds:(c,u)=>{if(u){const d=i[c],h=n[c];return d?h?Aj(h,d):d:h||ox}return n[c]||ox}}},ix=(t,e,n)=>{if(t.length-e===0)return n.classGroupId;const s=t[e],a=n.nextPart.get(s);if(a){const h=ix(t,e+1,a);if(h)return h}const c=n.validators;if(c===null)return;const u=e===0?t.join(Hc):t.slice(e).join(Hc),d=c.length;for(let h=0;h<d;h++){const p=c[h];if(p.validator(u))return p.classGroupId}},Oj=t=>t.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const e=t.slice(1,-1),n=e.indexOf(":"),i=e.slice(0,n);return i?Rj+i:void 0})(),Dj=t=>{const{theme:e,classGroups:n}=t;return jj(n,e)},jj=(t,e)=>{const n=nx();for(const i in t){const s=t[i];fh(s,n,i,e)}return n},fh=(t,e,n,i)=>{const s=t.length;for(let a=0;a<s;a++){const c=t[a];zj(c,e,n,i)}},zj=(t,e,n,i)=>{if(typeof t=="string"){Vj(t,e,n);return}if(typeof t=="function"){Lj(t,e,n,i);return}Ij(t,e,n,i)},Vj=(t,e,n)=>{const i=t===""?e:rx(e,t);i.classGroupId=n},Lj=(t,e,n,i)=>{if(Bj(t)){fh(t(i),e,n,i);return}e.validators===null&&(e.validators=[]),e.validators.push(Mj(n,t))},Ij=(t,e,n,i)=>{const s=Object.entries(t),a=s.length;for(let c=0;c<a;c++){const[u,d]=s[c];fh(d,rx(e,u),n,i)}},rx=(t,e)=>{let n=t;const i=e.split(Hc),s=i.length;for(let a=0;a<s;a++){const c=i[a];let u=n.nextPart.get(c);u||(u=nx(),n.nextPart.set(c,u)),n=u}return n},Bj=t=>"isThemeGetter"in t&&t.isThemeGetter===!0,Pj=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=Object.create(null),i=Object.create(null);const s=(a,c)=>{n[a]=c,e++,e>t&&(e=0,i=n,n=Object.create(null))};return{get(a){let c=n[a];if(c!==void 0)return c;if((c=i[a])!==void 0)return s(a,c),c},set(a,c){a in n?n[a]=c:s(a,c)}}},dh="!",sx=":",Hj=[],ax=(t,e,n,i,s)=>({modifiers:t,hasImportantModifier:e,baseClassName:n,maybePostfixModifierPosition:i,isExternal:s}),Uj=t=>{const{prefix:e,experimentalParseClassName:n}=t;let i=s=>{const a=[];let c=0,u=0,d=0,h;const p=s.length;for(let w=0;w<p;w++){const S=s[w];if(c===0&&u===0){if(S===sx){a.push(s.slice(d,w)),d=w+1;continue}if(S==="/"){h=w;continue}}S==="["?c++:S==="]"?c--:S==="("?u++:S===")"&&u--}const m=a.length===0?s:s.slice(d);let y=m,b=!1;m.endsWith(dh)?(y=m.slice(0,-1),b=!0):m.startsWith(dh)&&(y=m.slice(1),b=!0);const x=h&&h>d?h-d:void 0;return ax(a,b,y,x)};if(e){const s=e+sx,a=i;i=c=>c.startsWith(s)?a(c.slice(s.length)):ax(Hj,!1,c,void 0,!0)}if(n){const s=i;i=a=>n({className:a,parseClassName:s})}return i},$j=t=>{const e=new Map;return t.orderSensitiveModifiers.forEach((n,i)=>{e.set(n,1e6+i)}),n=>{const i=[];let s=[];for(let a=0;a<n.length;a++){const c=n[a],u=c[0]==="[",d=e.has(c);u||d?(s.length>0&&(s.sort(),i.push(...s),s=[]),i.push(c)):s.push(c)}return s.length>0&&(s.sort(),i.push(...s)),i}},qj=t=>({cache:Pj(t.cacheSize),parseClassName:Uj(t),sortModifiers:$j(t),...kj(t)}),Yj=/\s+/,Gj=(t,e)=>{const{parseClassName:n,getClassGroupId:i,getConflictingClassGroupIds:s,sortModifiers:a}=e,c=[],u=t.trim().split(Yj);let d="";for(let h=u.length-1;h>=0;h-=1){const p=u[h],{isExternal:m,modifiers:y,hasImportantModifier:b,baseClassName:x,maybePostfixModifierPosition:w}=n(p);if(m){d=p+(d.length>0?" "+d:d);continue}let S=!!w,E=i(S?x.substring(0,w):x);if(!E){if(!S){d=p+(d.length>0?" "+d:d);continue}if(E=i(x),!E){d=p+(d.length>0?" "+d:d);continue}S=!1}const D=y.length===0?"":y.length===1?y[0]:a(y).join(":"),T=b?D+dh:D,C=T+E;if(c.indexOf(C)>-1)continue;c.push(C);const R=s(E,S);for(let A=0;A<R.length;++A){const O=R[A];c.push(T+O)}d=p+(d.length>0?" "+d:d)}return d},Xj=(...t)=>{let e=0,n,i,s="";for(;e<t.length;)(n=t[e++])&&(i=lx(n))&&(s&&(s+=" "),s+=i);return s},lx=t=>{if(typeof t=="string")return t;let e,n="";for(let i=0;i<t.length;i++)t[i]&&(e=lx(t[i]))&&(n&&(n+=" "),n+=e);return n},Fj=(t,...e)=>{let n,i,s,a;const c=d=>{const h=e.reduce((p,m)=>m(p),t());return n=qj(h),i=n.cache.get,s=n.cache.set,a=u,u(d)},u=d=>{const h=i(d);if(h)return h;const p=Gj(d,n);return s(d,p),p};return a=c,(...d)=>a(Xj(...d))},Zj=[],je=t=>{const e=n=>n[t]||Zj;return e.isThemeGetter=!0,e},cx=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,ux=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Kj=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Qj=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Wj=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Jj=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,tz=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,ez=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,pi=t=>Kj.test(t),Pt=t=>!!t&&!Number.isNaN(Number(t)),mi=t=>!!t&&Number.isInteger(Number(t)),hh=t=>t.endsWith("%")&&Pt(t.slice(0,-1)),zo=t=>Qj.test(t),fx=()=>!0,nz=t=>Wj.test(t)&&!Jj.test(t),ph=()=>!1,oz=t=>tz.test(t),iz=t=>ez.test(t),rz=t=>!wt(t)&&!Ct(t),sz=t=>gi(t,yx,ph),wt=t=>cx.test(t),Cr=t=>gi(t,vx,nz),dx=t=>gi(t,pz,Pt),az=t=>gi(t,xx,fx),lz=t=>gi(t,bx,ph),hx=t=>gi(t,mx,ph),cz=t=>gi(t,gx,iz),Uc=t=>gi(t,wx,oz),Ct=t=>ux.test(t),Ba=t=>Tr(t,vx),uz=t=>Tr(t,bx),px=t=>Tr(t,mx),fz=t=>Tr(t,yx),dz=t=>Tr(t,gx),$c=t=>Tr(t,wx,!0),hz=t=>Tr(t,xx,!0),gi=(t,e,n)=>{const i=cx.exec(t);return i?i[1]?e(i[1]):n(i[2]):!1},Tr=(t,e,n=!1)=>{const i=ux.exec(t);return i?i[1]?e(i[1]):n:!1},mx=t=>t==="position"||t==="percentage",gx=t=>t==="image"||t==="url",yx=t=>t==="length"||t==="size"||t==="bg-size",vx=t=>t==="length",pz=t=>t==="number",bx=t=>t==="family-name",xx=t=>t==="number"||t==="weight",wx=t=>t==="shadow",mz=Fj(()=>{const t=je("color"),e=je("font"),n=je("text"),i=je("font-weight"),s=je("tracking"),a=je("leading"),c=je("breakpoint"),u=je("container"),d=je("spacing"),h=je("radius"),p=je("shadow"),m=je("inset-shadow"),y=je("text-shadow"),b=je("drop-shadow"),x=je("blur"),w=je("perspective"),S=je("aspect"),E=je("ease"),D=je("animate"),T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],C=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],R=()=>[...C(),Ct,wt],A=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto","contain","none"],k=()=>[Ct,wt,d],H=()=>[pi,"full","auto",...k()],$=()=>[mi,"none","subgrid",Ct,wt],q=()=>["auto",{span:["full",mi,Ct,wt]},mi,Ct,wt],F=()=>[mi,"auto",Ct,wt],Q=()=>["auto","min","max","fr",Ct,wt],B=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],P=()=>["start","end","center","stretch","center-safe","end-safe"],j=()=>["auto",...k()],I=()=>[pi,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...k()],z=()=>[pi,"screen","full","dvw","lvw","svw","min","max","fit",...k()],U=()=>[pi,"screen","full","lh","dvh","lvh","svh","min","max","fit",...k()],Y=()=>[t,Ct,wt],L=()=>[...C(),px,hx,{position:[Ct,wt]}],G=()=>["no-repeat",{repeat:["","x","y","space","round"]}],tt=()=>["auto","cover","contain",fz,sz,{size:[Ct,wt]}],it=()=>[hh,Ba,Cr],lt=()=>["","none","full",h,Ct,wt],ht=()=>["",Pt,Ba,Cr],ft=()=>["solid","dashed","dotted","double"],ut=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],dt=()=>[Pt,hh,px,hx],Mt=()=>["","none",x,Ct,wt],Nt=()=>["none",Pt,Ct,wt],bt=()=>["none",Pt,Ct,wt],Tt=()=>[Pt,Ct,wt],Dt=()=>[pi,"full",...k()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[zo],breakpoint:[zo],color:[fx],container:[zo],"drop-shadow":[zo],ease:["in","out","in-out"],font:[rz],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[zo],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[zo],shadow:[zo],spacing:["px",Pt],text:[zo],"text-shadow":[zo],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",pi,wt,Ct,S]}],container:["container"],columns:[{columns:[Pt,wt,Ct,u]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],sr:["sr-only","not-sr-only"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:R()}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:O()}],"overscroll-x":[{"overscroll-x":O()}],"overscroll-y":[{"overscroll-y":O()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:H()}],"inset-x":[{"inset-x":H()}],"inset-y":[{"inset-y":H()}],start:[{"inset-s":H(),start:H()}],end:[{"inset-e":H(),end:H()}],"inset-bs":[{"inset-bs":H()}],"inset-be":[{"inset-be":H()}],top:[{top:H()}],right:[{right:H()}],bottom:[{bottom:H()}],left:[{left:H()}],visibility:["visible","invisible","collapse"],z:[{z:[mi,"auto",Ct,wt]}],basis:[{basis:[pi,"full","auto",u,...k()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Pt,pi,"auto","initial","none",wt]}],grow:[{grow:["",Pt,Ct,wt]}],shrink:[{shrink:["",Pt,Ct,wt]}],order:[{order:[mi,"first","last","none",Ct,wt]}],"grid-cols":[{"grid-cols":$()}],"col-start-end":[{col:q()}],"col-start":[{"col-start":F()}],"col-end":[{"col-end":F()}],"grid-rows":[{"grid-rows":$()}],"row-start-end":[{row:q()}],"row-start":[{"row-start":F()}],"row-end":[{"row-end":F()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":Q()}],"auto-rows":[{"auto-rows":Q()}],gap:[{gap:k()}],"gap-x":[{"gap-x":k()}],"gap-y":[{"gap-y":k()}],"justify-content":[{justify:[...B(),"normal"]}],"justify-items":[{"justify-items":[...P(),"normal"]}],"justify-self":[{"justify-self":["auto",...P()]}],"align-content":[{content:["normal",...B()]}],"align-items":[{items:[...P(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...P(),{baseline:["","last"]}]}],"place-content":[{"place-content":B()}],"place-items":[{"place-items":[...P(),"baseline"]}],"place-self":[{"place-self":["auto",...P()]}],p:[{p:k()}],px:[{px:k()}],py:[{py:k()}],ps:[{ps:k()}],pe:[{pe:k()}],pbs:[{pbs:k()}],pbe:[{pbe:k()}],pt:[{pt:k()}],pr:[{pr:k()}],pb:[{pb:k()}],pl:[{pl:k()}],m:[{m:j()}],mx:[{mx:j()}],my:[{my:j()}],ms:[{ms:j()}],me:[{me:j()}],mbs:[{mbs:j()}],mbe:[{mbe:j()}],mt:[{mt:j()}],mr:[{mr:j()}],mb:[{mb:j()}],ml:[{ml:j()}],"space-x":[{"space-x":k()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":k()}],"space-y-reverse":["space-y-reverse"],size:[{size:I()}],"inline-size":[{inline:["auto",...z()]}],"min-inline-size":[{"min-inline":["auto",...z()]}],"max-inline-size":[{"max-inline":["none",...z()]}],"block-size":[{block:["auto",...U()]}],"min-block-size":[{"min-block":["auto",...U()]}],"max-block-size":[{"max-block":["none",...U()]}],w:[{w:[u,"screen",...I()]}],"min-w":[{"min-w":[u,"screen","none",...I()]}],"max-w":[{"max-w":[u,"screen","none","prose",{screen:[c]},...I()]}],h:[{h:["screen","lh",...I()]}],"min-h":[{"min-h":["screen","lh","none",...I()]}],"max-h":[{"max-h":["screen","lh",...I()]}],"font-size":[{text:["base",n,Ba,Cr]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[i,hz,az]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",hh,wt]}],"font-family":[{font:[uz,lz,e]}],"font-features":[{"font-features":[wt]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:[s,Ct,wt]}],"line-clamp":[{"line-clamp":[Pt,"none",Ct,dx]}],leading:[{leading:[a,...k()]}],"list-image":[{"list-image":["none",Ct,wt]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",Ct,wt]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:Y()}],"text-color":[{text:Y()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ft(),"wavy"]}],"text-decoration-thickness":[{decoration:[Pt,"from-font","auto",Ct,Cr]}],"text-decoration-color":[{decoration:Y()}],"underline-offset":[{"underline-offset":[Pt,"auto",Ct,wt]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Ct,wt]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Ct,wt]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:L()}],"bg-repeat":[{bg:G()}],"bg-size":[{bg:tt()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},mi,Ct,wt],radial:["",Ct,wt],conic:[mi,Ct,wt]},dz,cz]}],"bg-color":[{bg:Y()}],"gradient-from-pos":[{from:it()}],"gradient-via-pos":[{via:it()}],"gradient-to-pos":[{to:it()}],"gradient-from":[{from:Y()}],"gradient-via":[{via:Y()}],"gradient-to":[{to:Y()}],rounded:[{rounded:lt()}],"rounded-s":[{"rounded-s":lt()}],"rounded-e":[{"rounded-e":lt()}],"rounded-t":[{"rounded-t":lt()}],"rounded-r":[{"rounded-r":lt()}],"rounded-b":[{"rounded-b":lt()}],"rounded-l":[{"rounded-l":lt()}],"rounded-ss":[{"rounded-ss":lt()}],"rounded-se":[{"rounded-se":lt()}],"rounded-ee":[{"rounded-ee":lt()}],"rounded-es":[{"rounded-es":lt()}],"rounded-tl":[{"rounded-tl":lt()}],"rounded-tr":[{"rounded-tr":lt()}],"rounded-br":[{"rounded-br":lt()}],"rounded-bl":[{"rounded-bl":lt()}],"border-w":[{border:ht()}],"border-w-x":[{"border-x":ht()}],"border-w-y":[{"border-y":ht()}],"border-w-s":[{"border-s":ht()}],"border-w-e":[{"border-e":ht()}],"border-w-bs":[{"border-bs":ht()}],"border-w-be":[{"border-be":ht()}],"border-w-t":[{"border-t":ht()}],"border-w-r":[{"border-r":ht()}],"border-w-b":[{"border-b":ht()}],"border-w-l":[{"border-l":ht()}],"divide-x":[{"divide-x":ht()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":ht()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...ft(),"hidden","none"]}],"divide-style":[{divide:[...ft(),"hidden","none"]}],"border-color":[{border:Y()}],"border-color-x":[{"border-x":Y()}],"border-color-y":[{"border-y":Y()}],"border-color-s":[{"border-s":Y()}],"border-color-e":[{"border-e":Y()}],"border-color-bs":[{"border-bs":Y()}],"border-color-be":[{"border-be":Y()}],"border-color-t":[{"border-t":Y()}],"border-color-r":[{"border-r":Y()}],"border-color-b":[{"border-b":Y()}],"border-color-l":[{"border-l":Y()}],"divide-color":[{divide:Y()}],"outline-style":[{outline:[...ft(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Pt,Ct,wt]}],"outline-w":[{outline:["",Pt,Ba,Cr]}],"outline-color":[{outline:Y()}],shadow:[{shadow:["","none",p,$c,Uc]}],"shadow-color":[{shadow:Y()}],"inset-shadow":[{"inset-shadow":["none",m,$c,Uc]}],"inset-shadow-color":[{"inset-shadow":Y()}],"ring-w":[{ring:ht()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:Y()}],"ring-offset-w":[{"ring-offset":[Pt,Cr]}],"ring-offset-color":[{"ring-offset":Y()}],"inset-ring-w":[{"inset-ring":ht()}],"inset-ring-color":[{"inset-ring":Y()}],"text-shadow":[{"text-shadow":["none",y,$c,Uc]}],"text-shadow-color":[{"text-shadow":Y()}],opacity:[{opacity:[Pt,Ct,wt]}],"mix-blend":[{"mix-blend":[...ut(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":ut()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Pt]}],"mask-image-linear-from-pos":[{"mask-linear-from":dt()}],"mask-image-linear-to-pos":[{"mask-linear-to":dt()}],"mask-image-linear-from-color":[{"mask-linear-from":Y()}],"mask-image-linear-to-color":[{"mask-linear-to":Y()}],"mask-image-t-from-pos":[{"mask-t-from":dt()}],"mask-image-t-to-pos":[{"mask-t-to":dt()}],"mask-image-t-from-color":[{"mask-t-from":Y()}],"mask-image-t-to-color":[{"mask-t-to":Y()}],"mask-image-r-from-pos":[{"mask-r-from":dt()}],"mask-image-r-to-pos":[{"mask-r-to":dt()}],"mask-image-r-from-color":[{"mask-r-from":Y()}],"mask-image-r-to-color":[{"mask-r-to":Y()}],"mask-image-b-from-pos":[{"mask-b-from":dt()}],"mask-image-b-to-pos":[{"mask-b-to":dt()}],"mask-image-b-from-color":[{"mask-b-from":Y()}],"mask-image-b-to-color":[{"mask-b-to":Y()}],"mask-image-l-from-pos":[{"mask-l-from":dt()}],"mask-image-l-to-pos":[{"mask-l-to":dt()}],"mask-image-l-from-color":[{"mask-l-from":Y()}],"mask-image-l-to-color":[{"mask-l-to":Y()}],"mask-image-x-from-pos":[{"mask-x-from":dt()}],"mask-image-x-to-pos":[{"mask-x-to":dt()}],"mask-image-x-from-color":[{"mask-x-from":Y()}],"mask-image-x-to-color":[{"mask-x-to":Y()}],"mask-image-y-from-pos":[{"mask-y-from":dt()}],"mask-image-y-to-pos":[{"mask-y-to":dt()}],"mask-image-y-from-color":[{"mask-y-from":Y()}],"mask-image-y-to-color":[{"mask-y-to":Y()}],"mask-image-radial":[{"mask-radial":[Ct,wt]}],"mask-image-radial-from-pos":[{"mask-radial-from":dt()}],"mask-image-radial-to-pos":[{"mask-radial-to":dt()}],"mask-image-radial-from-color":[{"mask-radial-from":Y()}],"mask-image-radial-to-color":[{"mask-radial-to":Y()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":C()}],"mask-image-conic-pos":[{"mask-conic":[Pt]}],"mask-image-conic-from-pos":[{"mask-conic-from":dt()}],"mask-image-conic-to-pos":[{"mask-conic-to":dt()}],"mask-image-conic-from-color":[{"mask-conic-from":Y()}],"mask-image-conic-to-color":[{"mask-conic-to":Y()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:L()}],"mask-repeat":[{mask:G()}],"mask-size":[{mask:tt()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",Ct,wt]}],filter:[{filter:["","none",Ct,wt]}],blur:[{blur:Mt()}],brightness:[{brightness:[Pt,Ct,wt]}],contrast:[{contrast:[Pt,Ct,wt]}],"drop-shadow":[{"drop-shadow":["","none",b,$c,Uc]}],"drop-shadow-color":[{"drop-shadow":Y()}],grayscale:[{grayscale:["",Pt,Ct,wt]}],"hue-rotate":[{"hue-rotate":[Pt,Ct,wt]}],invert:[{invert:["",Pt,Ct,wt]}],saturate:[{saturate:[Pt,Ct,wt]}],sepia:[{sepia:["",Pt,Ct,wt]}],"backdrop-filter":[{"backdrop-filter":["","none",Ct,wt]}],"backdrop-blur":[{"backdrop-blur":Mt()}],"backdrop-brightness":[{"backdrop-brightness":[Pt,Ct,wt]}],"backdrop-contrast":[{"backdrop-contrast":[Pt,Ct,wt]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Pt,Ct,wt]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Pt,Ct,wt]}],"backdrop-invert":[{"backdrop-invert":["",Pt,Ct,wt]}],"backdrop-opacity":[{"backdrop-opacity":[Pt,Ct,wt]}],"backdrop-saturate":[{"backdrop-saturate":[Pt,Ct,wt]}],"backdrop-sepia":[{"backdrop-sepia":["",Pt,Ct,wt]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":k()}],"border-spacing-x":[{"border-spacing-x":k()}],"border-spacing-y":[{"border-spacing-y":k()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",Ct,wt]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Pt,"initial",Ct,wt]}],ease:[{ease:["linear","initial",E,Ct,wt]}],delay:[{delay:[Pt,Ct,wt]}],animate:[{animate:["none",D,Ct,wt]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[w,Ct,wt]}],"perspective-origin":[{"perspective-origin":R()}],rotate:[{rotate:Nt()}],"rotate-x":[{"rotate-x":Nt()}],"rotate-y":[{"rotate-y":Nt()}],"rotate-z":[{"rotate-z":Nt()}],scale:[{scale:bt()}],"scale-x":[{"scale-x":bt()}],"scale-y":[{"scale-y":bt()}],"scale-z":[{"scale-z":bt()}],"scale-3d":["scale-3d"],skew:[{skew:Tt()}],"skew-x":[{"skew-x":Tt()}],"skew-y":[{"skew-y":Tt()}],transform:[{transform:[Ct,wt,"","none","gpu","cpu"]}],"transform-origin":[{origin:R()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Dt()}],"translate-x":[{"translate-x":Dt()}],"translate-y":[{"translate-y":Dt()}],"translate-z":[{"translate-z":Dt()}],"translate-none":["translate-none"],accent:[{accent:Y()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:Y()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Ct,wt]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mbs":[{"scroll-mbs":k()}],"scroll-mbe":[{"scroll-mbe":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pbs":[{"scroll-pbs":k()}],"scroll-pbe":[{"scroll-pbe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Ct,wt]}],fill:[{fill:["none",...Y()]}],"stroke-w":[{stroke:[Pt,Ba,Cr,dx]}],stroke:[{stroke:["none",...Y()]}],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","inset-bs","inset-be","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pbs","pbe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mbs","mbe","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-x","border-w-y","border-w-s","border-w-e","border-w-bs","border-w-be","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-x","border-color-y","border-color-s","border-color-e","border-color-bs","border-color-be","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mbs","scroll-mbe","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pbs","scroll-pbe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}});function Gn(...t){return mz(ex(t))}function Je({children:t,inputPorts:e=[],outputPorts:n=[],selected:i,className:s,showPortLabels:a,onPortClick:c,glowUnconnected:u}){return M.jsxs("div",{className:Gn("relative rounded-lg border-2 bg-[var(--embed-bg-secondary)] shadow-md transition-all",i?"border-blue-500 shadow-lg":"border-[var(--embed-border-node)]",s),children:[e.map(d=>{const h=`${(d.index+1)*100/(e.length+1)}%`,p=u&&!d.connected;return M.jsxs(dr.Fragment,{children:[p&&M.jsx("div",{className:"absolute h-5 w-5 rounded-full animate-ping",style:{top:h,left:"-7px",transform:"translateY(-50%)",background:"radial-gradient(circle, rgba(96,165,250,0.5) 0%, transparent 70%)"}}),M.jsx(ds,{type:"target",position:At.Left,id:`in-${d.name}`,className:Gn("h-3 w-3 rounded-full border-2 transition-all duration-200",d.connected?"bg-blue-500 border-blue-600":"bg-[var(--embed-bg-tertiary)] border-[var(--embed-border-node)]",p&&"border-blue-400",c&&"cursor-pointer hover:scale-150","hover:bg-blue-300 hover:border-blue-500"),style:{top:h,left:"-6px"},onClick:c?m=>{m.stopPropagation(),c(d.name,"input")}:void 0}),a&&M.jsx("div",{className:"absolute text-[9px] font-mono text-[var(--embed-text-secondary)] pointer-events-none select-none",style:{top:h,left:"10px",transform:"translateY(-50%)"},children:d.name})]},`in-${d.name}`)}),M.jsx("div",{className:"relative px-3 py-2",children:t}),n.map(d=>{const h=`${(d.index+1)*100/(n.length+1)}%`,p=u&&!d.connected;return M.jsxs(dr.Fragment,{children:[p&&M.jsx("div",{className:"absolute h-5 w-5 rounded-full animate-ping",style:{top:h,right:"-7px",transform:"translateY(-50%)",background:"radial-gradient(circle, rgba(74,222,128,0.5) 0%, transparent 70%)"}}),M.jsx(ds,{type:"source",position:At.Right,id:`out-${d.name}`,className:Gn("h-3 w-3 rounded-full border-2 transition-all duration-200",d.connected?"bg-green-500 border-green-600":"bg-[var(--embed-bg-tertiary)] border-[var(--embed-border-node)]",d.value===!0&&"bg-green-500 border-green-600",d.value===!1&&"bg-gray-300 border-gray-400",p&&"border-green-400",c&&"cursor-pointer hover:scale-150","hover:bg-green-300 hover:border-green-500"),style:{top:h,right:"-6px"},onClick:c?m=>{m.stopPropagation(),c(d.name,"output")}:void 0}),a&&M.jsx("div",{className:"absolute text-[9px] font-mono text-[var(--embed-text-secondary)] pointer-events-none select-none",style:{top:h,right:"10px",transform:"translateY(-50%)",textAlign:"right"},children:d.name})]},`out-${d.name}`)})]})}function Sx(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Ex(...t){return e=>{let n=!1;const i=t.map(s=>{const a=Sx(s,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<i.length;s++){const a=i[s];typeof a=="function"?a():Sx(t[s],null)}}}}function _r(...t){return N.useCallback(Ex(...t),t)}function gz(t){const e=yz(t),n=N.forwardRef((i,s)=>{const{children:a,...c}=i,u=N.Children.toArray(a),d=u.find(bz);if(d){const h=d.props.children,p=u.map(m=>m===d?N.Children.count(h)>1?N.Children.only(null):N.isValidElement(h)?h.props.children:null:m);return M.jsx(e,{...c,ref:s,children:N.isValidElement(h)?N.cloneElement(h,void 0,p):null})}return M.jsx(e,{...c,ref:s,children:a})});return n.displayName=`${t}.Slot`,n}function yz(t){const e=N.forwardRef((n,i)=>{const{children:s,...a}=n;if(N.isValidElement(s)){const c=wz(s),u=xz(a,s.props);return s.type!==N.Fragment&&(u.ref=i?Ex(i,c):c),N.cloneElement(s,u)}return N.Children.count(s)>1?N.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var Cx=Symbol("radix.slottable");function vz(t){const e=({children:n})=>M.jsx(M.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=Cx,e}function bz(t){return N.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===Cx}function xz(t,e){const n={...e};for(const i in e){const s=t[i],a=e[i];/^on[A-Z]/.test(i)?s&&a?n[i]=(...u)=>{const d=a(...u);return s(...u),d}:s&&(n[i]=s):i==="style"?n[i]={...s,...a}:i==="className"&&(n[i]=[s,a].filter(Boolean).join(" "))}return{...t,...n}}function wz(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var Sz=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],yi=Sz.reduce((t,e)=>{const n=gz(`Primitive.${e}`),i=N.forwardRef((s,a)=>{const{asChild:c,...u}=s,d=c?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),M.jsx(d,{...u,ref:a})});return i.displayName=`Primitive.${e}`,{...t,[e]:i}},{});function Ez(t,e){t&&rh.flushSync(()=>t.dispatchEvent(e))}var Cz=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Tz="VisuallyHidden",Tx=N.forwardRef((t,e)=>M.jsx(yi.span,{...t,ref:e,style:{...Cz,...t.style}}));Tx.displayName=Tz;var _z=Tx;function _x(t,e=[]){let n=[];function i(a,c){const u=N.createContext(c),d=n.length;n=[...n,c];const h=m=>{const{scope:y,children:b,...x}=m,w=y?.[t]?.[d]||u,S=N.useMemo(()=>x,Object.values(x));return M.jsx(w.Provider,{value:S,children:b})};h.displayName=a+"Provider";function p(m,y){const b=y?.[t]?.[d]||u,x=N.useContext(b);if(x)return x;if(c!==void 0)return c;throw new Error(`\`${m}\` must be used within \`${a}\``)}return[h,p]}const s=()=>{const a=n.map(c=>N.createContext(c));return function(u){const d=u?.[t]||a;return N.useMemo(()=>({[`__scope${t}`]:{...u,[t]:d}}),[u,d])}};return s.scopeName=t,[i,Nz(s,...e)]}function Nz(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const i=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(a){const c=i.reduce((u,{useScope:d,scopeName:h})=>{const m=d(a)[`__scope${h}`];return{...u,...m}},{});return N.useMemo(()=>({[`__scope${e.scopeName}`]:c}),[c])}};return n.scopeName=e.scopeName,n}function Vo(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t?.(s),n===!1||!s.defaultPrevented)return e?.(s)}}var vi=globalThis?.document?N.useLayoutEffect:()=>{},Az=_0[" useInsertionEffect ".trim().toString()]||vi;function Mz({prop:t,defaultProp:e,onChange:n=()=>{},caller:i}){const[s,a,c]=Rz({defaultProp:e,onChange:n}),u=t!==void 0,d=u?t:s;{const p=N.useRef(t!==void 0);N.useEffect(()=>{const m=p.current;m!==u&&console.warn(`${i} is changing from ${m?"controlled":"uncontrolled"} to ${u?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=u},[u,i])}const h=N.useCallback(p=>{if(u){const m=kz(p)?p(t):p;m!==t&&c.current?.(m)}else a(p)},[u,t,a,c]);return[d,h]}function Rz({defaultProp:t,onChange:e}){const[n,i]=N.useState(t),s=N.useRef(n),a=N.useRef(e);return Az(()=>{a.current=e},[e]),N.useEffect(()=>{s.current!==n&&(a.current?.(n),s.current=n)},[n,s]),[n,i,a]}function kz(t){return typeof t=="function"}function Oz(t,e){return N.useReducer((n,i)=>e[n][i]??n,t)}var mh=t=>{const{present:e,children:n}=t,i=Dz(e),s=typeof n=="function"?n({present:i.isPresent}):N.Children.only(n),a=_r(i.ref,jz(s));return typeof n=="function"||i.isPresent?N.cloneElement(s,{ref:a}):null};mh.displayName="Presence";function Dz(t){const[e,n]=N.useState(),i=N.useRef(null),s=N.useRef(t),a=N.useRef("none"),c=t?"mounted":"unmounted",[u,d]=Oz(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return N.useEffect(()=>{const h=qc(i.current);a.current=u==="mounted"?h:"none"},[u]),vi(()=>{const h=i.current,p=s.current;if(p!==t){const y=a.current,b=qc(h);t?d("MOUNT"):b==="none"||h?.display==="none"?d("UNMOUNT"):d(p&&y!==b?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,d]),vi(()=>{if(e){let h;const p=e.ownerDocument.defaultView??window,m=b=>{const w=qc(i.current).includes(CSS.escape(b.animationName));if(b.target===e&&w&&(d("ANIMATION_END"),!s.current)){const S=e.style.animationFillMode;e.style.animationFillMode="forwards",h=p.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=S)})}},y=b=>{b.target===e&&(a.current=qc(i.current))};return e.addEventListener("animationstart",y),e.addEventListener("animationcancel",m),e.addEventListener("animationend",m),()=>{p.clearTimeout(h),e.removeEventListener("animationstart",y),e.removeEventListener("animationcancel",m),e.removeEventListener("animationend",m)}}else d("ANIMATION_END")},[e,d]),{isPresent:["mounted","unmountSuspended"].includes(u),ref:N.useCallback(h=>{i.current=h?getComputedStyle(h):null,n(h)},[])}}function qc(t){return t?.animationName||"none"}function jz(t){let e=Object.getOwnPropertyDescriptor(t.props,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=Object.getOwnPropertyDescriptor(t,"ref")?.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var zz=_0[" useId ".trim().toString()]||(()=>{}),Vz=0;function Lz(t){const[e,n]=N.useState(zz());return vi(()=>{n(i=>i??String(Vz++))},[t]),e?`radix-${e}`:""}function Yc(t){const e=N.useRef(t);return N.useEffect(()=>{e.current=t}),N.useMemo(()=>(...n)=>e.current?.(...n),[])}function Iz(t,e=globalThis?.document){const n=Yc(t);N.useEffect(()=>{const i=s=>{s.key==="Escape"&&n(s)};return e.addEventListener("keydown",i,{capture:!0}),()=>e.removeEventListener("keydown",i,{capture:!0})},[n,e])}var Bz="DismissableLayer",gh="dismissableLayer.update",Pz="dismissableLayer.pointerDownOutside",Hz="dismissableLayer.focusOutside",Nx,Ax=N.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Mx=N.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:i,onPointerDownOutside:s,onFocusOutside:a,onInteractOutside:c,onDismiss:u,...d}=t,h=N.useContext(Ax),[p,m]=N.useState(null),y=p?.ownerDocument??globalThis?.document,[,b]=N.useState({}),x=_r(e,O=>m(O)),w=Array.from(h.layers),[S]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),E=w.indexOf(S),D=p?w.indexOf(p):-1,T=h.layersWithOutsidePointerEventsDisabled.size>0,C=D>=E,R=qz(O=>{const k=O.target,H=[...h.branches].some($=>$.contains(k));!C||H||(s?.(O),c?.(O),O.defaultPrevented||u?.())},y),A=Yz(O=>{const k=O.target;[...h.branches].some($=>$.contains(k))||(a?.(O),c?.(O),O.defaultPrevented||u?.())},y);return Iz(O=>{D===h.layers.size-1&&(i?.(O),!O.defaultPrevented&&u&&(O.preventDefault(),u()))},y),N.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(Nx=y.body.style.pointerEvents,y.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),Rx(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(y.body.style.pointerEvents=Nx)}},[p,y,n,h]),N.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),Rx())},[p,h]),N.useEffect(()=>{const O=()=>b({});return document.addEventListener(gh,O),()=>document.removeEventListener(gh,O)},[]),M.jsx(yi.div,{...d,ref:x,style:{pointerEvents:T?C?"auto":"none":void 0,...t.style},onFocusCapture:Vo(t.onFocusCapture,A.onFocusCapture),onBlurCapture:Vo(t.onBlurCapture,A.onBlurCapture),onPointerDownCapture:Vo(t.onPointerDownCapture,R.onPointerDownCapture)})});Mx.displayName=Bz;var Uz="DismissableLayerBranch",$z=N.forwardRef((t,e)=>{const n=N.useContext(Ax),i=N.useRef(null),s=_r(e,i);return N.useEffect(()=>{const a=i.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),M.jsx(yi.div,{...t,ref:s})});$z.displayName=Uz;function qz(t,e=globalThis?.document){const n=Yc(t),i=N.useRef(!1),s=N.useRef(()=>{});return N.useEffect(()=>{const a=u=>{if(u.target&&!i.current){let d=function(){kx(Pz,n,h,{discrete:!0})};const h={originalEvent:u};u.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=d,e.addEventListener("click",s.current,{once:!0})):d()}else e.removeEventListener("click",s.current);i.current=!1},c=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(c),e.removeEventListener("pointerdown",a),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>i.current=!0}}function Yz(t,e=globalThis?.document){const n=Yc(t),i=N.useRef(!1);return N.useEffect(()=>{const s=a=>{a.target&&!i.current&&kx(Hz,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>i.current=!0,onBlurCapture:()=>i.current=!1}}function Rx(){const t=new CustomEvent(gh);document.dispatchEvent(t)}function kx(t,e,n,{discrete:i}){const s=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),i?Ez(s,a):s.dispatchEvent(a)}var Gz="Portal",Ox=N.forwardRef((t,e)=>{const{container:n,...i}=t,[s,a]=N.useState(!1);vi(()=>a(!0),[]);const c=n||s&&globalThis?.document?.body;return c?hD.createPortal(M.jsx(yi.div,{...i,ref:e}),c):null});Ox.displayName=Gz;function Xz(t){const[e,n]=N.useState(void 0);return vi(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const i=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const a=s[0];let c,u;if("borderBoxSize"in a){const d=a.borderBoxSize,h=Array.isArray(d)?d[0]:d;c=h.inlineSize,u=h.blockSize}else c=t.offsetWidth,u=t.offsetHeight;n({width:c,height:u})});return i.observe(t,{box:"border-box"}),()=>i.unobserve(t)}else n(void 0)},[t]),e}const Fz=["top","right","bottom","left"],bi=Math.min,hn=Math.max,Gc=Math.round,Xc=Math.floor,po=t=>({x:t,y:t}),Zz={left:"right",right:"left",bottom:"top",top:"bottom"},Kz={start:"end",end:"start"};function yh(t,e,n){return hn(t,bi(e,n))}function Lo(t,e){return typeof t=="function"?t(e):t}function Io(t){return t.split("-")[0]}function hs(t){return t.split("-")[1]}function vh(t){return t==="x"?"y":"x"}function bh(t){return t==="y"?"height":"width"}const Qz=new Set(["top","bottom"]);function mo(t){return Qz.has(Io(t))?"y":"x"}function xh(t){return vh(mo(t))}function Wz(t,e,n){n===void 0&&(n=!1);const i=hs(t),s=xh(t),a=bh(s);let c=s==="x"?i===(n?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(c=Fc(c)),[c,Fc(c)]}function Jz(t){const e=Fc(t);return[wh(t),e,wh(e)]}function wh(t){return t.replace(/start|end/g,e=>Kz[e])}const Dx=["left","right"],jx=["right","left"],tV=["top","bottom"],eV=["bottom","top"];function nV(t,e,n){switch(t){case"top":case"bottom":return n?e?jx:Dx:e?Dx:jx;case"left":case"right":return e?tV:eV;default:return[]}}function oV(t,e,n,i){const s=hs(t);let a=nV(Io(t),n==="start",i);return s&&(a=a.map(c=>c+"-"+s),e&&(a=a.concat(a.map(wh)))),a}function Fc(t){return t.replace(/left|right|bottom|top/g,e=>Zz[e])}function iV(t){return{top:0,right:0,bottom:0,left:0,...t}}function zx(t){return typeof t!="number"?iV(t):{top:t,right:t,bottom:t,left:t}}function Zc(t){const{x:e,y:n,width:i,height:s}=t;return{width:i,height:s,top:n,left:e,right:e+i,bottom:n+s,x:e,y:n}}function Vx(t,e,n){let{reference:i,floating:s}=t;const a=mo(e),c=xh(e),u=bh(c),d=Io(e),h=a==="y",p=i.x+i.width/2-s.width/2,m=i.y+i.height/2-s.height/2,y=i[u]/2-s[u]/2;let b;switch(d){case"top":b={x:p,y:i.y-s.height};break;case"bottom":b={x:p,y:i.y+i.height};break;case"right":b={x:i.x+i.width,y:m};break;case"left":b={x:i.x-s.width,y:m};break;default:b={x:i.x,y:i.y}}switch(hs(e)){case"start":b[c]-=y*(n&&h?-1:1);break;case"end":b[c]+=y*(n&&h?-1:1);break}return b}async function rV(t,e){var n;e===void 0&&(e={});const{x:i,y:s,platform:a,rects:c,elements:u,strategy:d}=t,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:m="floating",altBoundary:y=!1,padding:b=0}=Lo(e,t),x=zx(b),S=u[y?m==="floating"?"reference":"floating":m],E=Zc(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(S)))==null||n?S:S.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(u.floating)),boundary:h,rootBoundary:p,strategy:d})),D=m==="floating"?{x:i,y:s,width:c.floating.width,height:c.floating.height}:c.reference,T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(u.floating)),C=await(a.isElement==null?void 0:a.isElement(T))?await(a.getScale==null?void 0:a.getScale(T))||{x:1,y:1}:{x:1,y:1},R=Zc(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:u,rect:D,offsetParent:T,strategy:d}):D);return{top:(E.top-R.top+x.top)/C.y,bottom:(R.bottom-E.bottom+x.bottom)/C.y,left:(E.left-R.left+x.left)/C.x,right:(R.right-E.right+x.right)/C.x}}const sV=async(t,e,n)=>{const{placement:i="bottom",strategy:s="absolute",middleware:a=[],platform:c}=n,u=a.filter(Boolean),d=await(c.isRTL==null?void 0:c.isRTL(e));let h=await c.getElementRects({reference:t,floating:e,strategy:s}),{x:p,y:m}=Vx(h,i,d),y=i,b={},x=0;for(let S=0;S<u.length;S++){var w;const{name:E,fn:D}=u[S],{x:T,y:C,data:R,reset:A}=await D({x:p,y:m,initialPlacement:i,placement:y,strategy:s,middlewareData:b,rects:h,platform:{...c,detectOverflow:(w=c.detectOverflow)!=null?w:rV},elements:{reference:t,floating:e}});p=T??p,m=C??m,b={...b,[E]:{...b[E],...R}},A&&x<=50&&(x++,typeof A=="object"&&(A.placement&&(y=A.placement),A.rects&&(h=A.rects===!0?await c.getElementRects({reference:t,floating:e,strategy:s}):A.rects),{x:p,y:m}=Vx(h,y,d)),S=-1)}return{x:p,y:m,placement:y,strategy:s,middlewareData:b}},aV=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:i,placement:s,rects:a,platform:c,elements:u,middlewareData:d}=e,{element:h,padding:p=0}=Lo(t,e)||{};if(h==null)return{};const m=zx(p),y={x:n,y:i},b=xh(s),x=bh(b),w=await c.getDimensions(h),S=b==="y",E=S?"top":"left",D=S?"bottom":"right",T=S?"clientHeight":"clientWidth",C=a.reference[x]+a.reference[b]-y[b]-a.floating[x],R=y[b]-a.reference[b],A=await(c.getOffsetParent==null?void 0:c.getOffsetParent(h));let O=A?A[T]:0;(!O||!await(c.isElement==null?void 0:c.isElement(A)))&&(O=u.floating[T]||a.floating[x]);const k=C/2-R/2,H=O/2-w[x]/2-1,$=bi(m[E],H),q=bi(m[D],H),F=$,Q=O-w[x]-q,B=O/2-w[x]/2+k,P=yh(F,B,Q),j=!d.arrow&&hs(s)!=null&&B!==P&&a.reference[x]/2-(B<F?$:q)-w[x]/2<0,I=j?B<F?B-F:B-Q:0;return{[b]:y[b]+I,data:{[b]:P,centerOffset:B-P-I,...j&&{alignmentOffset:I}},reset:j}}}),lV=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,i;const{placement:s,middlewareData:a,rects:c,initialPlacement:u,platform:d,elements:h}=e,{mainAxis:p=!0,crossAxis:m=!0,fallbackPlacements:y,fallbackStrategy:b="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:w=!0,...S}=Lo(t,e);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const E=Io(s),D=mo(u),T=Io(u)===u,C=await(d.isRTL==null?void 0:d.isRTL(h.floating)),R=y||(T||!w?[Fc(u)]:Jz(u)),A=x!=="none";!y&&A&&R.push(...oV(u,w,x,C));const O=[u,...R],k=await d.detectOverflow(e,S),H=[];let $=((i=a.flip)==null?void 0:i.overflows)||[];if(p&&H.push(k[E]),m){const B=Wz(s,c,C);H.push(k[B[0]],k[B[1]])}if($=[...$,{placement:s,overflows:H}],!H.every(B=>B<=0)){var q,F;const B=(((q=a.flip)==null?void 0:q.index)||0)+1,P=O[B];if(P&&(!(m==="alignment"?D!==mo(P):!1)||$.every(z=>mo(z.placement)===D?z.overflows[0]>0:!0)))return{data:{index:B,overflows:$},reset:{placement:P}};let j=(F=$.filter(I=>I.overflows[0]<=0).sort((I,z)=>I.overflows[1]-z.overflows[1])[0])==null?void 0:F.placement;if(!j)switch(b){case"bestFit":{var Q;const I=(Q=$.filter(z=>{if(A){const U=mo(z.placement);return U===D||U==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(U=>U>0).reduce((U,Y)=>U+Y,0)]).sort((z,U)=>z[1]-U[1])[0])==null?void 0:Q[0];I&&(j=I);break}case"initialPlacement":j=u;break}if(s!==j)return{reset:{placement:j}}}return{}}}};function Lx(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function Ix(t){return Fz.some(e=>t[e]>=0)}const cV=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:i}=e,{strategy:s="referenceHidden",...a}=Lo(t,e);switch(s){case"referenceHidden":{const c=await i.detectOverflow(e,{...a,elementContext:"reference"}),u=Lx(c,n.reference);return{data:{referenceHiddenOffsets:u,referenceHidden:Ix(u)}}}case"escaped":{const c=await i.detectOverflow(e,{...a,altBoundary:!0}),u=Lx(c,n.floating);return{data:{escapedOffsets:u,escaped:Ix(u)}}}default:return{}}}}},Bx=new Set(["left","top"]);async function uV(t,e){const{placement:n,platform:i,elements:s}=t,a=await(i.isRTL==null?void 0:i.isRTL(s.floating)),c=Io(n),u=hs(n),d=mo(n)==="y",h=Bx.has(c)?-1:1,p=a&&d?-1:1,m=Lo(e,t);let{mainAxis:y,crossAxis:b,alignmentAxis:x}=typeof m=="number"?{mainAxis:m,crossAxis:0,alignmentAxis:null}:{mainAxis:m.mainAxis||0,crossAxis:m.crossAxis||0,alignmentAxis:m.alignmentAxis};return u&&typeof x=="number"&&(b=u==="end"?x*-1:x),d?{x:b*p,y:y*h}:{x:y*h,y:b*p}}const fV=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,i;const{x:s,y:a,placement:c,middlewareData:u}=e,d=await uV(e,t);return c===((n=u.offset)==null?void 0:n.placement)&&(i=u.arrow)!=null&&i.alignmentOffset?{}:{x:s+d.x,y:a+d.y,data:{...d,placement:c}}}}},dV=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:i,placement:s,platform:a}=e,{mainAxis:c=!0,crossAxis:u=!1,limiter:d={fn:E=>{let{x:D,y:T}=E;return{x:D,y:T}}},...h}=Lo(t,e),p={x:n,y:i},m=await a.detectOverflow(e,h),y=mo(Io(s)),b=vh(y);let x=p[b],w=p[y];if(c){const E=b==="y"?"top":"left",D=b==="y"?"bottom":"right",T=x+m[E],C=x-m[D];x=yh(T,x,C)}if(u){const E=y==="y"?"top":"left",D=y==="y"?"bottom":"right",T=w+m[E],C=w-m[D];w=yh(T,w,C)}const S=d.fn({...e,[b]:x,[y]:w});return{...S,data:{x:S.x-n,y:S.y-i,enabled:{[b]:c,[y]:u}}}}}},hV=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:i,placement:s,rects:a,middlewareData:c}=e,{offset:u=0,mainAxis:d=!0,crossAxis:h=!0}=Lo(t,e),p={x:n,y:i},m=mo(s),y=vh(m);let b=p[y],x=p[m];const w=Lo(u,e),S=typeof w=="number"?{mainAxis:w,crossAxis:0}:{mainAxis:0,crossAxis:0,...w};if(d){const T=y==="y"?"height":"width",C=a.reference[y]-a.floating[T]+S.mainAxis,R=a.reference[y]+a.reference[T]-S.mainAxis;b<C?b=C:b>R&&(b=R)}if(h){var E,D;const T=y==="y"?"width":"height",C=Bx.has(Io(s)),R=a.reference[m]-a.floating[T]+(C&&((E=c.offset)==null?void 0:E[m])||0)+(C?0:S.crossAxis),A=a.reference[m]+a.reference[T]+(C?0:((D=c.offset)==null?void 0:D[m])||0)-(C?S.crossAxis:0);x<R?x=R:x>A&&(x=A)}return{[y]:b,[m]:x}}}},pV=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,i;const{placement:s,rects:a,platform:c,elements:u}=e,{apply:d=()=>{},...h}=Lo(t,e),p=await c.detectOverflow(e,h),m=Io(s),y=hs(s),b=mo(s)==="y",{width:x,height:w}=a.floating;let S,E;m==="top"||m==="bottom"?(S=m,E=y===(await(c.isRTL==null?void 0:c.isRTL(u.floating))?"start":"end")?"left":"right"):(E=m,S=y==="end"?"top":"bottom");const D=w-p.top-p.bottom,T=x-p.left-p.right,C=bi(w-p[S],D),R=bi(x-p[E],T),A=!e.middlewareData.shift;let O=C,k=R;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(k=T),(i=e.middlewareData.shift)!=null&&i.enabled.y&&(O=D),A&&!y){const $=hn(p.left,0),q=hn(p.right,0),F=hn(p.top,0),Q=hn(p.bottom,0);b?k=x-2*($!==0||q!==0?$+q:hn(p.left,p.right)):O=w-2*(F!==0||Q!==0?F+Q:hn(p.top,p.bottom))}await d({...e,availableWidth:k,availableHeight:O});const H=await c.getDimensions(u.floating);return x!==H.width||w!==H.height?{reset:{rects:!0}}:{}}}};function Kc(){return typeof window<"u"}function ps(t){return Px(t)?(t.nodeName||"").toLowerCase():"#document"}function pn(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function go(t){var e;return(e=(Px(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Px(t){return Kc()?t instanceof Node||t instanceof pn(t).Node:!1}function Xn(t){return Kc()?t instanceof Element||t instanceof pn(t).Element:!1}function yo(t){return Kc()?t instanceof HTMLElement||t instanceof pn(t).HTMLElement:!1}function Hx(t){return!Kc()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof pn(t).ShadowRoot}const mV=new Set(["inline","contents"]);function Pa(t){const{overflow:e,overflowX:n,overflowY:i,display:s}=Fn(t);return/auto|scroll|overlay|hidden|clip/.test(e+i+n)&&!mV.has(s)}const gV=new Set(["table","td","th"]);function yV(t){return gV.has(ps(t))}const vV=[":popover-open",":modal"];function Qc(t){return vV.some(e=>{try{return t.matches(e)}catch{return!1}})}const bV=["transform","translate","scale","rotate","perspective"],xV=["transform","translate","scale","rotate","perspective","filter"],wV=["paint","layout","strict","content"];function Sh(t){const e=Eh(),n=Xn(t)?Fn(t):t;return bV.some(i=>n[i]?n[i]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||xV.some(i=>(n.willChange||"").includes(i))||wV.some(i=>(n.contain||"").includes(i))}function SV(t){let e=xi(t);for(;yo(e)&&!ms(e);){if(Sh(e))return e;if(Qc(e))return null;e=xi(e)}return null}function Eh(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const EV=new Set(["html","body","#document"]);function ms(t){return EV.has(ps(t))}function Fn(t){return pn(t).getComputedStyle(t)}function Wc(t){return Xn(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function xi(t){if(ps(t)==="html")return t;const e=t.assignedSlot||t.parentNode||Hx(t)&&t.host||go(t);return Hx(e)?e.host:e}function Ux(t){const e=xi(t);return ms(e)?t.ownerDocument?t.ownerDocument.body:t.body:yo(e)&&Pa(e)?e:Ux(e)}function Ha(t,e,n){var i;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=Ux(t),a=s===((i=t.ownerDocument)==null?void 0:i.body),c=pn(s);if(a){const u=Ch(c);return e.concat(c,c.visualViewport||[],Pa(s)?s:[],u&&n?Ha(u):[])}return e.concat(s,Ha(s,[],n))}function Ch(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function $x(t){const e=Fn(t);let n=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=yo(t),a=s?t.offsetWidth:n,c=s?t.offsetHeight:i,u=Gc(n)!==a||Gc(i)!==c;return u&&(n=a,i=c),{width:n,height:i,$:u}}function Th(t){return Xn(t)?t:t.contextElement}function gs(t){const e=Th(t);if(!yo(e))return po(1);const n=e.getBoundingClientRect(),{width:i,height:s,$:a}=$x(e);let c=(a?Gc(n.width):n.width)/i,u=(a?Gc(n.height):n.height)/s;return(!c||!Number.isFinite(c))&&(c=1),(!u||!Number.isFinite(u))&&(u=1),{x:c,y:u}}const CV=po(0);function qx(t){const e=pn(t);return!Eh()||!e.visualViewport?CV:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function TV(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==pn(t)?!1:e}function Nr(t,e,n,i){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=Th(t);let c=po(1);e&&(i?Xn(i)&&(c=gs(i)):c=gs(t));const u=TV(a,n,i)?qx(a):po(0);let d=(s.left+u.x)/c.x,h=(s.top+u.y)/c.y,p=s.width/c.x,m=s.height/c.y;if(a){const y=pn(a),b=i&&Xn(i)?pn(i):i;let x=y,w=Ch(x);for(;w&&i&&b!==x;){const S=gs(w),E=w.getBoundingClientRect(),D=Fn(w),T=E.left+(w.clientLeft+parseFloat(D.paddingLeft))*S.x,C=E.top+(w.clientTop+parseFloat(D.paddingTop))*S.y;d*=S.x,h*=S.y,p*=S.x,m*=S.y,d+=T,h+=C,x=pn(w),w=Ch(x)}}return Zc({width:p,height:m,x:d,y:h})}function Jc(t,e){const n=Wc(t).scrollLeft;return e?e.left+n:Nr(go(t)).left+n}function Yx(t,e){const n=t.getBoundingClientRect(),i=n.left+e.scrollLeft-Jc(t,n),s=n.top+e.scrollTop;return{x:i,y:s}}function _V(t){let{elements:e,rect:n,offsetParent:i,strategy:s}=t;const a=s==="fixed",c=go(i),u=e?Qc(e.floating):!1;if(i===c||u&&a)return n;let d={scrollLeft:0,scrollTop:0},h=po(1);const p=po(0),m=yo(i);if((m||!m&&!a)&&((ps(i)!=="body"||Pa(c))&&(d=Wc(i)),yo(i))){const b=Nr(i);h=gs(i),p.x=b.x+i.clientLeft,p.y=b.y+i.clientTop}const y=c&&!m&&!a?Yx(c,d):po(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-d.scrollLeft*h.x+p.x+y.x,y:n.y*h.y-d.scrollTop*h.y+p.y+y.y}}function NV(t){return Array.from(t.getClientRects())}function AV(t){const e=go(t),n=Wc(t),i=t.ownerDocument.body,s=hn(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),a=hn(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let c=-n.scrollLeft+Jc(t);const u=-n.scrollTop;return Fn(i).direction==="rtl"&&(c+=hn(e.clientWidth,i.clientWidth)-s),{width:s,height:a,x:c,y:u}}const Gx=25;function MV(t,e){const n=pn(t),i=go(t),s=n.visualViewport;let a=i.clientWidth,c=i.clientHeight,u=0,d=0;if(s){a=s.width,c=s.height;const p=Eh();(!p||p&&e==="fixed")&&(u=s.offsetLeft,d=s.offsetTop)}const h=Jc(i);if(h<=0){const p=i.ownerDocument,m=p.body,y=getComputedStyle(m),b=p.compatMode==="CSS1Compat"&&parseFloat(y.marginLeft)+parseFloat(y.marginRight)||0,x=Math.abs(i.clientWidth-m.clientWidth-b);x<=Gx&&(a-=x)}else h<=Gx&&(a+=h);return{width:a,height:c,x:u,y:d}}const RV=new Set(["absolute","fixed"]);function kV(t,e){const n=Nr(t,!0,e==="fixed"),i=n.top+t.clientTop,s=n.left+t.clientLeft,a=yo(t)?gs(t):po(1),c=t.clientWidth*a.x,u=t.clientHeight*a.y,d=s*a.x,h=i*a.y;return{width:c,height:u,x:d,y:h}}function Xx(t,e,n){let i;if(e==="viewport")i=MV(t,n);else if(e==="document")i=AV(go(t));else if(Xn(e))i=kV(e,n);else{const s=qx(t);i={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Zc(i)}function Fx(t,e){const n=xi(t);return n===e||!Xn(n)||ms(n)?!1:Fn(n).position==="fixed"||Fx(n,e)}function OV(t,e){const n=e.get(t);if(n)return n;let i=Ha(t,[],!1).filter(u=>Xn(u)&&ps(u)!=="body"),s=null;const a=Fn(t).position==="fixed";let c=a?xi(t):t;for(;Xn(c)&&!ms(c);){const u=Fn(c),d=Sh(c);!d&&u.position==="fixed"&&(s=null),(a?!d&&!s:!d&&u.position==="static"&&!!s&&RV.has(s.position)||Pa(c)&&!d&&Fx(t,c))?i=i.filter(p=>p!==c):s=u,c=xi(c)}return e.set(t,i),i}function DV(t){let{element:e,boundary:n,rootBoundary:i,strategy:s}=t;const c=[...n==="clippingAncestors"?Qc(e)?[]:OV(e,this._c):[].concat(n),i],u=c[0],d=c.reduce((h,p)=>{const m=Xx(e,p,s);return h.top=hn(m.top,h.top),h.right=bi(m.right,h.right),h.bottom=bi(m.bottom,h.bottom),h.left=hn(m.left,h.left),h},Xx(e,u,s));return{width:d.right-d.left,height:d.bottom-d.top,x:d.left,y:d.top}}function jV(t){const{width:e,height:n}=$x(t);return{width:e,height:n}}function zV(t,e,n){const i=yo(e),s=go(e),a=n==="fixed",c=Nr(t,!0,a,e);let u={scrollLeft:0,scrollTop:0};const d=po(0);function h(){d.x=Jc(s)}if(i||!i&&!a)if((ps(e)!=="body"||Pa(s))&&(u=Wc(e)),i){const b=Nr(e,!0,a,e);d.x=b.x+e.clientLeft,d.y=b.y+e.clientTop}else s&&h();a&&!i&&s&&h();const p=s&&!i&&!a?Yx(s,u):po(0),m=c.left+u.scrollLeft-d.x-p.x,y=c.top+u.scrollTop-d.y-p.y;return{x:m,y,width:c.width,height:c.height}}function _h(t){return Fn(t).position==="static"}function Zx(t,e){if(!yo(t)||Fn(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return go(t)===n&&(n=n.ownerDocument.body),n}function Kx(t,e){const n=pn(t);if(Qc(t))return n;if(!yo(t)){let s=xi(t);for(;s&&!ms(s);){if(Xn(s)&&!_h(s))return s;s=xi(s)}return n}let i=Zx(t,e);for(;i&&yV(i)&&_h(i);)i=Zx(i,e);return i&&ms(i)&&_h(i)&&!Sh(i)?n:i||SV(t)||n}const VV=async function(t){const e=this.getOffsetParent||Kx,n=this.getDimensions,i=await n(t.floating);return{reference:zV(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function LV(t){return Fn(t).direction==="rtl"}const IV={convertOffsetParentRelativeRectToViewportRelativeRect:_V,getDocumentElement:go,getClippingRect:DV,getOffsetParent:Kx,getElementRects:VV,getClientRects:NV,getDimensions:jV,getScale:gs,isElement:Xn,isRTL:LV};function Qx(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function BV(t,e){let n=null,i;const s=go(t);function a(){var u;clearTimeout(i),(u=n)==null||u.disconnect(),n=null}function c(u,d){u===void 0&&(u=!1),d===void 0&&(d=1),a();const h=t.getBoundingClientRect(),{left:p,top:m,width:y,height:b}=h;if(u||e(),!y||!b)return;const x=Xc(m),w=Xc(s.clientWidth-(p+y)),S=Xc(s.clientHeight-(m+b)),E=Xc(p),T={rootMargin:-x+"px "+-w+"px "+-S+"px "+-E+"px",threshold:hn(0,bi(1,d))||1};let C=!0;function R(A){const O=A[0].intersectionRatio;if(O!==d){if(!C)return c();O?c(!1,O):i=setTimeout(()=>{c(!1,1e-7)},1e3)}O===1&&!Qx(h,t.getBoundingClientRect())&&c(),C=!1}try{n=new IntersectionObserver(R,{...T,root:s.ownerDocument})}catch{n=new IntersectionObserver(R,T)}n.observe(t)}return c(!0),a}function PV(t,e,n,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:a=!0,elementResize:c=typeof ResizeObserver=="function",layoutShift:u=typeof IntersectionObserver=="function",animationFrame:d=!1}=i,h=Th(t),p=s||a?[...h?Ha(h):[],...Ha(e)]:[];p.forEach(E=>{s&&E.addEventListener("scroll",n,{passive:!0}),a&&E.addEventListener("resize",n)});const m=h&&u?BV(h,n):null;let y=-1,b=null;c&&(b=new ResizeObserver(E=>{let[D]=E;D&&D.target===h&&b&&(b.unobserve(e),cancelAnimationFrame(y),y=requestAnimationFrame(()=>{var T;(T=b)==null||T.observe(e)})),n()}),h&&!d&&b.observe(h),b.observe(e));let x,w=d?Nr(t):null;d&&S();function S(){const E=Nr(t);w&&!Qx(w,E)&&n(),w=E,x=requestAnimationFrame(S)}return n(),()=>{var E;p.forEach(D=>{s&&D.removeEventListener("scroll",n),a&&D.removeEventListener("resize",n)}),m?.(),(E=b)==null||E.disconnect(),b=null,d&&cancelAnimationFrame(x)}}const HV=fV,UV=dV,$V=lV,qV=pV,YV=cV,Wx=aV,GV=hV,XV=(t,e,n)=>{const i=new Map,s={platform:IV,...n},a={...s.platform,_c:i};return sV(t,e,{...s,platform:a})};var FV=typeof document<"u",ZV=function(){},tu=FV?N.useLayoutEffect:ZV;function eu(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,i,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(i=n;i--!==0;)if(!eu(t[i],e[i]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(i=n;i--!==0;)if(!{}.hasOwnProperty.call(e,s[i]))return!1;for(i=n;i--!==0;){const a=s[i];if(!(a==="_owner"&&t.$$typeof)&&!eu(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function Jx(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function tw(t,e){const n=Jx(t);return Math.round(e*n)/n}function Nh(t){const e=N.useRef(t);return tu(()=>{e.current=t}),e}function KV(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:i=[],platform:s,elements:{reference:a,floating:c}={},transform:u=!0,whileElementsMounted:d,open:h}=t,[p,m]=N.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[y,b]=N.useState(i);eu(y,i)||b(i);const[x,w]=N.useState(null),[S,E]=N.useState(null),D=N.useCallback(z=>{z!==A.current&&(A.current=z,w(z))},[]),T=N.useCallback(z=>{z!==O.current&&(O.current=z,E(z))},[]),C=a||x,R=c||S,A=N.useRef(null),O=N.useRef(null),k=N.useRef(p),H=d!=null,$=Nh(d),q=Nh(s),F=Nh(h),Q=N.useCallback(()=>{if(!A.current||!O.current)return;const z={placement:e,strategy:n,middleware:y};q.current&&(z.platform=q.current),XV(A.current,O.current,z).then(U=>{const Y={...U,isPositioned:F.current!==!1};B.current&&!eu(k.current,Y)&&(k.current=Y,rh.flushSync(()=>{m(Y)}))})},[y,e,n,q,F]);tu(()=>{h===!1&&k.current.isPositioned&&(k.current.isPositioned=!1,m(z=>({...z,isPositioned:!1})))},[h]);const B=N.useRef(!1);tu(()=>(B.current=!0,()=>{B.current=!1}),[]),tu(()=>{if(C&&(A.current=C),R&&(O.current=R),C&&R){if($.current)return $.current(C,R,Q);Q()}},[C,R,Q,$,H]);const P=N.useMemo(()=>({reference:A,floating:O,setReference:D,setFloating:T}),[D,T]),j=N.useMemo(()=>({reference:C,floating:R}),[C,R]),I=N.useMemo(()=>{const z={position:n,left:0,top:0};if(!j.floating)return z;const U=tw(j.floating,p.x),Y=tw(j.floating,p.y);return u?{...z,transform:"translate("+U+"px, "+Y+"px)",...Jx(j.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:U,top:Y}},[n,u,j.floating,p.x,p.y]);return N.useMemo(()=>({...p,update:Q,refs:P,elements:j,floatingStyles:I}),[p,Q,P,j,I])}const QV=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:i,padding:s}=typeof t=="function"?t(n):t;return i&&e(i)?i.current!=null?Wx({element:i.current,padding:s}).fn(n):{}:i?Wx({element:i,padding:s}).fn(n):{}}}},WV=(t,e)=>({...HV(t),options:[t,e]}),JV=(t,e)=>({...UV(t),options:[t,e]}),t4=(t,e)=>({...GV(t),options:[t,e]}),e4=(t,e)=>({...$V(t),options:[t,e]}),n4=(t,e)=>({...qV(t),options:[t,e]}),o4=(t,e)=>({...YV(t),options:[t,e]}),i4=(t,e)=>({...QV(t),options:[t,e]});var r4="Arrow",ew=N.forwardRef((t,e)=>{const{children:n,width:i=10,height:s=5,...a}=t;return M.jsx(yi.svg,{...a,ref:e,width:i,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:M.jsx("polygon",{points:"0,0 30,0 15,10"})})});ew.displayName=r4;var s4=ew,Ah="Popper",[nw,ow]=_x(Ah),[a4,iw]=nw(Ah),rw=t=>{const{__scopePopper:e,children:n}=t,[i,s]=N.useState(null);return M.jsx(a4,{scope:e,anchor:i,onAnchorChange:s,children:n})};rw.displayName=Ah;var sw="PopperAnchor",aw=N.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:i,...s}=t,a=iw(sw,n),c=N.useRef(null),u=_r(e,c),d=N.useRef(null);return N.useEffect(()=>{const h=d.current;d.current=i?.current||c.current,h!==d.current&&a.onAnchorChange(d.current)}),i?null:M.jsx(yi.div,{...s,ref:u})});aw.displayName=sw;var Mh="PopperContent",[l4,c4]=nw(Mh),lw=N.forwardRef((t,e)=>{const{__scopePopper:n,side:i="bottom",sideOffset:s=0,align:a="center",alignOffset:c=0,arrowPadding:u=0,avoidCollisions:d=!0,collisionBoundary:h=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:y=!1,updatePositionStrategy:b="optimized",onPlaced:x,...w}=t,S=iw(Mh,n),[E,D]=N.useState(null),T=_r(e,ft=>D(ft)),[C,R]=N.useState(null),A=Xz(C),O=A?.width??0,k=A?.height??0,H=i+(a!=="center"?"-"+a:""),$=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},q=Array.isArray(h)?h:[h],F=q.length>0,Q={padding:$,boundary:q.filter(f4),altBoundary:F},{refs:B,floatingStyles:P,placement:j,isPositioned:I,middlewareData:z}=KV({strategy:"fixed",placement:H,whileElementsMounted:(...ft)=>PV(...ft,{animationFrame:b==="always"}),elements:{reference:S.anchor},middleware:[WV({mainAxis:s+k,alignmentAxis:c}),d&&JV({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?t4():void 0,...Q}),d&&e4({...Q}),n4({...Q,apply:({elements:ft,rects:ut,availableWidth:dt,availableHeight:Mt})=>{const{width:Nt,height:bt}=ut.reference,Tt=ft.floating.style;Tt.setProperty("--radix-popper-available-width",`${dt}px`),Tt.setProperty("--radix-popper-available-height",`${Mt}px`),Tt.setProperty("--radix-popper-anchor-width",`${Nt}px`),Tt.setProperty("--radix-popper-anchor-height",`${bt}px`)}}),C&&i4({element:C,padding:u}),d4({arrowWidth:O,arrowHeight:k}),y&&o4({strategy:"referenceHidden",...Q})]}),[U,Y]=fw(j),L=Yc(x);vi(()=>{I&&L?.()},[I,L]);const G=z.arrow?.x,tt=z.arrow?.y,it=z.arrow?.centerOffset!==0,[lt,ht]=N.useState();return vi(()=>{E&&ht(window.getComputedStyle(E).zIndex)},[E]),M.jsx("div",{ref:B.setFloating,"data-radix-popper-content-wrapper":"",style:{...P,transform:I?P.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:lt,"--radix-popper-transform-origin":[z.transformOrigin?.x,z.transformOrigin?.y].join(" "),...z.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:M.jsx(l4,{scope:n,placedSide:U,onArrowChange:R,arrowX:G,arrowY:tt,shouldHideArrow:it,children:M.jsx(yi.div,{"data-side":U,"data-align":Y,...w,ref:T,style:{...w.style,animation:I?void 0:"none"}})})})});lw.displayName=Mh;var cw="PopperArrow",u4={top:"bottom",right:"left",bottom:"top",left:"right"},uw=N.forwardRef(function(e,n){const{__scopePopper:i,...s}=e,a=c4(cw,i),c=u4[a.placedSide];return M.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:M.jsx(s4,{...s,ref:n,style:{...s.style,display:"block"}})})});uw.displayName=cw;function f4(t){return t!==null}var d4=t=>({name:"transformOrigin",options:t,fn(e){const{placement:n,rects:i,middlewareData:s}=e,c=s.arrow?.centerOffset!==0,u=c?0:t.arrowWidth,d=c?0:t.arrowHeight,[h,p]=fw(n),m={start:"0%",center:"50%",end:"100%"}[p],y=(s.arrow?.x??0)+u/2,b=(s.arrow?.y??0)+d/2;let x="",w="";return h==="bottom"?(x=c?m:`${y}px`,w=`${-d}px`):h==="top"?(x=c?m:`${y}px`,w=`${i.floating.height+d}px`):h==="right"?(x=`${-d}px`,w=c?m:`${b}px`):h==="left"&&(x=`${i.floating.width+d}px`,w=c?m:`${b}px`),{data:{x,y:w}}}});function fw(t){const[e,n="center"]=t.split("-");return[e,n]}var h4=rw,p4=aw,m4=lw,g4=uw,[nu]=_x("Tooltip",[ow]),ou=ow(),dw="TooltipProvider",y4=700,Rh="tooltip.open",[v4,kh]=nu(dw),hw=t=>{const{__scopeTooltip:e,delayDuration:n=y4,skipDelayDuration:i=300,disableHoverableContent:s=!1,children:a}=t,c=N.useRef(!0),u=N.useRef(!1),d=N.useRef(0);return N.useEffect(()=>{const h=d.current;return()=>window.clearTimeout(h)},[]),M.jsx(v4,{scope:e,isOpenDelayedRef:c,delayDuration:n,onOpen:N.useCallback(()=>{window.clearTimeout(d.current),c.current=!1},[]),onClose:N.useCallback(()=>{window.clearTimeout(d.current),d.current=window.setTimeout(()=>c.current=!0,i)},[i]),isPointerInTransitRef:u,onPointerInTransitChange:N.useCallback(h=>{u.current=h},[]),disableHoverableContent:s,children:a})};hw.displayName=dw;var Ua="Tooltip",[b4,$a]=nu(Ua),pw=t=>{const{__scopeTooltip:e,children:n,open:i,defaultOpen:s,onOpenChange:a,disableHoverableContent:c,delayDuration:u}=t,d=kh(Ua,t.__scopeTooltip),h=ou(e),[p,m]=N.useState(null),y=Lz(),b=N.useRef(0),x=c??d.disableHoverableContent,w=u??d.delayDuration,S=N.useRef(!1),[E,D]=Mz({prop:i,defaultProp:s??!1,onChange:O=>{O?(d.onOpen(),document.dispatchEvent(new CustomEvent(Rh))):d.onClose(),a?.(O)},caller:Ua}),T=N.useMemo(()=>E?S.current?"delayed-open":"instant-open":"closed",[E]),C=N.useCallback(()=>{window.clearTimeout(b.current),b.current=0,S.current=!1,D(!0)},[D]),R=N.useCallback(()=>{window.clearTimeout(b.current),b.current=0,D(!1)},[D]),A=N.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{S.current=!0,D(!0),b.current=0},w)},[w,D]);return N.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),M.jsx(h4,{...h,children:M.jsx(b4,{scope:e,contentId:y,open:E,stateAttribute:T,trigger:p,onTriggerChange:m,onTriggerEnter:N.useCallback(()=>{d.isOpenDelayedRef.current?A():C()},[d.isOpenDelayedRef,A,C]),onTriggerLeave:N.useCallback(()=>{x?R():(window.clearTimeout(b.current),b.current=0)},[R,x]),onOpen:C,onClose:R,disableHoverableContent:x,children:n})})};pw.displayName=Ua;var Oh="TooltipTrigger",mw=N.forwardRef((t,e)=>{const{__scopeTooltip:n,...i}=t,s=$a(Oh,n),a=kh(Oh,n),c=ou(n),u=N.useRef(null),d=_r(e,u,s.onTriggerChange),h=N.useRef(!1),p=N.useRef(!1),m=N.useCallback(()=>h.current=!1,[]);return N.useEffect(()=>()=>document.removeEventListener("pointerup",m),[m]),M.jsx(p4,{asChild:!0,...c,children:M.jsx(yi.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...i,ref:d,onPointerMove:Vo(t.onPointerMove,y=>{y.pointerType!=="touch"&&!p.current&&!a.isPointerInTransitRef.current&&(s.onTriggerEnter(),p.current=!0)}),onPointerLeave:Vo(t.onPointerLeave,()=>{s.onTriggerLeave(),p.current=!1}),onPointerDown:Vo(t.onPointerDown,()=>{s.open&&s.onClose(),h.current=!0,document.addEventListener("pointerup",m,{once:!0})}),onFocus:Vo(t.onFocus,()=>{h.current||s.onOpen()}),onBlur:Vo(t.onBlur,s.onClose),onClick:Vo(t.onClick,s.onClose)})})});mw.displayName=Oh;var Dh="TooltipPortal",[x4,w4]=nu(Dh,{forceMount:void 0}),gw=t=>{const{__scopeTooltip:e,forceMount:n,children:i,container:s}=t,a=$a(Dh,e);return M.jsx(x4,{scope:e,forceMount:n,children:M.jsx(mh,{present:n||a.open,children:M.jsx(Ox,{asChild:!0,container:s,children:i})})})};gw.displayName=Dh;var ys="TooltipContent",yw=N.forwardRef((t,e)=>{const n=w4(ys,t.__scopeTooltip),{forceMount:i=n.forceMount,side:s="top",...a}=t,c=$a(ys,t.__scopeTooltip);return M.jsx(mh,{present:i||c.open,children:c.disableHoverableContent?M.jsx(vw,{side:s,...a,ref:e}):M.jsx(S4,{side:s,...a,ref:e})})}),S4=N.forwardRef((t,e)=>{const n=$a(ys,t.__scopeTooltip),i=kh(ys,t.__scopeTooltip),s=N.useRef(null),a=_r(e,s),[c,u]=N.useState(null),{trigger:d,onClose:h}=n,p=s.current,{onPointerInTransitChange:m}=i,y=N.useCallback(()=>{u(null),m(!1)},[m]),b=N.useCallback((x,w)=>{const S=x.currentTarget,E={x:x.clientX,y:x.clientY},D=_4(E,S.getBoundingClientRect()),T=N4(E,D),C=A4(w.getBoundingClientRect()),R=R4([...T,...C]);u(R),m(!0)},[m]);return N.useEffect(()=>()=>y(),[y]),N.useEffect(()=>{if(d&&p){const x=S=>b(S,p),w=S=>b(S,d);return d.addEventListener("pointerleave",x),p.addEventListener("pointerleave",w),()=>{d.removeEventListener("pointerleave",x),p.removeEventListener("pointerleave",w)}}},[d,p,b,y]),N.useEffect(()=>{if(c){const x=w=>{const S=w.target,E={x:w.clientX,y:w.clientY},D=d?.contains(S)||p?.contains(S),T=!M4(E,c);D?y():T&&(y(),h())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[d,p,c,h,y]),M.jsx(vw,{...t,ref:a})}),[E4,C4]=nu(Ua,{isInside:!1}),T4=vz("TooltipContent"),vw=N.forwardRef((t,e)=>{const{__scopeTooltip:n,children:i,"aria-label":s,onEscapeKeyDown:a,onPointerDownOutside:c,...u}=t,d=$a(ys,n),h=ou(n),{onClose:p}=d;return N.useEffect(()=>(document.addEventListener(Rh,p),()=>document.removeEventListener(Rh,p)),[p]),N.useEffect(()=>{if(d.trigger){const m=y=>{y.target?.contains(d.trigger)&&p()};return window.addEventListener("scroll",m,{capture:!0}),()=>window.removeEventListener("scroll",m,{capture:!0})}},[d.trigger,p]),M.jsx(Mx,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:c,onFocusOutside:m=>m.preventDefault(),onDismiss:p,children:M.jsxs(m4,{"data-state":d.stateAttribute,...h,...u,ref:e,style:{...u.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[M.jsx(T4,{children:i}),M.jsx(E4,{scope:n,isInside:!0,children:M.jsx(_z,{id:d.contentId,role:"tooltip",children:s||i})})]})})});yw.displayName=ys;var bw="TooltipArrow",xw=N.forwardRef((t,e)=>{const{__scopeTooltip:n,...i}=t,s=ou(n);return C4(bw,n).isInside?null:M.jsx(g4,{...s,...i,ref:e})});xw.displayName=bw;function _4(t,e){const n=Math.abs(e.top-t.y),i=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),a=Math.abs(e.left-t.x);switch(Math.min(n,i,s,a)){case a:return"left";case s:return"right";case n:return"top";case i:return"bottom";default:throw new Error("unreachable")}}function N4(t,e,n=5){const i=[];switch(e){case"top":i.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":i.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":i.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":i.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return i}function A4(t){const{top:e,right:n,bottom:i,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:i},{x:s,y:i}]}function M4(t,e){const{x:n,y:i}=t;let s=!1;for(let a=0,c=e.length-1;a<e.length;c=a++){const u=e[a],d=e[c],h=u.x,p=u.y,m=d.x,y=d.y;p>i!=y>i&&n<(m-h)*(i-p)/(y-p)+h&&(s=!s)}return s}function R4(t){const e=t.slice();return e.sort((n,i)=>n.x<i.x?-1:n.x>i.x?1:n.y<i.y?-1:n.y>i.y?1:0),k4(e)}function k4(t){if(t.length<=1)return t.slice();const e=[];for(let i=0;i<t.length;i++){const s=t[i];for(;e.length>=2;){const a=e[e.length-1],c=e[e.length-2];if((a.x-c.x)*(s.y-c.y)>=(a.y-c.y)*(s.x-c.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let i=t.length-1;i>=0;i--){const s=t[i];for(;n.length>=2;){const a=n[n.length-1],c=n[n.length-2];if((a.x-c.x)*(s.y-c.y)>=(a.y-c.y)*(s.x-c.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var O4=hw,D4=pw,j4=mw,z4=gw,V4=yw,L4=xw;function ww({delayDuration:t=0,...e}){return M.jsx(O4,{"data-slot":"tooltip-provider",delayDuration:t,...e})}function Sw({...t}){return M.jsx(D4,{"data-slot":"tooltip",...t})}function Ew({...t}){return M.jsx(j4,{"data-slot":"tooltip-trigger",...t})}function Cw({className:t,sideOffset:e=0,children:n,...i}){return M.jsx(z4,{children:M.jsxs(V4,{"data-slot":"tooltip-content",sideOffset:e,className:Gn("bg-foreground text-background animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-fit origin-(--radix-tooltip-content-transform-origin) rounded-md px-3 py-1.5 text-xs text-balance",t),...i,children:[n,M.jsx(L4,{className:"bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]"})]})})}function vs(){return M.jsx(ww,{delayDuration:200,children:M.jsxs(Sw,{children:[M.jsx(Ew,{asChild:!0,children:M.jsxs("div",{className:"absolute -top-2 -right-2 flex h-6 w-6 items-center justify-center cursor-pointer group",children:[M.jsx("span",{className:"absolute inset-0 rounded-full bg-blue-400/30 animate-[ping_2s_cubic-bezier(0,0,0.2,1)_infinite]"}),M.jsx("span",{className:"relative flex h-5 w-5 items-center justify-center rounded-full bg-blue-500 group-hover:bg-blue-400 transition-colors shadow-sm shadow-blue-500/30",children:M.jsxs("svg",{className:"h-3 w-3 text-white",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:[M.jsx("circle",{cx:"6.5",cy:"6.5",r:"4.5"}),M.jsx("line",{x1:"10",y1:"10",x2:"14",y2:"14"})]})})]})}),M.jsx(Cw,{side:"top",sideOffset:4,children:"Double-click to inspect"})]})})}function I4({data:t}){const e=t.width??8,n=(1<<Math.min(e,31))-1,i=t.numericValue??0,[s,a]=N.useState(!1),[c,u]=N.useState(""),d=N.useCallback(x=>{const w=Math.max(0,Math.min(n,x));t.onValueChange?.(w)},[t,n]),h=N.useCallback(x=>{x.stopPropagation(),u(i.toString()),a(!0)},[i]),p=N.useCallback(()=>{const x=parseInt(c,10);isNaN(x)||d(x),a(!1)},[c,d]),m=N.useCallback(x=>{x.stopPropagation(),x.key==="Enter"?p():x.key==="Escape"&&a(!1)},[p]),y=Math.ceil(e/4),b=i.toString(16).toUpperCase().padStart(y,"0");return M.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[M.jsxs("div",{className:"flex items-center gap-1",children:[M.jsx("button",{onClick:x=>{x.stopPropagation(),d(i-1)},"aria-label":"Decrease value",className:"w-6 h-6 flex items-center justify-center rounded bg-[var(--embed-bg-tertiary)] hover:opacity-80 text-[var(--embed-text-secondary)] text-sm font-bold active:scale-90 transition-all",children:"-"}),s?M.jsx("input",{type:"text",value:c,onChange:x=>u(x.target.value),onBlur:p,onKeyDown:m,onClick:x=>x.stopPropagation(),autoFocus:!0,className:"w-14 h-7 text-center text-xs font-mono bg-white border border-blue-400 rounded outline-none text-gray-800"}):M.jsxs("button",{onClick:h,"aria-label":`Current value: ${i}. Click to edit`,className:"w-14 h-7 flex items-center justify-center rounded bg-[var(--embed-bg-tertiary)] text-emerald-400 font-mono text-sm font-bold hover:opacity-80 transition-colors cursor-text",children:["0x",b]}),M.jsx("button",{onClick:x=>{x.stopPropagation(),d(i+1)},"aria-label":"Increase value",className:"w-6 h-6 flex items-center justify-center rounded bg-[var(--embed-bg-tertiary)] hover:opacity-80 text-[var(--embed-text-secondary)] text-sm font-bold active:scale-90 transition-all",children:"+"})]}),M.jsxs("div",{className:"text-[10px] text-[var(--embed-text-secondary)] font-mono",children:["= ",i]})]})}function B4({data:t,selected:e}){const n=t.value??!1,i=t.componentRef==="Input",s=N.useCallback(c=>{c.stopPropagation(),t.onToggle?.()},[t]),a=t.outputNames.map((c,u)=>({name:c,index:u,type:"output",value:i?(t.numericValue??0)!==0:n}));return M.jsx(Je,{outputPorts:a,selected:e,className:"min-w-[80px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"relative flex flex-col items-center gap-2",children:[t.isComposite&&M.jsx(vs,{}),M.jsx("div",{className:"px-2 py-1 rounded text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),i?M.jsx(I4,{data:t}):M.jsxs(M.Fragment,{children:[M.jsx("button",{onClick:s,role:"switch","aria-checked":n,"aria-label":t.label||t.componentRef,className:Gn("group relative h-9 w-16 rounded-full transition-all duration-300 ease-in-out","focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-400 focus-visible:ring-offset-2 focus-visible:ring-offset-gray-900 hover:shadow-md active:scale-95",n?"bg-gradient-to-r from-emerald-500 to-green-500 shadow-sm":"bg-gradient-to-r from-gray-300 to-gray-400 shadow-sm"),children:M.jsxs("span",{className:Gn("absolute top-0.5 flex items-center justify-center","h-8 w-8 rounded-full bg-white","shadow-lg transition-all duration-300 ease-out",n?"translate-x-[1.875rem]":"translate-x-0.5"),children:[M.jsx("span",{className:"absolute inset-1 rounded-full bg-gradient-to-br from-white to-gray-50"}),M.jsx("span",{className:Gn("relative z-10 h-2 w-2 rounded-full transition-all duration-300",n?"bg-gradient-to-br from-emerald-400 to-green-500":"bg-gradient-to-br from-gray-300 to-gray-400")})]})}),M.jsx("div",{className:Gn("text-xs font-semibold tracking-wide transition-colors duration-300",n?"text-emerald-400":"text-[var(--embed-text-secondary)]"),children:n?"ON":"OFF"})]})]})})}function P4({data:t,selected:e}){const n=t.numericValue??0,i=t.width??8,s=(1<<Math.min(i,31))-1,[a,c]=N.useState(!1),[u,d]=N.useState(n.toString()),[h,p]=N.useState("dec"),m=N.useCallback(S=>{S.stopPropagation(),d(n.toString()),c(!0)},[n]),y=N.useCallback(S=>{if(S.key==="Enter"){S.preventDefault(),S.stopPropagation();const E=u.trim();let D=E.toLowerCase().startsWith("0x")?parseInt(E,16):parseInt(E,10);isNaN(D)&&(D=0),D=Math.max(0,Math.min(s,D)),t.onValueChange?.(D),c(!1)}else S.key==="Escape"&&(S.preventDefault(),c(!1))},[u,s,t]),b=N.useCallback(S=>{S.stopPropagation(),p(E=>E==="dec"?"hex":"dec")},[]),x=t.outputNames.map((S,E)=>({name:S,index:E,type:"output",value:!0})),w=h==="hex"?`0x${n.toString(16).toUpperCase().padStart(Math.ceil(i/4),"0")}`:n.toString();return M.jsx(Je,{outputPorts:x,selected:e,className:"min-w-[100px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),M.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a?M.jsx("input",{type:"text",value:u,onChange:S=>d(S.target.value),onKeyDown:y,onBlur:()=>c(!1),className:"w-24 px-2 py-1 text-center font-mono text-sm border-2 border-blue-500 rounded focus:outline-none",autoFocus:!0,onClick:S=>S.stopPropagation()}):M.jsx("div",{onClick:m,className:"px-3 py-1 bg-gradient-to-r from-indigo-500 to-purple-500 text-white rounded cursor-pointer hover:shadow-md transition-all font-mono text-sm",title:"Click to edit value",children:w}),M.jsx("button",{onClick:b,className:"text-xs text-[var(--embed-text-secondary)] hover:text-[var(--embed-text-primary)] transition-colors",children:h==="dec"?"DEC":"HEX"})]}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-muted)]",children:[i,"-bit"]})]})})}function H4({data:t,selected:e}){const n=t.arguments?.init,i=Array.isArray(n)?n.length:0,s=t.inputNames.map((c,u)=>({name:c,index:u,type:"input"})),a=t.outputNames.map((c,u)=>({name:c,index:u,type:"output"}));return M.jsx(Je,{inputPorts:s,outputPorts:a,selected:e,className:"min-w-[120px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"EthFrame"}),M.jsx("div",{className:"px-3 py-2 text-xs font-semibold rounded-md bg-[var(--embed-bg-tertiary)] text-[var(--embed-text-primary)]",children:"ETH"}),M.jsx("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:i>0?`${i} bytes`:"no frame"})]})})}function U4({data:t,selected:e}){const n=t.value??!1,i=t.numericValue??0,s=t.inputNames.map((u,d)=>({name:u,index:d,type:"input"})),a=u=>u.toString(16).toUpperCase().padStart(2,"0"),c=()=>{if(t.componentRef==="HexDisplay"){const u=a(i);return M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 rounded text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),M.jsx("div",{className:"flex items-center justify-center px-4 py-2 bg-black rounded border-2 border-gray-600",children:M.jsx("span",{className:"text-2xl font-mono font-bold text-green-400",children:u})}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:["Dec: ",i]})]})}else if(t.componentRef==="SevenSegment"){const u=(i&15).toString(16).toUpperCase();return M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 rounded text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),M.jsx("div",{className:"flex items-center justify-center px-3 py-2 bg-black rounded border-2 border-gray-600",children:M.jsx("span",{className:"text-xl font-mono font-bold text-red-500",children:u})}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:["Dec: ",i&15]})]})}else return M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 rounded text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||t.componentRef}),M.jsx("div",{className:Gn("h-10 w-10 rounded-full border-2 transition-all",n?"border-green-600 bg-green-400 shadow-lg shadow-green-500/50":"border-gray-500 bg-[var(--embed-bg-tertiary)]"),children:n&&M.jsx("div",{className:"h-full w-full rounded-full bg-gradient-to-br from-green-300 to-green-500"})}),M.jsx("div",{className:Gn("text-xs font-semibold",n?"text-green-400":"text-[var(--embed-text-secondary)]"),children:n?"ON":"OFF"})]})};return M.jsx(Je,{inputPorts:s,selected:e,className:"min-w-[80px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"relative",children:[t.isComposite&&M.jsx(vs,{}),c()]})})}function $4({data:t,selected:e}){const n=t.arguments?.width??8,i=t.arguments?.height??8,s=n*i,a=t.__pixels??new Array(s).fill(0),c=n<=8?16:n<=16?8:4,u=n<=8?2:n<=16?1:0;return M.jsx(Je,{selected:e,inputPorts:t.inputNames.map((d,h)=>({name:d,index:h,type:"input"})),outputPorts:t.outputNames.map((d,h)=>({name:d,index:h,type:"output"})),className:"min-w-[160px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"Screen"}),M.jsx("svg",{width:n*c+(n-1)*u,height:i*c+(i-1)*u,className:"border-2 border-gray-700 rounded bg-black",style:{imageRendering:"pixelated"},children:a.slice(0,s).map((d,h)=>{const p=h%n,m=Math.floor(h/n);return M.jsx("rect",{x:p*(c+u),y:m*(c+u),width:c,height:c,fill:d!==0?"#00ff00":"#1a1a1a"},h)})}),M.jsxs("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:[n,"×",i," pixels"]})]})})}function q4({data:t,selected:e}){const n=t.__pixels??new Array(64).fill(0),i=8,s=16,a=2;return M.jsx(Je,{selected:e,inputPorts:t.inputNames.map((c,u)=>({name:c,index:u,type:"input"})),outputPorts:t.outputNames.map((c,u)=>({name:c,index:u,type:"output"})),className:"min-w-[160px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"RasterDisplay"}),M.jsx("svg",{width:i*s+(i-1)*a,height:i*s+(i-1)*a,className:"border-2 border-gray-700 rounded bg-black",style:{imageRendering:"pixelated"},children:n.map((c,u)=>{const d=u%i,h=Math.floor(u/i);return M.jsx("rect",{x:d*(s+a),y:h*(s+a),width:s,height:s,fill:c!==0?"#00ff00":"#1a1a1a"},u)})}),M.jsx("div",{className:"text-xs text-[var(--embed-text-secondary)]",children:"8×8 raster scan"})]})})}function Y4({data:t,selected:e}){const n=N.useRef(null),i=t.__consoleText??"";N.useEffect(()=>{n.current&&(n.current.scrollTop=n.current.scrollHeight)},[i]);const s=i?i.split(`
25
+ `).length:0,a=i.length;return M.jsx(Je,{selected:e,inputPorts:t.inputNames.map((c,u)=>({name:c,index:u,type:"input"})),outputPorts:t.outputNames.map((c,u)=>({name:c,index:u,type:"output"})),className:"min-w-[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:i||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 G4({data:t,selected:e}){const n=N.useRef(null),i=t.__uartText??"";N.useEffect(()=>{n.current&&(n.current.scrollTop=n.current.scrollHeight)},[i]);const s=i?i.split(`
26
+ `).length:0,a=i.length;return M.jsx(Je,{selected:e,inputPorts:t.inputNames.map((c,u)=>({name:c,index:u,type:"input"})),outputPorts:t.outputNames.map((c,u)=>({name:c,index:u,type:"output"})),className:"min-w-[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:i||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 X4=new Set(["And","Or","Not","Nand","Nor","Xor","Xnor","Buffer"]);function F4(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 Z4({data:t,selected:e}){const n=t.value??!1,i=t.inputNames.map((c,u)=>({name:c,index:u,type:"input"})),s=t.outputNames.map((c,u)=>({name:c,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 F4(t.componentRef,t.arguments)}})(),d=X4.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(Je,{inputPorts:i,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(vs,{}),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 K4({data:t,selected:e}){const n=typeof t.arguments?.initial=="number"?t.arguments.initial:0,i=t.inputNames.map((a,c)=>({name:a,index:c,type:"input"})),s=t.outputNames.map((a,c)=>({name:a,index:c,type:"output"}));return M.jsx(Je,{inputPorts:i,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(vs,{}),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 Q4({data:t,selected:e}){const n=t.arguments?.init,i=()=>n?Array.isArray(n)?`[${n.length} values]`:typeof n=="object"?`{${Object.keys(n).length} entries}`:"empty":"empty",s=t.inputNames.map((c,u)=>({name:c,index:u,type:"input"})),a=t.outputNames.map((c,u)=>({name:c,index:u,type:"output"}));return M.jsx(Je,{inputPorts:s,outputPorts:a,selected:e,className:"min-w-[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(vs,{}),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:i()})]})]})})}function W4({data:t,selected:e}){const n=t.arguments?.init,i=()=>n?Array.isArray(n)?`[${n.length} values]`:typeof n=="object"?`{${Object.keys(n).length} entries}`:"empty":"empty",s=t.inputNames.map((c,u)=>({name:c,index:u,type:"input"})),a=t.outputNames.map((c,u)=>({name:c,index:u,type:"output"}));return M.jsx(Je,{inputPorts:s,outputPorts:a,selected:e,className:"min-w-[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(vs,{}),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:i()})]})})}function J4({data:t,selected:e}){const n=t.__nicState,i=n?.txCount??0,s=n?.rxCount??0,a=n?.draining??!1;return M.jsx(Je,{selected:e,inputPorts:t.inputNames.map((c,u)=>({name:c,index:u,type:"input"})),outputPorts:t.outputNames.map((c,u)=>({name:c,index:u,type:"output"})),className:"min-w-[160px]",showPortLabels:t.showPortLabels,onPortClick:t.onPortClick,glowUnconnected:t.glowUnconnected,children:M.jsxs("div",{className:"flex flex-col items-center gap-2",children:[M.jsx("div",{className:"px-2 py-1 text-xs font-medium text-[var(--embed-text-primary)]",children:t.label||"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:[i," 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 tL=[{value:"c",label:"C"},{value:"cpp",label:"C++"},{value:"rust",label:"Rust"},{value:"asm",label:"ASM"}],Tw={c:`void _start() {
27
27
  volatile int *uart = (volatile int *)0x80000000;
28
28
  const char *msg = "Hello from C!\\n";
29
29
  while (*msg) *uart = *msg++;
@@ -53,27 +53,27 @@ _start:
53
53
  li t0, 0x80000000
54
54
  li a0, 72
55
55
  sw a0, 0(t0)
56
- 1: j 1b`};function J4({data:t,selected:e}){const[n,i]=N.useState(!1),[s,l]=N.useState(!1),[c,u]=N.useState("c"),[d,h]=N.useState(""),[p,m]=N.useState("idle"),[y,b]=N.useState(""),[x,w]=N.useState(null),[S,E]=N.useState(0),O=N.useRef(null),C=t.inputNames.map((P,j)=>({name:P,index:j,type:"input"})),_=t.outputNames.map((P,j)=>({name:P,index:j,type:"output"})),R=N.useCallback((P,j)=>{const I=new Map;for(let z=0;z<P.length;z++)P[z]!==0&&I.set(z,P[z]);w(j),E(P.length),t.onLoadMemory?.(I)},[t.onLoadMemory]),A=N.useCallback(async P=>{const j=await P.arrayBuffer();R(new Uint8Array(j),P.name)},[R]),k=N.useCallback(P=>{P.preventDefault(),P.stopPropagation(),i(!1);const j=P.dataTransfer.files[0];j&&A(j)},[A]),D=N.useCallback(P=>{P.preventDefault(),P.stopPropagation(),i(!0)},[]),H=N.useCallback(P=>{P.preventDefault(),P.stopPropagation(),i(!1)},[]),Y=N.useCallback(P=>{P.stopPropagation(),O.current?.click()},[]),$=N.useCallback(P=>{const j=P.target.files?.[0];j&&A(j),P.target.value=""},[A]),F=N.useCallback(P=>{P.stopPropagation(),w(null),E(0),t.onLoadMemory?.(new Map)},[t.onLoadMemory]),Q=N.useCallback(async()=>{const P=d||iw[c]||"";if(P.trim()){m("compiling"),b("");try{const I=await(await fetch("/api/compile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:P,language:c})})).json();if(!I.success){m("error"),b(I.stderr||I.error||"Compilation failed");return}const z=I.binary??"",U=atob(z),G=new Uint8Array(U.length);for(let L=0;L<U.length;L++)G[L]=U.charCodeAt(L);R(G,`program.${c}`),m("success"),setTimeout(()=>m("idle"),2e3)}catch(j){m("error"),b(j instanceof Error?j.message:"Network error")}}},[d,c,R]),B=N.useCallback(P=>{P.stopPropagation(),l(j=>!j)},[]);return M.jsxs(M.Fragment,{children:[M.jsx("input",{ref:O,type:"file",accept:".bin,.elf",onChange:$,className:"hidden"}),M.jsx(Xe,{inputPorts:C,outputPorts:_,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:`
56
+ 1: j 1b`};function eL({data:t,selected:e}){const[n,i]=N.useState(!1),[s,a]=N.useState(!1),[c,u]=N.useState("c"),[d,h]=N.useState(""),[p,m]=N.useState("idle"),[y,b]=N.useState(""),[x,w]=N.useState(null),[S,E]=N.useState(0),D=N.useRef(null),T=t.inputNames.map((P,j)=>({name:P,index:j,type:"input"})),C=t.outputNames.map((P,j)=>({name:P,index:j,type:"output"})),R=N.useCallback((P,j)=>{const I=new Map;for(let z=0;z<P.length;z++)P[z]!==0&&I.set(z,P[z]);w(j),E(P.length),t.onLoadMemory?.(I)},[t.onLoadMemory]),A=N.useCallback(async P=>{const j=await P.arrayBuffer();R(new Uint8Array(j),P.name)},[R]),O=N.useCallback(P=>{P.preventDefault(),P.stopPropagation(),i(!1);const j=P.dataTransfer.files[0];j&&A(j)},[A]),k=N.useCallback(P=>{P.preventDefault(),P.stopPropagation(),i(!0)},[]),H=N.useCallback(P=>{P.preventDefault(),P.stopPropagation(),i(!1)},[]),$=N.useCallback(P=>{P.stopPropagation(),D.current?.click()},[]),q=N.useCallback(P=>{const j=P.target.files?.[0];j&&A(j),P.target.value=""},[A]),F=N.useCallback(P=>{P.stopPropagation(),w(null),E(0),t.onLoadMemory?.(new Map)},[t.onLoadMemory]),Q=N.useCallback(async()=>{const P=d||Tw[c]||"";if(P.trim()){m("compiling"),b("");try{const I=await(await fetch("/api/compile",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({source:P,language:c})})).json();if(!I.success){m("error"),b(I.stderr||I.error||"Compilation failed");return}const z=I.binary??"",U=atob(z),Y=new Uint8Array(U.length);for(let L=0;L<U.length;L++)Y[L]=U.charCodeAt(L);R(Y,`program.${c}`),m("success"),setTimeout(()=>m("idle"),2e3)}catch(j){m("error"),b(j instanceof Error?j.message:"Network error")}}},[d,c,R]),B=N.useCallback(P=>{P.stopPropagation(),a(j=>!j)},[]);return M.jsxs(M.Fragment,{children:[M.jsx("input",{ref:D,type:"file",accept:".bin,.elf",onChange:q,className:"hidden"}),M.jsx(Je,{inputPorts:T,outputPorts:C,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:k,onDragOver:D,onDragLeave:H,onClick:Y,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:[S," bytes"]}),M.jsx("button",{onClick:F,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:`
59
+ `,onDrop:O,onDragOver:k,onDragLeave:H,onClick:$,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:[S," bytes"]}),M.jsx("button",{onClick:F,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:P=>P.stopPropagation(),children:[M.jsx("div",{className:"flex gap-1",children:W4.map(P=>M.jsx("button",{onClick:()=>u(P.value),className:`
62
+ `,children:s?"Hide Code":"Code"}),s&&M.jsxs("div",{className:"flex flex-col gap-2 w-full min-w-[280px] nodrag",onClick:P=>P.stopPropagation(),children:[M.jsx("div",{className:"flex gap-1",children:tL.map(P=>M.jsx("button",{onClick:()=>u(P.value),className:`
63
63
  px-2 py-0.5 text-xs rounded transition-colors
64
64
  ${c===P.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:P.label},P.value))}),M.jsx("textarea",{value:d,onChange:P=>h(P.target.value),placeholder:iw[c],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:Q,disabled:p==="compiling",className:`
65
+ `,children:P.label},P.value))}),M.jsx("textarea",{value:d,onChange:P=>h(P.target.value),placeholder:Tw[c],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:Q,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(`
68
+ `,children:p==="compiling"?"Compiling...":p==="success"?"Loaded!":"Compile & Load"}),p==="error"&&y&&M.jsx("div",{className:"p-2 text-xs font-mono rounded bg-red-500/10 text-red-400 max-h-24 overflow-y-auto whitespace-pre-wrap",children:y})]})]})})]})}const _w={inputNode:B4,numericInputNode:P4,outputNode:U4,logicGateNode:Z4,registerNode:K4,ramNode:Q4,romNode:W4,rv32iInstrMemNode:eL,ethFrameInputNode:H4,consoleNode:Y4,uartTxNode:G4,nicFifoNode:J4,screenNode:$4,rasterDisplayNode:q4},Nw={orthogonal:ch},jh={TRUE:"#22c55e",FALSE:"#94a3b8",UNDEFINED:"#cbd5e1"};function Ar(t){return t.nodeId===""?`.${t.portName}`:`${t.nodeId}.${t.portName}`}function nL(t,e,n,i){const s={Switch:"inputNode",Input:"numericInputNode",Led:"outputNode",And:"logicGateNode",Or:"logicGateNode",Not:"logicGateNode",Nand:"logicGateNode",Nor:"logicGateNode",Xor:"logicGateNode",Xnor:"logicGateNode",Buffer:"logicGateNode",DFlipFlop:"logicGateNode",Register:"registerNode",RAM:"ramNode",ROM:"romNode",HexDisplay:"outputNode",SevenSegment:"outputNode",Screen:"screenNode",RasterDisplay:"rasterDisplayNode",Console:"consoleNode",UART_TX:"uartTxNode",NIC_FIFO:"nicFifoNode",Constant:"logicGateNode",RV32I_InstrMem:"rv32iInstrMemNode",DualPortROM:"rv32iInstrMemNode",Eth_FrameInput:"ethFrameInputNode"};return s[t]?s[t]:i?"logicGateNode":e===0&&n>0?"inputNode":e>0&&n===0?"outputNode":e>0&&n>0?"logicGateNode":"default"}function oL(t,e,n,i,s){const a=[];for(const c of t.nodes){const u=e.components[c.id];if(!u){console.warn(`[projection] node '${c.id}' (${c.componentRef}) has no layout metadata, skipping render`);continue}const d=n.resolveCircuit(c.componentRef);if(!d)continue;const h=c.inputs.length,p=c.outputs.length,m=c.inputs.map(A=>A.name),y=c.outputs.map(A=>A.name),b=d.implementation.kind==="composite",x=nL(c.componentRef,h,p,b);let w,S,E,D,T,C,R;if(c.componentRef==="Switch"||c.componentRef==="Led"){let A=!1;if(i){if(c.componentRef==="Led"&&c.inputs.length>0){const O=Ar({nodeId:c.id,portName:c.inputs[0].name}),k=i.get(O);k!==void 0&&(w=!!k,A=!0)}else if(c.componentRef==="Switch"&&c.outputs.length>0){const O=Ar({nodeId:c.id,portName:c.outputs[0].name}),k=i.get(O);k!==void 0&&(w=!!k,A=!0)}}!A&&"value"in c.arguments&&(w=!!c.arguments.value)}else if(c.componentRef==="Input"){E=typeof c.arguments.width=="number"?c.arguments.width:8;let A=!1;if(i&&c.outputs.length>0){const O=Ar({nodeId:c.id,portName:c.outputs[0].name}),k=i.get(O);k!==void 0&&typeof k=="number"&&(S=k,A=!0)}A||(S=typeof c.arguments.value=="number"?c.arguments.value:0)}else if(c.componentRef==="HexDisplay"||c.componentRef==="SevenSegment"){if(i&&c.inputs.length>0){const A=Ar({nodeId:c.id,portName:c.inputs[0].name}),O=i.get(A);S=typeof O=="number"?O:0}}else if(c.componentRef==="Screen"){const A=c.arguments.width??8,O=c.arguments.height??8,k=A*O;if(D=new Array(k).fill(0),s&&i){const H=Array.from(t.connections).find($=>$.target.nodeId===c.id&&$.target.portName==="dataIn");if(H){const $=t.nodes.find(q=>q.id===H.source.nodeId);if($?.componentRef==="DualPortRAM"){const q=s.currentState.get($.id);if(q instanceof Map)for(let F=0;F<k;F++)D[F]=q.get(F)??0}else if($?.componentRef==="Mux"){const q=Ar({nodeId:$.id,portName:"sel"}),Q=i.get(q)===0?"in0":"in1",B=Array.from(t.connections).find(P=>P.target.nodeId===$.id&&P.target.portName===Q);if(B){const P=t.nodes.find(j=>j.id===B.source.nodeId);if(P?.componentRef==="DualPortRAM"){const j=s.currentState.get(P.id);if(j instanceof Map)for(let I=0;I<k;I++)D[I]=j.get(I)??0}}}}}}else if(c.componentRef==="RasterDisplay"){const A=c.arguments.width??8,O=c.arguments.height??8,k=A*O;if(D=new Array(k).fill(0),s){const H=s.currentState.get(c.id);if(H instanceof Map)for(let $=0;$<k;$++)D[$]=H.get($)??0}}else if(c.componentRef==="Console"){if(s){const A=s.currentState.get(c.id);typeof A=="string"&&(T=A)}}else if(c.componentRef==="UART_TX"){if(s){const A=s.currentState.get(c.id);typeof A=="string"&&(C=A)}}else if(c.componentRef==="NIC_FIFO"&&s){const A=s.currentState.get(c.id);if(A instanceof Map){const O=A,k=O.get(8192)??0,H=O.get(8193)??0,$=O.get(8210)??0,q=(O.get(8196)??0)!==0;R={txCount:k-H,rxCount:$,draining:q}}}a.push({id:c.id,type:x,position:u.position,data:{nodeId:c.id,componentRef:c.componentRef,label:c.label,value:w,numericValue:S,width:E,inputCount:h,outputCount:p,inputNames:m,outputNames:y,isComposite:b,arguments:c.arguments,__pixels:D,__consoleText:T,__uartText:C,__nicState:R},selectable:!0,deletable:!1})}if(s){const c=new Set(a.map(d=>d.id));let u=0;for(const[d,h]of s.currentState.entries())if(!c.has(d)&&typeof h=="string"){const p=d.split("."),m=p.length>1?p.slice(-2).join("."):d,y=d.toLowerCase().includes("uart");a.push({id:`__virtual_console_${u}`,type:y?"uartTxNode":"consoleNode",position:{x:600,y:50+u*250},data:{nodeId:d,componentRef:y?"UART_TX":"Console",label:y?`UART (${m})`:`Console (${m})`,value:void 0,numericValue:void 0,width:void 0,inputCount:y?4:2,outputCount:1,inputNames:y?["addr","write_data","mem_read","mem_write"]:["data","we"],outputNames:y?["read_data"]:["text"],__consoleText:y?void 0:h,__uartText:y?h:void 0},selected:!1,selectable:!1,deletable:!1}),u++}}return a}function iL(t,e){const n=[];for(const i of t.connections){let s=jh.UNDEFINED;if(e){const a=e.get(Ar(i.source))??e.get(Ar(i.target));a!==void 0&&(s=(typeof a=="boolean"?a:a!==0)?jh.TRUE:jh.FALSE)}n.push({id:i.id,type:"orthogonal",source:i.source.nodeId,target:i.target.nodeId,sourceHandle:`out-${i.source.portName}`,targetHandle:`in-${i.target.portName}`,style:{stroke:s,strokeWidth:2},animated:!1,selectable:!1,deletable:!1})}return n}function rL(t,e,n,i,s){return t?{nodes:oL(t,e,n,i,s),edges:iL(t,i)}:{nodes:[],edges:[]}}var Aw=Object.defineProperty,sL=(t,e,n)=>e in t?Aw(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,aL=(t,e)=>{for(var n in e)Aw(t,n,{get:e[n],enumerable:!0})},lL=(t,e,n)=>sL(t,e+"",n),Mw={};aL(Mw,{Graph:()=>_n,alg:()=>Vh,json:()=>Dw,version:()=>fL});var cL=Object.defineProperty,Rw=(t,e)=>{for(var n in e)cL(t,n,{get:e[n],enumerable:!0})},_n=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,e){return t.forEach(n=>{e!==void 0?this.setNode(n,e):this.setNode(n)}),this}setNode(t,e){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let e=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(n=>{this.setParent(n)}),delete this._children[t]),Object.keys(this._in[t]).forEach(e),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e===void 0)e="\0";else{e+="";for(let n=e;n!==void 0;n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}parent(t){if(this._isCompound){let e=this._parent[t];if(e!=="\0")return e}}children(t="\0"){if(this._isCompound){let e=this._children[t];if(e)return Object.keys(e)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let e=this._preds[t];if(e)return Object.keys(e)}successors(t){let e=this._sucs[t];if(e)return Object.keys(e)}neighbors(t){let e=this.predecessors(t);if(e){let n=new Set(e);for(let i of this.successors(t))n.add(i);return Array.from(n.values())}}isLeaf(t){let e;return this.isDirected()?e=this.successors(t):e=this.neighbors(t),e.length===0}filterNodes(t){let e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph()),Object.entries(this._nodes).forEach(([s,a])=>{t(s)&&e.setNode(s,a)}),Object.values(this._edgeObjs).forEach(s=>{e.hasNode(s.v)&&e.hasNode(s.w)&&e.setEdge(s,this.edge(s))});let n={},i=s=>{let a=this.parent(s);return!a||e.hasNode(a)?(n[s]=a??void 0,a??void 0):a in n?n[a]:i(a)};return this._isCompound&&e.nodes().forEach(s=>e.setParent(s,i(s))),e}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,e){return t.reduce((n,i)=>(e!==void 0?this.setEdge(n,i,e):this.setEdge(n,i),i)),this}setEdge(t,e,n,i){let s,a,c,u,d=!1;typeof t=="object"&&t!==null&&"v"in t?(s=t.v,a=t.w,c=t.name,arguments.length===2&&(u=e,d=!0)):(s=t,a=e,c=i,arguments.length>2&&(u=n,d=!0)),s=""+s,a=""+a,c!==void 0&&(c=""+c);let h=qa(this._isDirected,s,a,c);if(h in this._edgeLabels)return d&&(this._edgeLabels[h]=u),this;if(c!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(s),this.setNode(a),this._edgeLabels[h]=d?u:this._defaultEdgeLabelFn(s,a,c);let p=uL(this._isDirected,s,a,c);return s=p.v,a=p.w,Object.freeze(p),this._edgeObjs[h]=p,kw(this._preds[a],s),kw(this._sucs[s],a),this._in[a][h]=p,this._out[s][h]=p,this._edgeCount++,this}edge(t,e,n){let i=arguments.length===1?zh(this._isDirected,t):qa(this._isDirected,t,e,n);return this._edgeLabels[i]}edgeAsObj(t,e,n){let i=arguments.length===1?this.edge(t):this.edge(t,e,n);return typeof i!="object"?{label:i}:i}hasEdge(t,e,n){return(arguments.length===1?zh(this._isDirected,t):qa(this._isDirected,t,e,n))in this._edgeLabels}removeEdge(t,e,n){let i=arguments.length===1?zh(this._isDirected,t):qa(this._isDirected,t,e,n),s=this._edgeObjs[i];if(s){let a=s.v,c=s.w;delete this._edgeLabels[i],delete this._edgeObjs[i],Ow(this._preds[c],a),Ow(this._sucs[a],c),delete this._in[c][i],delete this._out[a][i],this._edgeCount--}return this}inEdges(t,e){return this.isDirected()?this.filterEdges(this._in[t],t,e):this.nodeEdges(t,e)}outEdges(t,e){return this.isDirected()?this.filterEdges(this._out[t],t,e):this.nodeEdges(t,e)}nodeEdges(t,e){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,e)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,e,n){if(!t)return;let i=Object.values(t);return n?i.filter(s=>s.v===e&&s.w===n||s.v===n&&s.w===e):i}};function kw(t,e){t[e]?t[e]++:t[e]=1}function Ow(t,e){t[e]!==void 0&&!--t[e]&&delete t[e]}function qa(t,e,n,i){let s=""+e,a=""+n;if(!t&&s>a){let c=s;s=a,a=c}return s+""+a+""+(i===void 0?"\0":i)}function uL(t,e,n,i){let s=""+e,a=""+n;if(!t&&s>a){let u=s;s=a,a=u}let c={v:s,w:a};return i&&(c.name=i),c}function zh(t,e){return qa(t,e.v,e.w,e.name)}var fL="4.0.1",Dw={};Rw(Dw,{read:()=>mL,write:()=>dL});function dL(t){let e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:hL(t),edges:pL(t)},n=t.graph();return n!==void 0&&(e.value=structuredClone(n)),e}function hL(t){return t.nodes().map(e=>{let n=t.node(e),i=t.parent(e),s={v:e};return n!==void 0&&(s.value=n),i!==void 0&&(s.parent=i),s})}function pL(t){return t.edges().map(e=>{let n=t.edge(e),i={v:e.v,w:e.w};return e.name!==void 0&&(i.name=e.name),n!==void 0&&(i.value=n),i})}function mL(t){let e=new _n(t.options);return t.value!==void 0&&e.setGraph(t.value),t.nodes.forEach(n=>{e.setNode(n.v,n.value),n.parent&&e.setParent(n.v,n.parent)}),t.edges.forEach(n=>{e.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),e}var Vh={};Rw(Vh,{CycleException:()=>ru,bellmanFord:()=>jw,components:()=>vL,dijkstra:()=>iu,dijkstraAll:()=>wL,findCycles:()=>SL,floydWarshall:()=>CL,isAcyclic:()=>_L,postorder:()=>AL,preorder:()=>ML,prim:()=>RL,shortestPaths:()=>kL,tarjan:()=>Vw,topsort:()=>Lw});var gL=()=>1;function jw(t,e,n,i){return yL(t,String(e),n||gL,i||function(s){return t.outEdges(s)})}function yL(t,e,n,i){let s={},a,c=0,u=t.nodes(),d=function(m){let y=n(m);s[m.v].distance+y<s[m.w].distance&&(s[m.w]={distance:s[m.v].distance+y,predecessor:m.v},a=!0)},h=function(){u.forEach(function(m){i(m).forEach(function(y){let b=y.v===m?y.v:y.w,x=b===y.v?y.w:y.v;d({v:b,w:x})})})};u.forEach(function(m){let y=m===e?0:Number.POSITIVE_INFINITY;s[m]={distance:y,predecessor:""}});let p=u.length;for(let m=1;m<p&&(a=!1,c++,h(),!!a);m++);if(c===p-1&&(a=!1,h(),a))throw new Error("The graph contains a negative weight cycle");return s}function vL(t){let e={},n=[],i;function s(a){a in e||(e[a]=!0,i.push(a),t.successors(a).forEach(s),t.predecessors(a).forEach(s))}return t.nodes().forEach(function(a){i=[],s(a),i.length&&n.push(i)}),n}var zw=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(t=>t.key)}has(t){return t in this._keyIndices}priority(t){let e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){let n=this._keyIndices,i=String(t);if(!(i in n)){let s=this._arr,a=s.length;return n[i]=a,s.push({key:i,priority:e}),this._decrease(a),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){let n=this._keyIndices[t];if(n===void 0)throw new Error(`Key not found: ${t}`);let i=this._arr[n].priority;if(e>i)throw new Error(`New priority is greater than current priority. Key: ${t} Old: ${i} New: ${e}`);this._arr[n].priority=e,this._decrease(n)}_heapify(t){let e=this._arr,n=2*t,i=n+1,s=t;n<e.length&&(s=e[n].priority<e[s].priority?n:s,i<e.length&&(s=e[i].priority<e[s].priority?i:s),s!==t&&(this._swap(t,s),this._heapify(s)))}_decrease(t){let e=this._arr,n=e[t].priority,i;for(;t!==0&&(i=t>>1,!(e[i].priority<n));)this._swap(t,i),t=i}_swap(t,e){let n=this._arr,i=this._keyIndices,s=n[t],a=n[e];n[t]=a,n[e]=s,i[a.key]=t,i[s.key]=e}},bL=()=>1;function iu(t,e,n,i){let s=function(a){return t.outEdges(a)};return xL(t,String(e),n||bL,i||s)}function xL(t,e,n,i){let s={},a=new zw,c,u,d=function(h){let p=h.v!==c?h.v:h.w,m=s[p],y=n(h),b=u.distance+y;if(y<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+h+" Weight: "+y);b<m.distance&&(m.distance=b,m.predecessor=c,a.decrease(p,b))};for(t.nodes().forEach(function(h){let p=h===e?0:Number.POSITIVE_INFINITY;s[h]={distance:p,predecessor:""},a.add(h,p)});a.size()>0&&(c=a.removeMin(),u=s[c],u.distance!==Number.POSITIVE_INFINITY);)i(c).forEach(d);return s}function wL(t,e,n){return t.nodes().reduce(function(i,s){return i[s]=iu(t,s,e,n),i},{})}function Vw(t){let e=0,n=[],i={},s=[];function a(c){let u=i[c]={onStack:!0,lowlink:e,index:e++};if(n.push(c),t.successors(c).forEach(function(d){d in i?i[d].onStack&&(u.lowlink=Math.min(u.lowlink,i[d].index)):(a(d),u.lowlink=Math.min(u.lowlink,i[d].lowlink))}),u.lowlink===u.index){let d=[],h;do h=n.pop(),i[h].onStack=!1,d.push(h);while(c!==h);s.push(d)}}return t.nodes().forEach(function(c){c in i||a(c)}),s}function SL(t){return Vw(t).filter(function(e){return e.length>1||e.length===1&&t.hasEdge(e[0],e[0])})}var EL=()=>1;function CL(t,e,n){return TL(t,e||EL,n||function(i){return t.outEdges(i)})}function TL(t,e,n){let i={},s=t.nodes();return s.forEach(function(a){i[a]={},i[a][a]={distance:0,predecessor:""},s.forEach(function(c){a!==c&&(i[a][c]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(a).forEach(function(c){let u=c.v===a?c.w:c.v,d=e(c);i[a][u]={distance:d,predecessor:a}})}),s.forEach(function(a){let c=i[a];s.forEach(function(u){let d=i[u];s.forEach(function(h){let p=d[a],m=c[h],y=d[h],b=p.distance+m.distance;b<y.distance&&(y.distance=b,y.predecessor=m.predecessor)})})}),i}var ru=class extends Error{constructor(...t){super(...t)}};function Lw(t){let e={},n={},i=[];function s(a){if(a in n)throw new ru;a in e||(n[a]=!0,e[a]=!0,t.predecessors(a).forEach(s),delete n[a],i.push(a))}if(t.sinks().forEach(s),Object.keys(e).length!==t.nodeCount())throw new ru;return i}function _L(t){try{Lw(t)}catch(e){if(e instanceof ru)return!1;throw e}return!0}function NL(t,e,n,i,s){Array.isArray(e)||(e=[e]);let a=(u=>{var d;return(d=t.isDirected()?t.successors(u):t.neighbors(u))!=null?d:[]}),c={};return e.forEach(function(u){if(!t.hasNode(u))throw new Error("Graph does not have node: "+u);s=Iw(t,u,n==="post",c,a,i,s)}),s}function Iw(t,e,n,i,s,a,c){return e in i||(i[e]=!0,n||(c=a(c,e)),s(e).forEach(function(u){c=Iw(t,u,n,i,s,a,c)}),n&&(c=a(c,e))),c}function Bw(t,e,n){return NL(t,e,n,function(i,s){return i.push(s),i},[])}function AL(t,e){return Bw(t,e,"post")}function ML(t,e){return Bw(t,e,"pre")}function RL(t,e){let n=new _n,i={},s=new zw,a;function c(d){let h=d.v===a?d.w:d.v,p=s.priority(h);if(p!==void 0){let m=e(d);m<p&&(i[h]=a,s.decrease(h,m))}}if(t.nodeCount()===0)return n;t.nodes().forEach(function(d){s.add(d,Number.POSITIVE_INFINITY),n.setNode(d)}),s.decrease(t.nodes()[0],0);let u=!1;for(;s.size()>0;){if(a=s.removeMin(),a in i)n.setEdge(a,i[a]);else{if(u)throw new Error("Input graph is not connected: "+t);u=!0}t.nodeEdges(a).forEach(c)}return n}function kL(t,e,n,i){return OL(t,e,n,i??(s=>{let a=t.outEdges(s);return a??[]}))}function OL(t,e,n,i){if(n===void 0)return iu(t,e,n,i);let s=!1,a=t.nodes();for(let c=0;c<a.length;c++){let u=i(a[c]);for(let d=0;d<u.length;d++){let h=u[d],p=h.v===a[c]?h.v:h.w,m=p===h.v?h.w:h.v;n({v:p,w:m})<0&&(s=!0)}if(s)return jw(t,e,n,i)}return iu(t,e,n,i)}function bs(t,e,n,i){let s=i;for(;t.hasNode(s);)s=Lh(i);return n.dummy=e,t.setNode(s,n),s}function DL(t){let e=new _n().setGraph(t.graph());return t.nodes().forEach(n=>e.setNode(n,t.node(n))),t.edges().forEach(n=>{let i=e.edge(n.v,n.w)||{weight:0,minlen:1},s=t.edge(n);e.setEdge(n.v,n.w,{weight:i.weight+s.weight,minlen:Math.max(i.minlen,s.minlen)})}),e}function Pw(t){let e=new _n({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(n=>{t.children(n).length||e.setNode(n,t.node(n))}),t.edges().forEach(n=>{e.setEdge(n,t.edge(n))}),e}function Hw(t,e){let n=t.x,i=t.y,s=e.x-n,a=e.y-i,c=t.width/2,u=t.height/2;if(!s&&!a)throw new Error("Not possible to find intersection inside of the rectangle");let d,h;return Math.abs(a)*c>Math.abs(s)*u?(a<0&&(u=-u),d=u*s/a,h=u):(s<0&&(c=-c),d=c,h=c*a/s),{x:n+d,y:i+h}}function Ya(t){let e=Ga(qw(t)+1).map(()=>[]);return t.nodes().forEach(n=>{let i=t.node(n),s=i.rank;s!==void 0&&(e[s]||(e[s]=[]),e[s][i.order]=n)}),e}function jL(t){let e=t.nodes().map(i=>{let s=t.node(i).rank;return s===void 0?Number.MAX_VALUE:s}),n=vo(Math.min,e);t.nodes().forEach(i=>{let s=t.node(i);Object.hasOwn(s,"rank")&&(s.rank-=n)})}function zL(t){let e=t.nodes().map(c=>t.node(c).rank).filter(c=>c!==void 0),n=vo(Math.min,e),i=[];t.nodes().forEach(c=>{let u=t.node(c).rank-n;i[u]||(i[u]=[]),i[u].push(c)});let s=0,a=t.graph().nodeRankFactor;Array.from(i).forEach((c,u)=>{c===void 0&&u%a!==0?--s:c!==void 0&&s&&c.forEach(d=>t.node(d).rank+=s)})}function Uw(t,e,n,i){let s={width:0,height:0};return arguments.length>=4&&(s.rank=n,s.order=i),bs(t,"border",s,e)}function VL(t,e=$w){let n=[];for(let i=0;i<t.length;i+=e){let s=t.slice(i,i+e);n.push(s)}return n}var $w=65535;function vo(t,e){if(e.length>$w){let n=VL(e);return t(...n.map(i=>t(...i)))}else return t(...e)}function qw(t){let e=t.nodes().map(n=>{let i=t.node(n).rank;return i===void 0?Number.MIN_VALUE:i});return vo(Math.max,e)}function LL(t,e){let n={lhs:[],rhs:[]};return t.forEach(i=>{e(i)?n.lhs.push(i):n.rhs.push(i)}),n}function Yw(t,e){let n=Date.now();try{return e()}finally{console.log(t+" time: "+(Date.now()-n)+"ms")}}function Gw(t,e){return e()}var IL=0;function Lh(t){let e=++IL;return t+(""+e)}function Ga(t,e,n=1){e==null&&(e=t,t=0);let i=a=>a<e;n<0&&(i=a=>e<a);let s=[];for(let a=t;i(a);a+=n)s.push(a);return s}function su(t,e){let n={};for(let i of e)t[i]!==void 0&&(n[i]=t[i]);return n}function au(t,e){let n;return typeof e=="string"?n=i=>i[e]:n=e,Object.entries(t).reduce((i,[s,a])=>(i[s]=n(a,s),i),{})}function BL(t,e){return t.reduce((n,i,s)=>(n[i]=e[s],n),{})}var lu="\0",PL="3.0.0",HL=class{constructor(){lL(this,"_sentinel");let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,e=t._prev;if(e!==t)return Xw(e),e}enqueue(t){let e=this._sentinel;t._prev&&t._next&&Xw(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e}toString(){let t=[],e=this._sentinel,n=e._prev;for(;n!==e;)t.push(JSON.stringify(n,UL)),n=n._prev;return"["+t.join(", ")+"]"}};function Xw(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function UL(t,e){if(t!=="_next"&&t!=="_prev")return e}var $L=HL,qL=()=>1;function YL(t,e){if(t.nodeCount()<=1)return[];let n=XL(t,e||qL);return GL(n.graph,n.buckets,n.zeroIdx).flatMap(i=>t.outEdges(i.v,i.w)||[])}function GL(t,e,n){var i;let s=[],a=e[e.length-1],c=e[0],u;for(;t.nodeCount();){for(;u=c.dequeue();)Ih(t,e,n,u);for(;u=a.dequeue();)Ih(t,e,n,u);if(t.nodeCount()){for(let d=e.length-2;d>0;--d)if(u=(i=e[d])==null?void 0:i.dequeue(),u){s=s.concat(Ih(t,e,n,u,!0)||[]);break}}}return s}function Ih(t,e,n,i,s){let a=[],c=s?a:void 0;return(t.inEdges(i.v)||[]).forEach(u=>{let d=t.edge(u),h=t.node(u.v);s&&a.push({v:u.v,w:u.w}),h.out-=d,Bh(e,n,h)}),(t.outEdges(i.v)||[]).forEach(u=>{let d=t.edge(u),h=u.w,p=t.node(h);p.in-=d,Bh(e,n,p)}),t.removeNode(i.v),c}function XL(t,e){let n=new _n,i=0,s=0;t.nodes().forEach(u=>{n.setNode(u,{v:u,in:0,out:0})}),t.edges().forEach(u=>{let d=n.edge(u.v,u.w)||0,h=e(u),p=d+h;n.setEdge(u.v,u.w,p);let m=n.node(u.v),y=n.node(u.w);s=Math.max(s,m.out+=h),i=Math.max(i,y.in+=h)});let a=FL(s+i+3).map(()=>new $L),c=i+1;return n.nodes().forEach(u=>{Bh(a,c,n.node(u))}),{graph:n,buckets:a,zeroIdx:c}}function Bh(t,e,n){var i,s,a;n.out?n.in?(a=t[n.out-n.in+e])==null||a.enqueue(n):(s=t[t.length-1])==null||s.enqueue(n):(i=t[0])==null||i.enqueue(n)}function FL(t){let e=[];for(let n=0;n<t;n++)e.push(n);return e}function ZL(t){(t.graph().acyclicer==="greedy"?YL(t,e(t)):KL(t)).forEach(n=>{let i=t.edge(n);t.removeEdge(n),i.forwardName=n.name,i.reversed=!0,t.setEdge(n.w,n.v,i,Lh("rev"))});function e(n){return i=>n.edge(i).weight}}function KL(t){let e=[],n={},i={};function s(a){Object.hasOwn(i,a)||(i[a]=!0,n[a]=!0,t.outEdges(a).forEach(c=>{Object.hasOwn(n,c.w)?e.push(c):s(c.w)}),delete n[a])}return t.nodes().forEach(s),e}function QL(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.reversed){t.removeEdge(e);let i=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,i)}})}function WL(t){t.graph().dummyChains=[],t.edges().forEach(e=>JL(t,e))}function JL(t,e){let n=e.v,i=t.node(n).rank,s=e.w,a=t.node(s).rank,c=e.name,u=t.edge(e),d=u.labelRank;if(a===i+1)return;t.removeEdge(e);let h,p,m;for(m=0,++i;i<a;++m,++i)u.points=[],p={width:0,height:0,edgeLabel:u,edgeObj:e,rank:i},h=bs(t,"edge",p,"_d"),i===d&&(p.width=u.width,p.height=u.height,p.dummy="edge-label",p.labelpos=u.labelpos),t.setEdge(n,h,{weight:u.weight},c),m===0&&t.graph().dummyChains.push(h),n=h;t.setEdge(n,s,{weight:u.weight},c)}function tI(t){t.graph().dummyChains.forEach(e=>{let n=t.node(e),i=n.edgeLabel,s;for(t.setEdge(n.edgeObj,i);n.dummy;)s=t.successors(e)[0],t.removeNode(e),i.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(i.x=n.x,i.y=n.y,i.width=n.width,i.height=n.height),e=s,n=t.node(e)})}function Ph(t){let e={};function n(i){let s=t.node(i);if(Object.hasOwn(e,i))return s.rank;e[i]=!0;let a=t.outEdges(i),c=a?a.map(d=>d==null?Number.POSITIVE_INFINITY:n(d.w)-t.edge(d).minlen):[],u=vo(Math.min,c);return u===Number.POSITIVE_INFINITY&&(u=0),s.rank=u}t.sources().forEach(n)}function xs(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}var Fw=eI;function eI(t){let e=new _n({directed:!1}),n=t.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let i=n[0],s=t.nodeCount();e.setNode(i,{});let a,c;for(;nI(e,t)<s&&(a=oI(e,t),!!a);)c=e.hasNode(a.v)?xs(t,a):-xs(t,a),iI(e,t,c);return e}function nI(t,e){function n(i){let s=e.nodeEdges(i);s&&s.forEach(a=>{let c=a.v,u=i===c?a.w:c;!t.hasNode(u)&&!xs(e,a)&&(t.setNode(u,{}),t.setEdge(i,u,{}),n(u))})}return t.nodes().forEach(n),t.nodeCount()}function oI(t,e){return e.edges().reduce((n,i)=>{let s=Number.POSITIVE_INFINITY;return t.hasNode(i.v)!==t.hasNode(i.w)&&(s=xs(e,i)),s<n[0]?[s,i]:n},[Number.POSITIVE_INFINITY,null])[1]}function iI(t,e,n){t.nodes().forEach(i=>e.node(i).rank+=n)}var{preorder:rI,postorder:sI}=Vh,aI=Mr;Mr.initLowLimValues=Uh,Mr.initCutValues=Hh,Mr.calcCutValue=Zw,Mr.leaveEdge=Qw,Mr.enterEdge=Ww,Mr.exchangeEdges=Jw;function Mr(t){t=DL(t),Ph(t);let e=Fw(t);Uh(e),Hh(e,t);let n,i;for(;n=Qw(e);)i=Ww(e,t,n),Jw(e,t,n,i)}function Hh(t,e){let n=sI(t,t.nodes());n=n.slice(0,n.length-1),n.forEach(i=>lI(t,e,i))}function lI(t,e,n){let i=t.node(n).parent,s=t.edge(n,i);s.cutvalue=Zw(t,e,n)}function Zw(t,e,n){let i=t.node(n).parent,s=!0,a=e.edge(n,i),c=0;a||(s=!1,a=e.edge(i,n)),c=a.weight;let u=e.nodeEdges(n);return u&&u.forEach(d=>{let h=d.v===n,p=h?d.w:d.v;if(p!==i){let m=h===s,y=e.edge(d).weight;if(c+=m?y:-y,uI(t,n,p)){let b=t.edge(n,p).cutvalue;c+=m?-b:b}}}),c}function Uh(t,e){arguments.length<2&&(e=t.nodes()[0]),Kw(t,{},1,e)}function Kw(t,e,n,i,s){let a=n,c=t.node(i);e[i]=!0;let u=t.neighbors(i);return u&&u.forEach(d=>{Object.hasOwn(e,d)||(n=Kw(t,e,n,d,i))}),c.low=a,c.lim=n++,s?c.parent=s:delete c.parent,n}function Qw(t){return t.edges().find(e=>t.edge(e).cutvalue<0)}function Ww(t,e,n){let i=n.v,s=n.w;e.hasEdge(i,s)||(i=n.w,s=n.v);let a=t.node(i),c=t.node(s),u=a,d=!1;return a.lim>c.lim&&(u=c,d=!0),e.edges().filter(h=>d===t1(t,t.node(h.v),u)&&d!==t1(t,t.node(h.w),u)).reduce((h,p)=>xs(e,p)<xs(e,h)?p:h)}function Jw(t,e,n,i){let s=n.v,a=n.w;t.removeEdge(s,a),t.setEdge(i.v,i.w,{}),Uh(t),Hh(t,e),cI(t,e)}function cI(t,e){let n=t.nodes().find(s=>!t.node(s).parent);if(!n)return;let i=rI(t,[n]);i=i.slice(1),i.forEach(s=>{let a=t.node(s).parent,c=e.edge(s,a),u=!1;c||(c=e.edge(a,s),u=!0),e.node(s).rank=e.node(a).rank+(u?c.minlen:-c.minlen)})}function uI(t,e,n){return t.hasEdge(e,n)}function t1(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}var fI=dI;function dI(t){let e=t.graph().ranker;if(typeof e=="function")return e(t);switch(e){case"network-simplex":e1(t);break;case"tight-tree":pI(t);break;case"longest-path":hI(t);break;case"none":break;default:e1(t)}}var hI=Ph;function pI(t){Ph(t),Fw(t)}function e1(t){aI(t)}var mI=gI;function gI(t){let e=vI(t);t.graph().dummyChains.forEach(n=>{let i=t.node(n),s=i.edgeObj,a=yI(t,e,s.v,s.w),c=a.path,u=a.lca,d=0,h=c[d],p=!0;for(;n!==s.w;){if(i=t.node(n),p){for(;(h=c[d])!==u&&t.node(h).maxRank<i.rank;)d++;h===u&&(p=!1)}if(!p){for(;d<c.length-1&&t.node(c[d+1]).minRank<=i.rank;)d++;h=c[d]}h!==void 0&&t.setParent(n,h),n=t.successors(n)[0]}})}function yI(t,e,n,i){let s=[],a=[],c=Math.min(e[n].low,e[i].low),u=Math.max(e[n].lim,e[i].lim),d;d=n;do d=t.parent(d),s.push(d);while(d&&(e[d].low>c||u>e[d].lim));let h=d,p=i;for(;(p=t.parent(p))!==h;)a.push(p);return{path:s.concat(a.reverse()),lca:h}}function vI(t){let e={},n=0;function i(s){let a=n;t.children(s).forEach(i),e[s]={low:a,lim:n++}}return t.children(lu).forEach(i),e}function bI(t){let e=bs(t,"root",{},"_root"),n=xI(t),i=Object.values(n),s=vo(Math.max,i)-1,a=2*s+1;t.graph().nestingRoot=e,t.edges().forEach(u=>t.edge(u).minlen*=a);let c=wI(t)+1;t.children(lu).forEach(u=>n1(t,e,a,c,s,n,u)),t.graph().nodeRankFactor=a}function n1(t,e,n,i,s,a,c){var u;let d=t.children(c);if(!d.length){c!==e&&t.setEdge(e,c,{weight:0,minlen:n});return}let h=Uw(t,"_bt"),p=Uw(t,"_bb"),m=t.node(c);t.setParent(h,c),m.borderTop=h,t.setParent(p,c),m.borderBottom=p,d.forEach(y=>{var b;n1(t,e,n,i,s,a,y);let x=t.node(y),w=x.borderTop?x.borderTop:y,S=x.borderBottom?x.borderBottom:y,E=x.borderTop?i:2*i,D=w!==S?1:s-((b=a[c])!=null?b:0)+1;t.setEdge(h,w,{weight:E,minlen:D,nestingEdge:!0}),t.setEdge(S,p,{weight:E,minlen:D,nestingEdge:!0})}),t.parent(c)||t.setEdge(e,h,{weight:0,minlen:s+((u=a[c])!=null?u:0)})}function xI(t){let e={};function n(i,s){let a=t.children(i);a&&a.length&&a.forEach(c=>n(c,s+1)),e[i]=s}return t.children(lu).forEach(i=>n(i,1)),e}function wI(t){return t.edges().reduce((e,n)=>e+t.edge(n).weight,0)}function SI(t){let e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(n=>{t.edge(n).nestingEdge&&t.removeEdge(n)})}var EI=CI;function CI(t){function e(n){let i=t.children(n),s=t.node(n);if(i.length&&i.forEach(e),Object.hasOwn(s,"minRank")){s.borderLeft=[],s.borderRight=[];for(let a=s.minRank,c=s.maxRank+1;a<c;++a)o1(t,"borderLeft","_bl",n,s,a),o1(t,"borderRight","_br",n,s,a)}}t.children(lu).forEach(e)}function o1(t,e,n,i,s,a){let c={width:0,height:0,rank:a,borderType:e},u=s[e][a-1],d=bs(t,"border",c,n);s[e][a]=d,t.setParent(d,i),u&&t.setEdge(u,d,{weight:1})}function TI(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="lr"||n==="rl")&&i1(t)}function _I(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="bt"||n==="rl")&&NI(t),(n==="lr"||n==="rl")&&(AI(t),i1(t))}function i1(t){t.nodes().forEach(e=>r1(t.node(e))),t.edges().forEach(e=>r1(t.edge(e)))}function r1(t){let e=t.width;t.width=t.height,t.height=e}function NI(t){t.nodes().forEach(e=>$h(t.node(e))),t.edges().forEach(e=>{var n;let i=t.edge(e);(n=i.points)==null||n.forEach($h),Object.hasOwn(i,"y")&&$h(i)})}function $h(t){t.y=-t.y}function AI(t){t.nodes().forEach(e=>qh(t.node(e))),t.edges().forEach(e=>{var n;let i=t.edge(e);(n=i.points)==null||n.forEach(qh),Object.hasOwn(i,"x")&&qh(i)})}function qh(t){let e=t.x;t.x=t.y,t.y=e}function MI(t){let e={},n=t.nodes().filter(u=>!t.children(u).length),i=n.map(u=>t.node(u).rank),s=vo(Math.max,i),a=Ga(s+1).map(()=>[]);function c(u){if(e[u])return;e[u]=!0;let d=t.node(u);a[d.rank].push(u);let h=t.successors(u);h&&h.forEach(c)}return n.sort((u,d)=>t.node(u).rank-t.node(d).rank).forEach(c),a}function RI(t,e){let n=0;for(let i=1;i<e.length;++i)n+=kI(t,e[i-1],e[i]);return n}function kI(t,e,n){let i=BL(n,n.map((h,p)=>p)),s=e.flatMap(h=>{let p=t.outEdges(h);return p?p.map(m=>({pos:i[m.w],weight:t.edge(m).weight})).sort((m,y)=>m.pos-y.pos):[]}),a=1;for(;a<n.length;)a<<=1;let c=2*a-1;a-=1;let u=new Array(c).fill(0),d=0;return s.forEach(h=>{let p=h.pos+a;u[p]+=h.weight;let m=0;for(;p>0;)p%2&&(m+=u[p+1]),p=p-1>>1,u[p]+=h.weight;d+=h.weight*m}),d}function OI(t,e=[]){return e.map(n=>{let i=t.inEdges(n);if(!i||!i.length)return{v:n};{let s=i.reduce((a,c)=>{let u=t.edge(c),d=t.node(c.v);return{sum:a.sum+u.weight*d.order,weight:a.weight+u.weight}},{sum:0,weight:0});return{v:n,barycenter:s.sum/s.weight,weight:s.weight}}})}function DI(t,e){let n={};t.forEach((s,a)=>{let c={indegree:0,in:[],out:[],vs:[s.v],i:a};s.barycenter!==void 0&&(c.barycenter=s.barycenter,c.weight=s.weight),n[s.v]=c}),e.edges().forEach(s=>{let a=n[s.v],c=n[s.w];a!==void 0&&c!==void 0&&(c.indegree++,a.out.push(c))});let i=Object.values(n).filter(s=>!s.indegree);return jI(i)}function jI(t){let e=[];function n(s){return a=>{a.merged||(a.barycenter===void 0||s.barycenter===void 0||a.barycenter>=s.barycenter)&&zI(s,a)}}function i(s){return a=>{a.in.push(s),--a.indegree===0&&t.push(a)}}for(;t.length;){let s=t.pop();e.push(s),s.in.reverse().forEach(n(s)),s.out.forEach(i(s))}return e.filter(s=>!s.merged).map(s=>su(s,["vs","i","barycenter","weight"]))}function zI(t,e){let n=0,i=0;t.weight&&(n+=t.barycenter*t.weight,i+=t.weight),e.weight&&(n+=e.barycenter*e.weight,i+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=n/i,t.weight=i,t.i=Math.min(e.i,t.i),e.merged=!0}function VI(t,e){let n=LL(t,p=>Object.hasOwn(p,"barycenter")),i=n.lhs,s=n.rhs.sort((p,m)=>m.i-p.i),a=[],c=0,u=0,d=0;i.sort(LI(!!e)),d=s1(a,s,d),i.forEach(p=>{d+=p.vs.length,a.push(p.vs),c+=p.barycenter*p.weight,u+=p.weight,d=s1(a,s,d)});let h={vs:a.flat(1)};return u&&(h.barycenter=c/u,h.weight=u),h}function s1(t,e,n){let i;for(;e.length&&(i=e[e.length-1]).i<=n;)e.pop(),t.push(i.vs),n++;return n}function LI(t){return(e,n)=>e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i}function a1(t,e,n,i){let s=t.children(e),a=t.node(e),c=a?a.borderLeft:void 0,u=a?a.borderRight:void 0,d={};c&&(s=s.filter(y=>y!==c&&y!==u));let h=OI(t,s);h.forEach(y=>{if(t.children(y.v).length){let b=a1(t,y.v,n,i);d[y.v]=b,Object.hasOwn(b,"barycenter")&&BI(y,b)}});let p=DI(h,n);II(p,d);let m=VI(p,i);if(c&&u){m.vs=[c,m.vs,u].flat(1);let y=t.predecessors(c);if(y&&y.length){let b=t.node(y[0]),x=t.predecessors(u),w=t.node(x[0]);Object.hasOwn(m,"barycenter")||(m.barycenter=0,m.weight=0),m.barycenter=(m.barycenter*m.weight+b.order+w.order)/(m.weight+2),m.weight+=2}}return m}function II(t,e){t.forEach(n=>{n.vs=n.vs.flatMap(i=>e[i]?e[i].vs:i)})}function BI(t,e){t.barycenter!==void 0?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)}function PI(t,e,n,i){i||(i=t.nodes());let s=HI(t),a=new _n({compound:!0}).setGraph({root:s}).setDefaultNodeLabel(c=>t.node(c));return i.forEach(c=>{let u=t.node(c),d=t.parent(c);if(u.rank===e||u.minRank<=e&&e<=u.maxRank){a.setNode(c),a.setParent(c,d||s);let h=t[n](c);h&&h.forEach(p=>{let m=p.v===c?p.w:p.v,y=a.edge(m,c),b=y!==void 0?y.weight:0;a.setEdge(m,c,{weight:t.edge(p).weight+b})}),Object.hasOwn(u,"minRank")&&a.setNode(c,{borderLeft:u.borderLeft[e],borderRight:u.borderRight[e]})}}),a}function HI(t){let e;for(;t.hasNode(e=Lh("_root")););return e}function UI(t,e,n){let i={},s;n.forEach(a=>{let c=t.parent(a),u,d;for(;c;){if(u=t.parent(c),u?(d=i[u],i[u]=c):(d=s,s=c),d&&d!==c){e.setEdge(d,c);return}c=u}})}function l1(t,e={}){if(typeof e.customOrder=="function"){e.customOrder(t,l1);return}let n=qw(t),i=c1(t,Ga(1,n+1),"inEdges"),s=c1(t,Ga(n-1,-1,-1),"outEdges"),a=MI(t);if(u1(t,a),e.disableOptimalOrderHeuristic)return;let c=Number.POSITIVE_INFINITY,u,d=e.constraints||[];for(let h=0,p=0;p<4;++h,++p){$I(h%2?i:s,h%4>=2,d),a=Ya(t);let m=RI(t,a);m<c?(p=0,u=Object.assign({},a),c=m):m===c&&(u=structuredClone(a))}u1(t,u)}function c1(t,e,n){let i=new Map,s=(a,c)=>{i.has(a)||i.set(a,[]),i.get(a).push(c)};for(let a of t.nodes()){let c=t.node(a);if(typeof c.rank=="number"&&s(c.rank,a),typeof c.minRank=="number"&&typeof c.maxRank=="number")for(let u=c.minRank;u<=c.maxRank;u++)u!==c.rank&&s(u,a)}return e.map(function(a){return PI(t,a,n,i.get(a)||[])})}function $I(t,e,n){let i=new _n;t.forEach(function(s){n.forEach(u=>i.setEdge(u.left,u.right));let a=s.graph().root,c=a1(s,a,i,e);c.vs.forEach((u,d)=>s.node(u).order=d),UI(s,i,c.vs)})}function u1(t,e){Object.values(e).forEach(n=>n.forEach((i,s)=>t.node(i).order=s))}function qI(t,e){let n={};function i(s,a){let c=0,u=0,d=s.length,h=a[a.length-1];return a.forEach((p,m)=>{let y=GI(t,p),b=y?t.node(y).order:d;(y||p===h)&&(a.slice(u,m+1).forEach(x=>{let w=t.predecessors(x);w&&w.forEach(S=>{let E=t.node(S),D=E.order;(D<c||b<D)&&!(E.dummy&&t.node(x).dummy)&&f1(n,S,x)})}),u=m+1,c=b)}),a}return e.length&&e.reduce(i),n}function YI(t,e){let n={};function i(a,c,u,d,h){Ga(c,u).forEach(p=>{let m=a[p];if(m!==void 0&&t.node(m).dummy){let y=t.predecessors(m);y&&y.forEach(b=>{if(b===void 0)return;let x=t.node(b);x.dummy&&(x.order<d||x.order>h)&&f1(n,b,m)})}})}function s(a,c){let u=-1,d=-1,h=0;return c.forEach((p,m)=>{if(t.node(p).dummy==="border"){let y=t.predecessors(p);if(y&&y.length){let b=y[0];if(b===void 0)return;d=t.node(b).order,i(c,h,m,u,d),h=m,u=d}}i(c,h,c.length,d,a.length)}),c}return e.length&&e.reduce(s),n}function GI(t,e){if(t.node(e).dummy){let n=t.predecessors(e);if(n)return n.find(i=>t.node(i).dummy)}}function f1(t,e,n){if(e>n){let s=e;e=n,n=s}let i=t[e];i||(t[e]=i={}),i[n]=!0}function XI(t,e,n){if(e>n){let s=e;e=n,n=s}let i=t[e];return i!==void 0&&Object.hasOwn(i,n)}function FI(t,e,n,i){let s={},a={},c={};return e.forEach(u=>{u.forEach((d,h)=>{s[d]=d,a[d]=d,c[d]=h})}),e.forEach(u=>{let d=-1;u.forEach(h=>{let p=i(h);if(p&&p.length){let m=p.sort((b,x)=>{let w=c[b],S=c[x];return(w!==void 0?w:0)-(S!==void 0?S:0)}),y=(m.length-1)/2;for(let b=Math.floor(y),x=Math.ceil(y);b<=x;++b){let w=m[b];if(w===void 0)continue;let S=c[w];if(S!==void 0&&a[h]===h&&d<S&&!XI(n,h,w)){let E=s[w];E!==void 0&&(a[w]=h,a[h]=s[h]=E,d=S)}}}})}),{root:s,align:a}}function ZI(t,e,n,i,s=!1){let a={},c=KI(t,e,n,s),u=s?"borderLeft":"borderRight";function d(b,x){let w=c.nodes().slice(),S={},E=w.pop();for(;E;){if(S[E])b(E);else{S[E]=!0,w.push(E);for(let D of x(E))w.push(D)}E=w.pop()}}function h(b){let x=c.inEdges(b);x?a[b]=x.reduce((w,S)=>{var E;let D=(E=a[S.v])!=null?E:0,T=c.edge(S);return Math.max(w,D+(T!==void 0?T:0))},0):a[b]=0}function p(b){let x=c.outEdges(b),w=Number.POSITIVE_INFINITY;x&&(w=x.reduce((E,D)=>{let T=a[D.w],C=c.edge(D);return Math.min(E,(T!==void 0?T:0)-(C!==void 0?C:0))},Number.POSITIVE_INFINITY));let S=t.node(b);w!==Number.POSITIVE_INFINITY&&S.borderType!==u&&(a[b]=Math.max(a[b]!==void 0?a[b]:0,w))}function m(b){return c.predecessors(b)||[]}function y(b){return c.successors(b)||[]}return d(h,m),d(p,y),Object.keys(i).forEach(b=>{var x;let w=n[b];w!==void 0&&(a[b]=(x=a[w])!=null?x:0)}),a}function KI(t,e,n,i){let s=new _n,a=t.graph(),c=e6(a.nodesep,a.edgesep,i);return e.forEach(u=>{let d;u.forEach(h=>{let p=n[h];if(p!==void 0){if(s.setNode(p),d!==void 0){let m=n[d];if(m!==void 0){let y=s.edge(m,p);s.setEdge(m,p,Math.max(c(t,h,d),y||0))}}d=h}})}),s}function QI(t,e){return Object.values(e).reduce((n,i)=>{let s=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;Object.entries(i).forEach(([u,d])=>{let h=n6(t,u)/2;s=Math.max(d+h,s),a=Math.min(d-h,a)});let c=s-a;return c<n[0]&&(n=[c,i]),n},[Number.POSITIVE_INFINITY,null])[1]}function WI(t,e){let n=Object.values(e),i=vo(Math.min,n),s=vo(Math.max,n);["u","d"].forEach(a=>{["l","r"].forEach(c=>{let u=a+c,d=t[u];if(!d||d===e)return;let h=Object.values(d),p=i-vo(Math.min,h);c!=="l"&&(p=s-vo(Math.max,h)),p&&(t[u]=au(d,m=>m+p))})})}function JI(t,e=void 0){let n=t.ul;return n?au(n,(i,s)=>{var a,c;if(e){let d=e.toLowerCase(),h=t[d];if(h&&h[s]!==void 0)return h[s]}let u=Object.values(t).map(d=>{let h=d[s];return h!==void 0?h:0}).sort((d,h)=>d-h);return(((a=u[1])!=null?a:0)+((c=u[2])!=null?c:0))/2}):{}}function t6(t){let e=Ya(t),n=Object.assign(qI(t,e),YI(t,e)),i={},s;["u","d"].forEach(c=>{s=c==="u"?e:Object.values(e).reverse(),["l","r"].forEach(u=>{u==="r"&&(s=s.map(p=>Object.values(p).reverse()));let d=FI(t,s,n,p=>(c==="u"?t.predecessors(p):t.successors(p))||[]),h=ZI(t,s,d.root,d.align,u==="r");u==="r"&&(h=au(h,p=>-p)),i[c+u]=h})});let a=QI(t,i);return WI(i,a),JI(i,t.graph().align)}function e6(t,e,n){return(i,s,a)=>{let c=i.node(s),u=i.node(a),d=0,h;if(d+=c.width/2,Object.hasOwn(c,"labelpos"))switch(c.labelpos.toLowerCase()){case"l":h=-c.width/2;break;case"r":h=c.width/2;break}if(h&&(d+=n?h:-h),h=void 0,d+=(c.dummy?e:t)/2,d+=(u.dummy?e:t)/2,d+=u.width/2,Object.hasOwn(u,"labelpos"))switch(u.labelpos.toLowerCase()){case"l":h=u.width/2;break;case"r":h=-u.width/2;break}return h&&(d+=n?h:-h),d}}function n6(t,e){return t.node(e).width}function o6(t){t=Pw(t),i6(t),Object.entries(t6(t)).forEach(([e,n])=>t.node(e).x=n)}function i6(t){let e=Ya(t),n=t.graph(),i=n.ranksep,s=n.rankalign,a=0;e.forEach(c=>{let u=c.reduce((d,h)=>{var p;let m=(p=t.node(h).height)!=null?p:0;return d>m?d:m},0);c.forEach(d=>{let h=t.node(d);s==="top"?h.y=a+h.height/2:s==="bottom"?h.y=a+u-h.height/2:h.y=a+u/2}),a+=u+i})}function r6(t,e={}){let n=e.debugTiming?Yw:Gw;return n("layout",()=>{let i=n(" buildLayoutGraph",()=>m6(t));return n(" runLayout",()=>s6(i,n,e)),n(" updateInputGraph",()=>a6(t,i)),i})}function s6(t,e,n){e(" makeSpaceForEdgeLabels",()=>g6(t)),e(" removeSelfEdges",()=>T6(t)),e(" acyclic",()=>ZL(t)),e(" nestingGraph.run",()=>bI(t)),e(" rank",()=>fI(Pw(t))),e(" injectEdgeLabelProxies",()=>y6(t)),e(" removeEmptyRanks",()=>zL(t)),e(" nestingGraph.cleanup",()=>SI(t)),e(" normalizeRanks",()=>jL(t)),e(" assignRankMinMax",()=>v6(t)),e(" removeEdgeLabelProxies",()=>b6(t)),e(" normalize.run",()=>WL(t)),e(" parentDummyChains",()=>mI(t)),e(" addBorderSegments",()=>EI(t)),e(" order",()=>l1(t,n)),e(" insertSelfEdges",()=>_6(t)),e(" adjustCoordinateSystem",()=>TI(t)),e(" position",()=>o6(t)),e(" positionSelfEdges",()=>N6(t)),e(" removeBorderNodes",()=>C6(t)),e(" normalize.undo",()=>tI(t)),e(" fixupEdgeLabelCoords",()=>S6(t)),e(" undoCoordinateSystem",()=>_I(t)),e(" translateGraph",()=>x6(t)),e(" assignNodeIntersects",()=>w6(t)),e(" reversePoints",()=>E6(t)),e(" acyclic.undo",()=>QL(t))}function a6(t,e){t.nodes().forEach(n=>{let i=t.node(n),s=e.node(n);i&&(i.x=s.x,i.y=s.y,i.order=s.order,i.rank=s.rank,e.children(n).length&&(i.width=s.width,i.height=s.height))}),t.edges().forEach(n=>{let i=t.edge(n),s=e.edge(n);i.points=s.points,Object.hasOwn(s,"x")&&(i.x=s.x,i.y=s.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}var l6=["nodesep","edgesep","ranksep","marginx","marginy"],c6={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},u6=["acyclicer","ranker","rankdir","align","rankalign"],f6=["width","height","rank"],d1={width:0,height:0},d6=["minlen","weight","width","height","labeloffset"],h6={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},p6=["labelpos"];function m6(t){let e=new _n({multigraph:!0,compound:!0}),n=Gh(t.graph());return e.setGraph(Object.assign({},c6,Yh(n,l6),su(n,u6))),t.nodes().forEach(i=>{let s=Gh(t.node(i)),a=Yh(s,f6);Object.keys(d1).forEach(u=>{a[u]===void 0&&(a[u]=d1[u])}),e.setNode(i,a);let c=t.parent(i);c!==void 0&&e.setParent(i,c)}),t.edges().forEach(i=>{let s=Gh(t.edge(i));e.setEdge(i,Object.assign({},h6,Yh(s,d6),su(s,p6)))}),e}function g6(t){let e=t.graph();e.ranksep/=2,t.edges().forEach(n=>{let i=t.edge(n);i.minlen*=2,i.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?i.width+=i.labeloffset:i.height+=i.labeloffset)})}function y6(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.width&&n.height){let i=t.node(e.v),s={rank:(t.node(e.w).rank-i.rank)/2+i.rank,e};bs(t,"edge-proxy",s,"_ep")}})}function v6(t){let e=0;t.nodes().forEach(n=>{let i=t.node(n);i.borderTop&&(i.minRank=t.node(i.borderTop).rank,i.maxRank=t.node(i.borderBottom).rank,e=Math.max(e,i.maxRank))}),t.graph().maxRank=e}function b6(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="edge-proxy"){let i=n;t.edge(i.e).labelRank=n.rank,t.removeNode(e)}})}function x6(t){let e=Number.POSITIVE_INFINITY,n=0,i=Number.POSITIVE_INFINITY,s=0,a=t.graph(),c=a.marginx||0,u=a.marginy||0;function d(h){let p=h.x,m=h.y,y=h.width,b=h.height;e=Math.min(e,p-y/2),n=Math.max(n,p+y/2),i=Math.min(i,m-b/2),s=Math.max(s,m+b/2)}t.nodes().forEach(h=>d(t.node(h))),t.edges().forEach(h=>{let p=t.edge(h);Object.hasOwn(p,"x")&&d(p)}),e-=c,i-=u,t.nodes().forEach(h=>{let p=t.node(h);p.x-=e,p.y-=i}),t.edges().forEach(h=>{let p=t.edge(h);p.points.forEach(m=>{m.x-=e,m.y-=i}),Object.hasOwn(p,"x")&&(p.x-=e),Object.hasOwn(p,"y")&&(p.y-=i)}),a.width=n-e+c,a.height=s-i+u}function w6(t){t.edges().forEach(e=>{let n=t.edge(e),i=t.node(e.v),s=t.node(e.w),a,c;n.points?(a=n.points[0],c=n.points[n.points.length-1]):(n.points=[],a=s,c=i),n.points.unshift(Hw(i,a)),n.points.push(Hw(s,c))})}function S6(t){t.edges().forEach(e=>{let n=t.edge(e);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function E6(t){t.edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}function C6(t){t.nodes().forEach(e=>{if(t.children(e).length){let n=t.node(e),i=t.node(n.borderTop),s=t.node(n.borderBottom),a=t.node(n.borderLeft[n.borderLeft.length-1]),c=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(c.x-a.x),n.height=Math.abs(s.y-i.y),n.x=a.x+n.width/2,n.y=i.y+n.height/2}}),t.nodes().forEach(e=>{t.node(e).dummy==="border"&&t.removeNode(e)})}function T6(t){t.edges().forEach(e=>{if(e.v===e.w){let n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}})}function _6(t){Ya(t).forEach(e=>{let n=0;e.forEach((i,s)=>{let a=t.node(i);a.order=s+n,(a.selfEdges||[]).forEach(c=>{bs(t,"selfedge",{width:c.label.width,height:c.label.height,rank:a.rank,order:s+ ++n,e:c.e,label:c.label},"_se")}),delete a.selfEdges})})}function N6(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="selfedge"){let i=n,s=t.node(i.e.v),a=s.x+s.width/2,c=s.y,u=n.x-a,d=s.height/2;t.setEdge(i.e,i.label),t.removeNode(e),i.label.points=[{x:a+2*u/3,y:c-d},{x:a+5*u/6,y:c-d},{x:a+u,y:c},{x:a+5*u/6,y:c+d},{x:a+2*u/3,y:c+d}],i.label.x=n.x,i.label.y=n.y}})}function Yh(t,e){return au(su(t,e),Number)}function Gh(t){let e={};return t&&Object.entries(t).forEach(([n,i])=>{typeof n=="string"&&(n=n.toLowerCase()),e[n]=i}),e}function A6(t){let e=Ya(t),n=new _n({compound:!0,multigraph:!0}).setGraph({});return t.nodes().forEach(i=>{n.setNode(i,{label:i}),n.setParent(i,"layer"+t.node(i).rank)}),t.edges().forEach(i=>n.setEdge(i.v,i.w,{},i.name)),e.forEach((i,s)=>{let a="layer"+s;n.setNode(a,{rank:"same"}),i.reduce((c,u)=>(n.setEdge(c,u,{style:"invis"}),u))}),n}var M6={graphlib:Mw,version:PL,layout:r6,debug:A6,util:{time:Yw,notime:Gw}},h1=M6;const R6={Switch:{width:140,height:110},Button:{width:120,height:80},Input:{width:140,height:80},Led:{width:100,height:110},Output:{width:100,height:80},HexDisplay:{width:100,height:80},SevenSegment:{width:100,height:80},Screen:{width:200,height:200},RasterDisplay:{width:200,height:200},Console:{width:380,height:220},Register:{width:120,height:80},RAM:{width:120,height:80},ROM:{width:120,height:80},DualPortRAM:{width:140,height:100}},k6={width:160,height:80};function O6(t){return R6[t]??k6}function D6(t,e){const a=new h1.graphlib.Graph;a.setGraph({rankdir:"LR",nodesep:60,ranksep:90,marginx:20,marginy:20}),a.setDefaultEdgeLabel(()=>({}));const c=new Set;for(const d of t.nodes){const h=O6(d.componentRef);a.setNode(d.id,{width:h.width,height:h.height}),c.add(d.id)}for(const d of t.connections)!c.has(d.source.nodeId)||!c.has(d.target.nodeId)||a.setEdge(d.source.nodeId,d.target.nodeId);h1.layout(a);const u={components:{},connections:{}};for(const d of t.nodes){const h=a.node(d.id);h&&(u.components[d.id]={id:d.id,position:{x:h.x-h.width/2,y:h.y-h.height/2}})}return u}function j6(t,e){return N.useMemo(()=>t?{metadata:D6(t),isLayoutReady:!0}:{metadata:{components:{},connections:{}},isLayoutReady:!1},[t,e?.direction,e?.nodeSpacing,e?.rankSpacing])}const p1="(pointer: coarse) and (max-width: 1024px)";function z6(){const[t,e]=N.useState(()=>typeof window>"u"||!window.matchMedia?!1:window.matchMedia(p1).matches);return N.useEffect(()=>{if(typeof window>"u"||!window.matchMedia)return;const n=window.matchMedia(p1),i=s=>e(s.matches);return e(n.matches),n.addEventListener("change",i),()=>n.removeEventListener("change",i)},[]),t}function m1(){const[t,e]=N.useState(()=>typeof document<"u"&&document.documentElement.classList.contains("dark")?"dark":"light");return N.useEffect(()=>{const n=document.documentElement,i=new MutationObserver(()=>{e(n.classList.contains("dark")?"dark":"light")});return i.observe(n,{attributes:!0,attributeFilter:["class"]}),()=>i.disconnect()},[]),t}const Xh=N.createContext({});function Fh(t){const e=N.useRef(null);return e.current===null&&(e.current=t()),e.current}const g1=typeof window<"u",y1=g1?N.useLayoutEffect:N.useEffect,cu=N.createContext(null);function Zh(t,e){t.indexOf(e)===-1&&t.push(e)}function uu(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const bo=(t,e,n)=>n>e?e:n<t?t:n;let Kh=()=>{};const Bo={},v1=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function b1(t){return typeof t=="object"&&t!==null}const x1=t=>/^0[^.\s]+$/u.test(t);function w1(t){let e;return()=>(e===void 0&&(e=t()),e)}const Nn=t=>t,V6=(t,e)=>n=>e(t(n)),Xa=(...t)=>t.reduce(V6),Fa=(t,e,n)=>{const i=e-t;return i===0?1:(n-t)/i};class Qh{constructor(){this.subscriptions=[]}add(e){return Zh(this.subscriptions,e),()=>uu(this.subscriptions,e)}notify(e,n,i){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,i);else for(let a=0;a<s;a++){const c=this.subscriptions[a];c&&c(e,n,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Zn=t=>t*1e3,An=t=>t/1e3;function S1(t,e){return e?t*(1e3/e):0}const E1=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,L6=1e-7,I6=12;function B6(t,e,n,i,s){let a,c,u=0;do c=e+(n-e)/2,a=E1(c,i,s)-t,a>0?n=c:e=c;while(Math.abs(a)>L6&&++u<I6);return c}function Za(t,e,n,i){if(t===e&&n===i)return Nn;const s=a=>B6(a,0,1,t,n);return a=>a===0||a===1?a:E1(s(a),e,i)}const C1=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,T1=t=>e=>1-t(1-e),_1=Za(.33,1.53,.69,.99),Wh=T1(_1),N1=C1(Wh),A1=t=>(t*=2)<1?.5*Wh(t):.5*(2-Math.pow(2,-10*(t-1))),Jh=t=>1-Math.sin(Math.acos(t)),M1=T1(Jh),R1=C1(Jh),P6=Za(.42,0,1,1),H6=Za(0,0,.58,1),k1=Za(.42,0,.58,1),U6=t=>Array.isArray(t)&&typeof t[0]!="number",O1=t=>Array.isArray(t)&&typeof t[0]=="number",$6={linear:Nn,easeIn:P6,easeInOut:k1,easeOut:H6,circIn:Jh,circInOut:R1,circOut:M1,backIn:Wh,backInOut:N1,backOut:_1,anticipate:A1},q6=t=>typeof t=="string",D1=t=>{if(O1(t)){Kh(t.length===4);const[e,n,i,s]=t;return Za(e,n,i,s)}else if(q6(t))return $6[t];return t},fu=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function Y6(t,e){let n=new Set,i=new Set,s=!1,a=!1;const c=new WeakSet;let u={delta:0,timestamp:0,isProcessing:!1};function d(p){c.has(p)&&(h.schedule(p),t()),p(u)}const h={schedule:(p,m=!1,y=!1)=>{const x=y&&s?n:i;return m&&c.add(p),x.has(p)||x.add(p),p},cancel:p=>{i.delete(p),c.delete(p)},process:p=>{if(u=p,s){a=!0;return}s=!0,[n,i]=[i,n],n.forEach(d),n.clear(),s=!1,a&&(a=!1,h.process(p))}};return h}const G6=40;function j1(t,e){let n=!1,i=!0;const s={delta:0,timestamp:0,isProcessing:!1},a=()=>n=!0,c=fu.reduce((T,C)=>(T[C]=Y6(a),T),{}),{setup:u,read:d,resolveKeyframes:h,preUpdate:p,update:m,preRender:y,render:b,postRender:x}=c,w=()=>{const T=Bo.useManualTiming?s.timestamp:performance.now();n=!1,Bo.useManualTiming||(s.delta=i?1e3/60:Math.max(Math.min(T-s.timestamp,G6),1)),s.timestamp=T,s.isProcessing=!0,u.process(s),d.process(s),h.process(s),p.process(s),m.process(s),y.process(s),b.process(s),x.process(s),s.isProcessing=!1,n&&e&&(i=!1,t(w))},S=()=>{n=!0,i=!0,s.isProcessing||t(w)};return{schedule:fu.reduce((T,C)=>{const R=c[C];return T[C]=(A,O=!1,k=!1)=>(n||S(),R.schedule(A,O,k)),T},{}),cancel:T=>{for(let C=0;C<fu.length;C++)c[fu[C]].cancel(T)},state:s,steps:c}}const{schedule:ae,cancel:wi,state:Be,steps:tp}=j1(typeof requestAnimationFrame<"u"?requestAnimationFrame:Nn,!0);let du;function X6(){du=void 0}const Fe={now:()=>(du===void 0&&Fe.set(Be.isProcessing||Bo.useManualTiming?Be.timestamp:performance.now()),du),set:t=>{du=t,queueMicrotask(X6)}},z1=t=>e=>typeof e=="string"&&e.startsWith(t),V1=z1("--"),F6=z1("var(--"),ep=t=>F6(t)?Z6.test(t.split("/*")[0].trim()):!1,Z6=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function L1(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const ws={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},Ka={...ws,transform:t=>bo(0,1,t)},hu={...ws,default:1},Qa=t=>Math.round(t*1e5)/1e5,np=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function K6(t){return t==null}const Q6=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,op=(t,e)=>n=>!!(typeof n=="string"&&Q6.test(n)&&n.startsWith(t)||e&&!K6(n)&&Object.prototype.hasOwnProperty.call(n,e)),I1=(t,e,n)=>i=>{if(typeof i!="string")return i;const[s,a,c,u]=i.match(np);return{[t]:parseFloat(s),[e]:parseFloat(a),[n]:parseFloat(c),alpha:u!==void 0?parseFloat(u):1}},W6=t=>bo(0,255,t),ip={...ws,transform:t=>Math.round(W6(t))},Rr={test:op("rgb","red"),parse:I1("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:i=1})=>"rgba("+ip.transform(t)+", "+ip.transform(e)+", "+ip.transform(n)+", "+Qa(Ka.transform(i))+")"};function J6(t){let e="",n="",i="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),i=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),i=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,i+=i,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(i,16),alpha:s?parseInt(s,16)/255:1}}const rp={test:op("#"),parse:J6,transform:Rr.transform},Wa=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),Si=Wa("deg"),xo=Wa("%"),St=Wa("px"),t8=Wa("vh"),e8=Wa("vw"),B1={...xo,parse:t=>xo.parse(t)/100,transform:t=>xo.transform(t*100)},Ss={test:op("hsl","hue"),parse:I1("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:i=1})=>"hsla("+Math.round(t)+", "+xo.transform(Qa(e))+", "+xo.transform(Qa(n))+", "+Qa(Ka.transform(i))+")"},Ne={test:t=>Rr.test(t)||rp.test(t)||Ss.test(t),parse:t=>Rr.test(t)?Rr.parse(t):Ss.test(t)?Ss.parse(t):rp.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Rr.transform(t):Ss.transform(t),getAnimatableNone:t=>{const e=Ne.parse(t);return e.alpha=0,Ne.transform(e)}},n8=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function o8(t){return isNaN(t)&&typeof t=="string"&&(t.match(np)?.length||0)+(t.match(n8)?.length||0)>0}const P1="number",H1="color",i8="var",r8="var(",U1="${}",s8=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function Ja(t){const e=t.toString(),n=[],i={color:[],number:[],var:[]},s=[];let a=0;const u=e.replace(s8,d=>(Ne.test(d)?(i.color.push(a),s.push(H1),n.push(Ne.parse(d))):d.startsWith(r8)?(i.var.push(a),s.push(i8),n.push(d)):(i.number.push(a),s.push(P1),n.push(parseFloat(d))),++a,U1)).split(U1);return{values:n,split:u,indexes:i,types:s}}function $1(t){return Ja(t).values}function q1(t){const{split:e,types:n}=Ja(t),i=e.length;return s=>{let a="";for(let c=0;c<i;c++)if(a+=e[c],s[c]!==void 0){const u=n[c];u===P1?a+=Qa(s[c]):u===H1?a+=Ne.transform(s[c]):a+=s[c]}return a}}const a8=t=>typeof t=="number"?0:Ne.test(t)?Ne.getAnimatableNone(t):t;function l8(t){const e=$1(t);return q1(t)(e.map(a8))}const Kn={test:o8,parse:$1,createTransformer:q1,getAnimatableNone:l8};function sp(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<.16666666666666666?t+(e-t)*6*n:n<.5?e:n<.6666666666666666?t+(e-t)*(.6666666666666666-n)*6:t}function c8({hue:t,saturation:e,lightness:n,alpha:i}){t/=360,e/=100,n/=100;let s=0,a=0,c=0;if(!e)s=a=c=n;else{const u=n<.5?n*(1+e):n+e-n*e,d=2*n-u;s=sp(d,u,t+.3333333333333333),a=sp(d,u,t),c=sp(d,u,t-.3333333333333333)}return{red:Math.round(s*255),green:Math.round(a*255),blue:Math.round(c*255),alpha:i}}function pu(t,e){return n=>n>0?e:t}const ye=(t,e,n)=>t+(e-t)*n,ap=(t,e,n)=>{const i=t*t,s=n*(e*e-i)+i;return s<0?0:Math.sqrt(s)},u8=[rp,Rr,Ss],f8=t=>u8.find(e=>e.test(t));function Y1(t){const e=f8(t);if(!e)return!1;let n=e.parse(t);return e===Ss&&(n=c8(n)),n}const G1=(t,e)=>{const n=Y1(t),i=Y1(e);if(!n||!i)return pu(t,e);const s={...n};return a=>(s.red=ap(n.red,i.red,a),s.green=ap(n.green,i.green,a),s.blue=ap(n.blue,i.blue,a),s.alpha=ye(n.alpha,i.alpha,a),Rr.transform(s))},lp=new Set(["none","hidden"]);function d8(t,e){return lp.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function h8(t,e){return n=>ye(t,e,n)}function cp(t){return typeof t=="number"?h8:typeof t=="string"?ep(t)?pu:Ne.test(t)?G1:g8:Array.isArray(t)?X1:typeof t=="object"?Ne.test(t)?G1:p8:pu}function X1(t,e){const n=[...t],i=n.length,s=t.map((a,c)=>cp(a)(a,e[c]));return a=>{for(let c=0;c<i;c++)n[c]=s[c](a);return n}}function p8(t,e){const n={...t,...e},i={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(i[s]=cp(t[s])(t[s],e[s]));return s=>{for(const a in i)n[a]=i[a](s);return n}}function m8(t,e){const n=[],i={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const a=e.types[s],c=t.indexes[a][i[a]],u=t.values[c]??0;n[s]=u,i[a]++}return n}const g8=(t,e)=>{const n=Kn.createTransformer(e),i=Ja(t),s=Ja(e);return i.indexes.var.length===s.indexes.var.length&&i.indexes.color.length===s.indexes.color.length&&i.indexes.number.length>=s.indexes.number.length?lp.has(t)&&!s.values.length||lp.has(e)&&!i.values.length?d8(t,e):Xa(X1(m8(i,s),s.values),n):pu(t,e)};function F1(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?ye(t,e,n):cp(t)(t,e)}const y8=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>ae.update(e,n),stop:()=>wi(e),now:()=>Be.isProcessing?Be.timestamp:Fe.now()}},Z1=(t,e,n=10)=>{let i="";const s=Math.max(Math.round(e/n),2);for(let a=0;a<s;a++)i+=Math.round(t(a/(s-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},mu=2e4;function up(t){let e=0;const n=50;let i=t.next(e);for(;!i.done&&e<mu;)e+=n,i=t.next(e);return e>=mu?1/0:e}function v8(t,e=100,n){const i=n({...t,keyframes:[0,e]}),s=Math.min(up(i),mu);return{type:"keyframes",ease:a=>i.next(s*a).value/e,duration:An(s)}}const b8=5;function K1(t,e,n){const i=Math.max(e-b8,0);return S1(n-t(i),e-i)}const be={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},fp=.001;function x8({duration:t=be.duration,bounce:e=be.bounce,velocity:n=be.velocity,mass:i=be.mass}){let s,a,c=1-e;c=bo(be.minDamping,be.maxDamping,c),t=bo(be.minDuration,be.maxDuration,An(t)),c<1?(s=h=>{const p=h*c,m=p*t,y=p-n,b=dp(h,c),x=Math.exp(-m);return fp-y/b*x},a=h=>{const m=h*c*t,y=m*n+n,b=Math.pow(c,2)*Math.pow(h,2)*t,x=Math.exp(-m),w=dp(Math.pow(h,2),c);return(-s(h)+fp>0?-1:1)*((y-b)*x)/w}):(s=h=>{const p=Math.exp(-h*t),m=(h-n)*t+1;return-fp+p*m},a=h=>{const p=Math.exp(-h*t),m=(n-h)*(t*t);return p*m});const u=5/t,d=S8(s,a,u);if(t=Zn(t),isNaN(d))return{stiffness:be.stiffness,damping:be.damping,duration:t};{const h=Math.pow(d,2)*i;return{stiffness:h,damping:c*2*Math.sqrt(i*h),duration:t}}}const w8=12;function S8(t,e,n){let i=n;for(let s=1;s<w8;s++)i=i-t(i)/e(i);return i}function dp(t,e){return t*Math.sqrt(1-e*e)}const E8=["duration","bounce"],C8=["stiffness","damping","mass"];function Q1(t,e){return e.some(n=>t[n]!==void 0)}function T8(t){let e={velocity:be.velocity,stiffness:be.stiffness,damping:be.damping,mass:be.mass,isResolvedFromDuration:!1,...t};if(!Q1(t,C8)&&Q1(t,E8))if(e.velocity=0,t.visualDuration){const n=t.visualDuration,i=2*Math.PI/(n*1.2),s=i*i,a=2*bo(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:be.mass,stiffness:s,damping:a}}else{const n=x8({...t,velocity:0});e={...e,...n,mass:be.mass},e.isResolvedFromDuration=!0}return e}function gu(t=be.visualDuration,e=be.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:i,restDelta:s}=n;const a=n.keyframes[0],c=n.keyframes[n.keyframes.length-1],u={done:!1,value:a},{stiffness:d,damping:h,mass:p,duration:m,velocity:y,isResolvedFromDuration:b}=T8({...n,velocity:-An(n.velocity||0)}),x=y||0,w=h/(2*Math.sqrt(d*p)),S=c-a,E=An(Math.sqrt(d/p)),D=Math.abs(S)<5;i||(i=D?be.restSpeed.granular:be.restSpeed.default),s||(s=D?be.restDelta.granular:be.restDelta.default);let T;if(w<1){const R=dp(E,w);T=A=>{const O=Math.exp(-w*E*A);return c-O*((x+w*E*S)/R*Math.sin(R*A)+S*Math.cos(R*A))}}else if(w===1)T=R=>c-Math.exp(-E*R)*(S+(x+E*S)*R);else{const R=E*Math.sqrt(w*w-1);T=A=>{const O=Math.exp(-w*E*A),k=Math.min(R*A,300);return c-O*((x+w*E*S)*Math.sinh(k)+R*S*Math.cosh(k))/R}}const C={calculatedDuration:b&&m||null,next:R=>{const A=T(R);if(b)u.done=R>=m;else{let O=R===0?x:0;w<1&&(O=R===0?Zn(x):K1(T,R,A));const k=Math.abs(O)<=i,H=Math.abs(c-A)<=s;u.done=k&&H}return u.value=u.done?c:A,u},toString:()=>{const R=Math.min(up(C),mu),A=Z1(O=>C.next(R*O).value,R,30);return R+"ms "+A},toTransition:()=>{}};return C}gu.applyToOptions=t=>{const e=v8(t,100,gu);return t.ease=e.ease,t.duration=Zn(e.duration),t.type="keyframes",t};function hp({keyframes:t,velocity:e=0,power:n=.8,timeConstant:i=325,bounceDamping:s=10,bounceStiffness:a=500,modifyTarget:c,min:u,max:d,restDelta:h=.5,restSpeed:p}){const m=t[0],y={done:!1,value:m},b=k=>u!==void 0&&k<u||d!==void 0&&k>d,x=k=>u===void 0?d:d===void 0||Math.abs(u-k)<Math.abs(d-k)?u:d;let w=n*e;const S=m+w,E=c===void 0?S:c(S);E!==S&&(w=E-m);const D=k=>-w*Math.exp(-k/i),T=k=>E+D(k),C=k=>{const H=D(k),$=T(k);y.done=Math.abs(H)<=h,y.value=y.done?E:$};let R,A;const O=k=>{b(y.value)&&(R=k,A=gu({keyframes:[y.value,x(y.value)],velocity:K1(T,k,y.value),damping:s,stiffness:a,restDelta:h,restSpeed:p}))};return O(0),{calculatedDuration:null,next:k=>{let H=!1;return!A&&R===void 0&&(H=!0,C(k),O(k)),R!==void 0&&k>=R?A.next(k-R):(!H&&C(k),y)}}}function _8(t,e,n){const i=[],s=n||Bo.mix||F1,a=t.length-1;for(let c=0;c<a;c++){let u=s(t[c],t[c+1]);if(e){const d=Array.isArray(e)?e[c]||Nn:e;u=Xa(d,u)}i.push(u)}return i}function N8(t,e,{clamp:n=!0,ease:i,mixer:s}={}){const a=t.length;if(Kh(a===e.length),a===1)return()=>e[0];if(a===2&&e[0]===e[1])return()=>e[1];const c=t[0]===t[1];t[0]>t[a-1]&&(t=[...t].reverse(),e=[...e].reverse());const u=_8(e,i,s),d=u.length,h=p=>{if(c&&p<t[0])return e[0];let m=0;if(d>1)for(;m<t.length-2&&!(p<t[m+1]);m++);const y=Fa(t[m],t[m+1],p);return u[m](y)};return n?p=>h(bo(t[0],t[a-1],p)):h}function A8(t,e){const n=t[t.length-1];for(let i=1;i<=e;i++){const s=Fa(0,e,i);t.push(ye(n,1,s))}}function M8(t){const e=[0];return A8(e,t.length-1),e}function R8(t,e){return t.map(n=>n*e)}function k8(t,e){return t.map(()=>e||k1).splice(0,t.length-1)}function tl({duration:t=300,keyframes:e,times:n,ease:i="easeInOut"}){const s=U6(i)?i.map(D1):D1(i),a={done:!1,value:e[0]},c=R8(n&&n.length===e.length?n:M8(e),t),u=N8(c,e,{ease:Array.isArray(s)?s:k8(e,s)});return{calculatedDuration:t,next:d=>(a.value=u(d),a.done=d>=t,a)}}const O8=t=>t!==null;function pp(t,{repeat:e,repeatType:n="loop"},i,s=1){const a=t.filter(O8),u=s<0||e&&n!=="loop"&&e%2===1?0:a.length-1;return!u||i===void 0?a[u]:i}const D8={decay:hp,inertia:hp,tween:tl,keyframes:tl,spring:gu};function W1(t){typeof t.type=="string"&&(t.type=D8[t.type])}class mp{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const j8=t=>t/100;class gp extends mp{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:n}=this.options;n&&n.updatedAt!==Fe.now()&&this.tick(Fe.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;W1(e);const{type:n=tl,repeat:i=0,repeatDelay:s=0,repeatType:a,velocity:c=0}=e;let{keyframes:u}=e;const d=n||tl;d!==tl&&typeof u[0]!="number"&&(this.mixKeyframes=Xa(j8,F1(u[0],u[1])),u=[0,100]);const h=d({...e,keyframes:u});a==="mirror"&&(this.mirroredGenerator=d({...e,keyframes:[...u].reverse(),velocity:-c})),h.calculatedDuration===null&&(h.calculatedDuration=up(h));const{calculatedDuration:p}=h;this.calculatedDuration=p,this.resolvedDuration=p+s,this.totalDuration=this.resolvedDuration*(i+1)-s,this.generator=h}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:i,totalDuration:s,mixKeyframes:a,mirroredGenerator:c,resolvedDuration:u,calculatedDuration:d}=this;if(this.startTime===null)return i.next(0);const{delay:h=0,keyframes:p,repeat:m,repeatType:y,repeatDelay:b,type:x,onUpdate:w,finalKeyframe:S}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const E=this.currentTime-h*(this.playbackSpeed>=0?1:-1),D=this.playbackSpeed>=0?E<0:E>s;this.currentTime=Math.max(E,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let T=this.currentTime,C=i;if(m){const k=Math.min(this.currentTime,s)/u;let H=Math.floor(k),$=k%1;!$&&k>=1&&($=1),$===1&&H--,H=Math.min(H,m+1),H%2&&(y==="reverse"?($=1-$,b&&($-=b/u)):y==="mirror"&&(C=c)),T=bo(0,1,$)*u}const R=D?{done:!1,value:p[0]}:C.next(T);a&&(R.value=a(R.value));let{done:A}=R;!D&&d!==null&&(A=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const O=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&A);return O&&x!==hp&&(R.value=pp(p,this.options,S,this.speed)),w&&w(R.value),O&&this.finish(),R}then(e,n){return this.finished.then(e,n)}get duration(){return An(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+An(e)}get time(){return An(this.currentTime)}set time(e){e=Zn(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(Fe.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=An(this.currentTime))}play(){if(this.isStopped)return;const{driver:e=y8,startTime:n}=this.options;this.driver||(this.driver=e(s=>this.tick(s))),this.options.onPlay?.();const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=n??i),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Fe.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){this.notifyFinished(),this.teardown(),this.state="finished",this.options.onComplete?.()}cancel(){this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),this.options.onCancel?.()}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),e.observe(this)}}function z8(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const kr=t=>t*180/Math.PI,yp=t=>{const e=kr(Math.atan2(t[1],t[0]));return vp(e)},V8={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:yp,rotateZ:yp,skewX:t=>kr(Math.atan(t[1])),skewY:t=>kr(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},vp=t=>(t=t%360,t<0&&(t+=360),t),J1=yp,tS=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),eS=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),L8={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:tS,scaleY:eS,scale:t=>(tS(t)+eS(t))/2,rotateX:t=>vp(kr(Math.atan2(t[6],t[5]))),rotateY:t=>vp(kr(Math.atan2(-t[2],t[0]))),rotateZ:J1,rotate:J1,skewX:t=>kr(Math.atan(t[4])),skewY:t=>kr(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function bp(t){return t.includes("scale")?1:0}function xp(t,e){if(!t||t==="none")return bp(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,s;if(n)i=L8,s=n;else{const u=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=V8,s=u}if(!s)return bp(e);const a=i[e],c=s[1].split(",").map(B8);return typeof a=="function"?a(c):c[a]}const I8=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return xp(n,e)};function B8(t){return parseFloat(t.trim())}const Es=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Cs=new Set(Es),nS=t=>t===ws||t===St,P8=new Set(["x","y","z"]),H8=Es.filter(t=>!P8.has(t));function U8(t){const e=[];return H8.forEach(n=>{const i=t.getValue(n);i!==void 0&&(e.push([n,i.get()]),i.set(n.startsWith("scale")?1:0))}),e}const Ei={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>xp(e,"x"),y:(t,{transform:e})=>xp(e,"y")};Ei.translateX=Ei.x,Ei.translateY=Ei.y;const Or=new Set;let wp=!1,Sp=!1,Ep=!1;function oS(){if(Sp){const t=Array.from(Or).filter(i=>i.needsMeasurement),e=new Set(t.map(i=>i.element)),n=new Map;e.forEach(i=>{const s=U8(i);s.length&&(n.set(i,s),i.render())}),t.forEach(i=>i.measureInitialState()),e.forEach(i=>{i.render();const s=n.get(i);s&&s.forEach(([a,c])=>{i.getValue(a)?.set(c)})}),t.forEach(i=>i.measureEndState()),t.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}Sp=!1,wp=!1,Or.forEach(t=>t.complete(Ep)),Or.clear()}function iS(){Or.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Sp=!0)})}function $8(){Ep=!0,iS(),oS(),Ep=!1}class Cp{constructor(e,n,i,s,a,c=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=i,this.motionValue=s,this.element=a,this.isAsync=c}scheduleResolve(){this.state="scheduled",this.isAsync?(Or.add(this),wp||(wp=!0,ae.read(iS),ae.resolveKeyframes(oS))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:i,motionValue:s}=this;if(e[0]===null){const a=s?.get(),c=e[e.length-1];if(a!==void 0)e[0]=a;else if(i&&n){const u=i.readValue(n,c);u!=null&&(e[0]=u)}e[0]===void 0&&(e[0]=c),s&&a===void 0&&s.set(e[0])}z8(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Or.delete(this)}cancel(){this.state==="scheduled"&&(Or.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const q8=t=>t.startsWith("--");function Y8(t,e,n){q8(e)?t.style.setProperty(e,n):t.style[e]=n}const G8={};function rS(t,e){const n=w1(t);return()=>G8[e]??n()}const X8=rS(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),sS=rS(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),el=([t,e,n,i])=>`cubic-bezier(${t}, ${e}, ${n}, ${i})`,aS={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:el([0,.65,.55,1]),circOut:el([.55,0,1,.45]),backIn:el([.31,.01,.66,-.59]),backOut:el([.33,1.53,.69,.99])};function lS(t,e){if(t)return typeof t=="function"?sS()?Z1(t,e):"ease-out":O1(t)?el(t):Array.isArray(t)?t.map(n=>lS(n,e)||aS.easeOut):aS[t]}function F8(t,e,n,{delay:i=0,duration:s=300,repeat:a=0,repeatType:c="loop",ease:u="easeOut",times:d}={},h=void 0){const p={[e]:n};d&&(p.offset=d);const m=lS(u,s);Array.isArray(m)&&(p.easing=m);const y={delay:i,duration:s,easing:Array.isArray(m)?"linear":m,fill:"both",iterations:a+1,direction:c==="reverse"?"alternate":"normal"};return h&&(y.pseudoElement=h),t.animate(p,y)}function cS(t){return typeof t=="function"&&"applyToOptions"in t}function Z8({type:t,...e}){return cS(t)&&sS()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class uS extends mp{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:i,keyframes:s,pseudoElement:a,allowFlatten:c=!1,finalKeyframe:u,onComplete:d}=e;this.isPseudoElement=!!a,this.allowFlatten=c,this.options=e,Kh(typeof e.type!="string");const h=Z8(e);this.animation=F8(n,i,s,h,a),h.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!a){const p=pp(s,this.options,u,this.speed);this.updateMotionValue?this.updateMotionValue(p):Y8(n,i,p),this.animation.cancel()}d?.(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){this.animation.finish?.()}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){const e=this.options?.element;!this.isPseudoElement&&e?.isConnected&&this.animation.commitStyles?.()}get duration(){const e=this.animation.effect?.getComputedTiming?.().duration||0;return An(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+An(e)}get time(){return An(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Zn(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,e&&X8()?(this.animation.timeline=e,Nn):n(this)}}const fS={anticipate:A1,backInOut:N1,circInOut:R1};function K8(t){return t in fS}function Q8(t){typeof t.ease=="string"&&K8(t.ease)&&(t.ease=fS[t.ease])}const Tp=10;class W8 extends uS{constructor(e){Q8(e),W1(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:i,onComplete:s,element:a,...c}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const u=new gp({...c,autoplay:!1}),d=Math.max(Tp,Fe.now()-this.startTime),h=bo(0,Tp,d-Tp);n.setWithVelocity(u.sample(Math.max(0,d-h)).value,u.sample(d).value,h),u.stop()}}const dS=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Kn.test(t)||t==="0")&&!t.startsWith("url("));function J8(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function tB(t,e,n,i){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const a=t[t.length-1],c=dS(s,e),u=dS(a,e);return!c||!u?!1:J8(t)||(n==="spring"||cS(n))&&i}function _p(t){t.duration=0,t.type="keyframes"}const eB=new Set(["opacity","clipPath","filter","transform"]),nB=w1(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function oB(t){const{motionValue:e,name:n,repeatDelay:i,repeatType:s,damping:a,type:c}=t;if(!(e?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:d,transformTemplate:h}=e.owner.getProps();return nB()&&n&&eB.has(n)&&(n!=="transform"||!h)&&!d&&!i&&s!=="mirror"&&a!==0&&c!=="inertia"}const iB=40;class rB extends mp{constructor({autoplay:e=!0,delay:n=0,type:i="keyframes",repeat:s=0,repeatDelay:a=0,repeatType:c="loop",keyframes:u,name:d,motionValue:h,element:p,...m}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Fe.now();const y={autoplay:e,delay:n,type:i,repeat:s,repeatDelay:a,repeatType:c,name:d,motionValue:h,element:p,...m},b=p?.KeyframeResolver||Cp;this.keyframeResolver=new b(u,(x,w,S)=>this.onKeyframesResolved(x,w,y,!S),d,h,p),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(e,n,i,s){this.keyframeResolver=void 0;const{name:a,type:c,velocity:u,delay:d,isHandoff:h,onUpdate:p}=i;this.resolvedAt=Fe.now(),tB(e,a,c,u)||((Bo.instantAnimations||!d)&&p?.(pp(e,i,n)),e[0]=e[e.length-1],_p(i),i.repeat=0);const y={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>iB?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...i,keyframes:e},b=!h&&oB(y),x=y.motionValue?.owner?.current,w=b?new W8({...y,element:x}):new gp(y);w.finished.then(()=>{this.notifyFinished()}).catch(Nn),this.pendingTimeline&&(this.stopTimeline=w.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=w}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),$8()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}function hS(t,e,n,i=0,s=1){const a=Array.from(t).sort((h,p)=>h.sortNodePosition(p)).indexOf(e),c=t.size,u=(c-1)*i;return typeof n=="function"?n(a,c):s===1?a*i:u-a*i}const sB=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function aB(t){const e=sB.exec(t);if(!e)return[,];const[,n,i,s]=e;return[`--${n??i}`,s]}function pS(t,e,n=1){const[i,s]=aB(t);if(!i)return;const a=window.getComputedStyle(e).getPropertyValue(i);if(a){const c=a.trim();return v1(c)?parseFloat(c):c}return ep(s)?pS(s,e,n+1):s}const lB={type:"spring",stiffness:500,damping:25,restSpeed:10},cB=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),uB={type:"keyframes",duration:.8},fB={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},dB=(t,{keyframes:e})=>e.length>2?uB:Cs.has(t)?t.startsWith("scale")?cB(e[1]):lB:fB,hB=t=>t!==null;function pB(t,{repeat:e,repeatType:n="loop"},i){const s=t.filter(hB),a=e&&n!=="loop"&&e%2===1?0:s.length-1;return s[a]}function mS(t,e){if(t?.inherit&&e){const{inherit:n,...i}=t;return{...e,...i}}return t}function Np(t,e){const n=t?.[e]??t?.default??t;return n!==t?mS(n,t):n}function mB({when:t,delay:e,delayChildren:n,staggerChildren:i,staggerDirection:s,repeat:a,repeatType:c,repeatDelay:u,from:d,elapsed:h,...p}){return!!Object.keys(p).length}const Ap=(t,e,n,i={},s,a)=>c=>{const u=Np(i,t)||{},d=u.delay||i.delay||0;let{elapsed:h=0}=i;h=h-Zn(d);const p={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...u,delay:-h,onUpdate:y=>{e.set(y),u.onUpdate&&u.onUpdate(y)},onComplete:()=>{c(),u.onComplete&&u.onComplete()},name:t,motionValue:e,element:a?void 0:s};mB(u)||Object.assign(p,dB(t,p)),p.duration&&(p.duration=Zn(p.duration)),p.repeatDelay&&(p.repeatDelay=Zn(p.repeatDelay)),p.from!==void 0&&(p.keyframes[0]=p.from);let m=!1;if((p.type===!1||p.duration===0&&!p.repeatDelay)&&(_p(p),p.delay===0&&(m=!0)),(Bo.instantAnimations||Bo.skipAnimations||s?.shouldSkipAnimations)&&(m=!0,_p(p),p.delay=0),p.allowFlatten=!u.type&&!u.ease,m&&!a&&e.get()!==void 0){const y=pB(p.keyframes,u);if(y!==void 0){ae.update(()=>{p.onUpdate(y),p.onComplete()});return}}return u.isSync?new gp(p):new rB(p)};function gS(t){const e=[{},{}];return t?.values.forEach((n,i)=>{e[0][i]=n.get(),e[1][i]=n.getVelocity()}),e}function Mp(t,e,n,i){if(typeof e=="function"){const[s,a]=gS(i);e=e(n!==void 0?n:t.custom,s,a)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,a]=gS(i);e=e(n!==void 0?n:t.custom,s,a)}return e}function Ts(t,e,n){const i=t.getProps();return Mp(i,e,n!==void 0?n:i.custom,t)}const yS=new Set(["width","height","top","left","right","bottom",...Es]),vS=30,gB=t=>!isNaN(parseFloat(t));class yB{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{const s=Fe.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),this.current!==this.prev&&(this.events.change?.notify(this.current),this.dependents))for(const a of this.dependents)a.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=Fe.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=gB(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new Qh);const i=this.events[e].add(n);return e==="change"?()=>{i(),ae.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,i){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-i}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Fe.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>vS)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,vS);return S1(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){this.dependents?.clear(),this.events.destroy?.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function _s(t,e){return new yB(t,e)}const Rp=t=>Array.isArray(t);function vB(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,_s(n))}function bB(t){return Rp(t)?t[t.length-1]||0:t}function xB(t,e){const n=Ts(t,e);let{transitionEnd:i={},transition:s={},...a}=n||{};a={...a,...i};for(const c in a){const u=bB(a[c]);vB(t,c,u)}}const Xe=t=>!!(t&&t.getVelocity);function wB(t){return!!(Xe(t)&&t.add)}function kp(t,e){const n=t.getValue("willChange");if(wB(n))return n.add(e);if(!n&&Bo.WillChange){const i=new Bo.WillChange("auto");t.addValue("willChange",i),i.add(e)}}function Op(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const bS="data-"+Op("framerAppearId");function xS(t){return t.props[bS]}function SB({protectedKeys:t,needsAnimating:e},n){const i=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,i}function wS(t,e,{delay:n=0,transitionOverride:i,type:s}={}){let{transition:a,transitionEnd:c,...u}=e;const d=t.getDefaultTransition();a=a?mS(a,d):d;const h=a?.reduceMotion;i&&(a=i);const p=[],m=s&&t.animationState&&t.animationState.getState()[s];for(const y in u){const b=t.getValue(y,t.latestValues[y]??null),x=u[y];if(x===void 0||m&&SB(m,y))continue;const w={delay:n,...Np(a||{},y)},S=b.get();if(S!==void 0&&!b.isAnimating&&!Array.isArray(x)&&x===S&&!w.velocity)continue;let E=!1;if(window.MotionHandoffAnimation){const C=xS(t);if(C){const R=window.MotionHandoffAnimation(C,y,ae);R!==null&&(w.startTime=R,E=!0)}}kp(t,y);const D=h??t.shouldReduceMotion;b.start(Ap(y,b,x,D&&yS.has(y)?{type:!1}:w,t,E));const T=b.animation;T&&p.push(T)}if(c){const y=()=>ae.update(()=>{c&&xB(t,c)});p.length?Promise.all(p).then(y):y()}return p}function Dp(t,e,n={}){const i=Ts(t,e,n.type==="exit"?t.presenceContext?.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=i||{};n.transitionOverride&&(s=n.transitionOverride);const a=i?()=>Promise.all(wS(t,i,n)):()=>Promise.resolve(),c=t.variantChildren&&t.variantChildren.size?(d=0)=>{const{delayChildren:h=0,staggerChildren:p,staggerDirection:m}=s;return EB(t,e,d,h,p,m,n)}:()=>Promise.resolve(),{when:u}=s;if(u){const[d,h]=u==="beforeChildren"?[a,c]:[c,a];return d().then(()=>h())}else return Promise.all([a(),c(n.delay)])}function EB(t,e,n=0,i=0,s=0,a=1,c){const u=[];for(const d of t.variantChildren)d.notify("AnimationStart",e),u.push(Dp(d,e,{...c,delay:n+(typeof i=="function"?0:i)+hS(t.variantChildren,d,i,s,a)}).then(()=>d.notify("AnimationComplete",e)));return Promise.all(u)}function CB(t,e,n={}){t.notify("AnimationStart",e);let i;if(Array.isArray(e)){const s=e.map(a=>Dp(t,a,n));i=Promise.all(s)}else if(typeof e=="string")i=Dp(t,e,n);else{const s=typeof e=="function"?Ts(t,e,n.custom):e;i=Promise.all(wS(t,s,n))}return i.then(()=>{t.notify("AnimationComplete",e)})}const TB={test:t=>t==="auto",parse:t=>t},SS=t=>e=>e.test(t),ES=[ws,St,xo,Si,e8,t8,TB],CS=t=>ES.find(SS(t));function _B(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||x1(t):!0}const NB=new Set(["brightness","contrast","saturate","opacity"]);function AB(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[i]=n.match(np)||[];if(!i)return t;const s=n.replace(i,"");let a=NB.has(e)?1:0;return i!==n&&(a*=100),e+"("+a+s+")"}const MB=/\b([a-z-]*)\(.*?\)/gu,jp={...Kn,getAnimatableNone:t=>{const e=t.match(MB);return e?e.map(AB).join(" "):t}},zp={...Kn,getAnimatableNone:t=>{const e=Kn.parse(t);return Kn.createTransformer(t)(e.map(i=>typeof i=="number"?0:typeof i=="object"?{...i,alpha:1}:i))}},TS={...ws,transform:Math.round},Vp={borderWidth:St,borderTopWidth:St,borderRightWidth:St,borderBottomWidth:St,borderLeftWidth:St,borderRadius:St,borderTopLeftRadius:St,borderTopRightRadius:St,borderBottomRightRadius:St,borderBottomLeftRadius:St,width:St,maxWidth:St,height:St,maxHeight:St,top:St,right:St,bottom:St,left:St,inset:St,insetBlock:St,insetBlockStart:St,insetBlockEnd:St,insetInline:St,insetInlineStart:St,insetInlineEnd:St,padding:St,paddingTop:St,paddingRight:St,paddingBottom:St,paddingLeft:St,paddingBlock:St,paddingBlockStart:St,paddingBlockEnd:St,paddingInline:St,paddingInlineStart:St,paddingInlineEnd:St,margin:St,marginTop:St,marginRight:St,marginBottom:St,marginLeft:St,marginBlock:St,marginBlockStart:St,marginBlockEnd:St,marginInline:St,marginInlineStart:St,marginInlineEnd:St,fontSize:St,backgroundPositionX:St,backgroundPositionY:St,...{rotate:Si,rotateX:Si,rotateY:Si,rotateZ:Si,scale:hu,scaleX:hu,scaleY:hu,scaleZ:hu,skew:Si,skewX:Si,skewY:Si,distance:St,translateX:St,translateY:St,translateZ:St,x:St,y:St,z:St,perspective:St,transformPerspective:St,opacity:Ka,originX:B1,originY:B1,originZ:St},zIndex:TS,fillOpacity:Ka,strokeOpacity:Ka,numOctaves:TS},RB={...Vp,color:Ne,backgroundColor:Ne,outlineColor:Ne,fill:Ne,stroke:Ne,borderColor:Ne,borderTopColor:Ne,borderRightColor:Ne,borderBottomColor:Ne,borderLeftColor:Ne,filter:jp,WebkitFilter:jp,mask:zp,WebkitMask:zp},_S=t=>RB[t],kB=new Set([jp,zp]);function NS(t,e){let n=_S(t);return kB.has(n)||(n=Kn),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const OB=new Set(["auto","none","0"]);function DB(t,e,n){let i=0,s;for(;i<t.length&&!s;){const a=t[i];typeof a=="string"&&!OB.has(a)&&Ja(a).values.length&&(s=t[i]),i++}if(s&&n)for(const a of e)t[a]=NS(n,s)}class jB extends Cp{constructor(e,n,i,s,a){super(e,n,i,s,a,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:i}=this;if(!n||!n.current)return;super.readKeyframes();for(let p=0;p<e.length;p++){let m=e[p];if(typeof m=="string"&&(m=m.trim(),ep(m))){const y=pS(m,n.current);y!==void 0&&(e[p]=y),p===e.length-1&&(this.finalKeyframe=m)}}if(this.resolveNoneKeyframes(),!yS.has(i)||e.length!==2)return;const[s,a]=e,c=CS(s),u=CS(a),d=L1(s),h=L1(a);if(d!==h&&Ei[i]){this.needsMeasurement=!0;return}if(c!==u)if(nS(c)&&nS(u))for(let p=0;p<e.length;p++){const m=e[p];typeof m=="string"&&(e[p]=parseFloat(m))}else Ei[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,i=[];for(let s=0;s<e.length;s++)(e[s]===null||_B(e[s]))&&i.push(s);i.length&&DB(e,i,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:i}=this;if(!e||!e.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Ei[i](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(i,s).jump(s,!1)}measureEndState(){const{element:e,name:n,unresolvedKeyframes:i}=this;if(!e||!e.current)return;const s=e.getValue(n);s&&s.jump(this.measuredOrigin,!1);const a=i.length-1,c=i[a];i[a]=Ei[n](e.measureViewportBox(),window.getComputedStyle(e.current)),c!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=c),this.removedTransforms?.length&&this.removedTransforms.forEach(([u,d])=>{e.getValue(u).set(d)}),this.resolveNoneKeyframes()}}const zB=new Set(["opacity","clipPath","filter","transform"]);function AS(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){let i=document;const s=n?.[t]??i.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t).filter(i=>i!=null)}const MS=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function Lp(t){return b1(t)&&"offsetHeight"in t}const{schedule:Ip}=j1(queueMicrotask,!1),Qn={x:!1,y:!1};function RS(){return Qn.x||Qn.y}function VB(t){return t==="x"||t==="y"?Qn[t]?null:(Qn[t]=!0,()=>{Qn[t]=!1}):Qn.x||Qn.y?null:(Qn.x=Qn.y=!0,()=>{Qn.x=Qn.y=!1})}function kS(t,e){const n=AS(t),i=new AbortController,s={passive:!0,...e,signal:i.signal};return[n,s,()=>i.abort()]}function LB(t){return!(t.pointerType==="touch"||RS())}function IB(t,e,n={}){const[i,s,a]=kS(t,n);return i.forEach(c=>{let u=!1,d=!1,h;const p=()=>{c.removeEventListener("pointerleave",x)},m=S=>{h&&(h(S),h=void 0),p()},y=S=>{u=!1,window.removeEventListener("pointerup",y),window.removeEventListener("pointercancel",y),d&&(d=!1,m(S))},b=()=>{u=!0,window.addEventListener("pointerup",y,s),window.addEventListener("pointercancel",y,s)},x=S=>{if(S.pointerType!=="touch"){if(u){d=!0;return}m(S)}},w=S=>{if(!LB(S))return;d=!1;const E=e(c,S);typeof E=="function"&&(h=E,c.addEventListener("pointerleave",x,s))};c.addEventListener("pointerenter",w,s),c.addEventListener("pointerdown",b,s)}),a}const OS=(t,e)=>e?t===e?!0:OS(t,e.parentElement):!1,Bp=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,BB=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function PB(t){return BB.has(t.tagName)||t.isContentEditable===!0}const HB=new Set(["INPUT","SELECT","TEXTAREA"]);function UB(t){return HB.has(t.tagName)||t.isContentEditable===!0}const yu=new WeakSet;function DS(t){return e=>{e.key==="Enter"&&t(e)}}function Pp(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const $B=(t,e)=>{const n=t.currentTarget;if(!n)return;const i=DS(()=>{if(yu.has(n))return;Pp(n,"down");const s=DS(()=>{Pp(n,"up")}),a=()=>Pp(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",a,e)});n.addEventListener("keydown",i,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",i),e)};function jS(t){return Bp(t)&&!RS()}const zS=new WeakSet;function qB(t,e,n={}){const[i,s,a]=kS(t,n),c=u=>{const d=u.currentTarget;if(!jS(u)||zS.has(u))return;yu.add(d),n.stopPropagation&&zS.add(u);const h=e(d,u),p=(b,x)=>{window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",y),yu.has(d)&&yu.delete(d),jS(b)&&typeof h=="function"&&h(b,{success:x})},m=b=>{p(b,d===window||d===document||n.useGlobalTarget||OS(d,b.target))},y=b=>{p(b,!1)};window.addEventListener("pointerup",m,s),window.addEventListener("pointercancel",y,s)};return i.forEach(u=>{(n.useGlobalTarget?window:u).addEventListener("pointerdown",c,s),Lp(u)&&(u.addEventListener("focus",h=>$B(h,s)),!PB(u)&&!u.hasAttribute("tabindex")&&(u.tabIndex=0))}),a}function Hp(t){return b1(t)&&"ownerSVGElement"in t}const vu=new WeakMap;let bu;const VS=(t,e,n)=>(i,s)=>s&&s[0]?s[0][t+"Size"]:Hp(i)&&"getBBox"in i?i.getBBox()[e]:i[n],YB=VS("inline","width","offsetWidth"),GB=VS("block","height","offsetHeight");function XB({target:t,borderBoxSize:e}){vu.get(t)?.forEach(n=>{n(t,{get width(){return YB(t,e)},get height(){return GB(t,e)}})})}function FB(t){t.forEach(XB)}function ZB(){typeof ResizeObserver>"u"||(bu=new ResizeObserver(FB))}function KB(t,e){bu||ZB();const n=AS(t);return n.forEach(i=>{let s=vu.get(i);s||(s=new Set,vu.set(i,s)),s.add(e),bu?.observe(i)}),()=>{n.forEach(i=>{const s=vu.get(i);s?.delete(e),s?.size||bu?.unobserve(i)})}}const xu=new Set;let Ns;function QB(){Ns=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};xu.forEach(e=>e(t))},window.addEventListener("resize",Ns)}function WB(t){return xu.add(t),Ns||QB(),()=>{xu.delete(t),!xu.size&&typeof Ns=="function"&&(window.removeEventListener("resize",Ns),Ns=void 0)}}function LS(t,e){return typeof t=="function"?WB(t):KB(t,e)}function JB(t){return Hp(t)&&t.tagName==="svg"}const tP=[...ES,Ne,Kn],eP=t=>tP.find(SS(t)),IS=()=>({translate:0,scale:1,origin:0,originPoint:0}),As=()=>({x:IS(),y:IS()}),BS=()=>({min:0,max:0}),ze=()=>({x:BS(),y:BS()}),nP=new WeakMap;function wu(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function nl(t){return typeof t=="string"||Array.isArray(t)}const Up=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],$p=["initial",...Up];function Su(t){return wu(t.animate)||$p.some(e=>nl(t[e]))}function PS(t){return!!(Su(t)||t.variants)}function oP(t,e,n){for(const i in e){const s=e[i],a=n[i];if(Xe(s))t.addValue(i,s);else if(Xe(a))t.addValue(i,_s(s,{owner:t}));else if(a!==s)if(t.hasValue(i)){const c=t.getValue(i);c.liveStyle===!0?c.jump(s):c.hasAnimated||c.set(s)}else{const c=t.getStaticValue(i);t.addValue(i,_s(c!==void 0?c:s,{owner:t}))}}for(const i in n)e[i]===void 0&&t.removeValue(i);return e}const qp={current:null},HS={current:!1},iP=typeof window<"u";function rP(){if(HS.current=!0,!!iP)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>qp.current=t.matches;t.addEventListener("change",e),e()}else qp.current=!1}const US=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let Eu={};function $S(t){Eu=t}function sP(){return Eu}class aP{scrapeMotionValuesFromProps(e,n,i){return{}}constructor({parent:e,props:n,presenceContext:i,reducedMotionConfig:s,skipAnimations:a,blockInitialAnimation:c,visualState:u},d={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=Cp,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const b=Fe.now();this.renderScheduledAt<b&&(this.renderScheduledAt=b,ae.render(this.render,!1,!0))};const{latestValues:h,renderState:p}=u;this.latestValues=h,this.baseTarget={...h},this.initialValues=n.initial?{...h}:{},this.renderState=p,this.parent=e,this.props=n,this.presenceContext=i,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=a,this.options=d,this.blockInitialAnimation=!!c,this.isControllingVariants=Su(n),this.isVariantNode=PS(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:m,...y}=this.scrapeMotionValuesFromProps(n,{},this);for(const b in y){const x=y[b];h[b]!==void 0&&Xe(x)&&x.set(h[b])}}mount(e){if(this.hasBeenMounted)for(const n in this.initialValues)this.values.get(n)?.jump(this.initialValues[n]),this.latestValues[n]=this.initialValues[n];this.current=e,nP.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,i)=>this.bindToMotionValue(i,n)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(HS.current||rP(),this.shouldReduceMotion=qp.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,this.parent?.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){this.projection&&this.projection.unmount(),wi(this.notifyUpdate),wi(this.render),this.valueSubscriptions.forEach(e=>e()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const e in this.events)this.events[e].clear();for(const e in this.features){const n=this.features[e];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&zB.has(e)&&this.current instanceof HTMLElement){const{factory:c,keyframes:u,times:d,ease:h,duration:p}=n.accelerate,m=new uS({element:this.current,name:e,keyframes:u,times:d,ease:h,duration:Zn(p)}),y=c(m);this.valueSubscriptions.set(e,()=>{y(),m.cancel()});return}const i=Cs.has(e);i&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",c=>{this.latestValues[e]=c,this.props.onUpdate&&ae.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let a;typeof window<"u"&&window.MotionCheckAppearSync&&(a=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),a&&a(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in Eu){const n=Eu[e];if(!n)continue;const{isEnabled:i,Feature:s}=n;if(!this.features[e]&&s&&i(this.props)&&(this.features[e]=new s(this)),this.features[e]){const a=this.features[e];a.isMounted?a.update():(a.mount(),a.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):ze()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let i=0;i<US.length;i++){const s=US[i];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const a="on"+s,c=e[a];c&&(this.propEventSubscriptions[s]=this.on(s,c))}this.prevMotionValues=oP(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const i=this.values.get(e);n!==i&&(i&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let i=this.values.get(e);return i===void 0&&n!==void 0&&(i=_s(n===null?void 0:n,{owner:this}),this.addValue(e,i)),i}readValue(e,n){let i=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return i!=null&&(typeof i=="string"&&(v1(i)||x1(i))?i=parseFloat(i):!eP(i)&&Kn.test(n)&&(i=NS(e,n)),this.setBaseTarget(e,Xe(i)?i.get():i)),Xe(i)?i.get():i}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){const{initial:n}=this.props;let i;if(typeof n=="string"||typeof n=="object"){const a=Mp(this.props,n,this.presenceContext?.custom);a&&(i=a[e])}if(n&&i!==void 0)return i;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Xe(s)?s:this.initialValues[e]!==void 0&&i===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new Qh),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){Ip.render(this.render)}}class qS extends aP{constructor(){super(...arguments),this.KeyframeResolver=jB}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const i=e.style;return i?i[n]:void 0}removeValueFromRenderState(e,{vars:n,style:i}){delete n[e],delete i[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Xe(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class Ci{constructor(e){this.isMounted=!1,this.node=e}update(){}}function YS({top:t,left:e,right:n,bottom:i}){return{x:{min:e,max:n},y:{min:t,max:i}}}function lP({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function cP(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),i=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:i.y,right:i.x}}function Yp(t){return t===void 0||t===1}function Gp({scale:t,scaleX:e,scaleY:n}){return!Yp(t)||!Yp(e)||!Yp(n)}function Dr(t){return Gp(t)||GS(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function GS(t){return XS(t.x)||XS(t.y)}function XS(t){return t&&t!=="0%"}function Cu(t,e,n){const i=t-n,s=e*i;return n+s}function FS(t,e,n,i,s){return s!==void 0&&(t=Cu(t,s,i)),Cu(t,n,i)+e}function Xp(t,e=0,n=1,i,s){t.min=FS(t.min,e,n,i,s),t.max=FS(t.max,e,n,i,s)}function ZS(t,{x:e,y:n}){Xp(t.x,e.translate,e.scale,e.originPoint),Xp(t.y,n.translate,n.scale,n.originPoint)}const KS=.999999999999,QS=1.0000000000001;function uP(t,e,n,i=!1){const s=n.length;if(!s)return;e.x=e.y=1;let a,c;for(let u=0;u<s;u++){a=n[u],c=a.projectionDelta;const{visualElement:d}=a.options;d&&d.props.style&&d.props.style.display==="contents"||(i&&a.options.layoutScroll&&a.scroll&&a!==a.root&&Rs(t,{x:-a.scroll.offset.x,y:-a.scroll.offset.y}),c&&(e.x*=c.x.scale,e.y*=c.y.scale,ZS(t,c)),i&&Dr(a.latestValues)&&Rs(t,a.latestValues))}e.x<QS&&e.x>KS&&(e.x=1),e.y<QS&&e.y>KS&&(e.y=1)}function Ms(t,e){t.min=t.min+e,t.max=t.max+e}function WS(t,e,n,i,s=.5){const a=ye(t.min,t.max,s);Xp(t,e,n,a,i)}function Rs(t,e){WS(t.x,e.x,e.scaleX,e.scale,e.originX),WS(t.y,e.y,e.scaleY,e.scale,e.originY)}function JS(t,e){return YS(cP(t.getBoundingClientRect(),e))}function fP(t,e,n){const i=JS(t,n),{scroll:s}=e;return s&&(Ms(i.x,s.offset.x),Ms(i.y,s.offset.y)),i}const dP={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},hP=Es.length;function pP(t,e,n){let i="",s=!0;for(let a=0;a<hP;a++){const c=Es[a],u=t[c];if(u===void 0)continue;let d=!0;if(typeof u=="number")d=u===(c.startsWith("scale")?1:0);else{const h=parseFloat(u);d=c.startsWith("scale")?h===1:h===0}if(!d||n){const h=MS(u,Vp[c]);if(!d){s=!1;const p=dP[c]||c;i+=`${p}(${h}) `}n&&(e[c]=h)}}return i=i.trim(),n?i=n(e,s?"":i):s&&(i="none"),i}function Fp(t,e,n){const{style:i,vars:s,transformOrigin:a}=t;let c=!1,u=!1;for(const d in e){const h=e[d];if(Cs.has(d)){c=!0;continue}else if(V1(d)){s[d]=h;continue}else{const p=MS(h,Vp[d]);d.startsWith("origin")?(u=!0,a[d]=p):i[d]=p}}if(e.transform||(c||n?i.transform=pP(e,t.transform,n):i.transform&&(i.transform="none")),u){const{originX:d="50%",originY:h="50%",originZ:p=0}=a;i.transformOrigin=`${d} ${h} ${p}`}}function tE(t,{style:e,vars:n},i,s){const a=t.style;let c;for(c in e)a[c]=e[c];s?.applyProjectionStyles(a,i);for(c in n)a.setProperty(c,n[c])}function eE(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const ol={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(St.test(t))t=parseFloat(t);else return t;const n=eE(t,e.target.x),i=eE(t,e.target.y);return`${n}% ${i}%`}},mP={correct:(t,{treeScale:e,projectionDelta:n})=>{const i=t,s=Kn.parse(t);if(s.length>5)return i;const a=Kn.createTransformer(t),c=typeof s[0]!="number"?1:0,u=n.x.scale*e.x,d=n.y.scale*e.y;s[0+c]/=u,s[1+c]/=d;const h=ye(u,d,.5);return typeof s[2+c]=="number"&&(s[2+c]/=h),typeof s[3+c]=="number"&&(s[3+c]/=h),a(s)}},Zp={borderRadius:{...ol,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:ol,borderTopRightRadius:ol,borderBottomLeftRadius:ol,borderBottomRightRadius:ol,boxShadow:mP};function nE(t,{layout:e,layoutId:n}){return Cs.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Zp[t]||t==="opacity")}function Kp(t,e,n){const i=t.style,s=e?.style,a={};if(!i)return a;for(const c in i)(Xe(i[c])||s&&Xe(s[c])||nE(c,t)||n?.getValue(c)?.liveStyle!==void 0)&&(a[c]=i[c]);return a}function gP(t){return window.getComputedStyle(t)}class yP extends qS{constructor(){super(...arguments),this.type="html",this.renderInstance=tE}readValueFromInstance(e,n){if(Cs.has(n))return this.projection?.isProjecting?bp(n):I8(e,n);{const i=gP(e),s=(V1(n)?i.getPropertyValue(n):i[n])||0;return typeof s=="string"?s.trim():s}}measureInstanceViewportBox(e,{transformPagePoint:n}){return JS(e,n)}build(e,n,i){Fp(e,n,i.transformTemplate)}scrapeMotionValuesFromProps(e,n,i){return Kp(e,n,i)}}const vP={offset:"stroke-dashoffset",array:"stroke-dasharray"},bP={offset:"strokeDashoffset",array:"strokeDasharray"};function xP(t,e,n=1,i=0,s=!0){t.pathLength=1;const a=s?vP:bP;t[a.offset]=`${-i}`,t[a.array]=`${e} ${n}`}const wP=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function oE(t,{attrX:e,attrY:n,attrScale:i,pathLength:s,pathSpacing:a=1,pathOffset:c=0,...u},d,h,p){if(Fp(t,u,h),d){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:m,style:y}=t;m.transform&&(y.transform=m.transform,delete m.transform),(y.transform||m.transformOrigin)&&(y.transformOrigin=m.transformOrigin??"50% 50%",delete m.transformOrigin),y.transform&&(y.transformBox=p?.transformBox??"fill-box",delete m.transformBox);for(const b of wP)m[b]!==void 0&&(y[b]=m[b],delete m[b]);e!==void 0&&(m.x=e),n!==void 0&&(m.y=n),i!==void 0&&(m.scale=i),s!==void 0&&xP(m,s,a,c,!1)}const iE=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),rE=t=>typeof t=="string"&&t.toLowerCase()==="svg";function SP(t,e,n,i){tE(t,e,void 0,i);for(const s in e.attrs)t.setAttribute(iE.has(s)?s:Op(s),e.attrs[s])}function sE(t,e,n){const i=Kp(t,e,n);for(const s in t)if(Xe(t[s])||Xe(e[s])){const a=Es.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;i[a]=t[s]}return i}class EP extends qS{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=ze}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(Cs.has(n)){const i=_S(n);return i&&i.default||0}return n=iE.has(n)?n:Op(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,i){return sE(e,n,i)}build(e,n,i){oE(e,n,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(e,n,i,s){SP(e,n,i,s)}mount(e){this.isSVGTag=rE(e.tagName),super.mount(e)}}const CP=$p.length;function aE(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?aE(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<CP;n++){const i=$p[n],s=t.props[i];(nl(s)||s===!1)&&(e[i]=s)}return e}function lE(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let i=0;i<n;i++)if(e[i]!==t[i])return!1;return!0}const TP=[...Up].reverse(),_P=Up.length;function NP(t){return e=>Promise.all(e.map(({animation:n,options:i})=>CB(t,n,i)))}function AP(t){let e=NP(t),n=cE(),i=!0;const s=d=>(h,p)=>{const m=Ts(t,p,d==="exit"?t.presenceContext?.custom:void 0);if(m){const{transition:y,transitionEnd:b,...x}=m;h={...h,...x,...b}}return h};function a(d){e=d(t)}function c(d){const{props:h}=t,p=aE(t.parent)||{},m=[],y=new Set;let b={},x=1/0;for(let S=0;S<_P;S++){const E=TP[S],D=n[E],T=h[E]!==void 0?h[E]:p[E],C=nl(T),R=E===d?D.isActive:null;R===!1&&(x=S);let A=T===p[E]&&T!==h[E]&&C;if(A&&i&&t.manuallyAnimateOnMount&&(A=!1),D.protectedKeys={...b},!D.isActive&&R===null||!T&&!D.prevProp||wu(T)||typeof T=="boolean")continue;if(E==="exit"&&D.isActive&&R!==!0){D.prevResolvedValues&&(b={...b,...D.prevResolvedValues});continue}const O=MP(D.prevProp,T);let k=O||E===d&&D.isActive&&!A&&C||S>x&&C,H=!1;const $=Array.isArray(T)?T:[T];let q=$.reduce(s(E),{});R===!1&&(q={});const{prevResolvedValues:F={}}=D,Q={...F,...q},B=I=>{k=!0,y.has(I)&&(H=!0,y.delete(I)),D.needsAnimating[I]=!0;const z=t.getValue(I);z&&(z.liveStyle=!1)};for(const I in Q){const z=q[I],U=F[I];if(b.hasOwnProperty(I))continue;let Y=!1;Rp(z)&&Rp(U)?Y=!lE(z,U):Y=z!==U,Y?z!=null?B(I):y.add(I):z!==void 0&&y.has(I)?B(I):D.protectedKeys[I]=!0}D.prevProp=T,D.prevResolvedValues=q,D.isActive&&(b={...b,...q}),i&&t.blockInitialAnimation&&(k=!1);const P=A&&O;k&&(!P||H)&&m.push(...$.map(I=>{const z={type:E};if(typeof I=="string"&&i&&!P&&t.manuallyAnimateOnMount&&t.parent){const{parent:U}=t,Y=Ts(U,I);if(U.enteringChildren&&Y){const{delayChildren:L}=Y.transition||{};z.delay=hS(U.enteringChildren,t,L)}}return{animation:I,options:z}}))}if(y.size){const S={};if(typeof h.initial!="boolean"){const E=Ts(t,Array.isArray(h.initial)?h.initial[0]:h.initial);E&&E.transition&&(S.transition=E.transition)}y.forEach(E=>{const D=t.getBaseTarget(E),T=t.getValue(E);T&&(T.liveStyle=!0),S[E]=D??null}),m.push({animation:S})}let w=!!m.length;return i&&(h.initial===!1||h.initial===h.animate)&&!t.manuallyAnimateOnMount&&(w=!1),i=!1,w?e(m):Promise.resolve()}function u(d,h){if(n[d].isActive===h)return Promise.resolve();t.variantChildren?.forEach(m=>m.animationState?.setActive(d,h)),n[d].isActive=h;const p=c(d);for(const m in n)n[m].protectedKeys={};return p}return{animateChanges:c,setActive:u,setAnimateFunction:a,getState:()=>n,reset:()=>{n=cE()}}}function MP(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!lE(e,t):!1}function jr(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function cE(){return{animate:jr(!0),whileInView:jr(),whileHover:jr(),whileTap:jr(),whileDrag:jr(),whileFocus:jr(),exit:jr()}}function uE(t,e){t.min=e.min,t.max=e.max}function Wn(t,e){uE(t.x,e.x),uE(t.y,e.y)}function fE(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const dE=1e-4,RP=1-dE,kP=1+dE,hE=.01,OP=0-hE,DP=0+hE;function Ze(t){return t.max-t.min}function jP(t,e,n){return Math.abs(t-e)<=n}function pE(t,e,n,i=.5){t.origin=i,t.originPoint=ye(e.min,e.max,t.origin),t.scale=Ze(n)/Ze(e),t.translate=ye(n.min,n.max,t.origin)-t.originPoint,(t.scale>=RP&&t.scale<=kP||isNaN(t.scale))&&(t.scale=1),(t.translate>=OP&&t.translate<=DP||isNaN(t.translate))&&(t.translate=0)}function il(t,e,n,i){pE(t.x,e.x,n.x,i?i.originX:void 0),pE(t.y,e.y,n.y,i?i.originY:void 0)}function mE(t,e,n){t.min=n.min+e.min,t.max=t.min+Ze(e)}function zP(t,e,n){mE(t.x,e.x,n.x),mE(t.y,e.y,n.y)}function gE(t,e,n){t.min=e.min-n.min,t.max=t.min+Ze(e)}function Tu(t,e,n){gE(t.x,e.x,n.x),gE(t.y,e.y,n.y)}function yE(t,e,n,i,s){return t-=e,t=Cu(t,1/n,i),s!==void 0&&(t=Cu(t,1/s,i)),t}function VP(t,e=0,n=1,i=.5,s,a=t,c=t){if(xo.test(e)&&(e=parseFloat(e),e=ye(c.min,c.max,e/100)-c.min),typeof e!="number")return;let u=ye(a.min,a.max,i);t===a&&(u-=e),t.min=yE(t.min,e,n,u,s),t.max=yE(t.max,e,n,u,s)}function vE(t,e,[n,i,s],a,c){VP(t,e[n],e[i],e[s],e.scale,a,c)}const LP=["x","scaleX","originX"],IP=["y","scaleY","originY"];function bE(t,e,n,i){vE(t.x,e,LP,n?n.x:void 0,i?i.x:void 0),vE(t.y,e,IP,n?n.y:void 0,i?i.y:void 0)}function xE(t){return t.translate===0&&t.scale===1}function wE(t){return xE(t.x)&&xE(t.y)}function SE(t,e){return t.min===e.min&&t.max===e.max}function BP(t,e){return SE(t.x,e.x)&&SE(t.y,e.y)}function EE(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function CE(t,e){return EE(t.x,e.x)&&EE(t.y,e.y)}function TE(t){return Ze(t.x)/Ze(t.y)}function _E(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function wo(t){return[t("x"),t("y")]}function PP(t,e,n){let i="";const s=t.x.translate/e.x,a=t.y.translate/e.y,c=n?.z||0;if((s||a||c)&&(i=`translate3d(${s}px, ${a}px, ${c}px) `),(e.x!==1||e.y!==1)&&(i+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:h,rotate:p,rotateX:m,rotateY:y,skewX:b,skewY:x}=n;h&&(i=`perspective(${h}px) ${i}`),p&&(i+=`rotate(${p}deg) `),m&&(i+=`rotateX(${m}deg) `),y&&(i+=`rotateY(${y}deg) `),b&&(i+=`skewX(${b}deg) `),x&&(i+=`skewY(${x}deg) `)}const u=t.x.scale*e.x,d=t.y.scale*e.y;return(u!==1||d!==1)&&(i+=`scale(${u}, ${d})`),i||"none"}const NE=["TopLeft","TopRight","BottomLeft","BottomRight"],HP=NE.length,AE=t=>typeof t=="string"?parseFloat(t):t,ME=t=>typeof t=="number"||St.test(t);function UP(t,e,n,i,s,a){s?(t.opacity=ye(0,n.opacity??1,$P(i)),t.opacityExit=ye(e.opacity??1,0,qP(i))):a&&(t.opacity=ye(e.opacity??1,n.opacity??1,i));for(let c=0;c<HP;c++){const u=`border${NE[c]}Radius`;let d=RE(e,u),h=RE(n,u);if(d===void 0&&h===void 0)continue;d||(d=0),h||(h=0),d===0||h===0||ME(d)===ME(h)?(t[u]=Math.max(ye(AE(d),AE(h),i),0),(xo.test(h)||xo.test(d))&&(t[u]+="%")):t[u]=h}(e.rotate||n.rotate)&&(t.rotate=ye(e.rotate||0,n.rotate||0,i))}function RE(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const $P=kE(0,.5,M1),qP=kE(.5,.95,Nn);function kE(t,e,n){return i=>i<t?0:i>e?1:n(Fa(t,e,i))}function YP(t,e,n){const i=Xe(t)?t:_s(t);return i.start(Ap("",i,e,n)),i.animation}function rl(t,e,n,i={passive:!0}){return t.addEventListener(e,n,i),()=>t.removeEventListener(e,n)}const GP=(t,e)=>t.depth-e.depth;class XP{constructor(){this.children=[],this.isDirty=!1}add(e){Zh(this.children,e),this.isDirty=!0}remove(e){uu(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(GP),this.isDirty=!1,this.children.forEach(e)}}function FP(t,e){const n=Fe.now(),i=({timestamp:s})=>{const a=s-n;a>=e&&(wi(i),t(a-e))};return ae.setup(i,!0),()=>wi(i)}function _u(t){return Xe(t)?t.get():t}class ZP{constructor(){this.members=[]}add(e){Zh(this.members,e);for(let n=this.members.length-1;n>=0;n--){const i=this.members[n];if(i===e||i===this.lead||i===this.prevLead)continue;const s=i.instance;s&&s.isConnected===!1&&i.isPresent!==!1&&!i.snapshot&&uu(this.members,i)}e.scheduleRender()}remove(e){if(uu(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let i;for(let s=n;s>=0;s--){const a=this.members[s],c=a.instance;if(a.isPresent!==!1&&(!c||c.isConnected!==!1)){i=a;break}}return i?(this.promote(i),!0):!1}promote(e,n){const i=this.lead;if(e!==i&&(this.prevLead=i,this.lead=e,e.show(),i)){i.instance&&i.scheduleRender(),e.scheduleRender();const s=i.options.layoutDependency,a=e.options.layoutDependency;if(!(s!==void 0&&a!==void 0&&s===a)){const d=i.instance;d&&d.isConnected===!1&&!i.snapshot||(e.resumeFrom=i,n&&(e.resumeFrom.preserveOpacity=!0),i.snapshot&&(e.snapshot=i.snapshot,e.snapshot.latestValues=i.animationValues||i.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0))}const{crossfade:u}=e.options;u===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:i}=e;n.onExitComplete&&n.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const Nu={hasAnimatedSinceResize:!0,hasEverUpdated:!1},Qp=["","X","Y","Z"],KP=1e3;let QP=0;function Wp(t,e,n,i){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),i&&(i[t]=0))}function OE(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=xS(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:a}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",ae,!(s||a))}const{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&OE(i)}function DE({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:i,resetTransform:s}){return class{constructor(c={},u=e?.()){this.id=QP++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(tH),this.nodes.forEach(iH),this.nodes.forEach(rH),this.nodes.forEach(eH)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=c,this.root=u?u.root||u:this,this.path=u?[...u.path,u]:[],this.parent=u,this.depth=u?u.depth+1:0;for(let d=0;d<this.path.length;d++)this.path[d].shouldResetTransform=!0;this.root===this&&(this.nodes=new XP)}addEventListener(c,u){return this.eventHandlers.has(c)||this.eventHandlers.set(c,new Qh),this.eventHandlers.get(c).add(u)}notifyListeners(c,...u){const d=this.eventHandlers.get(c);d&&d.notify(...u)}hasListeners(c){return this.eventHandlers.has(c)}mount(c){if(this.instance)return;this.isSVG=Hp(c)&&!JB(c),this.instance=c;const{layoutId:u,layout:d,visualElement:h}=this.options;if(h&&!h.current&&h.mount(c),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(d||u)&&(this.isLayoutDirty=!0),t){let p,m=0;const y=()=>this.root.updateBlockedByResize=!1;ae.read(()=>{m=window.innerWidth}),t(c,()=>{const b=window.innerWidth;b!==m&&(m=b,this.root.updateBlockedByResize=!0,p&&p(),p=FP(y,250),Nu.hasAnimatedSinceResize&&(Nu.hasAnimatedSinceResize=!1,this.nodes.forEach(VE)))})}u&&this.root.registerSharedNode(u,this),this.options.animate!==!1&&h&&(u||d)&&this.addEventListener("didUpdate",({delta:p,hasLayoutChanged:m,hasRelativeLayoutChanged:y,layout:b})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const x=this.options.transition||h.getDefaultTransition()||uH,{onLayoutAnimationStart:w,onLayoutAnimationComplete:S}=h.getProps(),E=!this.targetLayout||!CE(this.targetLayout,b),D=!m&&y;if(this.options.layoutRoot||this.resumeFrom||D||m&&(E||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const T={...Np(x,"layout"),onPlay:w,onComplete:S};(h.shouldReduceMotion||this.options.layoutRoot)&&(T.delay=0,T.type=!1),this.startAnimation(T),this.setAnimationOrigin(p,D)}else m||VE(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=b})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const c=this.getStack();c&&c.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),wi(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(sH),this.animationId++)}getTransformTemplate(){const{visualElement:c}=this.options;return c&&c.getProps().transformTemplate}willUpdate(c=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&OE(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let p=0;p<this.path.length;p++){const m=this.path[p];m.shouldResetTransform=!0,m.updateScroll("snapshot"),m.options.layoutRoot&&m.willUpdate(!1)}const{layoutId:u,layout:d}=this.options;if(u===void 0&&!d)return;const h=this.getTransformTemplate();this.prevTransformTemplateValue=h?h(this.latestValues,""):void 0,this.updateSnapshot(),c&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(jE);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(zE);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(oH),this.nodes.forEach(WP),this.nodes.forEach(JP)):this.nodes.forEach(zE),this.clearAllSnapshots();const u=Fe.now();Be.delta=bo(0,16.666666666666668,u-Be.timestamp),Be.timestamp=u,Be.isProcessing=!0,tp.update.process(Be),tp.preRender.process(Be),tp.render.process(Be),Be.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Ip.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(nH),this.sharedNodes.forEach(aH)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,ae.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){ae.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Ze(this.snapshot.measuredBox.x)&&!Ze(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let d=0;d<this.path.length;d++)this.path[d].updateScroll();const c=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=ze(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:u}=this.options;u&&u.notify("LayoutMeasure",this.layout.layoutBox,c?c.layoutBox:void 0)}updateScroll(c="measure"){let u=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===c&&(u=!1),u&&this.instance){const d=i(this.instance);this.scroll={animationId:this.root.animationId,phase:c,isRoot:d,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:d}}}resetTransform(){if(!s)return;const c=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,u=this.projectionDelta&&!wE(this.projectionDelta),d=this.getTransformTemplate(),h=d?d(this.latestValues,""):void 0,p=h!==this.prevTransformTemplateValue;c&&this.instance&&(u||Dr(this.latestValues)||p)&&(s(this.instance,h),this.shouldResetTransform=!1,this.scheduleRender())}measure(c=!0){const u=this.measurePageBox();let d=this.removeElementScroll(u);return c&&(d=this.removeTransform(d)),fH(d),{animationId:this.root.animationId,measuredBox:u,layoutBox:d,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:c}=this.options;if(!c)return ze();const u=c.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(dH))){const{scroll:h}=this.root;h&&(Ms(u.x,h.offset.x),Ms(u.y,h.offset.y))}return u}removeElementScroll(c){const u=ze();if(Wn(u,c),this.scroll?.wasRoot)return u;for(let d=0;d<this.path.length;d++){const h=this.path[d],{scroll:p,options:m}=h;h!==this.root&&p&&m.layoutScroll&&(p.wasRoot&&Wn(u,c),Ms(u.x,p.offset.x),Ms(u.y,p.offset.y))}return u}applyTransform(c,u=!1){const d=ze();Wn(d,c);for(let h=0;h<this.path.length;h++){const p=this.path[h];!u&&p.options.layoutScroll&&p.scroll&&p!==p.root&&Rs(d,{x:-p.scroll.offset.x,y:-p.scroll.offset.y}),Dr(p.latestValues)&&Rs(d,p.latestValues)}return Dr(this.latestValues)&&Rs(d,this.latestValues),d}removeTransform(c){const u=ze();Wn(u,c);for(let d=0;d<this.path.length;d++){const h=this.path[d];if(!h.instance||!Dr(h.latestValues))continue;Gp(h.latestValues)&&h.updateSnapshot();const p=ze(),m=h.measurePageBox();Wn(p,m),bE(u,h.latestValues,h.snapshot?h.snapshot.layoutBox:void 0,p)}return Dr(this.latestValues)&&bE(u,this.latestValues),u}setTargetDelta(c){this.targetDelta=c,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(c){this.options={...this.options,...c,crossfade:c.crossfade!==void 0?c.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==Be.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(c=!1){const u=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=u.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=u.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=u.isSharedProjectionDirty);const d=!!this.resumingFrom||this!==u;if(!(c||d&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:p,layoutId:m}=this.options;if(!this.layout||!(p||m))return;this.resolvedRelativeTargetAt=Be.timestamp;const y=this.getClosestProjectingParent();y&&this.linkedParentVersion!==y.layoutVersion&&!y.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(y&&y.layout?this.createRelativeTarget(y,this.layout.layoutBox,y.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=ze(),this.targetWithTransforms=ze()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),zP(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):Wn(this.target,this.layout.layoutBox),ZS(this.target,this.targetDelta)):Wn(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,y&&!!y.resumingFrom==!!this.resumingFrom&&!y.options.layoutScroll&&y.target&&this.animationProgress!==1?this.createRelativeTarget(y,this.target,y.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Gp(this.parent.latestValues)||GS(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(c,u,d){this.relativeParent=c,this.linkedParentVersion=c.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=ze(),this.relativeTargetOrigin=ze(),Tu(this.relativeTargetOrigin,u,d),Wn(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){const c=this.getLead(),u=!!this.resumingFrom||this!==c;let d=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(d=!1),u&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(d=!1),this.resolvedRelativeTargetAt===Be.timestamp&&(d=!1),d)return;const{layout:h,layoutId:p}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(h||p))return;Wn(this.layoutCorrected,this.layout.layoutBox);const m=this.treeScale.x,y=this.treeScale.y;uP(this.layoutCorrected,this.treeScale,this.path,u),c.layout&&!c.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(c.target=c.layout.layoutBox,c.targetWithTransforms=ze());const{target:b}=c;if(!b){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(fE(this.prevProjectionDelta.x,this.projectionDelta.x),fE(this.prevProjectionDelta.y,this.projectionDelta.y)),il(this.projectionDelta,this.layoutCorrected,b,this.latestValues),(this.treeScale.x!==m||this.treeScale.y!==y||!_E(this.projectionDelta.x,this.prevProjectionDelta.x)||!_E(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",b))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(c=!0){if(this.options.visualElement?.scheduleRender(),c){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=As(),this.projectionDelta=As(),this.projectionDeltaWithTransform=As()}setAnimationOrigin(c,u=!1){const d=this.snapshot,h=d?d.latestValues:{},p={...this.latestValues},m=As();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!u;const y=ze(),b=d?d.source:void 0,x=this.layout?this.layout.source:void 0,w=b!==x,S=this.getStack(),E=!S||S.members.length<=1,D=!!(w&&!E&&this.options.crossfade===!0&&!this.path.some(cH));this.animationProgress=0;let T;this.mixTargetDelta=C=>{const R=C/1e3;LE(m.x,c.x,R),LE(m.y,c.y,R),this.setTargetDelta(m),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Tu(y,this.layout.layoutBox,this.relativeParent.layout.layoutBox),lH(this.relativeTarget,this.relativeTargetOrigin,y,R),T&&BP(this.relativeTarget,T)&&(this.isProjectionDirty=!1),T||(T=ze()),Wn(T,this.relativeTarget)),w&&(this.animationValues=p,UP(p,h,this.latestValues,R,D,E)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=R},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(c){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(wi(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=ae.update(()=>{Nu.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=_s(0)),this.motionValue.jump(0,!1),this.currentAnimation=YP(this.motionValue,[0,1e3],{...c,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),c.onUpdate&&c.onUpdate(u)},onStop:()=>{},onComplete:()=>{c.onComplete&&c.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const c=this.getStack();c&&c.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(KP),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const c=this.getLead();let{targetWithTransforms:u,target:d,layout:h,latestValues:p}=c;if(!(!u||!d||!h)){if(this!==c&&this.layout&&h&&UE(this.options.animationType,this.layout.layoutBox,h.layoutBox)){d=this.target||ze();const m=Ze(this.layout.layoutBox.x);d.x.min=c.target.x.min,d.x.max=d.x.min+m;const y=Ze(this.layout.layoutBox.y);d.y.min=c.target.y.min,d.y.max=d.y.min+y}Wn(u,d),Rs(u,p),il(this.projectionDeltaWithTransform,this.layoutCorrected,u,p)}}registerSharedNode(c,u){this.sharedNodes.has(c)||this.sharedNodes.set(c,new ZP),this.sharedNodes.get(c).add(u);const h=u.options.initialPromotionConfig;u.promote({transition:h?h.transition:void 0,preserveFollowOpacity:h&&h.shouldPreserveFollowOpacity?h.shouldPreserveFollowOpacity(u):void 0})}isLead(){const c=this.getStack();return c?c.lead===this:!0}getLead(){const{layoutId:c}=this.options;return c?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:c}=this.options;return c?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:c}=this.options;if(c)return this.root.sharedNodes.get(c)}promote({needsReset:c,transition:u,preserveFollowOpacity:d}={}){const h=this.getStack();h&&h.promote(this,d),c&&(this.projectionDelta=void 0,this.needsReset=!0),u&&this.setOptions({transition:u})}relegate(){const c=this.getStack();return c?c.relegate(this):!1}resetSkewAndRotation(){const{visualElement:c}=this.options;if(!c)return;let u=!1;const{latestValues:d}=c;if((d.z||d.rotate||d.rotateX||d.rotateY||d.rotateZ||d.skewX||d.skewY)&&(u=!0),!u)return;const h={};d.z&&Wp("z",c,h,this.animationValues);for(let p=0;p<Qp.length;p++)Wp(`rotate${Qp[p]}`,c,h,this.animationValues),Wp(`skew${Qp[p]}`,c,h,this.animationValues);c.render();for(const p in h)c.setStaticValue(p,h[p]),this.animationValues&&(this.animationValues[p]=h[p]);c.scheduleRender()}applyProjectionStyles(c,u){if(!this.instance||this.isSVG)return;if(!this.isVisible){c.visibility="hidden";return}const d=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,c.visibility="",c.opacity="",c.pointerEvents=_u(u?.pointerEvents)||"",c.transform=d?d(this.latestValues,""):"none";return}const h=this.getLead();if(!this.projectionDelta||!this.layout||!h.target){this.options.layoutId&&(c.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,c.pointerEvents=_u(u?.pointerEvents)||""),this.hasProjected&&!Dr(this.latestValues)&&(c.transform=d?d({},""):"none",this.hasProjected=!1);return}c.visibility="";const p=h.animationValues||h.latestValues;this.applyTransformsToTarget();let m=PP(this.projectionDeltaWithTransform,this.treeScale,p);d&&(m=d(p,m)),c.transform=m;const{x:y,y:b}=this.projectionDelta;c.transformOrigin=`${y.origin*100}% ${b.origin*100}% 0`,h.animationValues?c.opacity=h===this?p.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:p.opacityExit:c.opacity=h===this?p.opacity!==void 0?p.opacity:"":p.opacityExit!==void 0?p.opacityExit:0;for(const x in Zp){if(p[x]===void 0)continue;const{correct:w,applyTo:S,isCSSVariable:E}=Zp[x],D=m==="none"?p[x]:w(p[x],h);if(S){const T=S.length;for(let C=0;C<T;C++)c[S[C]]=D}else E?this.options.visualElement.renderState.vars[x]=D:c[x]=D}this.options.layoutId&&(c.pointerEvents=h===this?_u(u?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(c=>c.currentAnimation?.stop()),this.root.nodes.forEach(jE),this.root.sharedNodes.clear()}}}function WP(t){t.updateLayout()}function JP(t){const e=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:i}=t.layout,{animationType:s}=t.options,a=e.source!==t.layout.source;s==="size"?wo(p=>{const m=a?e.measuredBox[p]:e.layoutBox[p],y=Ze(m);m.min=n[p].min,m.max=m.min+y}):UE(s,e.layoutBox,n)&&wo(p=>{const m=a?e.measuredBox[p]:e.layoutBox[p],y=Ze(n[p]);m.max=m.min+y,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[p].max=t.relativeTarget[p].min+y)});const c=As();il(c,n,e.layoutBox);const u=As();a?il(u,t.applyTransform(i,!0),e.measuredBox):il(u,n,e.layoutBox);const d=!wE(c);let h=!1;if(!t.resumeFrom){const p=t.getClosestProjectingParent();if(p&&!p.resumeFrom){const{snapshot:m,layout:y}=p;if(m&&y){const b=ze();Tu(b,e.layoutBox,m.layoutBox);const x=ze();Tu(x,n,y.layoutBox),CE(b,x)||(h=!0),p.options.layoutRoot&&(t.relativeTarget=x,t.relativeTargetOrigin=b,t.relativeParent=p)}}}t.notifyListeners("didUpdate",{layout:n,snapshot:e,delta:u,layoutDelta:c,hasLayoutChanged:d,hasRelativeLayoutChanged:h})}else if(t.isLead()){const{onExitComplete:n}=t.options;n&&n()}t.options.transition=void 0}function tH(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function eH(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function nH(t){t.clearSnapshot()}function jE(t){t.clearMeasurements()}function zE(t){t.isLayoutDirty=!1}function oH(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function VE(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function iH(t){t.resolveTargetDelta()}function rH(t){t.calcProjection()}function sH(t){t.resetSkewAndRotation()}function aH(t){t.removeLeadSnapshot()}function LE(t,e,n){t.translate=ye(e.translate,0,n),t.scale=ye(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function IE(t,e,n,i){t.min=ye(e.min,n.min,i),t.max=ye(e.max,n.max,i)}function lH(t,e,n,i){IE(t.x,e.x,n.x,i),IE(t.y,e.y,n.y,i)}function cH(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const uH={duration:.45,ease:[.4,0,.1,1]},BE=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),PE=BE("applewebkit/")&&!BE("chrome/")?Math.round:Nn;function HE(t){t.min=PE(t.min),t.max=PE(t.max)}function fH(t){HE(t.x),HE(t.y)}function UE(t,e,n){return t==="position"||t==="preserve-aspect"&&!jP(TE(e),TE(n),.2)}function dH(t){return t!==t.root&&t.scroll?.wasRoot}const hH=DE({attachResizeListener:(t,e)=>rl(t,"resize",e),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body?.scrollLeft||0,y:document.documentElement.scrollTop||document.body?.scrollTop||0}),checkIsScrollRoot:()=>!0}),Jp={current:void 0},$E=DE({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!Jp.current){const t=new hH({});t.mount(window),t.setOptions({layoutScroll:!0}),Jp.current=t}return Jp.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),tm=N.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function qE(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function pH(...t){return e=>{let n=!1;const i=t.map(s=>{const a=qE(s,e);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let s=0;s<i.length;s++){const a=i[s];typeof a=="function"?a():qE(t[s],null)}}}}function mH(...t){return N.useCallback(pH(...t),t)}class gH extends N.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const i=n.offsetParent,s=Lp(i)&&i.offsetWidth||0,a=Lp(i)&&i.offsetHeight||0,c=this.props.sizeRef.current;c.height=n.offsetHeight||0,c.width=n.offsetWidth||0,c.top=n.offsetTop,c.left=n.offsetLeft,c.right=s-c.width-c.left,c.bottom=a-c.height-c.top}return null}componentDidUpdate(){}render(){return this.props.children}}function yH({children:t,isPresent:e,anchorX:n,anchorY:i,root:s,pop:a}){const c=N.useId(),u=N.useRef(null),d=N.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:h}=N.useContext(tm),p=t.props?.ref??t?.ref,m=mH(u,p);return N.useInsertionEffect(()=>{const{width:y,height:b,top:x,left:w,right:S,bottom:E}=d.current;if(e||a===!1||!u.current||!y||!b)return;const D=n==="left"?`left: ${w}`:`right: ${S}`,T=i==="bottom"?`bottom: ${E}`:`top: ${x}`;u.current.dataset.motionPopId=c;const C=document.createElement("style");h&&(C.nonce=h);const R=s??document.head;return R.appendChild(C),C.sheet&&C.sheet.insertRule(`
69
69
  [data-motion-pop-id="${c}"] {
70
70
  position: absolute !important;
71
71
  width: ${y}px !important;
72
72
  height: ${b}px !important;
73
- ${O}px !important;
74
- ${C}px !important;
73
+ ${D}px !important;
74
+ ${T}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}) ===`),TU(S,w,c,i,l);const E=new Set(b);E.add(x.componentRef),d(S,w+".",E)}}}if(d(t,s,new Set([t.name])),l){console.log(`
78
- === Port Forwarding Map (${c.size} rules) ===`);for(const[m,y]of c.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){l&&console.log(` SKIP PORT FORWARDING: ${m.source.nodeId}.${m.source.portName} -> ${m.target.nodeId}.${m.target.portName}`);continue}const S=y&&b&&m.source.nodeId===m.target.nodeId,E=R=>R.nodeId===ke||n.some(A=>A.id===R.nodeId),O=R=>{const A=[],k=new Set,D=[R];for(;D.length>0;){const H=D.shift(),Y=`${H.nodeId}.${H.portName}`;if(!k.has(Y)){if(k.add(Y),E(H)){A.push(H);continue}if(u.has(H.nodeId)&&c.has(Y)){const $=c.get(Y);for(const F of $)D.push(F)}else A.push(H)}}return A.length>0?A:[R]};let C=[m.source];if(y&&!S&&(C=O(m.source),l&&C.length>0))for(const R of C)console.log(` FORWARD SOURCE: ${m.source.nodeId}.${m.source.portName} -> ${R.nodeId}.${R.portName}`);let _=[m.target];if(b&&!S&&(_=O(m.target),l&&_.length>0))for(const R of _)console.log(` FORWARD TARGET: ${m.target.nodeId}.${m.target.portName} -> ${R.nodeId}.${R.portName}`);for(const R of C)for(const A of _)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){l&&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),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(C)&&R.removeChild(C)}},[e]),M.jsx(gH,{isPresent:e,childRef:u,sizeRef:d,pop:a,children:a===!1?t:N.cloneElement(t,{ref:m})})}const vH=({children:t,initial:e,isPresent:n,onExitComplete:i,custom:s,presenceAffectsLayout:a,mode:c,anchorX:u,anchorY:d,root:h})=>{const p=Fh(bH),m=N.useId();let y=!0,b=N.useMemo(()=>(y=!1,{id:m,initial:e,isPresent:n,custom:s,onExitComplete:x=>{p.set(x,!0);for(const w of p.values())if(!w)return;i&&i()},register:x=>(p.set(x,!1),()=>p.delete(x))}),[n,p,i]);return a&&y&&(b={...b}),N.useMemo(()=>{p.forEach((x,w)=>p.set(w,!1))},[n]),N.useEffect(()=>{!n&&!p.size&&i&&i()},[n]),t=M.jsx(yH,{pop:c==="popLayout",isPresent:n,anchorX:u,anchorY:d,root:h,children:t}),M.jsx(cu.Provider,{value:b,children:t})};function bH(){return new Map}function YE(t=!0){const e=N.useContext(cu);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:i,register:s}=e,a=N.useId();N.useEffect(()=>{if(t)return s(a)},[t]);const c=N.useCallback(()=>t&&i&&i(a),[a,i,t]);return!n&&i?[!1,c]:[!0]}const Au=t=>t.key||"";function GE(t){const e=[];return N.Children.forEach(t,n=>{N.isValidElement(n)&&e.push(n)}),e}const XE=({children:t,custom:e,initial:n=!0,onExitComplete:i,presenceAffectsLayout:s=!0,mode:a="sync",propagate:c=!1,anchorX:u="left",anchorY:d="top",root:h})=>{const[p,m]=YE(c),y=N.useMemo(()=>GE(t),[t]),b=c&&!p?[]:y.map(Au),x=N.useRef(!0),w=N.useRef(y),S=Fh(()=>new Map),E=N.useRef(new Set),[D,T]=N.useState(y),[C,R]=N.useState(y);y1(()=>{x.current=!1,w.current=y;for(let k=0;k<C.length;k++){const H=Au(C[k]);b.includes(H)?(S.delete(H),E.current.delete(H)):S.get(H)!==!0&&S.set(H,!1)}},[C,b.length,b.join("-")]);const A=[];if(y!==D){let k=[...y];for(let H=0;H<C.length;H++){const $=C[H],q=Au($);b.includes(q)||(k.splice(H,0,$),A.push($))}return a==="wait"&&A.length&&(k=A),R(GE(k)),T(y),null}const{forceRender:O}=N.useContext(Xh);return M.jsx(M.Fragment,{children:C.map(k=>{const H=Au(k),$=c&&!p?!1:y===C||b.includes(H),q=()=>{if(E.current.has(H))return;if(E.current.add(H),S.has(H))S.set(H,!0);else return;let F=!0;S.forEach(Q=>{Q||(F=!1)}),F&&(O?.(),R(w.current),c&&m?.(),i&&i())};return M.jsx(vH,{isPresent:$,initial:!x.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:a,root:h,onExitComplete:$?void 0:q,anchorX:u,anchorY:d,children:k},H)})})},FE=N.createContext({strict:!1}),ZE={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let KE=!1;function xH(){if(KE)return;const t={};for(const e in ZE)t[e]={isEnabled:n=>ZE[e].some(i=>!!n[i])};$S(t),KE=!0}function QE(){return xH(),sP()}function wH(t){const e=QE();for(const n in t)e[n]={...e[n],...t[n]};$S(e)}const SH=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function Mu(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||SH.has(t)}let WE=t=>!Mu(t);function EH(t){typeof t=="function"&&(WE=e=>e.startsWith("on")?!Mu(e):t(e))}try{EH(require("@emotion/is-prop-valid").default)}catch{}function CH(t,e,n){const i={};for(const s in t)s==="values"&&typeof t.values=="object"||(WE(s)||n===!0&&Mu(s)||!e&&!Mu(s)||t.draggable&&s.startsWith("onDrag"))&&(i[s]=t[s]);return i}const Ru=N.createContext({});function TH(t,e){if(Su(t)){const{initial:n,animate:i}=t;return{initial:n===!1||nl(n)?n:void 0,animate:nl(i)?i:void 0}}return t.inherit!==!1?e:{}}function _H(t){const{initial:e,animate:n}=TH(t,N.useContext(Ru));return N.useMemo(()=>({initial:e,animate:n}),[JE(e),JE(n)])}function JE(t){return Array.isArray(t)?t.join(" "):t}const em=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function tC(t,e,n){for(const i in e)!Xe(e[i])&&!nE(i,n)&&(t[i]=e[i])}function NH({transformTemplate:t},e){return N.useMemo(()=>{const n=em();return Fp(n,e,t),Object.assign({},n.vars,n.style)},[e])}function AH(t,e){const n=t.style||{},i={};return tC(i,n,t),Object.assign(i,NH(t,e)),i}function MH(t,e){const n={},i=AH(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=i,n}const eC=()=>({...em(),attrs:{}});function RH(t,e,n,i){const s=N.useMemo(()=>{const a=eC();return oE(a,e,rE(i),t.transformTemplate,t.style),{...a.attrs,style:{...a.style}}},[e]);if(t.style){const a={};tC(a,t.style,t),s.style={...a,...s.style}}return s}const kH=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function nm(t){return typeof t!="string"||t.includes("-")?!1:!!(kH.indexOf(t)>-1||/[A-Z]/u.test(t))}function OH(t,e,n,{latestValues:i},s,a=!1,c){const d=(c??nm(t)?RH:MH)(e,i,s,t),h=CH(e,typeof t=="string",a),p=t!==N.Fragment?{...h,...d,ref:n}:{},{children:m}=e,y=N.useMemo(()=>Xe(m)?m.get():m,[m]);return N.createElement(t,{...p,children:y})}function DH({scrapeMotionValuesFromProps:t,createRenderState:e},n,i,s){return{latestValues:jH(n,i,s,t),renderState:e()}}function jH(t,e,n,i){const s={},a=i(t,{});for(const y in a)s[y]=_u(a[y]);let{initial:c,animate:u}=t;const d=Su(t),h=PS(t);e&&h&&!d&&t.inherit!==!1&&(c===void 0&&(c=e.initial),u===void 0&&(u=e.animate));let p=n?n.initial===!1:!1;p=p||c===!1;const m=p?u:c;if(m&&typeof m!="boolean"&&!wu(m)){const y=Array.isArray(m)?m:[m];for(let b=0;b<y.length;b++){const x=Mp(t,y[b]);if(x){const{transitionEnd:w,transition:S,...E}=x;for(const D in E){let T=E[D];if(Array.isArray(T)){const C=p?T.length-1:0;T=T[C]}T!==null&&(s[D]=T)}for(const D in w)s[D]=w[D]}}}return s}const nC=t=>(e,n)=>{const i=N.useContext(Ru),s=N.useContext(cu),a=()=>DH(t,e,i,s);return n?a():Fh(a)},zH=nC({scrapeMotionValuesFromProps:Kp,createRenderState:em}),VH=nC({scrapeMotionValuesFromProps:sE,createRenderState:eC}),LH=Symbol.for("motionComponentSymbol");function IH(t,e,n){const i=N.useRef(n);N.useInsertionEffect(()=>{i.current=n});const s=N.useRef(null);return N.useCallback(a=>{a&&t.onMount?.(a),e&&(a?e.mount(a):e.unmount());const c=i.current;if(typeof c=="function")if(a){const u=c(a);typeof u=="function"&&(s.current=u)}else s.current?(s.current(),s.current=null):c(a);else c&&(c.current=a)},[e])}const oC=N.createContext({});function ks(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function BH(t,e,n,i,s,a){const{visualElement:c}=N.useContext(Ru),u=N.useContext(FE),d=N.useContext(cu),h=N.useContext(tm),p=h.reducedMotion,m=h.skipAnimations,y=N.useRef(null),b=N.useRef(!1);i=i||u.renderer,!y.current&&i&&(y.current=i(t,{visualState:e,parent:c,props:n,presenceContext:d,blockInitialAnimation:d?d.initial===!1:!1,reducedMotionConfig:p,skipAnimations:m,isSVG:a}),b.current&&y.current&&(y.current.manuallyAnimateOnMount=!0));const x=y.current,w=N.useContext(oC);x&&!x.projection&&s&&(x.type==="html"||x.type==="svg")&&PH(y.current,n,s,w);const S=N.useRef(!1);N.useInsertionEffect(()=>{x&&S.current&&x.update(n,d)});const E=n[bS],D=N.useRef(!!E&&!window.MotionHandoffIsComplete?.(E)&&window.MotionHasOptimisedAnimation?.(E));return y1(()=>{b.current=!0,x&&(S.current=!0,window.MotionIsMounted=!0,x.updateFeatures(),x.scheduleRenderMicrotask(),D.current&&x.animationState&&x.animationState.animateChanges())}),N.useEffect(()=>{x&&(!D.current&&x.animationState&&x.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(E)}),D.current=!1),x.enteringChildren=void 0)}),x}function PH(t,e,n,i){const{layoutId:s,layout:a,drag:c,dragConstraints:u,layoutScroll:d,layoutRoot:h,layoutCrossfade:p}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:iC(t.parent)),t.projection.setOptions({layoutId:s,layout:a,alwaysMeasureLayout:!!c||u&&ks(u),visualElement:t,animationType:typeof a=="string"?a:"both",initialPromotionConfig:i,crossfade:p,layoutScroll:d,layoutRoot:h})}function iC(t){if(t)return t.options.allowProjection!==!1?t.projection:iC(t.parent)}function om(t,{forwardMotionProps:e=!1,type:n}={},i,s){i&&wH(i);const a=n?n==="svg":nm(t),c=a?VH:zH;function u(h,p){let m;const y={...N.useContext(tm),...h,layoutId:HH(h)},{isStatic:b}=y,x=_H(h),w=c(h,b);if(!b&&g1){UH();const S=$H(y);m=S.MeasureLayout,x.visualElement=BH(t,w,y,s,S.ProjectionNode,a)}return M.jsxs(Ru.Provider,{value:x,children:[m&&x.visualElement?M.jsx(m,{visualElement:x.visualElement,...y}):null,OH(t,h,IH(w,x.visualElement,p),w,b,e,a)]})}u.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const d=N.forwardRef(u);return d[LH]=t,d}function HH({layoutId:t}){const e=N.useContext(Xh).id;return e&&t!==void 0?e+"-"+t:t}function UH(t,e){N.useContext(FE).strict}function $H(t){const e=QE(),{drag:n,layout:i}=e;if(!n&&!i)return{};const s={...n,...i};return{MeasureLayout:n?.isEnabled(t)||i?.isEnabled(t)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function qH(t,e){if(typeof Proxy>"u")return om;const n=new Map,i=(a,c)=>om(a,c,t,e),s=(a,c)=>i(a,c);return new Proxy(s,{get:(a,c)=>c==="create"?i:(n.has(c)||n.set(c,om(c,void 0,t,e)),n.get(c))})}const YH=(t,e)=>e.isSVG??nm(t)?new EP(e):new yP(e,{allowProjection:t!==N.Fragment});class GH extends Ci{constructor(e){super(e),e.animationState||(e.animationState=AP(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();wu(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let XH=0;class FH extends Ci{constructor(){super(...arguments),this.id=XH++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===i)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const ZH={animation:{Feature:GH},exit:{Feature:FH}};function sl(t){return{point:{x:t.pageX,y:t.pageY}}}const KH=t=>e=>Bp(e)&&t(e,sl(e));function al(t,e,n,i){return rl(t,e,KH(n),i)}const rC=({current:t})=>t?t.ownerDocument.defaultView:null,sC=(t,e)=>Math.abs(t-e);function QH(t,e){const n=sC(t.x,e.x),i=sC(t.y,e.y);return Math.sqrt(n**2+i**2)}const aC=new Set(["auto","scroll"]);class lC{constructor(e,n,{transformPagePoint:i,contextWindow:s=window,dragSnapToOrigin:a=!1,distanceThreshold:c=3,element:u}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=b=>{this.handleScroll(b.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const b=rm(this.lastMoveEventInfo,this.history),x=this.startEvent!==null,w=QH(b.offset,{x:0,y:0})>=this.distanceThreshold;if(!x&&!w)return;const{point:S}=b,{timestamp:E}=Be;this.history.push({...S,timestamp:E});const{onStart:D,onMove:T}=this.handlers;x||(D&&D(this.lastMoveEvent,b),this.startEvent=this.lastMoveEvent),T&&T(this.lastMoveEvent,b)},this.handlePointerMove=(b,x)=>{this.lastMoveEvent=b,this.lastMoveEventInfo=im(x,this.transformPagePoint),ae.update(this.updatePoint,!0)},this.handlePointerUp=(b,x)=>{this.end();const{onEnd:w,onSessionEnd:S,resumeAnimation:E}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&E&&E(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const D=rm(b.type==="pointercancel"?this.lastMoveEventInfo:im(x,this.transformPagePoint),this.history);this.startEvent&&w&&w(b,D),S&&S(b,D)},!Bp(e))return;this.dragSnapToOrigin=a,this.handlers=n,this.transformPagePoint=i,this.distanceThreshold=c,this.contextWindow=s||window;const d=sl(e),h=im(d,this.transformPagePoint),{point:p}=h,{timestamp:m}=Be;this.history=[{...p,timestamp:m}];const{onSessionStart:y}=n;y&&y(e,rm(h,this.history)),this.removeListeners=Xa(al(this.contextWindow,"pointermove",this.handlePointerMove),al(this.contextWindow,"pointerup",this.handlePointerUp),al(this.contextWindow,"pointercancel",this.handlePointerUp)),u&&this.startScrollTracking(u)}startScrollTracking(e){let n=e.parentElement;for(;n;){const i=getComputedStyle(n);(aC.has(i.overflowX)||aC.has(i.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0}),window.addEventListener("scroll",this.onWindowScroll),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const i=e===window,s=i?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},a={x:s.x-n.x,y:s.y-n.y};a.x===0&&a.y===0||(i?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=a.x,this.lastMoveEventInfo.point.y+=a.y):this.history.length>0&&(this.history[0].x-=a.x,this.history[0].y-=a.y),this.scrollPositions.set(e,s),ae.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),wi(this.updatePoint)}}function im(t,e){return e?{point:e(t.point)}:t}function cC(t,e){return{x:t.x-e.x,y:t.y-e.y}}function rm({point:t},e){return{point:t,delta:cC(t,uC(e)),offset:cC(t,WH(e)),velocity:JH(e,.1)}}function WH(t){return t[0]}function uC(t){return t[t.length-1]}function JH(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,i=null;const s=uC(t);for(;n>=0&&(i=t[n],!(s.timestamp-i.timestamp>Zn(e)));)n--;if(!i)return{x:0,y:0};i===t[0]&&t.length>2&&s.timestamp-i.timestamp>Zn(e)*2&&(i=t[1]);const a=An(s.timestamp-i.timestamp);if(a===0)return{x:0,y:0};const c={x:(s.x-i.x)/a,y:(s.y-i.y)/a};return c.x===1/0&&(c.x=0),c.y===1/0&&(c.y=0),c}function tU(t,{min:e,max:n},i){return e!==void 0&&t<e?t=i?ye(e,t,i.min):Math.max(t,e):n!==void 0&&t>n&&(t=i?ye(n,t,i.max):Math.min(t,n)),t}function fC(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function eU(t,{top:e,left:n,bottom:i,right:s}){return{x:fC(t.x,n,s),y:fC(t.y,e,i)}}function dC(t,e){let n=e.min-t.min,i=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,i]=[i,n]),{min:n,max:i}}function nU(t,e){return{x:dC(t.x,e.x),y:dC(t.y,e.y)}}function oU(t,e){let n=.5;const i=Ze(t),s=Ze(e);return s>i?n=Fa(e.min,e.max-i,t.min):i>s&&(n=Fa(t.min,t.max-s,e.min)),bo(0,1,n)}function iU(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const sm=.35;function rU(t=sm){return t===!1?t=0:t===!0&&(t=sm),{x:hC(t,"left","right"),y:hC(t,"top","bottom")}}function hC(t,e,n){return{min:pC(t,e),max:pC(t,n)}}function pC(t,e){return typeof t=="number"?t:t[e]||0}const sU=new WeakMap;class aU{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=ze(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:i}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const a=m=>{n&&this.snapToCursor(sl(m).point),this.stopAnimation()},c=(m,y)=>{const{drag:b,dragPropagation:x,onDragStart:w}=this.getProps();if(b&&!x&&(this.openDragLock&&this.openDragLock(),this.openDragLock=VB(b),!this.openDragLock))return;this.latestPointerEvent=m,this.latestPanInfo=y,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),wo(E=>{let D=this.getAxisMotionValue(E).get()||0;if(xo.test(D)){const{projection:T}=this.visualElement;if(T&&T.layout){const C=T.layout.layoutBox[E];C&&(D=Ze(C)*(parseFloat(D)/100))}}this.originPoint[E]=D}),w&&ae.update(()=>w(m,y),!1,!0),kp(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},u=(m,y)=>{this.latestPointerEvent=m,this.latestPanInfo=y;const{dragPropagation:b,dragDirectionLock:x,onDirectionLock:w,onDrag:S}=this.getProps();if(!b&&!this.openDragLock)return;const{offset:E}=y;if(x&&this.currentDirection===null){this.currentDirection=cU(E),this.currentDirection!==null&&w&&w(this.currentDirection);return}this.updateAxis("x",y.point,E),this.updateAxis("y",y.point,E),this.visualElement.render(),S&&ae.update(()=>S(m,y),!1,!0)},d=(m,y)=>{this.latestPointerEvent=m,this.latestPanInfo=y,this.stop(m,y),this.latestPointerEvent=null,this.latestPanInfo=null},h=()=>{const{dragSnapToOrigin:m}=this.getProps();(m||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:p}=this.getProps();this.panSession=new lC(e,{onSessionStart:a,onStart:c,onMove:u,onSessionEnd:d,resumeAnimation:h},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:p,distanceThreshold:i,contextWindow:rC(this.visualElement),element:this.visualElement.current})}stop(e,n){const i=e||this.latestPointerEvent,s=n||this.latestPanInfo,a=this.isDragging;if(this.cancel(),!a||!s||!i)return;const{velocity:c}=s;this.startAnimation(c);const{onDragEnd:u}=this.getProps();u&&ae.postRender(()=>u(i,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,i){const{drag:s}=this.getProps();if(!i||!ku(e,s,this.currentDirection))return;const a=this.getAxisMotionValue(e);let c=this.originPoint[e]+i[e];this.constraints&&this.constraints[e]&&(c=tU(c,this.constraints[e],this.elastic[e])),a.set(c)}resolveConstraints(){const{dragConstraints:e,dragElastic:n}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,s=this.constraints;e&&ks(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&i?this.constraints=eU(i.layoutBox,e):this.constraints=!1,this.elastic=rU(n),s!==this.constraints&&!ks(e)&&i&&this.constraints&&!this.hasMutatedConstraints&&wo(a=>{this.constraints!==!1&&this.getAxisMotionValue(a)&&(this.constraints[a]=iU(i.layoutBox[a],this.constraints[a]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!ks(e))return!1;const i=e.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const a=fP(i,s.root,this.visualElement.getTransformPagePoint());let c=nU(s.layout.layoutBox,a);if(n){const u=n(lP(c));this.hasMutatedConstraints=!!u,u&&(c=YS(u))}return c}startAnimation(e){const{drag:n,dragMomentum:i,dragElastic:s,dragTransition:a,dragSnapToOrigin:c,onDragTransitionEnd:u}=this.getProps(),d=this.constraints||{},h=wo(p=>{if(!ku(p,n,this.currentDirection))return;let m=d&&d[p]||{};c&&(m={min:0,max:0});const y=s?200:1e6,b=s?40:1e7,x={type:"inertia",velocity:i?e[p]:0,bounceStiffness:y,bounceDamping:b,timeConstant:750,restDelta:1,restSpeed:10,...a,...m};return this.startAxisValueAnimation(p,x)});return Promise.all(h).then(u)}startAxisValueAnimation(e,n){const i=this.getAxisMotionValue(e);return kp(this.visualElement,e),i.start(Ap(e,i,0,n,this.visualElement,!1))}stopAnimation(){wo(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,i=this.visualElement.getProps(),s=i[n];return s||this.visualElement.getValue(e,(i.initial?i.initial[e]:void 0)||0)}snapToCursor(e){wo(n=>{const{drag:i}=this.getProps();if(!ku(n,i,this.currentDirection))return;const{projection:s}=this.visualElement,a=this.getAxisMotionValue(n);if(s&&s.layout){const{min:c,max:u}=s.layout.layoutBox[n],d=a.get()||0;a.set(e[n]-ye(c,u,.5)+d)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:i}=this.visualElement;if(!ks(n)||!i||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};wo(c=>{const u=this.getAxisMotionValue(c);if(u&&this.constraints!==!1){const d=u.get();s[c]=oU({min:d,max:d},this.constraints[c])}});const{transformTemplate:a}=this.visualElement.getProps();this.visualElement.current.style.transform=a?a({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.constraints=!1,this.resolveConstraints(),wo(c=>{if(!ku(c,e,null))return;const u=this.getAxisMotionValue(c),{min:d,max:h}=this.constraints[c];u.set(ye(d,h,s[c]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;sU.set(this.visualElement,this);const e=this.visualElement.current,n=al(e,"pointerdown",h=>{const{drag:p,dragListener:m=!0}=this.getProps(),y=h.target,b=y!==e&&UB(y);p&&m&&!b&&this.start(h)});let i;const s=()=>{const{dragConstraints:h}=this.getProps();ks(h)&&h.current&&(this.constraints=this.resolveRefConstraints(),i||(i=lU(e,h.current,()=>this.scalePositionWithinConstraints())))},{projection:a}=this.visualElement,c=a.addEventListener("measure",s);a&&!a.layout&&(a.root&&a.root.updateScroll(),a.updateLayout()),ae.read(s);const u=rl(window,"resize",()=>this.scalePositionWithinConstraints()),d=a.addEventListener("didUpdate",(({delta:h,hasLayoutChanged:p})=>{this.isDragging&&p&&(wo(m=>{const y=this.getAxisMotionValue(m);y&&(this.originPoint[m]+=h[m].translate,y.set(y.get()+h[m].translate))}),this.visualElement.render())}));return()=>{u(),n(),c(),d&&d(),i&&i()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:i=!1,dragPropagation:s=!1,dragConstraints:a=!1,dragElastic:c=sm,dragMomentum:u=!0}=e;return{...e,drag:n,dragDirectionLock:i,dragPropagation:s,dragConstraints:a,dragElastic:c,dragMomentum:u}}}function mC(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function lU(t,e,n){const i=LS(t,mC(n)),s=LS(e,mC(n));return()=>{i(),s()}}function ku(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function cU(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class uU extends Ci{constructor(e){super(e),this.removeGroupControls=Nn,this.removeListeners=Nn,this.controls=new aU(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Nn}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const am=t=>(e,n)=>{t&&ae.update(()=>t(e,n),!1,!0)};class fU extends Ci{constructor(){super(...arguments),this.removePointerDownListener=Nn}onPointerDown(e){this.session=new lC(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:rC(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:i,onPanEnd:s}=this.node.getProps();return{onSessionStart:am(e),onStart:am(n),onMove:am(i),onEnd:(a,c)=>{delete this.session,s&&ae.postRender(()=>s(a,c))}}}mount(){this.removePointerDownListener=al(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let lm=!1;class dU extends N.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i,layoutId:s}=this.props,{projection:a}=e;a&&(n.group&&n.group.add(a),i&&i.register&&s&&i.register(a),lm&&a.root.didUpdate(),a.addEventListener("animationComplete",()=>{this.safeToRemove()}),a.setOptions({...a.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),Nu.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:i,drag:s,isPresent:a}=this.props,{projection:c}=i;return c&&(c.isPresent=a,e.layoutDependency!==n&&c.setOptions({...c.options,layoutDependency:n}),lm=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==a?c.willUpdate():this.safeToRemove(),e.isPresent!==a&&(a?c.promote():c.relegate()||ae.postRender(()=>{const u=c.getStack();(!u||!u.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),Ip.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:i}=this.props,{projection:s}=e;lm=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),i&&i.deregister&&i.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function gC(t){const[e,n]=YE(),i=N.useContext(Xh);return M.jsx(dU,{...t,layoutGroup:i,switchLayoutGroup:N.useContext(oC),isPresent:e,safeToRemove:n})}const hU={pan:{Feature:fU},drag:{Feature:uU,ProjectionNode:$E,MeasureLayout:gC}};function yC(t,e,n){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,a=i[s];a&&ae.postRender(()=>a(e,sl(e)))}class pU extends Ci{mount(){const{current:e}=this.node;e&&(this.unmount=IB(e,(n,i)=>(yC(this.node,i,"Start"),s=>yC(this.node,s,"End"))))}unmount(){}}class mU extends Ci{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=Xa(rl(this.node.current,"focus",()=>this.onFocus()),rl(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function vC(t,e,n){const{props:i}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),a=i[s];a&&ae.postRender(()=>a(e,sl(e)))}class gU extends Ci{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:i}=this.node.props;this.unmount=qB(e,(s,a)=>(vC(this.node,a,"Start"),(c,{success:u})=>vC(this.node,c,u?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:i?.tap===!1})}unmount(){}}const cm=new WeakMap,um=new WeakMap,yU=t=>{const e=cm.get(t.target);e&&e(t)},vU=t=>{t.forEach(yU)};function bU({root:t,...e}){const n=t||document;um.has(n)||um.set(n,{});const i=um.get(n),s=JSON.stringify(e);return i[s]||(i[s]=new IntersectionObserver(vU,{root:t,...e})),i[s]}function xU(t,e,n){const i=bU(e);return cm.set(t,n),i.observe(t),()=>{cm.delete(t),i.unobserve(t)}}const wU={some:0,all:1};class SU extends Ci{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:i,amount:s="some",once:a}=e,c={root:n?n.current:void 0,rootMargin:i,threshold:typeof s=="number"?s:wU[s]},u=d=>{const{isIntersecting:h}=d;if(this.isInView===h||(this.isInView=h,a&&!h&&this.hasEnteredView))return;h&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",h);const{onViewportEnter:p,onViewportLeave:m}=this.node.getProps(),y=h?p:m;y&&y(d)};return xU(this.node.current,c,u)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(EU(e,n))&&this.startObserver()}unmount(){}}function EU({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const CU={...ZH,...{inView:{Feature:SU},tap:{Feature:gU},focus:{Feature:mU},hover:{Feature:pU}},...hU,...{layout:{ProjectionNode:$E,MeasureLayout:gC}}},Ou=qH(CU,YH),bC="__boundary_in_",xC="__boundary_out_";function TU(t){const e=[],n=[];for(const i of t.inputs){const s=`${bC}${i.name}`,a=i.portType.kind==="bus";e.push({id:s,label:i.name,componentRef:a?"Input":"Switch",arguments:a?{value:0,width:i.portType.width}:{value:!1},inputs:[],outputs:[{id:`${s}_out`,name:"out",portType:i.portType}],clocks:[]})}for(const i of t.outputs){const s=`${xC}${i.name}`,a=i.portType.kind==="bus";e.push({id:s,label:i.name,componentRef:a?"HexDisplay":"Led",arguments:{},inputs:[{id:`${s}_in`,name:"in",portType:i.portType}],outputs:[],clocks:[]})}for(const i of t.connections){const s={...i.source},a={...i.target};i.source.nodeId===""&&(s.nodeId=`${bC}${i.source.portName}`,s.portName="out"),i.target.nodeId===""&&(a.nodeId=`${xC}${i.target.portName}`,a.portName="in"),n.push({...i,source:s,target:a})}return{...t,name:`__drilldown_${t.name}`,nodes:[...e,...t.nodes],connections:n,implementation:{kind:"primitive"}}}const Le="__top__";function _U(t,e,n=!1,i){const s=[],a=[],c={path:"",componentName:t.name,children:[],primitives:[]};function u(p,m,y,b=new Set){for(const x of p.nodes){const w=m+x.id,S=e.resolveCircuit(x.componentRef);if(!S)throw new Error(`Unknown component: ${x.componentRef} (referenced by node ${w})`);if(S.implementation.kind==="primitive")s.push({id:w,primitiveType:x.componentRef,arguments:x.arguments,inputs:x.inputs.map(E=>({...E,nodeId:w})),outputs:x.outputs.map(E=>({...E,nodeId:w})),clocks:x.clocks.map(E=>({...E,nodeId:w})),dependents:[],inputSources:[]}),y.primitives.push(w);else if(S.implementation.kind==="composite"){if(b.has(x.componentRef))throw new Error(`Recursive circuit definition detected: '${x.componentRef}' references itself (cycle: ${[...b,x.componentRef].join(" → ")})`);const E={path:w,componentName:x.componentRef,children:[],primitives:[]};y.children.push(E);const D=new Set(b);D.add(x.componentRef),u(S,w+".",E,D)}else console.warn(`Intrinsic component ${x.componentRef} treated as primitive during elaboration`),s.push({id:w,primitiveType:x.componentRef,arguments:x.arguments,inputs:x.inputs.map(E=>({...E,nodeId:w})),outputs:x.outputs.map(E=>({...E,nodeId:w})),clocks:x.clocks.map(E=>({...E,nodeId:w})),dependents:[],inputSources:[]}),y.primitives.push(w)}for(const x of p.connections){const w=x.source.nodeId===""?m===""?Le:m.slice(0,-1):m+x.source.nodeId,S=x.target.nodeId===""?m===""?Le:m.slice(0,-1):m+x.target.nodeId;a.push({id:`${w}.${x.source.portName}->${S}.${x.target.portName}`,source:{nodeId:w,portName:x.source.portName},target:{nodeId:S,portName:x.target.portName},portType:x.portType})}}if(t.implementation.kind==="primitive"&&t.nodes.length===0){const p=t.name;s.push({id:p,primitiveType:t.name,arguments:{},inputs:t.inputs.map(m=>({id:`${p}.${m.name}`,name:m.name,portType:m.portType,nodeId:p})),outputs:t.outputs.map(m=>({id:`${p}.${m.name}`,name:m.name,portType:m.portType,nodeId:p})),clocks:t.clocks.map(m=>({id:`${p}.${m.name}`,name:m.name,nodeId:p})),dependents:[],inputSources:[]}),c.primitives.push(p);for(const m of t.inputs)a.push({id:`${Le}.${m.name}->${p}.${m.name}`,source:{nodeId:Le,portName:m.name},target:{nodeId:p,portName:m.name},portType:m.portType});for(const m of t.outputs)a.push({id:`${p}.${m.name}->${Le}.${m.name}`,source:{nodeId:p,portName:m.name},target:{nodeId:Le,portName:m.name},portType:m.portType})}else u(t,"",c,new Set([t.name]));const d=NU(t,a,s,e,"",n),h={nodes:s,connections:d,hierarchy:c,topLevelInputs:t.inputs,topLevelOutputs:t.outputs,nodeMap:new Map};return MU(h),h}function NU(t,e,n,i,s,a=!1){const c=new Map,u=new Set;function d(m,y,b=new Set){for(const x of m.nodes){const w=y+x.id,S=i.resolveCircuit(x.componentRef);if(S&&S.implementation.kind==="composite"){if(b.has(x.componentRef))continue;u.add(w),a&&console.log(`
77
+ === Tracing composite: ${w} (${x.componentRef}) ===`),AU(S,w,c,i,a);const E=new Set(b);E.add(x.componentRef),d(S,w+".",E)}}}if(d(t,s,new Set([t.name])),a){console.log(`
78
+ === Port Forwarding Map (${c.size} rules) ===`);for(const[m,y]of c.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 S=y&&b&&m.source.nodeId===m.target.nodeId,E=R=>R.nodeId===Le||n.some(A=>A.id===R.nodeId),D=R=>{const A=[],O=new Set,k=[R];for(;k.length>0;){const H=k.shift(),$=`${H.nodeId}.${H.portName}`;if(!O.has($)){if(O.add($),E(H)){A.push(H);continue}if(u.has(H.nodeId)&&c.has($)){const q=c.get($);for(const F of q)k.push(F)}else A.push(H)}}return A.length>0?A:[R]};let T=[m.source];if(y&&!S&&(T=D(m.source),a&&T.length>0))for(const R of T)console.log(` FORWARD SOURCE: ${m.source.nodeId}.${m.source.portName} -> ${R.nodeId}.${R.portName}`);let C=[m.target];if(b&&!S&&(C=D(m.target),a&&C.length>0))for(const R of C)console.log(` FORWARD TARGET: ${m.target.nodeId}.${m.target.portName} -> ${R.nodeId}.${R.portName}`);for(const R of T)for(const A of C)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(E=>E.target.nodeId===b.source.nodeId&&E.target.portName===b.source.portName&&!y.has(E.id)),S=h.filter(E=>E.source.nodeId===b.target.nodeId&&E.source.portName===b.target.portName&&!y.has(E.id));for(const E of w)for(const D of S){const T={id:`${E.source.nodeId}.${E.source.portName}->${D.target.nodeId}.${D.target.portName}`,source:E.source,target:D.target,portType:b.portType};m.push(T),y.add(E.id),y.add(D.id),a&&console.log(` DIRECT: ${T.source.nodeId}.${T.source.portName} -> ${T.target.nodeId}.${T.target.portName}`)}}else y.has(b.id)||m.push(b);return wC(m,n,u,a)}return wC(h,n,u,a)}function wC(t,e,n,i){const s=new Set(e.map(p=>p.id)),a=p=>p.nodeId===Le||s.has(p.nodeId),c=new Map;for(const p of t){const m=`${p.source.nodeId}.${p.source.portName}`;c.has(m)||c.set(m,[]),c.get(m).push(p)}const u=p=>{const m=[],y=new Set,b=[p];for(;b.length>0;){const x=b.pop(),w=`${x.nodeId}.${x.portName}`;if(!y.has(w)){if(y.add(w),a(x)){m.push(x);continue}for(const S of c.get(w)??[])b.push(S.target)}}return m},d=[],h=new Set;for(const p of t){if(!a(p.source))continue;const m=a(p.target)?[p.target]:u(p.target);for(const y of m){if(p.source.nodeId===y.nodeId&&p.source.portName===y.portName)continue;const x=`${p.source.nodeId}.${p.source.portName}->${y.nodeId}.${y.portName}`;h.has(x)||(h.add(x),i&&console.log(` RESOLVED: ${p.source.nodeId}.${p.source.portName} -> ${y.nodeId}.${y.portName}`),d.push({id:x,source:p.source,target:y,portType:p.portType}))}}return d}function AU(t,e,n,i,s=!1){for(const a of t.connections){if(a.source.nodeId===""&&a.target.nodeId!==""){const c=`${e}.${a.source.portName}`,u=Du(e,a.target,t,i);n.has(c)||n.set(c,[]);for(const d of u)n.get(c).push(d),s&&console.log(` INPUT: ${a.source.portName} -> ${d.nodeId}.${d.portName}`)}if(a.source.nodeId!==""&&a.target.nodeId===""){const c=`${e}.${a.target.portName}`,u=Du(e,a.source,t,i);n.has(c)||n.set(c,[]);for(const d of u)n.get(c).push(d),s&&console.log(` OUTPUT: ${a.target.portName} <- ${d.nodeId}.${d.portName}`)}if(a.source.nodeId===""&&a.target.nodeId===""){s&&console.log(` PASSTHROUGH: ${a.source.portName} -> ${a.target.portName}`);const c=`${e}.${a.source.portName}`;n.has(c)||n.set(c,[]),n.get(c).push({nodeId:e,portName:a.target.portName}),s&&console.log(` -> Added passthrough forwarding: ${c} -> ${e}.${a.target.portName}`)}}}function Du(t,e,n,i,s=new Set){if(e.nodeId==="")return[{nodeId:t,portName:e.portName}];const a=t+"."+e.nodeId,c=n.nodes.find(p=>p.id===e.nodeId);if(!c)return[{nodeId:a,portName:e.portName}];const u=i.resolveCircuit(c.componentRef);if(!u||u.implementation.kind!=="composite")return[{nodeId:a,portName:e.portName}];if(s.has(c.componentRef))return[{nodeId:a,portName:e.portName}];const d=new Set(s);d.add(c.componentRef);const h=[];for(const p of u.connections){if(p.target.nodeId===""&&p.target.portName===e.portName){const m=Du(a,p.source,u,i,d);h.push(...m)}if(p.source.nodeId===""&&p.source.portName===e.portName){const m=Du(a,p.target,u,i,d);h.push(...m)}}return h.length>0?h:[{nodeId:a,portName:e.portName}]}function MU(t){t.nodeMap=new Map(t.nodes.map(e=>[e.id,e]));for(const e of t.nodes)e.dependents=[],e.inputSources=[];for(const e of t.connections){const n=e.source.nodeId,i=e.target.nodeId;if(i===Le)continue;const s=t.nodeMap.get(n);s&&!s.dependents.includes(i)&&s.dependents.push(i);const a=t.nodeMap.get(i);a&&a.inputSources.push({portName:e.target.portName,sourceNodeId:n,sourcePortName:e.source.portName})}}function RU(t,e){return`${t}.${e}`}function SC(t,e,n){const i=new Map,s=new Map,a=new Map;for(const c of t.nodes){const u=e.resolveCircuit(c.primitiveType);if(u){if(u.implementation.kind==="primitive"&&u.state.length>0){const d=u.state.map(p=>kU(p,c.id,c.arguments,c.primitiveType,n)),h=u.state.length===1?d[0]:Object.fromEntries(u.state.map((p,m)=>[p.name,d[m]]));i.set(c.id,h),s.set(c.id,h)}for(const d of c.clocks)a.set(RU(c.id,d.name),{value:!1,edge:"none"})}}return{currentState:i,nextState:s,clocks:a,cycleCount:0}}function kU(t,e,n,i,s){const a=t.stateType.kind,c=n[t.name];if(a==="memory"){const d=new Map,h=t.initialValue;if(h?.data){if(h.data instanceof Map)for(const[p,m]of h.data)d.set(p,m);else if(typeof h.data=="object")for(const[p,m]of Object.entries(h.data)){const y=parseInt(p,10);!isNaN(y)&&typeof m=="number"&&d.set(y,m)}}if(c!==void 0){if(Array.isArray(c))c.forEach((p,m)=>{typeof p=="number"&&d.set(m,p)});else if(c instanceof Map)for(const[p,m]of c)d.set(p,m);else if(typeof c=="object"&&c!==null)for(const[p,m]of Object.entries(c)){const y=parseInt(p,10);!isNaN(y)&&typeof m=="number"&&d.set(y,m)}}if(s){const p=DU(e,s,i);if(p)for(const[m,y]of p.entries())d.set(m,y)}return d}if(c!==void 0&&(typeof c=="number"||typeof c=="boolean"))return c;const u=t.initialValue;return u}function OU(t){const n=t.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*");return new RegExp(n,"i")}function DU(t,e,n){for(const[i,s]of e){const a=OU(i);if(a.test(t)||n&&a.test(n))return s}}const fm={And:0,Or:1,Not:2,Nand:3,Nor:4,Xor:5,Xnor:6,Buffer:7,Switch:10,Led:11,Output:12,Button:13,Input:14,Constant:15,Splitter:20,Splitter8to8:21,Combiner8to8:22,Probe:23,BitSlice:24,AddressCombiner:25,Concat:26,BusAnd:40,BusOr:41,BusNot:42,BusXor:43,Incrementer:50,Adder:51,Multiplier:52,Comparator:53,LeftShifter:54,RightShifter:55,Subtractor:56,SignedAdder:57,SignedComparator:58,SignedMultiplier:59,Mux:70,Decoder:71,SevenSegment:80,HexDisplay:81,Screen:82,RasterDisplay:83,DFlipFlop:90,Register:91,ROM:100,RAM:101,DualPortRAM:102,Console:110},jU=Object.entries(fm).reduce((t,[e,n])=>(t[n]=e,t),[]);class zU{queue;pending;head=0;tail=0;capacity;constructor(e){this.capacity=e,this.queue=new Uint32Array(e),this.pending=new Uint8Array(e)}enqueue(e){this.pending[e]||(this.pending[e]=1,this.queue[this.tail%this.capacity]=e,this.tail++)}enqueueAll(e){for(let n=0;n<e.length;n++)this.enqueue(e[n])}dequeue(){const e=this.queue[this.head%this.capacity];return this.pending[e]=0,this.head++,e}isEmpty(){return this.head===this.tail}size(){return this.tail-this.head}toArray(){const e=[];for(let n=this.head;n<this.tail;n++)e.push(this.queue[n%this.capacity]);return e}clear(){this.head=0,this.tail=0,this.pending.fill(0)}}function EC(t){return{values:new Int32Array(t),changed:new Uint8Array(t),initialized:new Uint8Array(t)}}function CC(t,e){const n=t.circuit.inputSourcePort[t.portStart+e];return n>=0?t.values.values[n]:0}function TC(t,e,n){const i=t.portStart+t.inputCount+e;t.values.values[i]=n,t.values.initialized[i]=1}const VU=Math.max(...Object.values(fm))+1,ll=new Array(VU).fill(null);function _C(t){return new Proxy(t,{get(e,n){if(typeof n=="string"&&/^\d+$/.test(n))return e.get(Number(n))??0;const i=e[n];return typeof i=="function"?i.bind(e):i},set(e,n,i){return typeof n=="string"&&/^\d+$/.test(n)?(e.set(Number(n),i),!0):!1}})}let LU=200;const NC=new Map;function IU(t){const e=fm[t];if(e!==void 0)return e;const n=NC.get(t);if(n!==void 0)return n;const i=LU++;return NC.set(t,i),jU[i]=t,i}function BU(t,e,n,i){const s=t.length,a=e.length;return!i||i.length===0?function(u){const d={},h=u.circuit.flatCircuit.nodes[u.nodeIndex]?.arguments;if(h)for(const m in h)d[m]=h[m];for(let m=0;m<s;m++)d[t[m]]=CC(u,m);const p=n(d);for(let m=0;m<a;m++){const y=p[e[m]];y!==void 0&&TC(u,m,y)}}:function(u){const d={},h=u.circuit.flatCircuit.nodes[u.nodeIndex]?.arguments;if(h)for(const m in h)d[m]=h[m];for(let m=0;m<s;m++)d[t[m]]=CC(u,m);if(u.state){const m=u.state.currentState[u.nodeIndex];if(m!=null&&typeof m=="object"&&!Array.isArray(m)&&!(m instanceof Map)){const y=m;for(const b of i){const x=y[b];d[b]=x instanceof Map?_C(x):x}}else m!=null&&(d[i[0]]=m instanceof Map?_C(m):m)}const p=n(d);for(let m=0;m<a;m++){const y=p[e[m]];y!==void 0&&TC(u,m,y)}}}function PU(t){const e=IU(t);if(ll[e]!=null)return e;const n=nc(t);if(!n)return console.warn(`[eval-bridge] No eval-registry entry for '${t}' — getAllCircuitEvals:`,[...WN().keys()]),e;for(;ll.length<=e;)ll.push(null);return ll[e]=BU(n.inputNames,n.outputNames,n.evalFn,n.stateKeys),e}const dm=new Map;function HU(t){if(dm.has(t))return dm.get(t);const e=nc(t);if(!e?.onTickFn)return;const n={inputNames:e.inputNames,stateKeys:e.stateKeys??[],fn:e.onTickFn};return dm.set(t,n),n}function UU(t,e){const n=t.nodes.length,i=new Map,s=new Array(n);for(let $=0;$<n;$++){const q=t.nodes[$];i.set(q.id,$),s[$]=q.id}let a=0;const c=new Uint32Array(n),u=new Uint8Array(n),d=new Uint8Array(n);for(let $=0;$<n;$++){const q=t.nodes[$];c[$]=a,u[$]=q.inputs.length,d[$]=q.outputs.length,a+=q.inputs.length+q.outputs.length}const h=t.topLevelInputs.length,p=t.topLevelOutputs.length,m=a+h+p,y=new Map,b=new Array(m),x=new Uint8Array(m),w=new Uint8Array(m),S=new Array(m);let E=a;for(const $ of t.topLevelInputs){const q=`${Le}.${$.name}`;y.set(q,E),b[E]=q,x[E]=1,w[E]=$.portType.kind==="bus"?1:0,E++}for(const $ of t.topLevelOutputs){const q=`${Le}.${$.name}`;y.set(q,E),b[E]=q,x[E]=0,w[E]=$.portType.kind==="bus"?1:0,E++}for(let $=0;$<n;$++){const q=t.nodes[$];let F=c[$];for(const Q of q.inputs){const B=`${q.id}.${Q.name}`;y.set(B,F),b[F]=B,x[F]=0,w[F]=Q.portType.kind==="bus"?1:0,S[F]=Q.name,F++}for(const Q of q.outputs){const B=`${q.id}.${Q.name}`;y.set(B,F),b[F]=B,x[F]=1;let P=Q.portType.kind==="bus";if(!P){const j=q.arguments.width;if(typeof j=="number"&&j>1&&(P=!0),!P&&q.primitiveType==="Mux"){for(const I of q.inputs)if(I.name!=="sel"&&I.portType.kind==="bus"){P=!0;break}}}w[F]=P?1:0,F++}}const D=new Uint16Array(n);for(let $=0;$<n;$++){const q=t.nodes[$];D[$]=PU(q.primitiveType)}const T=new Array(n);for(let $=0;$<n;$++){const F=t.nodes[$].dependents.map(Q=>i.get(Q)).filter(Q=>Q!==void 0);T[$]=new Uint32Array(F)}const C=new Int32Array(a),R=new Int32Array(a);C.fill(-1),R.fill(-1);for(let $=0;$<n;$++){const q=t.nodes[$],F=c[$];for(let Q=0;Q<q.inputSources.length;Q++){const B=q.inputSources[Q],P=q.inputs.findIndex(I=>I.name===B.portName);if(P===-1)continue;const j=F+P;if(B.sourceNodeId===Le){C[j]=-1;const I=`${Le}.${B.sourcePortName}`;R[j]=y.get(I)??-1}else{const I=i.get(B.sourceNodeId);if(I===void 0)continue;const z=t.nodes[I],U=z.outputs.findIndex(Y=>Y.name===B.sourcePortName);if(U===-1)continue;C[j]=I,R[j]=c[I]+z.inputs.length+U}}}const A=new Uint8Array(n),O=new Uint8Array(n),k=new Uint8Array(n),H=new Uint8Array(n);for(let $=0;$<n;$++){const q=t.nodes[$];A[$]=q.inputs.length===0?1:0;const F=e.resolveCircuit(q.primitiveType);F?.state&&F.state.length>0&&(k[$]=1,O[$]=1);for(const Q of q.inputSources)if(Q.sourceNodeId===Le){H[$]=1;break}}return{nodeCount:n,portCount:m,nodeIdToIndex:i,indexToNodeId:s,portKeyToIndex:y,indexToPortKey:b,primitiveTypeIndex:D,nodePortStart:c,nodeInputCount:u,nodeOutputCount:d,dependents:T,inputSourceNode:C,inputSourcePort:R,inputPortNames:S,portIsOutput:x,portIsBus:w,isSourceNode:A,isStateOutputNode:O,hasState:k,readsTopLevelInput:H,flatCircuit:t}}function hm(t,e){const n=new Array(t.nodeCount),i=new Array(t.nodeCount);for(const[s,a]of e.currentState){const c=t.nodeIdToIndex.get(s);c!==void 0&&(n[c]=a)}for(const[s,a]of e.nextState){const c=t.nodeIdToIndex.get(s);c!==void 0&&(i[c]=a)}return{currentState:n,nextState:i,clocks:e.clocks,cycleCount:e.cycleCount}}function pm(t,e){const n=new Map,i=new Map;for(let s=0;s<t.nodeCount;s++){const a=t.indexToNodeId[s];e.currentState[s]!==void 0&&n.set(a,e.currentState[s]),e.nextState[s]!==void 0&&i.set(a,e.nextState[s])}return{currentState:n,nextState:i,clocks:e.clocks,cycleCount:e.cycleCount}}const AC=1e4,mm=new WeakMap;function $U(t){const e=new Map(t),n=new Proxy(e,{get(i,s){if(typeof s=="string"&&/^\d+$/.test(s))return i.get(Number(s))??0;const a=i[s];return typeof a=="function"?a.bind(i):a},set(i,s,a){return typeof s=="string"&&/^\d+$/.test(s)?(i.set(Number(s),a),!0):!1}});return mm.set(n,e),n}const qU=new Int32Array(64),YU=new Uint8Array(64);function cl(t,e,n,i,s){let a=0;if(s)for(const[u,d]of s){const h=t.portKeyToIndex.get(u);h!==void 0&&(n.values[h]=typeof d=="boolean"?d?1:0:d,n.initialized[h]=1)}const c={circuit:t,values:n,state:i,queue:e,nodeIndex:0,portStart:0,inputCount:0,outputCount:0};for(;!e.isEmpty();){if(++a>AC)throw new Error(`Propagation did not stabilize after ${AC} iterations. Possible unstable feedback loop in circuit.`);const u=e.dequeue(),d=t.nodePortStart[u],h=t.nodeInputCount[u],p=t.nodeOutputCount[u],m=d+h;c.nodeIndex=u,c.portStart=d,c.inputCount=h,c.outputCount=p;const y=p<=64?qU:new Int32Array(p),b=p<=64?YU:new Uint8Array(p);for(let E=0;E<p;E++)y[E]=n.values[m+E],b[E]=n.initialized[m+E];const x=t.primitiveTypeIndex[u],w=ll[x];w?w(c):GU(t,u);let S=!1;for(let E=0;E<p;E++){const D=m+E;if(n.values[D]!==y[E]||n.initialized[D]&&!b[E]){S=!0;break}}S&&e.enqueueAll(t.dependents[u])}return a}function GU(t,e,n,i,s){const a=t.flatCircuit.nodes[e];throw new Error(`Primitive '${a.primitiveType}' has no registered evaluator. Either import '@simten/core/std' to register the standard library, or register the primitive's eval lambda explicitly via registerEvalFunction(). If you constructed a Circuit IR by hand (rather than via circuit()), you must register its evaluator yourself.`)}function ju(t,e){for(let n=0;n<t.nodeCount;n++)(t.isSourceNode[n]||t.isStateOutputNode[n]||t.readsTopLevelInput[n])&&(e.enqueue(n),t.isSourceNode[n],t.isStateOutputNode[n],t.readsTopLevelInput[n])}function XU(t,e){for(let n=0;n<t.nodeCount;n++)t.isStateOutputNode[n]&&e.enqueue(n)}function FU(t,e){for(const[n,i]of e.clocks)i.edge="rising",i.value=!0}function ZU(t,e,n,i){for(let s=0;s<t.nodeCount;s++){if(!t.hasState[s])continue;const a=t.flatCircuit.nodes[s],c=HU(a.primitiveType);if(!c)continue;const u=new Map,d=t.nodePortStart[s],h=t.nodeInputCount[s];for(let w=0;w<h;w++){const S=d+w,E=t.inputSourceNode[S],D=t.inputSourcePort[S],T=t.inputPortNames[S];if(E===-1){if(i&&D>=0){const C=t.indexToPortKey[D],R=i.get(C);R!==void 0&&u.set(T,R)}}else if(D>=0){const C=e.values[D];u.set(T,C)}}if(a.arguments)for(const[w,S]of Object.entries(a.arguments))u.set(`__${w}`,S);const p={};for(const w of a.clocks){const S=`${a.id}.${w.name}`,E=n.clocks.get(S);E&&(p[w.name]=E.edge)}const m=n.currentState[s],y={};for(const[w,S]of u)y[w]=S;if(m!=null&&typeof m=="object"&&!(m instanceof Map))for(const w of c.stateKeys)y[w]=m[w];else m!=null&&c.stateKeys.length===1&&(m instanceof Map?y[c.stateKeys[0]]=$U(m):y[c.stateKeys[0]]=m);const b=c.fn(y);let x=c.stateKeys.length===1?b[c.stateKeys[0]]:b;x!=null&&typeof x=="object"&&mm.has(x)&&(x=mm.get(x)),n.nextState[s]=x}}function KU(t){for(let e=0;e<t.currentState.length;e++){const n=t.nextState[e];n!==void 0&&(n instanceof Map?(t.currentState[e]=new Map(n),t.nextState[e]=new Map(n)):(t.currentState[e]=n,t.nextState[e]=n))}t.cycleCount++}function ul(t,e,n){const i=new Map;if(n)for(const[s,a]of n)i.set(s,a);for(let s=0;s<t.portCount;s++){const a=t.indexToPortKey[s],c=t.portIsOutput[s]===1,u=t.portIsBus[s]===0;let d,h;if(c)d=e.values[s],h=e.initialized[s]!==0;else{const m=t.inputSourcePort[s];m>=0?(d=e.values[m],h=e.initialized[m]!==0):(d=0,h=!1)}h||(d=0);const p=d>1||d<0;i.set(a,u&&!p?d!==0:d)}return i}function QU(t,e,n){for(const[i,s]of n){const a=t.portKeyToIndex.get(i);a!==void 0&&(e.values[a]=typeof s=="boolean"?s?1:0:s,e.initialized[a]=1)}}function zu(t,e,n){for(const i of t.flatCircuit.connections)if(i.target.nodeId===Le||i.target.nodeId===""){const s=`${i.source.nodeId}.${i.source.portName}`,a=t.portKeyToIndex.get(s);if(a!==void 0){const c=`${i.target.nodeId||Le}.${i.target.portName}`,u=t.portIsBus[a]===0,d=e.values[a];n.set(c,u?d!==0:d)}}}class WU{flatCircuit=null;options=null;numericCircuit=null;numericSeqState=null;numericValues=null;eventQueue=null;topLevelInputs=new Map;cachedFlatSeqState=null;cachedPortValues=null;cacheValid=!1;totalTicks=0;totalEvaluations=0;initialize(e,n){this.flatCircuit=e,this.options=n,this.numericCircuit=UU(e,n.componentLibrary);const i=SC(e,n.componentLibrary);this.numericSeqState=hm(this.numericCircuit,i),this.numericValues=EC(this.numericCircuit.portCount),this.eventQueue=new zU(this.numericCircuit.nodeCount),this.topLevelInputs=new Map;for(const s of e.topLevelInputs){const a=`${Le}.${s.name}`,c=s.portType.kind==="bit"?!1:0;this.topLevelInputs.set(a,c)}this.eventQueue.clear(),ju(this.numericCircuit,this.eventQueue),cl(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState,this.topLevelInputs),this.totalTicks=0,this.totalEvaluations=0,this.cacheValid=!1}setNode(e,n){if(!this.flatCircuit||!this.numericCircuit)return;const i=`${Le}.${e}`;if(this.topLevelInputs.has(i)){this.topLevelInputs.set(i,n),this.cacheValid=!1;return}const s=this.flatCircuit.nodes.find(c=>c.id===e)??this.flatCircuit.nodes.find(c=>c.id.endsWith("."+e));if(!s)return;const a=this.numericCircuit.nodeIdToIndex.get(s.id);if(a!==void 0&&this.numericSeqState&&this.numericSeqState.currentState[a]!==void 0){this.numericSeqState.currentState[a]=n,this.cacheValid=!1,this.cachedFlatSeqState=null,n instanceof Map&&this.options&&(this.options.initialMemory||(this.options.initialMemory=new Map),this.options.initialMemory.set(s.id,n));return}(typeof n=="boolean"||typeof n=="number"||typeof n=="string")&&(s.arguments={...s.arguments,value:n},this.cacheValid=!1)}tick(){if(!this.numericCircuit||!this.numericSeqState||!this.numericValues||!this.eventQueue)throw new Error("Simulator not initialized");this.eventQueue.clear(),ju(this.numericCircuit,this.eventQueue);const e=cl(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState,this.topLevelInputs);FU(this.numericCircuit,this.numericSeqState),ZU(this.numericCircuit,this.numericValues,this.numericSeqState,this.topLevelInputs),KU(this.numericSeqState),this.eventQueue.clear(),XU(this.numericCircuit,this.eventQueue);const n=cl(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState,this.topLevelInputs),i=ul(this.numericCircuit,this.numericValues,this.topLevelInputs);zu(this.numericCircuit,this.numericValues,i),this.cachedPortValues=i,this.cachedFlatSeqState=null,this.cacheValid=!0;const s=e+n;this.totalTicks++,this.totalEvaluations+=s;const a=pm(this.numericCircuit,this.numericSeqState);return{portValues:i,sequentialState:a,metrics:{phase1Evals:e,phase2Evals:n,totalEvals:s}}}runCombinational(){if(!this.numericCircuit||!this.numericValues||!this.eventQueue)throw new Error("Simulator not initialized");if(this.cacheValid&&this.cachedPortValues)return{portValues:this.cachedPortValues,metrics:{totalEvals:0}};this.eventQueue.clear(),ju(this.numericCircuit,this.eventQueue);try{cl(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState??void 0,this.topLevelInputs)}catch(n){return{portValues:ul(this.numericCircuit,this.numericValues,this.topLevelInputs),metrics:{totalEvals:0},error:n instanceof Error?n.message:"Unknown error"}}const e=ul(this.numericCircuit,this.numericValues,this.topLevelInputs);return zu(this.numericCircuit,this.numericValues,e),this.cachedPortValues=e,this.cacheValid=!0,{portValues:e,metrics:{totalEvals:0}}}getOutput(e,n){if(!this.numericCircuit||!this.numericValues)return;const i=this.getPortValues(),s=`${e}.${n}`;return i.get(s)}getPortValues(){return!this.numericCircuit||!this.numericValues?new Map:(this.cacheValid||(this.cachedPortValues=ul(this.numericCircuit,this.numericValues,this.topLevelInputs),zu(this.numericCircuit,this.numericValues,this.cachedPortValues),this.cacheValid=!0),this.cachedPortValues)}getState(){return!this.numericCircuit||!this.numericSeqState?null:((!this.cacheValid||!this.cachedFlatSeqState)&&(this.cachedFlatSeqState=pm(this.numericCircuit,this.numericSeqState)),this.cachedFlatSeqState)}snapshot(){if(!this.numericSeqState||!this.numericCircuit||!this.numericValues)throw new Error("No sequential state to snapshot");const e=ul(this.numericCircuit,this.numericValues,this.topLevelInputs);zu(this.numericCircuit,this.numericValues,e);const n=pm(this.numericCircuit,this.numericSeqState);return{portValues:e,sequentialState:n,cycleCount:this.numericSeqState.cycleCount}}restore(e){!this.numericCircuit||!this.numericValues||(this.numericSeqState=hm(this.numericCircuit,e.sequentialState),QU(this.numericCircuit,this.numericValues,e.portValues),this.cacheValid=!1)}reset(){if(!this.flatCircuit||!this.options||!this.numericCircuit)return;const e=SC(this.flatCircuit,this.options.componentLibrary,this.options.initialMemory);this.numericSeqState=hm(this.numericCircuit,e),this.numericValues=EC(this.numericCircuit.portCount),this.eventQueue.clear(),ju(this.numericCircuit,this.eventQueue),cl(this.numericCircuit,this.eventQueue,this.numericValues,this.numericSeqState,this.topLevelInputs),this.totalTicks=0,this.totalEvaluations=0,this.cacheValid=!1}getMetrics(){return{totalTicks:this.totalTicks,totalEvaluations:this.totalEvaluations,avgEvalsPerTick:this.totalTicks>0?this.totalEvaluations/this.totalTicks:0,nodeCount:this.flatCircuit?.nodes.length??0}}}function JU(t,e){const n=new WU;return n.initialize(t,e),n}function t9(t,e){const n=_U(t,e);return JU(n,{componentLibrary:e})}const e9=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n9=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,n,i)=>i?i.toUpperCase():n.toLowerCase()),MC=t=>{const e=n9(t);return e.charAt(0).toUpperCase()+e.slice(1)},RC=(...t)=>t.filter((e,n,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===n).join(" ").trim(),o9=t=>{for(const e in t)if(e.startsWith("aria-")||e==="role"||e==="title")return!0};var i9={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const r9=N.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:i,className:s="",children:a,iconNode:c,...u},d)=>N.createElement("svg",{ref:d,...i9,width:e,height:e,stroke:t,strokeWidth:i?Number(n)*24/Number(e):n,className:RC("lucide",s),...!a&&!o9(u)&&{"aria-hidden":"true"},...u},[...c.map(([h,p])=>N.createElement(h,p)),...Array.isArray(a)?a:[a]]));const Ti=(t,e)=>{const n=N.forwardRef(({className:i,...s},a)=>N.createElement(r9,{ref:a,iconNode:e,className:RC(`lucide-${e9(MC(t))}`,`lucide-${t}`,i),...s}));return n.displayName=MC(t),n};const s9=Ti("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);const a9=Ti("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);const l9=Ti("gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);const c9=Ti("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);const u9=Ti("pause",[["rect",{x:"14",y:"3",width:"5",height:"18",rx:"1",key:"kaeet6"}],["rect",{x:"5",y:"3",width:"5",height:"18",rx:"1",key:"1wsw3u"}]]);const f9=Ti("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);const d9=Ti("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);const h9=Ti("skip-forward",[["path",{d:"M21 4v16",key:"7j8fe9"}],["path",{d:"M6.029 4.285A2 2 0 0 0 3 6v12a2 2 0 0 0 3.029 1.715l9.997-5.998a2 2 0 0 0 .003-3.432z",key:"zs4d6"}]]),kC=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,OC=ex,p9=((t,e)=>n=>{var i;if(e?.variants==null)return OC(t,n?.class,n?.className);const{variants:s,defaultVariants:a}=e,c=Object.keys(s).map(h=>{const p=n?.[h],m=a?.[h];if(p===null)return null;const y=kC(p)||kC(m);return s[h][y]}),u=n&&Object.entries(n).reduce((h,p)=>{let[m,y]=p;return y===void 0||(h[m]=y),h},{}),d=e==null||(i=e.compoundVariants)===null||i===void 0?void 0:i.reduce((h,p)=>{let{class:m,className:y,...b}=p;return Object.entries(b).every(x=>{let[w,S]=x;return Array.isArray(S)?S.includes({...a,...u}[w]):{...a,...u}[w]===S})?[...h,m,y]:h},[]);return OC(t,c,d,n?.class,n?.className)})("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2",sm:"h-8 rounded-md px-3 text-xs",lg:"h-10 rounded-md px-8",icon:"h-9 w-9"}},defaultVariants:{variant:"default",size:"default"}}),DC=N.forwardRef(({className:t,variant:e,size:n,...i},s)=>M.jsx("button",{className:Gn(p9({variant:e,size:n,className:t})),ref:s,...i}));DC.displayName="Button";function Os({label:t,icon:e,onClick:n,disabled:i}){return M.jsxs(Sw,{children:[M.jsx(Ew,{asChild:!0,children:M.jsx(DC,{variant:"ghost",size:"icon",onClick:n,disabled:i,"aria-label":t,className:"h-7 w-7 text-muted-foreground disabled:opacity-40 [&_svg]:size-3.5",children:M.jsx(e,{})})}),M.jsx(Cw,{side:"bottom",children:t})]})}function jC({cycle:t,historyLength:e,historyIndex:n,isRunning:i,isViewingPast:s,onStep:a,onRun:c,onPause:u,onReset:d,onStepBack:h,onStepForward:p,onSeek:m,onSpeedChange:y,speed:b=1,maxSpeed:x=100,showScrubber:w,floating:S,chromeless:E}){const D=S?"absolute top-3 left-1/2 -translate-x-1/2 z-10":"",T=E?"flex items-center gap-1.5":"flex items-center gap-1.5 border-t border-border bg-card/95 px-3 py-1.5";return M.jsx(ww,{children:M.jsx("div",{className:D,children:M.jsxs("div",{className:T,children:[M.jsx(Os,{label:"Tick",icon:h9,onClick:a,disabled:i||s}),i?M.jsx(Os,{label:"Pause",icon:u9,onClick:u}):M.jsx(Os,{label:"Run",icon:f9,onClick:c,disabled:s}),M.jsx(Os,{label:"Reset",icon:d9,onClick:d}),y&&M.jsxs("div",{className:"flex items-center gap-2 border-l border-border pl-2 ml-0.5",children:[M.jsx(l9,{className:"h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":!0}),M.jsx("input",{type:"range",min:"1",max:x,value:b,onChange:C=>y(Number(C.target.value)),className:"w-20 h-1 rounded-lg appearance-none cursor-pointer accent-blue-600",disabled:s,"aria-label":"Simulation speed"}),M.jsxs("span",{className:"min-w-[55px] text-[10px] text-muted-foreground font-mono tabular-nums",children:[b," tick/s"]})]}),M.jsx("div",{className:"border-l border-border pl-1.5 ml-0.5",children:M.jsxs("span",{className:"text-[11px] text-muted-foreground",children:["Cycle ",M.jsx("span",{className:"font-mono font-semibold text-foreground",children:t})]})}),e>1&&M.jsxs("div",{className:"flex items-center gap-0.5 border-l border-border pl-1.5 ml-0.5",children:[M.jsx(Os,{label:"Step back",icon:s9,onClick:h,disabled:n<=0||i}),M.jsx("span",{className:"min-w-[40px] text-center text-[11px] text-muted-foreground",children:s?M.jsxs("span",{className:"font-mono text-amber-600 dark:text-amber-400",children:[n+1,"/",e]}):M.jsxs("span",{className:"font-mono",children:[e,"/",e]})}),M.jsx(Os,{label:"Step forward",icon:a9,onClick:p,disabled:!s||i})]}),w&&m&&e>1&&M.jsxs("div",{className:"flex items-center gap-2 border-l border-border pl-2 ml-0.5",children:[M.jsx(c9,{className:"h-3.5 w-3.5 text-muted-foreground/70","aria-hidden":!0}),M.jsx("input",{type:"range",min:"0",max:e-1,value:n,onChange:C=>m(Number(C.target.value)),className:"w-24 h-1 rounded-lg appearance-none cursor-pointer accent-blue-600",disabled:i,"aria-label":"Cycle scrubber"})]})]})})})}function m9({frame:t,componentLibrary:e,onPushLevel:n,theme:i="dark"}){const s=N.useMemo(()=>TU(t.componentDef),[t.componentDef]),a=N.useMemo(()=>vd(s,e.resolveCircuit),[s,e]),c=N.useCallback(P=>{if(!P.isComposite)return;const j=e.resolveCircuit(P.componentRef);j&&j.implementation.kind==="composite"&&j.nodes.length>0&&n(P.componentRef,j,P.label??P.componentRef)},[e,n]),u=sd(),[d,h]=N.useState(new Map),[p,m]=N.useState(!1),y=N.useRef(null),[b,x]=N.useState(0),[w,S]=N.useState(!1),E=N.useRef([]),[D,T]=N.useState(0),[C,R]=N.useState(-1),A=N.useRef("");A.current||(A.current=`drill-${typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():Math.random().toString(36).slice(2)}`);const O=A.current;N.useEffect(()=>()=>{p&&u.dispose(O).catch(()=>{})},[u,O,p]),N.useEffect(()=>{const P=[],j=new Set;for(const z of e.getAllPrimitiveNames()){const U=e.resolveCircuit(z);U&&!j.has(z)&&(j.add(z),P.push(U))}const I=z=>{for(const U of z.nodes){if(j.has(U.componentRef))continue;const Y=e.resolveCircuit(U.componentRef);Y&&(j.add(U.componentRef),P.push(Y),Y.implementation.kind==="composite"&&I(Y))}};I(s),u.compileIR(s,P,O,{snapshot:a}).then(z=>{if("error"in z){try{const Y=t9(s,e);Y.runCombinational(),y.current=Y,m(!1);const L=new Map;for(const[G,tt]of Y.getPortValues())L.set(G,tt);h(L)}catch(Y){console.warn("[InspectorCanvas] Both sandbox and local failed:",Y)}return}m(!0);const U=new Map;for(const[Y,L]of Object.entries(z.portValues))U.set(Y,L);h(U),E.current=z.snapshotId!==void 0?[{snapshotId:z.snapshotId,cycle:0}]:[],T(E.current.length),R(E.current.length===0?-1:0),x(0)})},[s,e,u,O,a]);const k=N.useCallback(P=>{const j=`${P}.out`,I=d.get(j);u.setNode(P,!I,O).then(z=>{if("error"in z)return;const U=new Map;for(const[Y,L]of Object.entries(z.portValues))U.set(Y,L);h(U)})},[u,d]),H=N.useCallback((P,j)=>{u.setNode(P,j,O).then(I=>{if("error"in I)return;const z=new Map;for(const[U,Y]of Object.entries(I.portValues))z.set(U,Y);h(z)})},[u]),$=N.useCallback(()=>{u.tick(void 0,O,{snapshot:a}).then(P=>{if("error"in P)return;const j=new Map;for(const[I,z]of Object.entries(P.portValues))j.set(I,z);if(h(j),x(P.cycle),P.snapshotId!==void 0){const I=E.current.slice(0,C+1);I.push({snapshotId:P.snapshotId,cycle:P.cycle}),E.current=I,T(I.length),R(I.length-1)}})},[u,O,a,C]),q=N.useCallback(()=>{S(!1),u.reset(O).then(P=>{if("error"in P)return;const j=new Map;for(const[I,z]of Object.entries(P.portValues))j.set(I,z);h(j),x(0),E.current=[],T(0),R(-1),a&&u.snapshot(O).then(I=>{"error"in I||I.snapshotId===void 0||(E.current=[{snapshotId:I.snapshotId,cycle:0}],T(1),R(0))})})},[u,O,a]),F=N.useCallback(P=>{const j=E.current[P];j&&u.restore(j.snapshotId,O).then(I=>{if("error"in I)return;const z=new Map;for(const[U,Y]of Object.entries(I.portValues))z.set(U,Y);h(z),x(j.cycle),R(P)})},[u,O]),Q=N.useCallback(()=>{S(!1),C>0&&F(C-1)},[C,F]),B=N.useCallback(()=>{C<D-1?F(C+1):$()},[C,D,F,$]);return N.useEffect(()=>{if(!w)return;const P=window.setInterval(()=>{$()},200);return()=>window.clearInterval(P)},[w,$]),M.jsxs("div",{className:"relative h-full w-full",children:[a&&M.jsx(jC,{floating:!0,cycle:b,historyLength:D,historyIndex:C,isRunning:w,isViewingPast:C>=0&&C<D-1,onStep:$,onRun:()=>S(!0),onPause:()=>S(!1),onReset:q,onStepBack:Q,onStepForward:B}),M.jsx(zC,{circuit:s,componentLibrary:e,portValues:d,sequentialState:null,onToggleNode:k,onSetNodeValue:H,onNodeDoubleClick:c,nodeTypes:_w,edgeTypes:Nw,theme:i,showControls:!0,height:"100%",panOnMobile:!0})]})}function g9({stack:t,onNavigate:e,theme:n="dark"}){const s=t[t.length-1]?.componentDef.metadata?.description,a=n==="dark";return M.jsxs("div",{className:"flex items-center gap-1 text-sm min-w-0",children:[t.map((c,u)=>M.jsxs(dr.Fragment,{children:[u>0&&M.jsx("span",{className:`${a?"text-gray-500":"text-gray-400"} shrink-0`,children:">"}),u<t.length-1?M.jsxs("button",{onClick:()=>e(u),className:`${a?"text-blue-400 hover:text-blue-300":"text-blue-600 hover:text-blue-800"} hover:underline font-medium shrink-0`,children:[c.nodeLabel," (",c.componentName,")"]}):M.jsxs("span",{className:`font-semibold shrink-0 ${a?"text-gray-100":"text-gray-900"}`,children:[c.nodeLabel," (",c.componentName,")"]})]},u)),s&&M.jsxs(M.Fragment,{children:[M.jsx("span",{className:`${a?"text-gray-600":"text-gray-300"} shrink-0`,children:"—"}),M.jsx("span",{className:`${a?"text-gray-400":"text-gray-500"} text-xs italic truncate`,children:s})]})]})}const y9={enterIn:{opacity:0},enterOut:{opacity:0},center:{opacity:1},exitIn:{opacity:0},exitOut:{opacity:0}};function v9({stack:t,componentLibrary:e,theme:n="dark",onClose:i,onPopLevel:s,onPushLevel:a,onNavigate:c}){const u=t.length>0,d=N.useRef(0),[h,p]=N.useState("in");N.useEffect(()=>{t.length>d.current?p("in"):t.length<d.current&&p("out"),d.current=t.length},[t.length]),N.useEffect(()=>{if(!u)return;const x=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=x}},[u]);const m=N.useCallback(x=>{x.target===x.currentTarget&&i()},[i]),y=N.useCallback(x=>{x.key==="Escape"&&(x.stopPropagation(),t.length>1?s():i())},[t.length,s,i]),b=u?t[t.length-1]:null;return M.jsx(XE,{children:u&&b&&M.jsxs(M.Fragment,{children:[M.jsx(Ou.div,{className:"fixed inset-0 z-50 bg-black/50",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.25},onClick:m,onKeyDown:y,tabIndex:-1},"inspector-backdrop"),M.jsx(Ou.div,{className:"fixed inset-0 z-50 flex items-center justify-center p-8 pointer-events-none",children:M.jsxs(Ou.div,{className:`flex h-[80vh] w-full max-w-5xl flex-col rounded-lg shadow-xl pointer-events-auto overflow-hidden ${n==="dark"?"bg-gray-900":"bg-white"}`,initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:{duration:.15},children:[M.jsxs("div",{className:`flex items-center justify-between border-b px-4 py-3 ${n==="dark"?"border-gray-700":"border-gray-200"}`,children:[M.jsx(g9,{stack:t,onNavigate:c,theme:n}),M.jsx("button",{onClick:i,className:`rounded p-1 ${n==="dark"?"text-gray-400 hover:bg-gray-800 hover:text-gray-300":"text-gray-400 hover:bg-gray-100 hover:text-gray-600"}`,"aria-label":"Close inspector",children:M.jsx("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:M.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]}),M.jsx("div",{className:"relative flex-1 overflow-hidden",children:M.jsx(XE,{mode:"wait",initial:!1,children:M.jsx(Ou.div,{className:"absolute inset-0",initial:h==="in"?"enterIn":"enterOut",animate:"center",exit:h==="in"?"exitIn":"exitOut",variants:y9,transition:{duration:.2,ease:"easeInOut"},children:M.jsx(m9,{frame:b,componentLibrary:e,onPushLevel:a,theme:n})},`${t.length}-${b.componentName}`)})})]})},"inspector-dialog")]})})}function b9(){const{fitView:t,zoomIn:e,zoomOut:n}=Ia(),i="bg-[var(--embed-bg-tertiary)] hover:opacity-80 text-[var(--embed-text-secondary)] p-1.5 rounded border border-[var(--embed-border)] transition-colors";return M.jsxs("div",{className:"flex items-center gap-1",children:[M.jsx("button",{onClick:()=>n(),className:i,title:"Zoom out","aria-label":"Zoom out",children:M.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:1.5,children:M.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 12h14"})})}),M.jsx("button",{onClick:()=>e(),className:i,title:"Zoom in","aria-label":"Zoom in",children:M.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:1.5,children:M.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 5v14M5 12h14"})})}),M.jsx("button",{onClick:()=>t({padding:.3}),className:i,title:"Fit view","aria-label":"Fit view",children:M.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",strokeWidth:1.5,children:M.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3.75v4.5m0-4.5h4.5m-4.5 0L9 9M3.75 20.25v-4.5m0 4.5h4.5m-4.5 0L9 15M20.25 3.75h-4.5m4.5 0v4.5m0-4.5L15 9m5.25 11.25h-4.5m4.5 0v-4.5m0 4.5L15 15"})})})]})}let gm=null;function x9(){if(!gm){const t=new Map;gm={resolveCircuit:e=>t.get(e),getAllPrimitiveNames:()=>[...t.entries()].filter(([,e])=>e.implementation.kind==="primitive").map(([e])=>e),addCircuit:e=>{t.set(e.name,e)}}}return gm}function w9({circuit:t,componentLibrary:e,portValues:n,sequentialState:i,draggable:s=!0,layout:a,onToggleNode:c,onSetNodeValue:u,onLoadMemory:d,onNodeDoubleClick:h,height:p="100%",focus:m,className:y,renderEmptyState:b,renderOverlay:x,nodeTypes:w,edgeTypes:S,showControls:E=!0,showPortLabels:D,onPortClick:T,glowUnconnected:C,theme:R,panOnMobile:A=!1,onRequestRemount:O}){const k=m1(),H=R??k,$=z6(),q=w??_w,F=S??Nw,Q=e??x9(),B=N.useMemo(()=>m?new Set(Array.isArray(m)?m:[m]):null,[m]),P=N.useMemo(()=>t?Nj(t):null,[t]),{metadata:j}=j6(a?null:P),I=N.useMemo(()=>{if(!P)return{components:{},connections:{}};if(!a)return j;const mt={};for(const Et of P.nodes){const Vt=Et.label||Et.id,jt=a[Vt]??a[Et.id];jt&&(mt[Et.id]={id:Et.id,position:jt})}return{components:mt,connections:{}}},[P,j,a]),{projectedNodes:z,projectedEdges:U}=N.useMemo(()=>{if(!P)return{projectedNodes:[],projectedEdges:[]};const mt=rL(P,I,Q,n??void 0,i??void 0),Et=mt.nodes.map(Vt=>{const jt=Vt.data,zt=jt?.componentRef,ue={...Vt.data};if(D&&(ue.showPortLabels=!0),C&&(ue.glowUnconnected=!0),T){const Xt=jt.label||jt.componentRef;ue.onPortClick=(xe,Pe)=>T(Xt,xe,Pe)}return zt==="Input"&&u&&(ue.onValueChange=Xt=>u(Vt.id,Xt)),c&&(zt==="Switch"||zt==="Button")&&(ue.onToggle=()=>c(Vt.id)),d&&(zt==="RV32I_InstrMem"||zt==="DualPortROM")&&(ue.onLoadMemory=Xt=>d(Vt.id,Xt)),{...Vt,data:ue}});if(B){const Vt=new Set;for(const jt of Et){const zt=jt.data?.label??jt.id;B.has(zt)&&Vt.add(jt.id)}return{projectedNodes:Et.map(jt=>{const zt=jt.data?.label??jt.id;return{...jt,style:{...jt.style,opacity:B.has(zt)?1:.15,transition:"opacity 0.2s"}}}),projectedEdges:mt.edges.map(jt=>({...jt,style:{...jt.style,opacity:Vt.has(jt.source)||Vt.has(jt.target)?1:.15,transition:"opacity 0.2s"}}))}}return{projectedNodes:Et,projectedEdges:mt.edges}},[P,I,Q,n,i,c,u,d,B,D,T,C]),[Y,L]=N.useState([]),[G,tt]=N.useState([]),{fitView:it}=Ia(),lt=tj(),ht=N.useRef(null),ft=N.useRef(new Set),ut=N.useRef(new Map),dt=N.useRef(0);N.useLayoutEffect(()=>{const mt=ht.current,Et=ft.current,Vt=ut.current,jt=P?.name??null,zt=new Set(z.map(pe=>pe.id)),ue=new Map;for(const pe of z){const re=pe.data,ee=`${(re.inputNames??[]).join("|")}>${(re.outputNames??[]).join("|")}`;ue.set(pe.id,ee)}ht.current=jt,ft.current=zt,ut.current=ue;const Xt=jt!==mt;let xe=0;for(const pe of zt)Et.has(pe)&&xe++;const Pe=Math.max(Et.size,zt.size),Po=Pe>0&&xe/Pe<.5,Ae=Xt||Po,So=[];if(!Ae)for(const[pe,re]of ue){const ee=Vt.get(pe);ee!==void 0&&ee!==re&&So.push(pe)}const _i=dt.current===0;dt.current=z.length,L(pe=>{const re=new Map(pe.map(ee=>[ee.id,ee]));return z.map(ee=>{const Ee=re.get(ee.id);return Ee&&!Ae?{...Ee,type:ee.type,data:ee.data,selectable:ee.selectable,deletable:ee.deletable}:ee})}),tt(U),Ae&&Et.size>0?O?.():So.length>0&&requestAnimationFrame(()=>lt(So)),z.length>0&&_i&&!Ae&&requestAnimationFrame(()=>it({padding:.3}))},[z,U]);const Mt=N.useCallback(mt=>{L(Et=>ub(mt,Et))},[]),[Nt,bt]=N.useState([]),Tt=N.useCallback((mt,Et,Vt)=>{bt(jt=>[...jt,{componentName:mt,componentDef:Et,nodeLabel:Vt}])},[]),Dt=N.useCallback(()=>{bt(mt=>mt.slice(0,-1))},[]),qt=N.useCallback(()=>{bt([])},[]),Ht=N.useCallback(mt=>{bt(Et=>Et.slice(0,mt+1))},[]),pt=N.useCallback(mt=>{if(!mt.isComposite)return;const Et=Q.resolveCircuit(mt.componentRef);Et&&Et.implementation.kind==="composite"&&Et.nodes.length>0&&bt([{componentName:mt.componentRef,componentDef:Et,nodeLabel:mt.label??mt.componentRef}])},[Q]),gt=h??pt,yt=N.useCallback((mt,Et)=>{gt(Et.data)},[gt]);return M.jsxs("div",{"data-embed-theme":H,className:`bg-[var(--embed-bg-primary)] overflow-hidden relative ${y??""}`,style:{height:p},"aria-label":"Circuit diagram",children:[M.jsxs(J5,{nodes:Y,edges:G,nodeTypes:q,edgeTypes:F,onNodesChange:Mt,onNodeDoubleClick:yt,fitView:!0,minZoom:.1,maxZoom:3,fitViewOptions:{padding:.3,...B&&{nodes:Y.filter(mt=>{const Et=mt.data?.label??mt.id;return B.has(Et)})}},nodesDraggable:s&&!$,nodesConnectable:!1,elementsSelectable:!0,selectionOnDrag:!1,panOnDrag:$&&!A?!1:[1,2],zoomOnScroll:!0,zoomOnPinch:!0,zoomOnDoubleClick:!1,preventScrolling:!1,proOptions:{hideAttribution:!0},deleteKeyCode:null,panActivationKeyCode:null,children:[M.jsx(rj,{variant:jo.Dots,gap:20,size:1,color:"var(--embed-dot-color)"}),E&&M.jsx(Va,{position:"bottom-left",children:M.jsx(b9,{})})]}),x?.(),!t&&(b?b():M.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-[var(--embed-text-muted)]",children:"No circuit"})),!h&&Nt.length>0&&M.jsx(v9,{stack:Nt,componentLibrary:Q,theme:H,onClose:qt,onPopLevel:Dt,onPushLevel:Tt,onNavigate:Ht})]})}function zC(t){const[e,n]=N.useState(0),i=N.useCallback(()=>{n(s=>s+1)},[]);return M.jsx(Zb,{children:M.jsx(w9,{...t,onRequestRemount:i})},e)}const S9=N.forwardRef(function({circuit:e,height:n=300,showControls:i=!0,autoHarness:s=!1,initialInputs:a,layout:c,theme:u,focus:d,showPortLabels:h,onPortClick:p,glowUnconnected:m,renderEmptyState:y,renderOverlay:b,onPortValuesChange:x},w){const S=SM(e,{autoHarness:s,initialInputs:a}),E=m1(),D=u??E,T=N.useRef(x);N.useEffect(()=>{T.current=x}),N.useEffect(()=>{!S.ready||!S.portValues||S.portValues.size===0||T.current?.(S.portValues)},[S.ready,S.portValues]);const C=N.useCallback(()=>{S.tick()},[S.tick]),R=N.useCallback(()=>{S.reset()},[S.reset]);if(N.useImperativeHandle(w,()=>({tick:C,reset:R,setNodeValue:S.setNodeValue,startAutoRun:S.startAutoRun,stopAutoRun:S.stopAutoRun}),[C,R,S.setNodeValue,S.startAutoRun,S.stopAutoRun]),S.error)return M.jsx("div",{style:{height:n},className:"flex items-center justify-center p-4",children:M.jsxs("div",{className:"text-sm text-red-400 bg-red-500/10 rounded p-3 border border-red-500/20",children:[M.jsx("div",{className:"font-medium mb-1",children:"Compilation Error"}),M.jsx("div",{className:"font-mono text-xs",children:S.error})]})});if(!S.ready)return M.jsx("div",{style:{height:n},className:"flex items-center justify-center text-muted-foreground/60 text-sm",children:"Compiling..."});const A=S.isSequential&&i?40:0,O=typeof n=="number"?n-A:n;return M.jsxs("div",{style:{height:n},className:"flex flex-col","data-embed-theme":D,children:[M.jsx("div",{className:"flex-1 min-h-0",children:M.jsx(zC,{circuit:S.circuit,componentLibrary:S.componentLibrary??void 0,portValues:S.portValues,sequentialState:S.sequentialState,onToggleNode:S.toggleNode,onSetNodeValue:S.setNodeValue,onLoadMemory:(k,H)=>{const $=S.getSimulator();$&&($.setNode(k,H),S.runCombinational())},height:O,focus:d,showPortLabels:h,onPortClick:p,glowUnconnected:m,renderEmptyState:y,renderOverlay:b,...c?{layout:c}:{},...u?{theme:u}:{}})}),S.isSequential&&i&&M.jsx(jC,{cycle:S.cycleCount,historyLength:S.history?.length??0,historyIndex:S.historyIndex??-1,isRunning:S.isRunning,isViewingPast:S.isViewingPast??!1,onStep:C,onRun:()=>S.startAutoRun(5),onPause:()=>S.stopAutoRun(),onReset:R,onStepBack:()=>S.stepBack(),onStepForward:()=>{S.isViewingPast?S.stepForward():C()},speed:5})]})});var ym={exports:{}},VC;function E9(){return VC||(VC=1,(function(t){var e=(function(){var n=String.fromCharCode,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",a={};function c(d,h){if(!a[d]){a[d]={};for(var p=0;p<d.length;p++)a[d][d.charAt(p)]=p}return a[d][h]}var u={compressToBase64:function(d){if(d==null)return"";var h=u._compress(d,6,function(p){return i.charAt(p)});switch(h.length%4){default:case 0:return h;case 1:return h+"===";case 2:return h+"==";case 3:return h+"="}},decompressFromBase64:function(d){return d==null?"":d==""?null:u._decompress(d.length,32,function(h){return c(i,d.charAt(h))})},compressToUTF16:function(d){return d==null?"":u._compress(d,15,function(h){return n(h+32)})+" "},decompressFromUTF16:function(d){return d==null?"":d==""?null:u._decompress(d.length,16384,function(h){return d.charCodeAt(h)-32})},compressToUint8Array:function(d){for(var h=u.compress(d),p=new Uint8Array(h.length*2),m=0,y=h.length;m<y;m++){var b=h.charCodeAt(m);p[m*2]=b>>>8,p[m*2+1]=b%256}return p},decompressFromUint8Array:function(d){if(d==null)return u.decompress(d);for(var h=new Array(d.length/2),p=0,m=h.length;p<m;p++)h[p]=d[p*2]*256+d[p*2+1];var y=[];return h.forEach(function(b){y.push(n(b))}),u.decompress(y.join(""))},compressToEncodedURIComponent:function(d){return d==null?"":u._compress(d,6,function(h){return s.charAt(h)})},decompressFromEncodedURIComponent:function(d){return d==null?"":d==""?null:(d=d.replace(/ /g,"+"),u._decompress(d.length,32,function(h){return c(s,d.charAt(h))}))},compress:function(d){return u._compress(d,16,function(h){return n(h)})},_compress:function(d,h,p){if(d==null)return"";var m,y,b={},x={},w="",S="",E="",D=2,T=3,C=2,R=[],A=0,O=0,k;for(k=0;k<d.length;k+=1)if(w=d.charAt(k),Object.prototype.hasOwnProperty.call(b,w)||(b[w]=T++,x[w]=!0),S=E+w,Object.prototype.hasOwnProperty.call(b,S))E=S;else{if(Object.prototype.hasOwnProperty.call(x,E)){if(E.charCodeAt(0)<256){for(m=0;m<C;m++)A=A<<1,O==h-1?(O=0,R.push(p(A)),A=0):O++;for(y=E.charCodeAt(0),m=0;m<8;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1}else{for(y=1,m=0;m<C;m++)A=A<<1|y,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=0;for(y=E.charCodeAt(0),m=0;m<16;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1}D--,D==0&&(D=Math.pow(2,C),C++),delete x[E]}else for(y=b[E],m=0;m<C;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1;D--,D==0&&(D=Math.pow(2,C),C++),b[S]=T++,E=String(w)}if(E!==""){if(Object.prototype.hasOwnProperty.call(x,E)){if(E.charCodeAt(0)<256){for(m=0;m<C;m++)A=A<<1,O==h-1?(O=0,R.push(p(A)),A=0):O++;for(y=E.charCodeAt(0),m=0;m<8;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1}else{for(y=1,m=0;m<C;m++)A=A<<1|y,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=0;for(y=E.charCodeAt(0),m=0;m<16;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1}D--,D==0&&(D=Math.pow(2,C),C++),delete x[E]}else for(y=b[E],m=0;m<C;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1;D--,D==0&&(D=Math.pow(2,C),C++)}for(y=2,m=0;m<C;m++)A=A<<1|y&1,O==h-1?(O=0,R.push(p(A)),A=0):O++,y=y>>1;for(;;)if(A=A<<1,O==h-1){R.push(p(A));break}else O++;return R.join("")},decompress:function(d){return d==null?"":d==""?null:u._decompress(d.length,32768,function(h){return d.charCodeAt(h)})},_decompress:function(d,h,p){var m=[],y=4,b=4,x=3,w="",S=[],E,D,T,C,R,A,O,k={val:p(0),position:h,index:1};for(E=0;E<3;E+=1)m[E]=E;for(T=0,R=Math.pow(2,2),A=1;A!=R;)C=k.val&k.position,k.position>>=1,k.position==0&&(k.position=h,k.val=p(k.index++)),T|=(C>0?1:0)*A,A<<=1;switch(T){case 0:for(T=0,R=Math.pow(2,8),A=1;A!=R;)C=k.val&k.position,k.position>>=1,k.position==0&&(k.position=h,k.val=p(k.index++)),T|=(C>0?1:0)*A,A<<=1;O=n(T);break;case 1:for(T=0,R=Math.pow(2,16),A=1;A!=R;)C=k.val&k.position,k.position>>=1,k.position==0&&(k.position=h,k.val=p(k.index++)),T|=(C>0?1:0)*A,A<<=1;O=n(T);break;case 2:return""}for(m[3]=O,D=O,S.push(O);;){if(k.index>d)return"";for(T=0,R=Math.pow(2,x),A=1;A!=R;)C=k.val&k.position,k.position>>=1,k.position==0&&(k.position=h,k.val=p(k.index++)),T|=(C>0?1:0)*A,A<<=1;switch(O=T){case 0:for(T=0,R=Math.pow(2,8),A=1;A!=R;)C=k.val&k.position,k.position>>=1,k.position==0&&(k.position=h,k.val=p(k.index++)),T|=(C>0?1:0)*A,A<<=1;m[b++]=n(T),O=b-1,y--;break;case 1:for(T=0,R=Math.pow(2,16),A=1;A!=R;)C=k.val&k.position,k.position>>=1,k.position==0&&(k.position=h,k.val=p(k.index++)),T|=(C>0?1:0)*A,A<<=1;m[b++]=n(T),O=b-1,y--;break;case 2:return S.join("")}if(y==0&&(y=Math.pow(2,x),x++),m[O])w=m[O];else if(O===b)w=D+D.charAt(0);else return null;S.push(w),m[b++]=D+w.charAt(0),y--,D=w,y==0&&(y=Math.pow(2,x),x++)}}};return u})();t!=null?t.exports=e:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return e})})(ym)),ym.exports}var C9=E9();function T9(t){return C9.compressToEncodedURIComponent(t)}const _9=N.createContext(null);function N9(){return N.useContext(_9)}function LC(){return typeof window>"u"?"https://simten.dev":window.location.hostname==="localhost"?window.location.origin:"https://simten.dev"}const A9=160,M9=90;function R9(t){if(!t)return 1.5;const e=Object.values(t);if(e.length===0)return 1.5;const n=Math.max(...e.map(s=>s.x))+A9,i=Math.max(...e.map(s=>s.y))+M9;return n<=0||i<=0?1.5:n/i}const k9=N.forwardRef(function({circuit:e,height:n,aspectRatio:i,showControls:s=!0,layout:a,theme:c,title:u,subtitle:d,description:h,href:p,focus:m,showPortLabels:y,onPortClick:b,glowUnconnected:x,autoRunSpeed:w=500,initialInputs:S,forkSource:E,onPortValuesChange:D},T){const C=u||h,[R,A]=N.useState(null),[O,k]=N.useState(!1),H=N9(),$=async()=>{if(!O)try{const j=E??fM(e);if(H){k(!0);const{hash:I}=await H(j);window.open(`${LC()}/circuit/s/${I}`,"_blank","noopener")}else{const I=T9(j);window.open(`${LC()}/circuit/${I}`,"_blank","noopener")}}catch(j){A(j instanceof Error?j.message:"Couldn't fork this circuit"),setTimeout(()=>A(null),3e3)}finally{k(!1)}},q=n===void 0,F=i??R9(a),Q={width:"100%",aspectRatio:String(F),minHeight:240,maxHeight:"70vh"},B=C?void 0:q?Q:{height:n},P=C?q?Q:{height:n}:{height:"100%"};return M.jsxs("div",{style:B,className:`relative flex flex-col ${C?"rounded-xl border border-[var(--embed-border)] overflow-hidden bg-[var(--embed-bg-secondary)]":""}`,children:[!C&&!p&&M.jsx("button",{type:"button",onClick:$,title:R??"Open and modify this circuit in the Simten editor",className:"absolute top-2 right-2 z-10 hidden md:flex items-center px-2.5 py-1 rounded border border-[var(--embed-border)] bg-[var(--embed-bg-secondary)] text-[11px] text-[var(--embed-text-primary)] hover:opacity-80 transition-colors shadow-sm",children:R?"Fork failed":"Fork →"}),M.jsx("div",{style:P,className:"min-h-0",children:M.jsx(S9,{ref:T,circuit:e,height:"100%",showControls:s,autoHarness:!0,initialInputs:S,layout:a,theme:c,focus:m,showPortLabels:y,onPortClick:b,glowUnconnected:x,autoRunSpeed:w,onPortValuesChange:D})}),C&&M.jsxs("div",{className:"border-t border-[var(--embed-border)] px-4 py-3 flex items-end justify-between gap-4",children:[M.jsxs("div",{children:[M.jsx("div",{className:"text-base font-semibold text-[var(--embed-text-primary)]",children:u}),d&&M.jsx("div",{className:"text-xs text-[var(--embed-text-muted)] font-mono mt-0.5",children:d}),h&&M.jsx("div",{className:"text-sm text-[var(--embed-text-secondary)] mt-1.5 leading-relaxed",children:h})]}),p?M.jsx("a",{href:p,className:"shrink-0 px-3 py-1.5 rounded border border-[var(--embed-border)] text-xs text-[var(--embed-text-primary)] hover:opacity-80 transition-colors",children:"Open →"}):M.jsx("button",{type:"button",onClick:$,title:R??"Open and modify this circuit in the Simten editor",className:"hidden md:flex items-center shrink-0 px-3 py-1.5 rounded border border-[var(--embed-border)] text-xs text-[var(--embed-text-primary)] hover:opacity-80 transition-colors",children:R?`Can't fork: ${R.slice(0,40)}`:"Fork →"})]})]})});function O9({code:t,height:e,showControls:n,title:i,subtitle:s,description:a,href:c,autoRunSpeed:u,theme:d}){const h=sd(),[p,m]=N.useState(null),[y,b]=N.useState(null);return N.useEffect(()=>{if(!t){m(null),b(null);return}let x=!1;return h.compile(t).then(w=>{if(x)return;if("error"in w){b(w.error),m(null);return}const S=w.circuits[w.circuits.length-1];if(!S){b("No circuit found in code"),m(null);return}b(null),m(cM(S,w.libraryCircuits))}),()=>{x=!0}},[t,h]),t?y?M.jsx("div",{style:{height:e},className:"flex items-center justify-center p-4",children:M.jsxs("div",{className:"text-sm text-red-400 bg-red-500/10 rounded p-3 border border-red-500/20",children:[M.jsx("div",{className:"font-medium mb-1",children:"Error"}),M.jsx("div",{className:"font-mono text-xs whitespace-pre-wrap",children:y})]})}):p?M.jsx("div",{"data-embed-theme":d??"dark",children:M.jsx(k9,{circuit:p,height:e,showControls:n,title:i,subtitle:s,description:a,href:c,forkSource:t,autoRunSpeed:u,theme:d})}):M.jsx("div",{style:{height:e},className:"flex items-center justify-center text-sm text-gray-500",children:"Compiling..."}):M.jsx("div",{style:{height:e},className:"flex items-center justify-center text-sm text-gray-500",children:"No circuit code provided"})}function D9(t){return M.jsx(XN,{children:M.jsx(O9,{...t})})}const IC=HN(D9,{props:{code:"string",height:"number",showControls:"boolean",title:"string",subtitle:"string",description:"string",href:"string",autoRunSpeed:"number",theme:"string"}});return customElements.get("circuit-embed")||customElements.define("circuit-embed",IC),Zf.CircuitEmbedWC=IC,Object.defineProperty(Zf,Symbol.toStringTag,{value:"Module"}),Zf})({});