jetic-cli 0.2.7 → 0.2.9

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.
@@ -22,7 +22,7 @@
22
22
  *
23
23
  * This source code is licensed under the MIT license found in the
24
24
  * LICENSE file in the root directory of this source tree.
25
- */var lx;function zb(){return lx||(lx=1,(function(n){function r(E,$){var T=E.length;E.push($);e:for(;0<T;){var A=T-1>>>1,S=E[A];if(0<u(S,$))E[A]=$,E[T]=S,T=A;else break e}}function o(E){return E.length===0?null:E[0]}function i(E){if(E.length===0)return null;var $=E[0],T=E.pop();if(T!==$){E[0]=T;e:for(var A=0,S=E.length,D=S>>>1;A<D;){var L=2*(A+1)-1,F=E[L],ie=L+1,he=E[ie];if(0>u(F,T))ie<S&&0>u(he,F)?(E[A]=he,E[ie]=T,A=ie):(E[A]=F,E[L]=T,A=L);else if(ie<S&&0>u(he,T))E[A]=he,E[ie]=T,A=ie;else break e}}return $}function u(E,$){var T=E.sortIndex-$.sortIndex;return T!==0?T:E.id-$.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var h=Date,g=h.now();n.unstable_now=function(){return h.now()-g}}var x=[],m=[],p=1,b=null,v=3,N=!1,C=!1,k=!1,R=!1,z=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function M(E){for(var $=o(m);$!==null;){if($.callback===null)i(m);else if($.startTime<=E)i(m),$.sortIndex=$.expirationTime,r(x,$);else break;$=o(m)}}function H(E){if(k=!1,M(E),!C)if(o(x)!==null)C=!0,Z||(Z=!0,te());else{var $=o(m);$!==null&&W(H,$.startTime-E)}}var Z=!1,X=-1,oe=5,I=-1;function K(){return R?!0:!(n.unstable_now()-I<oe)}function ae(){if(R=!1,Z){var E=n.unstable_now();I=E;var $=!0;try{e:{C=!1,k&&(k=!1,V(X),X=-1),N=!0;var T=v;try{t:{for(M(E),b=o(x);b!==null&&!(b.expirationTime>E&&K());){var A=b.callback;if(typeof A=="function"){b.callback=null,v=b.priorityLevel;var S=A(b.expirationTime<=E);if(E=n.unstable_now(),typeof S=="function"){b.callback=S,M(E),$=!0;break t}b===o(x)&&i(x),M(E)}else i(x);b=o(x)}if(b!==null)$=!0;else{var D=o(m);D!==null&&W(H,D.startTime-E),$=!1}}break e}finally{b=null,v=T,N=!1}$=void 0}}finally{$?te():Z=!1}}}var te;if(typeof q=="function")te=function(){q(ae)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,_=se.port2;se.port1.onmessage=ae,te=function(){_.postMessage(null)}}else te=function(){z(ae,0)};function W(E,$){X=z(function(){E(n.unstable_now())},$)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(E){E.callback=null},n.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):oe=0<E?Math.floor(1e3/E):5},n.unstable_getCurrentPriorityLevel=function(){return v},n.unstable_next=function(E){switch(v){case 1:case 2:case 3:var $=3;break;default:$=v}var T=v;v=$;try{return E()}finally{v=T}},n.unstable_requestPaint=function(){R=!0},n.unstable_runWithPriority=function(E,$){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var T=v;v=E;try{return $()}finally{v=T}},n.unstable_scheduleCallback=function(E,$,T){var A=n.unstable_now();switch(typeof T=="object"&&T!==null?(T=T.delay,T=typeof T=="number"&&0<T?A+T:A):T=A,E){case 1:var S=-1;break;case 2:S=250;break;case 5:S=1073741823;break;case 4:S=1e4;break;default:S=5e3}return S=T+S,E={id:p++,callback:$,priorityLevel:E,startTime:T,expirationTime:S,sortIndex:-1},T>A?(E.sortIndex=T,r(m,E),o(x)===null&&E===o(m)&&(k?(V(X),X=-1):k=!0,W(H,T-A))):(E.sortIndex=S,r(x,E),C||N||(C=!0,Z||(Z=!0,te()))),E},n.unstable_shouldYield=K,n.unstable_wrapCallback=function(E){var $=v;return function(){var T=v;v=$;try{return E.apply(this,arguments)}finally{v=T}}}})(id)),id}var rx;function Ob(){return rx||(rx=1,od.exports=zb()),od.exports}var cd={exports:{}},qt={};/**
25
+ */var lx;function zb(){return lx||(lx=1,(function(n){function r(E,$){var T=E.length;E.push($);e:for(;0<T;){var A=T-1>>>1,S=E[A];if(0<u(S,$))E[A]=$,E[T]=S,T=A;else break e}}function o(E){return E.length===0?null:E[0]}function i(E){if(E.length===0)return null;var $=E[0],T=E.pop();if(T!==$){E[0]=T;e:for(var A=0,S=E.length,D=S>>>1;A<D;){var L=2*(A+1)-1,F=E[L],ie=L+1,he=E[ie];if(0>u(F,T))ie<S&&0>u(he,F)?(E[A]=he,E[ie]=T,A=ie):(E[A]=F,E[L]=T,A=L);else if(ie<S&&0>u(he,T))E[A]=he,E[ie]=T,A=ie;else break e}}return $}function u(E,$){var T=E.sortIndex-$.sortIndex;return T!==0?T:E.id-$.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var f=performance;n.unstable_now=function(){return f.now()}}else{var h=Date,g=h.now();n.unstable_now=function(){return h.now()-g}}var x=[],m=[],p=1,b=null,v=3,N=!1,C=!1,k=!1,R=!1,z=typeof setTimeout=="function"?setTimeout:null,V=typeof clearTimeout=="function"?clearTimeout:null,q=typeof setImmediate<"u"?setImmediate:null;function M(E){for(var $=o(m);$!==null;){if($.callback===null)i(m);else if($.startTime<=E)i(m),$.sortIndex=$.expirationTime,r(x,$);else break;$=o(m)}}function H(E){if(k=!1,M(E),!C)if(o(x)!==null)C=!0,Z||(Z=!0,te());else{var $=o(m);$!==null&&W(H,$.startTime-E)}}var Z=!1,X=-1,oe=5,I=-1;function K(){return R?!0:!(n.unstable_now()-I<oe)}function ae(){if(R=!1,Z){var E=n.unstable_now();I=E;var $=!0;try{e:{C=!1,k&&(k=!1,V(X),X=-1),N=!0;var T=v;try{t:{for(M(E),b=o(x);b!==null&&!(b.expirationTime>E&&K());){var A=b.callback;if(typeof A=="function"){b.callback=null,v=b.priorityLevel;var S=A(b.expirationTime<=E);if(E=n.unstable_now(),typeof S=="function"){b.callback=S,M(E),$=!0;break t}b===o(x)&&i(x),M(E)}else i(x);b=o(x)}if(b!==null)$=!0;else{var D=o(m);D!==null&&W(H,D.startTime-E),$=!1}}break e}finally{b=null,v=T,N=!1}$=void 0}}finally{$?te():Z=!1}}}var te;if(typeof q=="function")te=function(){q(ae)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,_=se.port2;se.port1.onmessage=ae,te=function(){_.postMessage(null)}}else te=function(){z(ae,0)};function W(E,$){X=z(function(){E(n.unstable_now())},$)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(E){E.callback=null},n.unstable_forceFrameRate=function(E){0>E||125<E?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):oe=0<E?Math.floor(1e3/E):5},n.unstable_getCurrentPriorityLevel=function(){return v},n.unstable_next=function(E){switch(v){case 1:case 2:case 3:var $=3;break;default:$=v}var T=v;v=$;try{return E()}finally{v=T}},n.unstable_requestPaint=function(){R=!0},n.unstable_runWithPriority=function(E,$){switch(E){case 1:case 2:case 3:case 4:case 5:break;default:E=3}var T=v;v=E;try{return $()}finally{v=T}},n.unstable_scheduleCallback=function(E,$,T){var A=n.unstable_now();switch(typeof T=="object"&&T!==null?(T=T.delay,T=typeof T=="number"&&0<T?A+T:A):T=A,E){case 1:var S=-1;break;case 2:S=250;break;case 5:S=1073741823;break;case 4:S=1e4;break;default:S=5e3}return S=T+S,E={id:p++,callback:$,priorityLevel:E,startTime:T,expirationTime:S,sortIndex:-1},T>A?(E.sortIndex=T,r(m,E),o(x)===null&&E===o(m)&&(k?(V(X),X=-1):k=!0,W(H,T-A))):(E.sortIndex=S,r(x,E),C||N||(C=!0,Z||(Z=!0,te()))),E},n.unstable_shouldYield=K,n.unstable_wrapCallback=function(E){var $=v;return function(){var T=v;v=$;try{return E.apply(this,arguments)}finally{v=T}}}})(id)),id}var rx;function Ob(){return rx||(rx=1,od.exports=zb()),od.exports}var cd={exports:{}},Lt={};/**
26
26
  * @license React
27
27
  * react-dom.production.js
28
28
  *
@@ -30,7 +30,7 @@
30
30
  *
31
31
  * This source code is licensed under the MIT license found in the
32
32
  * LICENSE file in the root directory of this source tree.
33
- */var ox;function Db(){if(ox)return qt;ox=1;var n=Yr();function r(x){var m="https://react.dev/errors/"+x;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)m+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+x+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(){}var i={d:{f:o,r:function(){throw Error(r(522))},D:o,C:o,L:o,m:o,X:o,S:o,M:o},p:0,findDOMNode:null},u=Symbol.for("react.portal");function f(x,m,p){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:b==null?null:""+b,children:x,containerInfo:m,implementation:p}}var h=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(x,m){if(x==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return qt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,qt.createPortal=function(x,m){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(r(299));return f(x,m,null,p)},qt.flushSync=function(x){var m=h.T,p=i.p;try{if(h.T=null,i.p=2,x)return x()}finally{h.T=m,i.p=p,i.d.f()}},qt.preconnect=function(x,m){typeof x=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,i.d.C(x,m))},qt.prefetchDNS=function(x){typeof x=="string"&&i.d.D(x)},qt.preinit=function(x,m){if(typeof x=="string"&&m&&typeof m.as=="string"){var p=m.as,b=g(p,m.crossOrigin),v=typeof m.integrity=="string"?m.integrity:void 0,N=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;p==="style"?i.d.S(x,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:N}):p==="script"&&i.d.X(x,{crossOrigin:b,integrity:v,fetchPriority:N,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},qt.preinitModule=function(x,m){if(typeof x=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var p=g(m.as,m.crossOrigin);i.d.M(x,{crossOrigin:p,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&i.d.M(x)},qt.preload=function(x,m){if(typeof x=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var p=m.as,b=g(p,m.crossOrigin);i.d.L(x,p,{crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},qt.preloadModule=function(x,m){if(typeof x=="string")if(m){var p=g(m.as,m.crossOrigin);i.d.m(x,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:p,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else i.d.m(x)},qt.requestFormReset=function(x){i.d.r(x)},qt.unstable_batchedUpdates=function(x,m){return x(m)},qt.useFormState=function(x,m,p){return h.H.useFormState(x,m,p)},qt.useFormStatus=function(){return h.H.useHostTransitionStatus()},qt.version="19.1.1",qt}var ix;function E0(){if(ix)return cd.exports;ix=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),cd.exports=Db(),cd.exports}/**
33
+ */var ox;function Db(){if(ox)return Lt;ox=1;var n=Yr();function r(x){var m="https://react.dev/errors/"+x;if(1<arguments.length){m+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)m+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+x+"; visit "+m+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function o(){}var i={d:{f:o,r:function(){throw Error(r(522))},D:o,C:o,L:o,m:o,X:o,S:o,M:o},p:0,findDOMNode:null},u=Symbol.for("react.portal");function f(x,m,p){var b=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:u,key:b==null?null:""+b,children:x,containerInfo:m,implementation:p}}var h=n.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function g(x,m){if(x==="font")return"";if(typeof m=="string")return m==="use-credentials"?m:""}return Lt.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Lt.createPortal=function(x,m){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!m||m.nodeType!==1&&m.nodeType!==9&&m.nodeType!==11)throw Error(r(299));return f(x,m,null,p)},Lt.flushSync=function(x){var m=h.T,p=i.p;try{if(h.T=null,i.p=2,x)return x()}finally{h.T=m,i.p=p,i.d.f()}},Lt.preconnect=function(x,m){typeof x=="string"&&(m?(m=m.crossOrigin,m=typeof m=="string"?m==="use-credentials"?m:"":void 0):m=null,i.d.C(x,m))},Lt.prefetchDNS=function(x){typeof x=="string"&&i.d.D(x)},Lt.preinit=function(x,m){if(typeof x=="string"&&m&&typeof m.as=="string"){var p=m.as,b=g(p,m.crossOrigin),v=typeof m.integrity=="string"?m.integrity:void 0,N=typeof m.fetchPriority=="string"?m.fetchPriority:void 0;p==="style"?i.d.S(x,typeof m.precedence=="string"?m.precedence:void 0,{crossOrigin:b,integrity:v,fetchPriority:N}):p==="script"&&i.d.X(x,{crossOrigin:b,integrity:v,fetchPriority:N,nonce:typeof m.nonce=="string"?m.nonce:void 0})}},Lt.preinitModule=function(x,m){if(typeof x=="string")if(typeof m=="object"&&m!==null){if(m.as==null||m.as==="script"){var p=g(m.as,m.crossOrigin);i.d.M(x,{crossOrigin:p,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0})}}else m==null&&i.d.M(x)},Lt.preload=function(x,m){if(typeof x=="string"&&typeof m=="object"&&m!==null&&typeof m.as=="string"){var p=m.as,b=g(p,m.crossOrigin);i.d.L(x,p,{crossOrigin:b,integrity:typeof m.integrity=="string"?m.integrity:void 0,nonce:typeof m.nonce=="string"?m.nonce:void 0,type:typeof m.type=="string"?m.type:void 0,fetchPriority:typeof m.fetchPriority=="string"?m.fetchPriority:void 0,referrerPolicy:typeof m.referrerPolicy=="string"?m.referrerPolicy:void 0,imageSrcSet:typeof m.imageSrcSet=="string"?m.imageSrcSet:void 0,imageSizes:typeof m.imageSizes=="string"?m.imageSizes:void 0,media:typeof m.media=="string"?m.media:void 0})}},Lt.preloadModule=function(x,m){if(typeof x=="string")if(m){var p=g(m.as,m.crossOrigin);i.d.m(x,{as:typeof m.as=="string"&&m.as!=="script"?m.as:void 0,crossOrigin:p,integrity:typeof m.integrity=="string"?m.integrity:void 0})}else i.d.m(x)},Lt.requestFormReset=function(x){i.d.r(x)},Lt.unstable_batchedUpdates=function(x,m){return x(m)},Lt.useFormState=function(x,m,p){return h.H.useFormState(x,m,p)},Lt.useFormStatus=function(){return h.H.useHostTransitionStatus()},Lt.version="19.1.1",Lt}var ix;function E0(){if(ix)return cd.exports;ix=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),cd.exports=Db(),cd.exports}/**
34
34
  * @license React
35
35
  * react-dom-client.production.js
36
36
  *
@@ -38,15 +38,15 @@
38
38
  *
39
39
  * This source code is licensed under the MIT license found in the
40
40
  * LICENSE file in the root directory of this source tree.
41
- */var cx;function Hb(){if(cx)return jr;cx=1;var n=Ob(),r=Yr(),o=E0();function i(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(f(e)!==e)throw Error(i(188))}function x(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(i(188));return t!==e?null:e}for(var a=e,l=t;;){var c=a.return;if(c===null)break;var d=c.alternate;if(d===null){if(l=c.return,l!==null){a=l;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===a)return g(c),e;if(d===l)return g(c),t;d=d.sibling}throw Error(i(188))}if(a.return!==l.return)a=c,l=d;else{for(var y=!1,w=c.child;w;){if(w===a){y=!0,a=c,l=d;break}if(w===l){y=!0,l=c,a=d;break}w=w.sibling}if(!y){for(w=d.child;w;){if(w===a){y=!0,a=d,l=c;break}if(w===l){y=!0,l=d,a=c;break}w=w.sibling}if(!y)throw Error(i(189))}}if(a.alternate!==l)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,b=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),z=Symbol.for("react.provider"),V=Symbol.for("react.consumer"),q=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function te(e){return e===null||typeof e!="object"?null:(e=ae&&e[ae]||e["@@iterator"],typeof e=="function"?e:null)}var se=Symbol.for("react.client.reference");function _(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===se?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case R:return"Profiler";case k:return"StrictMode";case H:return"Suspense";case Z:return"SuspenseList";case I:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case N:return"Portal";case q:return(e.displayName||"Context")+".Provider";case V:return(e._context.displayName||"Context")+".Consumer";case M:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case X:return t=e.displayName||null,t!==null?t:_(e.type)||"Memo";case oe:t=e._payload,e=e._init;try{return _(e(t))}catch{}}return null}var W=Array.isArray,E=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T={pending:!1,data:null,method:null,action:null},A=[],S=-1;function D(e){return{current:e}}function L(e){0>S||(e.current=A[S],A[S]=null,S--)}function F(e,t){S++,A[S]=e.current,e.current=t}var ie=D(null),he=D(null),me=D(null),Se=D(null);function ve(e,t){switch(F(me,t),F(he,e),F(ie,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Tp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Tp(t),e=Mp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}L(ie),F(ie,e)}function Ae(){L(ie),L(he),L(me)}function Re(e){e.memoizedState!==null&&F(Se,e);var t=ie.current,a=Mp(t,e.type);t!==a&&(F(he,e),F(ie,a))}function We(e){he.current===e&&(L(ie),L(he)),Se.current===e&&(L(Se),pr._currentValue=T)}var Te=Object.prototype.hasOwnProperty,be=n.unstable_scheduleCallback,B=n.unstable_cancelCallback,Y=n.unstable_shouldYield,ue=n.unstable_requestPaint,re=n.unstable_now,ee=n.unstable_getCurrentPriorityLevel,Ee=n.unstable_ImmediatePriority,ge=n.unstable_UserBlockingPriority,ke=n.unstable_NormalPriority,Oe=n.unstable_LowPriority,ze=n.unstable_IdlePriority,Mt=n.log,At=n.unstable_setDisableYieldValue,ft=null,nt=null;function pt(e){if(typeof Mt=="function"&&At(e),nt&&typeof nt.setStrictMode=="function")try{nt.setStrictMode(ft,e)}catch{}}var at=Math.clz32?Math.clz32:je,pe=Math.log,Ve=Math.LN2;function je(e){return e>>>=0,e===0?32:31-(pe(e)/Ve|0)|0}var Le=256,Ge=4194304;function Rt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Vt(e,t,a){var l=e.pendingLanes;if(l===0)return 0;var c=0,d=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var w=l&134217727;return w!==0?(l=w&~d,l!==0?c=Rt(l):(y&=w,y!==0?c=Rt(y):a||(a=w&~e,a!==0&&(c=Rt(a))))):(w=l&~d,w!==0?c=Rt(w):y!==0?c=Rt(y):a||(a=l&~e,a!==0&&(c=Rt(a)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,a=t&-t,d>=a||d===32&&(a&4194048)!==0)?t:c}function Jt(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Nl(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ys(){var e=Le;return Le<<=1,(Le&4194048)===0&&(Le=256),e}function la(){var e=Ge;return Ge<<=1,(Ge&62914560)===0&&(Ge=4194304),e}function Ya(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function ra(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Dn(e,t,a,l,c,d){var y=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var w=e.entanglements,O=e.expirationTimes,J=e.hiddenUpdates;for(a=y&~a;0<a;){var ce=31-at(a),fe=1<<ce;w[ce]=0,O[ce]=-1;var P=J[ce];if(P!==null)for(J[ce]=null,ce=0;ce<P.length;ce++){var ne=P[ce];ne!==null&&(ne.lane&=-536870913)}a&=~fe}l!==0&&Qr(e,l,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(y&~t))}function Qr(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-at(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|a&4194090}function Kr(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var l=31-at(a),c=1<<l;c&t|e[l]&t&&(e[l]|=t),a&=~c}}function wl(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Sl(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Jr(){var e=$.p;return e!==0?e:(e=window.event,e===void 0?32:Kp(e.type))}function Ii(e,t){var a=$.p;try{return $.p=e,t()}finally{$.p=a}}var _n=Math.random().toString(36).slice(2),wt="__reactFiber$"+_n,Ut="__reactProps$"+_n,oa="__reactContainer$"+_n,El="__reactEvents$"+_n,Fi="__reactListeners$"+_n,Pi="__reactHandles$"+_n,Ir="__reactResources$"+_n,Va="__reactMarker$"+_n;function kl(e){delete e[wt],delete e[Ut],delete e[El],delete e[Fi],delete e[Pi]}function Hn(e){var t=e[wt];if(t)return t;for(var a=e.parentNode;a;){if(t=a[oa]||a[wt]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Op(e);e!==null;){if(a=e[wt])return a;e=Op(e)}return t}e=a,a=e.parentNode}return null}function ia(e){if(e=e[wt]||e[oa]){var t=e.tag;if(t===5||t===6||t===13||t===26||t===27||t===3)return e}return null}function Ga(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ca(e){var t=e[Ir];return t||(t=e[Ir]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function xt(e){e[Va]=!0}var Fr=new Set,Pr={};function $n(e,t){ua(e,t),ua(e+"Capture",t)}function ua(e,t){for(Pr[e]=t,e=0;e<t.length;e++)Fr.add(t[e])}var eo=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]*$"),to={},no={};function ec(e){return Te.call(no,e)?!0:Te.call(to,e)?!1:eo.test(e)?no[e]=!0:(to[e]=!0,!1)}function bs(e,t,a){if(ec(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function vs(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function bn(e,t,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+l)}}var js,ao;function da(e){if(js===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);js=t&&t[1]||"",ao=-1<a.stack.indexOf(`
41
+ */var cx;function Hb(){if(cx)return jr;cx=1;var n=Ob(),r=Yr(),o=E0();function i(e){var t="https://react.dev/errors/"+e;if(1<arguments.length){t+="?args[]="+encodeURIComponent(arguments[1]);for(var a=2;a<arguments.length;a++)t+="&args[]="+encodeURIComponent(arguments[a])}return"Minified React error #"+e+"; visit "+t+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function u(e){return!(!e||e.nodeType!==1&&e.nodeType!==9&&e.nodeType!==11)}function f(e){var t=e,a=e;if(e.alternate)for(;t.return;)t=t.return;else{e=t;do t=e,(t.flags&4098)!==0&&(a=t.return),e=t.return;while(e)}return t.tag===3?a:null}function h(e){if(e.tag===13){var t=e.memoizedState;if(t===null&&(e=e.alternate,e!==null&&(t=e.memoizedState)),t!==null)return t.dehydrated}return null}function g(e){if(f(e)!==e)throw Error(i(188))}function x(e){var t=e.alternate;if(!t){if(t=f(e),t===null)throw Error(i(188));return t!==e?null:e}for(var a=e,l=t;;){var c=a.return;if(c===null)break;var d=c.alternate;if(d===null){if(l=c.return,l!==null){a=l;continue}break}if(c.child===d.child){for(d=c.child;d;){if(d===a)return g(c),e;if(d===l)return g(c),t;d=d.sibling}throw Error(i(188))}if(a.return!==l.return)a=c,l=d;else{for(var y=!1,w=c.child;w;){if(w===a){y=!0,a=c,l=d;break}if(w===l){y=!0,l=c,a=d;break}w=w.sibling}if(!y){for(w=d.child;w;){if(w===a){y=!0,a=d,l=c;break}if(w===l){y=!0,l=d,a=c;break}w=w.sibling}if(!y)throw Error(i(189))}}if(a.alternate!==l)throw Error(i(190))}if(a.tag!==3)throw Error(i(188));return a.stateNode.current===a?e:t}function m(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e;for(e=e.child;e!==null;){if(t=m(e),t!==null)return t;e=e.sibling}return null}var p=Object.assign,b=Symbol.for("react.element"),v=Symbol.for("react.transitional.element"),N=Symbol.for("react.portal"),C=Symbol.for("react.fragment"),k=Symbol.for("react.strict_mode"),R=Symbol.for("react.profiler"),z=Symbol.for("react.provider"),V=Symbol.for("react.consumer"),q=Symbol.for("react.context"),M=Symbol.for("react.forward_ref"),H=Symbol.for("react.suspense"),Z=Symbol.for("react.suspense_list"),X=Symbol.for("react.memo"),oe=Symbol.for("react.lazy"),I=Symbol.for("react.activity"),K=Symbol.for("react.memo_cache_sentinel"),ae=Symbol.iterator;function te(e){return e===null||typeof e!="object"?null:(e=ae&&e[ae]||e["@@iterator"],typeof e=="function"?e:null)}var se=Symbol.for("react.client.reference");function _(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===se?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case C:return"Fragment";case R:return"Profiler";case k:return"StrictMode";case H:return"Suspense";case Z:return"SuspenseList";case I:return"Activity"}if(typeof e=="object")switch(e.$$typeof){case N:return"Portal";case q:return(e.displayName||"Context")+".Provider";case V:return(e._context.displayName||"Context")+".Consumer";case M:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case X:return t=e.displayName||null,t!==null?t:_(e.type)||"Memo";case oe:t=e._payload,e=e._init;try{return _(e(t))}catch{}}return null}var W=Array.isArray,E=r.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=o.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,T={pending:!1,data:null,method:null,action:null},A=[],S=-1;function D(e){return{current:e}}function L(e){0>S||(e.current=A[S],A[S]=null,S--)}function F(e,t){S++,A[S]=e.current,e.current=t}var ie=D(null),he=D(null),me=D(null),Se=D(null);function ve(e,t){switch(F(me,t),F(he,e),F(ie,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?Tp(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=Tp(t),e=Mp(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}L(ie),F(ie,e)}function Ae(){L(ie),L(he),L(me)}function Re(e){e.memoizedState!==null&&F(Se,e);var t=ie.current,a=Mp(t,e.type);t!==a&&(F(he,e),F(ie,a))}function We(e){he.current===e&&(L(ie),L(he)),Se.current===e&&(L(Se),pr._currentValue=T)}var Te=Object.prototype.hasOwnProperty,be=n.unstable_scheduleCallback,B=n.unstable_cancelCallback,Y=n.unstable_shouldYield,ue=n.unstable_requestPaint,re=n.unstable_now,ee=n.unstable_getCurrentPriorityLevel,Ee=n.unstable_ImmediatePriority,ge=n.unstable_UserBlockingPriority,ke=n.unstable_NormalPriority,Oe=n.unstable_LowPriority,ze=n.unstable_IdlePriority,At=n.log,Rt=n.unstable_setDisableYieldValue,ft=null,nt=null;function xt(e){if(typeof At=="function"&&Rt(e),nt&&typeof nt.setStrictMode=="function")try{nt.setStrictMode(ft,e)}catch{}}var at=Math.clz32?Math.clz32:je,pe=Math.log,Ve=Math.LN2;function je(e){return e>>>=0,e===0?32:31-(pe(e)/Ve|0)|0}var Le=256,Ge=4194304;function zt(e){var t=e&42;if(t!==0)return t;switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194048;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Vt(e,t,a){var l=e.pendingLanes;if(l===0)return 0;var c=0,d=e.suspendedLanes,y=e.pingedLanes;e=e.warmLanes;var w=l&134217727;return w!==0?(l=w&~d,l!==0?c=zt(l):(y&=w,y!==0?c=zt(y):a||(a=w&~e,a!==0&&(c=zt(a))))):(w=l&~d,w!==0?c=zt(w):y!==0?c=zt(y):a||(a=l&~e,a!==0&&(c=zt(a)))),c===0?0:t!==0&&t!==c&&(t&d)===0&&(d=c&-c,a=t&-t,d>=a||d===32&&(a&4194048)!==0)?t:c}function It(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Nl(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return t+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function ys(){var e=Le;return Le<<=1,(Le&4194048)===0&&(Le=256),e}function la(){var e=Ge;return Ge<<=1,(Ge&62914560)===0&&(Ge=4194304),e}function Ya(e){for(var t=[],a=0;31>a;a++)t.push(e);return t}function ra(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Dn(e,t,a,l,c,d){var y=e.pendingLanes;e.pendingLanes=a,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=a,e.entangledLanes&=a,e.errorRecoveryDisabledLanes&=a,e.shellSuspendCounter=0;var w=e.entanglements,O=e.expirationTimes,J=e.hiddenUpdates;for(a=y&~a;0<a;){var ce=31-at(a),fe=1<<ce;w[ce]=0,O[ce]=-1;var P=J[ce];if(P!==null)for(J[ce]=null,ce=0;ce<P.length;ce++){var ne=P[ce];ne!==null&&(ne.lane&=-536870913)}a&=~fe}l!==0&&Qr(e,l,0),d!==0&&c===0&&e.tag!==0&&(e.suspendedLanes|=d&~(y&~t))}function Qr(e,t,a){e.pendingLanes|=t,e.suspendedLanes&=~t;var l=31-at(t);e.entangledLanes|=t,e.entanglements[l]=e.entanglements[l]|1073741824|a&4194090}function Kr(e,t){var a=e.entangledLanes|=t;for(e=e.entanglements;a;){var l=31-at(a),c=1<<l;c&t|e[l]&t&&(e[l]|=t),a&=~c}}function wl(e){switch(e){case 2:e=1;break;case 8:e=4;break;case 32:e=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:e=128;break;case 268435456:e=134217728;break;default:e=0}return e}function Sl(e){return e&=-e,2<e?8<e?(e&134217727)!==0?32:268435456:8:2}function Jr(){var e=$.p;return e!==0?e:(e=window.event,e===void 0?32:Kp(e.type))}function Ii(e,t){var a=$.p;try{return $.p=e,t()}finally{$.p=a}}var _n=Math.random().toString(36).slice(2),St="__reactFiber$"+_n,Bt="__reactProps$"+_n,oa="__reactContainer$"+_n,El="__reactEvents$"+_n,Fi="__reactListeners$"+_n,Pi="__reactHandles$"+_n,Ir="__reactResources$"+_n,Va="__reactMarker$"+_n;function kl(e){delete e[St],delete e[Bt],delete e[El],delete e[Fi],delete e[Pi]}function Hn(e){var t=e[St];if(t)return t;for(var a=e.parentNode;a;){if(t=a[oa]||a[St]){if(a=t.alternate,t.child!==null||a!==null&&a.child!==null)for(e=Op(e);e!==null;){if(a=e[St])return a;e=Op(e)}return t}e=a,a=e.parentNode}return null}function ia(e){if(e=e[St]||e[oa]){var t=e.tag;if(t===5||t===6||t===13||t===26||t===27||t===3)return e}return null}function Ga(e){var t=e.tag;if(t===5||t===26||t===27||t===6)return e.stateNode;throw Error(i(33))}function ca(e){var t=e[Ir];return t||(t=e[Ir]={hoistableStyles:new Map,hoistableScripts:new Map}),t}function gt(e){e[Va]=!0}var Fr=new Set,Pr={};function $n(e,t){ua(e,t),ua(e+"Capture",t)}function ua(e,t){for(Pr[e]=t,e=0;e<t.length;e++)Fr.add(t[e])}var eo=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]*$"),to={},no={};function ec(e){return Te.call(no,e)?!0:Te.call(to,e)?!1:eo.test(e)?no[e]=!0:(to[e]=!0,!1)}function bs(e,t,a){if(ec(t))if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":e.removeAttribute(t);return;case"boolean":var l=t.toLowerCase().slice(0,5);if(l!=="data-"&&l!=="aria-"){e.removeAttribute(t);return}}e.setAttribute(t,""+a)}}function vs(e,t,a){if(a===null)e.removeAttribute(t);else{switch(typeof a){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(t);return}e.setAttribute(t,""+a)}}function vn(e,t,a,l){if(l===null)e.removeAttribute(a);else{switch(typeof l){case"undefined":case"function":case"symbol":case"boolean":e.removeAttribute(a);return}e.setAttributeNS(t,a,""+l)}}var js,ao;function da(e){if(js===void 0)try{throw Error()}catch(a){var t=a.stack.trim().match(/\n( *(at )?)/);js=t&&t[1]||"",ao=-1<a.stack.indexOf(`
42
42
  at`)?" (<anonymous>)":-1<a.stack.indexOf("@")?"@unknown:0:0":""}return`
43
43
  `+js+e+ao}var _l=!1;function Xa(e,t){if(!e||_l)return"";_l=!0;var a=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var l={DetermineComponentFrameRoot:function(){try{if(t){var fe=function(){throw Error()};if(Object.defineProperty(fe.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(fe,[])}catch(ne){var P=ne}Reflect.construct(e,[],fe)}else{try{fe.call()}catch(ne){P=ne}e.call(fe.prototype)}}else{try{throw Error()}catch(ne){P=ne}(fe=e())&&typeof fe.catch=="function"&&fe.catch(function(){})}}catch(ne){if(ne&&P&&typeof ne.stack=="string")return[ne.stack,P.stack]}return[null,null]}};l.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var c=Object.getOwnPropertyDescriptor(l.DetermineComponentFrameRoot,"name");c&&c.configurable&&Object.defineProperty(l.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var d=l.DetermineComponentFrameRoot(),y=d[0],w=d[1];if(y&&w){var O=y.split(`
44
44
  `),J=w.split(`
45
45
  `);for(c=l=0;l<O.length&&!O[l].includes("DetermineComponentFrameRoot");)l++;for(;c<J.length&&!J[c].includes("DetermineComponentFrameRoot");)c++;if(l===O.length||c===J.length)for(l=O.length-1,c=J.length-1;1<=l&&0<=c&&O[l]!==J[c];)c--;for(;1<=l&&0<=c;l--,c--)if(O[l]!==J[c]){if(l!==1||c!==1)do if(l--,c--,0>c||O[l]!==J[c]){var ce=`
46
46
  `+O[l].replace(" at new "," at ");return e.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",e.displayName)),ce}while(1<=l&&0<=c);break}}}finally{_l=!1,Error.prepareStackTrace=a}return(a=e?e.displayName||e.name:"")?da(a):""}function Sy(e){switch(e.tag){case 26:case 27:case 5:return da(e.type);case 16:return da("Lazy");case 13:return da("Suspense");case 19:return da("SuspenseList");case 0:case 15:return Xa(e.type,!1);case 11:return Xa(e.type.render,!1);case 1:return Xa(e.type,!0);case 31:return da("Activity");default:return""}}function wf(e){try{var t="";do t+=Sy(e),e=e.return;while(e);return t}catch(a){return`
47
47
  Error generating stack: `+a.message+`
48
- `+a.stack}}function on(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Sf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ey(e){var t=Sf(e)?"checked":"value",a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var c=a.get,d=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(y){l=""+y,d.call(this,y)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return l},setValue:function(y){l=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function so(e){e._valueTracker||(e._valueTracker=Ey(e))}function Ef(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),l="";return e&&(l=Sf(e)?e.checked?"true":"false":e.value),e=l,e!==a?(t.setValue(e),!0):!1}function lo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var ky=/[\n"\\]/g;function cn(e){return e.replace(ky,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function tc(e,t,a,l,c,d,y,w){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+on(t)):e.value!==""+on(t)&&(e.value=""+on(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?nc(e,y,on(t)):a!=null?nc(e,y,on(a)):l!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+on(w):e.removeAttribute("name")}function kf(e,t,a,l,c,d,y,w){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||a!=null){if(!(d!=="submit"&&d!=="reset"||t!=null))return;a=a!=null?""+on(a):"",t=t!=null?""+on(t):a,w||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=w?e.checked:!!l,e.defaultChecked=!!l,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y)}function nc(e,t,a){t==="number"&&lo(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Ns(e,t,a,l){if(e=e.options,t){t={};for(var c=0;c<a.length;c++)t["$"+a[c]]=!0;for(a=0;a<e.length;a++)c=t.hasOwnProperty("$"+e[a].value),e[a].selected!==c&&(e[a].selected=c),c&&l&&(e[a].defaultSelected=!0)}else{for(a=""+on(a),t=null,c=0;c<e.length;c++){if(e[c].value===a){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function _f(e,t,a){if(t!=null&&(t=""+on(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+on(a):""}function Cf(e,t,a,l){if(t==null){if(l!=null){if(a!=null)throw Error(i(92));if(W(l)){if(1<l.length)throw Error(i(93));l=l[0]}a=l}a==null&&(a=""),t=a}a=on(t),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l)}function ws(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var _y=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 Tf(e,t,a){var l=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,a):typeof a!="number"||a===0||_y.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Mf(e,t,a){if(t!=null&&typeof t!="object")throw Error(i(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in t)l=t[c],t.hasOwnProperty(c)&&a[c]!==l&&Tf(e,c,l)}else for(var d in t)t.hasOwnProperty(d)&&Tf(e,d,t[d])}function ac(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Cy=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"]]),Ty=/^[\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 ro(e){return Ty.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var sc=null;function lc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ss=null,Es=null;function Af(e){var t=ia(e);if(t&&(e=t.stateNode)){var a=e[Ut]||null;e:switch(e=t.stateNode,t.type){case"input":if(tc(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+cn(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var l=a[t];if(l!==e&&l.form===e.form){var c=l[Ut]||null;if(!c)throw Error(i(90));tc(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<a.length;t++)l=a[t],l.form===e.form&&Ef(l)}break e;case"textarea":_f(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Ns(e,!!a.multiple,t,!1)}}}var rc=!1;function Rf(e,t,a){if(rc)return e(t,a);rc=!0;try{var l=e(t);return l}finally{if(rc=!1,(Ss!==null||Es!==null)&&(Zo(),Ss&&(t=Ss,e=Es,Es=Ss=null,Af(t),e)))for(t=0;t<e.length;t++)Af(e[t])}}function Cl(e,t){var a=e.stateNode;if(a===null)return null;var l=a[Ut]||null;if(l===null)return null;a=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(i(231,t,typeof a));return a}var Un=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oc=!1;if(Un)try{var Tl={};Object.defineProperty(Tl,"passive",{get:function(){oc=!0}}),window.addEventListener("test",Tl,Tl),window.removeEventListener("test",Tl,Tl)}catch{oc=!1}var fa=null,ic=null,oo=null;function zf(){if(oo)return oo;var e,t=ic,a=t.length,l,c="value"in fa?fa.value:fa.textContent,d=c.length;for(e=0;e<a&&t[e]===c[e];e++);var y=a-e;for(l=1;l<=y&&t[a-l]===c[d-l];l++);return oo=c.slice(e,1<l?1-l:void 0)}function io(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function co(){return!0}function Of(){return!1}function Xt(e){function t(a,l,c,d,y){this._reactName=a,this._targetInst=c,this.type=l,this.nativeEvent=d,this.target=y,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(a=e[w],this[w]=a?a(d):d[w]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?co:Of,this.isPropagationStopped=Of,this}return p(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=co)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=co)},persist:function(){},isPersistent:co}),t}var Za={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},uo=Xt(Za),Ml=p({},Za,{view:0,detail:0}),My=Xt(Ml),cc,uc,Al,fo=p({},Ml,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Al&&(Al&&e.type==="mousemove"?(cc=e.screenX-Al.screenX,uc=e.screenY-Al.screenY):uc=cc=0,Al=e),cc)},movementY:function(e){return"movementY"in e?e.movementY:uc}}),Df=Xt(fo),Ay=p({},fo,{dataTransfer:0}),Ry=Xt(Ay),zy=p({},Ml,{relatedTarget:0}),dc=Xt(zy),Oy=p({},Za,{animationName:0,elapsedTime:0,pseudoElement:0}),Dy=Xt(Oy),Hy=p({},Za,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),$y=Xt(Hy),Uy=p({},Za,{data:0}),Hf=Xt(Uy),By={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},qy={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"},Ly={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Yy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ly[e])?!!t[e]:!1}function fc(){return Yy}var Vy=p({},Ml,{key:function(e){if(e.key){var t=By[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=io(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?qy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fc,charCode:function(e){return e.type==="keypress"?io(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?io(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Gy=Xt(Vy),Xy=p({},fo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$f=Xt(Xy),Zy=p({},Ml,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fc}),Wy=Xt(Zy),Qy=p({},Za,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ky=Xt(Qy),Jy=p({},fo,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Iy=Xt(Jy),Fy=p({},Za,{newState:0,oldState:0}),Py=Xt(Fy),e1=[9,13,27,32],hc=Un&&"CompositionEvent"in window,Rl=null;Un&&"documentMode"in document&&(Rl=document.documentMode);var t1=Un&&"TextEvent"in window&&!Rl,Uf=Un&&(!hc||Rl&&8<Rl&&11>=Rl),Bf=" ",qf=!1;function Lf(e,t){switch(e){case"keyup":return e1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ks=!1;function n1(e,t){switch(e){case"compositionend":return Yf(t);case"keypress":return t.which!==32?null:(qf=!0,Bf);case"textInput":return e=t.data,e===Bf&&qf?null:e;default:return null}}function a1(e,t){if(ks)return e==="compositionend"||!hc&&Lf(e,t)?(e=zf(),oo=ic=fa=null,ks=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Uf&&t.locale!=="ko"?null:t.data;default:return null}}var s1={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 Vf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!s1[e.type]:t==="textarea"}function Gf(e,t,a,l){Ss?Es?Es.push(l):Es=[l]:Ss=l,t=Fo(t,"onChange"),0<t.length&&(a=new uo("onChange","change",null,a,l),e.push({event:a,listeners:t}))}var zl=null,Ol=null;function l1(e){Sp(e,0)}function ho(e){var t=Ga(e);if(Ef(t))return e}function Xf(e,t){if(e==="change")return t}var Zf=!1;if(Un){var mc;if(Un){var pc="oninput"in document;if(!pc){var Wf=document.createElement("div");Wf.setAttribute("oninput","return;"),pc=typeof Wf.oninput=="function"}mc=pc}else mc=!1;Zf=mc&&(!document.documentMode||9<document.documentMode)}function Qf(){zl&&(zl.detachEvent("onpropertychange",Kf),Ol=zl=null)}function Kf(e){if(e.propertyName==="value"&&ho(Ol)){var t=[];Gf(t,Ol,e,lc(e)),Rf(l1,t)}}function r1(e,t,a){e==="focusin"?(Qf(),zl=t,Ol=a,zl.attachEvent("onpropertychange",Kf)):e==="focusout"&&Qf()}function o1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ho(Ol)}function i1(e,t){if(e==="click")return ho(t)}function c1(e,t){if(e==="input"||e==="change")return ho(t)}function u1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var It=typeof Object.is=="function"?Object.is:u1;function Dl(e,t){if(It(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),l=Object.keys(t);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var c=a[l];if(!Te.call(t,c)||!It(e[c],t[c]))return!1}return!0}function Jf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function If(e,t){var a=Jf(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=t&&l>=t)return{node:a,offset:t-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Jf(a)}}function Ff(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ff(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=lo(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=lo(e.document)}return t}function xc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var d1=Un&&"documentMode"in document&&11>=document.documentMode,_s=null,gc=null,Hl=null,yc=!1;function eh(e,t,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;yc||_s==null||_s!==lo(l)||(l=_s,"selectionStart"in l&&xc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Hl&&Dl(Hl,l)||(Hl=l,l=Fo(gc,"onSelect"),0<l.length&&(t=new uo("onSelect","select",null,t,a),e.push({event:t,listeners:l}),t.target=_s)))}function Wa(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Cs={animationend:Wa("Animation","AnimationEnd"),animationiteration:Wa("Animation","AnimationIteration"),animationstart:Wa("Animation","AnimationStart"),transitionrun:Wa("Transition","TransitionRun"),transitionstart:Wa("Transition","TransitionStart"),transitioncancel:Wa("Transition","TransitionCancel"),transitionend:Wa("Transition","TransitionEnd")},bc={},th={};Un&&(th=document.createElement("div").style,"AnimationEvent"in window||(delete Cs.animationend.animation,delete Cs.animationiteration.animation,delete Cs.animationstart.animation),"TransitionEvent"in window||delete Cs.transitionend.transition);function Qa(e){if(bc[e])return bc[e];if(!Cs[e])return e;var t=Cs[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in th)return bc[e]=t[a];return e}var nh=Qa("animationend"),ah=Qa("animationiteration"),sh=Qa("animationstart"),f1=Qa("transitionrun"),h1=Qa("transitionstart"),m1=Qa("transitioncancel"),lh=Qa("transitionend"),rh=new Map,vc="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(" ");vc.push("scrollEnd");function vn(e,t){rh.set(e,t),$n(t,[e])}var oh=new WeakMap;function un(e,t){if(typeof e=="object"&&e!==null){var a=oh.get(e);return a!==void 0?a:(t={value:e,source:t,stack:wf(t)},oh.set(e,t),t)}return{value:e,source:t,stack:wf(t)}}var dn=[],Ts=0,jc=0;function mo(){for(var e=Ts,t=jc=Ts=0;t<e;){var a=dn[t];dn[t++]=null;var l=dn[t];dn[t++]=null;var c=dn[t];dn[t++]=null;var d=dn[t];if(dn[t++]=null,l!==null&&c!==null){var y=l.pending;y===null?c.next=c:(c.next=y.next,y.next=c),l.pending=c}d!==0&&ih(a,c,d)}}function po(e,t,a,l){dn[Ts++]=e,dn[Ts++]=t,dn[Ts++]=a,dn[Ts++]=l,jc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Nc(e,t,a,l){return po(e,t,a,l),xo(e)}function Ms(e,t){return po(e,null,null,t),xo(e)}function ih(e,t,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var c=!1,d=e.return;d!==null;)d.childLanes|=a,l=d.alternate,l!==null&&(l.childLanes|=a),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-at(a),e=d.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=a|536870912),d):null}function xo(e){if(50<or)throw or=0,Cu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var As={};function p1(e,t,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Ft(e,t,a,l){return new p1(e,t,a,l)}function wc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Bn(e,t){var a=e.alternate;return a===null?(a=Ft(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function ch(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function go(e,t,a,l,c,d){var y=0;if(l=e,typeof e=="function")wc(e)&&(y=1);else if(typeof e=="string")y=gb(e,a,ie.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case I:return e=Ft(31,a,t,c),e.elementType=I,e.lanes=d,e;case C:return Ka(a.children,c,d,t);case k:y=8,c|=24;break;case R:return e=Ft(12,a,t,c|2),e.elementType=R,e.lanes=d,e;case H:return e=Ft(13,a,t,c),e.elementType=H,e.lanes=d,e;case Z:return e=Ft(19,a,t,c),e.elementType=Z,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case z:case q:y=10;break e;case V:y=9;break e;case M:y=11;break e;case X:y=14;break e;case oe:y=16,l=null;break e}y=29,a=Error(i(130,e===null?"null":typeof e,"")),l=null}return t=Ft(y,a,t,c),t.elementType=e,t.type=l,t.lanes=d,t}function Ka(e,t,a,l){return e=Ft(7,e,l,t),e.lanes=a,e}function Sc(e,t,a){return e=Ft(6,e,null,t),e.lanes=a,e}function Ec(e,t,a){return t=Ft(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Rs=[],zs=0,yo=null,bo=0,fn=[],hn=0,Ja=null,qn=1,Ln="";function Ia(e,t){Rs[zs++]=bo,Rs[zs++]=yo,yo=e,bo=t}function uh(e,t,a){fn[hn++]=qn,fn[hn++]=Ln,fn[hn++]=Ja,Ja=e;var l=qn;e=Ln;var c=32-at(l)-1;l&=~(1<<c),a+=1;var d=32-at(t)+c;if(30<d){var y=c-c%5;d=(l&(1<<y)-1).toString(32),l>>=y,c-=y,qn=1<<32-at(t)+c|a<<c|l,Ln=d+e}else qn=1<<d|a<<c|l,Ln=e}function kc(e){e.return!==null&&(Ia(e,1),uh(e,1,0))}function _c(e){for(;e===yo;)yo=Rs[--zs],Rs[zs]=null,bo=Rs[--zs],Rs[zs]=null;for(;e===Ja;)Ja=fn[--hn],fn[hn]=null,Ln=fn[--hn],fn[hn]=null,qn=fn[--hn],fn[hn]=null}var Gt=null,ot=null,Ze=!1,Fa=null,Cn=!1,Cc=Error(i(519));function Pa(e){var t=Error(i(418,""));throw Bl(un(t,e)),Cc}function dh(e){var t=e.stateNode,a=e.type,l=e.memoizedProps;switch(t[wt]=e,t[Ut]=l,a){case"dialog":qe("cancel",t),qe("close",t);break;case"iframe":case"object":case"embed":qe("load",t);break;case"video":case"audio":for(a=0;a<cr.length;a++)qe(cr[a],t);break;case"source":qe("error",t);break;case"img":case"image":case"link":qe("error",t),qe("load",t);break;case"details":qe("toggle",t);break;case"input":qe("invalid",t),kf(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0),so(t);break;case"select":qe("invalid",t);break;case"textarea":qe("invalid",t),Cf(t,l.value,l.defaultValue,l.children),so(t)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||l.suppressHydrationWarning===!0||Cp(t.textContent,a)?(l.popover!=null&&(qe("beforetoggle",t),qe("toggle",t)),l.onScroll!=null&&qe("scroll",t),l.onScrollEnd!=null&&qe("scrollend",t),l.onClick!=null&&(t.onclick=Po),t=!0):t=!1,t||Pa(e)}function fh(e){for(Gt=e.return;Gt;)switch(Gt.tag){case 5:case 13:Cn=!1;return;case 27:case 3:Cn=!0;return;default:Gt=Gt.return}}function $l(e){if(e!==Gt)return!1;if(!Ze)return fh(e),Ze=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Gu(e.type,e.memoizedProps)),a=!a),a&&ot&&Pa(e),fh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8)if(a=e.data,a==="/$"){if(t===0){ot=Nn(e.nextSibling);break e}t--}else a!=="$"&&a!=="$!"&&a!=="$?"||t++;e=e.nextSibling}ot=null}}else t===27?(t=ot,Ca(e.type)?(e=Qu,Qu=null,ot=e):ot=t):ot=Gt?Nn(e.stateNode.nextSibling):null;return!0}function Ul(){ot=Gt=null,Ze=!1}function hh(){var e=Fa;return e!==null&&(Qt===null?Qt=e:Qt.push.apply(Qt,e),Fa=null),e}function Bl(e){Fa===null?Fa=[e]:Fa.push(e)}var Tc=D(null),es=null,Yn=null;function ha(e,t,a){F(Tc,t._currentValue),t._currentValue=a}function Vn(e){e._currentValue=Tc.current,L(Tc)}function Mc(e,t,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===a)break;e=e.return}}function Ac(e,t,a,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var y=c.child;d=d.firstContext;e:for(;d!==null;){var w=d;d=c;for(var O=0;O<t.length;O++)if(w.context===t[O]){d.lanes|=a,w=d.alternate,w!==null&&(w.lanes|=a),Mc(d.return,a,e),l||(y=null);break e}d=w.next}}else if(c.tag===18){if(y=c.return,y===null)throw Error(i(341));y.lanes|=a,d=y.alternate,d!==null&&(d.lanes|=a),Mc(y,a,e),y=null}else y=c.child;if(y!==null)y.return=c;else for(y=c;y!==null;){if(y===e){y=null;break}if(c=y.sibling,c!==null){c.return=y.return,y=c;break}y=y.return}c=y}}function ql(e,t,a,l){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var y=c.alternate;if(y===null)throw Error(i(387));if(y=y.memoizedProps,y!==null){var w=c.type;It(c.pendingProps.value,y.value)||(e!==null?e.push(w):e=[w])}}else if(c===Se.current){if(y=c.alternate,y===null)throw Error(i(387));y.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(pr):e=[pr])}c=c.return}e!==null&&Ac(t,e,a,l),t.flags|=262144}function vo(e){for(e=e.firstContext;e!==null;){if(!It(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ts(e){es=e,Yn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function Bt(e){return mh(es,e)}function jo(e,t){return es===null&&ts(e),mh(e,t)}function mh(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Yn===null){if(e===null)throw Error(i(308));Yn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Yn=Yn.next=t;return a}var x1=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},g1=n.unstable_scheduleCallback,y1=n.unstable_NormalPriority,bt={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Rc(){return{controller:new x1,data:new Map,refCount:0}}function Ll(e){e.refCount--,e.refCount===0&&g1(y1,function(){e.controller.abort()})}var Yl=null,zc=0,Os=0,Ds=null;function b1(e,t){if(Yl===null){var a=Yl=[];zc=0,Os=Du(),Ds={status:"pending",value:void 0,then:function(l){a.push(l)}}}return zc++,t.then(ph,ph),t}function ph(){if(--zc===0&&Yl!==null){Ds!==null&&(Ds.status="fulfilled");var e=Yl;Yl=null,Os=0,Ds=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function v1(e,t){var a=[],l={status:"pending",value:null,reason:null,then:function(c){a.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<a.length;c++)(0,a[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<a.length;c++)(0,a[c])(void 0)}),l}var xh=E.S;E.S=function(e,t){typeof t=="object"&&t!==null&&typeof t.then=="function"&&b1(e,t),xh!==null&&xh(e,t)};var ns=D(null);function Oc(){var e=ns.current;return e!==null?e:et.pooledCache}function No(e,t){t===null?F(ns,ns.current):F(ns,t.pool)}function gh(){var e=Oc();return e===null?null:{parent:bt._currentValue,pool:e}}var Vl=Error(i(460)),yh=Error(i(474)),wo=Error(i(542)),Dc={then:function(){}};function bh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function So(){}function vh(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(So,So),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Nh(e),e;default:if(typeof t.status=="string")t.then(So,So);else{if(e=et,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Nh(e),e}throw Gl=t,Vl}}var Gl=null;function jh(){if(Gl===null)throw Error(i(459));var e=Gl;return Gl=null,e}function Nh(e){if(e===Vl||e===wo)throw Error(i(483))}var ma=!1;function Hc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $c(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function pa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function xa(e,t,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Qe&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=xo(e),ih(e,null,a),t}return po(e,l,t,a),xo(e)}function Xl(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,Kr(e,a)}}function Uc(e,t){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var c=null,d=null;if(a=a.firstBaseUpdate,a!==null){do{var y={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};d===null?c=d=y:d=d.next=y,a=a.next}while(a!==null);d===null?c=d=t:d=d.next=t}else c=d=t;a={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Bc=!1;function Zl(){if(Bc){var e=Ds;if(e!==null)throw e}}function Wl(e,t,a,l){Bc=!1;var c=e.updateQueue;ma=!1;var d=c.firstBaseUpdate,y=c.lastBaseUpdate,w=c.shared.pending;if(w!==null){c.shared.pending=null;var O=w,J=O.next;O.next=null,y===null?d=J:y.next=J,y=O;var ce=e.alternate;ce!==null&&(ce=ce.updateQueue,w=ce.lastBaseUpdate,w!==y&&(w===null?ce.firstBaseUpdate=J:w.next=J,ce.lastBaseUpdate=O))}if(d!==null){var fe=c.baseState;y=0,ce=J=O=null,w=d;do{var P=w.lane&-536870913,ne=P!==w.lane;if(ne?(Ye&P)===P:(l&P)===P){P!==0&&P===Os&&(Bc=!0),ce!==null&&(ce=ce.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var Me=e,_e=w;P=t;var Fe=a;switch(_e.tag){case 1:if(Me=_e.payload,typeof Me=="function"){fe=Me.call(Fe,fe,P);break e}fe=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=_e.payload,P=typeof Me=="function"?Me.call(Fe,fe,P):Me,P==null)break e;fe=p({},fe,P);break e;case 2:ma=!0}}P=w.callback,P!==null&&(e.flags|=64,ne&&(e.flags|=8192),ne=c.callbacks,ne===null?c.callbacks=[P]:ne.push(P))}else ne={lane:P,tag:w.tag,payload:w.payload,callback:w.callback,next:null},ce===null?(J=ce=ne,O=fe):ce=ce.next=ne,y|=P;if(w=w.next,w===null){if(w=c.shared.pending,w===null)break;ne=w,w=ne.next,ne.next=null,c.lastBaseUpdate=ne,c.shared.pending=null}}while(!0);ce===null&&(O=fe),c.baseState=O,c.firstBaseUpdate=J,c.lastBaseUpdate=ce,d===null&&(c.shared.lanes=0),Sa|=y,e.lanes=y,e.memoizedState=fe}}function wh(e,t){if(typeof e!="function")throw Error(i(191,e));e.call(t)}function Sh(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)wh(a[e],t)}var Hs=D(null),Eo=D(0);function Eh(e,t){e=Jn,F(Eo,e),F(Hs,t),Jn=e|t.baseLanes}function qc(){F(Eo,Jn),F(Hs,Hs.current)}function Lc(){Jn=Eo.current,L(Hs),L(Eo)}var ga=0,He=null,Je=null,gt=null,ko=!1,$s=!1,as=!1,_o=0,Ql=0,Us=null,j1=0;function ht(){throw Error(i(321))}function Yc(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!It(e[a],t[a]))return!1;return!0}function Vc(e,t,a,l,c,d){return ga=d,He=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?im:cm,as=!1,d=a(l,c),as=!1,$s&&(d=_h(t,a,l,c)),kh(e),d}function kh(e){E.H=zo;var t=Je!==null&&Je.next!==null;if(ga=0,gt=Je=He=null,ko=!1,Ql=0,Us=null,t)throw Error(i(300));e===null||St||(e=e.dependencies,e!==null&&vo(e)&&(St=!0))}function _h(e,t,a,l){He=e;var c=0;do{if($s&&(Us=null),Ql=0,$s=!1,25<=c)throw Error(i(301));if(c+=1,gt=Je=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}E.H=C1,d=t(a,l)}while($s);return d}function N1(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?Kl(t):t,e=e.useState()[0],(Je!==null?Je.memoizedState:null)!==e&&(He.flags|=1024),t}function Gc(){var e=_o!==0;return _o=0,e}function Xc(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Zc(e){if(ko){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ko=!1}ga=0,gt=Je=He=null,$s=!1,Ql=_o=0,Us=null}function Zt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return gt===null?He.memoizedState=gt=e:gt=gt.next=e,gt}function yt(){if(Je===null){var e=He.alternate;e=e!==null?e.memoizedState:null}else e=Je.next;var t=gt===null?He.memoizedState:gt.next;if(t!==null)gt=t,Je=e;else{if(e===null)throw He.alternate===null?Error(i(467)):Error(i(310));Je=e,e={memoizedState:Je.memoizedState,baseState:Je.baseState,baseQueue:Je.baseQueue,queue:Je.queue,next:null},gt===null?He.memoizedState=gt=e:gt=gt.next=e}return gt}function Wc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Kl(e){var t=Ql;return Ql+=1,Us===null&&(Us=[]),e=vh(Us,e,t),t=He,(gt===null?t.memoizedState:gt.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?im:cm),e}function Co(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Kl(e);if(e.$$typeof===q)return Bt(e)}throw Error(i(438,String(e)))}function Qc(e){var t=null,a=He.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var l=He.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Wc(),He.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),l=0;l<e;l++)a[l]=K;return t.index++,a}function Gn(e,t){return typeof t=="function"?t(e):t}function To(e){var t=yt();return Kc(t,Je,e)}function Kc(e,t,a){var l=e.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=a;var c=e.baseQueue,d=l.pending;if(d!==null){if(c!==null){var y=c.next;c.next=d.next,d.next=y}t.baseQueue=c=d,l.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var w=y=null,O=null,J=t,ce=!1;do{var fe=J.lane&-536870913;if(fe!==J.lane?(Ye&fe)===fe:(ga&fe)===fe){var P=J.revertLane;if(P===0)O!==null&&(O=O.next={lane:0,revertLane:0,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),fe===Os&&(ce=!0);else if((ga&P)===P){J=J.next,P===Os&&(ce=!0);continue}else fe={lane:0,revertLane:J.revertLane,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},O===null?(w=O=fe,y=d):O=O.next=fe,He.lanes|=P,Sa|=P;fe=J.action,as&&a(d,fe),d=J.hasEagerState?J.eagerState:a(d,fe)}else P={lane:fe,revertLane:J.revertLane,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},O===null?(w=O=P,y=d):O=O.next=P,He.lanes|=fe,Sa|=fe;J=J.next}while(J!==null&&J!==t);if(O===null?y=d:O.next=w,!It(d,e.memoizedState)&&(St=!0,ce&&(a=Ds,a!==null)))throw a;e.memoizedState=d,e.baseState=y,e.baseQueue=O,l.lastRenderedState=d}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Jc(e){var t=yt(),a=t.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var l=a.dispatch,c=a.pending,d=t.memoizedState;if(c!==null){a.pending=null;var y=c=c.next;do d=e(d,y.action),y=y.next;while(y!==c);It(d,t.memoizedState)||(St=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),a.lastRenderedState=d}return[d,l]}function Ch(e,t,a){var l=He,c=yt(),d=Ze;if(d){if(a===void 0)throw Error(i(407));a=a()}else a=t();var y=!It((Je||c).memoizedState,a);y&&(c.memoizedState=a,St=!0),c=c.queue;var w=Ah.bind(null,l,c,e);if(Jl(2048,8,w,[e]),c.getSnapshot!==t||y||gt!==null&&gt.memoizedState.tag&1){if(l.flags|=2048,Bs(9,Mo(),Mh.bind(null,l,c,a,t),null),et===null)throw Error(i(349));d||(ga&124)!==0||Th(l,t,a)}return a}function Th(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=He.updateQueue,t===null?(t=Wc(),He.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Mh(e,t,a,l){t.value=a,t.getSnapshot=l,Rh(t)&&zh(e)}function Ah(e,t,a){return a(function(){Rh(t)&&zh(e)})}function Rh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!It(e,a)}catch{return!0}}function zh(e){var t=Ms(e,2);t!==null&&an(t,e,2)}function Ic(e){var t=Zt();if(typeof e=="function"){var a=e;if(e=a(),as){pt(!0);try{a()}finally{pt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gn,lastRenderedState:e},t}function Oh(e,t,a,l){return e.baseState=a,Kc(e,Je,typeof l=="function"?l:Gn)}function w1(e,t,a,l,c){if(Ro(e))throw Error(i(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){d.listeners.push(y)}};E.T!==null?a(!0):d.isTransition=!1,l(d),a=t.pending,a===null?(d.next=t.pending=d,Dh(t,d)):(d.next=a.next,t.pending=a.next=d)}}function Dh(e,t){var a=t.action,l=t.payload,c=e.state;if(t.isTransition){var d=E.T,y={};E.T=y;try{var w=a(c,l),O=E.S;O!==null&&O(y,w),Hh(e,t,w)}catch(J){Fc(e,t,J)}finally{E.T=d}}else try{d=a(c,l),Hh(e,t,d)}catch(J){Fc(e,t,J)}}function Hh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){$h(e,t,l)},function(l){return Fc(e,t,l)}):$h(e,t,a)}function $h(e,t,a){t.status="fulfilled",t.value=a,Uh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Dh(e,a)))}function Fc(e,t,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=a,Uh(t),t=t.next;while(t!==l)}e.action=null}function Uh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Bh(e,t){return t}function qh(e,t){if(Ze){var a=et.formState;if(a!==null){e:{var l=He;if(Ze){if(ot){t:{for(var c=ot,d=Cn;c.nodeType!==8;){if(!d){c=null;break t}if(c=Nn(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){ot=Nn(c.nextSibling),l=c.data==="F!";break e}}Pa(l)}l=!1}l&&(t=a[0])}}return a=Zt(),a.memoizedState=a.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bh,lastRenderedState:t},a.queue=l,a=lm.bind(null,He,l),l.dispatch=a,l=Ic(!1),d=au.bind(null,He,!1,l.queue),l=Zt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,a=w1.bind(null,He,c,d,a),c.dispatch=a,l.memoizedState=e,[t,a,!1]}function Lh(e){var t=yt();return Yh(t,Je,e)}function Yh(e,t,a){if(t=Kc(e,t,Bh)[0],e=To(Gn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Kl(t)}catch(y){throw y===Vl?wo:y}else l=t;t=yt();var c=t.queue,d=c.dispatch;return a!==t.memoizedState&&(He.flags|=2048,Bs(9,Mo(),S1.bind(null,c,a),null)),[l,d,e]}function S1(e,t){e.action=t}function Vh(e){var t=yt(),a=Je;if(a!==null)return Yh(t,a,e);yt(),t=t.memoizedState,a=yt();var l=a.queue.dispatch;return a.memoizedState=e,[t,l,!1]}function Bs(e,t,a,l){return e={tag:e,create:a,deps:l,inst:t,next:null},t=He.updateQueue,t===null&&(t=Wc(),He.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,t.lastEffect=e),e}function Mo(){return{destroy:void 0,resource:void 0}}function Gh(){return yt().memoizedState}function Ao(e,t,a,l){var c=Zt();l=l===void 0?null:l,He.flags|=e,c.memoizedState=Bs(1|t,Mo(),a,l)}function Jl(e,t,a,l){var c=yt();l=l===void 0?null:l;var d=c.memoizedState.inst;Je!==null&&l!==null&&Yc(l,Je.memoizedState.deps)?c.memoizedState=Bs(t,d,a,l):(He.flags|=e,c.memoizedState=Bs(1|t,d,a,l))}function Xh(e,t){Ao(8390656,8,e,t)}function Zh(e,t){Jl(2048,8,e,t)}function Wh(e,t){return Jl(4,2,e,t)}function Qh(e,t){return Jl(4,4,e,t)}function Kh(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Jh(e,t,a){a=a!=null?a.concat([e]):null,Jl(4,4,Kh.bind(null,t,e),a)}function Pc(){}function Ih(e,t){var a=yt();t=t===void 0?null:t;var l=a.memoizedState;return t!==null&&Yc(t,l[1])?l[0]:(a.memoizedState=[e,t],e)}function Fh(e,t){var a=yt();t=t===void 0?null:t;var l=a.memoizedState;if(t!==null&&Yc(t,l[1]))return l[0];if(l=e(),as){pt(!0);try{e()}finally{pt(!1)}}return a.memoizedState=[l,t],l}function eu(e,t,a){return a===void 0||(ga&1073741824)!==0?e.memoizedState=t:(e.memoizedState=a,e=tp(),He.lanes|=e,Sa|=e,a)}function Ph(e,t,a,l){return It(a,t)?a:Hs.current!==null?(e=eu(e,a,l),It(e,t)||(St=!0),e):(ga&42)===0?(St=!0,e.memoizedState=a):(e=tp(),He.lanes|=e,Sa|=e,t)}function em(e,t,a,l,c){var d=$.p;$.p=d!==0&&8>d?d:8;var y=E.T,w={};E.T=w,au(e,!1,t,a);try{var O=c(),J=E.S;if(J!==null&&J(w,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var ce=v1(O,l);Il(e,t,ce,nn(e))}else Il(e,t,l,nn(e))}catch(fe){Il(e,t,{then:function(){},status:"rejected",reason:fe},nn())}finally{$.p=d,E.T=y}}function E1(){}function tu(e,t,a,l){if(e.tag!==5)throw Error(i(476));var c=tm(e).queue;em(e,c,t,T,a===null?E1:function(){return nm(e),a(l)})}function tm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:T,baseState:T,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gn,lastRenderedState:T},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gn,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function nm(e){var t=tm(e).next.queue;Il(e,t,{},nn())}function nu(){return Bt(pr)}function am(){return yt().memoizedState}function sm(){return yt().memoizedState}function k1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=nn();e=pa(a);var l=xa(t,e,a);l!==null&&(an(l,t,a),Xl(l,t,a)),t={cache:Rc()},e.payload=t;return}t=t.return}}function _1(e,t,a){var l=nn();a={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null},Ro(e)?rm(t,a):(a=Nc(e,t,a,l),a!==null&&(an(a,e,l),om(a,t,l)))}function lm(e,t,a){var l=nn();Il(e,t,a,l)}function Il(e,t,a,l){var c={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ro(e))rm(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var y=t.lastRenderedState,w=d(y,a);if(c.hasEagerState=!0,c.eagerState=w,It(w,y))return po(e,t,c,0),et===null&&mo(),!1}catch{}finally{}if(a=Nc(e,t,c,l),a!==null)return an(a,e,l),om(a,t,l),!0}return!1}function au(e,t,a,l){if(l={lane:2,revertLane:Du(),action:l,hasEagerState:!1,eagerState:null,next:null},Ro(e)){if(t)throw Error(i(479))}else t=Nc(e,a,l,2),t!==null&&an(t,e,2)}function Ro(e){var t=e.alternate;return e===He||t!==null&&t===He}function rm(e,t){$s=ko=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function om(e,t,a){if((a&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,Kr(e,a)}}var zo={readContext:Bt,use:Co,useCallback:ht,useContext:ht,useEffect:ht,useImperativeHandle:ht,useLayoutEffect:ht,useInsertionEffect:ht,useMemo:ht,useReducer:ht,useRef:ht,useState:ht,useDebugValue:ht,useDeferredValue:ht,useTransition:ht,useSyncExternalStore:ht,useId:ht,useHostTransitionStatus:ht,useFormState:ht,useActionState:ht,useOptimistic:ht,useMemoCache:ht,useCacheRefresh:ht},im={readContext:Bt,use:Co,useCallback:function(e,t){return Zt().memoizedState=[e,t===void 0?null:t],e},useContext:Bt,useEffect:Xh,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Ao(4194308,4,Kh.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Ao(4194308,4,e,t)},useInsertionEffect:function(e,t){Ao(4,2,e,t)},useMemo:function(e,t){var a=Zt();t=t===void 0?null:t;var l=e();if(as){pt(!0);try{e()}finally{pt(!1)}}return a.memoizedState=[l,t],l},useReducer:function(e,t,a){var l=Zt();if(a!==void 0){var c=a(t);if(as){pt(!0);try{a(t)}finally{pt(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=_1.bind(null,He,e),[l.memoizedState,e]},useRef:function(e){var t=Zt();return e={current:e},t.memoizedState=e},useState:function(e){e=Ic(e);var t=e.queue,a=lm.bind(null,He,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Pc,useDeferredValue:function(e,t){var a=Zt();return eu(a,e,t)},useTransition:function(){var e=Ic(!1);return e=em.bind(null,He,e.queue,!0,!1),Zt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var l=He,c=Zt();if(Ze){if(a===void 0)throw Error(i(407));a=a()}else{if(a=t(),et===null)throw Error(i(349));(Ye&124)!==0||Th(l,t,a)}c.memoizedState=a;var d={value:a,getSnapshot:t};return c.queue=d,Xh(Ah.bind(null,l,d,e),[e]),l.flags|=2048,Bs(9,Mo(),Mh.bind(null,l,d,a,t),null),a},useId:function(){var e=Zt(),t=et.identifierPrefix;if(Ze){var a=Ln,l=qn;a=(l&~(1<<32-at(l)-1)).toString(32)+a,t="«"+t+"R"+a,a=_o++,0<a&&(t+="H"+a.toString(32)),t+="»"}else a=j1++,t="«"+t+"r"+a.toString(32)+"»";return e.memoizedState=t},useHostTransitionStatus:nu,useFormState:qh,useActionState:qh,useOptimistic:function(e){var t=Zt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=au.bind(null,He,!0,a),a.dispatch=t,[e,t]},useMemoCache:Qc,useCacheRefresh:function(){return Zt().memoizedState=k1.bind(null,He)}},cm={readContext:Bt,use:Co,useCallback:Ih,useContext:Bt,useEffect:Zh,useImperativeHandle:Jh,useInsertionEffect:Wh,useLayoutEffect:Qh,useMemo:Fh,useReducer:To,useRef:Gh,useState:function(){return To(Gn)},useDebugValue:Pc,useDeferredValue:function(e,t){var a=yt();return Ph(a,Je.memoizedState,e,t)},useTransition:function(){var e=To(Gn)[0],t=yt().memoizedState;return[typeof e=="boolean"?e:Kl(e),t]},useSyncExternalStore:Ch,useId:am,useHostTransitionStatus:nu,useFormState:Lh,useActionState:Lh,useOptimistic:function(e,t){var a=yt();return Oh(a,Je,e,t)},useMemoCache:Qc,useCacheRefresh:sm},C1={readContext:Bt,use:Co,useCallback:Ih,useContext:Bt,useEffect:Zh,useImperativeHandle:Jh,useInsertionEffect:Wh,useLayoutEffect:Qh,useMemo:Fh,useReducer:Jc,useRef:Gh,useState:function(){return Jc(Gn)},useDebugValue:Pc,useDeferredValue:function(e,t){var a=yt();return Je===null?eu(a,e,t):Ph(a,Je.memoizedState,e,t)},useTransition:function(){var e=Jc(Gn)[0],t=yt().memoizedState;return[typeof e=="boolean"?e:Kl(e),t]},useSyncExternalStore:Ch,useId:am,useHostTransitionStatus:nu,useFormState:Vh,useActionState:Vh,useOptimistic:function(e,t){var a=yt();return Je!==null?Oh(a,Je,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Qc,useCacheRefresh:sm},qs=null,Fl=0;function Oo(e){var t=Fl;return Fl+=1,qs===null&&(qs=[]),vh(qs,e,t)}function Pl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Do(e,t){throw t.$$typeof===b?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function um(e){var t=e._init;return t(e._payload)}function dm(e){function t(G,U){if(e){var Q=G.deletions;Q===null?(G.deletions=[U],G.flags|=16):Q.push(U)}}function a(G,U){if(!e)return null;for(;U!==null;)t(G,U),U=U.sibling;return null}function l(G){for(var U=new Map;G!==null;)G.key!==null?U.set(G.key,G):U.set(G.index,G),G=G.sibling;return U}function c(G,U){return G=Bn(G,U),G.index=0,G.sibling=null,G}function d(G,U,Q){return G.index=Q,e?(Q=G.alternate,Q!==null?(Q=Q.index,Q<U?(G.flags|=67108866,U):Q):(G.flags|=67108866,U)):(G.flags|=1048576,U)}function y(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function w(G,U,Q,de){return U===null||U.tag!==6?(U=Sc(Q,G.mode,de),U.return=G,U):(U=c(U,Q),U.return=G,U)}function O(G,U,Q,de){var ye=Q.type;return ye===C?ce(G,U,Q.props.children,de,Q.key):U!==null&&(U.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===oe&&um(ye)===U.type)?(U=c(U,Q.props),Pl(U,Q),U.return=G,U):(U=go(Q.type,Q.key,Q.props,null,G.mode,de),Pl(U,Q),U.return=G,U)}function J(G,U,Q,de){return U===null||U.tag!==4||U.stateNode.containerInfo!==Q.containerInfo||U.stateNode.implementation!==Q.implementation?(U=Ec(Q,G.mode,de),U.return=G,U):(U=c(U,Q.children||[]),U.return=G,U)}function ce(G,U,Q,de,ye){return U===null||U.tag!==7?(U=Ka(Q,G.mode,de,ye),U.return=G,U):(U=c(U,Q),U.return=G,U)}function fe(G,U,Q){if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return U=Sc(""+U,G.mode,Q),U.return=G,U;if(typeof U=="object"&&U!==null){switch(U.$$typeof){case v:return Q=go(U.type,U.key,U.props,null,G.mode,Q),Pl(Q,U),Q.return=G,Q;case N:return U=Ec(U,G.mode,Q),U.return=G,U;case oe:var de=U._init;return U=de(U._payload),fe(G,U,Q)}if(W(U)||te(U))return U=Ka(U,G.mode,Q,null),U.return=G,U;if(typeof U.then=="function")return fe(G,Oo(U),Q);if(U.$$typeof===q)return fe(G,jo(G,U),Q);Do(G,U)}return null}function P(G,U,Q,de){var ye=U!==null?U.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return ye!==null?null:w(G,U,""+Q,de);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case v:return Q.key===ye?O(G,U,Q,de):null;case N:return Q.key===ye?J(G,U,Q,de):null;case oe:return ye=Q._init,Q=ye(Q._payload),P(G,U,Q,de)}if(W(Q)||te(Q))return ye!==null?null:ce(G,U,Q,de,null);if(typeof Q.then=="function")return P(G,U,Oo(Q),de);if(Q.$$typeof===q)return P(G,U,jo(G,Q),de);Do(G,Q)}return null}function ne(G,U,Q,de,ye){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return G=G.get(Q)||null,w(U,G,""+de,ye);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case v:return G=G.get(de.key===null?Q:de.key)||null,O(U,G,de,ye);case N:return G=G.get(de.key===null?Q:de.key)||null,J(U,G,de,ye);case oe:var $e=de._init;return de=$e(de._payload),ne(G,U,Q,de,ye)}if(W(de)||te(de))return G=G.get(Q)||null,ce(U,G,de,ye,null);if(typeof de.then=="function")return ne(G,U,Q,Oo(de),ye);if(de.$$typeof===q)return ne(G,U,Q,jo(U,de),ye);Do(U,de)}return null}function Me(G,U,Q,de){for(var ye=null,$e=null,we=U,Ce=U=0,kt=null;we!==null&&Ce<Q.length;Ce++){we.index>Ce?(kt=we,we=null):kt=we.sibling;var Xe=P(G,we,Q[Ce],de);if(Xe===null){we===null&&(we=kt);break}e&&we&&Xe.alternate===null&&t(G,we),U=d(Xe,U,Ce),$e===null?ye=Xe:$e.sibling=Xe,$e=Xe,we=kt}if(Ce===Q.length)return a(G,we),Ze&&Ia(G,Ce),ye;if(we===null){for(;Ce<Q.length;Ce++)we=fe(G,Q[Ce],de),we!==null&&(U=d(we,U,Ce),$e===null?ye=we:$e.sibling=we,$e=we);return Ze&&Ia(G,Ce),ye}for(we=l(we);Ce<Q.length;Ce++)kt=ne(we,G,Ce,Q[Ce],de),kt!==null&&(e&&kt.alternate!==null&&we.delete(kt.key===null?Ce:kt.key),U=d(kt,U,Ce),$e===null?ye=kt:$e.sibling=kt,$e=kt);return e&&we.forEach(function(za){return t(G,za)}),Ze&&Ia(G,Ce),ye}function _e(G,U,Q,de){if(Q==null)throw Error(i(151));for(var ye=null,$e=null,we=U,Ce=U=0,kt=null,Xe=Q.next();we!==null&&!Xe.done;Ce++,Xe=Q.next()){we.index>Ce?(kt=we,we=null):kt=we.sibling;var za=P(G,we,Xe.value,de);if(za===null){we===null&&(we=kt);break}e&&we&&za.alternate===null&&t(G,we),U=d(za,U,Ce),$e===null?ye=za:$e.sibling=za,$e=za,we=kt}if(Xe.done)return a(G,we),Ze&&Ia(G,Ce),ye;if(we===null){for(;!Xe.done;Ce++,Xe=Q.next())Xe=fe(G,Xe.value,de),Xe!==null&&(U=d(Xe,U,Ce),$e===null?ye=Xe:$e.sibling=Xe,$e=Xe);return Ze&&Ia(G,Ce),ye}for(we=l(we);!Xe.done;Ce++,Xe=Q.next())Xe=ne(we,G,Ce,Xe.value,de),Xe!==null&&(e&&Xe.alternate!==null&&we.delete(Xe.key===null?Ce:Xe.key),U=d(Xe,U,Ce),$e===null?ye=Xe:$e.sibling=Xe,$e=Xe);return e&&we.forEach(function(Tb){return t(G,Tb)}),Ze&&Ia(G,Ce),ye}function Fe(G,U,Q,de){if(typeof Q=="object"&&Q!==null&&Q.type===C&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case v:e:{for(var ye=Q.key;U!==null;){if(U.key===ye){if(ye=Q.type,ye===C){if(U.tag===7){a(G,U.sibling),de=c(U,Q.props.children),de.return=G,G=de;break e}}else if(U.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===oe&&um(ye)===U.type){a(G,U.sibling),de=c(U,Q.props),Pl(de,Q),de.return=G,G=de;break e}a(G,U);break}else t(G,U);U=U.sibling}Q.type===C?(de=Ka(Q.props.children,G.mode,de,Q.key),de.return=G,G=de):(de=go(Q.type,Q.key,Q.props,null,G.mode,de),Pl(de,Q),de.return=G,G=de)}return y(G);case N:e:{for(ye=Q.key;U!==null;){if(U.key===ye)if(U.tag===4&&U.stateNode.containerInfo===Q.containerInfo&&U.stateNode.implementation===Q.implementation){a(G,U.sibling),de=c(U,Q.children||[]),de.return=G,G=de;break e}else{a(G,U);break}else t(G,U);U=U.sibling}de=Ec(Q,G.mode,de),de.return=G,G=de}return y(G);case oe:return ye=Q._init,Q=ye(Q._payload),Fe(G,U,Q,de)}if(W(Q))return Me(G,U,Q,de);if(te(Q)){if(ye=te(Q),typeof ye!="function")throw Error(i(150));return Q=ye.call(Q),_e(G,U,Q,de)}if(typeof Q.then=="function")return Fe(G,U,Oo(Q),de);if(Q.$$typeof===q)return Fe(G,U,jo(G,Q),de);Do(G,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,U!==null&&U.tag===6?(a(G,U.sibling),de=c(U,Q),de.return=G,G=de):(a(G,U),de=Sc(Q,G.mode,de),de.return=G,G=de),y(G)):a(G,U)}return function(G,U,Q,de){try{Fl=0;var ye=Fe(G,U,Q,de);return qs=null,ye}catch(we){if(we===Vl||we===wo)throw we;var $e=Ft(29,we,null,G.mode);return $e.lanes=de,$e.return=G,$e}finally{}}}var Ls=dm(!0),fm=dm(!1),mn=D(null),Tn=null;function ya(e){var t=e.alternate;F(vt,vt.current&1),F(mn,e),Tn===null&&(t===null||Hs.current!==null||t.memoizedState!==null)&&(Tn=e)}function hm(e){if(e.tag===22){if(F(vt,vt.current),F(mn,e),Tn===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(Tn=e)}}else ba()}function ba(){F(vt,vt.current),F(mn,mn.current)}function Xn(e){L(mn),Tn===e&&(Tn=null),L(vt)}var vt=D(0);function Ho(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||Wu(a)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function su(e,t,a,l){t=e.memoizedState,a=a(l,t),a=a==null?t:p({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var lu={enqueueSetState:function(e,t,a){e=e._reactInternals;var l=nn(),c=pa(l);c.payload=t,a!=null&&(c.callback=a),t=xa(e,c,l),t!==null&&(an(t,e,l),Xl(t,e,l))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var l=nn(),c=pa(l);c.tag=1,c.payload=t,a!=null&&(c.callback=a),t=xa(e,c,l),t!==null&&(an(t,e,l),Xl(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=nn(),l=pa(a);l.tag=2,t!=null&&(l.callback=t),t=xa(e,l,a),t!==null&&(an(t,e,a),Xl(t,e,a))}};function mm(e,t,a,l,c,d,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,d,y):t.prototype&&t.prototype.isPureReactComponent?!Dl(a,l)||!Dl(c,d):!0}function pm(e,t,a,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,l),t.state!==e&&lu.enqueueReplaceState(t,t.state,null)}function ss(e,t){var a=t;if("ref"in t){a={};for(var l in t)l!=="ref"&&(a[l]=t[l])}if(e=e.defaultProps){a===t&&(a=p({},a));for(var c in e)a[c]===void 0&&(a[c]=e[c])}return a}var $o=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function xm(e){$o(e)}function gm(e){console.error(e)}function ym(e){$o(e)}function Uo(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function bm(e,t,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function ru(e,t,a){return a=pa(a),a.tag=3,a.payload={element:null},a.callback=function(){Uo(e,t)},a}function vm(e){return e=pa(e),e.tag=3,e}function jm(e,t,a,l){var c=a.type.getDerivedStateFromError;if(typeof c=="function"){var d=l.value;e.payload=function(){return c(d)},e.callback=function(){bm(t,a,l)}}var y=a.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){bm(t,a,l),typeof c!="function"&&(Ea===null?Ea=new Set([this]):Ea.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function T1(e,t,a,l,c){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=a.alternate,t!==null&&ql(t,a,c,!0),a=mn.current,a!==null){switch(a.tag){case 13:return Tn===null?Mu():a.alternate===null&&it===0&&(it=3),a.flags&=-257,a.flags|=65536,a.lanes=c,l===Dc?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([l]):t.add(l),Ru(e,l,c)),!1;case 22:return a.flags|=65536,l===Dc?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([l]):a.add(l)),Ru(e,l,c)),!1}throw Error(i(435,a.tag))}return Ru(e,l,c),Mu(),!1}if(Ze)return t=mn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==Cc&&(e=Error(i(422),{cause:l}),Bl(un(e,a)))):(l!==Cc&&(t=Error(i(423),{cause:l}),Bl(un(t,a))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=un(l,a),c=ru(e.stateNode,l,c),Uc(e,c),it!==4&&(it=2)),!1;var d=Error(i(520),{cause:l});if(d=un(d,a),rr===null?rr=[d]:rr.push(d),it!==4&&(it=2),t===null)return!0;l=un(l,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=c&-c,a.lanes|=e,e=ru(a.stateNode,l,e),Uc(a,e),!1;case 1:if(t=a.type,d=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(Ea===null||!Ea.has(d))))return a.flags|=65536,c&=-c,a.lanes|=c,c=vm(c),jm(c,e,a,l),Uc(a,c),!1}a=a.return}while(a!==null);return!1}var Nm=Error(i(461)),St=!1;function zt(e,t,a,l){t.child=e===null?fm(t,null,a,l):Ls(t,e.child,a,l)}function wm(e,t,a,l,c){a=a.render;var d=t.ref;if("ref"in l){var y={};for(var w in l)w!=="ref"&&(y[w]=l[w])}else y=l;return ts(t),l=Vc(e,t,a,y,d,c),w=Gc(),e!==null&&!St?(Xc(e,t,c),Zn(e,t,c)):(Ze&&w&&kc(t),t.flags|=1,zt(e,t,l,c),t.child)}function Sm(e,t,a,l,c){if(e===null){var d=a.type;return typeof d=="function"&&!wc(d)&&d.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=d,Em(e,t,d,l,c)):(e=go(a.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!mu(e,c)){var y=d.memoizedProps;if(a=a.compare,a=a!==null?a:Dl,a(y,l)&&e.ref===t.ref)return Zn(e,t,c)}return t.flags|=1,e=Bn(d,l),e.ref=t.ref,e.return=t,t.child=e}function Em(e,t,a,l,c){if(e!==null){var d=e.memoizedProps;if(Dl(d,l)&&e.ref===t.ref)if(St=!1,t.pendingProps=l=d,mu(e,c))(e.flags&131072)!==0&&(St=!0);else return t.lanes=e.lanes,Zn(e,t,c)}return ou(e,t,a,l,c)}function km(e,t,a){var l=t.pendingProps,c=l.children,d=e!==null?e.memoizedState:null;if(l.mode==="hidden"){if((t.flags&128)!==0){if(l=d!==null?d.baseLanes|a:a,e!==null){for(c=t.child=e.child,d=0;c!==null;)d=d|c.lanes|c.childLanes,c=c.sibling;t.childLanes=d&~l}else t.childLanes=0,t.child=null;return _m(e,t,l,a)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&No(t,d!==null?d.cachePool:null),d!==null?Eh(t,d):qc(),hm(t);else return t.lanes=t.childLanes=536870912,_m(e,t,d!==null?d.baseLanes|a:a,a)}else d!==null?(No(t,d.cachePool),Eh(t,d),ba(),t.memoizedState=null):(e!==null&&No(t,null),qc(),ba());return zt(e,t,c,a),t.child}function _m(e,t,a,l){var c=Oc();return c=c===null?null:{parent:bt._currentValue,pool:c},t.memoizedState={baseLanes:a,cachePool:c},e!==null&&No(t,null),qc(),hm(t),e!==null&&ql(e,t,l,!0),null}function Bo(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function ou(e,t,a,l,c){return ts(t),a=Vc(e,t,a,l,void 0,c),l=Gc(),e!==null&&!St?(Xc(e,t,c),Zn(e,t,c)):(Ze&&l&&kc(t),t.flags|=1,zt(e,t,a,c),t.child)}function Cm(e,t,a,l,c,d){return ts(t),t.updateQueue=null,a=_h(t,l,a,c),kh(e),l=Gc(),e!==null&&!St?(Xc(e,t,d),Zn(e,t,d)):(Ze&&l&&kc(t),t.flags|=1,zt(e,t,a,d),t.child)}function Tm(e,t,a,l,c){if(ts(t),t.stateNode===null){var d=As,y=a.contextType;typeof y=="object"&&y!==null&&(d=Bt(y)),d=new a(l,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=lu,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=l,d.state=t.memoizedState,d.refs={},Hc(t),y=a.contextType,d.context=typeof y=="object"&&y!==null?Bt(y):As,d.state=t.memoizedState,y=a.getDerivedStateFromProps,typeof y=="function"&&(su(t,a,y,l),d.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(y=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),y!==d.state&&lu.enqueueReplaceState(d,d.state,null),Wl(t,l,d,c),Zl(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){d=t.stateNode;var w=t.memoizedProps,O=ss(a,w);d.props=O;var J=d.context,ce=a.contextType;y=As,typeof ce=="object"&&ce!==null&&(y=Bt(ce));var fe=a.getDerivedStateFromProps;ce=typeof fe=="function"||typeof d.getSnapshotBeforeUpdate=="function",w=t.pendingProps!==w,ce||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(w||J!==y)&&pm(t,d,l,y),ma=!1;var P=t.memoizedState;d.state=P,Wl(t,l,d,c),Zl(),J=t.memoizedState,w||P!==J||ma?(typeof fe=="function"&&(su(t,a,fe,l),J=t.memoizedState),(O=ma||mm(t,a,O,l,P,J,y))?(ce||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=J),d.props=l,d.state=J,d.context=y,l=O):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{d=t.stateNode,$c(e,t),y=t.memoizedProps,ce=ss(a,y),d.props=ce,fe=t.pendingProps,P=d.context,J=a.contextType,O=As,typeof J=="object"&&J!==null&&(O=Bt(J)),w=a.getDerivedStateFromProps,(J=typeof w=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(y!==fe||P!==O)&&pm(t,d,l,O),ma=!1,P=t.memoizedState,d.state=P,Wl(t,l,d,c),Zl();var ne=t.memoizedState;y!==fe||P!==ne||ma||e!==null&&e.dependencies!==null&&vo(e.dependencies)?(typeof w=="function"&&(su(t,a,w,l),ne=t.memoizedState),(ce=ma||mm(t,a,ce,l,P,ne,O)||e!==null&&e.dependencies!==null&&vo(e.dependencies))?(J||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(l,ne,O),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(l,ne,O)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&P===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&P===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=ne),d.props=l,d.state=ne,d.context=O,l=ce):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&P===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&P===e.memoizedState||(t.flags|=1024),l=!1)}return d=l,Bo(e,t),l=(t.flags&128)!==0,d||l?(d=t.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&l?(t.child=Ls(t,e.child,null,c),t.child=Ls(t,null,a,c)):zt(e,t,a,c),t.memoizedState=d.state,e=t.child):e=Zn(e,t,c),e}function Mm(e,t,a,l){return Ul(),t.flags|=256,zt(e,t,a,l),t.child}var iu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function cu(e){return{baseLanes:e,cachePool:gh()}}function uu(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=pn),e}function Am(e,t,a){var l=t.pendingProps,c=!1,d=(t.flags&128)!==0,y;if((y=d)||(y=e!==null&&e.memoizedState===null?!1:(vt.current&2)!==0),y&&(c=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ze){if(c?ya(t):ba(),Ze){var w=ot,O;if(O=w){e:{for(O=w,w=Cn;O.nodeType!==8;){if(!w){w=null;break e}if(O=Nn(O.nextSibling),O===null){w=null;break e}}w=O}w!==null?(t.memoizedState={dehydrated:w,treeContext:Ja!==null?{id:qn,overflow:Ln}:null,retryLane:536870912,hydrationErrors:null},O=Ft(18,null,null,0),O.stateNode=w,O.return=t,t.child=O,Gt=t,ot=null,O=!0):O=!1}O||Pa(t)}if(w=t.memoizedState,w!==null&&(w=w.dehydrated,w!==null))return Wu(w)?t.lanes=32:t.lanes=536870912,null;Xn(t)}return w=l.children,l=l.fallback,c?(ba(),c=t.mode,w=qo({mode:"hidden",children:w},c),l=Ka(l,c,a,null),w.return=t,l.return=t,w.sibling=l,t.child=w,c=t.child,c.memoizedState=cu(a),c.childLanes=uu(e,y,a),t.memoizedState=iu,l):(ya(t),du(t,w))}if(O=e.memoizedState,O!==null&&(w=O.dehydrated,w!==null)){if(d)t.flags&256?(ya(t),t.flags&=-257,t=fu(e,t,a)):t.memoizedState!==null?(ba(),t.child=e.child,t.flags|=128,t=null):(ba(),c=l.fallback,w=t.mode,l=qo({mode:"visible",children:l.children},w),c=Ka(c,w,a,null),c.flags|=2,l.return=t,c.return=t,l.sibling=c,t.child=l,Ls(t,e.child,null,a),l=t.child,l.memoizedState=cu(a),l.childLanes=uu(e,y,a),t.memoizedState=iu,t=c);else if(ya(t),Wu(w)){if(y=w.nextSibling&&w.nextSibling.dataset,y)var J=y.dgst;y=J,l=Error(i(419)),l.stack="",l.digest=y,Bl({value:l,source:null,stack:null}),t=fu(e,t,a)}else if(St||ql(e,t,a,!1),y=(a&e.childLanes)!==0,St||y){if(y=et,y!==null&&(l=a&-a,l=(l&42)!==0?1:wl(l),l=(l&(y.suspendedLanes|a))!==0?0:l,l!==0&&l!==O.retryLane))throw O.retryLane=l,Ms(e,l),an(y,e,l),Nm;w.data==="$?"||Mu(),t=fu(e,t,a)}else w.data==="$?"?(t.flags|=192,t.child=e.child,t=null):(e=O.treeContext,ot=Nn(w.nextSibling),Gt=t,Ze=!0,Fa=null,Cn=!1,e!==null&&(fn[hn++]=qn,fn[hn++]=Ln,fn[hn++]=Ja,qn=e.id,Ln=e.overflow,Ja=t),t=du(t,l.children),t.flags|=4096);return t}return c?(ba(),c=l.fallback,w=t.mode,O=e.child,J=O.sibling,l=Bn(O,{mode:"hidden",children:l.children}),l.subtreeFlags=O.subtreeFlags&65011712,J!==null?c=Bn(J,c):(c=Ka(c,w,a,null),c.flags|=2),c.return=t,l.return=t,l.sibling=c,t.child=l,l=c,c=t.child,w=e.child.memoizedState,w===null?w=cu(a):(O=w.cachePool,O!==null?(J=bt._currentValue,O=O.parent!==J?{parent:J,pool:J}:O):O=gh(),w={baseLanes:w.baseLanes|a,cachePool:O}),c.memoizedState=w,c.childLanes=uu(e,y,a),t.memoizedState=iu,l):(ya(t),a=e.child,e=a.sibling,a=Bn(a,{mode:"visible",children:l.children}),a.return=t,a.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=a,t.memoizedState=null,a)}function du(e,t){return t=qo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function qo(e,t){return e=Ft(22,e,null,t),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function fu(e,t,a){return Ls(t,e.child,null,a),e=du(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Rm(e,t,a){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Mc(e.return,t,a)}function hu(e,t,a,l,c){var d=e.memoizedState;d===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:c}:(d.isBackwards=t,d.rendering=null,d.renderingStartTime=0,d.last=l,d.tail=a,d.tailMode=c)}function zm(e,t,a){var l=t.pendingProps,c=l.revealOrder,d=l.tail;if(zt(e,t,l.children,a),l=vt.current,(l&2)!==0)l=l&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Rm(e,a,t);else if(e.tag===19)Rm(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}l&=1}switch(F(vt,l),c){case"forwards":for(a=t.child,c=null;a!==null;)e=a.alternate,e!==null&&Ho(e)===null&&(c=a),a=a.sibling;a=c,a===null?(c=t.child,t.child=null):(c=a.sibling,a.sibling=null),hu(t,!1,c,a,d);break;case"backwards":for(a=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Ho(e)===null){t.child=c;break}e=c.sibling,c.sibling=a,a=c,c=e}hu(t,!0,a,null,d);break;case"together":hu(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Zn(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Sa|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(ql(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,a=Bn(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Bn(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function mu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&vo(e)))}function M1(e,t,a){switch(t.tag){case 3:ve(t,t.stateNode.containerInfo),ha(t,bt,e.memoizedState.cache),Ul();break;case 27:case 5:Re(t);break;case 4:ve(t,t.stateNode.containerInfo);break;case 10:ha(t,t.type,t.memoizedProps.value);break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(ya(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Am(e,t,a):(ya(t),e=Zn(e,t,a),e!==null?e.sibling:null);ya(t);break;case 19:var c=(e.flags&128)!==0;if(l=(a&t.childLanes)!==0,l||(ql(e,t,a,!1),l=(a&t.childLanes)!==0),c){if(l)return zm(e,t,a);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),F(vt,vt.current),l)break;return null;case 22:case 23:return t.lanes=0,km(e,t,a);case 24:ha(t,bt,e.memoizedState.cache)}return Zn(e,t,a)}function Om(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)St=!0;else{if(!mu(e,a)&&(t.flags&128)===0)return St=!1,M1(e,t,a);St=(e.flags&131072)!==0}else St=!1,Ze&&(t.flags&1048576)!==0&&uh(t,bo,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var l=t.elementType,c=l._init;if(l=c(l._payload),t.type=l,typeof l=="function")wc(l)?(e=ss(l,e),t.tag=1,t=Tm(null,t,l,e,a)):(t.tag=0,t=ou(null,t,l,e,a));else{if(l!=null){if(c=l.$$typeof,c===M){t.tag=11,t=wm(null,t,l,e,a);break e}else if(c===X){t.tag=14,t=Sm(null,t,l,e,a);break e}}throw t=_(l)||l,Error(i(306,t,""))}}return t;case 0:return ou(e,t,t.type,t.pendingProps,a);case 1:return l=t.type,c=ss(l,t.pendingProps),Tm(e,t,l,c,a);case 3:e:{if(ve(t,t.stateNode.containerInfo),e===null)throw Error(i(387));l=t.pendingProps;var d=t.memoizedState;c=d.element,$c(e,t),Wl(t,l,null,a);var y=t.memoizedState;if(l=y.cache,ha(t,bt,l),l!==d.cache&&Ac(t,[bt],a,!0),Zl(),l=y.element,d.isDehydrated)if(d={element:l,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=Mm(e,t,l,a);break e}else if(l!==c){c=un(Error(i(424)),t),Bl(c),t=Mm(e,t,l,a);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ot=Nn(e.firstChild),Gt=t,Ze=!0,Fa=null,Cn=!0,a=fm(t,null,l,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ul(),l===c){t=Zn(e,t,a);break e}zt(e,t,l,a)}t=t.child}return t;case 26:return Bo(e,t),e===null?(a=Up(t.type,null,t.pendingProps,null))?t.memoizedState=a:Ze||(a=t.type,e=t.pendingProps,l=ei(me.current).createElement(a),l[wt]=t,l[Ut]=e,Dt(l,a,e),xt(l),t.stateNode=l):t.memoizedState=Up(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Re(t),e===null&&Ze&&(l=t.stateNode=Dp(t.type,t.pendingProps,me.current),Gt=t,Cn=!0,c=ot,Ca(t.type)?(Qu=c,ot=Nn(l.firstChild)):ot=c),zt(e,t,t.pendingProps.children,a),Bo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ze&&((c=l=ot)&&(l=sb(l,t.type,t.pendingProps,Cn),l!==null?(t.stateNode=l,Gt=t,ot=Nn(l.firstChild),Cn=!1,c=!0):c=!1),c||Pa(t)),Re(t),c=t.type,d=t.pendingProps,y=e!==null?e.memoizedProps:null,l=d.children,Gu(c,d)?l=null:y!==null&&Gu(c,y)&&(t.flags|=32),t.memoizedState!==null&&(c=Vc(e,t,N1,null,null,a),pr._currentValue=c),Bo(e,t),zt(e,t,l,a),t.child;case 6:return e===null&&Ze&&((e=a=ot)&&(a=lb(a,t.pendingProps,Cn),a!==null?(t.stateNode=a,Gt=t,ot=null,e=!0):e=!1),e||Pa(t)),null;case 13:return Am(e,t,a);case 4:return ve(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Ls(t,null,l,a):zt(e,t,l,a),t.child;case 11:return wm(e,t,t.type,t.pendingProps,a);case 7:return zt(e,t,t.pendingProps,a),t.child;case 8:return zt(e,t,t.pendingProps.children,a),t.child;case 12:return zt(e,t,t.pendingProps.children,a),t.child;case 10:return l=t.pendingProps,ha(t,t.type,l.value),zt(e,t,l.children,a),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,ts(t),c=Bt(c),l=l(c),t.flags|=1,zt(e,t,l,a),t.child;case 14:return Sm(e,t,t.type,t.pendingProps,a);case 15:return Em(e,t,t.type,t.pendingProps,a);case 19:return zm(e,t,a);case 31:return l=t.pendingProps,a=t.mode,l={mode:l.mode,children:l.children},e===null?(a=qo(l,a),a.ref=t.ref,t.child=a,a.return=t,t=a):(a=Bn(e.child,l),a.ref=t.ref,t.child=a,a.return=t,t=a),t;case 22:return km(e,t,a);case 24:return ts(t),l=Bt(bt),e===null?(c=Oc(),c===null&&(c=et,d=Rc(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=a),c=d),t.memoizedState={parent:l,cache:c},Hc(t),ha(t,bt,c)):((e.lanes&a)!==0&&($c(e,t),Wl(t,null,null,a),Zl()),c=e.memoizedState,d=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),ha(t,bt,l)):(l=d.cache,ha(t,bt,l),l!==c.cache&&Ac(t,[bt],a,!0))),zt(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Wn(e){e.flags|=4}function Dm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Vp(t)){if(t=mn.current,t!==null&&((Ye&4194048)===Ye?Tn!==null:(Ye&62914560)!==Ye&&(Ye&536870912)===0||t!==Tn))throw Gl=Dc,yh;e.flags|=8192}}function Lo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?la():536870912,e.lanes|=t,Xs|=t)}function er(e,t){if(!Ze)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function rt(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(t)for(var c=e.child;c!==null;)a|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)a|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=a,t}function A1(e,t,a){var l=t.pendingProps;switch(_c(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return rt(t),null;case 1:return rt(t),null;case 3:return a=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Vn(bt),Ae(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&($l(t)?Wn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,hh())),rt(t),null;case 26:return a=t.memoizedState,e===null?(Wn(t),a!==null?(rt(t),Dm(t,a)):(rt(t),t.flags&=-16777217)):a?a!==e.memoizedState?(Wn(t),rt(t),Dm(t,a)):(rt(t),t.flags&=-16777217):(e.memoizedProps!==l&&Wn(t),rt(t),t.flags&=-16777217),null;case 27:We(t),a=me.current;var c=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(!l){if(t.stateNode===null)throw Error(i(166));return rt(t),null}e=ie.current,$l(t)?dh(t):(e=Dp(c,l,a),t.stateNode=e,Wn(t))}return rt(t),null;case 5:if(We(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(!l){if(t.stateNode===null)throw Error(i(166));return rt(t),null}if(e=ie.current,$l(t))dh(t);else{switch(c=ei(me.current),e){case 1:e=c.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:e=c.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":e=c.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":e=c.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":e=c.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild);break;case"select":e=typeof l.is=="string"?c.createElement("select",{is:l.is}):c.createElement("select"),l.multiple?e.multiple=!0:l.size&&(e.size=l.size);break;default:e=typeof l.is=="string"?c.createElement(a,{is:l.is}):c.createElement(a)}}e[wt]=t,e[Ut]=l;e:for(c=t.child;c!==null;){if(c.tag===5||c.tag===6)e.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===t)break e;for(;c.sibling===null;){if(c.return===null||c.return===t)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}t.stateNode=e;e:switch(Dt(e,a,l),a){case"button":case"input":case"select":case"textarea":e=!!l.autoFocus;break e;case"img":e=!0;break e;default:e=!1}e&&Wn(t)}}return rt(t),t.flags&=-16777217,null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(i(166));if(e=me.current,$l(t)){if(e=t.stateNode,a=t.memoizedProps,l=null,c=Gt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[wt]=t,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||Cp(e.nodeValue,a)),e||Pa(t)}else e=ei(e).createTextNode(l),e[wt]=t,t.stateNode=e}return rt(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=$l(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(i(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(i(317));c[wt]=t}else Ul(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;rt(t),c=!1}else c=hh(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Xn(t),t):(Xn(t),null)}if(Xn(t),(t.flags&128)!==0)return t.lanes=a,t;if(a=l!==null,e=e!==null&&e.memoizedState!==null,a){l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool);var d=null;l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(d=l.memoizedState.cachePool.pool),d!==c&&(l.flags|=2048)}return a!==e&&a&&(t.child.flags|=8192),Lo(t,t.updateQueue),rt(t),null;case 4:return Ae(),e===null&&Bu(t.stateNode.containerInfo),rt(t),null;case 10:return Vn(t.type),rt(t),null;case 19:if(L(vt),c=t.memoizedState,c===null)return rt(t),null;if(l=(t.flags&128)!==0,d=c.rendering,d===null)if(l)er(c,!1);else{if(it!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=Ho(e),d!==null){for(t.flags|=128,er(c,!1),e=d.updateQueue,t.updateQueue=e,Lo(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)ch(a,e),a=a.sibling;return F(vt,vt.current&1|2),t.child}e=e.sibling}c.tail!==null&&re()>Go&&(t.flags|=128,l=!0,er(c,!1),t.lanes=4194304)}else{if(!l)if(e=Ho(d),e!==null){if(t.flags|=128,l=!0,e=e.updateQueue,t.updateQueue=e,Lo(t,e),er(c,!0),c.tail===null&&c.tailMode==="hidden"&&!d.alternate&&!Ze)return rt(t),null}else 2*re()-c.renderingStartTime>Go&&a!==536870912&&(t.flags|=128,l=!0,er(c,!1),t.lanes=4194304);c.isBackwards?(d.sibling=t.child,t.child=d):(e=c.last,e!==null?e.sibling=d:t.child=d,c.last=d)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=re(),t.sibling=null,e=vt.current,F(vt,l?e&1|2:e&1),t):(rt(t),null);case 22:case 23:return Xn(t),Lc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(a&536870912)!==0&&(t.flags&128)===0&&(rt(t),t.subtreeFlags&6&&(t.flags|=8192)):rt(t),a=t.updateQueue,a!==null&&Lo(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==a&&(t.flags|=2048),e!==null&&L(ns),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Vn(bt),rt(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function R1(e,t){switch(_c(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vn(bt),Ae(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return We(t),null;case 13:if(Xn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ul()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return L(vt),null;case 4:return Ae(),null;case 10:return Vn(t.type),null;case 22:case 23:return Xn(t),Lc(),e!==null&&L(ns),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Vn(bt),null;case 25:return null;default:return null}}function Hm(e,t){switch(_c(t),t.tag){case 3:Vn(bt),Ae();break;case 26:case 27:case 5:We(t);break;case 4:Ae();break;case 13:Xn(t);break;case 19:L(vt);break;case 10:Vn(t.type);break;case 22:case 23:Xn(t),Lc(),e!==null&&L(ns);break;case 24:Vn(bt)}}function tr(e,t){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var c=l.next;a=c;do{if((a.tag&e)===e){l=void 0;var d=a.create,y=a.inst;l=d(),y.destroy=l}a=a.next}while(a!==c)}}catch(w){Pe(t,t.return,w)}}function va(e,t,a){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var d=c.next;l=d;do{if((l.tag&e)===e){var y=l.inst,w=y.destroy;if(w!==void 0){y.destroy=void 0,c=t;var O=a,J=w;try{J()}catch(ce){Pe(c,O,ce)}}}l=l.next}while(l!==d)}}catch(ce){Pe(t,t.return,ce)}}function $m(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Sh(t,a)}catch(l){Pe(e,e.return,l)}}}function Um(e,t,a){a.props=ss(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){Pe(e,t,l)}}function nr(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(c){Pe(e,t,c)}}function Mn(e,t){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(c){Pe(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(c){Pe(e,t,c)}else a.current=null}function Bm(e){var t=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(c){Pe(e,e.return,c)}}function pu(e,t,a){try{var l=e.stateNode;P1(l,e.type,a,t),l[Ut]=t}catch(c){Pe(e,e.return,c)}}function qm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ca(e.type)||e.tag===4}function xu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ca(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function gu(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Po));else if(l!==4&&(l===27&&Ca(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(gu(e,t,a),e=e.sibling;e!==null;)gu(e,t,a),e=e.sibling}function Yo(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(l!==4&&(l===27&&Ca(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Yo(e,t,a),e=e.sibling;e!==null;)Yo(e,t,a),e=e.sibling}function Lm(e){var t=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Dt(t,l,a),t[wt]=e,t[Ut]=a}catch(d){Pe(e,e.return,d)}}var Qn=!1,mt=!1,yu=!1,Ym=typeof WeakSet=="function"?WeakSet:Set,Et=null;function z1(e,t){if(e=e.containerInfo,Yu=ri,e=Pf(e),xc(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var c=l.anchorOffset,d=l.focusNode;l=l.focusOffset;try{a.nodeType,d.nodeType}catch{a=null;break e}var y=0,w=-1,O=-1,J=0,ce=0,fe=e,P=null;t:for(;;){for(var ne;fe!==a||c!==0&&fe.nodeType!==3||(w=y+c),fe!==d||l!==0&&fe.nodeType!==3||(O=y+l),fe.nodeType===3&&(y+=fe.nodeValue.length),(ne=fe.firstChild)!==null;)P=fe,fe=ne;for(;;){if(fe===e)break t;if(P===a&&++J===c&&(w=y),P===d&&++ce===l&&(O=y),(ne=fe.nextSibling)!==null)break;fe=P,P=fe.parentNode}fe=ne}a=w===-1||O===-1?null:{start:w,end:O}}else a=null}a=a||{start:0,end:0}}else a=null;for(Vu={focusedElem:e,selectionRange:a},ri=!1,Et=t;Et!==null;)if(t=Et,e=t.child,(t.subtreeFlags&1024)!==0&&e!==null)e.return=t,Et=e;else for(;Et!==null;){switch(t=Et,d=t.alternate,e=t.flags,t.tag){case 0:break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,a=t,c=d.memoizedProps,d=d.memoizedState,l=a.stateNode;try{var Me=ss(a.type,c,a.elementType===a.type);e=l.getSnapshotBeforeUpdate(Me,d),l.__reactInternalSnapshotBeforeUpdate=e}catch(_e){Pe(a,a.return,_e)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)Zu(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Zu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,Et=e;break}Et=t.return}}function Vm(e,t,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:ja(e,a),l&4&&tr(5,a);break;case 1:if(ja(e,a),l&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(y){Pe(a,a.return,y)}else{var c=ss(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Pe(a,a.return,y)}}l&64&&$m(a),l&512&&nr(a,a.return);break;case 3:if(ja(e,a),l&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Sh(e,t)}catch(y){Pe(a,a.return,y)}}break;case 27:t===null&&l&4&&Lm(a);case 26:case 5:ja(e,a),t===null&&l&4&&Bm(a),l&512&&nr(a,a.return);break;case 12:ja(e,a);break;case 13:ja(e,a),l&4&&Zm(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Y1.bind(null,a),rb(e,a))));break;case 22:if(l=a.memoizedState!==null||Qn,!l){t=t!==null&&t.memoizedState!==null||mt,c=Qn;var d=mt;Qn=l,(mt=t)&&!d?Na(e,a,(a.subtreeFlags&8772)!==0):ja(e,a),Qn=c,mt=d}break;case 30:break;default:ja(e,a)}}function Gm(e){var t=e.alternate;t!==null&&(e.alternate=null,Gm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&kl(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var st=null,Wt=!1;function Kn(e,t,a){for(a=a.child;a!==null;)Xm(e,t,a),a=a.sibling}function Xm(e,t,a){if(nt&&typeof nt.onCommitFiberUnmount=="function")try{nt.onCommitFiberUnmount(ft,a)}catch{}switch(a.tag){case 26:mt||Mn(a,t),Kn(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:mt||Mn(a,t);var l=st,c=Wt;Ca(a.type)&&(st=a.stateNode,Wt=!1),Kn(e,t,a),dr(a.stateNode),st=l,Wt=c;break;case 5:mt||Mn(a,t);case 6:if(l=st,c=Wt,st=null,Kn(e,t,a),st=l,Wt=c,st!==null)if(Wt)try{(st.nodeType===9?st.body:st.nodeName==="HTML"?st.ownerDocument.body:st).removeChild(a.stateNode)}catch(d){Pe(a,t,d)}else try{st.removeChild(a.stateNode)}catch(d){Pe(a,t,d)}break;case 18:st!==null&&(Wt?(e=st,zp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),br(e)):zp(st,a.stateNode));break;case 4:l=st,c=Wt,st=a.stateNode.containerInfo,Wt=!0,Kn(e,t,a),st=l,Wt=c;break;case 0:case 11:case 14:case 15:mt||va(2,a,t),mt||va(4,a,t),Kn(e,t,a);break;case 1:mt||(Mn(a,t),l=a.stateNode,typeof l.componentWillUnmount=="function"&&Um(a,t,l)),Kn(e,t,a);break;case 21:Kn(e,t,a);break;case 22:mt=(l=mt)||a.memoizedState!==null,Kn(e,t,a),mt=l;break;default:Kn(e,t,a)}}function Zm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{br(e)}catch(a){Pe(t,t.return,a)}}function O1(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Ym),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Ym),t;default:throw Error(i(435,e.tag))}}function bu(e,t){var a=O1(e);t.forEach(function(l){var c=V1.bind(null,e,l);a.has(l)||(a.add(l),l.then(c,c))})}function Pt(e,t){var a=t.deletions;if(a!==null)for(var l=0;l<a.length;l++){var c=a[l],d=e,y=t,w=y;e:for(;w!==null;){switch(w.tag){case 27:if(Ca(w.type)){st=w.stateNode,Wt=!1;break e}break;case 5:st=w.stateNode,Wt=!1;break e;case 3:case 4:st=w.stateNode.containerInfo,Wt=!0;break e}w=w.return}if(st===null)throw Error(i(160));Xm(d,y,c),st=null,Wt=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13878)for(t=t.child;t!==null;)Wm(t,e),t=t.sibling}var jn=null;function Wm(e,t){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:Pt(t,e),en(e),l&4&&(va(3,e,e.return),tr(3,e),va(5,e,e.return));break;case 1:Pt(t,e),en(e),l&512&&(mt||a===null||Mn(a,a.return)),l&64&&Qn&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var c=jn;if(Pt(t,e),en(e),l&512&&(mt||a===null||Mn(a,a.return)),l&4){var d=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,c=c.ownerDocument||c;t:switch(l){case"title":d=c.getElementsByTagName("title")[0],(!d||d[Va]||d[wt]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(l),c.head.insertBefore(d,c.querySelector("head > title"))),Dt(d,l,a),d[wt]=e,xt(d),l=d;break e;case"link":var y=Lp("link","href",c).get(l+(a.href||""));if(y){for(var w=0;w<y.length;w++)if(d=y[w],d.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&d.getAttribute("rel")===(a.rel==null?null:a.rel)&&d.getAttribute("title")===(a.title==null?null:a.title)&&d.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){y.splice(w,1);break t}}d=c.createElement(l),Dt(d,l,a),c.head.appendChild(d);break;case"meta":if(y=Lp("meta","content",c).get(l+(a.content||""))){for(w=0;w<y.length;w++)if(d=y[w],d.getAttribute("content")===(a.content==null?null:""+a.content)&&d.getAttribute("name")===(a.name==null?null:a.name)&&d.getAttribute("property")===(a.property==null?null:a.property)&&d.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&d.getAttribute("charset")===(a.charSet==null?null:a.charSet)){y.splice(w,1);break t}}d=c.createElement(l),Dt(d,l,a),c.head.appendChild(d);break;default:throw Error(i(468,l))}d[wt]=e,xt(d),l=d}e.stateNode=l}else Yp(c,e.type,e.stateNode);else e.stateNode=qp(c,l,e.memoizedProps);else d!==l?(d===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):d.count--,l===null?Yp(c,e.type,e.stateNode):qp(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&pu(e,e.memoizedProps,a.memoizedProps)}break;case 27:Pt(t,e),en(e),l&512&&(mt||a===null||Mn(a,a.return)),a!==null&&l&4&&pu(e,e.memoizedProps,a.memoizedProps);break;case 5:if(Pt(t,e),en(e),l&512&&(mt||a===null||Mn(a,a.return)),e.flags&32){c=e.stateNode;try{ws(c,"")}catch(ne){Pe(e,e.return,ne)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,pu(e,c,a!==null?a.memoizedProps:c)),l&1024&&(yu=!0);break;case 6:if(Pt(t,e),en(e),l&4){if(e.stateNode===null)throw Error(i(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(ne){Pe(e,e.return,ne)}}break;case 3:if(ai=null,c=jn,jn=ti(t.containerInfo),Pt(t,e),jn=c,en(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{br(t.containerInfo)}catch(ne){Pe(e,e.return,ne)}yu&&(yu=!1,Qm(e));break;case 4:l=jn,jn=ti(e.stateNode.containerInfo),Pt(t,e),en(e),jn=l;break;case 12:Pt(t,e),en(e);break;case 13:Pt(t,e),en(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Eu=re()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,bu(e,l)));break;case 22:c=e.memoizedState!==null;var O=a!==null&&a.memoizedState!==null,J=Qn,ce=mt;if(Qn=J||c,mt=ce||O,Pt(t,e),mt=ce,Qn=J,en(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(a===null||O||Qn||mt||ls(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){O=a=t;try{if(d=O.stateNode,c)y=d.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{w=O.stateNode;var fe=O.memoizedProps.style,P=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;w.style.display=P==null||typeof P=="boolean"?"":(""+P).trim()}}catch(ne){Pe(O,O.return,ne)}}}else if(t.tag===6){if(a===null){O=t;try{O.stateNode.nodeValue=c?"":O.memoizedProps}catch(ne){Pe(O,O.return,ne)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,bu(e,a))));break;case 19:Pt(t,e),en(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,bu(e,l)));break;case 30:break;case 21:break;default:Pt(t,e),en(e)}}function en(e){var t=e.flags;if(t&2){try{for(var a,l=e.return;l!==null;){if(qm(l)){a=l;break}l=l.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var c=a.stateNode,d=xu(e);Yo(e,d,c);break;case 5:var y=a.stateNode;a.flags&32&&(ws(y,""),a.flags&=-33);var w=xu(e);Yo(e,w,y);break;case 3:case 4:var O=a.stateNode.containerInfo,J=xu(e);gu(e,J,O);break;default:throw Error(i(161))}}catch(ce){Pe(e,e.return,ce)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Qm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Qm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ja(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Vm(e,t.alternate,t),t=t.sibling}function ls(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:va(4,t,t.return),ls(t);break;case 1:Mn(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Um(t,t.return,a),ls(t);break;case 27:dr(t.stateNode);case 26:case 5:Mn(t,t.return),ls(t);break;case 22:t.memoizedState===null&&ls(t);break;case 30:ls(t);break;default:ls(t)}e=e.sibling}}function Na(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,d=t,y=d.flags;switch(d.tag){case 0:case 11:case 15:Na(c,d,a),tr(4,d);break;case 1:if(Na(c,d,a),l=d,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(J){Pe(l,l.return,J)}if(l=d,c=l.updateQueue,c!==null){var w=l.stateNode;try{var O=c.shared.hiddenCallbacks;if(O!==null)for(c.shared.hiddenCallbacks=null,c=0;c<O.length;c++)wh(O[c],w)}catch(J){Pe(l,l.return,J)}}a&&y&64&&$m(d),nr(d,d.return);break;case 27:Lm(d);case 26:case 5:Na(c,d,a),a&&l===null&&y&4&&Bm(d),nr(d,d.return);break;case 12:Na(c,d,a);break;case 13:Na(c,d,a),a&&y&4&&Zm(c,d);break;case 22:d.memoizedState===null&&Na(c,d,a),nr(d,d.return);break;case 30:break;default:Na(c,d,a)}t=t.sibling}}function vu(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Ll(a))}function ju(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ll(e))}function An(e,t,a,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Km(e,t,a,l),t=t.sibling}function Km(e,t,a,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:An(e,t,a,l),c&2048&&tr(9,t);break;case 1:An(e,t,a,l);break;case 3:An(e,t,a,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ll(e)));break;case 12:if(c&2048){An(e,t,a,l),e=t.stateNode;try{var d=t.memoizedProps,y=d.id,w=d.onPostCommit;typeof w=="function"&&w(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){Pe(t,t.return,O)}}else An(e,t,a,l);break;case 13:An(e,t,a,l);break;case 23:break;case 22:d=t.stateNode,y=t.alternate,t.memoizedState!==null?d._visibility&2?An(e,t,a,l):ar(e,t):d._visibility&2?An(e,t,a,l):(d._visibility|=2,Ys(e,t,a,l,(t.subtreeFlags&10256)!==0)),c&2048&&vu(y,t);break;case 24:An(e,t,a,l),c&2048&&ju(t.alternate,t);break;default:An(e,t,a,l)}}function Ys(e,t,a,l,c){for(c=c&&(t.subtreeFlags&10256)!==0,t=t.child;t!==null;){var d=e,y=t,w=a,O=l,J=y.flags;switch(y.tag){case 0:case 11:case 15:Ys(d,y,w,O,c),tr(8,y);break;case 23:break;case 22:var ce=y.stateNode;y.memoizedState!==null?ce._visibility&2?Ys(d,y,w,O,c):ar(d,y):(ce._visibility|=2,Ys(d,y,w,O,c)),c&&J&2048&&vu(y.alternate,y);break;case 24:Ys(d,y,w,O,c),c&&J&2048&&ju(y.alternate,y);break;default:Ys(d,y,w,O,c)}t=t.sibling}}function ar(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,l=t,c=l.flags;switch(l.tag){case 22:ar(a,l),c&2048&&vu(l.alternate,l);break;case 24:ar(a,l),c&2048&&ju(l.alternate,l);break;default:ar(a,l)}t=t.sibling}}var sr=8192;function Vs(e){if(e.subtreeFlags&sr)for(e=e.child;e!==null;)Jm(e),e=e.sibling}function Jm(e){switch(e.tag){case 26:Vs(e),e.flags&sr&&e.memoizedState!==null&&bb(jn,e.memoizedState,e.memoizedProps);break;case 5:Vs(e);break;case 3:case 4:var t=jn;jn=ti(e.stateNode.containerInfo),Vs(e),jn=t;break;case 22:e.memoizedState===null&&(t=e.alternate,t!==null&&t.memoizedState!==null?(t=sr,sr=16777216,Vs(e),sr=t):Vs(e));break;default:Vs(e)}}function Im(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function lr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];Et=l,Pm(l,e)}Im(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Fm(e),e=e.sibling}function Fm(e){switch(e.tag){case 0:case 11:case 15:lr(e),e.flags&2048&&va(9,e,e.return);break;case 3:lr(e);break;case 12:lr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Vo(e)):lr(e);break;default:lr(e)}}function Vo(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];Et=l,Pm(l,e)}Im(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:va(8,t,t.return),Vo(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Vo(t));break;default:Vo(t)}e=e.sibling}}function Pm(e,t){for(;Et!==null;){var a=Et;switch(a.tag){case 0:case 11:case 15:va(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Ll(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,Et=l;else e:for(a=e;Et!==null;){l=Et;var c=l.sibling,d=l.return;if(Gm(l),l===a){Et=null;break e}if(c!==null){c.return=d,Et=c;break e}Et=d}}}var D1={getCacheForType:function(e){var t=Bt(bt),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a}},H1=typeof WeakMap=="function"?WeakMap:Map,Qe=0,et=null,Be=null,Ye=0,Ke=0,tn=null,wa=!1,Gs=!1,Nu=!1,Jn=0,it=0,Sa=0,rs=0,wu=0,pn=0,Xs=0,rr=null,Qt=null,Su=!1,Eu=0,Go=1/0,Xo=null,Ea=null,Ot=0,ka=null,Zs=null,Ws=0,ku=0,_u=null,ep=null,or=0,Cu=null;function nn(){if((Qe&2)!==0&&Ye!==0)return Ye&-Ye;if(E.T!==null){var e=Os;return e!==0?e:Du()}return Jr()}function tp(){pn===0&&(pn=(Ye&536870912)===0||Ze?ys():536870912);var e=mn.current;return e!==null&&(e.flags|=32),pn}function an(e,t,a){(e===et&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)&&(Qs(e,0),_a(e,Ye,pn,!1)),ra(e,a),((Qe&2)===0||e!==et)&&(e===et&&((Qe&2)===0&&(rs|=a),it===4&&_a(e,Ye,pn,!1)),Rn(e))}function np(e,t,a){if((Qe&6)!==0)throw Error(i(327));var l=!a&&(t&124)===0&&(t&e.expiredLanes)===0||Jt(e,t),c=l?B1(e,t):Au(e,t,!0),d=l;do{if(c===0){Gs&&!l&&_a(e,t,0,!1);break}else{if(a=e.current.alternate,d&&!$1(a)){c=Au(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var w=e;c=rr;var O=w.current.memoizedState.isDehydrated;if(O&&(Qs(w,y).flags|=256),y=Au(w,y,!1),y!==2){if(Nu&&!O){w.errorRecoveryDisabledLanes|=d,rs|=d,c=4;break e}d=Qt,Qt=c,d!==null&&(Qt===null?Qt=d:Qt.push.apply(Qt,d))}c=y}if(d=!1,c!==2)continue}}if(c===1){Qs(e,0),_a(e,t,0,!0);break}e:{switch(l=e,d=c,d){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:_a(l,t,pn,!wa);break e;case 2:Qt=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(c=Eu+300-re(),10<c)){if(_a(l,t,pn,!wa),Vt(l,0,!0)!==0)break e;l.timeoutHandle=Ap(ap.bind(null,l,a,Qt,Xo,Su,t,pn,rs,Xs,wa,d,2,-0,0),c);break e}ap(l,a,Qt,Xo,Su,t,pn,rs,Xs,wa,d,0,-0,0)}}break}while(!0);Rn(e)}function ap(e,t,a,l,c,d,y,w,O,J,ce,fe,P,ne){if(e.timeoutHandle=-1,fe=t.subtreeFlags,(fe&8192||(fe&16785408)===16785408)&&(mr={stylesheets:null,count:0,unsuspend:yb},Jm(t),fe=vb(),fe!==null)){e.cancelPendingCommit=fe(up.bind(null,e,t,d,a,l,c,y,w,O,ce,1,P,ne)),_a(e,d,y,!J);return}up(e,t,d,a,l,c,y,w,O)}function $1(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var c=a[l],d=c.getSnapshot;c=c.value;try{if(!It(d(),c))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function _a(e,t,a,l){t&=~wu,t&=~rs,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var d=31-at(c),y=1<<d;l[d]=-1,c&=~y}a!==0&&Qr(e,a,t)}function Zo(){return(Qe&6)===0?(ir(0),!1):!0}function Tu(){if(Be!==null){if(Ke===0)var e=Be.return;else e=Be,Yn=es=null,Zc(e),qs=null,Fl=0,e=Be;for(;e!==null;)Hm(e.alternate,e),e=e.return;Be=null}}function Qs(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,tb(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Tu(),et=e,Be=a=Bn(e.current,null),Ye=t,Ke=0,tn=null,wa=!1,Gs=Jt(e,t),Nu=!1,Xs=pn=wu=rs=Sa=it=0,Qt=rr=null,Su=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-at(l),d=1<<c;t|=e[c],l&=~d}return Jn=t,mo(),a}function sp(e,t){He=null,E.H=zo,t===Vl||t===wo?(t=jh(),Ke=3):t===yh?(t=jh(),Ke=4):Ke=t===Nm?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,tn=t,Be===null&&(it=1,Uo(e,un(t,e.current)))}function lp(){var e=E.H;return E.H=zo,e===null?zo:e}function rp(){var e=E.A;return E.A=D1,e}function Mu(){it=4,wa||(Ye&4194048)!==Ye&&mn.current!==null||(Gs=!0),(Sa&134217727)===0&&(rs&134217727)===0||et===null||_a(et,Ye,pn,!1)}function Au(e,t,a){var l=Qe;Qe|=2;var c=lp(),d=rp();(et!==e||Ye!==t)&&(Xo=null,Qs(e,t)),t=!1;var y=it;e:do try{if(Ke!==0&&Be!==null){var w=Be,O=tn;switch(Ke){case 8:Tu(),y=6;break e;case 3:case 2:case 9:case 6:mn.current===null&&(t=!0);var J=Ke;if(Ke=0,tn=null,Ks(e,w,O,J),a&&Gs){y=0;break e}break;default:J=Ke,Ke=0,tn=null,Ks(e,w,O,J)}}U1(),y=it;break}catch(ce){sp(e,ce)}while(!0);return t&&e.shellSuspendCounter++,Yn=es=null,Qe=l,E.H=c,E.A=d,Be===null&&(et=null,Ye=0,mo()),y}function U1(){for(;Be!==null;)op(Be)}function B1(e,t){var a=Qe;Qe|=2;var l=lp(),c=rp();et!==e||Ye!==t?(Xo=null,Go=re()+500,Qs(e,t)):Gs=Jt(e,t);e:do try{if(Ke!==0&&Be!==null){t=Be;var d=tn;t:switch(Ke){case 1:Ke=0,tn=null,Ks(e,t,d,1);break;case 2:case 9:if(bh(d)){Ke=0,tn=null,ip(t);break}t=function(){Ke!==2&&Ke!==9||et!==e||(Ke=7),Rn(e)},d.then(t,t);break e;case 3:Ke=7;break e;case 4:Ke=5;break e;case 7:bh(d)?(Ke=0,tn=null,ip(t)):(Ke=0,tn=null,Ks(e,t,d,7));break;case 5:var y=null;switch(Be.tag){case 26:y=Be.memoizedState;case 5:case 27:var w=Be;if(!y||Vp(y)){Ke=0,tn=null;var O=w.sibling;if(O!==null)Be=O;else{var J=w.return;J!==null?(Be=J,Wo(J)):Be=null}break t}}Ke=0,tn=null,Ks(e,t,d,5);break;case 6:Ke=0,tn=null,Ks(e,t,d,6);break;case 8:Tu(),it=6;break e;default:throw Error(i(462))}}q1();break}catch(ce){sp(e,ce)}while(!0);return Yn=es=null,E.H=l,E.A=c,Qe=a,Be!==null?0:(et=null,Ye=0,mo(),it)}function q1(){for(;Be!==null&&!Y();)op(Be)}function op(e){var t=Om(e.alternate,e,Jn);e.memoizedProps=e.pendingProps,t===null?Wo(e):Be=t}function ip(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Cm(a,t,t.pendingProps,t.type,void 0,Ye);break;case 11:t=Cm(a,t,t.pendingProps,t.type.render,t.ref,Ye);break;case 5:Zc(t);default:Hm(a,t),t=Be=ch(t,Jn),t=Om(a,t,Jn)}e.memoizedProps=e.pendingProps,t===null?Wo(e):Be=t}function Ks(e,t,a,l){Yn=es=null,Zc(t),qs=null,Fl=0;var c=t.return;try{if(T1(e,c,t,a,Ye)){it=1,Uo(e,un(a,e.current)),Be=null;return}}catch(d){if(c!==null)throw Be=c,d;it=1,Uo(e,un(a,e.current)),Be=null;return}t.flags&32768?(Ze||l===1?e=!0:Gs||(Ye&536870912)!==0?e=!1:(wa=e=!0,(l===2||l===9||l===3||l===6)&&(l=mn.current,l!==null&&l.tag===13&&(l.flags|=16384))),cp(t,e)):Wo(t)}function Wo(e){var t=e;do{if((t.flags&32768)!==0){cp(t,wa);return}e=t.return;var a=A1(t.alternate,t,Jn);if(a!==null){Be=a;return}if(t=t.sibling,t!==null){Be=t;return}Be=t=e}while(t!==null);it===0&&(it=5)}function cp(e,t){do{var a=R1(e.alternate,e);if(a!==null){a.flags&=32767,Be=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){Be=e;return}Be=e=a}while(e!==null);it=6,Be=null}function up(e,t,a,l,c,d,y,w,O){e.cancelPendingCommit=null;do Qo();while(Ot!==0);if((Qe&6)!==0)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(d=t.lanes|t.childLanes,d|=jc,Dn(e,a,d,y,w,O),e===et&&(Be=et=null,Ye=0),Zs=t,ka=e,Ws=a,ku=d,_u=c,ep=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,G1(ke,function(){return pp(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=E.T,E.T=null,c=$.p,$.p=2,y=Qe,Qe|=4;try{z1(e,t,a)}finally{Qe=y,$.p=c,E.T=l}}Ot=1,dp(),fp(),hp()}}function dp(){if(Ot===1){Ot=0;var e=ka,t=Zs,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=E.T,E.T=null;var l=$.p;$.p=2;var c=Qe;Qe|=4;try{Wm(t,e);var d=Vu,y=Pf(e.containerInfo),w=d.focusedElem,O=d.selectionRange;if(y!==w&&w&&w.ownerDocument&&Ff(w.ownerDocument.documentElement,w)){if(O!==null&&xc(w)){var J=O.start,ce=O.end;if(ce===void 0&&(ce=J),"selectionStart"in w)w.selectionStart=J,w.selectionEnd=Math.min(ce,w.value.length);else{var fe=w.ownerDocument||document,P=fe&&fe.defaultView||window;if(P.getSelection){var ne=P.getSelection(),Me=w.textContent.length,_e=Math.min(O.start,Me),Fe=O.end===void 0?_e:Math.min(O.end,Me);!ne.extend&&_e>Fe&&(y=Fe,Fe=_e,_e=y);var G=If(w,_e),U=If(w,Fe);if(G&&U&&(ne.rangeCount!==1||ne.anchorNode!==G.node||ne.anchorOffset!==G.offset||ne.focusNode!==U.node||ne.focusOffset!==U.offset)){var Q=fe.createRange();Q.setStart(G.node,G.offset),ne.removeAllRanges(),_e>Fe?(ne.addRange(Q),ne.extend(U.node,U.offset)):(Q.setEnd(U.node,U.offset),ne.addRange(Q))}}}}for(fe=[],ne=w;ne=ne.parentNode;)ne.nodeType===1&&fe.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<fe.length;w++){var de=fe[w];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}ri=!!Yu,Vu=Yu=null}finally{Qe=c,$.p=l,E.T=a}}e.current=t,Ot=2}}function fp(){if(Ot===2){Ot=0;var e=ka,t=Zs,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=E.T,E.T=null;var l=$.p;$.p=2;var c=Qe;Qe|=4;try{Vm(e,t.alternate,t)}finally{Qe=c,$.p=l,E.T=a}}Ot=3}}function hp(){if(Ot===4||Ot===3){Ot=0,ue();var e=ka,t=Zs,a=Ws,l=ep;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Ot=5:(Ot=0,Zs=ka=null,mp(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Ea=null),Sl(a),t=t.stateNode,nt&&typeof nt.onCommitFiberRoot=="function")try{nt.onCommitFiberRoot(ft,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=E.T,c=$.p,$.p=2,E.T=null;try{for(var d=e.onRecoverableError,y=0;y<l.length;y++){var w=l[y];d(w.value,{componentStack:w.stack})}}finally{E.T=t,$.p=c}}(Ws&3)!==0&&Qo(),Rn(e),c=e.pendingLanes,(a&4194090)!==0&&(c&42)!==0?e===Cu?or++:(or=0,Cu=e):or=0,ir(0)}}function mp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ll(t)))}function Qo(e){return dp(),fp(),hp(),pp()}function pp(){if(Ot!==5)return!1;var e=ka,t=ku;ku=0;var a=Sl(Ws),l=E.T,c=$.p;try{$.p=32>a?32:a,E.T=null,a=_u,_u=null;var d=ka,y=Ws;if(Ot=0,Zs=ka=null,Ws=0,(Qe&6)!==0)throw Error(i(331));var w=Qe;if(Qe|=4,Fm(d.current),Km(d,d.current,y,a),Qe=w,ir(0,!1),nt&&typeof nt.onPostCommitFiberRoot=="function")try{nt.onPostCommitFiberRoot(ft,d)}catch{}return!0}finally{$.p=c,E.T=l,mp(e,t)}}function xp(e,t,a){t=un(a,t),t=ru(e.stateNode,t,2),e=xa(e,t,2),e!==null&&(ra(e,2),Rn(e))}function Pe(e,t,a){if(e.tag===3)xp(e,e,a);else for(;t!==null;){if(t.tag===3){xp(t,e,a);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ea===null||!Ea.has(l))){e=un(a,e),a=vm(2),l=xa(t,a,2),l!==null&&(jm(a,l,t,e),ra(l,2),Rn(l));break}}t=t.return}}function Ru(e,t,a){var l=e.pingCache;if(l===null){l=e.pingCache=new H1;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(a)||(Nu=!0,c.add(a),e=L1.bind(null,e,t,a),t.then(e,e))}function L1(e,t,a){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,et===e&&(Ye&a)===a&&(it===4||it===3&&(Ye&62914560)===Ye&&300>re()-Eu?(Qe&2)===0&&Qs(e,0):wu|=a,Xs===Ye&&(Xs=0)),Rn(e)}function gp(e,t){t===0&&(t=la()),e=Ms(e,t),e!==null&&(ra(e,t),Rn(e))}function Y1(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),gp(e,a)}function V1(e,t){var a=0;switch(e.tag){case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(a=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(i(314))}l!==null&&l.delete(t),gp(e,a)}function G1(e,t){return be(e,t)}var Ko=null,Js=null,zu=!1,Jo=!1,Ou=!1,os=0;function Rn(e){e!==Js&&e.next===null&&(Js===null?Ko=Js=e:Js=Js.next=e),Jo=!0,zu||(zu=!0,Z1())}function ir(e,t){if(!Ou&&Jo){Ou=!0;do for(var a=!1,l=Ko;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var d=0;else{var y=l.suspendedLanes,w=l.pingedLanes;d=(1<<31-at(42|e)+1)-1,d&=c&~(y&~w),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(a=!0,jp(l,d))}else d=Ye,d=Vt(l,l===et?d:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(d&3)===0||Jt(l,d)||(a=!0,jp(l,d));l=l.next}while(a);Ou=!1}}function X1(){yp()}function yp(){Jo=zu=!1;var e=0;os!==0&&(eb()&&(e=os),os=0);for(var t=re(),a=null,l=Ko;l!==null;){var c=l.next,d=bp(l,t);d===0?(l.next=null,a===null?Ko=c:a.next=c,c===null&&(Js=a)):(a=l,(e!==0||(d&3)!==0)&&(Jo=!0)),l=c}ir(e)}function bp(e,t){for(var a=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var y=31-at(d),w=1<<y,O=c[y];O===-1?((w&a)===0||(w&l)!==0)&&(c[y]=Nl(w,t)):O<=t&&(e.expiredLanes|=w),d&=~w}if(t=et,a=Ye,a=Vt(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===t&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&B(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||Jt(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(l!==null&&B(l),Sl(a)){case 2:case 8:a=ge;break;case 32:a=ke;break;case 268435456:a=ze;break;default:a=ke}return l=vp.bind(null,e),a=be(a,l),e.callbackPriority=t,e.callbackNode=a,t}return l!==null&&l!==null&&B(l),e.callbackPriority=2,e.callbackNode=null,2}function vp(e,t){if(Ot!==0&&Ot!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Qo()&&e.callbackNode!==a)return null;var l=Ye;return l=Vt(e,e===et?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(np(e,l,t),bp(e,re()),e.callbackNode!=null&&e.callbackNode===a?vp.bind(null,e):null)}function jp(e,t){if(Qo())return null;np(e,t,!0)}function Z1(){nb(function(){(Qe&6)!==0?be(Ee,X1):yp()})}function Du(){return os===0&&(os=ys()),os}function Np(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ro(""+e)}function wp(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function W1(e,t,a,l,c){if(t==="submit"&&a&&a.stateNode===c){var d=Np((c[Ut]||null).action),y=l.submitter;y&&(t=(t=y[Ut]||null)?Np(t.formAction):y.getAttribute("formAction"),t!==null&&(d=t,y=null));var w=new uo("action","action",null,l,c);e.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(os!==0){var O=y?wp(c,y):new FormData(c);tu(a,{pending:!0,data:O,method:c.method,action:d},null,O)}}else typeof d=="function"&&(w.preventDefault(),O=y?wp(c,y):new FormData(c),tu(a,{pending:!0,data:O,method:c.method,action:d},d,O))},currentTarget:c}]})}}for(var Hu=0;Hu<vc.length;Hu++){var $u=vc[Hu],Q1=$u.toLowerCase(),K1=$u[0].toUpperCase()+$u.slice(1);vn(Q1,"on"+K1)}vn(nh,"onAnimationEnd"),vn(ah,"onAnimationIteration"),vn(sh,"onAnimationStart"),vn("dblclick","onDoubleClick"),vn("focusin","onFocus"),vn("focusout","onBlur"),vn(f1,"onTransitionRun"),vn(h1,"onTransitionStart"),vn(m1,"onTransitionCancel"),vn(lh,"onTransitionEnd"),ua("onMouseEnter",["mouseout","mouseover"]),ua("onMouseLeave",["mouseout","mouseover"]),ua("onPointerEnter",["pointerout","pointerover"]),ua("onPointerLeave",["pointerout","pointerover"]),$n("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),$n("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),$n("onBeforeInput",["compositionend","keypress","textInput","paste"]),$n("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),$n("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),$n("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var cr="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(" "),J1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(cr));function Sp(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],c=l.event;l=l.listeners;e:{var d=void 0;if(t)for(var y=l.length-1;0<=y;y--){var w=l[y],O=w.instance,J=w.currentTarget;if(w=w.listener,O!==d&&c.isPropagationStopped())break e;d=w,c.currentTarget=J;try{d(c)}catch(ce){$o(ce)}c.currentTarget=null,d=O}else for(y=0;y<l.length;y++){if(w=l[y],O=w.instance,J=w.currentTarget,w=w.listener,O!==d&&c.isPropagationStopped())break e;d=w,c.currentTarget=J;try{d(c)}catch(ce){$o(ce)}c.currentTarget=null,d=O}}}}function qe(e,t){var a=t[El];a===void 0&&(a=t[El]=new Set);var l=e+"__bubble";a.has(l)||(Ep(t,e,2,!1),a.add(l))}function Uu(e,t,a){var l=0;t&&(l|=4),Ep(a,e,l,t)}var Io="_reactListening"+Math.random().toString(36).slice(2);function Bu(e){if(!e[Io]){e[Io]=!0,Fr.forEach(function(a){a!=="selectionchange"&&(J1.has(a)||Uu(a,!1,e),Uu(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Io]||(t[Io]=!0,Uu("selectionchange",!1,t))}}function Ep(e,t,a,l){switch(Kp(t)){case 2:var c=wb;break;case 8:c=Sb;break;default:c=Pu}a=c.bind(null,t,a,e),c=void 0,!oc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,a,{capture:!0,passive:c}):e.addEventListener(t,a,!0):c!==void 0?e.addEventListener(t,a,{passive:c}):e.addEventListener(t,a,!1)}function qu(e,t,a,l,c){var d=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var y=l.tag;if(y===3||y===4){var w=l.stateNode.containerInfo;if(w===c)break;if(y===4)for(y=l.return;y!==null;){var O=y.tag;if((O===3||O===4)&&y.stateNode.containerInfo===c)return;y=y.return}for(;w!==null;){if(y=Hn(w),y===null)return;if(O=y.tag,O===5||O===6||O===26||O===27){l=d=y;continue e}w=w.parentNode}}l=l.return}Rf(function(){var J=d,ce=lc(a),fe=[];e:{var P=rh.get(e);if(P!==void 0){var ne=uo,Me=e;switch(e){case"keypress":if(io(a)===0)break e;case"keydown":case"keyup":ne=Gy;break;case"focusin":Me="focus",ne=dc;break;case"focusout":Me="blur",ne=dc;break;case"beforeblur":case"afterblur":ne=dc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ne=Df;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=Ry;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=Wy;break;case nh:case ah:case sh:ne=Dy;break;case lh:ne=Ky;break;case"scroll":case"scrollend":ne=My;break;case"wheel":ne=Iy;break;case"copy":case"cut":case"paste":ne=$y;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=$f;break;case"toggle":case"beforetoggle":ne=Py}var _e=(t&4)!==0,Fe=!_e&&(e==="scroll"||e==="scrollend"),G=_e?P!==null?P+"Capture":null:P;_e=[];for(var U=J,Q;U!==null;){var de=U;if(Q=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||Q===null||G===null||(de=Cl(U,G),de!=null&&_e.push(ur(U,de,Q))),Fe)break;U=U.return}0<_e.length&&(P=new ne(P,Me,null,a,ce),fe.push({event:P,listeners:_e}))}}if((t&7)===0){e:{if(P=e==="mouseover"||e==="pointerover",ne=e==="mouseout"||e==="pointerout",P&&a!==sc&&(Me=a.relatedTarget||a.fromElement)&&(Hn(Me)||Me[oa]))break e;if((ne||P)&&(P=ce.window===ce?ce:(P=ce.ownerDocument)?P.defaultView||P.parentWindow:window,ne?(Me=a.relatedTarget||a.toElement,ne=J,Me=Me?Hn(Me):null,Me!==null&&(Fe=f(Me),_e=Me.tag,Me!==Fe||_e!==5&&_e!==27&&_e!==6)&&(Me=null)):(ne=null,Me=J),ne!==Me)){if(_e=Df,de="onMouseLeave",G="onMouseEnter",U="mouse",(e==="pointerout"||e==="pointerover")&&(_e=$f,de="onPointerLeave",G="onPointerEnter",U="pointer"),Fe=ne==null?P:Ga(ne),Q=Me==null?P:Ga(Me),P=new _e(de,U+"leave",ne,a,ce),P.target=Fe,P.relatedTarget=Q,de=null,Hn(ce)===J&&(_e=new _e(G,U+"enter",Me,a,ce),_e.target=Q,_e.relatedTarget=Fe,de=_e),Fe=de,ne&&Me)t:{for(_e=ne,G=Me,U=0,Q=_e;Q;Q=Is(Q))U++;for(Q=0,de=G;de;de=Is(de))Q++;for(;0<U-Q;)_e=Is(_e),U--;for(;0<Q-U;)G=Is(G),Q--;for(;U--;){if(_e===G||G!==null&&_e===G.alternate)break t;_e=Is(_e),G=Is(G)}_e=null}else _e=null;ne!==null&&kp(fe,P,ne,_e,!1),Me!==null&&Fe!==null&&kp(fe,Fe,Me,_e,!0)}}e:{if(P=J?Ga(J):window,ne=P.nodeName&&P.nodeName.toLowerCase(),ne==="select"||ne==="input"&&P.type==="file")var ye=Xf;else if(Vf(P))if(Zf)ye=c1;else{ye=o1;var $e=r1}else ne=P.nodeName,!ne||ne.toLowerCase()!=="input"||P.type!=="checkbox"&&P.type!=="radio"?J&&ac(J.elementType)&&(ye=Xf):ye=i1;if(ye&&(ye=ye(e,J))){Gf(fe,ye,a,ce);break e}$e&&$e(e,P,J),e==="focusout"&&J&&P.type==="number"&&J.memoizedProps.value!=null&&nc(P,"number",P.value)}switch($e=J?Ga(J):window,e){case"focusin":(Vf($e)||$e.contentEditable==="true")&&(_s=$e,gc=J,Hl=null);break;case"focusout":Hl=gc=_s=null;break;case"mousedown":yc=!0;break;case"contextmenu":case"mouseup":case"dragend":yc=!1,eh(fe,a,ce);break;case"selectionchange":if(d1)break;case"keydown":case"keyup":eh(fe,a,ce)}var we;if(hc)e:{switch(e){case"compositionstart":var Ce="onCompositionStart";break e;case"compositionend":Ce="onCompositionEnd";break e;case"compositionupdate":Ce="onCompositionUpdate";break e}Ce=void 0}else ks?Lf(e,a)&&(Ce="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ce="onCompositionStart");Ce&&(Uf&&a.locale!=="ko"&&(ks||Ce!=="onCompositionStart"?Ce==="onCompositionEnd"&&ks&&(we=zf()):(fa=ce,ic="value"in fa?fa.value:fa.textContent,ks=!0)),$e=Fo(J,Ce),0<$e.length&&(Ce=new Hf(Ce,e,null,a,ce),fe.push({event:Ce,listeners:$e}),we?Ce.data=we:(we=Yf(a),we!==null&&(Ce.data=we)))),(we=t1?n1(e,a):a1(e,a))&&(Ce=Fo(J,"onBeforeInput"),0<Ce.length&&($e=new Hf("onBeforeInput","beforeinput",null,a,ce),fe.push({event:$e,listeners:Ce}),$e.data=we)),W1(fe,e,J,a,ce)}Sp(fe,t)})}function ur(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Fo(e,t){for(var a=t+"Capture",l=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=Cl(e,a),c!=null&&l.unshift(ur(e,c,d)),c=Cl(e,t),c!=null&&l.push(ur(e,c,d))),e.tag===3)return l;e=e.return}return[]}function Is(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function kp(e,t,a,l,c){for(var d=t._reactName,y=[];a!==null&&a!==l;){var w=a,O=w.alternate,J=w.stateNode;if(w=w.tag,O!==null&&O===l)break;w!==5&&w!==26&&w!==27||J===null||(O=J,c?(J=Cl(a,d),J!=null&&y.unshift(ur(a,J,O))):c||(J=Cl(a,d),J!=null&&y.push(ur(a,J,O)))),a=a.return}y.length!==0&&e.push({event:t,listeners:y})}var I1=/\r\n?/g,F1=/\u0000|\uFFFD/g;function _p(e){return(typeof e=="string"?e:""+e).replace(I1,`
49
- `).replace(F1,"")}function Cp(e,t){return t=_p(t),_p(e)===t}function Po(){}function Ie(e,t,a,l,c,d){switch(a){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||ws(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&ws(e,""+l);break;case"className":vs(e,"class",l);break;case"tabIndex":vs(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":vs(e,a,l);break;case"style":Mf(e,l,d);break;case"data":if(t!=="object"){vs(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=ro(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof d=="function"&&(a==="formAction"?(t!=="input"&&Ie(e,t,"name",c.name,c,null),Ie(e,t,"formEncType",c.formEncType,c,null),Ie(e,t,"formMethod",c.formMethod,c,null),Ie(e,t,"formTarget",c.formTarget,c,null)):(Ie(e,t,"encType",c.encType,c,null),Ie(e,t,"method",c.method,c,null),Ie(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=ro(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=Po);break;case"onScroll":l!=null&&qe("scroll",e);break;case"onScrollEnd":l!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(c.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=ro(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""+l):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":qe("beforetoggle",e),qe("toggle",e),bs(e,"popover",l);break;case"xlinkActuate":bn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":bn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":bn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":bn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":bn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":bn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":bn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":bn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":bn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":bs(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Cy.get(a)||a,bs(e,a,l))}}function Lu(e,t,a,l,c,d){switch(a){case"style":Mf(e,l,d);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(c.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof l=="string"?ws(e,l):(typeof l=="number"||typeof l=="bigint")&&ws(e,""+l);break;case"onScroll":l!=null&&qe("scroll",e);break;case"onScrollEnd":l!=null&&qe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Po);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pr.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(c=a.endsWith("Capture"),t=a.slice(2,c?a.length-7:void 0),d=e[Ut]||null,d=d!=null?d[a]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof l=="function")){typeof d!="function"&&d!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,l,c);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):bs(e,a,l)}}}function Dt(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var l=!1,c=!1,d;for(d in a)if(a.hasOwnProperty(d)){var y=a[d];if(y!=null)switch(d){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,t));default:Ie(e,t,d,y,a,null)}}c&&Ie(e,t,"srcSet",a.srcSet,a,null),l&&Ie(e,t,"src",a.src,a,null);return;case"input":qe("invalid",e);var w=d=y=c=null,O=null,J=null;for(l in a)if(a.hasOwnProperty(l)){var ce=a[l];if(ce!=null)switch(l){case"name":c=ce;break;case"type":y=ce;break;case"checked":O=ce;break;case"defaultChecked":J=ce;break;case"value":d=ce;break;case"defaultValue":w=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(i(137,t));break;default:Ie(e,t,l,ce,a,null)}}kf(e,d,w,O,J,y,c,!1),so(e);return;case"select":qe("invalid",e),l=y=d=null;for(c in a)if(a.hasOwnProperty(c)&&(w=a[c],w!=null))switch(c){case"value":d=w;break;case"defaultValue":y=w;break;case"multiple":l=w;default:Ie(e,t,c,w,a,null)}t=d,a=y,e.multiple=!!l,t!=null?Ns(e,!!l,t,!1):a!=null&&Ns(e,!!l,a,!0);return;case"textarea":qe("invalid",e),d=c=l=null;for(y in a)if(a.hasOwnProperty(y)&&(w=a[y],w!=null))switch(y){case"value":l=w;break;case"defaultValue":c=w;break;case"children":d=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(i(91));break;default:Ie(e,t,y,w,a,null)}Cf(e,l,c,d),so(e);return;case"option":for(O in a)if(a.hasOwnProperty(O)&&(l=a[O],l!=null))switch(O){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Ie(e,t,O,l,a,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(l=0;l<cr.length;l++)qe(cr[l],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(J in a)if(a.hasOwnProperty(J)&&(l=a[J],l!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,t));default:Ie(e,t,J,l,a,null)}return;default:if(ac(t)){for(ce in a)a.hasOwnProperty(ce)&&(l=a[ce],l!==void 0&&Lu(e,t,ce,l,a,void 0));return}}for(w in a)a.hasOwnProperty(w)&&(l=a[w],l!=null&&Ie(e,t,w,l,a,null))}function P1(e,t,a,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,y=null,w=null,O=null,J=null,ce=null;for(ne in a){var fe=a[ne];if(a.hasOwnProperty(ne)&&fe!=null)switch(ne){case"checked":break;case"value":break;case"defaultValue":O=fe;default:l.hasOwnProperty(ne)||Ie(e,t,ne,null,l,fe)}}for(var P in l){var ne=l[P];if(fe=a[P],l.hasOwnProperty(P)&&(ne!=null||fe!=null))switch(P){case"type":d=ne;break;case"name":c=ne;break;case"checked":J=ne;break;case"defaultChecked":ce=ne;break;case"value":y=ne;break;case"defaultValue":w=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(i(137,t));break;default:ne!==fe&&Ie(e,t,P,ne,l,fe)}}tc(e,y,w,O,J,ce,d,c);return;case"select":ne=y=w=P=null;for(d in a)if(O=a[d],a.hasOwnProperty(d)&&O!=null)switch(d){case"value":break;case"multiple":ne=O;default:l.hasOwnProperty(d)||Ie(e,t,d,null,l,O)}for(c in l)if(d=l[c],O=a[c],l.hasOwnProperty(c)&&(d!=null||O!=null))switch(c){case"value":P=d;break;case"defaultValue":w=d;break;case"multiple":y=d;default:d!==O&&Ie(e,t,c,d,l,O)}t=w,a=y,l=ne,P!=null?Ns(e,!!a,P,!1):!!l!=!!a&&(t!=null?Ns(e,!!a,t,!0):Ns(e,!!a,a?[]:"",!1));return;case"textarea":ne=P=null;for(w in a)if(c=a[w],a.hasOwnProperty(w)&&c!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:Ie(e,t,w,null,l,c)}for(y in l)if(c=l[y],d=a[y],l.hasOwnProperty(y)&&(c!=null||d!=null))switch(y){case"value":P=c;break;case"defaultValue":ne=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(i(91));break;default:c!==d&&Ie(e,t,y,c,l,d)}_f(e,P,ne);return;case"option":for(var Me in a)if(P=a[Me],a.hasOwnProperty(Me)&&P!=null&&!l.hasOwnProperty(Me))switch(Me){case"selected":e.selected=!1;break;default:Ie(e,t,Me,null,l,P)}for(O in l)if(P=l[O],ne=a[O],l.hasOwnProperty(O)&&P!==ne&&(P!=null||ne!=null))switch(O){case"selected":e.selected=P&&typeof P!="function"&&typeof P!="symbol";break;default:Ie(e,t,O,P,l,ne)}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 _e in a)P=a[_e],a.hasOwnProperty(_e)&&P!=null&&!l.hasOwnProperty(_e)&&Ie(e,t,_e,null,l,P);for(J in l)if(P=l[J],ne=a[J],l.hasOwnProperty(J)&&P!==ne&&(P!=null||ne!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(i(137,t));break;default:Ie(e,t,J,P,l,ne)}return;default:if(ac(t)){for(var Fe in a)P=a[Fe],a.hasOwnProperty(Fe)&&P!==void 0&&!l.hasOwnProperty(Fe)&&Lu(e,t,Fe,void 0,l,P);for(ce in l)P=l[ce],ne=a[ce],!l.hasOwnProperty(ce)||P===ne||P===void 0&&ne===void 0||Lu(e,t,ce,P,l,ne);return}}for(var G in a)P=a[G],a.hasOwnProperty(G)&&P!=null&&!l.hasOwnProperty(G)&&Ie(e,t,G,null,l,P);for(fe in l)P=l[fe],ne=a[fe],!l.hasOwnProperty(fe)||P===ne||P==null&&ne==null||Ie(e,t,fe,P,l,ne)}var Yu=null,Vu=null;function ei(e){return e.nodeType===9?e:e.ownerDocument}function Tp(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Mp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Gu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Xu=null;function eb(){var e=window.event;return e&&e.type==="popstate"?e===Xu?!1:(Xu=e,!0):(Xu=null,!1)}var Ap=typeof setTimeout=="function"?setTimeout:void 0,tb=typeof clearTimeout=="function"?clearTimeout:void 0,Rp=typeof Promise=="function"?Promise:void 0,nb=typeof queueMicrotask=="function"?queueMicrotask:typeof Rp<"u"?function(e){return Rp.resolve(null).then(e).catch(ab)}:Ap;function ab(e){setTimeout(function(){throw e})}function Ca(e){return e==="head"}function zp(e,t){var a=t,l=0,c=0;do{var d=a.nextSibling;if(e.removeChild(a),d&&d.nodeType===8)if(a=d.data,a==="/$"){if(0<l&&8>l){a=l;var y=e.ownerDocument;if(a&1&&dr(y.documentElement),a&2&&dr(y.body),a&4)for(a=y.head,dr(a),y=a.firstChild;y;){var w=y.nextSibling,O=y.nodeName;y[Va]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&y.rel.toLowerCase()==="stylesheet"||a.removeChild(y),y=w}}if(c===0){e.removeChild(d),br(t);return}c--}else a==="$"||a==="$?"||a==="$!"?c++:l=a.charCodeAt(0)-48;else l=0;a=d}while(a);br(t)}function Zu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Zu(a),kl(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function sb(e,t,a,l){for(;e.nodeType===1;){var c=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Va])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=Nn(e.nextSibling),e===null)break}return null}function lb(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=Nn(e.nextSibling),e===null))return null;return e}function Wu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState==="complete"}function rb(e,t){var a=e.ownerDocument;if(e.data!=="$?"||a.readyState==="complete")t();else{var l=function(){t(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function Nn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="F!"||t==="F")break;if(t==="/$")return null}}return e}var Qu=null;function Op(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"){if(t===0)return e;t--}else a==="/$"&&t++}e=e.previousSibling}return null}function Dp(e,t,a){switch(t=ei(a),e){case"html":if(e=t.documentElement,!e)throw Error(i(452));return e;case"head":if(e=t.head,!e)throw Error(i(453));return e;case"body":if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function dr(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);kl(e)}var xn=new Map,Hp=new Set;function ti(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var In=$.d;$.d={f:ob,r:ib,D:cb,C:ub,L:db,m:fb,X:mb,S:hb,M:pb};function ob(){var e=In.f(),t=Zo();return e||t}function ib(e){var t=ia(e);t!==null&&t.tag===5&&t.type==="form"?nm(t):In.r(e)}var Fs=typeof document>"u"?null:document;function $p(e,t,a){var l=Fs;if(l&&typeof t=="string"&&t){var c=cn(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof a=="string"&&(c+='[crossorigin="'+a+'"]'),Hp.has(c)||(Hp.add(c),e={rel:e,crossOrigin:a,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),Dt(t,"link",e),xt(t),l.head.appendChild(t)))}}function cb(e){In.D(e),$p("dns-prefetch",e,null)}function ub(e,t){In.C(e,t),$p("preconnect",e,t)}function db(e,t,a){In.L(e,t,a);var l=Fs;if(l&&e&&t){var c='link[rel="preload"][as="'+cn(t)+'"]';t==="image"&&a&&a.imageSrcSet?(c+='[imagesrcset="'+cn(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(c+='[imagesizes="'+cn(a.imageSizes)+'"]')):c+='[href="'+cn(e)+'"]';var d=c;switch(t){case"style":d=Ps(e);break;case"script":d=el(e)}xn.has(d)||(e=p({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),xn.set(d,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(fr(d))||t==="script"&&l.querySelector(hr(d))||(t=l.createElement("link"),Dt(t,"link",e),xt(t),l.head.appendChild(t)))}}function fb(e,t){In.m(e,t);var a=Fs;if(a&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+cn(l)+'"][href="'+cn(e)+'"]',d=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=el(e)}if(!xn.has(d)&&(e=p({rel:"modulepreload",href:e},t),xn.set(d,e),a.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(hr(d)))return}l=a.createElement("link"),Dt(l,"link",e),xt(l),a.head.appendChild(l)}}}function hb(e,t,a){In.S(e,t,a);var l=Fs;if(l&&e){var c=ca(l).hoistableStyles,d=Ps(e);t=t||"default";var y=c.get(d);if(!y){var w={loading:0,preload:null};if(y=l.querySelector(fr(d)))w.loading=5;else{e=p({rel:"stylesheet",href:e,"data-precedence":t},a),(a=xn.get(d))&&Ku(e,a);var O=y=l.createElement("link");xt(O),Dt(O,"link",e),O._p=new Promise(function(J,ce){O.onload=J,O.onerror=ce}),O.addEventListener("load",function(){w.loading|=1}),O.addEventListener("error",function(){w.loading|=2}),w.loading|=4,ni(y,t,l)}y={type:"stylesheet",instance:y,count:1,state:w},c.set(d,y)}}}function mb(e,t){In.X(e,t);var a=Fs;if(a&&e){var l=ca(a).hoistableScripts,c=el(e),d=l.get(c);d||(d=a.querySelector(hr(c)),d||(e=p({src:e,async:!0},t),(t=xn.get(c))&&Ju(e,t),d=a.createElement("script"),xt(d),Dt(d,"link",e),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(c,d))}}function pb(e,t){In.M(e,t);var a=Fs;if(a&&e){var l=ca(a).hoistableScripts,c=el(e),d=l.get(c);d||(d=a.querySelector(hr(c)),d||(e=p({src:e,async:!0,type:"module"},t),(t=xn.get(c))&&Ju(e,t),d=a.createElement("script"),xt(d),Dt(d,"link",e),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(c,d))}}function Up(e,t,a,l){var c=(c=me.current)?ti(c):null;if(!c)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Ps(a.href),a=ca(c).hoistableStyles,l=a.get(t),l||(l={type:"style",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Ps(a.href);var d=ca(c).hoistableStyles,y=d.get(e);if(y||(c=c.ownerDocument||c,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,y),(d=c.querySelector(fr(e)))&&!d._p&&(y.instance=d,y.state.loading=5),xn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},xn.set(e,a),d||xb(c,e,a,y.state))),t&&l===null)throw Error(i(528,""));return y}if(t&&l!==null)throw Error(i(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=el(a),a=ca(c).hoistableScripts,l=a.get(t),l||(l={type:"script",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Ps(e){return'href="'+cn(e)+'"'}function fr(e){return'link[rel="stylesheet"]['+e+"]"}function Bp(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function xb(e,t,a,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),Dt(t,"link",a),xt(t),e.head.appendChild(t))}function el(e){return'[src="'+cn(e)+'"]'}function hr(e){return"script[async]"+e}function qp(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+cn(a.href)+'"]');if(l)return t.instance=l,xt(l),l;var c=p({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),xt(l),Dt(l,"style",c),ni(l,a.precedence,e),t.instance=l;case"stylesheet":c=Ps(a.href);var d=e.querySelector(fr(c));if(d)return t.state.loading|=4,t.instance=d,xt(d),d;l=Bp(a),(c=xn.get(c))&&Ku(l,c),d=(e.ownerDocument||e).createElement("link"),xt(d);var y=d;return y._p=new Promise(function(w,O){y.onload=w,y.onerror=O}),Dt(d,"link",l),t.state.loading|=4,ni(d,a.precedence,e),t.instance=d;case"script":return d=el(a.src),(c=e.querySelector(hr(d)))?(t.instance=c,xt(c),c):(l=a,(c=xn.get(d))&&(l=p({},a),Ju(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),xt(c),Dt(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(i(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,ni(l,a.precedence,e));return t.instance}function ni(e,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,d=c,y=0;y<l.length;y++){var w=l[y];if(w.dataset.precedence===t)d=w;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Ku(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ju(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ai=null;function Lp(e,t,a){if(ai===null){var l=new Map,c=ai=new Map;c.set(a,l)}else c=ai,l=c.get(a),l||(l=new Map,c.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),c=0;c<a.length;c++){var d=a[c];if(!(d[Va]||d[wt]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var y=d.getAttribute(t)||"";y=e+y;var w=l.get(y);w?w.push(d):l.set(y,[d])}}return l}function Yp(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function gb(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Vp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}var mr=null;function yb(){}function bb(e,t,a){if(mr===null)throw Error(i(475));var l=mr;if(t.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(t.state.loading&4)===0){if(t.instance===null){var c=Ps(a.href),d=e.querySelector(fr(c));if(d){e=d._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(l.count++,l=si.bind(l),e.then(l,l)),t.state.loading|=4,t.instance=d,xt(d);return}d=e.ownerDocument||e,a=Bp(a),(c=xn.get(c))&&Ku(a,c),d=d.createElement("link"),xt(d);var y=d;y._p=new Promise(function(w,O){y.onload=w,y.onerror=O}),Dt(d,"link",a),t.instance=d}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(t,e),(e=t.state.preload)&&(t.state.loading&3)===0&&(l.count++,t=si.bind(l),e.addEventListener("load",t),e.addEventListener("error",t))}}function vb(){if(mr===null)throw Error(i(475));var e=mr;return e.stylesheets&&e.count===0&&Iu(e,e.stylesheets),0<e.count?function(t){var a=setTimeout(function(){if(e.stylesheets&&Iu(e,e.stylesheets),e.unsuspend){var l=e.unsuspend;e.unsuspend=null,l()}},6e4);return e.unsuspend=t,function(){e.unsuspend=null,clearTimeout(a)}}:null}function si(){if(this.count--,this.count===0){if(this.stylesheets)Iu(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var li=null;function Iu(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,li=new Map,t.forEach(jb,e),li=null,si.call(e))}function jb(e,t){if(!(t.state.loading&4)){var a=li.get(e);if(a)var l=a.get(null);else{a=new Map,li.set(e,a);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var y=c[d];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(a.set(y.dataset.precedence,y),l=y)}l&&a.set(null,l)}c=t.instance,y=c.getAttribute("data-precedence"),d=a.get(y)||l,d===l&&a.set(null,c),a.set(y,c),this.count++,l=si.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var pr={$$typeof:q,Provider:null,Consumer:null,_currentValue:T,_currentValue2:T,_threadCount:0};function Nb(e,t,a,l,c,d,y,w){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ya(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ya(0),this.hiddenUpdates=Ya(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=w,this.incompleteTransitions=new Map}function Gp(e,t,a,l,c,d,y,w,O,J,ce,fe){return e=new Nb(e,t,a,y,w,O,J,fe),t=1,d===!0&&(t|=24),d=Ft(3,null,null,t),e.current=d,d.stateNode=e,t=Rc(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:l,isDehydrated:a,cache:t},Hc(d),e}function Xp(e){return e?(e=As,e):As}function Zp(e,t,a,l,c,d){c=Xp(c),l.context===null?l.context=c:l.pendingContext=c,l=pa(t),l.payload={element:a},d=d===void 0?null:d,d!==null&&(l.callback=d),a=xa(e,l,t),a!==null&&(an(a,e,t),Xl(a,e,t))}function Wp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Fu(e,t){Wp(e,t),(e=e.alternate)&&Wp(e,t)}function Qp(e){if(e.tag===13){var t=Ms(e,67108864);t!==null&&an(t,e,67108864),Fu(e,67108864)}}var ri=!0;function wb(e,t,a,l){var c=E.T;E.T=null;var d=$.p;try{$.p=2,Pu(e,t,a,l)}finally{$.p=d,E.T=c}}function Sb(e,t,a,l){var c=E.T;E.T=null;var d=$.p;try{$.p=8,Pu(e,t,a,l)}finally{$.p=d,E.T=c}}function Pu(e,t,a,l){if(ri){var c=ed(l);if(c===null)qu(e,t,l,oi,a),Jp(e,l);else if(kb(c,e,t,a,l))l.stopPropagation();else if(Jp(e,l),t&4&&-1<Eb.indexOf(e)){for(;c!==null;){var d=ia(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var y=Rt(d.pendingLanes);if(y!==0){var w=d;for(w.pendingLanes|=2,w.entangledLanes|=2;y;){var O=1<<31-at(y);w.entanglements[1]|=O,y&=~O}Rn(d),(Qe&6)===0&&(Go=re()+500,ir(0))}}break;case 13:w=Ms(d,2),w!==null&&an(w,d,2),Zo(),Fu(d,2)}if(d=ed(l),d===null&&qu(e,t,l,oi,a),d===c)break;c=d}c!==null&&l.stopPropagation()}else qu(e,t,l,null,a)}}function ed(e){return e=lc(e),td(e)}var oi=null;function td(e){if(oi=null,e=Hn(e),e!==null){var t=f(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=h(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return oi=e,null}function Kp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ee()){case Ee:return 2;case ge:return 8;case ke:case Oe:return 32;case ze:return 268435456;default:return 32}default:return 32}}var nd=!1,Ta=null,Ma=null,Aa=null,xr=new Map,gr=new Map,Ra=[],Eb="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 Jp(e,t){switch(e){case"focusin":case"focusout":Ta=null;break;case"dragenter":case"dragleave":Ma=null;break;case"mouseover":case"mouseout":Aa=null;break;case"pointerover":case"pointerout":xr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":gr.delete(t.pointerId)}}function yr(e,t,a,l,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:a,eventSystemFlags:l,nativeEvent:d,targetContainers:[c]},t!==null&&(t=ia(t),t!==null&&Qp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function kb(e,t,a,l,c){switch(t){case"focusin":return Ta=yr(Ta,e,t,a,l,c),!0;case"dragenter":return Ma=yr(Ma,e,t,a,l,c),!0;case"mouseover":return Aa=yr(Aa,e,t,a,l,c),!0;case"pointerover":var d=c.pointerId;return xr.set(d,yr(xr.get(d)||null,e,t,a,l,c)),!0;case"gotpointercapture":return d=c.pointerId,gr.set(d,yr(gr.get(d)||null,e,t,a,l,c)),!0}return!1}function Ip(e){var t=Hn(e.target);if(t!==null){var a=f(t);if(a!==null){if(t=a.tag,t===13){if(t=h(a),t!==null){e.blockedOn=t,Ii(e.priority,function(){if(a.tag===13){var l=nn();l=wl(l);var c=Ms(a,l);c!==null&&an(c,a,l),Fu(a,l)}});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ii(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=ed(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);sc=l,a.target.dispatchEvent(l),sc=null}else return t=ia(a),t!==null&&Qp(t),e.blockedOn=a,!1;t.shift()}return!0}function Fp(e,t,a){ii(e)&&a.delete(t)}function _b(){nd=!1,Ta!==null&&ii(Ta)&&(Ta=null),Ma!==null&&ii(Ma)&&(Ma=null),Aa!==null&&ii(Aa)&&(Aa=null),xr.forEach(Fp),gr.forEach(Fp)}function ci(e,t){e.blockedOn===t&&(e.blockedOn=null,nd||(nd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,_b)))}var ui=null;function Pp(e){ui!==e&&(ui=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){ui===e&&(ui=null);for(var t=0;t<e.length;t+=3){var a=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(td(l||a)===null)continue;break}var d=ia(a);d!==null&&(e.splice(t,3),t-=3,tu(d,{pending:!0,data:c,method:a.method,action:l},l,c))}}))}function br(e){function t(O){return ci(O,e)}Ta!==null&&ci(Ta,e),Ma!==null&&ci(Ma,e),Aa!==null&&ci(Aa,e),xr.forEach(t),gr.forEach(t);for(var a=0;a<Ra.length;a++){var l=Ra[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ra.length&&(a=Ra[0],a.blockedOn===null);)Ip(a),a.blockedOn===null&&Ra.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var c=a[l],d=a[l+1],y=c[Ut]||null;if(typeof d=="function")y||Pp(a);else if(y){var w=null;if(d&&d.hasAttribute("formAction")){if(c=d,y=d[Ut]||null)w=y.formAction;else if(td(c)!==null)continue}else w=y.action;typeof w=="function"?a[l+1]=w:(a.splice(l,3),l-=3),Pp(a)}}}function ad(e){this._internalRoot=e}di.prototype.render=ad.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var a=t.current,l=nn();Zp(a,l,e,t,null,null)},di.prototype.unmount=ad.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Zp(e.current,2,null,e,null,null),Zo(),t[oa]=null}};function di(e){this._internalRoot=e}di.prototype.unstable_scheduleHydration=function(e){if(e){var t=Jr();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Ra.length&&t!==0&&t<Ra[a].priority;a++);Ra.splice(a,0,e),a===0&&Ip(e)}};var ex=r.version;if(ex!=="19.1.1")throw Error(i(527,ex,"19.1.1"));$.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=x(t),e=e!==null?m(e):null,e=e===null?null:e.stateNode,e};var Cb={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fi=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fi.isDisabled&&fi.supportsFiber)try{ft=fi.inject(Cb),nt=fi}catch{}}return jr.createRoot=function(e,t){if(!u(e))throw Error(i(299));var a=!1,l="",c=xm,d=gm,y=ym,w=null;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError),t.unstable_transitionCallbacks!==void 0&&(w=t.unstable_transitionCallbacks)),t=Gp(e,1,!1,null,null,a,l,c,d,y,w,null),e[oa]=t.current,Bu(e),new ad(t)},jr.hydrateRoot=function(e,t,a){if(!u(e))throw Error(i(299));var l=!1,c="",d=xm,y=gm,w=ym,O=null,J=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(d=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError),a.unstable_transitionCallbacks!==void 0&&(O=a.unstable_transitionCallbacks),a.formState!==void 0&&(J=a.formState)),t=Gp(e,1,!0,t,a??null,l,c,d,y,w,O,J),t.context=Xp(null),a=t.current,l=nn(),l=wl(l),c=pa(l),c.callback=null,xa(a,c,l),a=l,t.current.lanes=a,ra(t,a),Rn(t),e[oa]=t.current,Bu(e),new di(t)},jr.version="19.1.1",jr}var ux;function $b(){if(ux)return rd.exports;ux=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),rd.exports=Hb(),rd.exports}var Ub=$b();/**
48
+ `+a.stack}}function cn(e){switch(typeof e){case"bigint":case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function Sf(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function Ey(e){var t=Sf(e)?"checked":"value",a=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),l=""+e[t];if(!e.hasOwnProperty(t)&&typeof a<"u"&&typeof a.get=="function"&&typeof a.set=="function"){var c=a.get,d=a.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return c.call(this)},set:function(y){l=""+y,d.call(this,y)}}),Object.defineProperty(e,t,{enumerable:a.enumerable}),{getValue:function(){return l},setValue:function(y){l=""+y},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function so(e){e._valueTracker||(e._valueTracker=Ey(e))}function Ef(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var a=t.getValue(),l="";return e&&(l=Sf(e)?e.checked?"true":"false":e.value),e=l,e!==a?(t.setValue(e),!0):!1}function lo(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var ky=/[\n"\\]/g;function un(e){return e.replace(ky,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function tc(e,t,a,l,c,d,y,w){e.name="",y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"?e.type=y:e.removeAttribute("type"),t!=null?y==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+cn(t)):e.value!==""+cn(t)&&(e.value=""+cn(t)):y!=="submit"&&y!=="reset"||e.removeAttribute("value"),t!=null?nc(e,y,cn(t)):a!=null?nc(e,y,cn(a)):l!=null&&e.removeAttribute("value"),c==null&&d!=null&&(e.defaultChecked=!!d),c!=null&&(e.checked=c&&typeof c!="function"&&typeof c!="symbol"),w!=null&&typeof w!="function"&&typeof w!="symbol"&&typeof w!="boolean"?e.name=""+cn(w):e.removeAttribute("name")}function kf(e,t,a,l,c,d,y,w){if(d!=null&&typeof d!="function"&&typeof d!="symbol"&&typeof d!="boolean"&&(e.type=d),t!=null||a!=null){if(!(d!=="submit"&&d!=="reset"||t!=null))return;a=a!=null?""+cn(a):"",t=t!=null?""+cn(t):a,w||t===e.value||(e.value=t),e.defaultValue=t}l=l??c,l=typeof l!="function"&&typeof l!="symbol"&&!!l,e.checked=w?e.checked:!!l,e.defaultChecked=!!l,y!=null&&typeof y!="function"&&typeof y!="symbol"&&typeof y!="boolean"&&(e.name=y)}function nc(e,t,a){t==="number"&&lo(e.ownerDocument)===e||e.defaultValue===""+a||(e.defaultValue=""+a)}function Ns(e,t,a,l){if(e=e.options,t){t={};for(var c=0;c<a.length;c++)t["$"+a[c]]=!0;for(a=0;a<e.length;a++)c=t.hasOwnProperty("$"+e[a].value),e[a].selected!==c&&(e[a].selected=c),c&&l&&(e[a].defaultSelected=!0)}else{for(a=""+cn(a),t=null,c=0;c<e.length;c++){if(e[c].value===a){e[c].selected=!0,l&&(e[c].defaultSelected=!0);return}t!==null||e[c].disabled||(t=e[c])}t!==null&&(t.selected=!0)}}function _f(e,t,a){if(t!=null&&(t=""+cn(t),t!==e.value&&(e.value=t),a==null)){e.defaultValue!==t&&(e.defaultValue=t);return}e.defaultValue=a!=null?""+cn(a):""}function Cf(e,t,a,l){if(t==null){if(l!=null){if(a!=null)throw Error(i(92));if(W(l)){if(1<l.length)throw Error(i(93));l=l[0]}a=l}a==null&&(a=""),t=a}a=cn(t),e.defaultValue=a,l=e.textContent,l===a&&l!==""&&l!==null&&(e.value=l)}function ws(e,t){if(t){var a=e.firstChild;if(a&&a===e.lastChild&&a.nodeType===3){a.nodeValue=t;return}}e.textContent=t}var _y=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 Tf(e,t,a){var l=t.indexOf("--")===0;a==null||typeof a=="boolean"||a===""?l?e.setProperty(t,""):t==="float"?e.cssFloat="":e[t]="":l?e.setProperty(t,a):typeof a!="number"||a===0||_y.has(t)?t==="float"?e.cssFloat=a:e[t]=(""+a).trim():e[t]=a+"px"}function Mf(e,t,a){if(t!=null&&typeof t!="object")throw Error(i(62));if(e=e.style,a!=null){for(var l in a)!a.hasOwnProperty(l)||t!=null&&t.hasOwnProperty(l)||(l.indexOf("--")===0?e.setProperty(l,""):l==="float"?e.cssFloat="":e[l]="");for(var c in t)l=t[c],t.hasOwnProperty(c)&&a[c]!==l&&Tf(e,c,l)}else for(var d in t)t.hasOwnProperty(d)&&Tf(e,d,t[d])}function ac(e){if(e.indexOf("-")===-1)return!1;switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Cy=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"]]),Ty=/^[\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 ro(e){return Ty.test(""+e)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":e}var sc=null;function lc(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Ss=null,Es=null;function Af(e){var t=ia(e);if(t&&(e=t.stateNode)){var a=e[Bt]||null;e:switch(e=t.stateNode,t.type){case"input":if(tc(e,a.value,a.defaultValue,a.defaultValue,a.checked,a.defaultChecked,a.type,a.name),t=a.name,a.type==="radio"&&t!=null){for(a=e;a.parentNode;)a=a.parentNode;for(a=a.querySelectorAll('input[name="'+un(""+t)+'"][type="radio"]'),t=0;t<a.length;t++){var l=a[t];if(l!==e&&l.form===e.form){var c=l[Bt]||null;if(!c)throw Error(i(90));tc(l,c.value,c.defaultValue,c.defaultValue,c.checked,c.defaultChecked,c.type,c.name)}}for(t=0;t<a.length;t++)l=a[t],l.form===e.form&&Ef(l)}break e;case"textarea":_f(e,a.value,a.defaultValue);break e;case"select":t=a.value,t!=null&&Ns(e,!!a.multiple,t,!1)}}}var rc=!1;function Rf(e,t,a){if(rc)return e(t,a);rc=!0;try{var l=e(t);return l}finally{if(rc=!1,(Ss!==null||Es!==null)&&(Zo(),Ss&&(t=Ss,e=Es,Es=Ss=null,Af(t),e)))for(t=0;t<e.length;t++)Af(e[t])}}function Cl(e,t){var a=e.stateNode;if(a===null)return null;var l=a[Bt]||null;if(l===null)return null;a=l[t];e:switch(t){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(l=!l.disabled)||(e=e.type,l=!(e==="button"||e==="input"||e==="select"||e==="textarea")),e=!l;break e;default:e=!1}if(e)return null;if(a&&typeof a!="function")throw Error(i(231,t,typeof a));return a}var Un=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),oc=!1;if(Un)try{var Tl={};Object.defineProperty(Tl,"passive",{get:function(){oc=!0}}),window.addEventListener("test",Tl,Tl),window.removeEventListener("test",Tl,Tl)}catch{oc=!1}var fa=null,ic=null,oo=null;function zf(){if(oo)return oo;var e,t=ic,a=t.length,l,c="value"in fa?fa.value:fa.textContent,d=c.length;for(e=0;e<a&&t[e]===c[e];e++);var y=a-e;for(l=1;l<=y&&t[a-l]===c[d-l];l++);return oo=c.slice(e,1<l?1-l:void 0)}function io(e){var t=e.keyCode;return"charCode"in e?(e=e.charCode,e===0&&t===13&&(e=13)):e=t,e===10&&(e=13),32<=e||e===13?e:0}function co(){return!0}function Of(){return!1}function Xt(e){function t(a,l,c,d,y){this._reactName=a,this._targetInst=c,this.type=l,this.nativeEvent=d,this.target=y,this.currentTarget=null;for(var w in e)e.hasOwnProperty(w)&&(a=e[w],this[w]=a?a(d):d[w]);return this.isDefaultPrevented=(d.defaultPrevented!=null?d.defaultPrevented:d.returnValue===!1)?co:Of,this.isPropagationStopped=Of,this}return p(t.prototype,{preventDefault:function(){this.defaultPrevented=!0;var a=this.nativeEvent;a&&(a.preventDefault?a.preventDefault():typeof a.returnValue!="unknown"&&(a.returnValue=!1),this.isDefaultPrevented=co)},stopPropagation:function(){var a=this.nativeEvent;a&&(a.stopPropagation?a.stopPropagation():typeof a.cancelBubble!="unknown"&&(a.cancelBubble=!0),this.isPropagationStopped=co)},persist:function(){},isPersistent:co}),t}var Za={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(e){return e.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},uo=Xt(Za),Ml=p({},Za,{view:0,detail:0}),My=Xt(Ml),cc,uc,Al,fo=p({},Ml,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:fc,button:0,buttons:0,relatedTarget:function(e){return e.relatedTarget===void 0?e.fromElement===e.srcElement?e.toElement:e.fromElement:e.relatedTarget},movementX:function(e){return"movementX"in e?e.movementX:(e!==Al&&(Al&&e.type==="mousemove"?(cc=e.screenX-Al.screenX,uc=e.screenY-Al.screenY):uc=cc=0,Al=e),cc)},movementY:function(e){return"movementY"in e?e.movementY:uc}}),Df=Xt(fo),Ay=p({},fo,{dataTransfer:0}),Ry=Xt(Ay),zy=p({},Ml,{relatedTarget:0}),dc=Xt(zy),Oy=p({},Za,{animationName:0,elapsedTime:0,pseudoElement:0}),Dy=Xt(Oy),Hy=p({},Za,{clipboardData:function(e){return"clipboardData"in e?e.clipboardData:window.clipboardData}}),$y=Xt(Hy),Uy=p({},Za,{data:0}),Hf=Xt(Uy),By={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},qy={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"},Ly={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Yy(e){var t=this.nativeEvent;return t.getModifierState?t.getModifierState(e):(e=Ly[e])?!!t[e]:!1}function fc(){return Yy}var Vy=p({},Ml,{key:function(e){if(e.key){var t=By[e.key]||e.key;if(t!=="Unidentified")return t}return e.type==="keypress"?(e=io(e),e===13?"Enter":String.fromCharCode(e)):e.type==="keydown"||e.type==="keyup"?qy[e.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:fc,charCode:function(e){return e.type==="keypress"?io(e):0},keyCode:function(e){return e.type==="keydown"||e.type==="keyup"?e.keyCode:0},which:function(e){return e.type==="keypress"?io(e):e.type==="keydown"||e.type==="keyup"?e.keyCode:0}}),Gy=Xt(Vy),Xy=p({},fo,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),$f=Xt(Xy),Zy=p({},Ml,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:fc}),Wy=Xt(Zy),Qy=p({},Za,{propertyName:0,elapsedTime:0,pseudoElement:0}),Ky=Xt(Qy),Jy=p({},fo,{deltaX:function(e){return"deltaX"in e?e.deltaX:"wheelDeltaX"in e?-e.wheelDeltaX:0},deltaY:function(e){return"deltaY"in e?e.deltaY:"wheelDeltaY"in e?-e.wheelDeltaY:"wheelDelta"in e?-e.wheelDelta:0},deltaZ:0,deltaMode:0}),Iy=Xt(Jy),Fy=p({},Za,{newState:0,oldState:0}),Py=Xt(Fy),e1=[9,13,27,32],hc=Un&&"CompositionEvent"in window,Rl=null;Un&&"documentMode"in document&&(Rl=document.documentMode);var t1=Un&&"TextEvent"in window&&!Rl,Uf=Un&&(!hc||Rl&&8<Rl&&11>=Rl),Bf=" ",qf=!1;function Lf(e,t){switch(e){case"keyup":return e1.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Yf(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var ks=!1;function n1(e,t){switch(e){case"compositionend":return Yf(t);case"keypress":return t.which!==32?null:(qf=!0,Bf);case"textInput":return e=t.data,e===Bf&&qf?null:e;default:return null}}function a1(e,t){if(ks)return e==="compositionend"||!hc&&Lf(e,t)?(e=zf(),oo=ic=fa=null,ks=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1<t.char.length)return t.char;if(t.which)return String.fromCharCode(t.which)}return null;case"compositionend":return Uf&&t.locale!=="ko"?null:t.data;default:return null}}var s1={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 Vf(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t==="input"?!!s1[e.type]:t==="textarea"}function Gf(e,t,a,l){Ss?Es?Es.push(l):Es=[l]:Ss=l,t=Fo(t,"onChange"),0<t.length&&(a=new uo("onChange","change",null,a,l),e.push({event:a,listeners:t}))}var zl=null,Ol=null;function l1(e){Sp(e,0)}function ho(e){var t=Ga(e);if(Ef(t))return e}function Xf(e,t){if(e==="change")return t}var Zf=!1;if(Un){var mc;if(Un){var pc="oninput"in document;if(!pc){var Wf=document.createElement("div");Wf.setAttribute("oninput","return;"),pc=typeof Wf.oninput=="function"}mc=pc}else mc=!1;Zf=mc&&(!document.documentMode||9<document.documentMode)}function Qf(){zl&&(zl.detachEvent("onpropertychange",Kf),Ol=zl=null)}function Kf(e){if(e.propertyName==="value"&&ho(Ol)){var t=[];Gf(t,Ol,e,lc(e)),Rf(l1,t)}}function r1(e,t,a){e==="focusin"?(Qf(),zl=t,Ol=a,zl.attachEvent("onpropertychange",Kf)):e==="focusout"&&Qf()}function o1(e){if(e==="selectionchange"||e==="keyup"||e==="keydown")return ho(Ol)}function i1(e,t){if(e==="click")return ho(t)}function c1(e,t){if(e==="input"||e==="change")return ho(t)}function u1(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var Ft=typeof Object.is=="function"?Object.is:u1;function Dl(e,t){if(Ft(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;var a=Object.keys(e),l=Object.keys(t);if(a.length!==l.length)return!1;for(l=0;l<a.length;l++){var c=a[l];if(!Te.call(t,c)||!Ft(e[c],t[c]))return!1}return!0}function Jf(e){for(;e&&e.firstChild;)e=e.firstChild;return e}function If(e,t){var a=Jf(e);e=0;for(var l;a;){if(a.nodeType===3){if(l=e+a.textContent.length,e<=t&&l>=t)return{node:a,offset:t-e};e=l}e:{for(;a;){if(a.nextSibling){a=a.nextSibling;break e}a=a.parentNode}a=void 0}a=Jf(a)}}function Ff(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Ff(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Pf(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=lo(e.document);t instanceof e.HTMLIFrameElement;){try{var a=typeof t.contentWindow.location.href=="string"}catch{a=!1}if(a)e=t.contentWindow;else break;t=lo(e.document)}return t}function xc(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var d1=Un&&"documentMode"in document&&11>=document.documentMode,_s=null,gc=null,Hl=null,yc=!1;function eh(e,t,a){var l=a.window===a?a.document:a.nodeType===9?a:a.ownerDocument;yc||_s==null||_s!==lo(l)||(l=_s,"selectionStart"in l&&xc(l)?l={start:l.selectionStart,end:l.selectionEnd}:(l=(l.ownerDocument&&l.ownerDocument.defaultView||window).getSelection(),l={anchorNode:l.anchorNode,anchorOffset:l.anchorOffset,focusNode:l.focusNode,focusOffset:l.focusOffset}),Hl&&Dl(Hl,l)||(Hl=l,l=Fo(gc,"onSelect"),0<l.length&&(t=new uo("onSelect","select",null,t,a),e.push({event:t,listeners:l}),t.target=_s)))}function Wa(e,t){var a={};return a[e.toLowerCase()]=t.toLowerCase(),a["Webkit"+e]="webkit"+t,a["Moz"+e]="moz"+t,a}var Cs={animationend:Wa("Animation","AnimationEnd"),animationiteration:Wa("Animation","AnimationIteration"),animationstart:Wa("Animation","AnimationStart"),transitionrun:Wa("Transition","TransitionRun"),transitionstart:Wa("Transition","TransitionStart"),transitioncancel:Wa("Transition","TransitionCancel"),transitionend:Wa("Transition","TransitionEnd")},bc={},th={};Un&&(th=document.createElement("div").style,"AnimationEvent"in window||(delete Cs.animationend.animation,delete Cs.animationiteration.animation,delete Cs.animationstart.animation),"TransitionEvent"in window||delete Cs.transitionend.transition);function Qa(e){if(bc[e])return bc[e];if(!Cs[e])return e;var t=Cs[e],a;for(a in t)if(t.hasOwnProperty(a)&&a in th)return bc[e]=t[a];return e}var nh=Qa("animationend"),ah=Qa("animationiteration"),sh=Qa("animationstart"),f1=Qa("transitionrun"),h1=Qa("transitionstart"),m1=Qa("transitioncancel"),lh=Qa("transitionend"),rh=new Map,vc="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(" ");vc.push("scrollEnd");function jn(e,t){rh.set(e,t),$n(t,[e])}var oh=new WeakMap;function dn(e,t){if(typeof e=="object"&&e!==null){var a=oh.get(e);return a!==void 0?a:(t={value:e,source:t,stack:wf(t)},oh.set(e,t),t)}return{value:e,source:t,stack:wf(t)}}var fn=[],Ts=0,jc=0;function mo(){for(var e=Ts,t=jc=Ts=0;t<e;){var a=fn[t];fn[t++]=null;var l=fn[t];fn[t++]=null;var c=fn[t];fn[t++]=null;var d=fn[t];if(fn[t++]=null,l!==null&&c!==null){var y=l.pending;y===null?c.next=c:(c.next=y.next,y.next=c),l.pending=c}d!==0&&ih(a,c,d)}}function po(e,t,a,l){fn[Ts++]=e,fn[Ts++]=t,fn[Ts++]=a,fn[Ts++]=l,jc|=l,e.lanes|=l,e=e.alternate,e!==null&&(e.lanes|=l)}function Nc(e,t,a,l){return po(e,t,a,l),xo(e)}function Ms(e,t){return po(e,null,null,t),xo(e)}function ih(e,t,a){e.lanes|=a;var l=e.alternate;l!==null&&(l.lanes|=a);for(var c=!1,d=e.return;d!==null;)d.childLanes|=a,l=d.alternate,l!==null&&(l.childLanes|=a),d.tag===22&&(e=d.stateNode,e===null||e._visibility&1||(c=!0)),e=d,d=d.return;return e.tag===3?(d=e.stateNode,c&&t!==null&&(c=31-at(a),e=d.hiddenUpdates,l=e[c],l===null?e[c]=[t]:l.push(t),t.lane=a|536870912),d):null}function xo(e){if(50<or)throw or=0,Cu=null,Error(i(185));for(var t=e.return;t!==null;)e=t,t=e.return;return e.tag===3?e.stateNode:null}var As={};function p1(e,t,a,l){this.tag=e,this.key=a,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=l,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Pt(e,t,a,l){return new p1(e,t,a,l)}function wc(e){return e=e.prototype,!(!e||!e.isReactComponent)}function Bn(e,t){var a=e.alternate;return a===null?(a=Pt(e.tag,t,e.key,e.mode),a.elementType=e.elementType,a.type=e.type,a.stateNode=e.stateNode,a.alternate=e,e.alternate=a):(a.pendingProps=t,a.type=e.type,a.flags=0,a.subtreeFlags=0,a.deletions=null),a.flags=e.flags&65011712,a.childLanes=e.childLanes,a.lanes=e.lanes,a.child=e.child,a.memoizedProps=e.memoizedProps,a.memoizedState=e.memoizedState,a.updateQueue=e.updateQueue,t=e.dependencies,a.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},a.sibling=e.sibling,a.index=e.index,a.ref=e.ref,a.refCleanup=e.refCleanup,a}function ch(e,t){e.flags&=65011714;var a=e.alternate;return a===null?(e.childLanes=0,e.lanes=t,e.child=null,e.subtreeFlags=0,e.memoizedProps=null,e.memoizedState=null,e.updateQueue=null,e.dependencies=null,e.stateNode=null):(e.childLanes=a.childLanes,e.lanes=a.lanes,e.child=a.child,e.subtreeFlags=0,e.deletions=null,e.memoizedProps=a.memoizedProps,e.memoizedState=a.memoizedState,e.updateQueue=a.updateQueue,e.type=a.type,t=a.dependencies,e.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),e}function go(e,t,a,l,c,d){var y=0;if(l=e,typeof e=="function")wc(e)&&(y=1);else if(typeof e=="string")y=gb(e,a,ie.current)?26:e==="html"||e==="head"||e==="body"?27:5;else e:switch(e){case I:return e=Pt(31,a,t,c),e.elementType=I,e.lanes=d,e;case C:return Ka(a.children,c,d,t);case k:y=8,c|=24;break;case R:return e=Pt(12,a,t,c|2),e.elementType=R,e.lanes=d,e;case H:return e=Pt(13,a,t,c),e.elementType=H,e.lanes=d,e;case Z:return e=Pt(19,a,t,c),e.elementType=Z,e.lanes=d,e;default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case z:case q:y=10;break e;case V:y=9;break e;case M:y=11;break e;case X:y=14;break e;case oe:y=16,l=null;break e}y=29,a=Error(i(130,e===null?"null":typeof e,"")),l=null}return t=Pt(y,a,t,c),t.elementType=e,t.type=l,t.lanes=d,t}function Ka(e,t,a,l){return e=Pt(7,e,l,t),e.lanes=a,e}function Sc(e,t,a){return e=Pt(6,e,null,t),e.lanes=a,e}function Ec(e,t,a){return t=Pt(4,e.children!==null?e.children:[],e.key,t),t.lanes=a,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}var Rs=[],zs=0,yo=null,bo=0,hn=[],mn=0,Ja=null,qn=1,Ln="";function Ia(e,t){Rs[zs++]=bo,Rs[zs++]=yo,yo=e,bo=t}function uh(e,t,a){hn[mn++]=qn,hn[mn++]=Ln,hn[mn++]=Ja,Ja=e;var l=qn;e=Ln;var c=32-at(l)-1;l&=~(1<<c),a+=1;var d=32-at(t)+c;if(30<d){var y=c-c%5;d=(l&(1<<y)-1).toString(32),l>>=y,c-=y,qn=1<<32-at(t)+c|a<<c|l,Ln=d+e}else qn=1<<d|a<<c|l,Ln=e}function kc(e){e.return!==null&&(Ia(e,1),uh(e,1,0))}function _c(e){for(;e===yo;)yo=Rs[--zs],Rs[zs]=null,bo=Rs[--zs],Rs[zs]=null;for(;e===Ja;)Ja=hn[--mn],hn[mn]=null,Ln=hn[--mn],hn[mn]=null,qn=hn[--mn],hn[mn]=null}var Gt=null,ot=null,Ze=!1,Fa=null,Cn=!1,Cc=Error(i(519));function Pa(e){var t=Error(i(418,""));throw Bl(dn(t,e)),Cc}function dh(e){var t=e.stateNode,a=e.type,l=e.memoizedProps;switch(t[St]=e,t[Bt]=l,a){case"dialog":qe("cancel",t),qe("close",t);break;case"iframe":case"object":case"embed":qe("load",t);break;case"video":case"audio":for(a=0;a<cr.length;a++)qe(cr[a],t);break;case"source":qe("error",t);break;case"img":case"image":case"link":qe("error",t),qe("load",t);break;case"details":qe("toggle",t);break;case"input":qe("invalid",t),kf(t,l.value,l.defaultValue,l.checked,l.defaultChecked,l.type,l.name,!0),so(t);break;case"select":qe("invalid",t);break;case"textarea":qe("invalid",t),Cf(t,l.value,l.defaultValue,l.children),so(t)}a=l.children,typeof a!="string"&&typeof a!="number"&&typeof a!="bigint"||t.textContent===""+a||l.suppressHydrationWarning===!0||Cp(t.textContent,a)?(l.popover!=null&&(qe("beforetoggle",t),qe("toggle",t)),l.onScroll!=null&&qe("scroll",t),l.onScrollEnd!=null&&qe("scrollend",t),l.onClick!=null&&(t.onclick=Po),t=!0):t=!1,t||Pa(e)}function fh(e){for(Gt=e.return;Gt;)switch(Gt.tag){case 5:case 13:Cn=!1;return;case 27:case 3:Cn=!0;return;default:Gt=Gt.return}}function $l(e){if(e!==Gt)return!1;if(!Ze)return fh(e),Ze=!0,!1;var t=e.tag,a;if((a=t!==3&&t!==27)&&((a=t===5)&&(a=e.type,a=!(a!=="form"&&a!=="button")||Gu(e.type,e.memoizedProps)),a=!a),a&&ot&&Pa(e),fh(e),t===13){if(e=e.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(i(317));e:{for(e=e.nextSibling,t=0;e;){if(e.nodeType===8)if(a=e.data,a==="/$"){if(t===0){ot=wn(e.nextSibling);break e}t--}else a!=="$"&&a!=="$!"&&a!=="$?"||t++;e=e.nextSibling}ot=null}}else t===27?(t=ot,Ca(e.type)?(e=Qu,Qu=null,ot=e):ot=t):ot=Gt?wn(e.stateNode.nextSibling):null;return!0}function Ul(){ot=Gt=null,Ze=!1}function hh(){var e=Fa;return e!==null&&(Qt===null?Qt=e:Qt.push.apply(Qt,e),Fa=null),e}function Bl(e){Fa===null?Fa=[e]:Fa.push(e)}var Tc=D(null),es=null,Yn=null;function ha(e,t,a){F(Tc,t._currentValue),t._currentValue=a}function Vn(e){e._currentValue=Tc.current,L(Tc)}function Mc(e,t,a){for(;e!==null;){var l=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,l!==null&&(l.childLanes|=t)):l!==null&&(l.childLanes&t)!==t&&(l.childLanes|=t),e===a)break;e=e.return}}function Ac(e,t,a,l){var c=e.child;for(c!==null&&(c.return=e);c!==null;){var d=c.dependencies;if(d!==null){var y=c.child;d=d.firstContext;e:for(;d!==null;){var w=d;d=c;for(var O=0;O<t.length;O++)if(w.context===t[O]){d.lanes|=a,w=d.alternate,w!==null&&(w.lanes|=a),Mc(d.return,a,e),l||(y=null);break e}d=w.next}}else if(c.tag===18){if(y=c.return,y===null)throw Error(i(341));y.lanes|=a,d=y.alternate,d!==null&&(d.lanes|=a),Mc(y,a,e),y=null}else y=c.child;if(y!==null)y.return=c;else for(y=c;y!==null;){if(y===e){y=null;break}if(c=y.sibling,c!==null){c.return=y.return,y=c;break}y=y.return}c=y}}function ql(e,t,a,l){e=null;for(var c=t,d=!1;c!==null;){if(!d){if((c.flags&524288)!==0)d=!0;else if((c.flags&262144)!==0)break}if(c.tag===10){var y=c.alternate;if(y===null)throw Error(i(387));if(y=y.memoizedProps,y!==null){var w=c.type;Ft(c.pendingProps.value,y.value)||(e!==null?e.push(w):e=[w])}}else if(c===Se.current){if(y=c.alternate,y===null)throw Error(i(387));y.memoizedState.memoizedState!==c.memoizedState.memoizedState&&(e!==null?e.push(pr):e=[pr])}c=c.return}e!==null&&Ac(t,e,a,l),t.flags|=262144}function vo(e){for(e=e.firstContext;e!==null;){if(!Ft(e.context._currentValue,e.memoizedValue))return!0;e=e.next}return!1}function ts(e){es=e,Yn=null,e=e.dependencies,e!==null&&(e.firstContext=null)}function qt(e){return mh(es,e)}function jo(e,t){return es===null&&ts(e),mh(e,t)}function mh(e,t){var a=t._currentValue;if(t={context:t,memoizedValue:a,next:null},Yn===null){if(e===null)throw Error(i(308));Yn=t,e.dependencies={lanes:0,firstContext:t},e.flags|=524288}else Yn=Yn.next=t;return a}var x1=typeof AbortController<"u"?AbortController:function(){var e=[],t=this.signal={aborted:!1,addEventListener:function(a,l){e.push(l)}};this.abort=function(){t.aborted=!0,e.forEach(function(a){return a()})}},g1=n.unstable_scheduleCallback,y1=n.unstable_NormalPriority,vt={$$typeof:q,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function Rc(){return{controller:new x1,data:new Map,refCount:0}}function Ll(e){e.refCount--,e.refCount===0&&g1(y1,function(){e.controller.abort()})}var Yl=null,zc=0,Os=0,Ds=null;function b1(e,t){if(Yl===null){var a=Yl=[];zc=0,Os=Du(),Ds={status:"pending",value:void 0,then:function(l){a.push(l)}}}return zc++,t.then(ph,ph),t}function ph(){if(--zc===0&&Yl!==null){Ds!==null&&(Ds.status="fulfilled");var e=Yl;Yl=null,Os=0,Ds=null;for(var t=0;t<e.length;t++)(0,e[t])()}}function v1(e,t){var a=[],l={status:"pending",value:null,reason:null,then:function(c){a.push(c)}};return e.then(function(){l.status="fulfilled",l.value=t;for(var c=0;c<a.length;c++)(0,a[c])(t)},function(c){for(l.status="rejected",l.reason=c,c=0;c<a.length;c++)(0,a[c])(void 0)}),l}var xh=E.S;E.S=function(e,t){typeof t=="object"&&t!==null&&typeof t.then=="function"&&b1(e,t),xh!==null&&xh(e,t)};var ns=D(null);function Oc(){var e=ns.current;return e!==null?e:et.pooledCache}function No(e,t){t===null?F(ns,ns.current):F(ns,t.pool)}function gh(){var e=Oc();return e===null?null:{parent:vt._currentValue,pool:e}}var Vl=Error(i(460)),yh=Error(i(474)),wo=Error(i(542)),Dc={then:function(){}};function bh(e){return e=e.status,e==="fulfilled"||e==="rejected"}function So(){}function vh(e,t,a){switch(a=e[a],a===void 0?e.push(t):a!==t&&(t.then(So,So),t=a),t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Nh(e),e;default:if(typeof t.status=="string")t.then(So,So);else{if(e=et,e!==null&&100<e.shellSuspendCounter)throw Error(i(482));e=t,e.status="pending",e.then(function(l){if(t.status==="pending"){var c=t;c.status="fulfilled",c.value=l}},function(l){if(t.status==="pending"){var c=t;c.status="rejected",c.reason=l}})}switch(t.status){case"fulfilled":return t.value;case"rejected":throw e=t.reason,Nh(e),e}throw Gl=t,Vl}}var Gl=null;function jh(){if(Gl===null)throw Error(i(459));var e=Gl;return Gl=null,e}function Nh(e){if(e===Vl||e===wo)throw Error(i(483))}var ma=!1;function Hc(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function $c(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function pa(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function xa(e,t,a){var l=e.updateQueue;if(l===null)return null;if(l=l.shared,(Qe&2)!==0){var c=l.pending;return c===null?t.next=t:(t.next=c.next,c.next=t),l.pending=t,t=xo(e),ih(e,null,a),t}return po(e,l,t,a),xo(e)}function Xl(e,t,a){if(t=t.updateQueue,t!==null&&(t=t.shared,(a&4194048)!==0)){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,Kr(e,a)}}function Uc(e,t){var a=e.updateQueue,l=e.alternate;if(l!==null&&(l=l.updateQueue,a===l)){var c=null,d=null;if(a=a.firstBaseUpdate,a!==null){do{var y={lane:a.lane,tag:a.tag,payload:a.payload,callback:null,next:null};d===null?c=d=y:d=d.next=y,a=a.next}while(a!==null);d===null?c=d=t:d=d.next=t}else c=d=t;a={baseState:l.baseState,firstBaseUpdate:c,lastBaseUpdate:d,shared:l.shared,callbacks:l.callbacks},e.updateQueue=a;return}e=a.lastBaseUpdate,e===null?a.firstBaseUpdate=t:e.next=t,a.lastBaseUpdate=t}var Bc=!1;function Zl(){if(Bc){var e=Ds;if(e!==null)throw e}}function Wl(e,t,a,l){Bc=!1;var c=e.updateQueue;ma=!1;var d=c.firstBaseUpdate,y=c.lastBaseUpdate,w=c.shared.pending;if(w!==null){c.shared.pending=null;var O=w,J=O.next;O.next=null,y===null?d=J:y.next=J,y=O;var ce=e.alternate;ce!==null&&(ce=ce.updateQueue,w=ce.lastBaseUpdate,w!==y&&(w===null?ce.firstBaseUpdate=J:w.next=J,ce.lastBaseUpdate=O))}if(d!==null){var fe=c.baseState;y=0,ce=J=O=null,w=d;do{var P=w.lane&-536870913,ne=P!==w.lane;if(ne?(Ye&P)===P:(l&P)===P){P!==0&&P===Os&&(Bc=!0),ce!==null&&(ce=ce.next={lane:0,tag:w.tag,payload:w.payload,callback:null,next:null});e:{var Me=e,_e=w;P=t;var Fe=a;switch(_e.tag){case 1:if(Me=_e.payload,typeof Me=="function"){fe=Me.call(Fe,fe,P);break e}fe=Me;break e;case 3:Me.flags=Me.flags&-65537|128;case 0:if(Me=_e.payload,P=typeof Me=="function"?Me.call(Fe,fe,P):Me,P==null)break e;fe=p({},fe,P);break e;case 2:ma=!0}}P=w.callback,P!==null&&(e.flags|=64,ne&&(e.flags|=8192),ne=c.callbacks,ne===null?c.callbacks=[P]:ne.push(P))}else ne={lane:P,tag:w.tag,payload:w.payload,callback:w.callback,next:null},ce===null?(J=ce=ne,O=fe):ce=ce.next=ne,y|=P;if(w=w.next,w===null){if(w=c.shared.pending,w===null)break;ne=w,w=ne.next,ne.next=null,c.lastBaseUpdate=ne,c.shared.pending=null}}while(!0);ce===null&&(O=fe),c.baseState=O,c.firstBaseUpdate=J,c.lastBaseUpdate=ce,d===null&&(c.shared.lanes=0),Sa|=y,e.lanes=y,e.memoizedState=fe}}function wh(e,t){if(typeof e!="function")throw Error(i(191,e));e.call(t)}function Sh(e,t){var a=e.callbacks;if(a!==null)for(e.callbacks=null,e=0;e<a.length;e++)wh(a[e],t)}var Hs=D(null),Eo=D(0);function Eh(e,t){e=Jn,F(Eo,e),F(Hs,t),Jn=e|t.baseLanes}function qc(){F(Eo,Jn),F(Hs,Hs.current)}function Lc(){Jn=Eo.current,L(Hs),L(Eo)}var ga=0,He=null,Je=null,yt=null,ko=!1,$s=!1,as=!1,_o=0,Ql=0,Us=null,j1=0;function ht(){throw Error(i(321))}function Yc(e,t){if(t===null)return!1;for(var a=0;a<t.length&&a<e.length;a++)if(!Ft(e[a],t[a]))return!1;return!0}function Vc(e,t,a,l,c,d){return ga=d,He=t,t.memoizedState=null,t.updateQueue=null,t.lanes=0,E.H=e===null||e.memoizedState===null?im:cm,as=!1,d=a(l,c),as=!1,$s&&(d=_h(t,a,l,c)),kh(e),d}function kh(e){E.H=zo;var t=Je!==null&&Je.next!==null;if(ga=0,yt=Je=He=null,ko=!1,Ql=0,Us=null,t)throw Error(i(300));e===null||Et||(e=e.dependencies,e!==null&&vo(e)&&(Et=!0))}function _h(e,t,a,l){He=e;var c=0;do{if($s&&(Us=null),Ql=0,$s=!1,25<=c)throw Error(i(301));if(c+=1,yt=Je=null,e.updateQueue!=null){var d=e.updateQueue;d.lastEffect=null,d.events=null,d.stores=null,d.memoCache!=null&&(d.memoCache.index=0)}E.H=C1,d=t(a,l)}while($s);return d}function N1(){var e=E.H,t=e.useState()[0];return t=typeof t.then=="function"?Kl(t):t,e=e.useState()[0],(Je!==null?Je.memoizedState:null)!==e&&(He.flags|=1024),t}function Gc(){var e=_o!==0;return _o=0,e}function Xc(e,t,a){t.updateQueue=e.updateQueue,t.flags&=-2053,e.lanes&=~a}function Zc(e){if(ko){for(e=e.memoizedState;e!==null;){var t=e.queue;t!==null&&(t.pending=null),e=e.next}ko=!1}ga=0,yt=Je=He=null,$s=!1,Ql=_o=0,Us=null}function Zt(){var e={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return yt===null?He.memoizedState=yt=e:yt=yt.next=e,yt}function bt(){if(Je===null){var e=He.alternate;e=e!==null?e.memoizedState:null}else e=Je.next;var t=yt===null?He.memoizedState:yt.next;if(t!==null)yt=t,Je=e;else{if(e===null)throw He.alternate===null?Error(i(467)):Error(i(310));Je=e,e={memoizedState:Je.memoizedState,baseState:Je.baseState,baseQueue:Je.baseQueue,queue:Je.queue,next:null},yt===null?He.memoizedState=yt=e:yt=yt.next=e}return yt}function Wc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Kl(e){var t=Ql;return Ql+=1,Us===null&&(Us=[]),e=vh(Us,e,t),t=He,(yt===null?t.memoizedState:yt.next)===null&&(t=t.alternate,E.H=t===null||t.memoizedState===null?im:cm),e}function Co(e){if(e!==null&&typeof e=="object"){if(typeof e.then=="function")return Kl(e);if(e.$$typeof===q)return qt(e)}throw Error(i(438,String(e)))}function Qc(e){var t=null,a=He.updateQueue;if(a!==null&&(t=a.memoCache),t==null){var l=He.alternate;l!==null&&(l=l.updateQueue,l!==null&&(l=l.memoCache,l!=null&&(t={data:l.data.map(function(c){return c.slice()}),index:0})))}if(t==null&&(t={data:[],index:0}),a===null&&(a=Wc(),He.updateQueue=a),a.memoCache=t,a=t.data[t.index],a===void 0)for(a=t.data[t.index]=Array(e),l=0;l<e;l++)a[l]=K;return t.index++,a}function Gn(e,t){return typeof t=="function"?t(e):t}function To(e){var t=bt();return Kc(t,Je,e)}function Kc(e,t,a){var l=e.queue;if(l===null)throw Error(i(311));l.lastRenderedReducer=a;var c=e.baseQueue,d=l.pending;if(d!==null){if(c!==null){var y=c.next;c.next=d.next,d.next=y}t.baseQueue=c=d,l.pending=null}if(d=e.baseState,c===null)e.memoizedState=d;else{t=c.next;var w=y=null,O=null,J=t,ce=!1;do{var fe=J.lane&-536870913;if(fe!==J.lane?(Ye&fe)===fe:(ga&fe)===fe){var P=J.revertLane;if(P===0)O!==null&&(O=O.next={lane:0,revertLane:0,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null}),fe===Os&&(ce=!0);else if((ga&P)===P){J=J.next,P===Os&&(ce=!0);continue}else fe={lane:0,revertLane:J.revertLane,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},O===null?(w=O=fe,y=d):O=O.next=fe,He.lanes|=P,Sa|=P;fe=J.action,as&&a(d,fe),d=J.hasEagerState?J.eagerState:a(d,fe)}else P={lane:fe,revertLane:J.revertLane,action:J.action,hasEagerState:J.hasEagerState,eagerState:J.eagerState,next:null},O===null?(w=O=P,y=d):O=O.next=P,He.lanes|=fe,Sa|=fe;J=J.next}while(J!==null&&J!==t);if(O===null?y=d:O.next=w,!Ft(d,e.memoizedState)&&(Et=!0,ce&&(a=Ds,a!==null)))throw a;e.memoizedState=d,e.baseState=y,e.baseQueue=O,l.lastRenderedState=d}return c===null&&(l.lanes=0),[e.memoizedState,l.dispatch]}function Jc(e){var t=bt(),a=t.queue;if(a===null)throw Error(i(311));a.lastRenderedReducer=e;var l=a.dispatch,c=a.pending,d=t.memoizedState;if(c!==null){a.pending=null;var y=c=c.next;do d=e(d,y.action),y=y.next;while(y!==c);Ft(d,t.memoizedState)||(Et=!0),t.memoizedState=d,t.baseQueue===null&&(t.baseState=d),a.lastRenderedState=d}return[d,l]}function Ch(e,t,a){var l=He,c=bt(),d=Ze;if(d){if(a===void 0)throw Error(i(407));a=a()}else a=t();var y=!Ft((Je||c).memoizedState,a);y&&(c.memoizedState=a,Et=!0),c=c.queue;var w=Ah.bind(null,l,c,e);if(Jl(2048,8,w,[e]),c.getSnapshot!==t||y||yt!==null&&yt.memoizedState.tag&1){if(l.flags|=2048,Bs(9,Mo(),Mh.bind(null,l,c,a,t),null),et===null)throw Error(i(349));d||(ga&124)!==0||Th(l,t,a)}return a}function Th(e,t,a){e.flags|=16384,e={getSnapshot:t,value:a},t=He.updateQueue,t===null?(t=Wc(),He.updateQueue=t,t.stores=[e]):(a=t.stores,a===null?t.stores=[e]:a.push(e))}function Mh(e,t,a,l){t.value=a,t.getSnapshot=l,Rh(t)&&zh(e)}function Ah(e,t,a){return a(function(){Rh(t)&&zh(e)})}function Rh(e){var t=e.getSnapshot;e=e.value;try{var a=t();return!Ft(e,a)}catch{return!0}}function zh(e){var t=Ms(e,2);t!==null&&sn(t,e,2)}function Ic(e){var t=Zt();if(typeof e=="function"){var a=e;if(e=a(),as){xt(!0);try{a()}finally{xt(!1)}}}return t.memoizedState=t.baseState=e,t.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gn,lastRenderedState:e},t}function Oh(e,t,a,l){return e.baseState=a,Kc(e,Je,typeof l=="function"?l:Gn)}function w1(e,t,a,l,c){if(Ro(e))throw Error(i(485));if(e=t.action,e!==null){var d={payload:c,action:e,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(y){d.listeners.push(y)}};E.T!==null?a(!0):d.isTransition=!1,l(d),a=t.pending,a===null?(d.next=t.pending=d,Dh(t,d)):(d.next=a.next,t.pending=a.next=d)}}function Dh(e,t){var a=t.action,l=t.payload,c=e.state;if(t.isTransition){var d=E.T,y={};E.T=y;try{var w=a(c,l),O=E.S;O!==null&&O(y,w),Hh(e,t,w)}catch(J){Fc(e,t,J)}finally{E.T=d}}else try{d=a(c,l),Hh(e,t,d)}catch(J){Fc(e,t,J)}}function Hh(e,t,a){a!==null&&typeof a=="object"&&typeof a.then=="function"?a.then(function(l){$h(e,t,l)},function(l){return Fc(e,t,l)}):$h(e,t,a)}function $h(e,t,a){t.status="fulfilled",t.value=a,Uh(t),e.state=a,t=e.pending,t!==null&&(a=t.next,a===t?e.pending=null:(a=a.next,t.next=a,Dh(e,a)))}function Fc(e,t,a){var l=e.pending;if(e.pending=null,l!==null){l=l.next;do t.status="rejected",t.reason=a,Uh(t),t=t.next;while(t!==l)}e.action=null}function Uh(e){e=e.listeners;for(var t=0;t<e.length;t++)(0,e[t])()}function Bh(e,t){return t}function qh(e,t){if(Ze){var a=et.formState;if(a!==null){e:{var l=He;if(Ze){if(ot){t:{for(var c=ot,d=Cn;c.nodeType!==8;){if(!d){c=null;break t}if(c=wn(c.nextSibling),c===null){c=null;break t}}d=c.data,c=d==="F!"||d==="F"?c:null}if(c){ot=wn(c.nextSibling),l=c.data==="F!";break e}}Pa(l)}l=!1}l&&(t=a[0])}}return a=Zt(),a.memoizedState=a.baseState=t,l={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Bh,lastRenderedState:t},a.queue=l,a=lm.bind(null,He,l),l.dispatch=a,l=Ic(!1),d=au.bind(null,He,!1,l.queue),l=Zt(),c={state:t,dispatch:null,action:e,pending:null},l.queue=c,a=w1.bind(null,He,c,d,a),c.dispatch=a,l.memoizedState=e,[t,a,!1]}function Lh(e){var t=bt();return Yh(t,Je,e)}function Yh(e,t,a){if(t=Kc(e,t,Bh)[0],e=To(Gn)[0],typeof t=="object"&&t!==null&&typeof t.then=="function")try{var l=Kl(t)}catch(y){throw y===Vl?wo:y}else l=t;t=bt();var c=t.queue,d=c.dispatch;return a!==t.memoizedState&&(He.flags|=2048,Bs(9,Mo(),S1.bind(null,c,a),null)),[l,d,e]}function S1(e,t){e.action=t}function Vh(e){var t=bt(),a=Je;if(a!==null)return Yh(t,a,e);bt(),t=t.memoizedState,a=bt();var l=a.queue.dispatch;return a.memoizedState=e,[t,l,!1]}function Bs(e,t,a,l){return e={tag:e,create:a,deps:l,inst:t,next:null},t=He.updateQueue,t===null&&(t=Wc(),He.updateQueue=t),a=t.lastEffect,a===null?t.lastEffect=e.next=e:(l=a.next,a.next=e,e.next=l,t.lastEffect=e),e}function Mo(){return{destroy:void 0,resource:void 0}}function Gh(){return bt().memoizedState}function Ao(e,t,a,l){var c=Zt();l=l===void 0?null:l,He.flags|=e,c.memoizedState=Bs(1|t,Mo(),a,l)}function Jl(e,t,a,l){var c=bt();l=l===void 0?null:l;var d=c.memoizedState.inst;Je!==null&&l!==null&&Yc(l,Je.memoizedState.deps)?c.memoizedState=Bs(t,d,a,l):(He.flags|=e,c.memoizedState=Bs(1|t,d,a,l))}function Xh(e,t){Ao(8390656,8,e,t)}function Zh(e,t){Jl(2048,8,e,t)}function Wh(e,t){return Jl(4,2,e,t)}function Qh(e,t){return Jl(4,4,e,t)}function Kh(e,t){if(typeof t=="function"){e=e();var a=t(e);return function(){typeof a=="function"?a():t(null)}}if(t!=null)return e=e(),t.current=e,function(){t.current=null}}function Jh(e,t,a){a=a!=null?a.concat([e]):null,Jl(4,4,Kh.bind(null,t,e),a)}function Pc(){}function Ih(e,t){var a=bt();t=t===void 0?null:t;var l=a.memoizedState;return t!==null&&Yc(t,l[1])?l[0]:(a.memoizedState=[e,t],e)}function Fh(e,t){var a=bt();t=t===void 0?null:t;var l=a.memoizedState;if(t!==null&&Yc(t,l[1]))return l[0];if(l=e(),as){xt(!0);try{e()}finally{xt(!1)}}return a.memoizedState=[l,t],l}function eu(e,t,a){return a===void 0||(ga&1073741824)!==0?e.memoizedState=t:(e.memoizedState=a,e=tp(),He.lanes|=e,Sa|=e,a)}function Ph(e,t,a,l){return Ft(a,t)?a:Hs.current!==null?(e=eu(e,a,l),Ft(e,t)||(Et=!0),e):(ga&42)===0?(Et=!0,e.memoizedState=a):(e=tp(),He.lanes|=e,Sa|=e,t)}function em(e,t,a,l,c){var d=$.p;$.p=d!==0&&8>d?d:8;var y=E.T,w={};E.T=w,au(e,!1,t,a);try{var O=c(),J=E.S;if(J!==null&&J(w,O),O!==null&&typeof O=="object"&&typeof O.then=="function"){var ce=v1(O,l);Il(e,t,ce,an(e))}else Il(e,t,l,an(e))}catch(fe){Il(e,t,{then:function(){},status:"rejected",reason:fe},an())}finally{$.p=d,E.T=y}}function E1(){}function tu(e,t,a,l){if(e.tag!==5)throw Error(i(476));var c=tm(e).queue;em(e,c,t,T,a===null?E1:function(){return nm(e),a(l)})}function tm(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:T,baseState:T,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gn,lastRenderedState:T},next:null};var a={};return t.next={memoizedState:a,baseState:a,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Gn,lastRenderedState:a},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function nm(e){var t=tm(e).next.queue;Il(e,t,{},an())}function nu(){return qt(pr)}function am(){return bt().memoizedState}function sm(){return bt().memoizedState}function k1(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var a=an();e=pa(a);var l=xa(t,e,a);l!==null&&(sn(l,t,a),Xl(l,t,a)),t={cache:Rc()},e.payload=t;return}t=t.return}}function _1(e,t,a){var l=an();a={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null},Ro(e)?rm(t,a):(a=Nc(e,t,a,l),a!==null&&(sn(a,e,l),om(a,t,l)))}function lm(e,t,a){var l=an();Il(e,t,a,l)}function Il(e,t,a,l){var c={lane:l,revertLane:0,action:a,hasEagerState:!1,eagerState:null,next:null};if(Ro(e))rm(t,c);else{var d=e.alternate;if(e.lanes===0&&(d===null||d.lanes===0)&&(d=t.lastRenderedReducer,d!==null))try{var y=t.lastRenderedState,w=d(y,a);if(c.hasEagerState=!0,c.eagerState=w,Ft(w,y))return po(e,t,c,0),et===null&&mo(),!1}catch{}finally{}if(a=Nc(e,t,c,l),a!==null)return sn(a,e,l),om(a,t,l),!0}return!1}function au(e,t,a,l){if(l={lane:2,revertLane:Du(),action:l,hasEagerState:!1,eagerState:null,next:null},Ro(e)){if(t)throw Error(i(479))}else t=Nc(e,a,l,2),t!==null&&sn(t,e,2)}function Ro(e){var t=e.alternate;return e===He||t!==null&&t===He}function rm(e,t){$s=ko=!0;var a=e.pending;a===null?t.next=t:(t.next=a.next,a.next=t),e.pending=t}function om(e,t,a){if((a&4194048)!==0){var l=t.lanes;l&=e.pendingLanes,a|=l,t.lanes=a,Kr(e,a)}}var zo={readContext:qt,use:Co,useCallback:ht,useContext:ht,useEffect:ht,useImperativeHandle:ht,useLayoutEffect:ht,useInsertionEffect:ht,useMemo:ht,useReducer:ht,useRef:ht,useState:ht,useDebugValue:ht,useDeferredValue:ht,useTransition:ht,useSyncExternalStore:ht,useId:ht,useHostTransitionStatus:ht,useFormState:ht,useActionState:ht,useOptimistic:ht,useMemoCache:ht,useCacheRefresh:ht},im={readContext:qt,use:Co,useCallback:function(e,t){return Zt().memoizedState=[e,t===void 0?null:t],e},useContext:qt,useEffect:Xh,useImperativeHandle:function(e,t,a){a=a!=null?a.concat([e]):null,Ao(4194308,4,Kh.bind(null,t,e),a)},useLayoutEffect:function(e,t){return Ao(4194308,4,e,t)},useInsertionEffect:function(e,t){Ao(4,2,e,t)},useMemo:function(e,t){var a=Zt();t=t===void 0?null:t;var l=e();if(as){xt(!0);try{e()}finally{xt(!1)}}return a.memoizedState=[l,t],l},useReducer:function(e,t,a){var l=Zt();if(a!==void 0){var c=a(t);if(as){xt(!0);try{a(t)}finally{xt(!1)}}}else c=t;return l.memoizedState=l.baseState=c,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:c},l.queue=e,e=e.dispatch=_1.bind(null,He,e),[l.memoizedState,e]},useRef:function(e){var t=Zt();return e={current:e},t.memoizedState=e},useState:function(e){e=Ic(e);var t=e.queue,a=lm.bind(null,He,t);return t.dispatch=a,[e.memoizedState,a]},useDebugValue:Pc,useDeferredValue:function(e,t){var a=Zt();return eu(a,e,t)},useTransition:function(){var e=Ic(!1);return e=em.bind(null,He,e.queue,!0,!1),Zt().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,a){var l=He,c=Zt();if(Ze){if(a===void 0)throw Error(i(407));a=a()}else{if(a=t(),et===null)throw Error(i(349));(Ye&124)!==0||Th(l,t,a)}c.memoizedState=a;var d={value:a,getSnapshot:t};return c.queue=d,Xh(Ah.bind(null,l,d,e),[e]),l.flags|=2048,Bs(9,Mo(),Mh.bind(null,l,d,a,t),null),a},useId:function(){var e=Zt(),t=et.identifierPrefix;if(Ze){var a=Ln,l=qn;a=(l&~(1<<32-at(l)-1)).toString(32)+a,t="«"+t+"R"+a,a=_o++,0<a&&(t+="H"+a.toString(32)),t+="»"}else a=j1++,t="«"+t+"r"+a.toString(32)+"»";return e.memoizedState=t},useHostTransitionStatus:nu,useFormState:qh,useActionState:qh,useOptimistic:function(e){var t=Zt();t.memoizedState=t.baseState=e;var a={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return t.queue=a,t=au.bind(null,He,!0,a),a.dispatch=t,[e,t]},useMemoCache:Qc,useCacheRefresh:function(){return Zt().memoizedState=k1.bind(null,He)}},cm={readContext:qt,use:Co,useCallback:Ih,useContext:qt,useEffect:Zh,useImperativeHandle:Jh,useInsertionEffect:Wh,useLayoutEffect:Qh,useMemo:Fh,useReducer:To,useRef:Gh,useState:function(){return To(Gn)},useDebugValue:Pc,useDeferredValue:function(e,t){var a=bt();return Ph(a,Je.memoizedState,e,t)},useTransition:function(){var e=To(Gn)[0],t=bt().memoizedState;return[typeof e=="boolean"?e:Kl(e),t]},useSyncExternalStore:Ch,useId:am,useHostTransitionStatus:nu,useFormState:Lh,useActionState:Lh,useOptimistic:function(e,t){var a=bt();return Oh(a,Je,e,t)},useMemoCache:Qc,useCacheRefresh:sm},C1={readContext:qt,use:Co,useCallback:Ih,useContext:qt,useEffect:Zh,useImperativeHandle:Jh,useInsertionEffect:Wh,useLayoutEffect:Qh,useMemo:Fh,useReducer:Jc,useRef:Gh,useState:function(){return Jc(Gn)},useDebugValue:Pc,useDeferredValue:function(e,t){var a=bt();return Je===null?eu(a,e,t):Ph(a,Je.memoizedState,e,t)},useTransition:function(){var e=Jc(Gn)[0],t=bt().memoizedState;return[typeof e=="boolean"?e:Kl(e),t]},useSyncExternalStore:Ch,useId:am,useHostTransitionStatus:nu,useFormState:Vh,useActionState:Vh,useOptimistic:function(e,t){var a=bt();return Je!==null?Oh(a,Je,e,t):(a.baseState=e,[e,a.queue.dispatch])},useMemoCache:Qc,useCacheRefresh:sm},qs=null,Fl=0;function Oo(e){var t=Fl;return Fl+=1,qs===null&&(qs=[]),vh(qs,e,t)}function Pl(e,t){t=t.props.ref,e.ref=t!==void 0?t:null}function Do(e,t){throw t.$$typeof===b?Error(i(525)):(e=Object.prototype.toString.call(t),Error(i(31,e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)))}function um(e){var t=e._init;return t(e._payload)}function dm(e){function t(G,U){if(e){var Q=G.deletions;Q===null?(G.deletions=[U],G.flags|=16):Q.push(U)}}function a(G,U){if(!e)return null;for(;U!==null;)t(G,U),U=U.sibling;return null}function l(G){for(var U=new Map;G!==null;)G.key!==null?U.set(G.key,G):U.set(G.index,G),G=G.sibling;return U}function c(G,U){return G=Bn(G,U),G.index=0,G.sibling=null,G}function d(G,U,Q){return G.index=Q,e?(Q=G.alternate,Q!==null?(Q=Q.index,Q<U?(G.flags|=67108866,U):Q):(G.flags|=67108866,U)):(G.flags|=1048576,U)}function y(G){return e&&G.alternate===null&&(G.flags|=67108866),G}function w(G,U,Q,de){return U===null||U.tag!==6?(U=Sc(Q,G.mode,de),U.return=G,U):(U=c(U,Q),U.return=G,U)}function O(G,U,Q,de){var ye=Q.type;return ye===C?ce(G,U,Q.props.children,de,Q.key):U!==null&&(U.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===oe&&um(ye)===U.type)?(U=c(U,Q.props),Pl(U,Q),U.return=G,U):(U=go(Q.type,Q.key,Q.props,null,G.mode,de),Pl(U,Q),U.return=G,U)}function J(G,U,Q,de){return U===null||U.tag!==4||U.stateNode.containerInfo!==Q.containerInfo||U.stateNode.implementation!==Q.implementation?(U=Ec(Q,G.mode,de),U.return=G,U):(U=c(U,Q.children||[]),U.return=G,U)}function ce(G,U,Q,de,ye){return U===null||U.tag!==7?(U=Ka(Q,G.mode,de,ye),U.return=G,U):(U=c(U,Q),U.return=G,U)}function fe(G,U,Q){if(typeof U=="string"&&U!==""||typeof U=="number"||typeof U=="bigint")return U=Sc(""+U,G.mode,Q),U.return=G,U;if(typeof U=="object"&&U!==null){switch(U.$$typeof){case v:return Q=go(U.type,U.key,U.props,null,G.mode,Q),Pl(Q,U),Q.return=G,Q;case N:return U=Ec(U,G.mode,Q),U.return=G,U;case oe:var de=U._init;return U=de(U._payload),fe(G,U,Q)}if(W(U)||te(U))return U=Ka(U,G.mode,Q,null),U.return=G,U;if(typeof U.then=="function")return fe(G,Oo(U),Q);if(U.$$typeof===q)return fe(G,jo(G,U),Q);Do(G,U)}return null}function P(G,U,Q,de){var ye=U!==null?U.key:null;if(typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint")return ye!==null?null:w(G,U,""+Q,de);if(typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case v:return Q.key===ye?O(G,U,Q,de):null;case N:return Q.key===ye?J(G,U,Q,de):null;case oe:return ye=Q._init,Q=ye(Q._payload),P(G,U,Q,de)}if(W(Q)||te(Q))return ye!==null?null:ce(G,U,Q,de,null);if(typeof Q.then=="function")return P(G,U,Oo(Q),de);if(Q.$$typeof===q)return P(G,U,jo(G,Q),de);Do(G,Q)}return null}function ne(G,U,Q,de,ye){if(typeof de=="string"&&de!==""||typeof de=="number"||typeof de=="bigint")return G=G.get(Q)||null,w(U,G,""+de,ye);if(typeof de=="object"&&de!==null){switch(de.$$typeof){case v:return G=G.get(de.key===null?Q:de.key)||null,O(U,G,de,ye);case N:return G=G.get(de.key===null?Q:de.key)||null,J(U,G,de,ye);case oe:var $e=de._init;return de=$e(de._payload),ne(G,U,Q,de,ye)}if(W(de)||te(de))return G=G.get(Q)||null,ce(U,G,de,ye,null);if(typeof de.then=="function")return ne(G,U,Q,Oo(de),ye);if(de.$$typeof===q)return ne(G,U,Q,jo(U,de),ye);Do(U,de)}return null}function Me(G,U,Q,de){for(var ye=null,$e=null,we=U,Ce=U=0,_t=null;we!==null&&Ce<Q.length;Ce++){we.index>Ce?(_t=we,we=null):_t=we.sibling;var Xe=P(G,we,Q[Ce],de);if(Xe===null){we===null&&(we=_t);break}e&&we&&Xe.alternate===null&&t(G,we),U=d(Xe,U,Ce),$e===null?ye=Xe:$e.sibling=Xe,$e=Xe,we=_t}if(Ce===Q.length)return a(G,we),Ze&&Ia(G,Ce),ye;if(we===null){for(;Ce<Q.length;Ce++)we=fe(G,Q[Ce],de),we!==null&&(U=d(we,U,Ce),$e===null?ye=we:$e.sibling=we,$e=we);return Ze&&Ia(G,Ce),ye}for(we=l(we);Ce<Q.length;Ce++)_t=ne(we,G,Ce,Q[Ce],de),_t!==null&&(e&&_t.alternate!==null&&we.delete(_t.key===null?Ce:_t.key),U=d(_t,U,Ce),$e===null?ye=_t:$e.sibling=_t,$e=_t);return e&&we.forEach(function(za){return t(G,za)}),Ze&&Ia(G,Ce),ye}function _e(G,U,Q,de){if(Q==null)throw Error(i(151));for(var ye=null,$e=null,we=U,Ce=U=0,_t=null,Xe=Q.next();we!==null&&!Xe.done;Ce++,Xe=Q.next()){we.index>Ce?(_t=we,we=null):_t=we.sibling;var za=P(G,we,Xe.value,de);if(za===null){we===null&&(we=_t);break}e&&we&&za.alternate===null&&t(G,we),U=d(za,U,Ce),$e===null?ye=za:$e.sibling=za,$e=za,we=_t}if(Xe.done)return a(G,we),Ze&&Ia(G,Ce),ye;if(we===null){for(;!Xe.done;Ce++,Xe=Q.next())Xe=fe(G,Xe.value,de),Xe!==null&&(U=d(Xe,U,Ce),$e===null?ye=Xe:$e.sibling=Xe,$e=Xe);return Ze&&Ia(G,Ce),ye}for(we=l(we);!Xe.done;Ce++,Xe=Q.next())Xe=ne(we,G,Ce,Xe.value,de),Xe!==null&&(e&&Xe.alternate!==null&&we.delete(Xe.key===null?Ce:Xe.key),U=d(Xe,U,Ce),$e===null?ye=Xe:$e.sibling=Xe,$e=Xe);return e&&we.forEach(function(Tb){return t(G,Tb)}),Ze&&Ia(G,Ce),ye}function Fe(G,U,Q,de){if(typeof Q=="object"&&Q!==null&&Q.type===C&&Q.key===null&&(Q=Q.props.children),typeof Q=="object"&&Q!==null){switch(Q.$$typeof){case v:e:{for(var ye=Q.key;U!==null;){if(U.key===ye){if(ye=Q.type,ye===C){if(U.tag===7){a(G,U.sibling),de=c(U,Q.props.children),de.return=G,G=de;break e}}else if(U.elementType===ye||typeof ye=="object"&&ye!==null&&ye.$$typeof===oe&&um(ye)===U.type){a(G,U.sibling),de=c(U,Q.props),Pl(de,Q),de.return=G,G=de;break e}a(G,U);break}else t(G,U);U=U.sibling}Q.type===C?(de=Ka(Q.props.children,G.mode,de,Q.key),de.return=G,G=de):(de=go(Q.type,Q.key,Q.props,null,G.mode,de),Pl(de,Q),de.return=G,G=de)}return y(G);case N:e:{for(ye=Q.key;U!==null;){if(U.key===ye)if(U.tag===4&&U.stateNode.containerInfo===Q.containerInfo&&U.stateNode.implementation===Q.implementation){a(G,U.sibling),de=c(U,Q.children||[]),de.return=G,G=de;break e}else{a(G,U);break}else t(G,U);U=U.sibling}de=Ec(Q,G.mode,de),de.return=G,G=de}return y(G);case oe:return ye=Q._init,Q=ye(Q._payload),Fe(G,U,Q,de)}if(W(Q))return Me(G,U,Q,de);if(te(Q)){if(ye=te(Q),typeof ye!="function")throw Error(i(150));return Q=ye.call(Q),_e(G,U,Q,de)}if(typeof Q.then=="function")return Fe(G,U,Oo(Q),de);if(Q.$$typeof===q)return Fe(G,U,jo(G,Q),de);Do(G,Q)}return typeof Q=="string"&&Q!==""||typeof Q=="number"||typeof Q=="bigint"?(Q=""+Q,U!==null&&U.tag===6?(a(G,U.sibling),de=c(U,Q),de.return=G,G=de):(a(G,U),de=Sc(Q,G.mode,de),de.return=G,G=de),y(G)):a(G,U)}return function(G,U,Q,de){try{Fl=0;var ye=Fe(G,U,Q,de);return qs=null,ye}catch(we){if(we===Vl||we===wo)throw we;var $e=Pt(29,we,null,G.mode);return $e.lanes=de,$e.return=G,$e}finally{}}}var Ls=dm(!0),fm=dm(!1),pn=D(null),Tn=null;function ya(e){var t=e.alternate;F(jt,jt.current&1),F(pn,e),Tn===null&&(t===null||Hs.current!==null||t.memoizedState!==null)&&(Tn=e)}function hm(e){if(e.tag===22){if(F(jt,jt.current),F(pn,e),Tn===null){var t=e.alternate;t!==null&&t.memoizedState!==null&&(Tn=e)}}else ba()}function ba(){F(jt,jt.current),F(pn,pn.current)}function Xn(e){L(pn),Tn===e&&(Tn=null),L(jt)}var jt=D(0);function Ho(e){for(var t=e;t!==null;){if(t.tag===13){var a=t.memoizedState;if(a!==null&&(a=a.dehydrated,a===null||a.data==="$?"||Wu(a)))return t}else if(t.tag===19&&t.memoizedProps.revealOrder!==void 0){if((t.flags&128)!==0)return t}else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return null;t=t.return}t.sibling.return=t.return,t=t.sibling}return null}function su(e,t,a,l){t=e.memoizedState,a=a(l,t),a=a==null?t:p({},t,a),e.memoizedState=a,e.lanes===0&&(e.updateQueue.baseState=a)}var lu={enqueueSetState:function(e,t,a){e=e._reactInternals;var l=an(),c=pa(l);c.payload=t,a!=null&&(c.callback=a),t=xa(e,c,l),t!==null&&(sn(t,e,l),Xl(t,e,l))},enqueueReplaceState:function(e,t,a){e=e._reactInternals;var l=an(),c=pa(l);c.tag=1,c.payload=t,a!=null&&(c.callback=a),t=xa(e,c,l),t!==null&&(sn(t,e,l),Xl(t,e,l))},enqueueForceUpdate:function(e,t){e=e._reactInternals;var a=an(),l=pa(a);l.tag=2,t!=null&&(l.callback=t),t=xa(e,l,a),t!==null&&(sn(t,e,a),Xl(t,e,a))}};function mm(e,t,a,l,c,d,y){return e=e.stateNode,typeof e.shouldComponentUpdate=="function"?e.shouldComponentUpdate(l,d,y):t.prototype&&t.prototype.isPureReactComponent?!Dl(a,l)||!Dl(c,d):!0}function pm(e,t,a,l){e=t.state,typeof t.componentWillReceiveProps=="function"&&t.componentWillReceiveProps(a,l),typeof t.UNSAFE_componentWillReceiveProps=="function"&&t.UNSAFE_componentWillReceiveProps(a,l),t.state!==e&&lu.enqueueReplaceState(t,t.state,null)}function ss(e,t){var a=t;if("ref"in t){a={};for(var l in t)l!=="ref"&&(a[l]=t[l])}if(e=e.defaultProps){a===t&&(a=p({},a));for(var c in e)a[c]===void 0&&(a[c]=e[c])}return a}var $o=typeof reportError=="function"?reportError:function(e){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var t=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof e=="object"&&e!==null&&typeof e.message=="string"?String(e.message):String(e),error:e});if(!window.dispatchEvent(t))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",e);return}console.error(e)};function xm(e){$o(e)}function gm(e){console.error(e)}function ym(e){$o(e)}function Uo(e,t){try{var a=e.onUncaughtError;a(t.value,{componentStack:t.stack})}catch(l){setTimeout(function(){throw l})}}function bm(e,t,a){try{var l=e.onCaughtError;l(a.value,{componentStack:a.stack,errorBoundary:t.tag===1?t.stateNode:null})}catch(c){setTimeout(function(){throw c})}}function ru(e,t,a){return a=pa(a),a.tag=3,a.payload={element:null},a.callback=function(){Uo(e,t)},a}function vm(e){return e=pa(e),e.tag=3,e}function jm(e,t,a,l){var c=a.type.getDerivedStateFromError;if(typeof c=="function"){var d=l.value;e.payload=function(){return c(d)},e.callback=function(){bm(t,a,l)}}var y=a.stateNode;y!==null&&typeof y.componentDidCatch=="function"&&(e.callback=function(){bm(t,a,l),typeof c!="function"&&(Ea===null?Ea=new Set([this]):Ea.add(this));var w=l.stack;this.componentDidCatch(l.value,{componentStack:w!==null?w:""})})}function T1(e,t,a,l,c){if(a.flags|=32768,l!==null&&typeof l=="object"&&typeof l.then=="function"){if(t=a.alternate,t!==null&&ql(t,a,c,!0),a=pn.current,a!==null){switch(a.tag){case 13:return Tn===null?Mu():a.alternate===null&&it===0&&(it=3),a.flags&=-257,a.flags|=65536,a.lanes=c,l===Dc?a.flags|=16384:(t=a.updateQueue,t===null?a.updateQueue=new Set([l]):t.add(l),Ru(e,l,c)),!1;case 22:return a.flags|=65536,l===Dc?a.flags|=16384:(t=a.updateQueue,t===null?(t={transitions:null,markerInstances:null,retryQueue:new Set([l])},a.updateQueue=t):(a=t.retryQueue,a===null?t.retryQueue=new Set([l]):a.add(l)),Ru(e,l,c)),!1}throw Error(i(435,a.tag))}return Ru(e,l,c),Mu(),!1}if(Ze)return t=pn.current,t!==null?((t.flags&65536)===0&&(t.flags|=256),t.flags|=65536,t.lanes=c,l!==Cc&&(e=Error(i(422),{cause:l}),Bl(dn(e,a)))):(l!==Cc&&(t=Error(i(423),{cause:l}),Bl(dn(t,a))),e=e.current.alternate,e.flags|=65536,c&=-c,e.lanes|=c,l=dn(l,a),c=ru(e.stateNode,l,c),Uc(e,c),it!==4&&(it=2)),!1;var d=Error(i(520),{cause:l});if(d=dn(d,a),rr===null?rr=[d]:rr.push(d),it!==4&&(it=2),t===null)return!0;l=dn(l,a),a=t;do{switch(a.tag){case 3:return a.flags|=65536,e=c&-c,a.lanes|=e,e=ru(a.stateNode,l,e),Uc(a,e),!1;case 1:if(t=a.type,d=a.stateNode,(a.flags&128)===0&&(typeof t.getDerivedStateFromError=="function"||d!==null&&typeof d.componentDidCatch=="function"&&(Ea===null||!Ea.has(d))))return a.flags|=65536,c&=-c,a.lanes|=c,c=vm(c),jm(c,e,a,l),Uc(a,c),!1}a=a.return}while(a!==null);return!1}var Nm=Error(i(461)),Et=!1;function Ot(e,t,a,l){t.child=e===null?fm(t,null,a,l):Ls(t,e.child,a,l)}function wm(e,t,a,l,c){a=a.render;var d=t.ref;if("ref"in l){var y={};for(var w in l)w!=="ref"&&(y[w]=l[w])}else y=l;return ts(t),l=Vc(e,t,a,y,d,c),w=Gc(),e!==null&&!Et?(Xc(e,t,c),Zn(e,t,c)):(Ze&&w&&kc(t),t.flags|=1,Ot(e,t,l,c),t.child)}function Sm(e,t,a,l,c){if(e===null){var d=a.type;return typeof d=="function"&&!wc(d)&&d.defaultProps===void 0&&a.compare===null?(t.tag=15,t.type=d,Em(e,t,d,l,c)):(e=go(a.type,null,l,t,t.mode,c),e.ref=t.ref,e.return=t,t.child=e)}if(d=e.child,!mu(e,c)){var y=d.memoizedProps;if(a=a.compare,a=a!==null?a:Dl,a(y,l)&&e.ref===t.ref)return Zn(e,t,c)}return t.flags|=1,e=Bn(d,l),e.ref=t.ref,e.return=t,t.child=e}function Em(e,t,a,l,c){if(e!==null){var d=e.memoizedProps;if(Dl(d,l)&&e.ref===t.ref)if(Et=!1,t.pendingProps=l=d,mu(e,c))(e.flags&131072)!==0&&(Et=!0);else return t.lanes=e.lanes,Zn(e,t,c)}return ou(e,t,a,l,c)}function km(e,t,a){var l=t.pendingProps,c=l.children,d=e!==null?e.memoizedState:null;if(l.mode==="hidden"){if((t.flags&128)!==0){if(l=d!==null?d.baseLanes|a:a,e!==null){for(c=t.child=e.child,d=0;c!==null;)d=d|c.lanes|c.childLanes,c=c.sibling;t.childLanes=d&~l}else t.childLanes=0,t.child=null;return _m(e,t,l,a)}if((a&536870912)!==0)t.memoizedState={baseLanes:0,cachePool:null},e!==null&&No(t,d!==null?d.cachePool:null),d!==null?Eh(t,d):qc(),hm(t);else return t.lanes=t.childLanes=536870912,_m(e,t,d!==null?d.baseLanes|a:a,a)}else d!==null?(No(t,d.cachePool),Eh(t,d),ba(),t.memoizedState=null):(e!==null&&No(t,null),qc(),ba());return Ot(e,t,c,a),t.child}function _m(e,t,a,l){var c=Oc();return c=c===null?null:{parent:vt._currentValue,pool:c},t.memoizedState={baseLanes:a,cachePool:c},e!==null&&No(t,null),qc(),hm(t),e!==null&&ql(e,t,l,!0),null}function Bo(e,t){var a=t.ref;if(a===null)e!==null&&e.ref!==null&&(t.flags|=4194816);else{if(typeof a!="function"&&typeof a!="object")throw Error(i(284));(e===null||e.ref!==a)&&(t.flags|=4194816)}}function ou(e,t,a,l,c){return ts(t),a=Vc(e,t,a,l,void 0,c),l=Gc(),e!==null&&!Et?(Xc(e,t,c),Zn(e,t,c)):(Ze&&l&&kc(t),t.flags|=1,Ot(e,t,a,c),t.child)}function Cm(e,t,a,l,c,d){return ts(t),t.updateQueue=null,a=_h(t,l,a,c),kh(e),l=Gc(),e!==null&&!Et?(Xc(e,t,d),Zn(e,t,d)):(Ze&&l&&kc(t),t.flags|=1,Ot(e,t,a,d),t.child)}function Tm(e,t,a,l,c){if(ts(t),t.stateNode===null){var d=As,y=a.contextType;typeof y=="object"&&y!==null&&(d=qt(y)),d=new a(l,d),t.memoizedState=d.state!==null&&d.state!==void 0?d.state:null,d.updater=lu,t.stateNode=d,d._reactInternals=t,d=t.stateNode,d.props=l,d.state=t.memoizedState,d.refs={},Hc(t),y=a.contextType,d.context=typeof y=="object"&&y!==null?qt(y):As,d.state=t.memoizedState,y=a.getDerivedStateFromProps,typeof y=="function"&&(su(t,a,y,l),d.state=t.memoizedState),typeof a.getDerivedStateFromProps=="function"||typeof d.getSnapshotBeforeUpdate=="function"||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(y=d.state,typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount(),y!==d.state&&lu.enqueueReplaceState(d,d.state,null),Wl(t,l,d,c),Zl(),d.state=t.memoizedState),typeof d.componentDidMount=="function"&&(t.flags|=4194308),l=!0}else if(e===null){d=t.stateNode;var w=t.memoizedProps,O=ss(a,w);d.props=O;var J=d.context,ce=a.contextType;y=As,typeof ce=="object"&&ce!==null&&(y=qt(ce));var fe=a.getDerivedStateFromProps;ce=typeof fe=="function"||typeof d.getSnapshotBeforeUpdate=="function",w=t.pendingProps!==w,ce||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(w||J!==y)&&pm(t,d,l,y),ma=!1;var P=t.memoizedState;d.state=P,Wl(t,l,d,c),Zl(),J=t.memoizedState,w||P!==J||ma?(typeof fe=="function"&&(su(t,a,fe,l),J=t.memoizedState),(O=ma||mm(t,a,O,l,P,J,y))?(ce||typeof d.UNSAFE_componentWillMount!="function"&&typeof d.componentWillMount!="function"||(typeof d.componentWillMount=="function"&&d.componentWillMount(),typeof d.UNSAFE_componentWillMount=="function"&&d.UNSAFE_componentWillMount()),typeof d.componentDidMount=="function"&&(t.flags|=4194308)):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),t.memoizedProps=l,t.memoizedState=J),d.props=l,d.state=J,d.context=y,l=O):(typeof d.componentDidMount=="function"&&(t.flags|=4194308),l=!1)}else{d=t.stateNode,$c(e,t),y=t.memoizedProps,ce=ss(a,y),d.props=ce,fe=t.pendingProps,P=d.context,J=a.contextType,O=As,typeof J=="object"&&J!==null&&(O=qt(J)),w=a.getDerivedStateFromProps,(J=typeof w=="function"||typeof d.getSnapshotBeforeUpdate=="function")||typeof d.UNSAFE_componentWillReceiveProps!="function"&&typeof d.componentWillReceiveProps!="function"||(y!==fe||P!==O)&&pm(t,d,l,O),ma=!1,P=t.memoizedState,d.state=P,Wl(t,l,d,c),Zl();var ne=t.memoizedState;y!==fe||P!==ne||ma||e!==null&&e.dependencies!==null&&vo(e.dependencies)?(typeof w=="function"&&(su(t,a,w,l),ne=t.memoizedState),(ce=ma||mm(t,a,ce,l,P,ne,O)||e!==null&&e.dependencies!==null&&vo(e.dependencies))?(J||typeof d.UNSAFE_componentWillUpdate!="function"&&typeof d.componentWillUpdate!="function"||(typeof d.componentWillUpdate=="function"&&d.componentWillUpdate(l,ne,O),typeof d.UNSAFE_componentWillUpdate=="function"&&d.UNSAFE_componentWillUpdate(l,ne,O)),typeof d.componentDidUpdate=="function"&&(t.flags|=4),typeof d.getSnapshotBeforeUpdate=="function"&&(t.flags|=1024)):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&P===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&P===e.memoizedState||(t.flags|=1024),t.memoizedProps=l,t.memoizedState=ne),d.props=l,d.state=ne,d.context=O,l=ce):(typeof d.componentDidUpdate!="function"||y===e.memoizedProps&&P===e.memoizedState||(t.flags|=4),typeof d.getSnapshotBeforeUpdate!="function"||y===e.memoizedProps&&P===e.memoizedState||(t.flags|=1024),l=!1)}return d=l,Bo(e,t),l=(t.flags&128)!==0,d||l?(d=t.stateNode,a=l&&typeof a.getDerivedStateFromError!="function"?null:d.render(),t.flags|=1,e!==null&&l?(t.child=Ls(t,e.child,null,c),t.child=Ls(t,null,a,c)):Ot(e,t,a,c),t.memoizedState=d.state,e=t.child):e=Zn(e,t,c),e}function Mm(e,t,a,l){return Ul(),t.flags|=256,Ot(e,t,a,l),t.child}var iu={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function cu(e){return{baseLanes:e,cachePool:gh()}}function uu(e,t,a){return e=e!==null?e.childLanes&~a:0,t&&(e|=xn),e}function Am(e,t,a){var l=t.pendingProps,c=!1,d=(t.flags&128)!==0,y;if((y=d)||(y=e!==null&&e.memoizedState===null?!1:(jt.current&2)!==0),y&&(c=!0,t.flags&=-129),y=(t.flags&32)!==0,t.flags&=-33,e===null){if(Ze){if(c?ya(t):ba(),Ze){var w=ot,O;if(O=w){e:{for(O=w,w=Cn;O.nodeType!==8;){if(!w){w=null;break e}if(O=wn(O.nextSibling),O===null){w=null;break e}}w=O}w!==null?(t.memoizedState={dehydrated:w,treeContext:Ja!==null?{id:qn,overflow:Ln}:null,retryLane:536870912,hydrationErrors:null},O=Pt(18,null,null,0),O.stateNode=w,O.return=t,t.child=O,Gt=t,ot=null,O=!0):O=!1}O||Pa(t)}if(w=t.memoizedState,w!==null&&(w=w.dehydrated,w!==null))return Wu(w)?t.lanes=32:t.lanes=536870912,null;Xn(t)}return w=l.children,l=l.fallback,c?(ba(),c=t.mode,w=qo({mode:"hidden",children:w},c),l=Ka(l,c,a,null),w.return=t,l.return=t,w.sibling=l,t.child=w,c=t.child,c.memoizedState=cu(a),c.childLanes=uu(e,y,a),t.memoizedState=iu,l):(ya(t),du(t,w))}if(O=e.memoizedState,O!==null&&(w=O.dehydrated,w!==null)){if(d)t.flags&256?(ya(t),t.flags&=-257,t=fu(e,t,a)):t.memoizedState!==null?(ba(),t.child=e.child,t.flags|=128,t=null):(ba(),c=l.fallback,w=t.mode,l=qo({mode:"visible",children:l.children},w),c=Ka(c,w,a,null),c.flags|=2,l.return=t,c.return=t,l.sibling=c,t.child=l,Ls(t,e.child,null,a),l=t.child,l.memoizedState=cu(a),l.childLanes=uu(e,y,a),t.memoizedState=iu,t=c);else if(ya(t),Wu(w)){if(y=w.nextSibling&&w.nextSibling.dataset,y)var J=y.dgst;y=J,l=Error(i(419)),l.stack="",l.digest=y,Bl({value:l,source:null,stack:null}),t=fu(e,t,a)}else if(Et||ql(e,t,a,!1),y=(a&e.childLanes)!==0,Et||y){if(y=et,y!==null&&(l=a&-a,l=(l&42)!==0?1:wl(l),l=(l&(y.suspendedLanes|a))!==0?0:l,l!==0&&l!==O.retryLane))throw O.retryLane=l,Ms(e,l),sn(y,e,l),Nm;w.data==="$?"||Mu(),t=fu(e,t,a)}else w.data==="$?"?(t.flags|=192,t.child=e.child,t=null):(e=O.treeContext,ot=wn(w.nextSibling),Gt=t,Ze=!0,Fa=null,Cn=!1,e!==null&&(hn[mn++]=qn,hn[mn++]=Ln,hn[mn++]=Ja,qn=e.id,Ln=e.overflow,Ja=t),t=du(t,l.children),t.flags|=4096);return t}return c?(ba(),c=l.fallback,w=t.mode,O=e.child,J=O.sibling,l=Bn(O,{mode:"hidden",children:l.children}),l.subtreeFlags=O.subtreeFlags&65011712,J!==null?c=Bn(J,c):(c=Ka(c,w,a,null),c.flags|=2),c.return=t,l.return=t,l.sibling=c,t.child=l,l=c,c=t.child,w=e.child.memoizedState,w===null?w=cu(a):(O=w.cachePool,O!==null?(J=vt._currentValue,O=O.parent!==J?{parent:J,pool:J}:O):O=gh(),w={baseLanes:w.baseLanes|a,cachePool:O}),c.memoizedState=w,c.childLanes=uu(e,y,a),t.memoizedState=iu,l):(ya(t),a=e.child,e=a.sibling,a=Bn(a,{mode:"visible",children:l.children}),a.return=t,a.sibling=null,e!==null&&(y=t.deletions,y===null?(t.deletions=[e],t.flags|=16):y.push(e)),t.child=a,t.memoizedState=null,a)}function du(e,t){return t=qo({mode:"visible",children:t},e.mode),t.return=e,e.child=t}function qo(e,t){return e=Pt(22,e,null,t),e.lanes=0,e.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null},e}function fu(e,t,a){return Ls(t,e.child,null,a),e=du(t,t.pendingProps.children),e.flags|=2,t.memoizedState=null,e}function Rm(e,t,a){e.lanes|=t;var l=e.alternate;l!==null&&(l.lanes|=t),Mc(e.return,t,a)}function hu(e,t,a,l,c){var d=e.memoizedState;d===null?e.memoizedState={isBackwards:t,rendering:null,renderingStartTime:0,last:l,tail:a,tailMode:c}:(d.isBackwards=t,d.rendering=null,d.renderingStartTime=0,d.last=l,d.tail=a,d.tailMode=c)}function zm(e,t,a){var l=t.pendingProps,c=l.revealOrder,d=l.tail;if(Ot(e,t,l.children,a),l=jt.current,(l&2)!==0)l=l&1|2,t.flags|=128;else{if(e!==null&&(e.flags&128)!==0)e:for(e=t.child;e!==null;){if(e.tag===13)e.memoizedState!==null&&Rm(e,a,t);else if(e.tag===19)Rm(e,a,t);else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break e;for(;e.sibling===null;){if(e.return===null||e.return===t)break e;e=e.return}e.sibling.return=e.return,e=e.sibling}l&=1}switch(F(jt,l),c){case"forwards":for(a=t.child,c=null;a!==null;)e=a.alternate,e!==null&&Ho(e)===null&&(c=a),a=a.sibling;a=c,a===null?(c=t.child,t.child=null):(c=a.sibling,a.sibling=null),hu(t,!1,c,a,d);break;case"backwards":for(a=null,c=t.child,t.child=null;c!==null;){if(e=c.alternate,e!==null&&Ho(e)===null){t.child=c;break}e=c.sibling,c.sibling=a,a=c,c=e}hu(t,!0,a,null,d);break;case"together":hu(t,!1,null,null,void 0);break;default:t.memoizedState=null}return t.child}function Zn(e,t,a){if(e!==null&&(t.dependencies=e.dependencies),Sa|=t.lanes,(a&t.childLanes)===0)if(e!==null){if(ql(e,t,a,!1),(a&t.childLanes)===0)return null}else return null;if(e!==null&&t.child!==e.child)throw Error(i(153));if(t.child!==null){for(e=t.child,a=Bn(e,e.pendingProps),t.child=a,a.return=t;e.sibling!==null;)e=e.sibling,a=a.sibling=Bn(e,e.pendingProps),a.return=t;a.sibling=null}return t.child}function mu(e,t){return(e.lanes&t)!==0?!0:(e=e.dependencies,!!(e!==null&&vo(e)))}function M1(e,t,a){switch(t.tag){case 3:ve(t,t.stateNode.containerInfo),ha(t,vt,e.memoizedState.cache),Ul();break;case 27:case 5:Re(t);break;case 4:ve(t,t.stateNode.containerInfo);break;case 10:ha(t,t.type,t.memoizedProps.value);break;case 13:var l=t.memoizedState;if(l!==null)return l.dehydrated!==null?(ya(t),t.flags|=128,null):(a&t.child.childLanes)!==0?Am(e,t,a):(ya(t),e=Zn(e,t,a),e!==null?e.sibling:null);ya(t);break;case 19:var c=(e.flags&128)!==0;if(l=(a&t.childLanes)!==0,l||(ql(e,t,a,!1),l=(a&t.childLanes)!==0),c){if(l)return zm(e,t,a);t.flags|=128}if(c=t.memoizedState,c!==null&&(c.rendering=null,c.tail=null,c.lastEffect=null),F(jt,jt.current),l)break;return null;case 22:case 23:return t.lanes=0,km(e,t,a);case 24:ha(t,vt,e.memoizedState.cache)}return Zn(e,t,a)}function Om(e,t,a){if(e!==null)if(e.memoizedProps!==t.pendingProps)Et=!0;else{if(!mu(e,a)&&(t.flags&128)===0)return Et=!1,M1(e,t,a);Et=(e.flags&131072)!==0}else Et=!1,Ze&&(t.flags&1048576)!==0&&uh(t,bo,t.index);switch(t.lanes=0,t.tag){case 16:e:{e=t.pendingProps;var l=t.elementType,c=l._init;if(l=c(l._payload),t.type=l,typeof l=="function")wc(l)?(e=ss(l,e),t.tag=1,t=Tm(null,t,l,e,a)):(t.tag=0,t=ou(null,t,l,e,a));else{if(l!=null){if(c=l.$$typeof,c===M){t.tag=11,t=wm(null,t,l,e,a);break e}else if(c===X){t.tag=14,t=Sm(null,t,l,e,a);break e}}throw t=_(l)||l,Error(i(306,t,""))}}return t;case 0:return ou(e,t,t.type,t.pendingProps,a);case 1:return l=t.type,c=ss(l,t.pendingProps),Tm(e,t,l,c,a);case 3:e:{if(ve(t,t.stateNode.containerInfo),e===null)throw Error(i(387));l=t.pendingProps;var d=t.memoizedState;c=d.element,$c(e,t),Wl(t,l,null,a);var y=t.memoizedState;if(l=y.cache,ha(t,vt,l),l!==d.cache&&Ac(t,[vt],a,!0),Zl(),l=y.element,d.isDehydrated)if(d={element:l,isDehydrated:!1,cache:y.cache},t.updateQueue.baseState=d,t.memoizedState=d,t.flags&256){t=Mm(e,t,l,a);break e}else if(l!==c){c=dn(Error(i(424)),t),Bl(c),t=Mm(e,t,l,a);break e}else{switch(e=t.stateNode.containerInfo,e.nodeType){case 9:e=e.body;break;default:e=e.nodeName==="HTML"?e.ownerDocument.body:e}for(ot=wn(e.firstChild),Gt=t,Ze=!0,Fa=null,Cn=!0,a=fm(t,null,l,a),t.child=a;a;)a.flags=a.flags&-3|4096,a=a.sibling}else{if(Ul(),l===c){t=Zn(e,t,a);break e}Ot(e,t,l,a)}t=t.child}return t;case 26:return Bo(e,t),e===null?(a=Up(t.type,null,t.pendingProps,null))?t.memoizedState=a:Ze||(a=t.type,e=t.pendingProps,l=ei(me.current).createElement(a),l[St]=t,l[Bt]=e,Ht(l,a,e),gt(l),t.stateNode=l):t.memoizedState=Up(t.type,e.memoizedProps,t.pendingProps,e.memoizedState),null;case 27:return Re(t),e===null&&Ze&&(l=t.stateNode=Dp(t.type,t.pendingProps,me.current),Gt=t,Cn=!0,c=ot,Ca(t.type)?(Qu=c,ot=wn(l.firstChild)):ot=c),Ot(e,t,t.pendingProps.children,a),Bo(e,t),e===null&&(t.flags|=4194304),t.child;case 5:return e===null&&Ze&&((c=l=ot)&&(l=sb(l,t.type,t.pendingProps,Cn),l!==null?(t.stateNode=l,Gt=t,ot=wn(l.firstChild),Cn=!1,c=!0):c=!1),c||Pa(t)),Re(t),c=t.type,d=t.pendingProps,y=e!==null?e.memoizedProps:null,l=d.children,Gu(c,d)?l=null:y!==null&&Gu(c,y)&&(t.flags|=32),t.memoizedState!==null&&(c=Vc(e,t,N1,null,null,a),pr._currentValue=c),Bo(e,t),Ot(e,t,l,a),t.child;case 6:return e===null&&Ze&&((e=a=ot)&&(a=lb(a,t.pendingProps,Cn),a!==null?(t.stateNode=a,Gt=t,ot=null,e=!0):e=!1),e||Pa(t)),null;case 13:return Am(e,t,a);case 4:return ve(t,t.stateNode.containerInfo),l=t.pendingProps,e===null?t.child=Ls(t,null,l,a):Ot(e,t,l,a),t.child;case 11:return wm(e,t,t.type,t.pendingProps,a);case 7:return Ot(e,t,t.pendingProps,a),t.child;case 8:return Ot(e,t,t.pendingProps.children,a),t.child;case 12:return Ot(e,t,t.pendingProps.children,a),t.child;case 10:return l=t.pendingProps,ha(t,t.type,l.value),Ot(e,t,l.children,a),t.child;case 9:return c=t.type._context,l=t.pendingProps.children,ts(t),c=qt(c),l=l(c),t.flags|=1,Ot(e,t,l,a),t.child;case 14:return Sm(e,t,t.type,t.pendingProps,a);case 15:return Em(e,t,t.type,t.pendingProps,a);case 19:return zm(e,t,a);case 31:return l=t.pendingProps,a=t.mode,l={mode:l.mode,children:l.children},e===null?(a=qo(l,a),a.ref=t.ref,t.child=a,a.return=t,t=a):(a=Bn(e.child,l),a.ref=t.ref,t.child=a,a.return=t,t=a),t;case 22:return km(e,t,a);case 24:return ts(t),l=qt(vt),e===null?(c=Oc(),c===null&&(c=et,d=Rc(),c.pooledCache=d,d.refCount++,d!==null&&(c.pooledCacheLanes|=a),c=d),t.memoizedState={parent:l,cache:c},Hc(t),ha(t,vt,c)):((e.lanes&a)!==0&&($c(e,t),Wl(t,null,null,a),Zl()),c=e.memoizedState,d=t.memoizedState,c.parent!==l?(c={parent:l,cache:l},t.memoizedState=c,t.lanes===0&&(t.memoizedState=t.updateQueue.baseState=c),ha(t,vt,l)):(l=d.cache,ha(t,vt,l),l!==c.cache&&Ac(t,[vt],a,!0))),Ot(e,t,t.pendingProps.children,a),t.child;case 29:throw t.pendingProps}throw Error(i(156,t.tag))}function Wn(e){e.flags|=4}function Dm(e,t){if(t.type!=="stylesheet"||(t.state.loading&4)!==0)e.flags&=-16777217;else if(e.flags|=16777216,!Vp(t)){if(t=pn.current,t!==null&&((Ye&4194048)===Ye?Tn!==null:(Ye&62914560)!==Ye&&(Ye&536870912)===0||t!==Tn))throw Gl=Dc,yh;e.flags|=8192}}function Lo(e,t){t!==null&&(e.flags|=4),e.flags&16384&&(t=e.tag!==22?la():536870912,e.lanes|=t,Xs|=t)}function er(e,t){if(!Ze)switch(e.tailMode){case"hidden":t=e.tail;for(var a=null;t!==null;)t.alternate!==null&&(a=t),t=t.sibling;a===null?e.tail=null:a.sibling=null;break;case"collapsed":a=e.tail;for(var l=null;a!==null;)a.alternate!==null&&(l=a),a=a.sibling;l===null?t||e.tail===null?e.tail=null:e.tail.sibling=null:l.sibling=null}}function rt(e){var t=e.alternate!==null&&e.alternate.child===e.child,a=0,l=0;if(t)for(var c=e.child;c!==null;)a|=c.lanes|c.childLanes,l|=c.subtreeFlags&65011712,l|=c.flags&65011712,c.return=e,c=c.sibling;else for(c=e.child;c!==null;)a|=c.lanes|c.childLanes,l|=c.subtreeFlags,l|=c.flags,c.return=e,c=c.sibling;return e.subtreeFlags|=l,e.childLanes=a,t}function A1(e,t,a){var l=t.pendingProps;switch(_c(t),t.tag){case 31:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return rt(t),null;case 1:return rt(t),null;case 3:return a=t.stateNode,l=null,e!==null&&(l=e.memoizedState.cache),t.memoizedState.cache!==l&&(t.flags|=2048),Vn(vt),Ae(),a.pendingContext&&(a.context=a.pendingContext,a.pendingContext=null),(e===null||e.child===null)&&($l(t)?Wn(t):e===null||e.memoizedState.isDehydrated&&(t.flags&256)===0||(t.flags|=1024,hh())),rt(t),null;case 26:return a=t.memoizedState,e===null?(Wn(t),a!==null?(rt(t),Dm(t,a)):(rt(t),t.flags&=-16777217)):a?a!==e.memoizedState?(Wn(t),rt(t),Dm(t,a)):(rt(t),t.flags&=-16777217):(e.memoizedProps!==l&&Wn(t),rt(t),t.flags&=-16777217),null;case 27:We(t),a=me.current;var c=t.type;if(e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(!l){if(t.stateNode===null)throw Error(i(166));return rt(t),null}e=ie.current,$l(t)?dh(t):(e=Dp(c,l,a),t.stateNode=e,Wn(t))}return rt(t),null;case 5:if(We(t),a=t.type,e!==null&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(!l){if(t.stateNode===null)throw Error(i(166));return rt(t),null}if(e=ie.current,$l(t))dh(t);else{switch(c=ei(me.current),e){case 1:e=c.createElementNS("http://www.w3.org/2000/svg",a);break;case 2:e=c.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;default:switch(a){case"svg":e=c.createElementNS("http://www.w3.org/2000/svg",a);break;case"math":e=c.createElementNS("http://www.w3.org/1998/Math/MathML",a);break;case"script":e=c.createElement("div"),e.innerHTML="<script><\/script>",e=e.removeChild(e.firstChild);break;case"select":e=typeof l.is=="string"?c.createElement("select",{is:l.is}):c.createElement("select"),l.multiple?e.multiple=!0:l.size&&(e.size=l.size);break;default:e=typeof l.is=="string"?c.createElement(a,{is:l.is}):c.createElement(a)}}e[St]=t,e[Bt]=l;e:for(c=t.child;c!==null;){if(c.tag===5||c.tag===6)e.appendChild(c.stateNode);else if(c.tag!==4&&c.tag!==27&&c.child!==null){c.child.return=c,c=c.child;continue}if(c===t)break e;for(;c.sibling===null;){if(c.return===null||c.return===t)break e;c=c.return}c.sibling.return=c.return,c=c.sibling}t.stateNode=e;e:switch(Ht(e,a,l),a){case"button":case"input":case"select":case"textarea":e=!!l.autoFocus;break e;case"img":e=!0;break e;default:e=!1}e&&Wn(t)}}return rt(t),t.flags&=-16777217,null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==l&&Wn(t);else{if(typeof l!="string"&&t.stateNode===null)throw Error(i(166));if(e=me.current,$l(t)){if(e=t.stateNode,a=t.memoizedProps,l=null,c=Gt,c!==null)switch(c.tag){case 27:case 5:l=c.memoizedProps}e[St]=t,e=!!(e.nodeValue===a||l!==null&&l.suppressHydrationWarning===!0||Cp(e.nodeValue,a)),e||Pa(t)}else e=ei(e).createTextNode(l),e[St]=t,t.stateNode=e}return rt(t),null;case 13:if(l=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(c=$l(t),l!==null&&l.dehydrated!==null){if(e===null){if(!c)throw Error(i(318));if(c=t.memoizedState,c=c!==null?c.dehydrated:null,!c)throw Error(i(317));c[St]=t}else Ul(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;rt(t),c=!1}else c=hh(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=c),c=!0;if(!c)return t.flags&256?(Xn(t),t):(Xn(t),null)}if(Xn(t),(t.flags&128)!==0)return t.lanes=a,t;if(a=l!==null,e=e!==null&&e.memoizedState!==null,a){l=t.child,c=null,l.alternate!==null&&l.alternate.memoizedState!==null&&l.alternate.memoizedState.cachePool!==null&&(c=l.alternate.memoizedState.cachePool.pool);var d=null;l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(d=l.memoizedState.cachePool.pool),d!==c&&(l.flags|=2048)}return a!==e&&a&&(t.child.flags|=8192),Lo(t,t.updateQueue),rt(t),null;case 4:return Ae(),e===null&&Bu(t.stateNode.containerInfo),rt(t),null;case 10:return Vn(t.type),rt(t),null;case 19:if(L(jt),c=t.memoizedState,c===null)return rt(t),null;if(l=(t.flags&128)!==0,d=c.rendering,d===null)if(l)er(c,!1);else{if(it!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(d=Ho(e),d!==null){for(t.flags|=128,er(c,!1),e=d.updateQueue,t.updateQueue=e,Lo(t,e),t.subtreeFlags=0,e=a,a=t.child;a!==null;)ch(a,e),a=a.sibling;return F(jt,jt.current&1|2),t.child}e=e.sibling}c.tail!==null&&re()>Go&&(t.flags|=128,l=!0,er(c,!1),t.lanes=4194304)}else{if(!l)if(e=Ho(d),e!==null){if(t.flags|=128,l=!0,e=e.updateQueue,t.updateQueue=e,Lo(t,e),er(c,!0),c.tail===null&&c.tailMode==="hidden"&&!d.alternate&&!Ze)return rt(t),null}else 2*re()-c.renderingStartTime>Go&&a!==536870912&&(t.flags|=128,l=!0,er(c,!1),t.lanes=4194304);c.isBackwards?(d.sibling=t.child,t.child=d):(e=c.last,e!==null?e.sibling=d:t.child=d,c.last=d)}return c.tail!==null?(t=c.tail,c.rendering=t,c.tail=t.sibling,c.renderingStartTime=re(),t.sibling=null,e=jt.current,F(jt,l?e&1|2:e&1),t):(rt(t),null);case 22:case 23:return Xn(t),Lc(),l=t.memoizedState!==null,e!==null?e.memoizedState!==null!==l&&(t.flags|=8192):l&&(t.flags|=8192),l?(a&536870912)!==0&&(t.flags&128)===0&&(rt(t),t.subtreeFlags&6&&(t.flags|=8192)):rt(t),a=t.updateQueue,a!==null&&Lo(t,a.retryQueue),a=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),l=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(l=t.memoizedState.cachePool.pool),l!==a&&(t.flags|=2048),e!==null&&L(ns),null;case 24:return a=null,e!==null&&(a=e.memoizedState.cache),t.memoizedState.cache!==a&&(t.flags|=2048),Vn(vt),rt(t),null;case 25:return null;case 30:return null}throw Error(i(156,t.tag))}function R1(e,t){switch(_c(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Vn(vt),Ae(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return We(t),null;case 13:if(Xn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(i(340));Ul()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return L(jt),null;case 4:return Ae(),null;case 10:return Vn(t.type),null;case 22:case 23:return Xn(t),Lc(),e!==null&&L(ns),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Vn(vt),null;case 25:return null;default:return null}}function Hm(e,t){switch(_c(t),t.tag){case 3:Vn(vt),Ae();break;case 26:case 27:case 5:We(t);break;case 4:Ae();break;case 13:Xn(t);break;case 19:L(jt);break;case 10:Vn(t.type);break;case 22:case 23:Xn(t),Lc(),e!==null&&L(ns);break;case 24:Vn(vt)}}function tr(e,t){try{var a=t.updateQueue,l=a!==null?a.lastEffect:null;if(l!==null){var c=l.next;a=c;do{if((a.tag&e)===e){l=void 0;var d=a.create,y=a.inst;l=d(),y.destroy=l}a=a.next}while(a!==c)}}catch(w){Pe(t,t.return,w)}}function va(e,t,a){try{var l=t.updateQueue,c=l!==null?l.lastEffect:null;if(c!==null){var d=c.next;l=d;do{if((l.tag&e)===e){var y=l.inst,w=y.destroy;if(w!==void 0){y.destroy=void 0,c=t;var O=a,J=w;try{J()}catch(ce){Pe(c,O,ce)}}}l=l.next}while(l!==d)}}catch(ce){Pe(t,t.return,ce)}}function $m(e){var t=e.updateQueue;if(t!==null){var a=e.stateNode;try{Sh(t,a)}catch(l){Pe(e,e.return,l)}}}function Um(e,t,a){a.props=ss(e.type,e.memoizedProps),a.state=e.memoizedState;try{a.componentWillUnmount()}catch(l){Pe(e,t,l)}}function nr(e,t){try{var a=e.ref;if(a!==null){switch(e.tag){case 26:case 27:case 5:var l=e.stateNode;break;case 30:l=e.stateNode;break;default:l=e.stateNode}typeof a=="function"?e.refCleanup=a(l):a.current=l}}catch(c){Pe(e,t,c)}}function Mn(e,t){var a=e.ref,l=e.refCleanup;if(a!==null)if(typeof l=="function")try{l()}catch(c){Pe(e,t,c)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof a=="function")try{a(null)}catch(c){Pe(e,t,c)}else a.current=null}function Bm(e){var t=e.type,a=e.memoizedProps,l=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":a.autoFocus&&l.focus();break e;case"img":a.src?l.src=a.src:a.srcSet&&(l.srcset=a.srcSet)}}catch(c){Pe(e,e.return,c)}}function pu(e,t,a){try{var l=e.stateNode;P1(l,e.type,a,t),l[Bt]=t}catch(c){Pe(e,e.return,c)}}function qm(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&Ca(e.type)||e.tag===4}function xu(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||qm(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&Ca(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function gu(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?(a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a).insertBefore(e,t):(t=a.nodeType===9?a.body:a.nodeName==="HTML"?a.ownerDocument.body:a,t.appendChild(e),a=a._reactRootContainer,a!=null||t.onclick!==null||(t.onclick=Po));else if(l!==4&&(l===27&&Ca(e.type)&&(a=e.stateNode,t=null),e=e.child,e!==null))for(gu(e,t,a),e=e.sibling;e!==null;)gu(e,t,a),e=e.sibling}function Yo(e,t,a){var l=e.tag;if(l===5||l===6)e=e.stateNode,t?a.insertBefore(e,t):a.appendChild(e);else if(l!==4&&(l===27&&Ca(e.type)&&(a=e.stateNode),e=e.child,e!==null))for(Yo(e,t,a),e=e.sibling;e!==null;)Yo(e,t,a),e=e.sibling}function Lm(e){var t=e.stateNode,a=e.memoizedProps;try{for(var l=e.type,c=t.attributes;c.length;)t.removeAttributeNode(c[0]);Ht(t,l,a),t[St]=e,t[Bt]=a}catch(d){Pe(e,e.return,d)}}var Qn=!1,mt=!1,yu=!1,Ym=typeof WeakSet=="function"?WeakSet:Set,kt=null;function z1(e,t){if(e=e.containerInfo,Yu=ri,e=Pf(e),xc(e)){if("selectionStart"in e)var a={start:e.selectionStart,end:e.selectionEnd};else e:{a=(a=e.ownerDocument)&&a.defaultView||window;var l=a.getSelection&&a.getSelection();if(l&&l.rangeCount!==0){a=l.anchorNode;var c=l.anchorOffset,d=l.focusNode;l=l.focusOffset;try{a.nodeType,d.nodeType}catch{a=null;break e}var y=0,w=-1,O=-1,J=0,ce=0,fe=e,P=null;t:for(;;){for(var ne;fe!==a||c!==0&&fe.nodeType!==3||(w=y+c),fe!==d||l!==0&&fe.nodeType!==3||(O=y+l),fe.nodeType===3&&(y+=fe.nodeValue.length),(ne=fe.firstChild)!==null;)P=fe,fe=ne;for(;;){if(fe===e)break t;if(P===a&&++J===c&&(w=y),P===d&&++ce===l&&(O=y),(ne=fe.nextSibling)!==null)break;fe=P,P=fe.parentNode}fe=ne}a=w===-1||O===-1?null:{start:w,end:O}}else a=null}a=a||{start:0,end:0}}else a=null;for(Vu={focusedElem:e,selectionRange:a},ri=!1,kt=t;kt!==null;)if(t=kt,e=t.child,(t.subtreeFlags&1024)!==0&&e!==null)e.return=t,kt=e;else for(;kt!==null;){switch(t=kt,d=t.alternate,e=t.flags,t.tag){case 0:break;case 11:case 15:break;case 1:if((e&1024)!==0&&d!==null){e=void 0,a=t,c=d.memoizedProps,d=d.memoizedState,l=a.stateNode;try{var Me=ss(a.type,c,a.elementType===a.type);e=l.getSnapshotBeforeUpdate(Me,d),l.__reactInternalSnapshotBeforeUpdate=e}catch(_e){Pe(a,a.return,_e)}}break;case 3:if((e&1024)!==0){if(e=t.stateNode.containerInfo,a=e.nodeType,a===9)Zu(e);else if(a===1)switch(e.nodeName){case"HEAD":case"HTML":case"BODY":Zu(e);break;default:e.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((e&1024)!==0)throw Error(i(163))}if(e=t.sibling,e!==null){e.return=t.return,kt=e;break}kt=t.return}}function Vm(e,t,a){var l=a.flags;switch(a.tag){case 0:case 11:case 15:ja(e,a),l&4&&tr(5,a);break;case 1:if(ja(e,a),l&4)if(e=a.stateNode,t===null)try{e.componentDidMount()}catch(y){Pe(a,a.return,y)}else{var c=ss(a.type,t.memoizedProps);t=t.memoizedState;try{e.componentDidUpdate(c,t,e.__reactInternalSnapshotBeforeUpdate)}catch(y){Pe(a,a.return,y)}}l&64&&$m(a),l&512&&nr(a,a.return);break;case 3:if(ja(e,a),l&64&&(e=a.updateQueue,e!==null)){if(t=null,a.child!==null)switch(a.child.tag){case 27:case 5:t=a.child.stateNode;break;case 1:t=a.child.stateNode}try{Sh(e,t)}catch(y){Pe(a,a.return,y)}}break;case 27:t===null&&l&4&&Lm(a);case 26:case 5:ja(e,a),t===null&&l&4&&Bm(a),l&512&&nr(a,a.return);break;case 12:ja(e,a);break;case 13:ja(e,a),l&4&&Zm(e,a),l&64&&(e=a.memoizedState,e!==null&&(e=e.dehydrated,e!==null&&(a=Y1.bind(null,a),rb(e,a))));break;case 22:if(l=a.memoizedState!==null||Qn,!l){t=t!==null&&t.memoizedState!==null||mt,c=Qn;var d=mt;Qn=l,(mt=t)&&!d?Na(e,a,(a.subtreeFlags&8772)!==0):ja(e,a),Qn=c,mt=d}break;case 30:break;default:ja(e,a)}}function Gm(e){var t=e.alternate;t!==null&&(e.alternate=null,Gm(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&kl(t)),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}var st=null,Wt=!1;function Kn(e,t,a){for(a=a.child;a!==null;)Xm(e,t,a),a=a.sibling}function Xm(e,t,a){if(nt&&typeof nt.onCommitFiberUnmount=="function")try{nt.onCommitFiberUnmount(ft,a)}catch{}switch(a.tag){case 26:mt||Mn(a,t),Kn(e,t,a),a.memoizedState?a.memoizedState.count--:a.stateNode&&(a=a.stateNode,a.parentNode.removeChild(a));break;case 27:mt||Mn(a,t);var l=st,c=Wt;Ca(a.type)&&(st=a.stateNode,Wt=!1),Kn(e,t,a),dr(a.stateNode),st=l,Wt=c;break;case 5:mt||Mn(a,t);case 6:if(l=st,c=Wt,st=null,Kn(e,t,a),st=l,Wt=c,st!==null)if(Wt)try{(st.nodeType===9?st.body:st.nodeName==="HTML"?st.ownerDocument.body:st).removeChild(a.stateNode)}catch(d){Pe(a,t,d)}else try{st.removeChild(a.stateNode)}catch(d){Pe(a,t,d)}break;case 18:st!==null&&(Wt?(e=st,zp(e.nodeType===9?e.body:e.nodeName==="HTML"?e.ownerDocument.body:e,a.stateNode),br(e)):zp(st,a.stateNode));break;case 4:l=st,c=Wt,st=a.stateNode.containerInfo,Wt=!0,Kn(e,t,a),st=l,Wt=c;break;case 0:case 11:case 14:case 15:mt||va(2,a,t),mt||va(4,a,t),Kn(e,t,a);break;case 1:mt||(Mn(a,t),l=a.stateNode,typeof l.componentWillUnmount=="function"&&Um(a,t,l)),Kn(e,t,a);break;case 21:Kn(e,t,a);break;case 22:mt=(l=mt)||a.memoizedState!==null,Kn(e,t,a),mt=l;break;default:Kn(e,t,a)}}function Zm(e,t){if(t.memoizedState===null&&(e=t.alternate,e!==null&&(e=e.memoizedState,e!==null&&(e=e.dehydrated,e!==null))))try{br(e)}catch(a){Pe(t,t.return,a)}}function O1(e){switch(e.tag){case 13:case 19:var t=e.stateNode;return t===null&&(t=e.stateNode=new Ym),t;case 22:return e=e.stateNode,t=e._retryCache,t===null&&(t=e._retryCache=new Ym),t;default:throw Error(i(435,e.tag))}}function bu(e,t){var a=O1(e);t.forEach(function(l){var c=V1.bind(null,e,l);a.has(l)||(a.add(l),l.then(c,c))})}function en(e,t){var a=t.deletions;if(a!==null)for(var l=0;l<a.length;l++){var c=a[l],d=e,y=t,w=y;e:for(;w!==null;){switch(w.tag){case 27:if(Ca(w.type)){st=w.stateNode,Wt=!1;break e}break;case 5:st=w.stateNode,Wt=!1;break e;case 3:case 4:st=w.stateNode.containerInfo,Wt=!0;break e}w=w.return}if(st===null)throw Error(i(160));Xm(d,y,c),st=null,Wt=!1,d=c.alternate,d!==null&&(d.return=null),c.return=null}if(t.subtreeFlags&13878)for(t=t.child;t!==null;)Wm(t,e),t=t.sibling}var Nn=null;function Wm(e,t){var a=e.alternate,l=e.flags;switch(e.tag){case 0:case 11:case 14:case 15:en(t,e),tn(e),l&4&&(va(3,e,e.return),tr(3,e),va(5,e,e.return));break;case 1:en(t,e),tn(e),l&512&&(mt||a===null||Mn(a,a.return)),l&64&&Qn&&(e=e.updateQueue,e!==null&&(l=e.callbacks,l!==null&&(a=e.shared.hiddenCallbacks,e.shared.hiddenCallbacks=a===null?l:a.concat(l))));break;case 26:var c=Nn;if(en(t,e),tn(e),l&512&&(mt||a===null||Mn(a,a.return)),l&4){var d=a!==null?a.memoizedState:null;if(l=e.memoizedState,a===null)if(l===null)if(e.stateNode===null){e:{l=e.type,a=e.memoizedProps,c=c.ownerDocument||c;t:switch(l){case"title":d=c.getElementsByTagName("title")[0],(!d||d[Va]||d[St]||d.namespaceURI==="http://www.w3.org/2000/svg"||d.hasAttribute("itemprop"))&&(d=c.createElement(l),c.head.insertBefore(d,c.querySelector("head > title"))),Ht(d,l,a),d[St]=e,gt(d),l=d;break e;case"link":var y=Lp("link","href",c).get(l+(a.href||""));if(y){for(var w=0;w<y.length;w++)if(d=y[w],d.getAttribute("href")===(a.href==null||a.href===""?null:a.href)&&d.getAttribute("rel")===(a.rel==null?null:a.rel)&&d.getAttribute("title")===(a.title==null?null:a.title)&&d.getAttribute("crossorigin")===(a.crossOrigin==null?null:a.crossOrigin)){y.splice(w,1);break t}}d=c.createElement(l),Ht(d,l,a),c.head.appendChild(d);break;case"meta":if(y=Lp("meta","content",c).get(l+(a.content||""))){for(w=0;w<y.length;w++)if(d=y[w],d.getAttribute("content")===(a.content==null?null:""+a.content)&&d.getAttribute("name")===(a.name==null?null:a.name)&&d.getAttribute("property")===(a.property==null?null:a.property)&&d.getAttribute("http-equiv")===(a.httpEquiv==null?null:a.httpEquiv)&&d.getAttribute("charset")===(a.charSet==null?null:a.charSet)){y.splice(w,1);break t}}d=c.createElement(l),Ht(d,l,a),c.head.appendChild(d);break;default:throw Error(i(468,l))}d[St]=e,gt(d),l=d}e.stateNode=l}else Yp(c,e.type,e.stateNode);else e.stateNode=qp(c,l,e.memoizedProps);else d!==l?(d===null?a.stateNode!==null&&(a=a.stateNode,a.parentNode.removeChild(a)):d.count--,l===null?Yp(c,e.type,e.stateNode):qp(c,l,e.memoizedProps)):l===null&&e.stateNode!==null&&pu(e,e.memoizedProps,a.memoizedProps)}break;case 27:en(t,e),tn(e),l&512&&(mt||a===null||Mn(a,a.return)),a!==null&&l&4&&pu(e,e.memoizedProps,a.memoizedProps);break;case 5:if(en(t,e),tn(e),l&512&&(mt||a===null||Mn(a,a.return)),e.flags&32){c=e.stateNode;try{ws(c,"")}catch(ne){Pe(e,e.return,ne)}}l&4&&e.stateNode!=null&&(c=e.memoizedProps,pu(e,c,a!==null?a.memoizedProps:c)),l&1024&&(yu=!0);break;case 6:if(en(t,e),tn(e),l&4){if(e.stateNode===null)throw Error(i(162));l=e.memoizedProps,a=e.stateNode;try{a.nodeValue=l}catch(ne){Pe(e,e.return,ne)}}break;case 3:if(ai=null,c=Nn,Nn=ti(t.containerInfo),en(t,e),Nn=c,tn(e),l&4&&a!==null&&a.memoizedState.isDehydrated)try{br(t.containerInfo)}catch(ne){Pe(e,e.return,ne)}yu&&(yu=!1,Qm(e));break;case 4:l=Nn,Nn=ti(e.stateNode.containerInfo),en(t,e),tn(e),Nn=l;break;case 12:en(t,e),tn(e);break;case 13:en(t,e),tn(e),e.child.flags&8192&&e.memoizedState!==null!=(a!==null&&a.memoizedState!==null)&&(Eu=re()),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,bu(e,l)));break;case 22:c=e.memoizedState!==null;var O=a!==null&&a.memoizedState!==null,J=Qn,ce=mt;if(Qn=J||c,mt=ce||O,en(t,e),mt=ce,Qn=J,tn(e),l&8192)e:for(t=e.stateNode,t._visibility=c?t._visibility&-2:t._visibility|1,c&&(a===null||O||Qn||mt||ls(e)),a=null,t=e;;){if(t.tag===5||t.tag===26){if(a===null){O=a=t;try{if(d=O.stateNode,c)y=d.style,typeof y.setProperty=="function"?y.setProperty("display","none","important"):y.display="none";else{w=O.stateNode;var fe=O.memoizedProps.style,P=fe!=null&&fe.hasOwnProperty("display")?fe.display:null;w.style.display=P==null||typeof P=="boolean"?"":(""+P).trim()}}catch(ne){Pe(O,O.return,ne)}}}else if(t.tag===6){if(a===null){O=t;try{O.stateNode.nodeValue=c?"":O.memoizedProps}catch(ne){Pe(O,O.return,ne)}}}else if((t.tag!==22&&t.tag!==23||t.memoizedState===null||t===e)&&t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;a===t&&(a=null),t=t.return}a===t&&(a=null),t.sibling.return=t.return,t=t.sibling}l&4&&(l=e.updateQueue,l!==null&&(a=l.retryQueue,a!==null&&(l.retryQueue=null,bu(e,a))));break;case 19:en(t,e),tn(e),l&4&&(l=e.updateQueue,l!==null&&(e.updateQueue=null,bu(e,l)));break;case 30:break;case 21:break;default:en(t,e),tn(e)}}function tn(e){var t=e.flags;if(t&2){try{for(var a,l=e.return;l!==null;){if(qm(l)){a=l;break}l=l.return}if(a==null)throw Error(i(160));switch(a.tag){case 27:var c=a.stateNode,d=xu(e);Yo(e,d,c);break;case 5:var y=a.stateNode;a.flags&32&&(ws(y,""),a.flags&=-33);var w=xu(e);Yo(e,w,y);break;case 3:case 4:var O=a.stateNode.containerInfo,J=xu(e);gu(e,J,O);break;default:throw Error(i(161))}}catch(ce){Pe(e,e.return,ce)}e.flags&=-3}t&4096&&(e.flags&=-4097)}function Qm(e){if(e.subtreeFlags&1024)for(e=e.child;e!==null;){var t=e;Qm(t),t.tag===5&&t.flags&1024&&t.stateNode.reset(),e=e.sibling}}function ja(e,t){if(t.subtreeFlags&8772)for(t=t.child;t!==null;)Vm(e,t.alternate,t),t=t.sibling}function ls(e){for(e=e.child;e!==null;){var t=e;switch(t.tag){case 0:case 11:case 14:case 15:va(4,t,t.return),ls(t);break;case 1:Mn(t,t.return);var a=t.stateNode;typeof a.componentWillUnmount=="function"&&Um(t,t.return,a),ls(t);break;case 27:dr(t.stateNode);case 26:case 5:Mn(t,t.return),ls(t);break;case 22:t.memoizedState===null&&ls(t);break;case 30:ls(t);break;default:ls(t)}e=e.sibling}}function Na(e,t,a){for(a=a&&(t.subtreeFlags&8772)!==0,t=t.child;t!==null;){var l=t.alternate,c=e,d=t,y=d.flags;switch(d.tag){case 0:case 11:case 15:Na(c,d,a),tr(4,d);break;case 1:if(Na(c,d,a),l=d,c=l.stateNode,typeof c.componentDidMount=="function")try{c.componentDidMount()}catch(J){Pe(l,l.return,J)}if(l=d,c=l.updateQueue,c!==null){var w=l.stateNode;try{var O=c.shared.hiddenCallbacks;if(O!==null)for(c.shared.hiddenCallbacks=null,c=0;c<O.length;c++)wh(O[c],w)}catch(J){Pe(l,l.return,J)}}a&&y&64&&$m(d),nr(d,d.return);break;case 27:Lm(d);case 26:case 5:Na(c,d,a),a&&l===null&&y&4&&Bm(d),nr(d,d.return);break;case 12:Na(c,d,a);break;case 13:Na(c,d,a),a&&y&4&&Zm(c,d);break;case 22:d.memoizedState===null&&Na(c,d,a),nr(d,d.return);break;case 30:break;default:Na(c,d,a)}t=t.sibling}}function vu(e,t){var a=null;e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(a=e.memoizedState.cachePool.pool),e=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(e=t.memoizedState.cachePool.pool),e!==a&&(e!=null&&e.refCount++,a!=null&&Ll(a))}function ju(e,t){e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ll(e))}function An(e,t,a,l){if(t.subtreeFlags&10256)for(t=t.child;t!==null;)Km(e,t,a,l),t=t.sibling}function Km(e,t,a,l){var c=t.flags;switch(t.tag){case 0:case 11:case 15:An(e,t,a,l),c&2048&&tr(9,t);break;case 1:An(e,t,a,l);break;case 3:An(e,t,a,l),c&2048&&(e=null,t.alternate!==null&&(e=t.alternate.memoizedState.cache),t=t.memoizedState.cache,t!==e&&(t.refCount++,e!=null&&Ll(e)));break;case 12:if(c&2048){An(e,t,a,l),e=t.stateNode;try{var d=t.memoizedProps,y=d.id,w=d.onPostCommit;typeof w=="function"&&w(y,t.alternate===null?"mount":"update",e.passiveEffectDuration,-0)}catch(O){Pe(t,t.return,O)}}else An(e,t,a,l);break;case 13:An(e,t,a,l);break;case 23:break;case 22:d=t.stateNode,y=t.alternate,t.memoizedState!==null?d._visibility&2?An(e,t,a,l):ar(e,t):d._visibility&2?An(e,t,a,l):(d._visibility|=2,Ys(e,t,a,l,(t.subtreeFlags&10256)!==0)),c&2048&&vu(y,t);break;case 24:An(e,t,a,l),c&2048&&ju(t.alternate,t);break;default:An(e,t,a,l)}}function Ys(e,t,a,l,c){for(c=c&&(t.subtreeFlags&10256)!==0,t=t.child;t!==null;){var d=e,y=t,w=a,O=l,J=y.flags;switch(y.tag){case 0:case 11:case 15:Ys(d,y,w,O,c),tr(8,y);break;case 23:break;case 22:var ce=y.stateNode;y.memoizedState!==null?ce._visibility&2?Ys(d,y,w,O,c):ar(d,y):(ce._visibility|=2,Ys(d,y,w,O,c)),c&&J&2048&&vu(y.alternate,y);break;case 24:Ys(d,y,w,O,c),c&&J&2048&&ju(y.alternate,y);break;default:Ys(d,y,w,O,c)}t=t.sibling}}function ar(e,t){if(t.subtreeFlags&10256)for(t=t.child;t!==null;){var a=e,l=t,c=l.flags;switch(l.tag){case 22:ar(a,l),c&2048&&vu(l.alternate,l);break;case 24:ar(a,l),c&2048&&ju(l.alternate,l);break;default:ar(a,l)}t=t.sibling}}var sr=8192;function Vs(e){if(e.subtreeFlags&sr)for(e=e.child;e!==null;)Jm(e),e=e.sibling}function Jm(e){switch(e.tag){case 26:Vs(e),e.flags&sr&&e.memoizedState!==null&&bb(Nn,e.memoizedState,e.memoizedProps);break;case 5:Vs(e);break;case 3:case 4:var t=Nn;Nn=ti(e.stateNode.containerInfo),Vs(e),Nn=t;break;case 22:e.memoizedState===null&&(t=e.alternate,t!==null&&t.memoizedState!==null?(t=sr,sr=16777216,Vs(e),sr=t):Vs(e));break;default:Vs(e)}}function Im(e){var t=e.alternate;if(t!==null&&(e=t.child,e!==null)){t.child=null;do t=e.sibling,e.sibling=null,e=t;while(e!==null)}}function lr(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];kt=l,Pm(l,e)}Im(e)}if(e.subtreeFlags&10256)for(e=e.child;e!==null;)Fm(e),e=e.sibling}function Fm(e){switch(e.tag){case 0:case 11:case 15:lr(e),e.flags&2048&&va(9,e,e.return);break;case 3:lr(e);break;case 12:lr(e);break;case 22:var t=e.stateNode;e.memoizedState!==null&&t._visibility&2&&(e.return===null||e.return.tag!==13)?(t._visibility&=-3,Vo(e)):lr(e);break;default:lr(e)}}function Vo(e){var t=e.deletions;if((e.flags&16)!==0){if(t!==null)for(var a=0;a<t.length;a++){var l=t[a];kt=l,Pm(l,e)}Im(e)}for(e=e.child;e!==null;){switch(t=e,t.tag){case 0:case 11:case 15:va(8,t,t.return),Vo(t);break;case 22:a=t.stateNode,a._visibility&2&&(a._visibility&=-3,Vo(t));break;default:Vo(t)}e=e.sibling}}function Pm(e,t){for(;kt!==null;){var a=kt;switch(a.tag){case 0:case 11:case 15:va(8,a,t);break;case 23:case 22:if(a.memoizedState!==null&&a.memoizedState.cachePool!==null){var l=a.memoizedState.cachePool.pool;l!=null&&l.refCount++}break;case 24:Ll(a.memoizedState.cache)}if(l=a.child,l!==null)l.return=a,kt=l;else e:for(a=e;kt!==null;){l=kt;var c=l.sibling,d=l.return;if(Gm(l),l===a){kt=null;break e}if(c!==null){c.return=d,kt=c;break e}kt=d}}}var D1={getCacheForType:function(e){var t=qt(vt),a=t.data.get(e);return a===void 0&&(a=e(),t.data.set(e,a)),a}},H1=typeof WeakMap=="function"?WeakMap:Map,Qe=0,et=null,Be=null,Ye=0,Ke=0,nn=null,wa=!1,Gs=!1,Nu=!1,Jn=0,it=0,Sa=0,rs=0,wu=0,xn=0,Xs=0,rr=null,Qt=null,Su=!1,Eu=0,Go=1/0,Xo=null,Ea=null,Dt=0,ka=null,Zs=null,Ws=0,ku=0,_u=null,ep=null,or=0,Cu=null;function an(){if((Qe&2)!==0&&Ye!==0)return Ye&-Ye;if(E.T!==null){var e=Os;return e!==0?e:Du()}return Jr()}function tp(){xn===0&&(xn=(Ye&536870912)===0||Ze?ys():536870912);var e=pn.current;return e!==null&&(e.flags|=32),xn}function sn(e,t,a){(e===et&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)&&(Qs(e,0),_a(e,Ye,xn,!1)),ra(e,a),((Qe&2)===0||e!==et)&&(e===et&&((Qe&2)===0&&(rs|=a),it===4&&_a(e,Ye,xn,!1)),Rn(e))}function np(e,t,a){if((Qe&6)!==0)throw Error(i(327));var l=!a&&(t&124)===0&&(t&e.expiredLanes)===0||It(e,t),c=l?B1(e,t):Au(e,t,!0),d=l;do{if(c===0){Gs&&!l&&_a(e,t,0,!1);break}else{if(a=e.current.alternate,d&&!$1(a)){c=Au(e,t,!1),d=!1;continue}if(c===2){if(d=t,e.errorRecoveryDisabledLanes&d)var y=0;else y=e.pendingLanes&-536870913,y=y!==0?y:y&536870912?536870912:0;if(y!==0){t=y;e:{var w=e;c=rr;var O=w.current.memoizedState.isDehydrated;if(O&&(Qs(w,y).flags|=256),y=Au(w,y,!1),y!==2){if(Nu&&!O){w.errorRecoveryDisabledLanes|=d,rs|=d,c=4;break e}d=Qt,Qt=c,d!==null&&(Qt===null?Qt=d:Qt.push.apply(Qt,d))}c=y}if(d=!1,c!==2)continue}}if(c===1){Qs(e,0),_a(e,t,0,!0);break}e:{switch(l=e,d=c,d){case 0:case 1:throw Error(i(345));case 4:if((t&4194048)!==t)break;case 6:_a(l,t,xn,!wa);break e;case 2:Qt=null;break;case 3:case 5:break;default:throw Error(i(329))}if((t&62914560)===t&&(c=Eu+300-re(),10<c)){if(_a(l,t,xn,!wa),Vt(l,0,!0)!==0)break e;l.timeoutHandle=Ap(ap.bind(null,l,a,Qt,Xo,Su,t,xn,rs,Xs,wa,d,2,-0,0),c);break e}ap(l,a,Qt,Xo,Su,t,xn,rs,Xs,wa,d,0,-0,0)}}break}while(!0);Rn(e)}function ap(e,t,a,l,c,d,y,w,O,J,ce,fe,P,ne){if(e.timeoutHandle=-1,fe=t.subtreeFlags,(fe&8192||(fe&16785408)===16785408)&&(mr={stylesheets:null,count:0,unsuspend:yb},Jm(t),fe=vb(),fe!==null)){e.cancelPendingCommit=fe(up.bind(null,e,t,d,a,l,c,y,w,O,ce,1,P,ne)),_a(e,d,y,!J);return}up(e,t,d,a,l,c,y,w,O)}function $1(e){for(var t=e;;){var a=t.tag;if((a===0||a===11||a===15)&&t.flags&16384&&(a=t.updateQueue,a!==null&&(a=a.stores,a!==null)))for(var l=0;l<a.length;l++){var c=a[l],d=c.getSnapshot;c=c.value;try{if(!Ft(d(),c))return!1}catch{return!1}}if(a=t.child,t.subtreeFlags&16384&&a!==null)a.return=t,t=a;else{if(t===e)break;for(;t.sibling===null;){if(t.return===null||t.return===e)return!0;t=t.return}t.sibling.return=t.return,t=t.sibling}}return!0}function _a(e,t,a,l){t&=~wu,t&=~rs,e.suspendedLanes|=t,e.pingedLanes&=~t,l&&(e.warmLanes|=t),l=e.expirationTimes;for(var c=t;0<c;){var d=31-at(c),y=1<<d;l[d]=-1,c&=~y}a!==0&&Qr(e,a,t)}function Zo(){return(Qe&6)===0?(ir(0),!1):!0}function Tu(){if(Be!==null){if(Ke===0)var e=Be.return;else e=Be,Yn=es=null,Zc(e),qs=null,Fl=0,e=Be;for(;e!==null;)Hm(e.alternate,e),e=e.return;Be=null}}function Qs(e,t){var a=e.timeoutHandle;a!==-1&&(e.timeoutHandle=-1,tb(a)),a=e.cancelPendingCommit,a!==null&&(e.cancelPendingCommit=null,a()),Tu(),et=e,Be=a=Bn(e.current,null),Ye=t,Ke=0,nn=null,wa=!1,Gs=It(e,t),Nu=!1,Xs=xn=wu=rs=Sa=it=0,Qt=rr=null,Su=!1,(t&8)!==0&&(t|=t&32);var l=e.entangledLanes;if(l!==0)for(e=e.entanglements,l&=t;0<l;){var c=31-at(l),d=1<<c;t|=e[c],l&=~d}return Jn=t,mo(),a}function sp(e,t){He=null,E.H=zo,t===Vl||t===wo?(t=jh(),Ke=3):t===yh?(t=jh(),Ke=4):Ke=t===Nm?8:t!==null&&typeof t=="object"&&typeof t.then=="function"?6:1,nn=t,Be===null&&(it=1,Uo(e,dn(t,e.current)))}function lp(){var e=E.H;return E.H=zo,e===null?zo:e}function rp(){var e=E.A;return E.A=D1,e}function Mu(){it=4,wa||(Ye&4194048)!==Ye&&pn.current!==null||(Gs=!0),(Sa&134217727)===0&&(rs&134217727)===0||et===null||_a(et,Ye,xn,!1)}function Au(e,t,a){var l=Qe;Qe|=2;var c=lp(),d=rp();(et!==e||Ye!==t)&&(Xo=null,Qs(e,t)),t=!1;var y=it;e:do try{if(Ke!==0&&Be!==null){var w=Be,O=nn;switch(Ke){case 8:Tu(),y=6;break e;case 3:case 2:case 9:case 6:pn.current===null&&(t=!0);var J=Ke;if(Ke=0,nn=null,Ks(e,w,O,J),a&&Gs){y=0;break e}break;default:J=Ke,Ke=0,nn=null,Ks(e,w,O,J)}}U1(),y=it;break}catch(ce){sp(e,ce)}while(!0);return t&&e.shellSuspendCounter++,Yn=es=null,Qe=l,E.H=c,E.A=d,Be===null&&(et=null,Ye=0,mo()),y}function U1(){for(;Be!==null;)op(Be)}function B1(e,t){var a=Qe;Qe|=2;var l=lp(),c=rp();et!==e||Ye!==t?(Xo=null,Go=re()+500,Qs(e,t)):Gs=It(e,t);e:do try{if(Ke!==0&&Be!==null){t=Be;var d=nn;t:switch(Ke){case 1:Ke=0,nn=null,Ks(e,t,d,1);break;case 2:case 9:if(bh(d)){Ke=0,nn=null,ip(t);break}t=function(){Ke!==2&&Ke!==9||et!==e||(Ke=7),Rn(e)},d.then(t,t);break e;case 3:Ke=7;break e;case 4:Ke=5;break e;case 7:bh(d)?(Ke=0,nn=null,ip(t)):(Ke=0,nn=null,Ks(e,t,d,7));break;case 5:var y=null;switch(Be.tag){case 26:y=Be.memoizedState;case 5:case 27:var w=Be;if(!y||Vp(y)){Ke=0,nn=null;var O=w.sibling;if(O!==null)Be=O;else{var J=w.return;J!==null?(Be=J,Wo(J)):Be=null}break t}}Ke=0,nn=null,Ks(e,t,d,5);break;case 6:Ke=0,nn=null,Ks(e,t,d,6);break;case 8:Tu(),it=6;break e;default:throw Error(i(462))}}q1();break}catch(ce){sp(e,ce)}while(!0);return Yn=es=null,E.H=l,E.A=c,Qe=a,Be!==null?0:(et=null,Ye=0,mo(),it)}function q1(){for(;Be!==null&&!Y();)op(Be)}function op(e){var t=Om(e.alternate,e,Jn);e.memoizedProps=e.pendingProps,t===null?Wo(e):Be=t}function ip(e){var t=e,a=t.alternate;switch(t.tag){case 15:case 0:t=Cm(a,t,t.pendingProps,t.type,void 0,Ye);break;case 11:t=Cm(a,t,t.pendingProps,t.type.render,t.ref,Ye);break;case 5:Zc(t);default:Hm(a,t),t=Be=ch(t,Jn),t=Om(a,t,Jn)}e.memoizedProps=e.pendingProps,t===null?Wo(e):Be=t}function Ks(e,t,a,l){Yn=es=null,Zc(t),qs=null,Fl=0;var c=t.return;try{if(T1(e,c,t,a,Ye)){it=1,Uo(e,dn(a,e.current)),Be=null;return}}catch(d){if(c!==null)throw Be=c,d;it=1,Uo(e,dn(a,e.current)),Be=null;return}t.flags&32768?(Ze||l===1?e=!0:Gs||(Ye&536870912)!==0?e=!1:(wa=e=!0,(l===2||l===9||l===3||l===6)&&(l=pn.current,l!==null&&l.tag===13&&(l.flags|=16384))),cp(t,e)):Wo(t)}function Wo(e){var t=e;do{if((t.flags&32768)!==0){cp(t,wa);return}e=t.return;var a=A1(t.alternate,t,Jn);if(a!==null){Be=a;return}if(t=t.sibling,t!==null){Be=t;return}Be=t=e}while(t!==null);it===0&&(it=5)}function cp(e,t){do{var a=R1(e.alternate,e);if(a!==null){a.flags&=32767,Be=a;return}if(a=e.return,a!==null&&(a.flags|=32768,a.subtreeFlags=0,a.deletions=null),!t&&(e=e.sibling,e!==null)){Be=e;return}Be=e=a}while(e!==null);it=6,Be=null}function up(e,t,a,l,c,d,y,w,O){e.cancelPendingCommit=null;do Qo();while(Dt!==0);if((Qe&6)!==0)throw Error(i(327));if(t!==null){if(t===e.current)throw Error(i(177));if(d=t.lanes|t.childLanes,d|=jc,Dn(e,a,d,y,w,O),e===et&&(Be=et=null,Ye=0),Zs=t,ka=e,Ws=a,ku=d,_u=c,ep=l,(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?(e.callbackNode=null,e.callbackPriority=0,G1(ke,function(){return pp(),null})):(e.callbackNode=null,e.callbackPriority=0),l=(t.flags&13878)!==0,(t.subtreeFlags&13878)!==0||l){l=E.T,E.T=null,c=$.p,$.p=2,y=Qe,Qe|=4;try{z1(e,t,a)}finally{Qe=y,$.p=c,E.T=l}}Dt=1,dp(),fp(),hp()}}function dp(){if(Dt===1){Dt=0;var e=ka,t=Zs,a=(t.flags&13878)!==0;if((t.subtreeFlags&13878)!==0||a){a=E.T,E.T=null;var l=$.p;$.p=2;var c=Qe;Qe|=4;try{Wm(t,e);var d=Vu,y=Pf(e.containerInfo),w=d.focusedElem,O=d.selectionRange;if(y!==w&&w&&w.ownerDocument&&Ff(w.ownerDocument.documentElement,w)){if(O!==null&&xc(w)){var J=O.start,ce=O.end;if(ce===void 0&&(ce=J),"selectionStart"in w)w.selectionStart=J,w.selectionEnd=Math.min(ce,w.value.length);else{var fe=w.ownerDocument||document,P=fe&&fe.defaultView||window;if(P.getSelection){var ne=P.getSelection(),Me=w.textContent.length,_e=Math.min(O.start,Me),Fe=O.end===void 0?_e:Math.min(O.end,Me);!ne.extend&&_e>Fe&&(y=Fe,Fe=_e,_e=y);var G=If(w,_e),U=If(w,Fe);if(G&&U&&(ne.rangeCount!==1||ne.anchorNode!==G.node||ne.anchorOffset!==G.offset||ne.focusNode!==U.node||ne.focusOffset!==U.offset)){var Q=fe.createRange();Q.setStart(G.node,G.offset),ne.removeAllRanges(),_e>Fe?(ne.addRange(Q),ne.extend(U.node,U.offset)):(Q.setEnd(U.node,U.offset),ne.addRange(Q))}}}}for(fe=[],ne=w;ne=ne.parentNode;)ne.nodeType===1&&fe.push({element:ne,left:ne.scrollLeft,top:ne.scrollTop});for(typeof w.focus=="function"&&w.focus(),w=0;w<fe.length;w++){var de=fe[w];de.element.scrollLeft=de.left,de.element.scrollTop=de.top}}ri=!!Yu,Vu=Yu=null}finally{Qe=c,$.p=l,E.T=a}}e.current=t,Dt=2}}function fp(){if(Dt===2){Dt=0;var e=ka,t=Zs,a=(t.flags&8772)!==0;if((t.subtreeFlags&8772)!==0||a){a=E.T,E.T=null;var l=$.p;$.p=2;var c=Qe;Qe|=4;try{Vm(e,t.alternate,t)}finally{Qe=c,$.p=l,E.T=a}}Dt=3}}function hp(){if(Dt===4||Dt===3){Dt=0,ue();var e=ka,t=Zs,a=Ws,l=ep;(t.subtreeFlags&10256)!==0||(t.flags&10256)!==0?Dt=5:(Dt=0,Zs=ka=null,mp(e,e.pendingLanes));var c=e.pendingLanes;if(c===0&&(Ea=null),Sl(a),t=t.stateNode,nt&&typeof nt.onCommitFiberRoot=="function")try{nt.onCommitFiberRoot(ft,t,void 0,(t.current.flags&128)===128)}catch{}if(l!==null){t=E.T,c=$.p,$.p=2,E.T=null;try{for(var d=e.onRecoverableError,y=0;y<l.length;y++){var w=l[y];d(w.value,{componentStack:w.stack})}}finally{E.T=t,$.p=c}}(Ws&3)!==0&&Qo(),Rn(e),c=e.pendingLanes,(a&4194090)!==0&&(c&42)!==0?e===Cu?or++:(or=0,Cu=e):or=0,ir(0)}}function mp(e,t){(e.pooledCacheLanes&=t)===0&&(t=e.pooledCache,t!=null&&(e.pooledCache=null,Ll(t)))}function Qo(e){return dp(),fp(),hp(),pp()}function pp(){if(Dt!==5)return!1;var e=ka,t=ku;ku=0;var a=Sl(Ws),l=E.T,c=$.p;try{$.p=32>a?32:a,E.T=null,a=_u,_u=null;var d=ka,y=Ws;if(Dt=0,Zs=ka=null,Ws=0,(Qe&6)!==0)throw Error(i(331));var w=Qe;if(Qe|=4,Fm(d.current),Km(d,d.current,y,a),Qe=w,ir(0,!1),nt&&typeof nt.onPostCommitFiberRoot=="function")try{nt.onPostCommitFiberRoot(ft,d)}catch{}return!0}finally{$.p=c,E.T=l,mp(e,t)}}function xp(e,t,a){t=dn(a,t),t=ru(e.stateNode,t,2),e=xa(e,t,2),e!==null&&(ra(e,2),Rn(e))}function Pe(e,t,a){if(e.tag===3)xp(e,e,a);else for(;t!==null;){if(t.tag===3){xp(t,e,a);break}else if(t.tag===1){var l=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof l.componentDidCatch=="function"&&(Ea===null||!Ea.has(l))){e=dn(a,e),a=vm(2),l=xa(t,a,2),l!==null&&(jm(a,l,t,e),ra(l,2),Rn(l));break}}t=t.return}}function Ru(e,t,a){var l=e.pingCache;if(l===null){l=e.pingCache=new H1;var c=new Set;l.set(t,c)}else c=l.get(t),c===void 0&&(c=new Set,l.set(t,c));c.has(a)||(Nu=!0,c.add(a),e=L1.bind(null,e,t,a),t.then(e,e))}function L1(e,t,a){var l=e.pingCache;l!==null&&l.delete(t),e.pingedLanes|=e.suspendedLanes&a,e.warmLanes&=~a,et===e&&(Ye&a)===a&&(it===4||it===3&&(Ye&62914560)===Ye&&300>re()-Eu?(Qe&2)===0&&Qs(e,0):wu|=a,Xs===Ye&&(Xs=0)),Rn(e)}function gp(e,t){t===0&&(t=la()),e=Ms(e,t),e!==null&&(ra(e,t),Rn(e))}function Y1(e){var t=e.memoizedState,a=0;t!==null&&(a=t.retryLane),gp(e,a)}function V1(e,t){var a=0;switch(e.tag){case 13:var l=e.stateNode,c=e.memoizedState;c!==null&&(a=c.retryLane);break;case 19:l=e.stateNode;break;case 22:l=e.stateNode._retryCache;break;default:throw Error(i(314))}l!==null&&l.delete(t),gp(e,a)}function G1(e,t){return be(e,t)}var Ko=null,Js=null,zu=!1,Jo=!1,Ou=!1,os=0;function Rn(e){e!==Js&&e.next===null&&(Js===null?Ko=Js=e:Js=Js.next=e),Jo=!0,zu||(zu=!0,Z1())}function ir(e,t){if(!Ou&&Jo){Ou=!0;do for(var a=!1,l=Ko;l!==null;){if(e!==0){var c=l.pendingLanes;if(c===0)var d=0;else{var y=l.suspendedLanes,w=l.pingedLanes;d=(1<<31-at(42|e)+1)-1,d&=c&~(y&~w),d=d&201326741?d&201326741|1:d?d|2:0}d!==0&&(a=!0,jp(l,d))}else d=Ye,d=Vt(l,l===et?d:0,l.cancelPendingCommit!==null||l.timeoutHandle!==-1),(d&3)===0||It(l,d)||(a=!0,jp(l,d));l=l.next}while(a);Ou=!1}}function X1(){yp()}function yp(){Jo=zu=!1;var e=0;os!==0&&(eb()&&(e=os),os=0);for(var t=re(),a=null,l=Ko;l!==null;){var c=l.next,d=bp(l,t);d===0?(l.next=null,a===null?Ko=c:a.next=c,c===null&&(Js=a)):(a=l,(e!==0||(d&3)!==0)&&(Jo=!0)),l=c}ir(e)}function bp(e,t){for(var a=e.suspendedLanes,l=e.pingedLanes,c=e.expirationTimes,d=e.pendingLanes&-62914561;0<d;){var y=31-at(d),w=1<<y,O=c[y];O===-1?((w&a)===0||(w&l)!==0)&&(c[y]=Nl(w,t)):O<=t&&(e.expiredLanes|=w),d&=~w}if(t=et,a=Ye,a=Vt(e,e===t?a:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l=e.callbackNode,a===0||e===t&&(Ke===2||Ke===9)||e.cancelPendingCommit!==null)return l!==null&&l!==null&&B(l),e.callbackNode=null,e.callbackPriority=0;if((a&3)===0||It(e,a)){if(t=a&-a,t===e.callbackPriority)return t;switch(l!==null&&B(l),Sl(a)){case 2:case 8:a=ge;break;case 32:a=ke;break;case 268435456:a=ze;break;default:a=ke}return l=vp.bind(null,e),a=be(a,l),e.callbackPriority=t,e.callbackNode=a,t}return l!==null&&l!==null&&B(l),e.callbackPriority=2,e.callbackNode=null,2}function vp(e,t){if(Dt!==0&&Dt!==5)return e.callbackNode=null,e.callbackPriority=0,null;var a=e.callbackNode;if(Qo()&&e.callbackNode!==a)return null;var l=Ye;return l=Vt(e,e===et?l:0,e.cancelPendingCommit!==null||e.timeoutHandle!==-1),l===0?null:(np(e,l,t),bp(e,re()),e.callbackNode!=null&&e.callbackNode===a?vp.bind(null,e):null)}function jp(e,t){if(Qo())return null;np(e,t,!0)}function Z1(){nb(function(){(Qe&6)!==0?be(Ee,X1):yp()})}function Du(){return os===0&&(os=ys()),os}function Np(e){return e==null||typeof e=="symbol"||typeof e=="boolean"?null:typeof e=="function"?e:ro(""+e)}function wp(e,t){var a=t.ownerDocument.createElement("input");return a.name=t.name,a.value=t.value,e.id&&a.setAttribute("form",e.id),t.parentNode.insertBefore(a,t),e=new FormData(e),a.parentNode.removeChild(a),e}function W1(e,t,a,l,c){if(t==="submit"&&a&&a.stateNode===c){var d=Np((c[Bt]||null).action),y=l.submitter;y&&(t=(t=y[Bt]||null)?Np(t.formAction):y.getAttribute("formAction"),t!==null&&(d=t,y=null));var w=new uo("action","action",null,l,c);e.push({event:w,listeners:[{instance:null,listener:function(){if(l.defaultPrevented){if(os!==0){var O=y?wp(c,y):new FormData(c);tu(a,{pending:!0,data:O,method:c.method,action:d},null,O)}}else typeof d=="function"&&(w.preventDefault(),O=y?wp(c,y):new FormData(c),tu(a,{pending:!0,data:O,method:c.method,action:d},d,O))},currentTarget:c}]})}}for(var Hu=0;Hu<vc.length;Hu++){var $u=vc[Hu],Q1=$u.toLowerCase(),K1=$u[0].toUpperCase()+$u.slice(1);jn(Q1,"on"+K1)}jn(nh,"onAnimationEnd"),jn(ah,"onAnimationIteration"),jn(sh,"onAnimationStart"),jn("dblclick","onDoubleClick"),jn("focusin","onFocus"),jn("focusout","onBlur"),jn(f1,"onTransitionRun"),jn(h1,"onTransitionStart"),jn(m1,"onTransitionCancel"),jn(lh,"onTransitionEnd"),ua("onMouseEnter",["mouseout","mouseover"]),ua("onMouseLeave",["mouseout","mouseover"]),ua("onPointerEnter",["pointerout","pointerover"]),ua("onPointerLeave",["pointerout","pointerover"]),$n("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),$n("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),$n("onBeforeInput",["compositionend","keypress","textInput","paste"]),$n("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),$n("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),$n("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var cr="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(" "),J1=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(cr));function Sp(e,t){t=(t&4)!==0;for(var a=0;a<e.length;a++){var l=e[a],c=l.event;l=l.listeners;e:{var d=void 0;if(t)for(var y=l.length-1;0<=y;y--){var w=l[y],O=w.instance,J=w.currentTarget;if(w=w.listener,O!==d&&c.isPropagationStopped())break e;d=w,c.currentTarget=J;try{d(c)}catch(ce){$o(ce)}c.currentTarget=null,d=O}else for(y=0;y<l.length;y++){if(w=l[y],O=w.instance,J=w.currentTarget,w=w.listener,O!==d&&c.isPropagationStopped())break e;d=w,c.currentTarget=J;try{d(c)}catch(ce){$o(ce)}c.currentTarget=null,d=O}}}}function qe(e,t){var a=t[El];a===void 0&&(a=t[El]=new Set);var l=e+"__bubble";a.has(l)||(Ep(t,e,2,!1),a.add(l))}function Uu(e,t,a){var l=0;t&&(l|=4),Ep(a,e,l,t)}var Io="_reactListening"+Math.random().toString(36).slice(2);function Bu(e){if(!e[Io]){e[Io]=!0,Fr.forEach(function(a){a!=="selectionchange"&&(J1.has(a)||Uu(a,!1,e),Uu(a,!0,e))});var t=e.nodeType===9?e:e.ownerDocument;t===null||t[Io]||(t[Io]=!0,Uu("selectionchange",!1,t))}}function Ep(e,t,a,l){switch(Kp(t)){case 2:var c=wb;break;case 8:c=Sb;break;default:c=Pu}a=c.bind(null,t,a,e),c=void 0,!oc||t!=="touchstart"&&t!=="touchmove"&&t!=="wheel"||(c=!0),l?c!==void 0?e.addEventListener(t,a,{capture:!0,passive:c}):e.addEventListener(t,a,!0):c!==void 0?e.addEventListener(t,a,{passive:c}):e.addEventListener(t,a,!1)}function qu(e,t,a,l,c){var d=l;if((t&1)===0&&(t&2)===0&&l!==null)e:for(;;){if(l===null)return;var y=l.tag;if(y===3||y===4){var w=l.stateNode.containerInfo;if(w===c)break;if(y===4)for(y=l.return;y!==null;){var O=y.tag;if((O===3||O===4)&&y.stateNode.containerInfo===c)return;y=y.return}for(;w!==null;){if(y=Hn(w),y===null)return;if(O=y.tag,O===5||O===6||O===26||O===27){l=d=y;continue e}w=w.parentNode}}l=l.return}Rf(function(){var J=d,ce=lc(a),fe=[];e:{var P=rh.get(e);if(P!==void 0){var ne=uo,Me=e;switch(e){case"keypress":if(io(a)===0)break e;case"keydown":case"keyup":ne=Gy;break;case"focusin":Me="focus",ne=dc;break;case"focusout":Me="blur",ne=dc;break;case"beforeblur":case"afterblur":ne=dc;break;case"click":if(a.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":ne=Df;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":ne=Ry;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":ne=Wy;break;case nh:case ah:case sh:ne=Dy;break;case lh:ne=Ky;break;case"scroll":case"scrollend":ne=My;break;case"wheel":ne=Iy;break;case"copy":case"cut":case"paste":ne=$y;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":ne=$f;break;case"toggle":case"beforetoggle":ne=Py}var _e=(t&4)!==0,Fe=!_e&&(e==="scroll"||e==="scrollend"),G=_e?P!==null?P+"Capture":null:P;_e=[];for(var U=J,Q;U!==null;){var de=U;if(Q=de.stateNode,de=de.tag,de!==5&&de!==26&&de!==27||Q===null||G===null||(de=Cl(U,G),de!=null&&_e.push(ur(U,de,Q))),Fe)break;U=U.return}0<_e.length&&(P=new ne(P,Me,null,a,ce),fe.push({event:P,listeners:_e}))}}if((t&7)===0){e:{if(P=e==="mouseover"||e==="pointerover",ne=e==="mouseout"||e==="pointerout",P&&a!==sc&&(Me=a.relatedTarget||a.fromElement)&&(Hn(Me)||Me[oa]))break e;if((ne||P)&&(P=ce.window===ce?ce:(P=ce.ownerDocument)?P.defaultView||P.parentWindow:window,ne?(Me=a.relatedTarget||a.toElement,ne=J,Me=Me?Hn(Me):null,Me!==null&&(Fe=f(Me),_e=Me.tag,Me!==Fe||_e!==5&&_e!==27&&_e!==6)&&(Me=null)):(ne=null,Me=J),ne!==Me)){if(_e=Df,de="onMouseLeave",G="onMouseEnter",U="mouse",(e==="pointerout"||e==="pointerover")&&(_e=$f,de="onPointerLeave",G="onPointerEnter",U="pointer"),Fe=ne==null?P:Ga(ne),Q=Me==null?P:Ga(Me),P=new _e(de,U+"leave",ne,a,ce),P.target=Fe,P.relatedTarget=Q,de=null,Hn(ce)===J&&(_e=new _e(G,U+"enter",Me,a,ce),_e.target=Q,_e.relatedTarget=Fe,de=_e),Fe=de,ne&&Me)t:{for(_e=ne,G=Me,U=0,Q=_e;Q;Q=Is(Q))U++;for(Q=0,de=G;de;de=Is(de))Q++;for(;0<U-Q;)_e=Is(_e),U--;for(;0<Q-U;)G=Is(G),Q--;for(;U--;){if(_e===G||G!==null&&_e===G.alternate)break t;_e=Is(_e),G=Is(G)}_e=null}else _e=null;ne!==null&&kp(fe,P,ne,_e,!1),Me!==null&&Fe!==null&&kp(fe,Fe,Me,_e,!0)}}e:{if(P=J?Ga(J):window,ne=P.nodeName&&P.nodeName.toLowerCase(),ne==="select"||ne==="input"&&P.type==="file")var ye=Xf;else if(Vf(P))if(Zf)ye=c1;else{ye=o1;var $e=r1}else ne=P.nodeName,!ne||ne.toLowerCase()!=="input"||P.type!=="checkbox"&&P.type!=="radio"?J&&ac(J.elementType)&&(ye=Xf):ye=i1;if(ye&&(ye=ye(e,J))){Gf(fe,ye,a,ce);break e}$e&&$e(e,P,J),e==="focusout"&&J&&P.type==="number"&&J.memoizedProps.value!=null&&nc(P,"number",P.value)}switch($e=J?Ga(J):window,e){case"focusin":(Vf($e)||$e.contentEditable==="true")&&(_s=$e,gc=J,Hl=null);break;case"focusout":Hl=gc=_s=null;break;case"mousedown":yc=!0;break;case"contextmenu":case"mouseup":case"dragend":yc=!1,eh(fe,a,ce);break;case"selectionchange":if(d1)break;case"keydown":case"keyup":eh(fe,a,ce)}var we;if(hc)e:{switch(e){case"compositionstart":var Ce="onCompositionStart";break e;case"compositionend":Ce="onCompositionEnd";break e;case"compositionupdate":Ce="onCompositionUpdate";break e}Ce=void 0}else ks?Lf(e,a)&&(Ce="onCompositionEnd"):e==="keydown"&&a.keyCode===229&&(Ce="onCompositionStart");Ce&&(Uf&&a.locale!=="ko"&&(ks||Ce!=="onCompositionStart"?Ce==="onCompositionEnd"&&ks&&(we=zf()):(fa=ce,ic="value"in fa?fa.value:fa.textContent,ks=!0)),$e=Fo(J,Ce),0<$e.length&&(Ce=new Hf(Ce,e,null,a,ce),fe.push({event:Ce,listeners:$e}),we?Ce.data=we:(we=Yf(a),we!==null&&(Ce.data=we)))),(we=t1?n1(e,a):a1(e,a))&&(Ce=Fo(J,"onBeforeInput"),0<Ce.length&&($e=new Hf("onBeforeInput","beforeinput",null,a,ce),fe.push({event:$e,listeners:Ce}),$e.data=we)),W1(fe,e,J,a,ce)}Sp(fe,t)})}function ur(e,t,a){return{instance:e,listener:t,currentTarget:a}}function Fo(e,t){for(var a=t+"Capture",l=[];e!==null;){var c=e,d=c.stateNode;if(c=c.tag,c!==5&&c!==26&&c!==27||d===null||(c=Cl(e,a),c!=null&&l.unshift(ur(e,c,d)),c=Cl(e,t),c!=null&&l.push(ur(e,c,d))),e.tag===3)return l;e=e.return}return[]}function Is(e){if(e===null)return null;do e=e.return;while(e&&e.tag!==5&&e.tag!==27);return e||null}function kp(e,t,a,l,c){for(var d=t._reactName,y=[];a!==null&&a!==l;){var w=a,O=w.alternate,J=w.stateNode;if(w=w.tag,O!==null&&O===l)break;w!==5&&w!==26&&w!==27||J===null||(O=J,c?(J=Cl(a,d),J!=null&&y.unshift(ur(a,J,O))):c||(J=Cl(a,d),J!=null&&y.push(ur(a,J,O)))),a=a.return}y.length!==0&&e.push({event:t,listeners:y})}var I1=/\r\n?/g,F1=/\u0000|\uFFFD/g;function _p(e){return(typeof e=="string"?e:""+e).replace(I1,`
49
+ `).replace(F1,"")}function Cp(e,t){return t=_p(t),_p(e)===t}function Po(){}function Ie(e,t,a,l,c,d){switch(a){case"children":typeof l=="string"?t==="body"||t==="textarea"&&l===""||ws(e,l):(typeof l=="number"||typeof l=="bigint")&&t!=="body"&&ws(e,""+l);break;case"className":vs(e,"class",l);break;case"tabIndex":vs(e,"tabindex",l);break;case"dir":case"role":case"viewBox":case"width":case"height":vs(e,a,l);break;case"style":Mf(e,l,d);break;case"data":if(t!=="object"){vs(e,"data",l);break}case"src":case"href":if(l===""&&(t!=="a"||a!=="href")){e.removeAttribute(a);break}if(l==null||typeof l=="function"||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=ro(""+l),e.setAttribute(a,l);break;case"action":case"formAction":if(typeof l=="function"){e.setAttribute(a,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof d=="function"&&(a==="formAction"?(t!=="input"&&Ie(e,t,"name",c.name,c,null),Ie(e,t,"formEncType",c.formEncType,c,null),Ie(e,t,"formMethod",c.formMethod,c,null),Ie(e,t,"formTarget",c.formTarget,c,null)):(Ie(e,t,"encType",c.encType,c,null),Ie(e,t,"method",c.method,c,null),Ie(e,t,"target",c.target,c,null)));if(l==null||typeof l=="symbol"||typeof l=="boolean"){e.removeAttribute(a);break}l=ro(""+l),e.setAttribute(a,l);break;case"onClick":l!=null&&(e.onclick=Po);break;case"onScroll":l!=null&&qe("scroll",e);break;case"onScrollEnd":l!=null&&qe("scrollend",e);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(c.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"multiple":e.multiple=l&&typeof l!="function"&&typeof l!="symbol";break;case"muted":e.muted=l&&typeof l!="function"&&typeof l!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(l==null||typeof l=="function"||typeof l=="boolean"||typeof l=="symbol"){e.removeAttribute("xlink:href");break}a=ro(""+l),e.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",a);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""+l):e.removeAttribute(a);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":l&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,""):e.removeAttribute(a);break;case"capture":case"download":l===!0?e.setAttribute(a,""):l!==!1&&l!=null&&typeof l!="function"&&typeof l!="symbol"?e.setAttribute(a,l):e.removeAttribute(a);break;case"cols":case"rows":case"size":case"span":l!=null&&typeof l!="function"&&typeof l!="symbol"&&!isNaN(l)&&1<=l?e.setAttribute(a,l):e.removeAttribute(a);break;case"rowSpan":case"start":l==null||typeof l=="function"||typeof l=="symbol"||isNaN(l)?e.removeAttribute(a):e.setAttribute(a,l);break;case"popover":qe("beforetoggle",e),qe("toggle",e),bs(e,"popover",l);break;case"xlinkActuate":vn(e,"http://www.w3.org/1999/xlink","xlink:actuate",l);break;case"xlinkArcrole":vn(e,"http://www.w3.org/1999/xlink","xlink:arcrole",l);break;case"xlinkRole":vn(e,"http://www.w3.org/1999/xlink","xlink:role",l);break;case"xlinkShow":vn(e,"http://www.w3.org/1999/xlink","xlink:show",l);break;case"xlinkTitle":vn(e,"http://www.w3.org/1999/xlink","xlink:title",l);break;case"xlinkType":vn(e,"http://www.w3.org/1999/xlink","xlink:type",l);break;case"xmlBase":vn(e,"http://www.w3.org/XML/1998/namespace","xml:base",l);break;case"xmlLang":vn(e,"http://www.w3.org/XML/1998/namespace","xml:lang",l);break;case"xmlSpace":vn(e,"http://www.w3.org/XML/1998/namespace","xml:space",l);break;case"is":bs(e,"is",l);break;case"innerText":case"textContent":break;default:(!(2<a.length)||a[0]!=="o"&&a[0]!=="O"||a[1]!=="n"&&a[1]!=="N")&&(a=Cy.get(a)||a,bs(e,a,l))}}function Lu(e,t,a,l,c,d){switch(a){case"style":Mf(e,l,d);break;case"dangerouslySetInnerHTML":if(l!=null){if(typeof l!="object"||!("__html"in l))throw Error(i(61));if(a=l.__html,a!=null){if(c.children!=null)throw Error(i(60));e.innerHTML=a}}break;case"children":typeof l=="string"?ws(e,l):(typeof l=="number"||typeof l=="bigint")&&ws(e,""+l);break;case"onScroll":l!=null&&qe("scroll",e);break;case"onScrollEnd":l!=null&&qe("scrollend",e);break;case"onClick":l!=null&&(e.onclick=Po);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Pr.hasOwnProperty(a))e:{if(a[0]==="o"&&a[1]==="n"&&(c=a.endsWith("Capture"),t=a.slice(2,c?a.length-7:void 0),d=e[Bt]||null,d=d!=null?d[a]:null,typeof d=="function"&&e.removeEventListener(t,d,c),typeof l=="function")){typeof d!="function"&&d!==null&&(a in e?e[a]=null:e.hasAttribute(a)&&e.removeAttribute(a)),e.addEventListener(t,l,c);break e}a in e?e[a]=l:l===!0?e.setAttribute(a,""):bs(e,a,l)}}}function Ht(e,t,a){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":qe("error",e),qe("load",e);var l=!1,c=!1,d;for(d in a)if(a.hasOwnProperty(d)){var y=a[d];if(y!=null)switch(d){case"src":l=!0;break;case"srcSet":c=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,t));default:Ie(e,t,d,y,a,null)}}c&&Ie(e,t,"srcSet",a.srcSet,a,null),l&&Ie(e,t,"src",a.src,a,null);return;case"input":qe("invalid",e);var w=d=y=c=null,O=null,J=null;for(l in a)if(a.hasOwnProperty(l)){var ce=a[l];if(ce!=null)switch(l){case"name":c=ce;break;case"type":y=ce;break;case"checked":O=ce;break;case"defaultChecked":J=ce;break;case"value":d=ce;break;case"defaultValue":w=ce;break;case"children":case"dangerouslySetInnerHTML":if(ce!=null)throw Error(i(137,t));break;default:Ie(e,t,l,ce,a,null)}}kf(e,d,w,O,J,y,c,!1),so(e);return;case"select":qe("invalid",e),l=y=d=null;for(c in a)if(a.hasOwnProperty(c)&&(w=a[c],w!=null))switch(c){case"value":d=w;break;case"defaultValue":y=w;break;case"multiple":l=w;default:Ie(e,t,c,w,a,null)}t=d,a=y,e.multiple=!!l,t!=null?Ns(e,!!l,t,!1):a!=null&&Ns(e,!!l,a,!0);return;case"textarea":qe("invalid",e),d=c=l=null;for(y in a)if(a.hasOwnProperty(y)&&(w=a[y],w!=null))switch(y){case"value":l=w;break;case"defaultValue":c=w;break;case"children":d=w;break;case"dangerouslySetInnerHTML":if(w!=null)throw Error(i(91));break;default:Ie(e,t,y,w,a,null)}Cf(e,l,c,d),so(e);return;case"option":for(O in a)if(a.hasOwnProperty(O)&&(l=a[O],l!=null))switch(O){case"selected":e.selected=l&&typeof l!="function"&&typeof l!="symbol";break;default:Ie(e,t,O,l,a,null)}return;case"dialog":qe("beforetoggle",e),qe("toggle",e),qe("cancel",e),qe("close",e);break;case"iframe":case"object":qe("load",e);break;case"video":case"audio":for(l=0;l<cr.length;l++)qe(cr[l],e);break;case"image":qe("error",e),qe("load",e);break;case"details":qe("toggle",e);break;case"embed":case"source":case"link":qe("error",e),qe("load",e);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(J in a)if(a.hasOwnProperty(J)&&(l=a[J],l!=null))switch(J){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,t));default:Ie(e,t,J,l,a,null)}return;default:if(ac(t)){for(ce in a)a.hasOwnProperty(ce)&&(l=a[ce],l!==void 0&&Lu(e,t,ce,l,a,void 0));return}}for(w in a)a.hasOwnProperty(w)&&(l=a[w],l!=null&&Ie(e,t,w,l,a,null))}function P1(e,t,a,l){switch(t){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var c=null,d=null,y=null,w=null,O=null,J=null,ce=null;for(ne in a){var fe=a[ne];if(a.hasOwnProperty(ne)&&fe!=null)switch(ne){case"checked":break;case"value":break;case"defaultValue":O=fe;default:l.hasOwnProperty(ne)||Ie(e,t,ne,null,l,fe)}}for(var P in l){var ne=l[P];if(fe=a[P],l.hasOwnProperty(P)&&(ne!=null||fe!=null))switch(P){case"type":d=ne;break;case"name":c=ne;break;case"checked":J=ne;break;case"defaultChecked":ce=ne;break;case"value":y=ne;break;case"defaultValue":w=ne;break;case"children":case"dangerouslySetInnerHTML":if(ne!=null)throw Error(i(137,t));break;default:ne!==fe&&Ie(e,t,P,ne,l,fe)}}tc(e,y,w,O,J,ce,d,c);return;case"select":ne=y=w=P=null;for(d in a)if(O=a[d],a.hasOwnProperty(d)&&O!=null)switch(d){case"value":break;case"multiple":ne=O;default:l.hasOwnProperty(d)||Ie(e,t,d,null,l,O)}for(c in l)if(d=l[c],O=a[c],l.hasOwnProperty(c)&&(d!=null||O!=null))switch(c){case"value":P=d;break;case"defaultValue":w=d;break;case"multiple":y=d;default:d!==O&&Ie(e,t,c,d,l,O)}t=w,a=y,l=ne,P!=null?Ns(e,!!a,P,!1):!!l!=!!a&&(t!=null?Ns(e,!!a,t,!0):Ns(e,!!a,a?[]:"",!1));return;case"textarea":ne=P=null;for(w in a)if(c=a[w],a.hasOwnProperty(w)&&c!=null&&!l.hasOwnProperty(w))switch(w){case"value":break;case"children":break;default:Ie(e,t,w,null,l,c)}for(y in l)if(c=l[y],d=a[y],l.hasOwnProperty(y)&&(c!=null||d!=null))switch(y){case"value":P=c;break;case"defaultValue":ne=c;break;case"children":break;case"dangerouslySetInnerHTML":if(c!=null)throw Error(i(91));break;default:c!==d&&Ie(e,t,y,c,l,d)}_f(e,P,ne);return;case"option":for(var Me in a)if(P=a[Me],a.hasOwnProperty(Me)&&P!=null&&!l.hasOwnProperty(Me))switch(Me){case"selected":e.selected=!1;break;default:Ie(e,t,Me,null,l,P)}for(O in l)if(P=l[O],ne=a[O],l.hasOwnProperty(O)&&P!==ne&&(P!=null||ne!=null))switch(O){case"selected":e.selected=P&&typeof P!="function"&&typeof P!="symbol";break;default:Ie(e,t,O,P,l,ne)}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 _e in a)P=a[_e],a.hasOwnProperty(_e)&&P!=null&&!l.hasOwnProperty(_e)&&Ie(e,t,_e,null,l,P);for(J in l)if(P=l[J],ne=a[J],l.hasOwnProperty(J)&&P!==ne&&(P!=null||ne!=null))switch(J){case"children":case"dangerouslySetInnerHTML":if(P!=null)throw Error(i(137,t));break;default:Ie(e,t,J,P,l,ne)}return;default:if(ac(t)){for(var Fe in a)P=a[Fe],a.hasOwnProperty(Fe)&&P!==void 0&&!l.hasOwnProperty(Fe)&&Lu(e,t,Fe,void 0,l,P);for(ce in l)P=l[ce],ne=a[ce],!l.hasOwnProperty(ce)||P===ne||P===void 0&&ne===void 0||Lu(e,t,ce,P,l,ne);return}}for(var G in a)P=a[G],a.hasOwnProperty(G)&&P!=null&&!l.hasOwnProperty(G)&&Ie(e,t,G,null,l,P);for(fe in l)P=l[fe],ne=a[fe],!l.hasOwnProperty(fe)||P===ne||P==null&&ne==null||Ie(e,t,fe,P,l,ne)}var Yu=null,Vu=null;function ei(e){return e.nodeType===9?e:e.ownerDocument}function Tp(e){switch(e){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function Mp(e,t){if(e===0)switch(t){case"svg":return 1;case"math":return 2;default:return 0}return e===1&&t==="foreignObject"?0:e}function Gu(e,t){return e==="textarea"||e==="noscript"||typeof t.children=="string"||typeof t.children=="number"||typeof t.children=="bigint"||typeof t.dangerouslySetInnerHTML=="object"&&t.dangerouslySetInnerHTML!==null&&t.dangerouslySetInnerHTML.__html!=null}var Xu=null;function eb(){var e=window.event;return e&&e.type==="popstate"?e===Xu?!1:(Xu=e,!0):(Xu=null,!1)}var Ap=typeof setTimeout=="function"?setTimeout:void 0,tb=typeof clearTimeout=="function"?clearTimeout:void 0,Rp=typeof Promise=="function"?Promise:void 0,nb=typeof queueMicrotask=="function"?queueMicrotask:typeof Rp<"u"?function(e){return Rp.resolve(null).then(e).catch(ab)}:Ap;function ab(e){setTimeout(function(){throw e})}function Ca(e){return e==="head"}function zp(e,t){var a=t,l=0,c=0;do{var d=a.nextSibling;if(e.removeChild(a),d&&d.nodeType===8)if(a=d.data,a==="/$"){if(0<l&&8>l){a=l;var y=e.ownerDocument;if(a&1&&dr(y.documentElement),a&2&&dr(y.body),a&4)for(a=y.head,dr(a),y=a.firstChild;y;){var w=y.nextSibling,O=y.nodeName;y[Va]||O==="SCRIPT"||O==="STYLE"||O==="LINK"&&y.rel.toLowerCase()==="stylesheet"||a.removeChild(y),y=w}}if(c===0){e.removeChild(d),br(t);return}c--}else a==="$"||a==="$?"||a==="$!"?c++:l=a.charCodeAt(0)-48;else l=0;a=d}while(a);br(t)}function Zu(e){var t=e.firstChild;for(t&&t.nodeType===10&&(t=t.nextSibling);t;){var a=t;switch(t=t.nextSibling,a.nodeName){case"HTML":case"HEAD":case"BODY":Zu(a),kl(a);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(a.rel.toLowerCase()==="stylesheet")continue}e.removeChild(a)}}function sb(e,t,a,l){for(;e.nodeType===1;){var c=a;if(e.nodeName.toLowerCase()!==t.toLowerCase()){if(!l&&(e.nodeName!=="INPUT"||e.type!=="hidden"))break}else if(l){if(!e[Va])switch(t){case"meta":if(!e.hasAttribute("itemprop"))break;return e;case"link":if(d=e.getAttribute("rel"),d==="stylesheet"&&e.hasAttribute("data-precedence"))break;if(d!==c.rel||e.getAttribute("href")!==(c.href==null||c.href===""?null:c.href)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin)||e.getAttribute("title")!==(c.title==null?null:c.title))break;return e;case"style":if(e.hasAttribute("data-precedence"))break;return e;case"script":if(d=e.getAttribute("src"),(d!==(c.src==null?null:c.src)||e.getAttribute("type")!==(c.type==null?null:c.type)||e.getAttribute("crossorigin")!==(c.crossOrigin==null?null:c.crossOrigin))&&d&&e.hasAttribute("async")&&!e.hasAttribute("itemprop"))break;return e;default:return e}}else if(t==="input"&&e.type==="hidden"){var d=c.name==null?null:""+c.name;if(c.type==="hidden"&&e.getAttribute("name")===d)return e}else return e;if(e=wn(e.nextSibling),e===null)break}return null}function lb(e,t,a){if(t==="")return null;for(;e.nodeType!==3;)if((e.nodeType!==1||e.nodeName!=="INPUT"||e.type!=="hidden")&&!a||(e=wn(e.nextSibling),e===null))return null;return e}function Wu(e){return e.data==="$!"||e.data==="$?"&&e.ownerDocument.readyState==="complete"}function rb(e,t){var a=e.ownerDocument;if(e.data!=="$?"||a.readyState==="complete")t();else{var l=function(){t(),a.removeEventListener("DOMContentLoaded",l)};a.addEventListener("DOMContentLoaded",l),e._reactRetry=l}}function wn(e){for(;e!=null;e=e.nextSibling){var t=e.nodeType;if(t===1||t===3)break;if(t===8){if(t=e.data,t==="$"||t==="$!"||t==="$?"||t==="F!"||t==="F")break;if(t==="/$")return null}}return e}var Qu=null;function Op(e){e=e.previousSibling;for(var t=0;e;){if(e.nodeType===8){var a=e.data;if(a==="$"||a==="$!"||a==="$?"){if(t===0)return e;t--}else a==="/$"&&t++}e=e.previousSibling}return null}function Dp(e,t,a){switch(t=ei(a),e){case"html":if(e=t.documentElement,!e)throw Error(i(452));return e;case"head":if(e=t.head,!e)throw Error(i(453));return e;case"body":if(e=t.body,!e)throw Error(i(454));return e;default:throw Error(i(451))}}function dr(e){for(var t=e.attributes;t.length;)e.removeAttributeNode(t[0]);kl(e)}var gn=new Map,Hp=new Set;function ti(e){return typeof e.getRootNode=="function"?e.getRootNode():e.nodeType===9?e:e.ownerDocument}var In=$.d;$.d={f:ob,r:ib,D:cb,C:ub,L:db,m:fb,X:mb,S:hb,M:pb};function ob(){var e=In.f(),t=Zo();return e||t}function ib(e){var t=ia(e);t!==null&&t.tag===5&&t.type==="form"?nm(t):In.r(e)}var Fs=typeof document>"u"?null:document;function $p(e,t,a){var l=Fs;if(l&&typeof t=="string"&&t){var c=un(t);c='link[rel="'+e+'"][href="'+c+'"]',typeof a=="string"&&(c+='[crossorigin="'+a+'"]'),Hp.has(c)||(Hp.add(c),e={rel:e,crossOrigin:a,href:t},l.querySelector(c)===null&&(t=l.createElement("link"),Ht(t,"link",e),gt(t),l.head.appendChild(t)))}}function cb(e){In.D(e),$p("dns-prefetch",e,null)}function ub(e,t){In.C(e,t),$p("preconnect",e,t)}function db(e,t,a){In.L(e,t,a);var l=Fs;if(l&&e&&t){var c='link[rel="preload"][as="'+un(t)+'"]';t==="image"&&a&&a.imageSrcSet?(c+='[imagesrcset="'+un(a.imageSrcSet)+'"]',typeof a.imageSizes=="string"&&(c+='[imagesizes="'+un(a.imageSizes)+'"]')):c+='[href="'+un(e)+'"]';var d=c;switch(t){case"style":d=Ps(e);break;case"script":d=el(e)}gn.has(d)||(e=p({rel:"preload",href:t==="image"&&a&&a.imageSrcSet?void 0:e,as:t},a),gn.set(d,e),l.querySelector(c)!==null||t==="style"&&l.querySelector(fr(d))||t==="script"&&l.querySelector(hr(d))||(t=l.createElement("link"),Ht(t,"link",e),gt(t),l.head.appendChild(t)))}}function fb(e,t){In.m(e,t);var a=Fs;if(a&&e){var l=t&&typeof t.as=="string"?t.as:"script",c='link[rel="modulepreload"][as="'+un(l)+'"][href="'+un(e)+'"]',d=c;switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":d=el(e)}if(!gn.has(d)&&(e=p({rel:"modulepreload",href:e},t),gn.set(d,e),a.querySelector(c)===null)){switch(l){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(a.querySelector(hr(d)))return}l=a.createElement("link"),Ht(l,"link",e),gt(l),a.head.appendChild(l)}}}function hb(e,t,a){In.S(e,t,a);var l=Fs;if(l&&e){var c=ca(l).hoistableStyles,d=Ps(e);t=t||"default";var y=c.get(d);if(!y){var w={loading:0,preload:null};if(y=l.querySelector(fr(d)))w.loading=5;else{e=p({rel:"stylesheet",href:e,"data-precedence":t},a),(a=gn.get(d))&&Ku(e,a);var O=y=l.createElement("link");gt(O),Ht(O,"link",e),O._p=new Promise(function(J,ce){O.onload=J,O.onerror=ce}),O.addEventListener("load",function(){w.loading|=1}),O.addEventListener("error",function(){w.loading|=2}),w.loading|=4,ni(y,t,l)}y={type:"stylesheet",instance:y,count:1,state:w},c.set(d,y)}}}function mb(e,t){In.X(e,t);var a=Fs;if(a&&e){var l=ca(a).hoistableScripts,c=el(e),d=l.get(c);d||(d=a.querySelector(hr(c)),d||(e=p({src:e,async:!0},t),(t=gn.get(c))&&Ju(e,t),d=a.createElement("script"),gt(d),Ht(d,"link",e),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(c,d))}}function pb(e,t){In.M(e,t);var a=Fs;if(a&&e){var l=ca(a).hoistableScripts,c=el(e),d=l.get(c);d||(d=a.querySelector(hr(c)),d||(e=p({src:e,async:!0,type:"module"},t),(t=gn.get(c))&&Ju(e,t),d=a.createElement("script"),gt(d),Ht(d,"link",e),a.head.appendChild(d)),d={type:"script",instance:d,count:1,state:null},l.set(c,d))}}function Up(e,t,a,l){var c=(c=me.current)?ti(c):null;if(!c)throw Error(i(446));switch(e){case"meta":case"title":return null;case"style":return typeof a.precedence=="string"&&typeof a.href=="string"?(t=Ps(a.href),a=ca(c).hoistableStyles,l=a.get(t),l||(l={type:"style",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};case"link":if(a.rel==="stylesheet"&&typeof a.href=="string"&&typeof a.precedence=="string"){e=Ps(a.href);var d=ca(c).hoistableStyles,y=d.get(e);if(y||(c=c.ownerDocument||c,y={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},d.set(e,y),(d=c.querySelector(fr(e)))&&!d._p&&(y.instance=d,y.state.loading=5),gn.has(e)||(a={rel:"preload",as:"style",href:a.href,crossOrigin:a.crossOrigin,integrity:a.integrity,media:a.media,hrefLang:a.hrefLang,referrerPolicy:a.referrerPolicy},gn.set(e,a),d||xb(c,e,a,y.state))),t&&l===null)throw Error(i(528,""));return y}if(t&&l!==null)throw Error(i(529,""));return null;case"script":return t=a.async,a=a.src,typeof a=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=el(a),a=ca(c).hoistableScripts,l=a.get(t),l||(l={type:"script",instance:null,count:0,state:null},a.set(t,l)),l):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,e))}}function Ps(e){return'href="'+un(e)+'"'}function fr(e){return'link[rel="stylesheet"]['+e+"]"}function Bp(e){return p({},e,{"data-precedence":e.precedence,precedence:null})}function xb(e,t,a,l){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?l.loading=1:(t=e.createElement("link"),l.preload=t,t.addEventListener("load",function(){return l.loading|=1}),t.addEventListener("error",function(){return l.loading|=2}),Ht(t,"link",a),gt(t),e.head.appendChild(t))}function el(e){return'[src="'+un(e)+'"]'}function hr(e){return"script[async]"+e}function qp(e,t,a){if(t.count++,t.instance===null)switch(t.type){case"style":var l=e.querySelector('style[data-href~="'+un(a.href)+'"]');if(l)return t.instance=l,gt(l),l;var c=p({},a,{"data-href":a.href,"data-precedence":a.precedence,href:null,precedence:null});return l=(e.ownerDocument||e).createElement("style"),gt(l),Ht(l,"style",c),ni(l,a.precedence,e),t.instance=l;case"stylesheet":c=Ps(a.href);var d=e.querySelector(fr(c));if(d)return t.state.loading|=4,t.instance=d,gt(d),d;l=Bp(a),(c=gn.get(c))&&Ku(l,c),d=(e.ownerDocument||e).createElement("link"),gt(d);var y=d;return y._p=new Promise(function(w,O){y.onload=w,y.onerror=O}),Ht(d,"link",l),t.state.loading|=4,ni(d,a.precedence,e),t.instance=d;case"script":return d=el(a.src),(c=e.querySelector(hr(d)))?(t.instance=c,gt(c),c):(l=a,(c=gn.get(d))&&(l=p({},a),Ju(l,c)),e=e.ownerDocument||e,c=e.createElement("script"),gt(c),Ht(c,"link",l),e.head.appendChild(c),t.instance=c);case"void":return null;default:throw Error(i(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(l=t.instance,t.state.loading|=4,ni(l,a.precedence,e));return t.instance}function ni(e,t,a){for(var l=a.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),c=l.length?l[l.length-1]:null,d=c,y=0;y<l.length;y++){var w=l[y];if(w.dataset.precedence===t)d=w;else if(d!==c)break}d?d.parentNode.insertBefore(e,d.nextSibling):(t=a.nodeType===9?a.head:a,t.insertBefore(e,t.firstChild))}function Ku(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.title==null&&(e.title=t.title)}function Ju(e,t){e.crossOrigin==null&&(e.crossOrigin=t.crossOrigin),e.referrerPolicy==null&&(e.referrerPolicy=t.referrerPolicy),e.integrity==null&&(e.integrity=t.integrity)}var ai=null;function Lp(e,t,a){if(ai===null){var l=new Map,c=ai=new Map;c.set(a,l)}else c=ai,l=c.get(a),l||(l=new Map,c.set(a,l));if(l.has(e))return l;for(l.set(e,null),a=a.getElementsByTagName(e),c=0;c<a.length;c++){var d=a[c];if(!(d[Va]||d[St]||e==="link"&&d.getAttribute("rel")==="stylesheet")&&d.namespaceURI!=="http://www.w3.org/2000/svg"){var y=d.getAttribute(t)||"";y=e+y;var w=l.get(y);w?w.push(d):l.set(y,[d])}}return l}function Yp(e,t,a){e=e.ownerDocument||e,e.head.insertBefore(a,t==="title"?e.querySelector("head > title"):null)}function gb(e,t,a){if(a===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function Vp(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}var mr=null;function yb(){}function bb(e,t,a){if(mr===null)throw Error(i(475));var l=mr;if(t.type==="stylesheet"&&(typeof a.media!="string"||matchMedia(a.media).matches!==!1)&&(t.state.loading&4)===0){if(t.instance===null){var c=Ps(a.href),d=e.querySelector(fr(c));if(d){e=d._p,e!==null&&typeof e=="object"&&typeof e.then=="function"&&(l.count++,l=si.bind(l),e.then(l,l)),t.state.loading|=4,t.instance=d,gt(d);return}d=e.ownerDocument||e,a=Bp(a),(c=gn.get(c))&&Ku(a,c),d=d.createElement("link"),gt(d);var y=d;y._p=new Promise(function(w,O){y.onload=w,y.onerror=O}),Ht(d,"link",a),t.instance=d}l.stylesheets===null&&(l.stylesheets=new Map),l.stylesheets.set(t,e),(e=t.state.preload)&&(t.state.loading&3)===0&&(l.count++,t=si.bind(l),e.addEventListener("load",t),e.addEventListener("error",t))}}function vb(){if(mr===null)throw Error(i(475));var e=mr;return e.stylesheets&&e.count===0&&Iu(e,e.stylesheets),0<e.count?function(t){var a=setTimeout(function(){if(e.stylesheets&&Iu(e,e.stylesheets),e.unsuspend){var l=e.unsuspend;e.unsuspend=null,l()}},6e4);return e.unsuspend=t,function(){e.unsuspend=null,clearTimeout(a)}}:null}function si(){if(this.count--,this.count===0){if(this.stylesheets)Iu(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var li=null;function Iu(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,li=new Map,t.forEach(jb,e),li=null,si.call(e))}function jb(e,t){if(!(t.state.loading&4)){var a=li.get(e);if(a)var l=a.get(null);else{a=new Map,li.set(e,a);for(var c=e.querySelectorAll("link[data-precedence],style[data-precedence]"),d=0;d<c.length;d++){var y=c[d];(y.nodeName==="LINK"||y.getAttribute("media")!=="not all")&&(a.set(y.dataset.precedence,y),l=y)}l&&a.set(null,l)}c=t.instance,y=c.getAttribute("data-precedence"),d=a.get(y)||l,d===l&&a.set(null,c),a.set(y,c),this.count++,l=si.bind(this),c.addEventListener("load",l),c.addEventListener("error",l),d?d.parentNode.insertBefore(c,d.nextSibling):(e=e.nodeType===9?e.head:e,e.insertBefore(c,e.firstChild)),t.state.loading|=4}}var pr={$$typeof:q,Provider:null,Consumer:null,_currentValue:T,_currentValue2:T,_threadCount:0};function Nb(e,t,a,l,c,d,y,w){this.tag=1,this.containerInfo=e,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=Ya(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Ya(0),this.hiddenUpdates=Ya(null),this.identifierPrefix=l,this.onUncaughtError=c,this.onCaughtError=d,this.onRecoverableError=y,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=w,this.incompleteTransitions=new Map}function Gp(e,t,a,l,c,d,y,w,O,J,ce,fe){return e=new Nb(e,t,a,y,w,O,J,fe),t=1,d===!0&&(t|=24),d=Pt(3,null,null,t),e.current=d,d.stateNode=e,t=Rc(),t.refCount++,e.pooledCache=t,t.refCount++,d.memoizedState={element:l,isDehydrated:a,cache:t},Hc(d),e}function Xp(e){return e?(e=As,e):As}function Zp(e,t,a,l,c,d){c=Xp(c),l.context===null?l.context=c:l.pendingContext=c,l=pa(t),l.payload={element:a},d=d===void 0?null:d,d!==null&&(l.callback=d),a=xa(e,l,t),a!==null&&(sn(a,e,t),Xl(a,e,t))}function Wp(e,t){if(e=e.memoizedState,e!==null&&e.dehydrated!==null){var a=e.retryLane;e.retryLane=a!==0&&a<t?a:t}}function Fu(e,t){Wp(e,t),(e=e.alternate)&&Wp(e,t)}function Qp(e){if(e.tag===13){var t=Ms(e,67108864);t!==null&&sn(t,e,67108864),Fu(e,67108864)}}var ri=!0;function wb(e,t,a,l){var c=E.T;E.T=null;var d=$.p;try{$.p=2,Pu(e,t,a,l)}finally{$.p=d,E.T=c}}function Sb(e,t,a,l){var c=E.T;E.T=null;var d=$.p;try{$.p=8,Pu(e,t,a,l)}finally{$.p=d,E.T=c}}function Pu(e,t,a,l){if(ri){var c=ed(l);if(c===null)qu(e,t,l,oi,a),Jp(e,l);else if(kb(c,e,t,a,l))l.stopPropagation();else if(Jp(e,l),t&4&&-1<Eb.indexOf(e)){for(;c!==null;){var d=ia(c);if(d!==null)switch(d.tag){case 3:if(d=d.stateNode,d.current.memoizedState.isDehydrated){var y=zt(d.pendingLanes);if(y!==0){var w=d;for(w.pendingLanes|=2,w.entangledLanes|=2;y;){var O=1<<31-at(y);w.entanglements[1]|=O,y&=~O}Rn(d),(Qe&6)===0&&(Go=re()+500,ir(0))}}break;case 13:w=Ms(d,2),w!==null&&sn(w,d,2),Zo(),Fu(d,2)}if(d=ed(l),d===null&&qu(e,t,l,oi,a),d===c)break;c=d}c!==null&&l.stopPropagation()}else qu(e,t,l,null,a)}}function ed(e){return e=lc(e),td(e)}var oi=null;function td(e){if(oi=null,e=Hn(e),e!==null){var t=f(e);if(t===null)e=null;else{var a=t.tag;if(a===13){if(e=h(t),e!==null)return e;e=null}else if(a===3){if(t.stateNode.current.memoizedState.isDehydrated)return t.tag===3?t.stateNode.containerInfo:null;e=null}else t!==e&&(e=null)}}return oi=e,null}function Kp(e){switch(e){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(ee()){case Ee:return 2;case ge:return 8;case ke:case Oe:return 32;case ze:return 268435456;default:return 32}default:return 32}}var nd=!1,Ta=null,Ma=null,Aa=null,xr=new Map,gr=new Map,Ra=[],Eb="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 Jp(e,t){switch(e){case"focusin":case"focusout":Ta=null;break;case"dragenter":case"dragleave":Ma=null;break;case"mouseover":case"mouseout":Aa=null;break;case"pointerover":case"pointerout":xr.delete(t.pointerId);break;case"gotpointercapture":case"lostpointercapture":gr.delete(t.pointerId)}}function yr(e,t,a,l,c,d){return e===null||e.nativeEvent!==d?(e={blockedOn:t,domEventName:a,eventSystemFlags:l,nativeEvent:d,targetContainers:[c]},t!==null&&(t=ia(t),t!==null&&Qp(t)),e):(e.eventSystemFlags|=l,t=e.targetContainers,c!==null&&t.indexOf(c)===-1&&t.push(c),e)}function kb(e,t,a,l,c){switch(t){case"focusin":return Ta=yr(Ta,e,t,a,l,c),!0;case"dragenter":return Ma=yr(Ma,e,t,a,l,c),!0;case"mouseover":return Aa=yr(Aa,e,t,a,l,c),!0;case"pointerover":var d=c.pointerId;return xr.set(d,yr(xr.get(d)||null,e,t,a,l,c)),!0;case"gotpointercapture":return d=c.pointerId,gr.set(d,yr(gr.get(d)||null,e,t,a,l,c)),!0}return!1}function Ip(e){var t=Hn(e.target);if(t!==null){var a=f(t);if(a!==null){if(t=a.tag,t===13){if(t=h(a),t!==null){e.blockedOn=t,Ii(e.priority,function(){if(a.tag===13){var l=an();l=wl(l);var c=Ms(a,l);c!==null&&sn(c,a,l),Fu(a,l)}});return}}else if(t===3&&a.stateNode.current.memoizedState.isDehydrated){e.blockedOn=a.tag===3?a.stateNode.containerInfo:null;return}}}e.blockedOn=null}function ii(e){if(e.blockedOn!==null)return!1;for(var t=e.targetContainers;0<t.length;){var a=ed(e.nativeEvent);if(a===null){a=e.nativeEvent;var l=new a.constructor(a.type,a);sc=l,a.target.dispatchEvent(l),sc=null}else return t=ia(a),t!==null&&Qp(t),e.blockedOn=a,!1;t.shift()}return!0}function Fp(e,t,a){ii(e)&&a.delete(t)}function _b(){nd=!1,Ta!==null&&ii(Ta)&&(Ta=null),Ma!==null&&ii(Ma)&&(Ma=null),Aa!==null&&ii(Aa)&&(Aa=null),xr.forEach(Fp),gr.forEach(Fp)}function ci(e,t){e.blockedOn===t&&(e.blockedOn=null,nd||(nd=!0,n.unstable_scheduleCallback(n.unstable_NormalPriority,_b)))}var ui=null;function Pp(e){ui!==e&&(ui=e,n.unstable_scheduleCallback(n.unstable_NormalPriority,function(){ui===e&&(ui=null);for(var t=0;t<e.length;t+=3){var a=e[t],l=e[t+1],c=e[t+2];if(typeof l!="function"){if(td(l||a)===null)continue;break}var d=ia(a);d!==null&&(e.splice(t,3),t-=3,tu(d,{pending:!0,data:c,method:a.method,action:l},l,c))}}))}function br(e){function t(O){return ci(O,e)}Ta!==null&&ci(Ta,e),Ma!==null&&ci(Ma,e),Aa!==null&&ci(Aa,e),xr.forEach(t),gr.forEach(t);for(var a=0;a<Ra.length;a++){var l=Ra[a];l.blockedOn===e&&(l.blockedOn=null)}for(;0<Ra.length&&(a=Ra[0],a.blockedOn===null);)Ip(a),a.blockedOn===null&&Ra.shift();if(a=(e.ownerDocument||e).$$reactFormReplay,a!=null)for(l=0;l<a.length;l+=3){var c=a[l],d=a[l+1],y=c[Bt]||null;if(typeof d=="function")y||Pp(a);else if(y){var w=null;if(d&&d.hasAttribute("formAction")){if(c=d,y=d[Bt]||null)w=y.formAction;else if(td(c)!==null)continue}else w=y.action;typeof w=="function"?a[l+1]=w:(a.splice(l,3),l-=3),Pp(a)}}}function ad(e){this._internalRoot=e}di.prototype.render=ad.prototype.render=function(e){var t=this._internalRoot;if(t===null)throw Error(i(409));var a=t.current,l=an();Zp(a,l,e,t,null,null)},di.prototype.unmount=ad.prototype.unmount=function(){var e=this._internalRoot;if(e!==null){this._internalRoot=null;var t=e.containerInfo;Zp(e.current,2,null,e,null,null),Zo(),t[oa]=null}};function di(e){this._internalRoot=e}di.prototype.unstable_scheduleHydration=function(e){if(e){var t=Jr();e={blockedOn:null,target:e,priority:t};for(var a=0;a<Ra.length&&t!==0&&t<Ra[a].priority;a++);Ra.splice(a,0,e),a===0&&Ip(e)}};var ex=r.version;if(ex!=="19.1.1")throw Error(i(527,ex,"19.1.1"));$.findDOMNode=function(e){var t=e._reactInternals;if(t===void 0)throw typeof e.render=="function"?Error(i(188)):(e=Object.keys(e).join(","),Error(i(268,e)));return e=x(t),e=e!==null?m(e):null,e=e===null?null:e.stateNode,e};var Cb={bundleType:0,version:"19.1.1",rendererPackageName:"react-dom",currentDispatcherRef:E,reconcilerVersion:"19.1.1"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var fi=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!fi.isDisabled&&fi.supportsFiber)try{ft=fi.inject(Cb),nt=fi}catch{}}return jr.createRoot=function(e,t){if(!u(e))throw Error(i(299));var a=!1,l="",c=xm,d=gm,y=ym,w=null;return t!=null&&(t.unstable_strictMode===!0&&(a=!0),t.identifierPrefix!==void 0&&(l=t.identifierPrefix),t.onUncaughtError!==void 0&&(c=t.onUncaughtError),t.onCaughtError!==void 0&&(d=t.onCaughtError),t.onRecoverableError!==void 0&&(y=t.onRecoverableError),t.unstable_transitionCallbacks!==void 0&&(w=t.unstable_transitionCallbacks)),t=Gp(e,1,!1,null,null,a,l,c,d,y,w,null),e[oa]=t.current,Bu(e),new ad(t)},jr.hydrateRoot=function(e,t,a){if(!u(e))throw Error(i(299));var l=!1,c="",d=xm,y=gm,w=ym,O=null,J=null;return a!=null&&(a.unstable_strictMode===!0&&(l=!0),a.identifierPrefix!==void 0&&(c=a.identifierPrefix),a.onUncaughtError!==void 0&&(d=a.onUncaughtError),a.onCaughtError!==void 0&&(y=a.onCaughtError),a.onRecoverableError!==void 0&&(w=a.onRecoverableError),a.unstable_transitionCallbacks!==void 0&&(O=a.unstable_transitionCallbacks),a.formState!==void 0&&(J=a.formState)),t=Gp(e,1,!0,t,a??null,l,c,d,y,w,O,J),t.context=Xp(null),a=t.current,l=an(),l=wl(l),c=pa(l),c.callback=null,xa(a,c,l),a=l,t.current.lanes=a,ra(t,a),Rn(t),e[oa]=t.current,Bu(e),new di(t)},jr.version="19.1.1",jr}var ux;function $b(){if(ux)return rd.exports;ux=1;function n(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(r){console.error(r)}}return n(),rd.exports=Hb(),rd.exports}var Ub=$b();/**
50
50
  * @license lucide-react v1.33.0 - ISC
51
51
  *
52
52
  * This source code is licensed under the ISC license.
@@ -126,7 +126,7 @@ Error generating stack: `+a.message+`
126
126
  *
127
127
  * This source code is licensed under the ISC license.
128
128
  * See the LICENSE file in the root directory of this source tree.
129
- */const Pb=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],_t=Ne("circle-alert",Pb);/**
129
+ */const Pb=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Ct=Ne("circle-alert",Pb);/**
130
130
  * @license lucide-react v1.33.0 - ISC
131
131
  *
132
132
  * This source code is licensed under the ISC license.
@@ -281,7 +281,7 @@ Error generating stack: `+a.message+`
281
281
  *
282
282
  * This source code is licensed under the ISC license.
283
283
  * See the LICENSE file in the root directory of this source tree.
284
- */const Lv=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],Ht=Ne("plus",Lv);/**
284
+ */const Lv=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],$t=Ne("plus",Lv);/**
285
285
  * @license lucide-react v1.33.0 - ISC
286
286
  *
287
287
  * This source code is licensed under the ISC license.
@@ -366,12 +366,12 @@ Error generating stack: `+a.message+`
366
366
  *
367
367
  * This source code is licensed under the ISC license.
368
368
  * See the LICENSE file in the root directory of this source tree.
369
- */const d2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ct=Ne("x",d2);/**
369
+ */const d2=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Tt=Ne("x",d2);/**
370
370
  * @license lucide-react v1.33.0 - ISC
371
371
  *
372
372
  * This source code is licensed under the ISC license.
373
373
  * See the LICENSE file in the root directory of this source tree.
374
- */const f2=[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]],hs=Ne("zap",f2),D0=j.createContext({theme:"dark",toggleTheme:()=>{}});function h2({children:n}){const[r,o]=j.useState(()=>localStorage.getItem("jetic_theme")==="light"?"light":"dark");j.useEffect(()=>{const u=document.documentElement;r==="light"?(u.classList.add("light"),u.classList.remove("dark")):(u.classList.add("dark"),u.classList.remove("light")),localStorage.setItem("jetic_theme",r);const f=document.getElementById("app-favicon");f&&(f.href=r==="light"?"/brand/jetic-black.svg":"/brand/jetic.svg")},[r]);const i=()=>o(u=>u==="dark"?"light":"dark");return s.jsx(D0.Provider,{value:{theme:r,toggleTheme:i},children:n})}function H0(){return j.useContext(D0)}function m2({size:n=20,className:r}){return s.jsx("svg",{width:n,height:n*1.5,viewBox:"0 0 14 21",fill:"currentColor",className:r,"aria-label":"Jetic",children:s.jsx("path",{d:"M0 0h14v14l-7 7H0v-7h7V7H0V0Z"})})}const p2=[{label:"WORKFLOW",items:[{id:"overview",label:"Overview",icon:Cv},{id:"model",label:"Model",icon:A0},{id:"simulations",label:"Simulations",icon:ea},{id:"inspect",label:"Inspect",icon:e2}]},{label:"AGENT",items:[{id:"memory",label:"Memory & Environment",icon:fl}]},{label:"OBSERVABILITY",items:[{id:"traces",label:"Traces",icon:Vr},{id:"changes",label:"Files changes",icon:T0}]}],x2=[],$0="relative flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[13.5px] font-medium transition-colors hover:cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--focus-ring)]",U0="theme-bg-brand text-[color:var(--brand-foreground)] shadow-sm",B0="theme-text hover:theme-bg-overlay-md hover:theme-text-primary";function hx({icon:n,label:r,active:o=!1,onClick:i}){return s.jsxs("button",{type:"button",onClick:i,"aria-current":o?"page":void 0,className:`${$0} ${o?U0:B0}`,children:[s.jsx(n,{className:"h-[15px] w-[15px] shrink-0",strokeWidth:2}),s.jsx("span",{children:r})]})}function g2({currentPage:n,onNavigate:r,onToggleAssistant:o,isAssistantOpen:i}){const{theme:u,toggleTheme:f}=H0();return s.jsxs("div",{className:"flex w-60 shrink-0 flex-col select-none transition-colors duration-300 border-r theme-border theme-sidebar",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 pb-6 pt-5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(m2,{size:12,className:"theme-text-primary"}),s.jsxs("span",{className:"text-[15px] font-semibold tracking-wide theme-text-primary",children:["Jetic",s.jsx("span",{className:"ml-1 theme-text-brand",children:"Studio"})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border theme-border theme-bg-overlay px-2 py-0.5 text-[11px] font-medium theme-text-muted",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full theme-bg-brand"}),"v0.2.6"]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto px-3",children:s.jsx("div",{className:"flex flex-col gap-6",children:p2.map(h=>s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"px-3 pb-1 text-[11px] font-semibold uppercase tracking-wider theme-text-muted",children:h.label}),s.jsx("div",{className:"flex flex-col gap-0.5",children:h.items.map(g=>s.jsx(hx,{icon:g.icon,label:g.label,active:n===g.id,onClick:()=>r(g.id)},g.id))})]},h.label))})}),s.jsx("div",{className:"mx-3 my-3 hidden border-t theme-border"}),s.jsx("div",{className:"flex flex-col gap-0.5 px-3",children:s.jsxs("button",{type:"button",onClick:o,"aria-pressed":i,className:`hidden ${$0} ${i?U0:B0}`,children:[s.jsx(Fv,{className:"h-[15px] w-[15px] shrink-0",strokeWidth:2}),s.jsx("span",{children:"Jetic Assistant"})]})}),s.jsx("div",{className:"mx-3 my-3 hidden border-t theme-border"}),s.jsx("div",{className:"flex flex-col gap-0.5 px-3",children:x2.map(h=>s.jsx(hx,{icon:h.icon,label:h.label,active:n===h.id,onClick:()=>r(h.id)},h.id))}),s.jsx("div",{className:"px-3 pb-4 pt-3",children:s.jsxs("div",{className:"flex items-center gap-1 rounded-xl p-1 border theme-border theme-bg-overlay",children:[s.jsxs("button",{type:"button",onClick:()=>u!=="dark"&&f(),title:"Dark mode","aria-pressed":u==="dark",className:`flex flex-1 items-center justify-center gap-1.5 rounded-lg py-1.5 text-[11px] font-medium transition-colors hover:cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--focus-ring)] ${u==="dark"?"theme-bg-brand text-[color:var(--brand-foreground)] shadow-sm":"theme-text-muted hover:theme-text"}`,children:[s.jsx(Ov,{className:"h-3 w-3 shrink-0",strokeWidth:2}),"Dark"]}),s.jsxs("button",{type:"button",onClick:()=>u!=="light"&&f(),title:"Light mode","aria-pressed":u==="light",className:`flex flex-1 items-center justify-center gap-1.5 rounded-lg py-1.5 text-[11px] font-medium transition-colors hover:cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--focus-ring)] ${u==="light"?"theme-bg-brand text-[color:var(--brand-foreground)] shadow-sm":"theme-text-muted hover:theme-text"}`,children:[s.jsx(s2,{className:"h-3 w-3 shrink-0",strokeWidth:2}),"Light"]})]})})]})}function y2({isOpen:n,onClose:r}){return n?s.jsxs("div",{className:"absolute inset-y-0 right-0 w-[400px] border-l theme-border theme-bg-elevated shadow-2xl flex flex-col z-50",children:[s.jsxs("div",{className:"flex h-14 items-center justify-between border-b theme-border px-5",children:[s.jsx("div",{className:"flex items-center gap-2 text-emerald-400",children:s.jsx("span",{className:"text-[14px] font-medium",children:"Jetic AI"})}),s.jsx("button",{onClick:r,className:"theme-text-muted hover:theme-text hover:bg-white/5 p-2 rounded-full",children:s.jsx(Ct,{className:"",size:13})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:s.jsxs("div",{className:"flex flex-col items-center pt-8 pb-4",children:[s.jsx("div",{className:"mb-4 flex h-10 w-10 items-center justify-center rounded-full theme-bg-overlay-md text-[13px] font-medium theme-text-primary",children:"J"}),s.jsx("h2",{className:"text-[17px] font-semibold theme-text-primary text-center",children:"How can I help you test your APIs?"}),s.jsx("p",{className:"theme-text-muted text-[13px] mt-2 text-center",children:"Ask me to generate simulations, debug traces, or explain API behavior."})]})}),s.jsx("div",{className:"p-4 border-t theme-border theme-bg-surface",children:s.jsxs("div",{className:"rounded border border-emerald-600/60 theme-bg-overlay focus-within:border-emerald-500 transition-colors",children:[s.jsx("textarea",{rows:2,placeholder:"E.g. Test password reset flow...",className:"w-full resize-none bg-transparent px-4 pb-2 pt-3.5 text-[13.5px] theme-text-primary placeholder:theme-text-muted focus:outline-none"}),s.jsxs("div",{className:"flex items-center justify-between px-3 pb-3 pt-1",children:[s.jsx("div",{className:"flex gap-2",children:s.jsx("span",{className:"text-[11px] theme-text-muted font-mono theme-bg-overlay-md px-2 py-0.5 rounded",children:"gpt-4o"})}),s.jsx("button",{className:"text-[12px] font-medium text-emerald-400 hover:text-emerald-300",children:"Send"})]})]})})]}):null}const mx="Check recent file changes (jetic_get_changes). Re-analyse ONLY those modified files to update .jetic/model.json instead of reading the entire codebase";function b2({onNavigateToChanges:n}){const[r,o]=j.useState(null),[i,u]=j.useState(!1),[f,h]=j.useState(!1),g=j.useCallback(async()=>{try{const p=await fetch("/api/changes");if(!p.ok)return;const b=await p.json();o(b)}catch{}},[]);j.useEffect(()=>{g();let p=null,b=null;try{p=new EventSource("/api/changes/stream"),p.onmessage=v=>{try{o(JSON.parse(v.data))}catch{}},p.onerror=()=>{b||(b=setInterval(g,3e3))}}catch{b=setInterval(g,3e3)}return()=>{p?.close(),b&&clearInterval(b)}},[g]);const x=r?.changes?.length??0;j.useEffect(()=>{x===0&&u(!1)},[x]);const m=p=>{p.stopPropagation(),navigator.clipboard.writeText(mx),h(!0),setTimeout(()=>h(!1),2e3)};return x===0||i?null:s.jsxs("div",{className:"fixed bottom-6 right-6 z-[100] w-[420px] max-w-[calc(100vw-3rem)] rounded-xl border border-amber-500/35 p-4 shadow-2xl transition-all duration-300 animate-in slide-in-from-bottom-5 theme-sidebar theme-text-primary",style:{boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.4), 0 0 15px rgba(245, 158, 11, 0.1)"},children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-amber-500/15 text-amber-400 border border-amber-500/25",children:s.jsx(i2,{className:"h-4 w-4",strokeWidth:2})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-[13px] font-semibold tracking-tight theme-text-primary",children:"Model is not currently in sync with codebase"}),s.jsxs("p",{className:"text-[11px] theme-text-muted",children:["Detected ",s.jsxs("span",{className:"font-medium text-amber-400",children:[x," change",x>1?"s":""]})," in your codebase."]})]})]}),s.jsx("button",{type:"button",onClick:()=>u(!0),title:"Cancel",className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-lg transition-colors theme-text-muted hover:theme-bg-overlay-md hover:cursor-pointer",children:s.jsx(Ct,{className:"h-3.5 w-3.5",strokeWidth:2})})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:[r?.changes.slice(0,3).map(p=>{const b=p.filePath.split("/").pop()??p.filePath;return s.jsx("span",{onClick:()=>n?.(),className:"truncate max-w-[130px] rounded px-2 py-0.5 font-mono text-[10.5px] hover:border-amber-500/50 hover:cursor-pointer transition-colors theme-bg-overlay border theme-border theme-text-muted",title:p.filePath,children:b},p.filePath)}),x>3&&s.jsxs("span",{onClick:()=>n?.(),className:"rounded px-1.5 py-0.5 text-[10.5px] font-medium hover:cursor-pointer theme-bg-overlay-md theme-text-faint",children:["+",x-3," more"]})]}),s.jsxs("div",{className:"mt-3.5 pt-3 border-t theme-border",children:[s.jsx("p",{className:"text-[11px] mb-2 font-medium theme-text-muted",children:"Then you need to rescan the codebase:"}),s.jsxs("div",{className:"relative flex items-center justify-between rounded-lg p-2.5 font-mono text-[11px] leading-relaxed group theme-bg-base border theme-border theme-text",children:[s.jsx("span",{className:"pr-16 select-all font-mono text-[11px] leading-relaxed theme-text-primary",children:mx}),s.jsx("button",{type:"button",onClick:m,title:"Copy prompt",className:`absolute right-2 top-2.5 flex items-center gap-1 rounded-md px-2 py-1 text-[10.5px] font-sans font-medium transition-all shadow-sm hover:cursor-pointer border theme-border ${f?"bg-blue-500/20 text-blue-400":"theme-bg-overlay-md theme-text-muted"}`,children:f?s.jsxs(s.Fragment,{children:[s.jsx(ut,{className:"h-3 w-3 text-blue-400",strokeWidth:2}),s.jsx("span",{children:"Copied"})]}):s.jsxs(s.Fragment,{children:[s.jsx(C0,{className:"h-3 w-3",strokeWidth:2}),s.jsx("span",{children:"Copy"})]})})]})]})]})}const v2=`.jl-p{fill:currentColor}
374
+ */const f2=[["path",{d:"M15.914 4a1.5 1.5 0 00-2.474-1.561l-9 9A1.5 1.5 0 005.5 14h4.002a.5.5 0 01.471.666L8.086 20a1.5 1.5 0 002.475 1.56l9-9A1.5 1.5 0 0018.5 10h-3.997a.5.5 0 01-.472-.667z",key:"1v7up4"}]],hs=Ne("zap",f2),D0=j.createContext({theme:"dark",toggleTheme:()=>{}});function h2({children:n}){const[r,o]=j.useState(()=>localStorage.getItem("jetic_theme")==="light"?"light":"dark");j.useEffect(()=>{const u=document.documentElement;r==="light"?(u.classList.add("light"),u.classList.remove("dark")):(u.classList.add("dark"),u.classList.remove("light")),localStorage.setItem("jetic_theme",r);const f=document.getElementById("app-favicon");f&&(f.href=r==="light"?"/brand/jetic-black.svg":"/brand/jetic.svg")},[r]);const i=()=>o(u=>u==="dark"?"light":"dark");return s.jsx(D0.Provider,{value:{theme:r,toggleTheme:i},children:n})}function H0(){return j.useContext(D0)}function m2({size:n=20,className:r}){return s.jsx("svg",{width:n,height:n*1.5,viewBox:"0 0 14 21",fill:"currentColor",className:r,"aria-label":"Jetic",children:s.jsx("path",{d:"M0 0h14v14l-7 7H0v-7h7V7H0V0Z"})})}const p2=[{label:"WORKFLOW",items:[{id:"overview",label:"Overview",icon:Cv},{id:"model",label:"Model",icon:A0},{id:"simulations",label:"Simulations",icon:ea},{id:"inspect",label:"Inspect",icon:e2}]},{label:"AGENT",items:[{id:"memory",label:"Memory & Environment",icon:fl}]},{label:"OBSERVABILITY",items:[{id:"traces",label:"Traces",icon:Vr},{id:"changes",label:"Files changes",icon:T0}]}],x2=[],$0="relative flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-[13.5px] font-medium transition-colors hover:cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--focus-ring)]",U0="theme-bg-brand text-[color:var(--brand-foreground)] shadow-sm",B0="theme-text hover:theme-bg-overlay-md hover:theme-text-primary";function hx({icon:n,label:r,active:o=!1,onClick:i}){return s.jsxs("button",{type:"button",onClick:i,"aria-current":o?"page":void 0,className:`${$0} ${o?U0:B0}`,children:[s.jsx(n,{className:"h-[15px] w-[15px] shrink-0",strokeWidth:2}),s.jsx("span",{children:r})]})}function g2({currentPage:n,onNavigate:r,onToggleAssistant:o,isAssistantOpen:i}){const{theme:u,toggleTheme:f}=H0();return s.jsxs("div",{className:"flex w-60 shrink-0 flex-col select-none transition-colors duration-300 border-r theme-border theme-sidebar",children:[s.jsxs("div",{className:"flex items-center justify-between px-4 pb-6 pt-5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(m2,{size:12,className:"theme-text-primary"}),s.jsxs("span",{className:"text-[15px] font-semibold tracking-wide theme-text-primary",children:["Jetic",s.jsx("span",{className:"ml-1 theme-text-brand",children:"Studio"})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border theme-border theme-bg-overlay px-2 py-0.5 text-[11px] font-medium theme-text-muted",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full theme-bg-brand"}),"v0.2.8"]})]}),s.jsx("div",{className:"flex-1 overflow-y-auto px-3",children:s.jsx("div",{className:"flex flex-col gap-6",children:p2.map(h=>s.jsxs("div",{className:"flex flex-col gap-1",children:[s.jsx("span",{className:"px-3 pb-1 text-[11px] font-semibold uppercase tracking-wider theme-text-muted",children:h.label}),s.jsx("div",{className:"flex flex-col gap-0.5",children:h.items.map(g=>s.jsx(hx,{icon:g.icon,label:g.label,active:n===g.id,onClick:()=>r(g.id)},g.id))})]},h.label))})}),s.jsx("div",{className:"mx-3 my-3 hidden border-t theme-border"}),s.jsx("div",{className:"flex flex-col gap-0.5 px-3",children:s.jsxs("button",{type:"button",onClick:o,"aria-pressed":i,className:`hidden ${$0} ${i?U0:B0}`,children:[s.jsx(Fv,{className:"h-[15px] w-[15px] shrink-0",strokeWidth:2}),s.jsx("span",{children:"Jetic Assistant"})]})}),s.jsx("div",{className:"mx-3 my-3 hidden border-t theme-border"}),s.jsx("div",{className:"flex flex-col gap-0.5 px-3",children:x2.map(h=>s.jsx(hx,{icon:h.icon,label:h.label,active:n===h.id,onClick:()=>r(h.id)},h.id))}),s.jsx("div",{className:"px-3 pb-4 pt-3",children:s.jsxs("div",{className:"flex items-center gap-1 rounded-xl p-1 border theme-border theme-bg-overlay",children:[s.jsxs("button",{type:"button",onClick:()=>u!=="dark"&&f(),title:"Dark mode","aria-pressed":u==="dark",className:`flex flex-1 items-center justify-center gap-1.5 rounded-lg py-1.5 text-[11px] font-medium transition-colors hover:cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--focus-ring)] ${u==="dark"?"theme-bg-brand text-[color:var(--brand-foreground)] shadow-sm":"theme-text-muted hover:theme-text"}`,children:[s.jsx(Ov,{className:"h-3 w-3 shrink-0",strokeWidth:2}),"Dark"]}),s.jsxs("button",{type:"button",onClick:()=>u!=="light"&&f(),title:"Light mode","aria-pressed":u==="light",className:`flex flex-1 items-center justify-center gap-1.5 rounded-lg py-1.5 text-[11px] font-medium transition-colors hover:cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--focus-ring)] ${u==="light"?"theme-bg-brand text-[color:var(--brand-foreground)] shadow-sm":"theme-text-muted hover:theme-text"}`,children:[s.jsx(s2,{className:"h-3 w-3 shrink-0",strokeWidth:2}),"Light"]})]})})]})}function y2({isOpen:n,onClose:r}){return n?s.jsxs("div",{className:"absolute inset-y-0 right-0 w-[400px] border-l theme-border theme-bg-elevated shadow-2xl flex flex-col z-50",children:[s.jsxs("div",{className:"flex h-14 items-center justify-between border-b theme-border px-5",children:[s.jsx("div",{className:"flex items-center gap-2 text-emerald-400",children:s.jsx("span",{className:"text-[14px] font-medium",children:"Jetic AI"})}),s.jsx("button",{onClick:r,className:"theme-text-muted hover:theme-text hover:bg-white/5 p-2 rounded-full",children:s.jsx(Tt,{className:"",size:13})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5 space-y-4",children:s.jsxs("div",{className:"flex flex-col items-center pt-8 pb-4",children:[s.jsx("div",{className:"mb-4 flex h-10 w-10 items-center justify-center rounded-full theme-bg-overlay-md text-[13px] font-medium theme-text-primary",children:"J"}),s.jsx("h2",{className:"text-[17px] font-semibold theme-text-primary text-center",children:"How can I help you test your APIs?"}),s.jsx("p",{className:"theme-text-muted text-[13px] mt-2 text-center",children:"Ask me to generate simulations, debug traces, or explain API behavior."})]})}),s.jsx("div",{className:"p-4 border-t theme-border theme-bg-surface",children:s.jsxs("div",{className:"rounded border border-emerald-600/60 theme-bg-overlay focus-within:border-emerald-500 transition-colors",children:[s.jsx("textarea",{rows:2,placeholder:"E.g. Test password reset flow...",className:"w-full resize-none bg-transparent px-4 pb-2 pt-3.5 text-[13.5px] theme-text-primary placeholder:theme-text-muted focus:outline-none"}),s.jsxs("div",{className:"flex items-center justify-between px-3 pb-3 pt-1",children:[s.jsx("div",{className:"flex gap-2",children:s.jsx("span",{className:"text-[11px] theme-text-muted font-mono theme-bg-overlay-md px-2 py-0.5 rounded",children:"gpt-4o"})}),s.jsx("button",{className:"text-[12px] font-medium text-emerald-400 hover:text-emerald-300",children:"Send"})]})]})})]}):null}const mx="Check recent file changes (jetic_get_changes). Re-analyse ONLY those modified files to update .jetic/model.json instead of reading the entire codebase";function b2({onNavigateToChanges:n}){const[r,o]=j.useState(null),[i,u]=j.useState(!1),[f,h]=j.useState(!1),g=j.useCallback(async()=>{try{const p=await fetch("/api/changes");if(!p.ok)return;const b=await p.json();o(b)}catch{}},[]);j.useEffect(()=>{g();let p=null,b=null;try{p=new EventSource("/api/changes/stream"),p.onmessage=v=>{try{o(JSON.parse(v.data))}catch{}},p.onerror=()=>{b||(b=setInterval(g,3e3))}}catch{b=setInterval(g,3e3)}return()=>{p?.close(),b&&clearInterval(b)}},[g]);const x=r?.changes?.length??0;j.useEffect(()=>{x===0&&u(!1)},[x]);const m=p=>{p.stopPropagation(),navigator.clipboard.writeText(mx),h(!0),setTimeout(()=>h(!1),2e3)};return x===0||i?null:s.jsxs("div",{className:"fixed bottom-6 right-6 z-[100] w-[420px] max-w-[calc(100vw-3rem)] rounded-xl border border-amber-500/35 p-4 shadow-2xl transition-all duration-300 animate-in slide-in-from-bottom-5 theme-sidebar theme-text-primary",style:{boxShadow:"0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.4), 0 0 15px rgba(245, 158, 11, 0.1)"},children:[s.jsxs("div",{className:"flex items-start justify-between gap-3",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-amber-500/15 text-amber-400 border border-amber-500/25",children:s.jsx(i2,{className:"h-4 w-4",strokeWidth:2})}),s.jsxs("div",{children:[s.jsx("h4",{className:"text-[13px] font-semibold tracking-tight theme-text-primary",children:"Model is not currently in sync with codebase"}),s.jsxs("p",{className:"text-[11px] theme-text-muted",children:["Detected ",s.jsxs("span",{className:"font-medium text-amber-400",children:[x," change",x>1?"s":""]})," in your codebase."]})]})]}),s.jsx("button",{type:"button",onClick:()=>u(!0),title:"Cancel",className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-lg transition-colors theme-text-muted hover:theme-bg-overlay-md hover:cursor-pointer",children:s.jsx(Tt,{className:"h-3.5 w-3.5",strokeWidth:2})})]}),s.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-1.5",children:[r?.changes.slice(0,3).map(p=>{const b=p.filePath.split("/").pop()??p.filePath;return s.jsx("span",{onClick:()=>n?.(),className:"truncate max-w-[130px] rounded px-2 py-0.5 font-mono text-[10.5px] hover:border-amber-500/50 hover:cursor-pointer transition-colors theme-bg-overlay border theme-border theme-text-muted",title:p.filePath,children:b},p.filePath)}),x>3&&s.jsxs("span",{onClick:()=>n?.(),className:"rounded px-1.5 py-0.5 text-[10.5px] font-medium hover:cursor-pointer theme-bg-overlay-md theme-text-faint",children:["+",x-3," more"]})]}),s.jsxs("div",{className:"mt-3.5 pt-3 border-t theme-border",children:[s.jsx("p",{className:"text-[11px] mb-2 font-medium theme-text-muted",children:"Then you need to rescan the codebase:"}),s.jsxs("div",{className:"relative flex items-center justify-between rounded-lg p-2.5 font-mono text-[11px] leading-relaxed group theme-bg-base border theme-border theme-text",children:[s.jsx("span",{className:"pr-16 select-all font-mono text-[11px] leading-relaxed theme-text-primary",children:mx}),s.jsx("button",{type:"button",onClick:m,title:"Copy prompt",className:`absolute right-2 top-2.5 flex items-center gap-1 rounded-md px-2 py-1 text-[10.5px] font-sans font-medium transition-all shadow-sm hover:cursor-pointer border theme-border ${f?"bg-blue-500/20 text-blue-400":"theme-bg-overlay-md theme-text-muted"}`,children:f?s.jsxs(s.Fragment,{children:[s.jsx(ut,{className:"h-3 w-3 text-blue-400",strokeWidth:2}),s.jsx("span",{children:"Copied"})]}):s.jsxs(s.Fragment,{children:[s.jsx(C0,{className:"h-3 w-3",strokeWidth:2}),s.jsx("span",{children:"Copy"})]})})]})]})]})}const v2=`.jl-p{fill:currentColor}
375
375
  .jl-g{transform-origin:7px 10.5px}
376
376
  .jl-sg stop{stop-color:var(--j-hi)}
377
377
  .jl-sg .jl-mid{stop-opacity:var(--j-hia)}
@@ -392,7 +392,7 @@ Error generating stack: `+a.message+`
392
392
  @keyframes jl-a-in{from{transform:translateX(-14px)}}
393
393
  @keyframes jl-b-in{from{transform:translateY(-7.2px)}}
394
394
  @keyframes jl-c-in{from{transform:translateX(14px)}}
395
- @keyframes jl-s-in{from{transform:translateX(-9px)}to{transform:translateX(27px)}}`;function j2({size:n=20,loop:r=!0,sheen:o="#000",className:i}){const u=j.useId().replace(/:/g,""),f={"--j-hi":o,"--j-hia":.22};return s.jsxs("svg",{className:`jl ${i??""}`,"data-loop":r,style:f,width:n,height:n*1.5,viewBox:"0 0 14 21",role:"img","aria-label":"Jetic",children:[s.jsx("style",{children:v2}),s.jsxs("defs",{children:[s.jsx("clipPath",{id:`${u}-shape`,children:s.jsx("path",{d:"M0 0h14v14l-7 7H0v-7h7V7H0V0Z"})}),s.jsx("clipPath",{id:`${u}-a`,children:s.jsx("rect",{x:"0",y:"-1",width:"14",height:"9"})}),s.jsx("clipPath",{id:`${u}-b`,children:s.jsx("rect",{x:"6",y:"6.96",width:"9",height:"7.08"})}),s.jsx("clipPath",{id:`${u}-c`,children:s.jsx("rect",{x:"0",y:"13",width:"14",height:"9"})}),s.jsxs("linearGradient",{id:`${u}-sg`,className:"jl-sg",children:[s.jsx("stop",{offset:"0",stopOpacity:"0"}),s.jsx("stop",{offset:".5",className:"jl-mid"}),s.jsx("stop",{offset:"1",stopOpacity:"0"})]})]}),s.jsxs("g",{className:"jl-g",children:[s.jsx("g",{clipPath:`url(#${u}-a)`,children:s.jsx("path",{className:"jl-p jl-a",d:"M0 0H14V7.04H7V7H0Z"})}),s.jsx("g",{clipPath:`url(#${u}-b)`,children:s.jsx("path",{className:"jl-p jl-b",d:"M7 6.96H14V14.04H7Z"})}),s.jsx("g",{clipPath:`url(#${u}-c)`,children:s.jsx("path",{className:"jl-p jl-c",d:"M0 14H7V13.96H14V14L7 21H0Z"})}),s.jsx("g",{clipPath:`url(#${u}-shape)`,children:s.jsx("g",{className:"jl-s",children:s.jsx("rect",{transform:"skewX(-20)",x:"0",y:"-2",width:"5",height:"25",fill:`url(#${u}-sg)`})})})]})]})}const N2={GET:{bg:"bg-emerald-500/10",text:"text-emerald-400",dot:"#34d399"},POST:{bg:"bg-[color:var(--brand)]/10",text:"text-[color:var(--brand)]",dot:"var(--brand)"},PUT:{bg:"bg-amber-500/10",text:"text-amber-400",dot:"#fbbf24"},PATCH:{bg:"bg-orange-500/10",text:"text-orange-400",dot:"#fb923c"},DELETE:{bg:"bg-red-500/10",text:"text-red-400",dot:"#f87171"}};function q0(n){return N2[n.toUpperCase()]??{bg:"theme-bg-overlay-md",text:"theme-text-muted",dot:"var(--text-muted)"}}const L0="inline-flex items-center gap-1.5 rounded-lg border theme-border theme-bg-overlay px-3 py-1.5 text-[12px] font-medium theme-text-muted transition-colors hover:cursor-pointer hover:theme-bg-overlay-md hover:theme-text disabled:opacity-40",fd="inline-flex items-center gap-1 text-[12px] font-medium text-[color:var(--brand)] transition-colors hover:cursor-pointer hover:opacity-80";function hi({label:n,value:r,sub:o,icon:i,accent:u="blue"}){const f={blue:"text-[color:var(--brand)]",emerald:"text-emerald-400",amber:"text-amber-400",red:"text-red-400",zinc:"theme-text-muted"}[u];return s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay p-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("p",{className:"text-[12px] font-medium theme-text-muted",children:n}),s.jsx(i,{className:`h-[15px] w-[15px] ${f}`,strokeWidth:2})]}),s.jsx("p",{className:"mt-3 text-2xl font-semibold leading-none tabular-nums theme-text-primary",children:r}),s.jsx("p",{className:"mt-1.5 h-4 text-[11px] theme-text-faint",children:o??" "})]})}function Nr({title:n,icon:r,action:o,children:i,noPad:u=!1}){return s.jsxs("section",{className:"overflow-hidden rounded-lg border theme-border theme-bg-overlay",children:[s.jsxs("header",{className:"flex items-center gap-2 border-b theme-border px-4 py-3",children:[r&&s.jsx(r,{className:"h-[15px] w-[15px] theme-text-muted",strokeWidth:2}),s.jsx("h2",{className:"text-[13px] font-medium theme-text-primary",children:n}),o&&s.jsx("div",{className:"ml-auto",children:o})]}),s.jsx("div",{className:u?"":"p-4",children:i})]})}function w2({method:n}){const r=q0(n);return s.jsx("span",{className:`inline-flex w-14 shrink-0 items-center justify-center rounded px-1.5 py-0.5 text-[10px] font-semibold tracking-wide ${r.bg} ${r.text}`,children:n.toUpperCase()})}function hd({icon:n,msg:r,hint:o}){return s.jsxs("div",{className:"flex flex-col items-center gap-1 px-4 py-8 text-center",children:[n&&s.jsx("div",{className:"mb-2 flex h-9 w-9 items-center justify-center rounded-lg border theme-border theme-bg-overlay-md",children:s.jsx(n,{className:"h-[15px] w-[15px] theme-text-faint",strokeWidth:2})}),s.jsx("p",{className:"text-[12px] font-medium theme-text-muted",children:r}),o&&s.jsx("p",{className:"text-[11px] theme-text-faint",children:o})]})}function S2({onClose:n,onSave:r}){const[o,i]=j.useState(""),[u,f]=j.useState("https://"),[h,g]=j.useState(!1),[x,m]=j.useState(""),p=j.useRef(null);j.useEffect(()=>{p.current?.focus()},[]),j.useEffect(()=>{const N=C=>{C.key==="Escape"&&n()};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[n]);const b=async N=>{if(N.preventDefault(),!o.trim()){m("Name is required");return}if(!u.trim()||u==="https://"){m("Base URL is required");return}g(!0),m("");try{await r(o.trim(),u.trim()),n()}catch(C){m(C.message),g(!1)}},v="w-full rounded-lg border theme-border theme-bg-overlay px-3 py-2 text-[12px] theme-text-primary outline-none transition-colors focus:border-[color:var(--brand)]/50";return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",onClick:N=>{N.target===N.currentTarget&&n()},children:s.jsxs("form",{role:"dialog","aria-modal":"true","aria-labelledby":"add-env-title",onSubmit:b,className:"w-full max-w-sm rounded-lg border theme-border theme-sidebar p-6 shadow-2xl shadow-black/60",children:[s.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg border theme-border theme-bg-overlay",children:s.jsx(jl,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2})}),s.jsxs("div",{children:[s.jsx("h2",{id:"add-env-title",className:"text-[13.5px] font-medium leading-none theme-text-primary",children:"Add environment"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-faint",children:"Target for simulations and scans"})]})]}),s.jsx("button",{type:"button",onClick:n,"aria-label":"Close",className:"flex h-7 w-7 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-muted transition-colors hover:cursor-pointer hover:theme-bg-overlay-md",children:s.jsx(Ct,{className:"h-[15px] w-[15px]",strokeWidth:2})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{htmlFor:"env-name",className:"mb-1.5 block text-[12px] font-medium theme-text-muted",children:"Name"}),s.jsx("input",{id:"env-name",ref:p,value:o,onChange:N=>i(N.target.value),placeholder:"production",className:v})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"env-url",className:"mb-1.5 block text-[12px] font-medium theme-text-muted",children:"Base URL"}),s.jsx("input",{id:"env-url",value:u,onChange:N=>f(N.target.value),placeholder:"https://api.example.com",className:`${v} font-mono`})]}),x&&s.jsxs("p",{className:"flex items-center gap-1.5 text-[12px] text-red-400",children:[s.jsx(_t,{className:"h-3.5 w-3.5 shrink-0",strokeWidth:2})," ",x]}),s.jsxs("div",{className:"flex items-center justify-end gap-2 border-t theme-border pt-4",children:[s.jsx("button",{type:"button",onClick:n,className:L0,children:"Cancel"}),s.jsxs("button",{type:"submit",disabled:h,className:"inline-flex items-center gap-2 rounded-lg bg-[var(--action)] px-4 py-1.5 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)] disabled:opacity-50",children:[h&&s.jsx(dt,{className:"h-[14px] w-[14px] animate-spin",strokeWidth:2}),h?"Saving…":"Add environment"]})]})]})]})})}function px({onNavigate:n}){const[r,o]=j.useState(null),[i,u]=j.useState([]),[f,h]=j.useState([]),[g,x]=j.useState(!0),[m,p]=j.useState(!1),[b,v]=j.useState(null),[N,C]=j.useState(null),[k,R]=j.useState(!1),[z,V]=j.useState(null),[q,M]=j.useState(null),H=j.useCallback(async(T=!1)=>{T?p(!0):x(!0),v(null);try{const[A,S,D,L]=await Promise.allSettled([fetch("/api/model").then(F=>F.ok?F.json():null),fetch("/api/workflows").then(F=>F.ok?F.json():[]),fetch("/api/memory").then(F=>F.ok?F.json():[]),fetch("/api/model/environments").then(F=>F.ok?F.json():null)]);A.status==="fulfilled"&&o(A.value),S.status==="fulfilled"&&u(S.value??[]),D.status==="fulfilled"&&h(D.value??[]),L.status==="fulfilled"&&L.value&&C(L.value.defaultEnvironment??null)}catch(A){v(A.message)}finally{x(!1),p(!1)}},[]);j.useEffect(()=>{H()},[H]);const Z=r?.endpoints?.length??0,X=i.length,oe=f.length,I=r?.endpoints?.filter(T=>(T.security?.length??0)>0).length??0,K=i.reduce((T,A)=>T+(A.steps?.length??0),0),ae=(r?.endpoints??[]).reduce((T,A)=>(T[A.method.toUpperCase()]=(T[A.method.toUpperCase()]??0)+1,T),{}),te=(r?.endpoints??[]).slice(0,8),se=i.slice(0,4),_=f.slice(0,6),W=async T=>{V(T);try{await fetch(`/api/model/environments/${encodeURIComponent(T)}/default`,{method:"PUT"}),C(T),o(A=>A&&{...A,defaultEnvironment:T})}finally{V(null)}},E=async T=>{M(T);try{await fetch(`/api/model/environments/${encodeURIComponent(T)}`,{method:"DELETE"}),o(A=>A&&{...A,environments:A.environments?.filter(S=>S.name!==T)}),N===T&&C(null)}finally{M(null)}},$=r?[r.project.framework??r.project.language,`v${r.version}`,`Updated ${new Date(r.generatedAt).toLocaleString()}`].filter(Boolean):[];return s.jsxs("div",{className:"flex min-h-full w-full flex-col",children:[s.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3 border-b theme-border px-6 py-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h1",{className:"truncate text-[16px] font-semibold leading-none theme-text-primary",children:r?.project?.name??"Overview"}),s.jsx("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2 text-[11px] theme-text-muted",children:g?s.jsx("span",{children:"Loading…"}):r?$.map((T,A)=>s.jsxs(le.Fragment,{children:[A>0&&s.jsx("span",{className:"theme-text-faint","aria-hidden":!0,children:"/"}),s.jsx("span",{children:T})]},A)):s.jsx("span",{children:"No model yet. Run a scan to get started."})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("a",{href:"https://docs.jetic.space",target:"_blank",rel:"noopener noreferrer",className:L0,children:[s.jsx(lv,{className:"h-[15px] w-[15px]",strokeWidth:2}),"Docs",s.jsx(Md,{className:"h-3 w-3 theme-text-faint",strokeWidth:2})]}),s.jsx("button",{type:"button",onClick:()=>H(!0),disabled:m||g,"aria-label":"Refresh",title:"Refresh",className:"flex h-8 w-8 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-muted transition-colors hover:cursor-pointer hover:theme-bg-overlay-md hover:theme-text disabled:opacity-40",children:s.jsx(na,{className:`h-[15px] w-[15px] ${m?"animate-spin":""}`,strokeWidth:2})}),!g&&!r?s.jsxs("button",{type:"button",onClick:()=>n?.("model"),className:"inline-flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-3 py-1.5 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)]",children:[s.jsx(Ri,{className:"h-[15px] w-[15px]",strokeWidth:2})," Scan project"]}):s.jsxs("button",{type:"button",onClick:()=>n?.("simulations"),className:"inline-flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-3 py-1.5 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)]",children:[s.jsx(tv,{className:"h-[15px] w-[15px]",strokeWidth:2})," Simulations"]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:s.jsxs("div",{className:" w-full",children:[g&&s.jsxs("div",{className:"space-y-5 p-6",children:[s.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[1,2,3,4].map(T=>s.jsx("div",{className:"h-[104px] animate-pulse rounded-lg border theme-border theme-bg-overlay"},T))}),s.jsxs("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-3",children:[s.jsx("div",{className:"h-80 animate-pulse rounded-lg border theme-border theme-bg-overlay lg:col-span-2"}),s.jsx("div",{className:"h-80 animate-pulse rounded-lg border theme-border theme-bg-overlay"})]})]}),!g&&b&&s.jsxs("div",{className:"m-6 flex flex-col items-center gap-3 rounded-lg border border-red-500/20 bg-red-500/[0.05] p-10 text-center",children:[s.jsx(_t,{className:"h-7 w-7 text-red-400",strokeWidth:2}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[13px] font-medium text-red-300",children:"Couldn't load the overview"}),s.jsx("p",{className:"mt-1 text-[12px] text-red-300/80",children:b})]}),s.jsx("button",{type:"button",onClick:()=>H(),className:"rounded-lg border border-red-500/20 bg-red-500/10 px-4 py-1.5 text-[12px] font-medium text-red-400 transition-colors hover:cursor-pointer hover:bg-red-500/20",children:"Try again"})]}),!g&&!b&&s.jsxs("div",{className:"space-y-5 p-6",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[s.jsx(hi,{label:"Endpoints",value:Z,icon:dd,accent:"blue",sub:Z>0?`${Object.keys(ae).length} HTTP methods`:void 0}),s.jsx(hi,{label:"Secured routes",value:I,icon:La,accent:"amber",sub:Z>0?`${Math.round(I/Z*100)}% of endpoints`:void 0}),s.jsx(hi,{label:"Workflows",value:X,icon:_i,accent:"zinc",sub:X>0?`${K} total steps`:void 0}),s.jsx(hi,{label:"Memory keys",value:oe,icon:fl,accent:"emerald"})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-3",children:[s.jsx("div",{className:"lg:col-span-2",children:s.jsx(Nr,{title:"Endpoints",icon:dd,noPad:!0,action:s.jsxs("button",{type:"button",onClick:()=>n?.("model"),className:fd,children:["View all ",s.jsx(dl,{className:"h-3.5 w-3.5",strokeWidth:2})]}),children:te.length===0?s.jsx(hd,{icon:dd,msg:"No endpoints yet",hint:"Scan your project to discover routes."}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"hidden items-center gap-3 border-b theme-border theme-bg-overlay-md px-4 py-2 text-[11px] font-medium theme-text-faint sm:flex",children:[s.jsx("span",{className:"w-14",children:"Method"}),s.jsx("span",{className:"flex-1",children:"Path"}),s.jsx("span",{className:"w-36",children:"Handler"}),s.jsx("span",{className:"w-4"})]}),s.jsx("div",{className:"divide-y divide-[var(--border)]",children:te.map(T=>{const A=(T.security?.length??0)>0;return s.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 transition-colors hover:theme-bg-overlay-md",children:[s.jsx(w2,{method:T.method}),s.jsx("span",{className:"flex-1 truncate font-mono text-[12px] theme-text",title:T.path,children:T.path}),s.jsx("span",{className:"hidden w-36 truncate text-[11px] theme-text-faint sm:block",title:T.handlerName,children:T.handlerName??"—"}),s.jsx("span",{className:"flex w-4 justify-end",title:A?"Secured":void 0,children:A&&s.jsx(La,{className:"h-[14px] w-[14px] text-amber-500/70",strokeWidth:2})})]},T.id)})}),Z>8&&s.jsxs("div",{className:"border-t theme-border px-4 py-2.5 text-[11px] theme-text-faint",children:["Showing 8 of ",Z," endpoints"]})]})})}),s.jsxs("div",{className:"space-y-5",children:[s.jsx(Nr,{title:"Environments",icon:jl,action:r&&s.jsxs("button",{type:"button",onClick:()=>R(!0),className:"inline-flex items-center gap-1 rounded-lg border theme-border px-2 py-1 text-[11px] font-medium text-[color:var(--brand)] transition-colors hover:cursor-pointer hover:bg-[color:var(--brand)]/10",children:[s.jsx(Ht,{className:"h-3 w-3",strokeWidth:2})," Add"]}),children:!r||(r.environments?.length??0)===0?s.jsx("p",{className:"py-2 text-center text-[12px] theme-text-faint",children:"No environments configured"}):s.jsx("div",{className:"space-y-1.5",children:r.environments.map(T=>{const A=N===T.name,S=z===T.name,D=q===T.name;return s.jsxs("div",{className:`group flex items-center gap-2.5 rounded-lg border px-3 py-2 transition-colors ${A?"border-[color:var(--brand)]/30 bg-[color:var(--brand)]/[0.05]":"theme-border theme-bg-overlay-md"}`,children:[s.jsx("button",{type:"button","aria-label":A?`${T.name} is the default environment`:`Set ${T.name} as default`,title:A?"Default environment":"Set as default",onClick:()=>{A||W(T.name)},className:`flex h-4 w-4 shrink-0 items-center justify-center rounded-full border-2 transition-colors hover:cursor-pointer ${A?"border-[color:var(--brand)] bg-[color:var(--brand)]/20":"theme-border bg-transparent"}`,children:S?s.jsx(dt,{className:"h-2.5 w-2.5 animate-spin text-[color:var(--brand)]",strokeWidth:3}):A&&s.jsx(ut,{className:"h-2.5 w-2.5 text-[color:var(--brand)]",strokeWidth:3})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:`truncate text-[12px] font-medium ${A?"text-[color:var(--brand)]":"theme-text-primary"}`,children:T.name}),A&&s.jsx("span",{className:"shrink-0 rounded-full border border-[color:var(--brand)]/20 bg-[color:var(--brand)]/10 px-1.5 py-px text-[9px] font-semibold text-[color:var(--brand)]",children:"Default"})]}),s.jsx("p",{className:"truncate font-mono text-[11px] theme-text-faint",title:T.baseUrl,children:T.baseUrl})]}),s.jsx("button",{type:"button",disabled:D,"aria-label":`Delete ${T.name}`,onClick:()=>E(T.name),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-lg border border-transparent theme-text-faint opacity-60 transition-all hover:cursor-pointer hover:border-red-500/30 hover:bg-red-500/10 hover:text-red-400 hover:opacity-100 focus-visible:opacity-100 group-hover:opacity-100",children:D?s.jsx(dt,{className:"h-3 w-3 animate-spin",strokeWidth:2}):s.jsx(Yt,{className:"h-3 w-3",strokeWidth:2})})]},T.name)})})}),s.jsx(Nr,{title:"Method distribution",icon:Vr,children:Object.keys(ae).length===0?s.jsx("p",{className:"py-2 text-center text-[12px] theme-text-faint",children:"No endpoints scanned yet"}):s.jsx("div",{className:"space-y-3",children:Object.entries(ae).sort(([,T],[,A])=>A-T).map(([T,A])=>{const S=q0(T),D=Math.round(A/Z*100);return s.jsxs("div",{children:[s.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[s.jsx("span",{className:`text-[12px] font-medium ${S.text}`,children:T}),s.jsxs("span",{className:"text-[11px] tabular-nums theme-text-muted",children:[A," ",s.jsxs("span",{className:"theme-text-faint",children:["(",D,"%)"]})]})]}),s.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full theme-bg-overlay-md",children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${D}%`,background:S.dot}})})]},T)})})})]})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[s.jsx(Nr,{title:"Workflows",icon:_i,noPad:!0,action:s.jsxs("button",{type:"button",onClick:()=>n?.("simulations"),className:fd,children:["View all ",s.jsx(dl,{className:"h-3.5 w-3.5",strokeWidth:2})]}),children:se.length===0?s.jsx(hd,{icon:_i,msg:"No workflows found",hint:"Workflows you create will show up here."}):s.jsx("div",{className:"divide-y divide-[var(--border)]",children:se.map((T,A)=>s.jsxs("button",{type:"button",onClick:()=>n?.("simulations"),className:"group flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors hover:cursor-pointer hover:theme-bg-overlay-md",children:[s.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border theme-border theme-bg-overlay-md",children:s.jsx(hs,{className:"h-[14px] w-[14px] text-[color:var(--brand)]",strokeWidth:2})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-[13px] theme-text-primary",children:T.name}),s.jsxs("p",{className:"text-[11px] theme-text-faint",children:[T.steps.length," ",T.steps.length===1?"step":"steps"]})]}),s.jsx(vl,{className:"h-[15px] w-[15px] shrink-0 theme-text-faint opacity-0 transition-opacity group-hover:opacity-100",strokeWidth:2})]},T._file??A))})}),s.jsx(Nr,{title:"Runtime memory",icon:fl,noPad:!0,action:s.jsxs("button",{type:"button",onClick:()=>n?.("memory"),className:fd,children:["Inspect ",s.jsx(dl,{className:"h-3.5 w-3.5",strokeWidth:2})]}),children:_.length===0?s.jsx(hd,{icon:fl,msg:"No memory entries",hint:"Values stored at runtime appear here."}):s.jsxs("div",{className:"divide-y divide-[var(--border)]",children:[_.map((T,A)=>s.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 transition-colors hover:theme-bg-overlay-md",children:[s.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500/60"}),s.jsx("span",{className:"flex-1 truncate font-mono text-[12px] theme-text",title:T.key,children:T.key}),s.jsx("span",{className:"max-w-[120px] truncate font-mono text-[11px] theme-text-faint",children:typeof T.value=="object"?JSON.stringify(T.value):String(T.value)})]},T.key??A)),f.length>6&&s.jsxs("p",{className:"px-4 py-2.5 text-[11px] theme-text-faint",children:["+",f.length-6," more entries"]})]})})]}),s.jsxs("div",{className:"flex items-center gap-2 border-t theme-border pt-3 text-[11px] theme-text-faint",children:[s.jsx(Gr,{className:"h-[14px] w-[14px]",strokeWidth:2}),r?`Model generated ${new Date(r.generatedAt).toLocaleString()}`:"No model generated yet"]})]})]})}),k&&s.jsx(S2,{onClose:()=>R(!1),onSave:async(T,A)=>{const S=await fetch("/api/model/environments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:T,baseUrl:A})});if(!S.ok){const L=await S.json().catch(()=>({}));throw new Error(L.error??"Failed")}const D=await S.json();o(L=>L&&{...L,environments:D.environments}),D.defaultEnvironment&&C(D.defaultEnvironment)}})]})}async function E2(n){return await fetch("/api/traces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),n.id}async function xx(){try{const n=await fetch("/api/traces");if(n.ok){const r=await n.json();if(Array.isArray(r))return r}}catch{}return[]}async function k2(n){await fetch(`/api/traces/${encodeURIComponent(n)}`,{method:"DELETE"})}async function _2(){await fetch("/api/traces",{method:"DELETE"})}function $t(n){if(typeof n=="string"||typeof n=="number")return""+n;let r="";if(Array.isArray(n))for(let o=0,i;o<n.length;o++)(i=$t(n[o]))!==""&&(r+=(r&&" ")+i);else for(let o in n)n[o]&&(r+=(r&&" ")+o);return r}var md={exports:{}},pd={},xd={exports:{}},gd={};/**
395
+ @keyframes jl-s-in{from{transform:translateX(-9px)}to{transform:translateX(27px)}}`;function j2({size:n=20,loop:r=!0,sheen:o="#000",className:i}){const u=j.useId().replace(/:/g,""),f={"--j-hi":o,"--j-hia":.22};return s.jsxs("svg",{className:`jl ${i??""}`,"data-loop":r,style:f,width:n,height:n*1.5,viewBox:"0 0 14 21",role:"img","aria-label":"Jetic",children:[s.jsx("style",{children:v2}),s.jsxs("defs",{children:[s.jsx("clipPath",{id:`${u}-shape`,children:s.jsx("path",{d:"M0 0h14v14l-7 7H0v-7h7V7H0V0Z"})}),s.jsx("clipPath",{id:`${u}-a`,children:s.jsx("rect",{x:"0",y:"-1",width:"14",height:"9"})}),s.jsx("clipPath",{id:`${u}-b`,children:s.jsx("rect",{x:"6",y:"6.96",width:"9",height:"7.08"})}),s.jsx("clipPath",{id:`${u}-c`,children:s.jsx("rect",{x:"0",y:"13",width:"14",height:"9"})}),s.jsxs("linearGradient",{id:`${u}-sg`,className:"jl-sg",children:[s.jsx("stop",{offset:"0",stopOpacity:"0"}),s.jsx("stop",{offset:".5",className:"jl-mid"}),s.jsx("stop",{offset:"1",stopOpacity:"0"})]})]}),s.jsxs("g",{className:"jl-g",children:[s.jsx("g",{clipPath:`url(#${u}-a)`,children:s.jsx("path",{className:"jl-p jl-a",d:"M0 0H14V7.04H7V7H0Z"})}),s.jsx("g",{clipPath:`url(#${u}-b)`,children:s.jsx("path",{className:"jl-p jl-b",d:"M7 6.96H14V14.04H7Z"})}),s.jsx("g",{clipPath:`url(#${u}-c)`,children:s.jsx("path",{className:"jl-p jl-c",d:"M0 14H7V13.96H14V14L7 21H0Z"})}),s.jsx("g",{clipPath:`url(#${u}-shape)`,children:s.jsx("g",{className:"jl-s",children:s.jsx("rect",{transform:"skewX(-20)",x:"0",y:"-2",width:"5",height:"25",fill:`url(#${u}-sg)`})})})]})]})}const N2={GET:{bg:"bg-emerald-500/10",text:"text-emerald-400",dot:"#34d399"},POST:{bg:"bg-[color:var(--brand)]/10",text:"text-[color:var(--brand)]",dot:"var(--brand)"},PUT:{bg:"bg-amber-500/10",text:"text-amber-400",dot:"#fbbf24"},PATCH:{bg:"bg-orange-500/10",text:"text-orange-400",dot:"#fb923c"},DELETE:{bg:"bg-red-500/10",text:"text-red-400",dot:"#f87171"}};function q0(n){return N2[n.toUpperCase()]??{bg:"theme-bg-overlay-md",text:"theme-text-muted",dot:"var(--text-muted)"}}const L0="inline-flex items-center gap-1.5 rounded-lg border theme-border theme-bg-overlay px-3 py-1.5 text-[12px] font-medium theme-text-muted transition-colors hover:cursor-pointer hover:theme-bg-overlay-md hover:theme-text disabled:opacity-40",fd="inline-flex items-center gap-1 text-[12px] font-medium text-[color:var(--brand)] transition-colors hover:cursor-pointer hover:opacity-80";function hi({label:n,value:r,sub:o,icon:i,accent:u="blue"}){const f={blue:"text-[color:var(--brand)]",emerald:"text-emerald-400",amber:"text-amber-400",red:"text-red-400",zinc:"theme-text-muted"}[u];return s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay p-4",children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("p",{className:"text-[12px] font-medium theme-text-muted",children:n}),s.jsx(i,{className:`h-[15px] w-[15px] ${f}`,strokeWidth:2})]}),s.jsx("p",{className:"mt-3 text-2xl font-semibold leading-none tabular-nums theme-text-primary",children:r}),s.jsx("p",{className:"mt-1.5 h-4 text-[11px] theme-text-faint",children:o??" "})]})}function Nr({title:n,icon:r,action:o,children:i,noPad:u=!1}){return s.jsxs("section",{className:"overflow-hidden rounded-lg border theme-border theme-bg-overlay",children:[s.jsxs("header",{className:"flex items-center gap-2 border-b theme-border px-4 py-3",children:[r&&s.jsx(r,{className:"h-[15px] w-[15px] theme-text-muted",strokeWidth:2}),s.jsx("h2",{className:"text-[13px] font-medium theme-text-primary",children:n}),o&&s.jsx("div",{className:"ml-auto",children:o})]}),s.jsx("div",{className:u?"":"p-4",children:i})]})}function w2({method:n}){const r=q0(n);return s.jsx("span",{className:`inline-flex w-14 shrink-0 items-center justify-center rounded px-1.5 py-0.5 text-[10px] font-semibold tracking-wide ${r.bg} ${r.text}`,children:n.toUpperCase()})}function hd({icon:n,msg:r,hint:o}){return s.jsxs("div",{className:"flex flex-col items-center gap-1 px-4 py-8 text-center",children:[n&&s.jsx("div",{className:"mb-2 flex h-9 w-9 items-center justify-center rounded-lg border theme-border theme-bg-overlay-md",children:s.jsx(n,{className:"h-[15px] w-[15px] theme-text-faint",strokeWidth:2})}),s.jsx("p",{className:"text-[12px] font-medium theme-text-muted",children:r}),o&&s.jsx("p",{className:"text-[11px] theme-text-faint",children:o})]})}function S2({onClose:n,onSave:r}){const[o,i]=j.useState(""),[u,f]=j.useState("https://"),[h,g]=j.useState(!1),[x,m]=j.useState(""),p=j.useRef(null);j.useEffect(()=>{p.current?.focus()},[]),j.useEffect(()=>{const N=C=>{C.key==="Escape"&&n()};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[n]);const b=async N=>{if(N.preventDefault(),!o.trim()){m("Name is required");return}if(!u.trim()||u==="https://"){m("Base URL is required");return}g(!0),m("");try{await r(o.trim(),u.trim()),n()}catch(C){m(C.message),g(!1)}},v="w-full rounded-lg border theme-border theme-bg-overlay px-3 py-2 text-[12px] theme-text-primary outline-none transition-colors focus:border-[color:var(--brand)]/50";return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",onClick:N=>{N.target===N.currentTarget&&n()},children:s.jsxs("form",{role:"dialog","aria-modal":"true","aria-labelledby":"add-env-title",onSubmit:b,className:"w-full max-w-sm rounded-lg border theme-border theme-sidebar p-6 shadow-2xl shadow-black/60",children:[s.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"flex h-8 w-8 items-center justify-center rounded-lg border theme-border theme-bg-overlay",children:s.jsx(jl,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2})}),s.jsxs("div",{children:[s.jsx("h2",{id:"add-env-title",className:"text-[13.5px] font-medium leading-none theme-text-primary",children:"Add environment"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-faint",children:"Target for simulations and scans"})]})]}),s.jsx("button",{type:"button",onClick:n,"aria-label":"Close",className:"flex h-7 w-7 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-muted transition-colors hover:cursor-pointer hover:theme-bg-overlay-md",children:s.jsx(Tt,{className:"h-[15px] w-[15px]",strokeWidth:2})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{htmlFor:"env-name",className:"mb-1.5 block text-[12px] font-medium theme-text-muted",children:"Name"}),s.jsx("input",{id:"env-name",ref:p,value:o,onChange:N=>i(N.target.value),placeholder:"production",className:v})]}),s.jsxs("div",{children:[s.jsx("label",{htmlFor:"env-url",className:"mb-1.5 block text-[12px] font-medium theme-text-muted",children:"Base URL"}),s.jsx("input",{id:"env-url",value:u,onChange:N=>f(N.target.value),placeholder:"https://api.example.com",className:`${v} font-mono`})]}),x&&s.jsxs("p",{className:"flex items-center gap-1.5 text-[12px] text-red-400",children:[s.jsx(Ct,{className:"h-3.5 w-3.5 shrink-0",strokeWidth:2})," ",x]}),s.jsxs("div",{className:"flex items-center justify-end gap-2 border-t theme-border pt-4",children:[s.jsx("button",{type:"button",onClick:n,className:L0,children:"Cancel"}),s.jsxs("button",{type:"submit",disabled:h,className:"inline-flex items-center gap-2 rounded-lg bg-[var(--action)] px-4 py-1.5 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)] disabled:opacity-50",children:[h&&s.jsx(dt,{className:"h-[14px] w-[14px] animate-spin",strokeWidth:2}),h?"Saving…":"Add environment"]})]})]})]})})}function px({onNavigate:n}){const[r,o]=j.useState(null),[i,u]=j.useState([]),[f,h]=j.useState([]),[g,x]=j.useState(!0),[m,p]=j.useState(!1),[b,v]=j.useState(null),[N,C]=j.useState(null),[k,R]=j.useState(!1),[z,V]=j.useState(null),[q,M]=j.useState(null),H=j.useCallback(async(T=!1)=>{T?p(!0):x(!0),v(null);try{const[A,S,D,L]=await Promise.allSettled([fetch("/api/model").then(F=>F.ok?F.json():null),fetch("/api/workflows").then(F=>F.ok?F.json():[]),fetch("/api/memory").then(F=>F.ok?F.json():[]),fetch("/api/model/environments").then(F=>F.ok?F.json():null)]);A.status==="fulfilled"&&o(A.value),S.status==="fulfilled"&&u(S.value??[]),D.status==="fulfilled"&&h(D.value??[]),L.status==="fulfilled"&&L.value&&C(L.value.defaultEnvironment??null)}catch(A){v(A.message)}finally{x(!1),p(!1)}},[]);j.useEffect(()=>{H()},[H]);const Z=r?.endpoints?.length??0,X=i.length,oe=f.length,I=r?.endpoints?.filter(T=>(T.security?.length??0)>0).length??0,K=i.reduce((T,A)=>T+(A.steps?.length??0),0),ae=(r?.endpoints??[]).reduce((T,A)=>(T[A.method.toUpperCase()]=(T[A.method.toUpperCase()]??0)+1,T),{}),te=(r?.endpoints??[]).slice(0,8),se=i.slice(0,4),_=f.slice(0,6),W=async T=>{V(T);try{await fetch(`/api/model/environments/${encodeURIComponent(T)}/default`,{method:"PUT"}),C(T),o(A=>A&&{...A,defaultEnvironment:T})}finally{V(null)}},E=async T=>{M(T);try{await fetch(`/api/model/environments/${encodeURIComponent(T)}`,{method:"DELETE"}),o(A=>A&&{...A,environments:A.environments?.filter(S=>S.name!==T)}),N===T&&C(null)}finally{M(null)}},$=r?[r.project.framework??r.project.language,`v${r.version}`,`Updated ${new Date(r.generatedAt).toLocaleString()}`].filter(Boolean):[];return s.jsxs("div",{className:"flex min-h-full w-full flex-col",children:[s.jsxs("header",{className:"flex flex-wrap items-center justify-between gap-3 border-b theme-border px-6 py-4",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("h1",{className:"truncate text-[16px] font-semibold leading-none theme-text-primary",children:r?.project?.name??"Overview"}),s.jsx("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2 text-[11px] theme-text-muted",children:g?s.jsx("span",{children:"Loading…"}):r?$.map((T,A)=>s.jsxs(le.Fragment,{children:[A>0&&s.jsx("span",{className:"theme-text-faint","aria-hidden":!0,children:"/"}),s.jsx("span",{children:T})]},A)):s.jsx("span",{children:"No model yet. Run a scan to get started."})})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsxs("a",{href:"https://docs.jetic.space",target:"_blank",rel:"noopener noreferrer",className:L0,children:[s.jsx(lv,{className:"h-[15px] w-[15px]",strokeWidth:2}),"Docs",s.jsx(Md,{className:"h-3 w-3 theme-text-faint",strokeWidth:2})]}),s.jsx("button",{type:"button",onClick:()=>H(!0),disabled:m||g,"aria-label":"Refresh",title:"Refresh",className:"flex h-8 w-8 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-muted transition-colors hover:cursor-pointer hover:theme-bg-overlay-md hover:theme-text disabled:opacity-40",children:s.jsx(na,{className:`h-[15px] w-[15px] ${m?"animate-spin":""}`,strokeWidth:2})}),!g&&!r?s.jsxs("button",{type:"button",onClick:()=>n?.("model"),className:"inline-flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-3 py-1.5 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)]",children:[s.jsx(Ri,{className:"h-[15px] w-[15px]",strokeWidth:2})," Scan project"]}):s.jsxs("button",{type:"button",onClick:()=>n?.("simulations"),className:"inline-flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-3 py-1.5 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)]",children:[s.jsx(tv,{className:"h-[15px] w-[15px]",strokeWidth:2})," Simulations"]})]})]}),s.jsx("div",{className:"flex-1 overflow-auto",children:s.jsxs("div",{className:" w-full",children:[g&&s.jsxs("div",{className:"space-y-5 p-6",children:[s.jsx("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[1,2,3,4].map(T=>s.jsx("div",{className:"h-[104px] animate-pulse rounded-lg border theme-border theme-bg-overlay"},T))}),s.jsxs("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-3",children:[s.jsx("div",{className:"h-80 animate-pulse rounded-lg border theme-border theme-bg-overlay lg:col-span-2"}),s.jsx("div",{className:"h-80 animate-pulse rounded-lg border theme-border theme-bg-overlay"})]})]}),!g&&b&&s.jsxs("div",{className:"m-6 flex flex-col items-center gap-3 rounded-lg border border-red-500/20 bg-red-500/[0.05] p-10 text-center",children:[s.jsx(Ct,{className:"h-7 w-7 text-red-400",strokeWidth:2}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[13px] font-medium text-red-300",children:"Couldn't load the overview"}),s.jsx("p",{className:"mt-1 text-[12px] text-red-300/80",children:b})]}),s.jsx("button",{type:"button",onClick:()=>H(),className:"rounded-lg border border-red-500/20 bg-red-500/10 px-4 py-1.5 text-[12px] font-medium text-red-400 transition-colors hover:cursor-pointer hover:bg-red-500/20",children:"Try again"})]}),!g&&!b&&s.jsxs("div",{className:"space-y-5 p-6",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3 lg:grid-cols-4",children:[s.jsx(hi,{label:"Endpoints",value:Z,icon:dd,accent:"blue",sub:Z>0?`${Object.keys(ae).length} HTTP methods`:void 0}),s.jsx(hi,{label:"Secured routes",value:I,icon:La,accent:"amber",sub:Z>0?`${Math.round(I/Z*100)}% of endpoints`:void 0}),s.jsx(hi,{label:"Workflows",value:X,icon:_i,accent:"zinc",sub:X>0?`${K} total steps`:void 0}),s.jsx(hi,{label:"Memory keys",value:oe,icon:fl,accent:"emerald"})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-3",children:[s.jsx("div",{className:"lg:col-span-2",children:s.jsx(Nr,{title:"Endpoints",icon:dd,noPad:!0,action:s.jsxs("button",{type:"button",onClick:()=>n?.("model"),className:fd,children:["View all ",s.jsx(dl,{className:"h-3.5 w-3.5",strokeWidth:2})]}),children:te.length===0?s.jsx(hd,{icon:dd,msg:"No endpoints yet",hint:"Scan your project to discover routes."}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"hidden items-center gap-3 border-b theme-border theme-bg-overlay-md px-4 py-2 text-[11px] font-medium theme-text-faint sm:flex",children:[s.jsx("span",{className:"w-14",children:"Method"}),s.jsx("span",{className:"flex-1",children:"Path"}),s.jsx("span",{className:"w-36",children:"Handler"}),s.jsx("span",{className:"w-4"})]}),s.jsx("div",{className:"divide-y divide-[var(--border)]",children:te.map(T=>{const A=(T.security?.length??0)>0;return s.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 transition-colors hover:theme-bg-overlay-md",children:[s.jsx(w2,{method:T.method}),s.jsx("span",{className:"flex-1 truncate font-mono text-[12px] theme-text",title:T.path,children:T.path}),s.jsx("span",{className:"hidden w-36 truncate text-[11px] theme-text-faint sm:block",title:T.handlerName,children:T.handlerName??"—"}),s.jsx("span",{className:"flex w-4 justify-end",title:A?"Secured":void 0,children:A&&s.jsx(La,{className:"h-[14px] w-[14px] text-amber-500/70",strokeWidth:2})})]},T.id)})}),Z>8&&s.jsxs("div",{className:"border-t theme-border px-4 py-2.5 text-[11px] theme-text-faint",children:["Showing 8 of ",Z," endpoints"]})]})})}),s.jsxs("div",{className:"space-y-5",children:[s.jsx(Nr,{title:"Environments",icon:jl,action:r&&s.jsxs("button",{type:"button",onClick:()=>R(!0),className:"inline-flex items-center gap-1 rounded-lg border theme-border px-2 py-1 text-[11px] font-medium text-[color:var(--brand)] transition-colors hover:cursor-pointer hover:bg-[color:var(--brand)]/10",children:[s.jsx($t,{className:"h-3 w-3",strokeWidth:2})," Add"]}),children:!r||(r.environments?.length??0)===0?s.jsx("p",{className:"py-2 text-center text-[12px] theme-text-faint",children:"No environments configured"}):s.jsx("div",{className:"space-y-1.5",children:r.environments.map(T=>{const A=N===T.name,S=z===T.name,D=q===T.name;return s.jsxs("div",{className:`group flex items-center gap-2.5 rounded-lg border px-3 py-2 transition-colors ${A?"border-[color:var(--brand)]/30 bg-[color:var(--brand)]/[0.05]":"theme-border theme-bg-overlay-md"}`,children:[s.jsx("button",{type:"button","aria-label":A?`${T.name} is the default environment`:`Set ${T.name} as default`,title:A?"Default environment":"Set as default",onClick:()=>{A||W(T.name)},className:`flex h-4 w-4 shrink-0 items-center justify-center rounded-full border-2 transition-colors hover:cursor-pointer ${A?"border-[color:var(--brand)] bg-[color:var(--brand)]/20":"theme-border bg-transparent"}`,children:S?s.jsx(dt,{className:"h-2.5 w-2.5 animate-spin text-[color:var(--brand)]",strokeWidth:3}):A&&s.jsx(ut,{className:"h-2.5 w-2.5 text-[color:var(--brand)]",strokeWidth:3})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("span",{className:`truncate text-[12px] font-medium ${A?"text-[color:var(--brand)]":"theme-text-primary"}`,children:T.name}),A&&s.jsx("span",{className:"shrink-0 rounded-full border border-[color:var(--brand)]/20 bg-[color:var(--brand)]/10 px-1.5 py-px text-[9px] font-semibold text-[color:var(--brand)]",children:"Default"})]}),s.jsx("p",{className:"truncate font-mono text-[11px] theme-text-faint",title:T.baseUrl,children:T.baseUrl})]}),s.jsx("button",{type:"button",disabled:D,"aria-label":`Delete ${T.name}`,onClick:()=>E(T.name),className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-lg border border-transparent theme-text-faint opacity-60 transition-all hover:cursor-pointer hover:border-red-500/30 hover:bg-red-500/10 hover:text-red-400 hover:opacity-100 focus-visible:opacity-100 group-hover:opacity-100",children:D?s.jsx(dt,{className:"h-3 w-3 animate-spin",strokeWidth:2}):s.jsx(Yt,{className:"h-3 w-3",strokeWidth:2})})]},T.name)})})}),s.jsx(Nr,{title:"Method distribution",icon:Vr,children:Object.keys(ae).length===0?s.jsx("p",{className:"py-2 text-center text-[12px] theme-text-faint",children:"No endpoints scanned yet"}):s.jsx("div",{className:"space-y-3",children:Object.entries(ae).sort(([,T],[,A])=>A-T).map(([T,A])=>{const S=q0(T),D=Math.round(A/Z*100);return s.jsxs("div",{children:[s.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[s.jsx("span",{className:`text-[12px] font-medium ${S.text}`,children:T}),s.jsxs("span",{className:"text-[11px] tabular-nums theme-text-muted",children:[A," ",s.jsxs("span",{className:"theme-text-faint",children:["(",D,"%)"]})]})]}),s.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full theme-bg-overlay-md",children:s.jsx("div",{className:"h-full rounded-full transition-all",style:{width:`${D}%`,background:S.dot}})})]},T)})})})]})]}),s.jsxs("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[s.jsx(Nr,{title:"Workflows",icon:_i,noPad:!0,action:s.jsxs("button",{type:"button",onClick:()=>n?.("simulations"),className:fd,children:["View all ",s.jsx(dl,{className:"h-3.5 w-3.5",strokeWidth:2})]}),children:se.length===0?s.jsx(hd,{icon:_i,msg:"No workflows found",hint:"Workflows you create will show up here."}):s.jsx("div",{className:"divide-y divide-[var(--border)]",children:se.map((T,A)=>s.jsxs("button",{type:"button",onClick:()=>n?.("simulations"),className:"group flex w-full items-center gap-3 px-4 py-2.5 text-left transition-colors hover:cursor-pointer hover:theme-bg-overlay-md",children:[s.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border theme-border theme-bg-overlay-md",children:s.jsx(hs,{className:"h-[14px] w-[14px] text-[color:var(--brand)]",strokeWidth:2})}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"truncate text-[13px] theme-text-primary",children:T.name}),s.jsxs("p",{className:"text-[11px] theme-text-faint",children:[T.steps.length," ",T.steps.length===1?"step":"steps"]})]}),s.jsx(vl,{className:"h-[15px] w-[15px] shrink-0 theme-text-faint opacity-0 transition-opacity group-hover:opacity-100",strokeWidth:2})]},T._file??A))})}),s.jsx(Nr,{title:"Runtime memory",icon:fl,noPad:!0,action:s.jsxs("button",{type:"button",onClick:()=>n?.("memory"),className:fd,children:["Inspect ",s.jsx(dl,{className:"h-3.5 w-3.5",strokeWidth:2})]}),children:_.length===0?s.jsx(hd,{icon:fl,msg:"No memory entries",hint:"Values stored at runtime appear here."}):s.jsxs("div",{className:"divide-y divide-[var(--border)]",children:[_.map((T,A)=>s.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 transition-colors hover:theme-bg-overlay-md",children:[s.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500/60"}),s.jsx("span",{className:"flex-1 truncate font-mono text-[12px] theme-text",title:T.key,children:T.key}),s.jsx("span",{className:"max-w-[120px] truncate font-mono text-[11px] theme-text-faint",children:typeof T.value=="object"?JSON.stringify(T.value):String(T.value)})]},T.key??A)),f.length>6&&s.jsxs("p",{className:"px-4 py-2.5 text-[11px] theme-text-faint",children:["+",f.length-6," more entries"]})]})})]}),s.jsxs("div",{className:"flex items-center gap-2 border-t theme-border pt-3 text-[11px] theme-text-faint",children:[s.jsx(Gr,{className:"h-[14px] w-[14px]",strokeWidth:2}),r?`Model generated ${new Date(r.generatedAt).toLocaleString()}`:"No model generated yet"]})]})]})}),k&&s.jsx(S2,{onClose:()=>R(!1),onSave:async(T,A)=>{const S=await fetch("/api/model/environments",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:T,baseUrl:A})});if(!S.ok){const L=await S.json().catch(()=>({}));throw new Error(L.error??"Failed")}const D=await S.json();o(L=>L&&{...L,environments:D.environments}),D.defaultEnvironment&&C(D.defaultEnvironment)}})]})}async function E2(n){return await fetch("/api/traces",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)}),n.id}async function xx(){try{const n=await fetch("/api/traces");if(n.ok){const r=await n.json();if(Array.isArray(r))return r}}catch{}return[]}async function k2(n){await fetch(`/api/traces/${encodeURIComponent(n)}`,{method:"DELETE"})}async function _2(){await fetch("/api/traces",{method:"DELETE"})}function Ut(n){if(typeof n=="string"||typeof n=="number")return""+n;let r="";if(Array.isArray(n))for(let o=0,i;o<n.length;o++)(i=Ut(n[o]))!==""&&(r+=(r&&" ")+i);else for(let o in n)n[o]&&(r+=(r&&" ")+o);return r}var md={exports:{}},pd={},xd={exports:{}},gd={};/**
396
396
  * @license React
397
397
  * use-sync-external-store-shim.production.js
398
398
  *
@@ -408,9 +408,9 @@ Error generating stack: `+a.message+`
408
408
  *
409
409
  * This source code is licensed under the MIT license found in the
410
410
  * LICENSE file in the root directory of this source tree.
411
- */var bx;function M2(){if(bx)return pd;bx=1;var n=Yr(),r=T2();function o(m,p){return m===p&&(m!==0||1/m===1/p)||m!==m&&p!==p}var i=typeof Object.is=="function"?Object.is:o,u=r.useSyncExternalStore,f=n.useRef,h=n.useEffect,g=n.useMemo,x=n.useDebugValue;return pd.useSyncExternalStoreWithSelector=function(m,p,b,v,N){var C=f(null);if(C.current===null){var k={hasValue:!1,value:null};C.current=k}else k=C.current;C=g(function(){function z(Z){if(!V){if(V=!0,q=Z,Z=v(Z),N!==void 0&&k.hasValue){var X=k.value;if(N(X,Z))return M=X}return M=Z}if(X=M,i(q,Z))return X;var oe=v(Z);return N!==void 0&&N(X,oe)?(q=Z,X):(q=Z,M=oe)}var V=!1,q,M,H=b===void 0?null:b;return[function(){return z(p())},H===null?void 0:function(){return z(H())}]},[p,b,v,N]);var R=u(m,C[0],C[1]);return h(function(){k.hasValue=!0,k.value=R},[R]),x(R),R},pd}var vx;function A2(){return vx||(vx=1,md.exports=M2()),md.exports}var R2=A2();const z2=S0(R2),O2={},jx=n=>{let r;const o=new Set,i=(p,b)=>{const v=typeof p=="function"?p(r):p;if(!Object.is(v,r)){const N=r;r=b??(typeof v!="object"||v===null)?v:Object.assign({},r,v),o.forEach(C=>C(r,N))}},u=()=>r,x={setState:i,getState:u,getInitialState:()=>m,subscribe:p=>(o.add(p),()=>o.delete(p)),destroy:()=>{(O2?"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."),o.clear()}},m=r=n(i,u,x);return x},D2=n=>n?jx(n):jx,{useDebugValue:H2}=le,{useSyncExternalStoreWithSelector:$2}=z2,U2=n=>n;function Y0(n,r=U2,o){const i=$2(n.subscribe,n.getState,n.getServerState||n.getInitialState,r,o);return H2(i),i}const Nx=(n,r)=>{const o=D2(n),i=(u,f=r)=>Y0(o,u,f);return Object.assign(i,o),i},B2=(n,r)=>n?Nx(n,r):Nx;function Tt(n,r){if(Object.is(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;if(n instanceof Map&&r instanceof Map){if(n.size!==r.size)return!1;for(const[i,u]of n)if(!Object.is(u,r.get(i)))return!1;return!0}if(n instanceof Set&&r instanceof Set){if(n.size!==r.size)return!1;for(const i of n)if(!r.has(i))return!1;return!0}const o=Object.keys(n);if(o.length!==Object.keys(r).length)return!1;for(const i of o)if(!Object.prototype.hasOwnProperty.call(r,i)||!Object.is(n[i],r[i]))return!1;return!0}var q2={value:()=>{}};function Gi(){for(var n=0,r=arguments.length,o={},i;n<r;++n){if(!(i=arguments[n]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new Ci(o)}function Ci(n){this._=n}function L2(n,r){return n.trim().split(/^|\s+/).map(function(o){var i="",u=o.indexOf(".");if(u>=0&&(i=o.slice(u+1),o=o.slice(0,u)),o&&!r.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Ci.prototype=Gi.prototype={constructor:Ci,on:function(n,r){var o=this._,i=L2(n+"",o),u,f=-1,h=i.length;if(arguments.length<2){for(;++f<h;)if((u=(n=i[f]).type)&&(u=Y2(o[u],n.name)))return u;return}if(r!=null&&typeof r!="function")throw new Error("invalid callback: "+r);for(;++f<h;)if(u=(n=i[f]).type)o[u]=wx(o[u],n.name,r);else if(r==null)for(u in o)o[u]=wx(o[u],n.name,null);return this},copy:function(){var n={},r=this._;for(var o in r)n[o]=r[o].slice();return new Ci(n)},call:function(n,r){if((u=arguments.length-2)>0)for(var o=new Array(u),i=0,u,f;i<u;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(f=this._[n],i=0,u=f.length;i<u;++i)f[i].value.apply(r,o)},apply:function(n,r,o){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var i=this._[n],u=0,f=i.length;u<f;++u)i[u].value.apply(r,o)}};function Y2(n,r){for(var o=0,i=n.length,u;o<i;++o)if((u=n[o]).name===r)return u.value}function wx(n,r,o){for(var i=0,u=n.length;i<u;++i)if(n[i].name===r){n[i]=q2,n=n.slice(0,i).concat(n.slice(i+1));break}return o!=null&&n.push({name:r,value:o}),n}var zd="http://www.w3.org/1999/xhtml";const Sx={svg:"http://www.w3.org/2000/svg",xhtml:zd,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Xi(n){var r=n+="",o=r.indexOf(":");return o>=0&&(r=n.slice(0,o))!=="xmlns"&&(n=n.slice(o+1)),Sx.hasOwnProperty(r)?{space:Sx[r],local:n}:n}function V2(n){return function(){var r=this.ownerDocument,o=this.namespaceURI;return o===zd&&r.documentElement.namespaceURI===zd?r.createElement(n):r.createElementNS(o,n)}}function G2(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function V0(n){var r=Xi(n);return(r.local?G2:V2)(r)}function X2(){}function tf(n){return n==null?X2:function(){return this.querySelector(n)}}function Z2(n){typeof n!="function"&&(n=tf(n));for(var r=this._groups,o=r.length,i=new Array(o),u=0;u<o;++u)for(var f=r[u],h=f.length,g=i[u]=new Array(h),x,m,p=0;p<h;++p)(x=f[p])&&(m=n.call(x,x.__data__,p,f))&&("__data__"in x&&(m.__data__=x.__data__),g[p]=m);return new rn(i,this._parents)}function W2(n){return n==null?[]:Array.isArray(n)?n:Array.from(n)}function Q2(){return[]}function G0(n){return n==null?Q2:function(){return this.querySelectorAll(n)}}function K2(n){return function(){return W2(n.apply(this,arguments))}}function J2(n){typeof n=="function"?n=K2(n):n=G0(n);for(var r=this._groups,o=r.length,i=[],u=[],f=0;f<o;++f)for(var h=r[f],g=h.length,x,m=0;m<g;++m)(x=h[m])&&(i.push(n.call(x,x.__data__,m,h)),u.push(x));return new rn(i,u)}function X0(n){return function(){return this.matches(n)}}function Z0(n){return function(r){return r.matches(n)}}var I2=Array.prototype.find;function F2(n){return function(){return I2.call(this.children,n)}}function P2(){return this.firstElementChild}function ej(n){return this.select(n==null?P2:F2(typeof n=="function"?n:Z0(n)))}var tj=Array.prototype.filter;function nj(){return Array.from(this.children)}function aj(n){return function(){return tj.call(this.children,n)}}function sj(n){return this.selectAll(n==null?nj:aj(typeof n=="function"?n:Z0(n)))}function lj(n){typeof n!="function"&&(n=X0(n));for(var r=this._groups,o=r.length,i=new Array(o),u=0;u<o;++u)for(var f=r[u],h=f.length,g=i[u]=[],x,m=0;m<h;++m)(x=f[m])&&n.call(x,x.__data__,m,f)&&g.push(x);return new rn(i,this._parents)}function W0(n){return new Array(n.length)}function rj(){return new rn(this._enter||this._groups.map(W0),this._parents)}function Oi(n,r){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=r}Oi.prototype={constructor:Oi,appendChild:function(n){return this._parent.insertBefore(n,this._next)},insertBefore:function(n,r){return this._parent.insertBefore(n,r)},querySelector:function(n){return this._parent.querySelector(n)},querySelectorAll:function(n){return this._parent.querySelectorAll(n)}};function oj(n){return function(){return n}}function ij(n,r,o,i,u,f){for(var h=0,g,x=r.length,m=f.length;h<m;++h)(g=r[h])?(g.__data__=f[h],i[h]=g):o[h]=new Oi(n,f[h]);for(;h<x;++h)(g=r[h])&&(u[h]=g)}function cj(n,r,o,i,u,f,h){var g,x,m=new Map,p=r.length,b=f.length,v=new Array(p),N;for(g=0;g<p;++g)(x=r[g])&&(v[g]=N=h.call(x,x.__data__,g,r)+"",m.has(N)?u[g]=x:m.set(N,x));for(g=0;g<b;++g)N=h.call(n,f[g],g,f)+"",(x=m.get(N))?(i[g]=x,x.__data__=f[g],m.delete(N)):o[g]=new Oi(n,f[g]);for(g=0;g<p;++g)(x=r[g])&&m.get(v[g])===x&&(u[g]=x)}function uj(n){return n.__data__}function dj(n,r){if(!arguments.length)return Array.from(this,uj);var o=r?cj:ij,i=this._parents,u=this._groups;typeof n!="function"&&(n=oj(n));for(var f=u.length,h=new Array(f),g=new Array(f),x=new Array(f),m=0;m<f;++m){var p=i[m],b=u[m],v=b.length,N=fj(n.call(p,p&&p.__data__,m,i)),C=N.length,k=g[m]=new Array(C),R=h[m]=new Array(C),z=x[m]=new Array(v);o(p,b,k,R,z,N,r);for(var V=0,q=0,M,H;V<C;++V)if(M=k[V]){for(V>=q&&(q=V+1);!(H=R[q])&&++q<C;);M._next=H||null}}return h=new rn(h,i),h._enter=g,h._exit=x,h}function fj(n){return typeof n=="object"&&"length"in n?n:Array.from(n)}function hj(){return new rn(this._exit||this._groups.map(W0),this._parents)}function mj(n,r,o){var i=this.enter(),u=this,f=this.exit();return typeof n=="function"?(i=n(i),i&&(i=i.selection())):i=i.append(n+""),r!=null&&(u=r(u),u&&(u=u.selection())),o==null?f.remove():o(f),i&&u?i.merge(u).order():u}function pj(n){for(var r=n.selection?n.selection():n,o=this._groups,i=r._groups,u=o.length,f=i.length,h=Math.min(u,f),g=new Array(u),x=0;x<h;++x)for(var m=o[x],p=i[x],b=m.length,v=g[x]=new Array(b),N,C=0;C<b;++C)(N=m[C]||p[C])&&(v[C]=N);for(;x<u;++x)g[x]=o[x];return new rn(g,this._parents)}function xj(){for(var n=this._groups,r=-1,o=n.length;++r<o;)for(var i=n[r],u=i.length-1,f=i[u],h;--u>=0;)(h=i[u])&&(f&&h.compareDocumentPosition(f)^4&&f.parentNode.insertBefore(h,f),f=h);return this}function gj(n){n||(n=yj);function r(b,v){return b&&v?n(b.__data__,v.__data__):!b-!v}for(var o=this._groups,i=o.length,u=new Array(i),f=0;f<i;++f){for(var h=o[f],g=h.length,x=u[f]=new Array(g),m,p=0;p<g;++p)(m=h[p])&&(x[p]=m);x.sort(r)}return new rn(u,this._parents).order()}function yj(n,r){return n<r?-1:n>r?1:n>=r?0:NaN}function bj(){var n=arguments[0];return arguments[0]=this,n.apply(null,arguments),this}function vj(){return Array.from(this)}function jj(){for(var n=this._groups,r=0,o=n.length;r<o;++r)for(var i=n[r],u=0,f=i.length;u<f;++u){var h=i[u];if(h)return h}return null}function Nj(){let n=0;for(const r of this)++n;return n}function wj(){return!this.node()}function Sj(n){for(var r=this._groups,o=0,i=r.length;o<i;++o)for(var u=r[o],f=0,h=u.length,g;f<h;++f)(g=u[f])&&n.call(g,g.__data__,f,u);return this}function Ej(n){return function(){this.removeAttribute(n)}}function kj(n){return function(){this.removeAttributeNS(n.space,n.local)}}function _j(n,r){return function(){this.setAttribute(n,r)}}function Cj(n,r){return function(){this.setAttributeNS(n.space,n.local,r)}}function Tj(n,r){return function(){var o=r.apply(this,arguments);o==null?this.removeAttribute(n):this.setAttribute(n,o)}}function Mj(n,r){return function(){var o=r.apply(this,arguments);o==null?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,o)}}function Aj(n,r){var o=Xi(n);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((r==null?o.local?kj:Ej:typeof r=="function"?o.local?Mj:Tj:o.local?Cj:_j)(o,r))}function Q0(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function Rj(n){return function(){this.style.removeProperty(n)}}function zj(n,r,o){return function(){this.style.setProperty(n,r,o)}}function Oj(n,r,o){return function(){var i=r.apply(this,arguments);i==null?this.style.removeProperty(n):this.style.setProperty(n,i,o)}}function Dj(n,r,o){return arguments.length>1?this.each((r==null?Rj:typeof r=="function"?Oj:zj)(n,r,o??"")):xl(this.node(),n)}function xl(n,r){return n.style.getPropertyValue(r)||Q0(n).getComputedStyle(n,null).getPropertyValue(r)}function Hj(n){return function(){delete this[n]}}function $j(n,r){return function(){this[n]=r}}function Uj(n,r){return function(){var o=r.apply(this,arguments);o==null?delete this[n]:this[n]=o}}function Bj(n,r){return arguments.length>1?this.each((r==null?Hj:typeof r=="function"?Uj:$j)(n,r)):this.node()[n]}function K0(n){return n.trim().split(/^|\s+/)}function nf(n){return n.classList||new J0(n)}function J0(n){this._node=n,this._names=K0(n.getAttribute("class")||"")}J0.prototype={add:function(n){var r=this._names.indexOf(n);r<0&&(this._names.push(n),this._node.setAttribute("class",this._names.join(" ")))},remove:function(n){var r=this._names.indexOf(n);r>=0&&(this._names.splice(r,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};function I0(n,r){for(var o=nf(n),i=-1,u=r.length;++i<u;)o.add(r[i])}function F0(n,r){for(var o=nf(n),i=-1,u=r.length;++i<u;)o.remove(r[i])}function qj(n){return function(){I0(this,n)}}function Lj(n){return function(){F0(this,n)}}function Yj(n,r){return function(){(r.apply(this,arguments)?I0:F0)(this,n)}}function Vj(n,r){var o=K0(n+"");if(arguments.length<2){for(var i=nf(this.node()),u=-1,f=o.length;++u<f;)if(!i.contains(o[u]))return!1;return!0}return this.each((typeof r=="function"?Yj:r?qj:Lj)(o,r))}function Gj(){this.textContent=""}function Xj(n){return function(){this.textContent=n}}function Zj(n){return function(){var r=n.apply(this,arguments);this.textContent=r??""}}function Wj(n){return arguments.length?this.each(n==null?Gj:(typeof n=="function"?Zj:Xj)(n)):this.node().textContent}function Qj(){this.innerHTML=""}function Kj(n){return function(){this.innerHTML=n}}function Jj(n){return function(){var r=n.apply(this,arguments);this.innerHTML=r??""}}function Ij(n){return arguments.length?this.each(n==null?Qj:(typeof n=="function"?Jj:Kj)(n)):this.node().innerHTML}function Fj(){this.nextSibling&&this.parentNode.appendChild(this)}function Pj(){return this.each(Fj)}function eN(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function tN(){return this.each(eN)}function nN(n){var r=typeof n=="function"?n:V0(n);return this.select(function(){return this.appendChild(r.apply(this,arguments))})}function aN(){return null}function sN(n,r){var o=typeof n=="function"?n:V0(n),i=r==null?aN:typeof r=="function"?r:tf(r);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function lN(){var n=this.parentNode;n&&n.removeChild(this)}function rN(){return this.each(lN)}function oN(){var n=this.cloneNode(!1),r=this.parentNode;return r?r.insertBefore(n,this.nextSibling):n}function iN(){var n=this.cloneNode(!0),r=this.parentNode;return r?r.insertBefore(n,this.nextSibling):n}function cN(n){return this.select(n?iN:oN)}function uN(n){return arguments.length?this.property("__data__",n):this.node().__data__}function dN(n){return function(r){n.call(this,r,this.__data__)}}function fN(n){return n.trim().split(/^|\s+/).map(function(r){var o="",i=r.indexOf(".");return i>=0&&(o=r.slice(i+1),r=r.slice(0,i)),{type:r,name:o}})}function hN(n){return function(){var r=this.__on;if(r){for(var o=0,i=-1,u=r.length,f;o<u;++o)f=r[o],(!n.type||f.type===n.type)&&f.name===n.name?this.removeEventListener(f.type,f.listener,f.options):r[++i]=f;++i?r.length=i:delete this.__on}}}function mN(n,r,o){return function(){var i=this.__on,u,f=dN(r);if(i){for(var h=0,g=i.length;h<g;++h)if((u=i[h]).type===n.type&&u.name===n.name){this.removeEventListener(u.type,u.listener,u.options),this.addEventListener(u.type,u.listener=f,u.options=o),u.value=r;return}}this.addEventListener(n.type,f,o),u={type:n.type,name:n.name,value:r,listener:f,options:o},i?i.push(u):this.__on=[u]}}function pN(n,r,o){var i=fN(n+""),u,f=i.length,h;if(arguments.length<2){var g=this.node().__on;if(g){for(var x=0,m=g.length,p;x<m;++x)for(u=0,p=g[x];u<f;++u)if((h=i[u]).type===p.type&&h.name===p.name)return p.value}return}for(g=r?mN:hN,u=0;u<f;++u)this.each(g(i[u],r,o));return this}function P0(n,r,o){var i=Q0(n),u=i.CustomEvent;typeof u=="function"?u=new u(r,o):(u=i.document.createEvent("Event"),o?(u.initEvent(r,o.bubbles,o.cancelable),u.detail=o.detail):u.initEvent(r,!1,!1)),n.dispatchEvent(u)}function xN(n,r){return function(){return P0(this,n,r)}}function gN(n,r){return function(){return P0(this,n,r.apply(this,arguments))}}function yN(n,r){return this.each((typeof r=="function"?gN:xN)(n,r))}function*bN(){for(var n=this._groups,r=0,o=n.length;r<o;++r)for(var i=n[r],u=0,f=i.length,h;u<f;++u)(h=i[u])&&(yield h)}var eg=[null];function rn(n,r){this._groups=n,this._parents=r}function Xr(){return new rn([[document.documentElement]],eg)}function vN(){return this}rn.prototype=Xr.prototype={constructor:rn,select:Z2,selectAll:J2,selectChild:ej,selectChildren:sj,filter:lj,data:dj,enter:rj,exit:hj,join:mj,merge:pj,selection:vN,order:xj,sort:gj,call:bj,nodes:vj,node:jj,size:Nj,empty:wj,each:Sj,attr:Aj,style:Dj,property:Bj,classed:Vj,text:Wj,html:Ij,raise:Pj,lower:tN,append:nN,insert:sN,remove:rN,clone:cN,datum:uN,on:pN,dispatch:yN,[Symbol.iterator]:bN};function gn(n){return typeof n=="string"?new rn([[document.querySelector(n)]],[document.documentElement]):new rn([[n]],eg)}function jN(n){let r;for(;r=n.sourceEvent;)n=r;return n}function Sn(n,r){if(n=jN(n),r===void 0&&(r=n.currentTarget),r){var o=r.ownerSVGElement||r;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=n.clientX,i.y=n.clientY,i=i.matrixTransform(r.getScreenCTM().inverse()),[i.x,i.y]}if(r.getBoundingClientRect){var u=r.getBoundingClientRect();return[n.clientX-u.left-r.clientLeft,n.clientY-u.top-r.clientTop]}}return[n.pageX,n.pageY]}const NN={passive:!1},Or={capture:!0,passive:!1};function yd(n){n.stopImmediatePropagation()}function hl(n){n.preventDefault(),n.stopImmediatePropagation()}function tg(n){var r=n.document.documentElement,o=gn(n).on("dragstart.drag",hl,Or);"onselectstart"in r?o.on("selectstart.drag",hl,Or):(r.__noselect=r.style.MozUserSelect,r.style.MozUserSelect="none")}function ng(n,r){var o=n.document.documentElement,i=gn(n).on("dragstart.drag",null);r&&(i.on("click.drag",hl,Or),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}const mi=n=>()=>n;function Od(n,{sourceEvent:r,subject:o,target:i,identifier:u,active:f,x:h,y:g,dx:x,dy:m,dispatch:p}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:u,enumerable:!0,configurable:!0},active:{value:f,enumerable:!0,configurable:!0},x:{value:h,enumerable:!0,configurable:!0},y:{value:g,enumerable:!0,configurable:!0},dx:{value:x,enumerable:!0,configurable:!0},dy:{value:m,enumerable:!0,configurable:!0},_:{value:p}})}Od.prototype.on=function(){var n=this._.on.apply(this._,arguments);return n===this._?this:n};function wN(n){return!n.ctrlKey&&!n.button}function SN(){return this.parentNode}function EN(n,r){return r??{x:n.x,y:n.y}}function kN(){return navigator.maxTouchPoints||"ontouchstart"in this}function _N(){var n=wN,r=SN,o=EN,i=kN,u={},f=Gi("start","drag","end"),h=0,g,x,m,p,b=0;function v(M){M.on("mousedown.drag",N).filter(i).on("touchstart.drag",R).on("touchmove.drag",z,NN).on("touchend.drag touchcancel.drag",V).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function N(M,H){if(!(p||!n.call(this,M,H))){var Z=q(this,r.call(this,M,H),M,H,"mouse");Z&&(gn(M.view).on("mousemove.drag",C,Or).on("mouseup.drag",k,Or),tg(M.view),yd(M),m=!1,g=M.clientX,x=M.clientY,Z("start",M))}}function C(M){if(hl(M),!m){var H=M.clientX-g,Z=M.clientY-x;m=H*H+Z*Z>b}u.mouse("drag",M)}function k(M){gn(M.view).on("mousemove.drag mouseup.drag",null),ng(M.view,m),hl(M),u.mouse("end",M)}function R(M,H){if(n.call(this,M,H)){var Z=M.changedTouches,X=r.call(this,M,H),oe=Z.length,I,K;for(I=0;I<oe;++I)(K=q(this,X,M,H,Z[I].identifier,Z[I]))&&(yd(M),K("start",M,Z[I]))}}function z(M){var H=M.changedTouches,Z=H.length,X,oe;for(X=0;X<Z;++X)(oe=u[H[X].identifier])&&(hl(M),oe("drag",M,H[X]))}function V(M){var H=M.changedTouches,Z=H.length,X,oe;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),X=0;X<Z;++X)(oe=u[H[X].identifier])&&(yd(M),oe("end",M,H[X]))}function q(M,H,Z,X,oe,I){var K=f.copy(),ae=Sn(I||Z,H),te,se,_;if((_=o.call(M,new Od("beforestart",{sourceEvent:Z,target:v,identifier:oe,active:h,x:ae[0],y:ae[1],dx:0,dy:0,dispatch:K}),X))!=null)return te=_.x-ae[0]||0,se=_.y-ae[1]||0,function W(E,$,T){var A=ae,S;switch(E){case"start":u[oe]=W,S=h++;break;case"end":delete u[oe],--h;case"drag":ae=Sn(T||$,H),S=h;break}K.call(E,M,new Od(E,{sourceEvent:$,subject:_,target:v,identifier:oe,active:S,x:ae[0]+te,y:ae[1]+se,dx:ae[0]-A[0],dy:ae[1]-A[1],dispatch:K}),X)}}return v.filter=function(M){return arguments.length?(n=typeof M=="function"?M:mi(!!M),v):n},v.container=function(M){return arguments.length?(r=typeof M=="function"?M:mi(M),v):r},v.subject=function(M){return arguments.length?(o=typeof M=="function"?M:mi(M),v):o},v.touchable=function(M){return arguments.length?(i=typeof M=="function"?M:mi(!!M),v):i},v.on=function(){var M=f.on.apply(f,arguments);return M===f?v:M},v.clickDistance=function(M){return arguments.length?(b=(M=+M)*M,v):Math.sqrt(b)},v}function af(n,r,o){n.prototype=r.prototype=o,o.constructor=n}function ag(n,r){var o=Object.create(n.prototype);for(var i in r)o[i]=r[i];return o}function Zr(){}var Dr=.7,Di=1/Dr,ml="\\s*([+-]?\\d+)\\s*",Hr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",zn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",CN=/^#([0-9a-f]{3,8})$/,TN=new RegExp(`^rgb\\(${ml},${ml},${ml}\\)$`),MN=new RegExp(`^rgb\\(${zn},${zn},${zn}\\)$`),AN=new RegExp(`^rgba\\(${ml},${ml},${ml},${Hr}\\)$`),RN=new RegExp(`^rgba\\(${zn},${zn},${zn},${Hr}\\)$`),zN=new RegExp(`^hsl\\(${Hr},${zn},${zn}\\)$`),ON=new RegExp(`^hsla\\(${Hr},${zn},${zn},${Hr}\\)$`),Ex={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};af(Zr,$r,{copy(n){return Object.assign(new this.constructor,this,n)},displayable(){return this.rgb().displayable()},hex:kx,formatHex:kx,formatHex8:DN,formatHsl:HN,formatRgb:_x,toString:_x});function kx(){return this.rgb().formatHex()}function DN(){return this.rgb().formatHex8()}function HN(){return sg(this).formatHsl()}function _x(){return this.rgb().formatRgb()}function $r(n){var r,o;return n=(n+"").trim().toLowerCase(),(r=CN.exec(n))?(o=r[1].length,r=parseInt(r[1],16),o===6?Cx(r):o===3?new Kt(r>>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):o===8?pi(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):o===4?pi(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=TN.exec(n))?new Kt(r[1],r[2],r[3],1):(r=MN.exec(n))?new Kt(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=AN.exec(n))?pi(r[1],r[2],r[3],r[4]):(r=RN.exec(n))?pi(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=zN.exec(n))?Ax(r[1],r[2]/100,r[3]/100,1):(r=ON.exec(n))?Ax(r[1],r[2]/100,r[3]/100,r[4]):Ex.hasOwnProperty(n)?Cx(Ex[n]):n==="transparent"?new Kt(NaN,NaN,NaN,0):null}function Cx(n){return new Kt(n>>16&255,n>>8&255,n&255,1)}function pi(n,r,o,i){return i<=0&&(n=r=o=NaN),new Kt(n,r,o,i)}function $N(n){return n instanceof Zr||(n=$r(n)),n?(n=n.rgb(),new Kt(n.r,n.g,n.b,n.opacity)):new Kt}function Dd(n,r,o,i){return arguments.length===1?$N(n):new Kt(n,r,o,i??1)}function Kt(n,r,o,i){this.r=+n,this.g=+r,this.b=+o,this.opacity=+i}af(Kt,Dd,ag(Zr,{brighter(n){return n=n==null?Di:Math.pow(Di,n),new Kt(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=n==null?Dr:Math.pow(Dr,n),new Kt(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new Kt(ds(this.r),ds(this.g),ds(this.b),Hi(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:Tx,formatHex:Tx,formatHex8:UN,formatRgb:Mx,toString:Mx}));function Tx(){return`#${cs(this.r)}${cs(this.g)}${cs(this.b)}`}function UN(){return`#${cs(this.r)}${cs(this.g)}${cs(this.b)}${cs((isNaN(this.opacity)?1:this.opacity)*255)}`}function Mx(){const n=Hi(this.opacity);return`${n===1?"rgb(":"rgba("}${ds(this.r)}, ${ds(this.g)}, ${ds(this.b)}${n===1?")":`, ${n})`}`}function Hi(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function ds(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function cs(n){return n=ds(n),(n<16?"0":"")+n.toString(16)}function Ax(n,r,o,i){return i<=0?n=r=o=NaN:o<=0||o>=1?n=r=NaN:r<=0&&(n=NaN),new En(n,r,o,i)}function sg(n){if(n instanceof En)return new En(n.h,n.s,n.l,n.opacity);if(n instanceof Zr||(n=$r(n)),!n)return new En;if(n instanceof En)return n;n=n.rgb();var r=n.r/255,o=n.g/255,i=n.b/255,u=Math.min(r,o,i),f=Math.max(r,o,i),h=NaN,g=f-u,x=(f+u)/2;return g?(r===f?h=(o-i)/g+(o<i)*6:o===f?h=(i-r)/g+2:h=(r-o)/g+4,g/=x<.5?f+u:2-f-u,h*=60):g=x>0&&x<1?0:h,new En(h,g,x,n.opacity)}function BN(n,r,o,i){return arguments.length===1?sg(n):new En(n,r,o,i??1)}function En(n,r,o,i){this.h=+n,this.s=+r,this.l=+o,this.opacity=+i}af(En,BN,ag(Zr,{brighter(n){return n=n==null?Di:Math.pow(Di,n),new En(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?Dr:Math.pow(Dr,n),new En(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+(this.h<0)*360,r=isNaN(n)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*r,u=2*o-i;return new Kt(bd(n>=240?n-240:n+120,u,i),bd(n,u,i),bd(n<120?n+240:n-120,u,i),this.opacity)},clamp(){return new En(Rx(this.h),xi(this.s),xi(this.l),Hi(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 n=Hi(this.opacity);return`${n===1?"hsl(":"hsla("}${Rx(this.h)}, ${xi(this.s)*100}%, ${xi(this.l)*100}%${n===1?")":`, ${n})`}`}}));function Rx(n){return n=(n||0)%360,n<0?n+360:n}function xi(n){return Math.max(0,Math.min(1,n||0))}function bd(n,r,o){return(n<60?r+(o-r)*n/60:n<180?o:n<240?r+(o-r)*(240-n)/60:r)*255}const lg=n=>()=>n;function qN(n,r){return function(o){return n+o*r}}function LN(n,r,o){return n=Math.pow(n,o),r=Math.pow(r,o)-n,o=1/o,function(i){return Math.pow(n+i*r,o)}}function YN(n){return(n=+n)==1?rg:function(r,o){return o-r?LN(r,o,n):lg(isNaN(r)?o:r)}}function rg(n,r){var o=r-n;return o?qN(n,o):lg(isNaN(n)?r:n)}const zx=(function n(r){var o=YN(r);function i(u,f){var h=o((u=Dd(u)).r,(f=Dd(f)).r),g=o(u.g,f.g),x=o(u.b,f.b),m=rg(u.opacity,f.opacity);return function(p){return u.r=h(p),u.g=g(p),u.b=x(p),u.opacity=m(p),u+""}}return i.gamma=n,i})(1);function Da(n,r){return n=+n,r=+r,function(o){return n*(1-o)+r*o}}var Hd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vd=new RegExp(Hd.source,"g");function VN(n){return function(){return n}}function GN(n){return function(r){return n(r)+""}}function XN(n,r){var o=Hd.lastIndex=vd.lastIndex=0,i,u,f,h=-1,g=[],x=[];for(n=n+"",r=r+"";(i=Hd.exec(n))&&(u=vd.exec(r));)(f=u.index)>o&&(f=r.slice(o,f),g[h]?g[h]+=f:g[++h]=f),(i=i[0])===(u=u[0])?g[h]?g[h]+=u:g[++h]=u:(g[++h]=null,x.push({i:h,x:Da(i,u)})),o=vd.lastIndex;return o<r.length&&(f=r.slice(o),g[h]?g[h]+=f:g[++h]=f),g.length<2?x[0]?GN(x[0].x):VN(r):(r=x.length,function(m){for(var p=0,b;p<r;++p)g[(b=x[p]).i]=b.x(m);return g.join("")})}var Ox=180/Math.PI,$d={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function og(n,r,o,i,u,f){var h,g,x;return(h=Math.sqrt(n*n+r*r))&&(n/=h,r/=h),(x=n*o+r*i)&&(o-=n*x,i-=r*x),(g=Math.sqrt(o*o+i*i))&&(o/=g,i/=g,x/=g),n*i<r*o&&(n=-n,r=-r,x=-x,h=-h),{translateX:u,translateY:f,rotate:Math.atan2(r,n)*Ox,skewX:Math.atan(x)*Ox,scaleX:h,scaleY:g}}var gi;function ZN(n){const r=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(n+"");return r.isIdentity?$d:og(r.a,r.b,r.c,r.d,r.e,r.f)}function WN(n){return n==null||(gi||(gi=document.createElementNS("http://www.w3.org/2000/svg","g")),gi.setAttribute("transform",n),!(n=gi.transform.baseVal.consolidate()))?$d:(n=n.matrix,og(n.a,n.b,n.c,n.d,n.e,n.f))}function ig(n,r,o,i){function u(m){return m.length?m.pop()+" ":""}function f(m,p,b,v,N,C){if(m!==b||p!==v){var k=N.push("translate(",null,r,null,o);C.push({i:k-4,x:Da(m,b)},{i:k-2,x:Da(p,v)})}else(b||v)&&N.push("translate("+b+r+v+o)}function h(m,p,b,v){m!==p?(m-p>180?p+=360:p-m>180&&(m+=360),v.push({i:b.push(u(b)+"rotate(",null,i)-2,x:Da(m,p)})):p&&b.push(u(b)+"rotate("+p+i)}function g(m,p,b,v){m!==p?v.push({i:b.push(u(b)+"skewX(",null,i)-2,x:Da(m,p)}):p&&b.push(u(b)+"skewX("+p+i)}function x(m,p,b,v,N,C){if(m!==b||p!==v){var k=N.push(u(N)+"scale(",null,",",null,")");C.push({i:k-4,x:Da(m,b)},{i:k-2,x:Da(p,v)})}else(b!==1||v!==1)&&N.push(u(N)+"scale("+b+","+v+")")}return function(m,p){var b=[],v=[];return m=n(m),p=n(p),f(m.translateX,m.translateY,p.translateX,p.translateY,b,v),h(m.rotate,p.rotate,b,v),g(m.skewX,p.skewX,b,v),x(m.scaleX,m.scaleY,p.scaleX,p.scaleY,b,v),m=p=null,function(N){for(var C=-1,k=v.length,R;++C<k;)b[(R=v[C]).i]=R.x(N);return b.join("")}}}var QN=ig(ZN,"px, ","px)","deg)"),KN=ig(WN,", ",")",")"),JN=1e-12;function Dx(n){return((n=Math.exp(n))+1/n)/2}function IN(n){return((n=Math.exp(n))-1/n)/2}function FN(n){return((n=Math.exp(2*n))-1)/(n+1)}const PN=(function n(r,o,i){function u(f,h){var g=f[0],x=f[1],m=f[2],p=h[0],b=h[1],v=h[2],N=p-g,C=b-x,k=N*N+C*C,R,z;if(k<JN)z=Math.log(v/m)/r,R=function(X){return[g+X*N,x+X*C,m*Math.exp(r*X*z)]};else{var V=Math.sqrt(k),q=(v*v-m*m+i*k)/(2*m*o*V),M=(v*v-m*m-i*k)/(2*v*o*V),H=Math.log(Math.sqrt(q*q+1)-q),Z=Math.log(Math.sqrt(M*M+1)-M);z=(Z-H)/r,R=function(X){var oe=X*z,I=Dx(H),K=m/(o*V)*(I*FN(r*oe+H)-IN(H));return[g+K*N,x+K*C,m*I/Dx(r*oe+H)]}}return R.duration=z*1e3*r/Math.SQRT2,R}return u.rho=function(f){var h=Math.max(.001,+f),g=h*h,x=g*g;return n(h,g,x)},u})(Math.SQRT2,2,4);var gl=0,Tr=0,wr=0,cg=1e3,$i,Mr,Ui=0,ms=0,Zi=0,Ur=typeof performance=="object"&&performance.now?performance:Date,ug=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function sf(){return ms||(ug(ew),ms=Ur.now()+Zi)}function ew(){ms=0}function Bi(){this._call=this._time=this._next=null}Bi.prototype=dg.prototype={constructor:Bi,restart:function(n,r,o){if(typeof n!="function")throw new TypeError("callback is not a function");o=(o==null?sf():+o)+(r==null?0:+r),!this._next&&Mr!==this&&(Mr?Mr._next=this:$i=this,Mr=this),this._call=n,this._time=o,Ud()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ud())}};function dg(n,r,o){var i=new Bi;return i.restart(n,r,o),i}function tw(){sf(),++gl;for(var n=$i,r;n;)(r=ms-n._time)>=0&&n._call.call(void 0,r),n=n._next;--gl}function Hx(){ms=(Ui=Ur.now())+Zi,gl=Tr=0;try{tw()}finally{gl=0,aw(),ms=0}}function nw(){var n=Ur.now(),r=n-Ui;r>cg&&(Zi-=r,Ui=n)}function aw(){for(var n,r=$i,o,i=1/0;r;)r._call?(i>r._time&&(i=r._time),n=r,r=r._next):(o=r._next,r._next=null,r=n?n._next=o:$i=o);Mr=n,Ud(i)}function Ud(n){if(!gl){Tr&&(Tr=clearTimeout(Tr));var r=n-ms;r>24?(n<1/0&&(Tr=setTimeout(Hx,n-Ur.now()-Zi)),wr&&(wr=clearInterval(wr))):(wr||(Ui=Ur.now(),wr=setInterval(nw,cg)),gl=1,ug(Hx))}}function $x(n,r,o){var i=new Bi;return r=r==null?0:+r,i.restart(u=>{i.stop(),n(u+r)},r,o),i}var sw=Gi("start","end","cancel","interrupt"),lw=[],fg=0,Ux=1,Bd=2,Ti=3,Bx=4,qd=5,Mi=6;function Wi(n,r,o,i,u,f){var h=n.__transition;if(!h)n.__transition={};else if(o in h)return;rw(n,o,{name:r,index:i,group:u,on:sw,tween:lw,time:f.time,delay:f.delay,duration:f.duration,ease:f.ease,timer:null,state:fg})}function lf(n,r){var o=kn(n,r);if(o.state>fg)throw new Error("too late; already scheduled");return o}function On(n,r){var o=kn(n,r);if(o.state>Ti)throw new Error("too late; already running");return o}function kn(n,r){var o=n.__transition;if(!o||!(o=o[r]))throw new Error("transition not found");return o}function rw(n,r,o){var i=n.__transition,u;i[r]=o,o.timer=dg(f,0,o.time);function f(m){o.state=Ux,o.timer.restart(h,o.delay,o.time),o.delay<=m&&h(m-o.delay)}function h(m){var p,b,v,N;if(o.state!==Ux)return x();for(p in i)if(N=i[p],N.name===o.name){if(N.state===Ti)return $x(h);N.state===Bx?(N.state=Mi,N.timer.stop(),N.on.call("interrupt",n,n.__data__,N.index,N.group),delete i[p]):+p<r&&(N.state=Mi,N.timer.stop(),N.on.call("cancel",n,n.__data__,N.index,N.group),delete i[p])}if($x(function(){o.state===Ti&&(o.state=Bx,o.timer.restart(g,o.delay,o.time),g(m))}),o.state=Bd,o.on.call("start",n,n.__data__,o.index,o.group),o.state===Bd){for(o.state=Ti,u=new Array(v=o.tween.length),p=0,b=-1;p<v;++p)(N=o.tween[p].value.call(n,n.__data__,o.index,o.group))&&(u[++b]=N);u.length=b+1}}function g(m){for(var p=m<o.duration?o.ease.call(null,m/o.duration):(o.timer.restart(x),o.state=qd,1),b=-1,v=u.length;++b<v;)u[b].call(n,p);o.state===qd&&(o.on.call("end",n,n.__data__,o.index,o.group),x())}function x(){o.state=Mi,o.timer.stop(),delete i[r];for(var m in i)return;delete n.__transition}}function Ai(n,r){var o=n.__transition,i,u,f=!0,h;if(o){r=r==null?null:r+"";for(h in o){if((i=o[h]).name!==r){f=!1;continue}u=i.state>Bd&&i.state<qd,i.state=Mi,i.timer.stop(),i.on.call(u?"interrupt":"cancel",n,n.__data__,i.index,i.group),delete o[h]}f&&delete n.__transition}}function ow(n){return this.each(function(){Ai(this,n)})}function iw(n,r){var o,i;return function(){var u=On(this,n),f=u.tween;if(f!==o){i=o=f;for(var h=0,g=i.length;h<g;++h)if(i[h].name===r){i=i.slice(),i.splice(h,1);break}}u.tween=i}}function cw(n,r,o){var i,u;if(typeof o!="function")throw new Error;return function(){var f=On(this,n),h=f.tween;if(h!==i){u=(i=h).slice();for(var g={name:r,value:o},x=0,m=u.length;x<m;++x)if(u[x].name===r){u[x]=g;break}x===m&&u.push(g)}f.tween=u}}function uw(n,r){var o=this._id;if(n+="",arguments.length<2){for(var i=kn(this.node(),o).tween,u=0,f=i.length,h;u<f;++u)if((h=i[u]).name===n)return h.value;return null}return this.each((r==null?iw:cw)(o,n,r))}function rf(n,r,o){var i=n._id;return n.each(function(){var u=On(this,i);(u.value||(u.value={}))[r]=o.apply(this,arguments)}),function(u){return kn(u,i).value[r]}}function hg(n,r){var o;return(typeof r=="number"?Da:r instanceof $r?zx:(o=$r(r))?(r=o,zx):XN)(n,r)}function dw(n){return function(){this.removeAttribute(n)}}function fw(n){return function(){this.removeAttributeNS(n.space,n.local)}}function hw(n,r,o){var i,u=o+"",f;return function(){var h=this.getAttribute(n);return h===u?null:h===i?f:f=r(i=h,o)}}function mw(n,r,o){var i,u=o+"",f;return function(){var h=this.getAttributeNS(n.space,n.local);return h===u?null:h===i?f:f=r(i=h,o)}}function pw(n,r,o){var i,u,f;return function(){var h,g=o(this),x;return g==null?void this.removeAttribute(n):(h=this.getAttribute(n),x=g+"",h===x?null:h===i&&x===u?f:(u=x,f=r(i=h,g)))}}function xw(n,r,o){var i,u,f;return function(){var h,g=o(this),x;return g==null?void this.removeAttributeNS(n.space,n.local):(h=this.getAttributeNS(n.space,n.local),x=g+"",h===x?null:h===i&&x===u?f:(u=x,f=r(i=h,g)))}}function gw(n,r){var o=Xi(n),i=o==="transform"?KN:hg;return this.attrTween(n,typeof r=="function"?(o.local?xw:pw)(o,i,rf(this,"attr."+n,r)):r==null?(o.local?fw:dw)(o):(o.local?mw:hw)(o,i,r))}function yw(n,r){return function(o){this.setAttribute(n,r.call(this,o))}}function bw(n,r){return function(o){this.setAttributeNS(n.space,n.local,r.call(this,o))}}function vw(n,r){var o,i;function u(){var f=r.apply(this,arguments);return f!==i&&(o=(i=f)&&bw(n,f)),o}return u._value=r,u}function jw(n,r){var o,i;function u(){var f=r.apply(this,arguments);return f!==i&&(o=(i=f)&&yw(n,f)),o}return u._value=r,u}function Nw(n,r){var o="attr."+n;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(r==null)return this.tween(o,null);if(typeof r!="function")throw new Error;var i=Xi(n);return this.tween(o,(i.local?vw:jw)(i,r))}function ww(n,r){return function(){lf(this,n).delay=+r.apply(this,arguments)}}function Sw(n,r){return r=+r,function(){lf(this,n).delay=r}}function Ew(n){var r=this._id;return arguments.length?this.each((typeof n=="function"?ww:Sw)(r,n)):kn(this.node(),r).delay}function kw(n,r){return function(){On(this,n).duration=+r.apply(this,arguments)}}function _w(n,r){return r=+r,function(){On(this,n).duration=r}}function Cw(n){var r=this._id;return arguments.length?this.each((typeof n=="function"?kw:_w)(r,n)):kn(this.node(),r).duration}function Tw(n,r){if(typeof r!="function")throw new Error;return function(){On(this,n).ease=r}}function Mw(n){var r=this._id;return arguments.length?this.each(Tw(r,n)):kn(this.node(),r).ease}function Aw(n,r){return function(){var o=r.apply(this,arguments);if(typeof o!="function")throw new Error;On(this,n).ease=o}}function Rw(n){if(typeof n!="function")throw new Error;return this.each(Aw(this._id,n))}function zw(n){typeof n!="function"&&(n=X0(n));for(var r=this._groups,o=r.length,i=new Array(o),u=0;u<o;++u)for(var f=r[u],h=f.length,g=i[u]=[],x,m=0;m<h;++m)(x=f[m])&&n.call(x,x.__data__,m,f)&&g.push(x);return new aa(i,this._parents,this._name,this._id)}function Ow(n){if(n._id!==this._id)throw new Error;for(var r=this._groups,o=n._groups,i=r.length,u=o.length,f=Math.min(i,u),h=new Array(i),g=0;g<f;++g)for(var x=r[g],m=o[g],p=x.length,b=h[g]=new Array(p),v,N=0;N<p;++N)(v=x[N]||m[N])&&(b[N]=v);for(;g<i;++g)h[g]=r[g];return new aa(h,this._parents,this._name,this._id)}function Dw(n){return(n+"").trim().split(/^|\s+/).every(function(r){var o=r.indexOf(".");return o>=0&&(r=r.slice(0,o)),!r||r==="start"})}function Hw(n,r,o){var i,u,f=Dw(r)?lf:On;return function(){var h=f(this,n),g=h.on;g!==i&&(u=(i=g).copy()).on(r,o),h.on=u}}function $w(n,r){var o=this._id;return arguments.length<2?kn(this.node(),o).on.on(n):this.each(Hw(o,n,r))}function Uw(n){return function(){var r=this.parentNode;for(var o in this.__transition)if(+o!==n)return;r&&r.removeChild(this)}}function Bw(){return this.on("end.remove",Uw(this._id))}function qw(n){var r=this._name,o=this._id;typeof n!="function"&&(n=tf(n));for(var i=this._groups,u=i.length,f=new Array(u),h=0;h<u;++h)for(var g=i[h],x=g.length,m=f[h]=new Array(x),p,b,v=0;v<x;++v)(p=g[v])&&(b=n.call(p,p.__data__,v,g))&&("__data__"in p&&(b.__data__=p.__data__),m[v]=b,Wi(m[v],r,o,v,m,kn(p,o)));return new aa(f,this._parents,r,o)}function Lw(n){var r=this._name,o=this._id;typeof n!="function"&&(n=G0(n));for(var i=this._groups,u=i.length,f=[],h=[],g=0;g<u;++g)for(var x=i[g],m=x.length,p,b=0;b<m;++b)if(p=x[b]){for(var v=n.call(p,p.__data__,b,x),N,C=kn(p,o),k=0,R=v.length;k<R;++k)(N=v[k])&&Wi(N,r,o,k,v,C);f.push(v),h.push(p)}return new aa(f,h,r,o)}var Yw=Xr.prototype.constructor;function Vw(){return new Yw(this._groups,this._parents)}function Gw(n,r){var o,i,u;return function(){var f=xl(this,n),h=(this.style.removeProperty(n),xl(this,n));return f===h?null:f===o&&h===i?u:u=r(o=f,i=h)}}function mg(n){return function(){this.style.removeProperty(n)}}function Xw(n,r,o){var i,u=o+"",f;return function(){var h=xl(this,n);return h===u?null:h===i?f:f=r(i=h,o)}}function Zw(n,r,o){var i,u,f;return function(){var h=xl(this,n),g=o(this),x=g+"";return g==null&&(x=g=(this.style.removeProperty(n),xl(this,n))),h===x?null:h===i&&x===u?f:(u=x,f=r(i=h,g))}}function Ww(n,r){var o,i,u,f="style."+r,h="end."+f,g;return function(){var x=On(this,n),m=x.on,p=x.value[f]==null?g||(g=mg(r)):void 0;(m!==o||u!==p)&&(i=(o=m).copy()).on(h,u=p),x.on=i}}function Qw(n,r,o){var i=(n+="")=="transform"?QN:hg;return r==null?this.styleTween(n,Gw(n,i)).on("end.style."+n,mg(n)):typeof r=="function"?this.styleTween(n,Zw(n,i,rf(this,"style."+n,r))).each(Ww(this._id,n)):this.styleTween(n,Xw(n,i,r),o).on("end.style."+n,null)}function Kw(n,r,o){return function(i){this.style.setProperty(n,r.call(this,i),o)}}function Jw(n,r,o){var i,u;function f(){var h=r.apply(this,arguments);return h!==u&&(i=(u=h)&&Kw(n,h,o)),i}return f._value=r,f}function Iw(n,r,o){var i="style."+(n+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(r==null)return this.tween(i,null);if(typeof r!="function")throw new Error;return this.tween(i,Jw(n,r,o??""))}function Fw(n){return function(){this.textContent=n}}function Pw(n){return function(){var r=n(this);this.textContent=r??""}}function e5(n){return this.tween("text",typeof n=="function"?Pw(rf(this,"text",n)):Fw(n==null?"":n+""))}function t5(n){return function(r){this.textContent=n.call(this,r)}}function n5(n){var r,o;function i(){var u=n.apply(this,arguments);return u!==o&&(r=(o=u)&&t5(u)),r}return i._value=n,i}function a5(n){var r="text";if(arguments.length<1)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;return this.tween(r,n5(n))}function s5(){for(var n=this._name,r=this._id,o=pg(),i=this._groups,u=i.length,f=0;f<u;++f)for(var h=i[f],g=h.length,x,m=0;m<g;++m)if(x=h[m]){var p=kn(x,r);Wi(x,n,o,m,h,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new aa(i,this._parents,n,o)}function l5(){var n,r,o=this,i=o._id,u=o.size();return new Promise(function(f,h){var g={value:h},x={value:function(){--u===0&&f()}};o.each(function(){var m=On(this,i),p=m.on;p!==n&&(r=(n=p).copy(),r._.cancel.push(g),r._.interrupt.push(g),r._.end.push(x)),m.on=r}),u===0&&f()})}var r5=0;function aa(n,r,o,i){this._groups=n,this._parents=r,this._name=o,this._id=i}function pg(){return++r5}var Fn=Xr.prototype;aa.prototype={constructor:aa,select:qw,selectAll:Lw,selectChild:Fn.selectChild,selectChildren:Fn.selectChildren,filter:zw,merge:Ow,selection:Vw,transition:s5,call:Fn.call,nodes:Fn.nodes,node:Fn.node,size:Fn.size,empty:Fn.empty,each:Fn.each,on:$w,attr:gw,attrTween:Nw,style:Qw,styleTween:Iw,text:e5,textTween:a5,remove:Bw,tween:uw,delay:Ew,duration:Cw,ease:Mw,easeVarying:Rw,end:l5,[Symbol.iterator]:Fn[Symbol.iterator]};function o5(n){return((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2}var i5={time:null,delay:0,duration:250,ease:o5};function c5(n,r){for(var o;!(o=n.__transition)||!(o=o[r]);)if(!(n=n.parentNode))throw new Error(`transition ${r} not found`);return o}function u5(n){var r,o;n instanceof aa?(r=n._id,n=n._name):(r=pg(),(o=i5).time=sf(),n=n==null?null:n+"");for(var i=this._groups,u=i.length,f=0;f<u;++f)for(var h=i[f],g=h.length,x,m=0;m<g;++m)(x=h[m])&&Wi(x,n,r,m,h,o||c5(x,r));return new aa(i,this._parents,n,r)}Xr.prototype.interrupt=ow;Xr.prototype.transition=u5;const yi=n=>()=>n;function d5(n,{sourceEvent:r,target:o,transform:i,dispatch:u}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:u}})}function Pn(n,r,o){this.k=n,this.x=r,this.y=o}Pn.prototype={constructor:Pn,scale:function(n){return n===1?this:new Pn(this.k*n,this.x,this.y)},translate:function(n,r){return n===0&r===0?this:new Pn(this.k,this.x+this.k*n,this.y+this.k*r)},apply:function(n){return[n[0]*this.k+this.x,n[1]*this.k+this.y]},applyX:function(n){return n*this.k+this.x},applyY:function(n){return n*this.k+this.y},invert:function(n){return[(n[0]-this.x)/this.k,(n[1]-this.y)/this.k]},invertX:function(n){return(n-this.x)/this.k},invertY:function(n){return(n-this.y)/this.k},rescaleX:function(n){return n.copy().domain(n.range().map(this.invertX,this).map(n.invert,n))},rescaleY:function(n){return n.copy().domain(n.range().map(this.invertY,this).map(n.invert,n))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ta=new Pn(1,0,0);Pn.prototype;function jd(n){n.stopImmediatePropagation()}function Sr(n){n.preventDefault(),n.stopImmediatePropagation()}function f5(n){return(!n.ctrlKey||n.type==="wheel")&&!n.button}function h5(){var n=this;return n instanceof SVGElement?(n=n.ownerSVGElement||n,n.hasAttribute("viewBox")?(n=n.viewBox.baseVal,[[n.x,n.y],[n.x+n.width,n.y+n.height]]):[[0,0],[n.width.baseVal.value,n.height.baseVal.value]]):[[0,0],[n.clientWidth,n.clientHeight]]}function qx(){return this.__zoom||ta}function m5(n){return-n.deltaY*(n.deltaMode===1?.05:n.deltaMode?1:.002)*(n.ctrlKey?10:1)}function p5(){return navigator.maxTouchPoints||"ontouchstart"in this}function x5(n,r,o){var i=n.invertX(r[0][0])-o[0][0],u=n.invertX(r[1][0])-o[1][0],f=n.invertY(r[0][1])-o[0][1],h=n.invertY(r[1][1])-o[1][1];return n.translate(u>i?(i+u)/2:Math.min(0,i)||Math.max(0,u),h>f?(f+h)/2:Math.min(0,f)||Math.max(0,h))}function xg(){var n=f5,r=h5,o=x5,i=m5,u=p5,f=[0,1/0],h=[[-1/0,-1/0],[1/0,1/0]],g=250,x=PN,m=Gi("start","zoom","end"),p,b,v,N=500,C=150,k=0,R=10;function z(_){_.property("__zoom",qx).on("wheel.zoom",oe,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",K).filter(u).on("touchstart.zoom",ae).on("touchmove.zoom",te).on("touchend.zoom touchcancel.zoom",se).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}z.transform=function(_,W,E,$){var T=_.selection?_.selection():_;T.property("__zoom",qx),_!==T?H(_,W,E,$):T.interrupt().each(function(){Z(this,arguments).event($).start().zoom(null,typeof W=="function"?W.apply(this,arguments):W).end()})},z.scaleBy=function(_,W,E,$){z.scaleTo(_,function(){var T=this.__zoom.k,A=typeof W=="function"?W.apply(this,arguments):W;return T*A},E,$)},z.scaleTo=function(_,W,E,$){z.transform(_,function(){var T=r.apply(this,arguments),A=this.__zoom,S=E==null?M(T):typeof E=="function"?E.apply(this,arguments):E,D=A.invert(S),L=typeof W=="function"?W.apply(this,arguments):W;return o(q(V(A,L),S,D),T,h)},E,$)},z.translateBy=function(_,W,E,$){z.transform(_,function(){return o(this.__zoom.translate(typeof W=="function"?W.apply(this,arguments):W,typeof E=="function"?E.apply(this,arguments):E),r.apply(this,arguments),h)},null,$)},z.translateTo=function(_,W,E,$,T){z.transform(_,function(){var A=r.apply(this,arguments),S=this.__zoom,D=$==null?M(A):typeof $=="function"?$.apply(this,arguments):$;return o(ta.translate(D[0],D[1]).scale(S.k).translate(typeof W=="function"?-W.apply(this,arguments):-W,typeof E=="function"?-E.apply(this,arguments):-E),A,h)},$,T)};function V(_,W){return W=Math.max(f[0],Math.min(f[1],W)),W===_.k?_:new Pn(W,_.x,_.y)}function q(_,W,E){var $=W[0]-E[0]*_.k,T=W[1]-E[1]*_.k;return $===_.x&&T===_.y?_:new Pn(_.k,$,T)}function M(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function H(_,W,E,$){_.on("start.zoom",function(){Z(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){Z(this,arguments).event($).end()}).tween("zoom",function(){var T=this,A=arguments,S=Z(T,A).event($),D=r.apply(T,A),L=E==null?M(D):typeof E=="function"?E.apply(T,A):E,F=Math.max(D[1][0]-D[0][0],D[1][1]-D[0][1]),ie=T.__zoom,he=typeof W=="function"?W.apply(T,A):W,me=x(ie.invert(L).concat(F/ie.k),he.invert(L).concat(F/he.k));return function(Se){if(Se===1)Se=he;else{var ve=me(Se),Ae=F/ve[2];Se=new Pn(Ae,L[0]-ve[0]*Ae,L[1]-ve[1]*Ae)}S.zoom(null,Se)}})}function Z(_,W,E){return!E&&_.__zooming||new X(_,W)}function X(_,W){this.that=_,this.args=W,this.active=0,this.sourceEvent=null,this.extent=r.apply(_,W),this.taps=0}X.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,W){return this.mouse&&_!=="mouse"&&(this.mouse[1]=W.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=W.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=W.invert(this.touch1[0])),this.that.__zoom=W,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var W=gn(this.that).datum();m.call(_,this.that,new d5(_,{sourceEvent:this.sourceEvent,target:z,transform:this.that.__zoom,dispatch:m}),W)}};function oe(_,...W){if(!n.apply(this,arguments))return;var E=Z(this,W).event(_),$=this.__zoom,T=Math.max(f[0],Math.min(f[1],$.k*Math.pow(2,i.apply(this,arguments)))),A=Sn(_);if(E.wheel)(E.mouse[0][0]!==A[0]||E.mouse[0][1]!==A[1])&&(E.mouse[1]=$.invert(E.mouse[0]=A)),clearTimeout(E.wheel);else{if($.k===T)return;E.mouse=[A,$.invert(A)],Ai(this),E.start()}Sr(_),E.wheel=setTimeout(S,C),E.zoom("mouse",o(q(V($,T),E.mouse[0],E.mouse[1]),E.extent,h));function S(){E.wheel=null,E.end()}}function I(_,...W){if(v||!n.apply(this,arguments))return;var E=_.currentTarget,$=Z(this,W,!0).event(_),T=gn(_.view).on("mousemove.zoom",L,!0).on("mouseup.zoom",F,!0),A=Sn(_,E),S=_.clientX,D=_.clientY;tg(_.view),jd(_),$.mouse=[A,this.__zoom.invert(A)],Ai(this),$.start();function L(ie){if(Sr(ie),!$.moved){var he=ie.clientX-S,me=ie.clientY-D;$.moved=he*he+me*me>k}$.event(ie).zoom("mouse",o(q($.that.__zoom,$.mouse[0]=Sn(ie,E),$.mouse[1]),$.extent,h))}function F(ie){T.on("mousemove.zoom mouseup.zoom",null),ng(ie.view,$.moved),Sr(ie),$.event(ie).end()}}function K(_,...W){if(n.apply(this,arguments)){var E=this.__zoom,$=Sn(_.changedTouches?_.changedTouches[0]:_,this),T=E.invert($),A=E.k*(_.shiftKey?.5:2),S=o(q(V(E,A),$,T),r.apply(this,W),h);Sr(_),g>0?gn(this).transition().duration(g).call(H,S,$,_):gn(this).call(z.transform,S,$,_)}}function ae(_,...W){if(n.apply(this,arguments)){var E=_.touches,$=E.length,T=Z(this,W,_.changedTouches.length===$).event(_),A,S,D,L;for(jd(_),S=0;S<$;++S)D=E[S],L=Sn(D,this),L=[L,this.__zoom.invert(L),D.identifier],T.touch0?!T.touch1&&T.touch0[2]!==L[2]&&(T.touch1=L,T.taps=0):(T.touch0=L,A=!0,T.taps=1+!!p);p&&(p=clearTimeout(p)),A&&(T.taps<2&&(b=L[0],p=setTimeout(function(){p=null},N)),Ai(this),T.start())}}function te(_,...W){if(this.__zooming){var E=Z(this,W).event(_),$=_.changedTouches,T=$.length,A,S,D,L;for(Sr(_),A=0;A<T;++A)S=$[A],D=Sn(S,this),E.touch0&&E.touch0[2]===S.identifier?E.touch0[0]=D:E.touch1&&E.touch1[2]===S.identifier&&(E.touch1[0]=D);if(S=E.that.__zoom,E.touch1){var F=E.touch0[0],ie=E.touch0[1],he=E.touch1[0],me=E.touch1[1],Se=(Se=he[0]-F[0])*Se+(Se=he[1]-F[1])*Se,ve=(ve=me[0]-ie[0])*ve+(ve=me[1]-ie[1])*ve;S=V(S,Math.sqrt(Se/ve)),D=[(F[0]+he[0])/2,(F[1]+he[1])/2],L=[(ie[0]+me[0])/2,(ie[1]+me[1])/2]}else if(E.touch0)D=E.touch0[0],L=E.touch0[1];else return;E.zoom("touch",o(q(S,D,L),E.extent,h))}}function se(_,...W){if(this.__zooming){var E=Z(this,W).event(_),$=_.changedTouches,T=$.length,A,S;for(jd(_),v&&clearTimeout(v),v=setTimeout(function(){v=null},N),A=0;A<T;++A)S=$[A],E.touch0&&E.touch0[2]===S.identifier?delete E.touch0:E.touch1&&E.touch1[2]===S.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(S=Sn(S,this),Math.hypot(b[0]-S[0],b[1]-S[1])<R)){var D=gn(this).on("dblclick.zoom");D&&D.apply(this,arguments)}}}return z.wheelDelta=function(_){return arguments.length?(i=typeof _=="function"?_:yi(+_),z):i},z.filter=function(_){return arguments.length?(n=typeof _=="function"?_:yi(!!_),z):n},z.touchable=function(_){return arguments.length?(u=typeof _=="function"?_:yi(!!_),z):u},z.extent=function(_){return arguments.length?(r=typeof _=="function"?_:yi([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),z):r},z.scaleExtent=function(_){return arguments.length?(f[0]=+_[0],f[1]=+_[1],z):[f[0],f[1]]},z.translateExtent=function(_){return arguments.length?(h[0][0]=+_[0][0],h[1][0]=+_[1][0],h[0][1]=+_[0][1],h[1][1]=+_[1][1],z):[[h[0][0],h[0][1]],[h[1][0],h[1][1]]]},z.constrain=function(_){return arguments.length?(o=_,z):o},z.duration=function(_){return arguments.length?(g=+_,z):g},z.interpolate=function(_){return arguments.length?(x=_,z):x},z.on=function(){var _=m.on.apply(m,arguments);return _===m?z:_},z.clickDistance=function(_){return arguments.length?(k=(_=+_)*_,z):Math.sqrt(k)},z.tapDistance=function(_){return arguments.length?(R=+_,z):R},z}E0();const Qi=j.createContext(null),g5=Qi.Provider,sa={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:n=>`Node type "${n}" 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:n=>`The old edge with id=${n} does not exist.`,error009:n=>`Marker type "${n}" doesn't exist.`,error008:(n,r)=>`Couldn't create edge for ${n?"target":"source"} handle id: "${n?r.targetHandle:r.sourceHandle}", edge id: ${r.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:n=>`Edge type "${n}" not found. Using fallback type "default".`,error012:n=>`Node with id "${n}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},gg=sa.error001();function tt(n,r){const o=j.useContext(Qi);if(o===null)throw new Error(gg);return Y0(o,n,r)}const Nt=()=>{const n=j.useContext(Qi);if(n===null)throw new Error(gg);return j.useMemo(()=>({getState:n.getState,setState:n.setState,subscribe:n.subscribe,destroy:n.destroy}),[n])},y5=n=>n.userSelectionActive?"none":"all";function of({position:n,children:r,className:o,style:i,...u}){const f=tt(y5),h=`${n}`.split("-");return le.createElement("div",{className:$t(["react-flow__panel",o,...h]),style:{...i,pointerEvents:f},...u},r)}function b5({proOptions:n,position:r="bottom-right"}){return n?.hideAttribution?null:le.createElement(of,{position:r,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},le.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const v5=({x:n,y:r,label:o,labelStyle:i={},labelShowBg:u=!0,labelBgStyle:f={},labelBgPadding:h=[2,4],labelBgBorderRadius:g=2,children:x,className:m,...p})=>{const b=j.useRef(null),[v,N]=j.useState({x:0,y:0,width:0,height:0}),C=$t(["react-flow__edge-textwrapper",m]);return j.useEffect(()=>{if(b.current){const k=b.current.getBBox();N({x:k.x,y:k.y,width:k.width,height:k.height})}},[o]),typeof o>"u"||!o?null:le.createElement("g",{transform:`translate(${n-v.width/2} ${r-v.height/2})`,className:C,visibility:v.width?"visible":"hidden",...p},u&&le.createElement("rect",{width:v.width+2*h[0],x:-h[0],y:-h[1],height:v.height+2*h[1],className:"react-flow__edge-textbg",style:f,rx:g,ry:g}),le.createElement("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:b,style:i},o),x)};var j5=j.memo(v5);const cf=n=>({width:n.offsetWidth,height:n.offsetHeight}),yl=(n,r=0,o=1)=>Math.min(Math.max(n,r),o),uf=(n={x:0,y:0},r)=>({x:yl(n.x,r[0][0],r[1][0]),y:yl(n.y,r[0][1],r[1][1])}),Lx=(n,r,o)=>n<r?yl(Math.abs(n-r),1,50)/50:n>o?-yl(Math.abs(n-o),1,50)/50:0,yg=(n,r)=>{const o=Lx(n.x,35,r.width-35)*20,i=Lx(n.y,35,r.height-35)*20;return[o,i]},bg=n=>n.getRootNode?.()||window?.document,vg=(n,r)=>({x:Math.min(n.x,r.x),y:Math.min(n.y,r.y),x2:Math.max(n.x2,r.x2),y2:Math.max(n.y2,r.y2)}),Br=({x:n,y:r,width:o,height:i})=>({x:n,y:r,x2:n+o,y2:r+i}),jg=({x:n,y:r,x2:o,y2:i})=>({x:n,y:r,width:o-n,height:i-r}),Yx=n=>({...n.positionAbsolute||{x:0,y:0},width:n.width||0,height:n.height||0}),N5=(n,r)=>jg(vg(Br(n),Br(r))),Ld=(n,r)=>{const o=Math.max(0,Math.min(n.x+n.width,r.x+r.width)-Math.max(n.x,r.x)),i=Math.max(0,Math.min(n.y+n.height,r.y+r.height)-Math.max(n.y,r.y));return Math.ceil(o*i)},w5=n=>yn(n.width)&&yn(n.height)&&yn(n.x)&&yn(n.y),yn=n=>!isNaN(n)&&isFinite(n),ct=Symbol.for("internals"),Ng=["Enter"," ","Escape"],S5=(n,r)=>{},E5=n=>"nativeEvent"in n;function Yd(n){const o=(E5(n)?n.nativeEvent:n).composedPath?.()?.[0]||n.target;return["INPUT","SELECT","TEXTAREA"].includes(o?.nodeName)||o?.hasAttribute("contenteditable")||!!o?.closest(".nokey")}const wg=n=>"clientX"in n,Ua=(n,r)=>{const o=wg(n),i=o?n.clientX:n.touches?.[0].clientX,u=o?n.clientY:n.touches?.[0].clientY;return{x:i-(r?.left??0),y:u-(r?.top??0)}},qi=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,Wr=({id:n,path:r,labelX:o,labelY:i,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:m,style:p,markerEnd:b,markerStart:v,interactionWidth:N=20})=>le.createElement(le.Fragment,null,le.createElement("path",{id:n,style:p,d:r,fill:"none",className:"react-flow__edge-path",markerEnd:b,markerStart:v}),N&&le.createElement("path",{d:r,fill:"none",strokeOpacity:0,strokeWidth:N,className:"react-flow__edge-interaction"}),u&&yn(o)&&yn(i)?le.createElement(j5,{x:o,y:i,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:m}):null);Wr.displayName="BaseEdge";function Er(n,r,o){return o===void 0?o:i=>{const u=r().edges.find(f=>f.id===n);u&&o(i,{...u})}}function Sg({sourceX:n,sourceY:r,targetX:o,targetY:i}){const u=Math.abs(o-n)/2,f=o<n?o+u:o-u,h=Math.abs(i-r)/2,g=i<r?i+h:i-h;return[f,g,u,h]}function Eg({sourceX:n,sourceY:r,targetX:o,targetY:i,sourceControlX:u,sourceControlY:f,targetControlX:h,targetControlY:g}){const x=n*.125+u*.375+h*.375+o*.125,m=r*.125+f*.375+g*.375+i*.125,p=Math.abs(x-n),b=Math.abs(m-r);return[x,m,p,b]}var ps;(function(n){n.Strict="strict",n.Loose="loose"})(ps||(ps={}));var us;(function(n){n.Free="free",n.Vertical="vertical",n.Horizontal="horizontal"})(us||(us={}));var qr;(function(n){n.Partial="partial",n.Full="full"})(qr||(qr={}));var $a;(function(n){n.Bezier="default",n.Straight="straight",n.Step="step",n.SmoothStep="smoothstep",n.SimpleBezier="simplebezier"})($a||($a={}));var Ba;(function(n){n.Arrow="arrow",n.ArrowClosed="arrowclosed"})(Ba||(Ba={}));var xe;(function(n){n.Left="left",n.Top="top",n.Right="right",n.Bottom="bottom"})(xe||(xe={}));function Vx({pos:n,x1:r,y1:o,x2:i,y2:u}){return n===xe.Left||n===xe.Right?[.5*(r+i),o]:[r,.5*(o+u)]}function kg({sourceX:n,sourceY:r,sourcePosition:o=xe.Bottom,targetX:i,targetY:u,targetPosition:f=xe.Top}){const[h,g]=Vx({pos:o,x1:n,y1:r,x2:i,y2:u}),[x,m]=Vx({pos:f,x1:i,y1:u,x2:n,y2:r}),[p,b,v,N]=Eg({sourceX:n,sourceY:r,targetX:i,targetY:u,sourceControlX:h,sourceControlY:g,targetControlX:x,targetControlY:m});return[`M${n},${r} C${h},${g} ${x},${m} ${i},${u}`,p,b,v,N]}const df=j.memo(({sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:u=xe.Bottom,targetPosition:f=xe.Top,label:h,labelStyle:g,labelShowBg:x,labelBgStyle:m,labelBgPadding:p,labelBgBorderRadius:b,style:v,markerEnd:N,markerStart:C,interactionWidth:k})=>{const[R,z,V]=kg({sourceX:n,sourceY:r,sourcePosition:u,targetX:o,targetY:i,targetPosition:f});return le.createElement(Wr,{path:R,labelX:z,labelY:V,label:h,labelStyle:g,labelShowBg:x,labelBgStyle:m,labelBgPadding:p,labelBgBorderRadius:b,style:v,markerEnd:N,markerStart:C,interactionWidth:k})});df.displayName="SimpleBezierEdge";const Gx={[xe.Left]:{x:-1,y:0},[xe.Right]:{x:1,y:0},[xe.Top]:{x:0,y:-1},[xe.Bottom]:{x:0,y:1}},k5=({source:n,sourcePosition:r=xe.Bottom,target:o})=>r===xe.Left||r===xe.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1},Xx=(n,r)=>Math.sqrt(Math.pow(r.x-n.x,2)+Math.pow(r.y-n.y,2));function _5({source:n,sourcePosition:r=xe.Bottom,target:o,targetPosition:i=xe.Top,center:u,offset:f}){const h=Gx[r],g=Gx[i],x={x:n.x+h.x*f,y:n.y+h.y*f},m={x:o.x+g.x*f,y:o.y+g.y*f},p=k5({source:x,sourcePosition:r,target:m}),b=p.x!==0?"x":"y",v=p[b];let N=[],C,k;const R={x:0,y:0},z={x:0,y:0},[V,q,M,H]=Sg({sourceX:n.x,sourceY:n.y,targetX:o.x,targetY:o.y});if(h[b]*g[b]===-1){C=u.x??V,k=u.y??q;const X=[{x:C,y:x.y},{x:C,y:m.y}],oe=[{x:x.x,y:k},{x:m.x,y:k}];h[b]===v?N=b==="x"?X:oe:N=b==="x"?oe:X}else{const X=[{x:x.x,y:m.y}],oe=[{x:m.x,y:x.y}];if(b==="x"?N=h.x===v?oe:X:N=h.y===v?X:oe,r===i){const se=Math.abs(n[b]-o[b]);if(se<=f){const _=Math.min(f-1,f-se);h[b]===v?R[b]=(x[b]>n[b]?-1:1)*_:z[b]=(m[b]>o[b]?-1:1)*_}}if(r!==i){const se=b==="x"?"y":"x",_=h[b]===g[se],W=x[se]>m[se],E=x[se]<m[se];(h[b]===1&&(!_&&W||_&&E)||h[b]!==1&&(!_&&E||_&&W))&&(N=b==="x"?X:oe)}const I={x:x.x+R.x,y:x.y+R.y},K={x:m.x+z.x,y:m.y+z.y},ae=Math.max(Math.abs(I.x-N[0].x),Math.abs(K.x-N[0].x)),te=Math.max(Math.abs(I.y-N[0].y),Math.abs(K.y-N[0].y));ae>=te?(C=(I.x+K.x)/2,k=N[0].y):(C=N[0].x,k=(I.y+K.y)/2)}return[[n,{x:x.x+R.x,y:x.y+R.y},...N,{x:m.x+z.x,y:m.y+z.y},o],C,k,M,H]}function C5(n,r,o,i){const u=Math.min(Xx(n,r)/2,Xx(r,o)/2,i),{x:f,y:h}=r;if(n.x===f&&f===o.x||n.y===h&&h===o.y)return`L${f} ${h}`;if(n.y===h){const m=n.x<o.x?-1:1,p=n.y<o.y?1:-1;return`L ${f+u*m},${h}Q ${f},${h} ${f},${h+u*p}`}const g=n.x<o.x?1:-1,x=n.y<o.y?-1:1;return`L ${f},${h+u*x}Q ${f},${h} ${f+u*g},${h}`}function Vd({sourceX:n,sourceY:r,sourcePosition:o=xe.Bottom,targetX:i,targetY:u,targetPosition:f=xe.Top,borderRadius:h=5,centerX:g,centerY:x,offset:m=20}){const[p,b,v,N,C]=_5({source:{x:n,y:r},sourcePosition:o,target:{x:i,y:u},targetPosition:f,center:{x:g,y:x},offset:m});return[p.reduce((R,z,V)=>{let q="";return V>0&&V<p.length-1?q=C5(p[V-1],z,p[V+1],h):q=`${V===0?"M":"L"}${z.x} ${z.y}`,R+=q,R},""),b,v,N,C]}const Ki=j.memo(({sourceX:n,sourceY:r,targetX:o,targetY:i,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:m,style:p,sourcePosition:b=xe.Bottom,targetPosition:v=xe.Top,markerEnd:N,markerStart:C,pathOptions:k,interactionWidth:R})=>{const[z,V,q]=Vd({sourceX:n,sourceY:r,sourcePosition:b,targetX:o,targetY:i,targetPosition:v,borderRadius:k?.borderRadius,offset:k?.offset});return le.createElement(Wr,{path:z,labelX:V,labelY:q,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:m,style:p,markerEnd:N,markerStart:C,interactionWidth:R})});Ki.displayName="SmoothStepEdge";const ff=j.memo(n=>le.createElement(Ki,{...n,pathOptions:j.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])}));ff.displayName="StepEdge";function T5({sourceX:n,sourceY:r,targetX:o,targetY:i}){const[u,f,h,g]=Sg({sourceX:n,sourceY:r,targetX:o,targetY:i});return[`M ${n},${r}L ${o},${i}`,u,f,h,g]}const hf=j.memo(({sourceX:n,sourceY:r,targetX:o,targetY:i,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:m,style:p,markerEnd:b,markerStart:v,interactionWidth:N})=>{const[C,k,R]=T5({sourceX:n,sourceY:r,targetX:o,targetY:i});return le.createElement(Wr,{path:C,labelX:k,labelY:R,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:m,style:p,markerEnd:b,markerStart:v,interactionWidth:N})});hf.displayName="StraightEdge";function bi(n,r){return n>=0?.5*n:r*25*Math.sqrt(-n)}function Zx({pos:n,x1:r,y1:o,x2:i,y2:u,c:f}){switch(n){case xe.Left:return[r-bi(r-i,f),o];case xe.Right:return[r+bi(i-r,f),o];case xe.Top:return[r,o-bi(o-u,f)];case xe.Bottom:return[r,o+bi(u-o,f)]}}function _g({sourceX:n,sourceY:r,sourcePosition:o=xe.Bottom,targetX:i,targetY:u,targetPosition:f=xe.Top,curvature:h=.25}){const[g,x]=Zx({pos:o,x1:n,y1:r,x2:i,y2:u,c:h}),[m,p]=Zx({pos:f,x1:i,y1:u,x2:n,y2:r,c:h}),[b,v,N,C]=Eg({sourceX:n,sourceY:r,targetX:i,targetY:u,sourceControlX:g,sourceControlY:x,targetControlX:m,targetControlY:p});return[`M${n},${r} C${g},${x} ${m},${p} ${i},${u}`,b,v,N,C]}const Li=j.memo(({sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:u=xe.Bottom,targetPosition:f=xe.Top,label:h,labelStyle:g,labelShowBg:x,labelBgStyle:m,labelBgPadding:p,labelBgBorderRadius:b,style:v,markerEnd:N,markerStart:C,pathOptions:k,interactionWidth:R})=>{const[z,V,q]=_g({sourceX:n,sourceY:r,sourcePosition:u,targetX:o,targetY:i,targetPosition:f,curvature:k?.curvature});return le.createElement(Wr,{path:z,labelX:V,labelY:q,label:h,labelStyle:g,labelShowBg:x,labelBgStyle:m,labelBgPadding:p,labelBgBorderRadius:b,style:v,markerEnd:N,markerStart:C,interactionWidth:R})});Li.displayName="BezierEdge";const mf=j.createContext(null),M5=mf.Provider;mf.Consumer;const A5=()=>j.useContext(mf),R5=n=>"id"in n&&"source"in n&&"target"in n,z5=({source:n,sourceHandle:r,target:o,targetHandle:i})=>`reactflow__edge-${n}${r||""}-${o}${i||""}`,Gd=(n,r)=>typeof n>"u"?"":typeof n=="string"?n:`${r?`${r}__`:""}${Object.keys(n).sort().map(i=>`${i}=${n[i]}`).join("&")}`,O5=(n,r)=>r.some(o=>o.source===n.source&&o.target===n.target&&(o.sourceHandle===n.sourceHandle||!o.sourceHandle&&!n.sourceHandle)&&(o.targetHandle===n.targetHandle||!o.targetHandle&&!n.targetHandle)),D5=(n,r)=>{if(!n.source||!n.target)return r;let o;return R5(n)?o={...n}:o={...n,id:z5(n)},O5(o,r)?r:r.concat(o)},Xd=({x:n,y:r},[o,i,u],f,[h,g])=>{const x={x:(n-o)/u,y:(r-i)/u};return f?{x:h*Math.round(x.x/h),y:g*Math.round(x.y/g)}:x},Cg=({x:n,y:r},[o,i,u])=>({x:n*u+o,y:r*u+i}),fs=(n,r=[0,0])=>{if(!n)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const o=(n.width??0)*r[0],i=(n.height??0)*r[1],u={x:n.position.x-o,y:n.position.y-i};return{...u,positionAbsolute:n.positionAbsolute?{x:n.positionAbsolute.x-o,y:n.positionAbsolute.y-i}:u}},Ji=(n,r=[0,0])=>{if(n.length===0)return{x:0,y:0,width:0,height:0};const o=n.reduce((i,u)=>{const{x:f,y:h}=fs(u,r).positionAbsolute;return vg(i,Br({x:f,y:h,width:u.width||0,height:u.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return jg(o)},Tg=(n,r,[o,i,u]=[0,0,1],f=!1,h=!1,g=[0,0])=>{const x={x:(r.x-o)/u,y:(r.y-i)/u,width:r.width/u,height:r.height/u},m=[];return n.forEach(p=>{const{width:b,height:v,selectable:N=!0,hidden:C=!1}=p;if(h&&!N||C)return!1;const{positionAbsolute:k}=fs(p,g),R={x:k.x,y:k.y,width:b||0,height:v||0},z=Ld(x,R),V=typeof b>"u"||typeof v>"u"||b===null||v===null,q=f&&z>0,M=(b||0)*(v||0);(V||q||z>=M||p.dragging)&&m.push(p)}),m},Mg=(n,r)=>{const o=n.map(i=>i.id);return r.filter(i=>o.includes(i.source)||o.includes(i.target))},Ag=(n,r,o,i,u,f=.1)=>{const h=r/(n.width*(1+f)),g=o/(n.height*(1+f)),x=Math.min(h,g),m=yl(x,i,u),p=n.x+n.width/2,b=n.y+n.height/2,v=r/2-p*m,N=o/2-b*m;return{x:v,y:N,zoom:m}},is=(n,r=0)=>n.transition().duration(r);function Wx(n,r,o,i){return(r[o]||[]).reduce((u,f)=>(`${n.id}-${f.id}-${o}`!==i&&u.push({id:f.id||null,type:o,nodeId:n.id,x:(n.positionAbsolute?.x??0)+f.x+f.width/2,y:(n.positionAbsolute?.y??0)+f.y+f.height/2}),u),[])}function H5(n,r,o,i,u,f){const{x:h,y:g}=Ua(n),m=r.elementsFromPoint(h,g).find(C=>C.classList.contains("react-flow__handle"));if(m){const C=m.getAttribute("data-nodeid");if(C){const k=pf(void 0,m),R=m.getAttribute("data-handleid"),z=f({nodeId:C,id:R,type:k});if(z){const V=u.find(q=>q.nodeId===C&&q.type===k&&q.id===R);return{handle:{id:R,type:k,nodeId:C,x:V?.x||o.x,y:V?.y||o.y},validHandleResult:z}}}}let p=[],b=1/0;if(u.forEach(C=>{const k=Math.sqrt((C.x-o.x)**2+(C.y-o.y)**2);if(k<=i){const R=f(C);k<=b&&(k<b?p=[{handle:C,validHandleResult:R}]:k===b&&p.push({handle:C,validHandleResult:R}),b=k)}}),!p.length)return{handle:null,validHandleResult:Rg()};if(p.length===1)return p[0];const v=p.some(({validHandleResult:C})=>C.isValid),N=p.some(({handle:C})=>C.type==="target");return p.find(({handle:C,validHandleResult:k})=>N?C.type==="target":v?k.isValid:!0)||p[0]}const $5={source:null,target:null,sourceHandle:null,targetHandle:null},Rg=()=>({handleDomNode:null,isValid:!1,connection:$5,endHandle:null});function zg(n,r,o,i,u,f,h){const g=u==="target",x=h.querySelector(`.react-flow__handle[data-id="${n?.nodeId}-${n?.id}-${n?.type}"]`),m={...Rg(),handleDomNode:x};if(x){const p=pf(void 0,x),b=x.getAttribute("data-nodeid"),v=x.getAttribute("data-handleid"),N=x.classList.contains("connectable"),C=x.classList.contains("connectableend"),k={source:g?b:o,sourceHandle:g?v:i,target:g?o:b,targetHandle:g?i:v};m.connection=k,N&&C&&(r===ps.Strict?g&&p==="source"||!g&&p==="target":b!==o||v!==i)&&(m.endHandle={nodeId:b,handleId:v,type:p},m.isValid=f(k))}return m}function U5({nodes:n,nodeId:r,handleId:o,handleType:i}){return n.reduce((u,f)=>{if(f[ct]){const{handleBounds:h}=f[ct];let g=[],x=[];h&&(g=Wx(f,h,"source",`${r}-${o}-${i}`),x=Wx(f,h,"target",`${r}-${o}-${i}`)),u.push(...g,...x)}return u},[])}function pf(n,r){return n||(r?.classList.contains("target")?"target":r?.classList.contains("source")?"source":null)}function Nd(n){n?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function B5(n,r){let o=null;return r?o="valid":n&&!r&&(o="invalid"),o}function Og({event:n,handleId:r,nodeId:o,onConnect:i,isTarget:u,getState:f,setState:h,isValidConnection:g,edgeUpdaterType:x,onReconnectEnd:m}){const p=bg(n.target),{connectionMode:b,domNode:v,autoPanOnConnect:N,connectionRadius:C,onConnectStart:k,panBy:R,getNodes:z,cancelConnection:V}=f();let q=0,M;const{x:H,y:Z}=Ua(n),X=p?.elementFromPoint(H,Z),oe=pf(x,X),I=v?.getBoundingClientRect();if(!I||!oe)return;let K,ae=Ua(n,I),te=!1,se=null,_=!1,W=null;const E=U5({nodes:z(),nodeId:o,handleId:r,handleType:oe}),$=()=>{if(!N)return;const[S,D]=yg(ae,I);R({x:S,y:D}),q=requestAnimationFrame($)};h({connectionPosition:ae,connectionStatus:null,connectionNodeId:o,connectionHandleId:r,connectionHandleType:oe,connectionStartHandle:{nodeId:o,handleId:r,type:oe},connectionEndHandle:null}),k?.(n,{nodeId:o,handleId:r,handleType:oe});function T(S){const{transform:D}=f();ae=Ua(S,I);const{handle:L,validHandleResult:F}=H5(S,p,Xd(ae,D,!1,[1,1]),C,E,ie=>zg(ie,b,o,r,u?"target":"source",g,p));if(M=L,te||($(),te=!0),W=F.handleDomNode,se=F.connection,_=F.isValid,h({connectionPosition:M&&_?Cg({x:M.x,y:M.y},D):ae,connectionStatus:B5(!!M,_),connectionEndHandle:F.endHandle}),!M&&!_&&!W)return Nd(K);se.source!==se.target&&W&&(Nd(K),K=W,W.classList.add("connecting","react-flow__handle-connecting"),W.classList.toggle("valid",_),W.classList.toggle("react-flow__handle-valid",_))}function A(S){(M||W)&&se&&_&&i?.(se),f().onConnectEnd?.(S),x&&m?.(S),Nd(K),V(),cancelAnimationFrame(q),te=!1,_=!1,se=null,W=null,p.removeEventListener("mousemove",T),p.removeEventListener("mouseup",A),p.removeEventListener("touchmove",T),p.removeEventListener("touchend",A)}p.addEventListener("mousemove",T),p.addEventListener("mouseup",A),p.addEventListener("touchmove",T),p.addEventListener("touchend",A)}const Qx=()=>!0,q5=n=>({connectionStartHandle:n.connectionStartHandle,connectOnClick:n.connectOnClick,noPanClassName:n.noPanClassName}),L5=(n,r,o)=>i=>{const{connectionStartHandle:u,connectionEndHandle:f,connectionClickStartHandle:h}=i;return{connecting:u?.nodeId===n&&u?.handleId===r&&u?.type===o||f?.nodeId===n&&f?.handleId===r&&f?.type===o,clickConnecting:h?.nodeId===n&&h?.handleId===r&&h?.type===o}},Dg=j.forwardRef(({type:n="source",position:r=xe.Top,isValidConnection:o,isConnectable:i=!0,isConnectableStart:u=!0,isConnectableEnd:f=!0,id:h,onConnect:g,children:x,className:m,onMouseDown:p,onTouchStart:b,...v},N)=>{const C=h||null,k=n==="target",R=Nt(),z=A5(),{connectOnClick:V,noPanClassName:q}=tt(q5,Tt),{connecting:M,clickConnecting:H}=tt(L5(z,C,n),Tt);z||R.getState().onError?.("010",sa.error010());const Z=I=>{const{defaultEdgeOptions:K,onConnect:ae,hasDefaultEdges:te}=R.getState(),se={...K,...I};if(te){const{edges:_,setEdges:W}=R.getState();W(D5(se,_))}ae?.(se),g?.(se)},X=I=>{if(!z)return;const K=wg(I);u&&(K&&I.button===0||!K)&&Og({event:I,handleId:C,nodeId:z,onConnect:Z,isTarget:k,getState:R.getState,setState:R.setState,isValidConnection:o||R.getState().isValidConnection||Qx}),K?p?.(I):b?.(I)},oe=I=>{const{onClickConnectStart:K,onClickConnectEnd:ae,connectionClickStartHandle:te,connectionMode:se,isValidConnection:_}=R.getState();if(!z||!te&&!u)return;if(!te){K?.(I,{nodeId:z,handleId:C,handleType:n}),R.setState({connectionClickStartHandle:{nodeId:z,type:n,handleId:C}});return}const W=bg(I.target),E=o||_||Qx,{connection:$,isValid:T}=zg({nodeId:z,id:C,type:n},se,te.nodeId,te.handleId||null,te.type,E,W);T&&Z($),ae?.(I),R.setState({connectionClickStartHandle:null})};return le.createElement("div",{"data-handleid":C,"data-nodeid":z,"data-handlepos":r,"data-id":`${z}-${C}-${n}`,className:$t(["react-flow__handle",`react-flow__handle-${r}`,"nodrag",q,m,{source:!k,target:k,connectable:i,connectablestart:u,connectableend:f,connecting:H,connectionindicator:i&&(u&&!M||f&&M)}]),onMouseDown:X,onTouchStart:X,onClick:V?oe:void 0,ref:N,...v},x)});Dg.displayName="Handle";var jt=j.memo(Dg);const Hg=({data:n,isConnectable:r,targetPosition:o=xe.Top,sourcePosition:i=xe.Bottom})=>le.createElement(le.Fragment,null,le.createElement(jt,{type:"target",position:o,isConnectable:r}),n?.label,le.createElement(jt,{type:"source",position:i,isConnectable:r}));Hg.displayName="DefaultNode";var Zd=j.memo(Hg);const $g=({data:n,isConnectable:r,sourcePosition:o=xe.Bottom})=>le.createElement(le.Fragment,null,n?.label,le.createElement(jt,{type:"source",position:o,isConnectable:r}));$g.displayName="InputNode";var Ug=j.memo($g);const Bg=({data:n,isConnectable:r,targetPosition:o=xe.Top})=>le.createElement(le.Fragment,null,le.createElement(jt,{type:"target",position:o,isConnectable:r}),n?.label);Bg.displayName="OutputNode";var qg=j.memo(Bg);const xf=()=>null;xf.displayName="GroupNode";const Y5=n=>({selectedNodes:n.getNodes().filter(r=>r.selected),selectedEdges:n.edges.filter(r=>r.selected).map(r=>({...r}))}),vi=n=>n.id;function V5(n,r){return Tt(n.selectedNodes.map(vi),r.selectedNodes.map(vi))&&Tt(n.selectedEdges.map(vi),r.selectedEdges.map(vi))}const Lg=j.memo(({onSelectionChange:n})=>{const r=Nt(),{selectedNodes:o,selectedEdges:i}=tt(Y5,V5);return j.useEffect(()=>{const u={nodes:o,edges:i};n?.(u),r.getState().onSelectionChange.forEach(f=>f(u))},[o,i,n]),null});Lg.displayName="SelectionListener";const G5=n=>!!n.onSelectionChange;function X5({onSelectionChange:n}){const r=tt(G5);return n||r?le.createElement(Lg,{onSelectionChange:n}):null}const Z5=n=>({setNodes:n.setNodes,setEdges:n.setEdges,setDefaultNodesAndEdges:n.setDefaultNodesAndEdges,setMinZoom:n.setMinZoom,setMaxZoom:n.setMaxZoom,setTranslateExtent:n.setTranslateExtent,setNodeExtent:n.setNodeExtent,reset:n.reset});function tl(n,r){j.useEffect(()=>{typeof n<"u"&&r(n)},[n])}function Ue(n,r,o){j.useEffect(()=>{typeof r<"u"&&o({[n]:r})},[r])}const W5=({nodes:n,edges:r,defaultNodes:o,defaultEdges:i,onConnect:u,onConnectStart:f,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:x,nodesDraggable:m,nodesConnectable:p,nodesFocusable:b,edgesFocusable:v,edgesUpdatable:N,elevateNodesOnSelect:C,minZoom:k,maxZoom:R,nodeExtent:z,onNodesChange:V,onEdgesChange:q,elementsSelectable:M,connectionMode:H,snapGrid:Z,snapToGrid:X,translateExtent:oe,connectOnClick:I,defaultEdgeOptions:K,fitView:ae,fitViewOptions:te,onNodesDelete:se,onEdgesDelete:_,onNodeDrag:W,onNodeDragStart:E,onNodeDragStop:$,onSelectionDrag:T,onSelectionDragStart:A,onSelectionDragStop:S,noPanClassName:D,nodeOrigin:L,rfId:F,autoPanOnConnect:ie,autoPanOnNodeDrag:he,onError:me,connectionRadius:Se,isValidConnection:ve,nodeDragThreshold:Ae})=>{const{setNodes:Re,setEdges:We,setDefaultNodesAndEdges:Te,setMinZoom:be,setMaxZoom:B,setTranslateExtent:Y,setNodeExtent:ue,reset:re}=tt(Z5,Tt),ee=Nt();return j.useEffect(()=>{const Ee=i?.map(ge=>({...ge,...K}));return Te(o,Ee),()=>{re()}},[]),Ue("defaultEdgeOptions",K,ee.setState),Ue("connectionMode",H,ee.setState),Ue("onConnect",u,ee.setState),Ue("onConnectStart",f,ee.setState),Ue("onConnectEnd",h,ee.setState),Ue("onClickConnectStart",g,ee.setState),Ue("onClickConnectEnd",x,ee.setState),Ue("nodesDraggable",m,ee.setState),Ue("nodesConnectable",p,ee.setState),Ue("nodesFocusable",b,ee.setState),Ue("edgesFocusable",v,ee.setState),Ue("edgesUpdatable",N,ee.setState),Ue("elementsSelectable",M,ee.setState),Ue("elevateNodesOnSelect",C,ee.setState),Ue("snapToGrid",X,ee.setState),Ue("snapGrid",Z,ee.setState),Ue("onNodesChange",V,ee.setState),Ue("onEdgesChange",q,ee.setState),Ue("connectOnClick",I,ee.setState),Ue("fitViewOnInit",ae,ee.setState),Ue("fitViewOnInitOptions",te,ee.setState),Ue("onNodesDelete",se,ee.setState),Ue("onEdgesDelete",_,ee.setState),Ue("onNodeDrag",W,ee.setState),Ue("onNodeDragStart",E,ee.setState),Ue("onNodeDragStop",$,ee.setState),Ue("onSelectionDrag",T,ee.setState),Ue("onSelectionDragStart",A,ee.setState),Ue("onSelectionDragStop",S,ee.setState),Ue("noPanClassName",D,ee.setState),Ue("nodeOrigin",L,ee.setState),Ue("rfId",F,ee.setState),Ue("autoPanOnConnect",ie,ee.setState),Ue("autoPanOnNodeDrag",he,ee.setState),Ue("onError",me,ee.setState),Ue("connectionRadius",Se,ee.setState),Ue("isValidConnection",ve,ee.setState),Ue("nodeDragThreshold",Ae,ee.setState),tl(n,Re),tl(r,We),tl(k,be),tl(R,B),tl(oe,Y),tl(z,ue),null},Kx={display:"none"},Q5={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Yg="react-flow__node-desc",Vg="react-flow__edge-desc",K5="react-flow__aria-live",J5=n=>n.ariaLiveMessage;function I5({rfId:n}){const r=tt(J5);return le.createElement("div",{id:`${K5}-${n}`,"aria-live":"assertive","aria-atomic":"true",style:Q5},r)}function F5({rfId:n,disableKeyboardA11y:r}){return le.createElement(le.Fragment,null,le.createElement("div",{id:`${Yg}-${n}`,style:Kx},"Press enter or space to select a node.",!r&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),le.createElement("div",{id:`${Vg}-${n}`,style:Kx},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!r&&le.createElement(I5,{rfId:n}))}var Lr=(n=null,r={actInsideInputWithModifier:!0})=>{const[o,i]=j.useState(!1),u=j.useRef(!1),f=j.useRef(new Set([])),[h,g]=j.useMemo(()=>{if(n!==null){const m=(Array.isArray(n)?n:[n]).filter(b=>typeof b=="string").map(b=>b.split("+")),p=m.reduce((b,v)=>b.concat(...v),[]);return[m,p]}return[[],[]]},[n]);return j.useEffect(()=>{const x=typeof document<"u"?document:null,m=r?.target||x;if(n!==null){const p=N=>{if(u.current=N.ctrlKey||N.metaKey||N.shiftKey,(!u.current||u.current&&!r.actInsideInputWithModifier)&&Yd(N))return!1;const k=Ix(N.code,g);f.current.add(N[k]),Jx(h,f.current,!1)&&(N.preventDefault(),i(!0))},b=N=>{if((!u.current||u.current&&!r.actInsideInputWithModifier)&&Yd(N))return!1;const k=Ix(N.code,g);Jx(h,f.current,!0)?(i(!1),f.current.clear()):f.current.delete(N[k]),N.key==="Meta"&&f.current.clear(),u.current=!1},v=()=>{f.current.clear(),i(!1)};return m?.addEventListener("keydown",p),m?.addEventListener("keyup",b),window.addEventListener("blur",v),()=>{m?.removeEventListener("keydown",p),m?.removeEventListener("keyup",b),window.removeEventListener("blur",v)}}},[n,i]),o};function Jx(n,r,o){return n.filter(i=>o||i.length===r.size).some(i=>i.every(u=>r.has(u)))}function Ix(n,r){return r.includes(n)?"code":"key"}function Gg(n,r,o,i){const u=n.parentNode||n.parentId;if(!u)return o;const f=r.get(u),h=fs(f,i);return Gg(f,r,{x:(o.x??0)+h.x,y:(o.y??0)+h.y,z:(f[ct]?.z??0)>(o.z??0)?f[ct]?.z??0:o.z??0},i)}function Xg(n,r,o){n.forEach(i=>{const u=i.parentNode||i.parentId;if(u&&!n.has(u))throw new Error(`Parent node ${u} not found`);if(u||o?.[i.id]){const{x:f,y:h,z:g}=Gg(i,n,{...i.position,z:i[ct]?.z??0},r);i.positionAbsolute={x:f,y:h},i[ct].z=g,o?.[i.id]&&(i[ct].isParent=!0)}})}function wd(n,r,o,i){const u=new Map,f={},h=i?1e3:0;return n.forEach(g=>{const x=(yn(g.zIndex)?g.zIndex:0)+(g.selected?h:0),m=r.get(g.id),p={...g,positionAbsolute:{x:g.position.x,y:g.position.y}},b=g.parentNode||g.parentId;b&&(f[b]=!0);const v=m?.type&&m?.type!==g.type;Object.defineProperty(p,ct,{enumerable:!1,value:{handleBounds:v?void 0:m?.[ct]?.handleBounds,z:x}}),u.set(g.id,p)}),Xg(u,o,f),u}function Zg(n,r={}){const{getNodes:o,width:i,height:u,minZoom:f,maxZoom:h,d3Zoom:g,d3Selection:x,fitViewOnInitDone:m,fitViewOnInit:p,nodeOrigin:b}=n(),v=r.initial&&!m&&p;if(g&&x&&(v||!r.initial)){const C=o().filter(R=>{const z=r.includeHiddenNodes?R.width&&R.height:!R.hidden;return r.nodes?.length?z&&r.nodes.some(V=>V.id===R.id):z}),k=C.every(R=>R.width&&R.height);if(C.length>0&&k){const R=Ji(C,b),{x:z,y:V,zoom:q}=Ag(R,i,u,r.minZoom??f,r.maxZoom??h,r.padding??.1),M=ta.translate(z,V).scale(q);return typeof r.duration=="number"&&r.duration>0?g.transform(is(x,r.duration),M):g.transform(x,M),!0}}return!1}function P5(n,r){return n.forEach(o=>{const i=r.get(o.id);i&&r.set(i.id,{...i,[ct]:i[ct],selected:o.selected})}),new Map(r)}function eS(n,r){return r.map(o=>{const i=n.find(u=>u.id===o.id);return i&&(o.selected=i.selected),o})}function ji({changedNodes:n,changedEdges:r,get:o,set:i}){const{nodeInternals:u,edges:f,onNodesChange:h,onEdgesChange:g,hasDefaultNodes:x,hasDefaultEdges:m}=o();n?.length&&(x&&i({nodeInternals:P5(n,u)}),h?.(n)),r?.length&&(m&&i({edges:eS(r,f)}),g?.(r))}const nl=()=>{},tS={zoomIn:nl,zoomOut:nl,zoomTo:nl,getZoom:()=>1,setViewport:nl,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:nl,fitBounds:nl,project:n=>n,screenToFlowPosition:n=>n,flowToScreenPosition:n=>n,viewportInitialized:!1},nS=n=>({d3Zoom:n.d3Zoom,d3Selection:n.d3Selection}),aS=()=>{const n=Nt(),{d3Zoom:r,d3Selection:o}=tt(nS,Tt);return j.useMemo(()=>o&&r?{zoomIn:u=>r.scaleBy(is(o,u?.duration),1.2),zoomOut:u=>r.scaleBy(is(o,u?.duration),1/1.2),zoomTo:(u,f)=>r.scaleTo(is(o,f?.duration),u),getZoom:()=>n.getState().transform[2],setViewport:(u,f)=>{const[h,g,x]=n.getState().transform,m=ta.translate(u.x??h,u.y??g).scale(u.zoom??x);r.transform(is(o,f?.duration),m)},getViewport:()=>{const[u,f,h]=n.getState().transform;return{x:u,y:f,zoom:h}},fitView:u=>Zg(n.getState,u),setCenter:(u,f,h)=>{const{width:g,height:x,maxZoom:m}=n.getState(),p=typeof h?.zoom<"u"?h.zoom:m,b=g/2-u*p,v=x/2-f*p,N=ta.translate(b,v).scale(p);r.transform(is(o,h?.duration),N)},fitBounds:(u,f)=>{const{width:h,height:g,minZoom:x,maxZoom:m}=n.getState(),{x:p,y:b,zoom:v}=Ag(u,h,g,x,m,f?.padding??.1),N=ta.translate(p,b).scale(v);r.transform(is(o,f?.duration),N)},project:u=>{const{transform:f,snapToGrid:h,snapGrid:g}=n.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Xd(u,f,h,g)},screenToFlowPosition:u=>{const{transform:f,snapToGrid:h,snapGrid:g,domNode:x}=n.getState();if(!x)return u;const{x:m,y:p}=x.getBoundingClientRect(),b={x:u.x-m,y:u.y-p};return Xd(b,f,h,g)},flowToScreenPosition:u=>{const{transform:f,domNode:h}=n.getState();if(!h)return u;const{x:g,y:x}=h.getBoundingClientRect(),m=Cg(u,f);return{x:m.x+g,y:m.y+x}},viewportInitialized:!0}:tS,[r,o])};function gf(){const n=aS(),r=Nt(),o=j.useCallback(()=>r.getState().getNodes().map(k=>({...k})),[]),i=j.useCallback(k=>r.getState().nodeInternals.get(k),[]),u=j.useCallback(()=>{const{edges:k=[]}=r.getState();return k.map(R=>({...R}))},[]),f=j.useCallback(k=>{const{edges:R=[]}=r.getState();return R.find(z=>z.id===k)},[]),h=j.useCallback(k=>{const{getNodes:R,setNodes:z,hasDefaultNodes:V,onNodesChange:q}=r.getState(),M=R(),H=typeof k=="function"?k(M):k;if(V)z(H);else if(q){const Z=H.length===0?M.map(X=>({type:"remove",id:X.id})):H.map(X=>({item:X,type:"reset"}));q(Z)}},[]),g=j.useCallback(k=>{const{edges:R=[],setEdges:z,hasDefaultEdges:V,onEdgesChange:q}=r.getState(),M=typeof k=="function"?k(R):k;if(V)z(M);else if(q){const H=M.length===0?R.map(Z=>({type:"remove",id:Z.id})):M.map(Z=>({item:Z,type:"reset"}));q(H)}},[]),x=j.useCallback(k=>{const R=Array.isArray(k)?k:[k],{getNodes:z,setNodes:V,hasDefaultNodes:q,onNodesChange:M}=r.getState();if(q){const Z=[...z(),...R];V(Z)}else if(M){const H=R.map(Z=>({item:Z,type:"add"}));M(H)}},[]),m=j.useCallback(k=>{const R=Array.isArray(k)?k:[k],{edges:z=[],setEdges:V,hasDefaultEdges:q,onEdgesChange:M}=r.getState();if(q)V([...z,...R]);else if(M){const H=R.map(Z=>({item:Z,type:"add"}));M(H)}},[]),p=j.useCallback(()=>{const{getNodes:k,edges:R=[],transform:z}=r.getState(),[V,q,M]=z;return{nodes:k().map(H=>({...H})),edges:R.map(H=>({...H})),viewport:{x:V,y:q,zoom:M}}},[]),b=j.useCallback(({nodes:k,edges:R})=>{const{nodeInternals:z,getNodes:V,edges:q,hasDefaultNodes:M,hasDefaultEdges:H,onNodesDelete:Z,onEdgesDelete:X,onNodesChange:oe,onEdgesChange:I}=r.getState(),K=(k||[]).map(W=>W.id),ae=(R||[]).map(W=>W.id),te=V().reduce((W,E)=>{const $=E.parentNode||E.parentId,T=!K.includes(E.id)&&$&&W.find(S=>S.id===$);return(typeof E.deletable=="boolean"?E.deletable:!0)&&(K.includes(E.id)||T)&&W.push(E),W},[]),se=q.filter(W=>typeof W.deletable=="boolean"?W.deletable:!0),_=se.filter(W=>ae.includes(W.id));if(te||_){const W=Mg(te,se),E=[..._,...W],$=E.reduce((T,A)=>(T.includes(A.id)||T.push(A.id),T),[]);if((H||M)&&(H&&r.setState({edges:q.filter(T=>!$.includes(T.id))}),M&&(te.forEach(T=>{z.delete(T.id)}),r.setState({nodeInternals:new Map(z)}))),$.length>0&&(X?.(E),I&&I($.map(T=>({id:T,type:"remove"})))),te.length>0&&(Z?.(te),oe)){const T=te.map(A=>({id:A.id,type:"remove"}));oe(T)}}},[]),v=j.useCallback(k=>{const R=w5(k),z=R?null:r.getState().nodeInternals.get(k.id);return!R&&!z?[null,null,R]:[R?k:Yx(z),z,R]},[]),N=j.useCallback((k,R=!0,z)=>{const[V,q,M]=v(k);return V?(z||r.getState().getNodes()).filter(H=>{if(!M&&(H.id===q.id||!H.positionAbsolute))return!1;const Z=Yx(H),X=Ld(Z,V);return R&&X>0||X>=V.width*V.height}):[]},[]),C=j.useCallback((k,R,z=!0)=>{const[V]=v(k);if(!V)return!1;const q=Ld(V,R);return z&&q>0||q>=V.width*V.height},[]);return j.useMemo(()=>({...n,getNodes:o,getNode:i,getEdges:u,getEdge:f,setNodes:h,setEdges:g,addNodes:x,addEdges:m,toObject:p,deleteElements:b,getIntersectingNodes:N,isNodeIntersecting:C}),[n,o,i,u,f,h,g,x,m,p,b,N,C])}const sS={actInsideInputWithModifier:!1};var lS=({deleteKeyCode:n,multiSelectionKeyCode:r})=>{const o=Nt(),{deleteElements:i}=gf(),u=Lr(n,sS),f=Lr(r);j.useEffect(()=>{if(u){const{edges:h,getNodes:g}=o.getState(),x=g().filter(p=>p.selected),m=h.filter(p=>p.selected);i({nodes:x,edges:m}),o.setState({nodesSelectionActive:!1})}},[u]),j.useEffect(()=>{o.setState({multiSelectionActive:f})},[f])};function rS(n){const r=Nt();j.useEffect(()=>{let o;const i=()=>{if(!n.current)return;const u=cf(n.current);(u.height===0||u.width===0)&&r.getState().onError?.("004",sa.error004()),r.setState({width:u.width||500,height:u.height||500})};return i(),window.addEventListener("resize",i),n.current&&(o=new ResizeObserver(()=>i()),o.observe(n.current)),()=>{window.removeEventListener("resize",i),o&&n.current&&o.unobserve(n.current)}},[])}const yf={position:"absolute",width:"100%",height:"100%",top:0,left:0},oS=(n,r)=>n.x!==r.x||n.y!==r.y||n.zoom!==r.k,Ni=n=>({x:n.x,y:n.y,zoom:n.k}),al=(n,r)=>n.target.closest(`.${r}`),Fx=(n,r)=>r===2&&Array.isArray(n)&&n.includes(2),Px=n=>{const r=n.ctrlKey&&qi()?10:1;return-n.deltaY*(n.deltaMode===1?.05:n.deltaMode?1:.002)*r},iS=n=>({d3Zoom:n.d3Zoom,d3Selection:n.d3Selection,d3ZoomHandler:n.d3ZoomHandler,userSelectionActive:n.userSelectionActive}),cS=({onMove:n,onMoveStart:r,onMoveEnd:o,onPaneContextMenu:i,zoomOnScroll:u=!0,zoomOnPinch:f=!0,panOnScroll:h=!1,panOnScrollSpeed:g=.5,panOnScrollMode:x=us.Free,zoomOnDoubleClick:m=!0,elementsSelectable:p,panOnDrag:b=!0,defaultViewport:v,translateExtent:N,minZoom:C,maxZoom:k,zoomActivationKeyCode:R,preventScrolling:z=!0,children:V,noWheelClassName:q,noPanClassName:M})=>{const H=j.useRef(),Z=Nt(),X=j.useRef(!1),oe=j.useRef(!1),I=j.useRef(null),K=j.useRef({x:0,y:0,zoom:0}),{d3Zoom:ae,d3Selection:te,d3ZoomHandler:se,userSelectionActive:_}=tt(iS,Tt),W=Lr(R),E=j.useRef(0),$=j.useRef(!1),T=j.useRef();return rS(I),j.useEffect(()=>{if(I.current){const A=I.current.getBoundingClientRect(),S=xg().scaleExtent([C,k]).translateExtent(N),D=gn(I.current).call(S),L=ta.translate(v.x,v.y).scale(yl(v.zoom,C,k)),F=[[0,0],[A.width,A.height]],ie=S.constrain()(L,F,N);S.transform(D,ie),S.wheelDelta(Px),Z.setState({d3Zoom:S,d3Selection:D,d3ZoomHandler:D.on("wheel.zoom"),transform:[ie.x,ie.y,ie.k],domNode:I.current.closest(".react-flow")})}},[]),j.useEffect(()=>{te&&ae&&(h&&!W&&!_?te.on("wheel.zoom",A=>{if(al(A,q))return!1;A.preventDefault(),A.stopImmediatePropagation();const S=te.property("__zoom").k||1;if(A.ctrlKey&&f){const ve=Sn(A),Ae=Px(A),Re=S*Math.pow(2,Ae);ae.scaleTo(te,Re,ve,A);return}const D=A.deltaMode===1?20:1;let L=x===us.Vertical?0:A.deltaX*D,F=x===us.Horizontal?0:A.deltaY*D;!qi()&&A.shiftKey&&x!==us.Vertical&&(L=A.deltaY*D,F=0),ae.translateBy(te,-(L/S)*g,-(F/S)*g,{internal:!0});const ie=Ni(te.property("__zoom")),{onViewportChangeStart:he,onViewportChange:me,onViewportChangeEnd:Se}=Z.getState();clearTimeout(T.current),$.current||($.current=!0,r?.(A,ie),he?.(ie)),$.current&&(n?.(A,ie),me?.(ie),T.current=setTimeout(()=>{o?.(A,ie),Se?.(ie),$.current=!1},150))},{passive:!1}):typeof se<"u"&&te.on("wheel.zoom",function(A,S){if(!z&&A.type==="wheel"&&!A.ctrlKey||al(A,q))return null;A.preventDefault(),se.call(this,A,S)},{passive:!1}))},[_,h,x,te,ae,se,W,f,z,q,r,n,o]),j.useEffect(()=>{ae&&ae.on("start",A=>{if(!A.sourceEvent||A.sourceEvent.internal)return null;E.current=A.sourceEvent?.button;const{onViewportChangeStart:S}=Z.getState(),D=Ni(A.transform);X.current=!0,K.current=D,A.sourceEvent?.type==="mousedown"&&Z.setState({paneDragging:!0}),S?.(D),r?.(A.sourceEvent,D)})},[ae,r]),j.useEffect(()=>{ae&&(_&&!X.current?ae.on("zoom",null):_||ae.on("zoom",A=>{const{onViewportChange:S}=Z.getState();if(Z.setState({transform:[A.transform.x,A.transform.y,A.transform.k]}),oe.current=!!(i&&Fx(b,E.current??0)),(n||S)&&!A.sourceEvent?.internal){const D=Ni(A.transform);S?.(D),n?.(A.sourceEvent,D)}}))},[_,ae,n,b,i]),j.useEffect(()=>{ae&&ae.on("end",A=>{if(!A.sourceEvent||A.sourceEvent.internal)return null;const{onViewportChangeEnd:S}=Z.getState();if(X.current=!1,Z.setState({paneDragging:!1}),i&&Fx(b,E.current??0)&&!oe.current&&i(A.sourceEvent),oe.current=!1,(o||S)&&oS(K.current,A.transform)){const D=Ni(A.transform);K.current=D,clearTimeout(H.current),H.current=setTimeout(()=>{S?.(D),o?.(A.sourceEvent,D)},h?150:0)}})},[ae,h,b,o,i]),j.useEffect(()=>{ae&&ae.filter(A=>{const S=W||u,D=f&&A.ctrlKey;if((b===!0||Array.isArray(b)&&b.includes(1))&&A.button===1&&A.type==="mousedown"&&(al(A,"react-flow__node")||al(A,"react-flow__edge")))return!0;if(!b&&!S&&!h&&!m&&!f||_||!m&&A.type==="dblclick"||al(A,q)&&A.type==="wheel"||al(A,M)&&(A.type!=="wheel"||h&&A.type==="wheel"&&!W)||!f&&A.ctrlKey&&A.type==="wheel"||!S&&!h&&!D&&A.type==="wheel"||!b&&(A.type==="mousedown"||A.type==="touchstart")||Array.isArray(b)&&!b.includes(A.button)&&A.type==="mousedown")return!1;const L=Array.isArray(b)&&b.includes(A.button)||!A.button||A.button<=1;return(!A.ctrlKey||A.type==="wheel")&&L})},[_,ae,u,f,h,m,b,p,W]),le.createElement("div",{className:"react-flow__renderer",ref:I,style:yf},V)},uS=n=>({userSelectionActive:n.userSelectionActive,userSelectionRect:n.userSelectionRect});function dS(){const{userSelectionActive:n,userSelectionRect:r}=tt(uS,Tt);return n&&r?le.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:r.width,height:r.height,transform:`translate(${r.x}px, ${r.y}px)`}}):null}function e0(n,r){const o=r.parentNode||r.parentId,i=n.find(u=>u.id===o);if(i){const u=r.position.x+r.width-i.width,f=r.position.y+r.height-i.height;if(u>0||f>0||r.position.x<0||r.position.y<0){if(i.style={...i.style},i.style.width=i.style.width??i.width,i.style.height=i.style.height??i.height,u>0&&(i.style.width+=u),f>0&&(i.style.height+=f),r.position.x<0){const h=Math.abs(r.position.x);i.position.x=i.position.x-h,i.style.width+=h,r.position.x=0}if(r.position.y<0){const h=Math.abs(r.position.y);i.position.y=i.position.y-h,i.style.height+=h,r.position.y=0}i.width=i.style.width,i.height=i.style.height}}}function Wg(n,r){if(n.some(i=>i.type==="reset"))return n.filter(i=>i.type==="reset").map(i=>i.item);const o=n.filter(i=>i.type==="add").map(i=>i.item);return r.reduce((i,u)=>{const f=n.filter(g=>g.id===u.id);if(f.length===0)return i.push(u),i;const h={...u};for(const g of f)if(g)switch(g.type){case"select":{h.selected=g.selected;break}case"position":{typeof g.position<"u"&&(h.position=g.position),typeof g.positionAbsolute<"u"&&(h.positionAbsolute=g.positionAbsolute),typeof g.dragging<"u"&&(h.dragging=g.dragging),h.expandParent&&e0(i,h);break}case"dimensions":{typeof g.dimensions<"u"&&(h.width=g.dimensions.width,h.height=g.dimensions.height),typeof g.updateStyle<"u"&&(h.style={...h.style||{},...g.dimensions}),typeof g.resizing=="boolean"&&(h.resizing=g.resizing),h.expandParent&&e0(i,h);break}case"remove":return i}return i.push(h),i},o)}function Qg(n,r){return Wg(n,r)}function fS(n,r){return Wg(n,r)}const Ha=(n,r)=>({id:n,type:"select",selected:r});function cl(n,r){return n.reduce((o,i)=>{const u=r.includes(i.id);return!i.selected&&u?(i.selected=!0,o.push(Ha(i.id,!0))):i.selected&&!u&&(i.selected=!1,o.push(Ha(i.id,!1))),o},[])}const Sd=(n,r)=>o=>{o.target===r.current&&n?.(o)},hS=n=>({userSelectionActive:n.userSelectionActive,elementsSelectable:n.elementsSelectable,dragging:n.paneDragging}),Kg=j.memo(({isSelecting:n,selectionMode:r=qr.Full,panOnDrag:o,onSelectionStart:i,onSelectionEnd:u,onPaneClick:f,onPaneContextMenu:h,onPaneScroll:g,onPaneMouseEnter:x,onPaneMouseMove:m,onPaneMouseLeave:p,children:b})=>{const v=j.useRef(null),N=Nt(),C=j.useRef(0),k=j.useRef(0),R=j.useRef(),{userSelectionActive:z,elementsSelectable:V,dragging:q}=tt(hS,Tt),M=()=>{N.setState({userSelectionActive:!1,userSelectionRect:null}),C.current=0,k.current=0},H=se=>{f?.(se),N.getState().resetSelectedElements(),N.setState({nodesSelectionActive:!1})},Z=se=>{if(Array.isArray(o)&&o?.includes(2)){se.preventDefault();return}h?.(se)},X=g?se=>g(se):void 0,oe=se=>{const{resetSelectedElements:_,domNode:W}=N.getState();if(R.current=W?.getBoundingClientRect(),!V||!n||se.button!==0||se.target!==v.current||!R.current)return;const{x:E,y:$}=Ua(se,R.current);_(),N.setState({userSelectionRect:{width:0,height:0,startX:E,startY:$,x:E,y:$}}),i?.(se)},I=se=>{const{userSelectionRect:_,nodeInternals:W,edges:E,transform:$,onNodesChange:T,onEdgesChange:A,nodeOrigin:S,getNodes:D}=N.getState();if(!n||!R.current||!_)return;N.setState({userSelectionActive:!0,nodesSelectionActive:!1});const L=Ua(se,R.current),F=_.startX??0,ie=_.startY??0,he={..._,x:L.x<F?L.x:F,y:L.y<ie?L.y:ie,width:Math.abs(L.x-F),height:Math.abs(L.y-ie)},me=D(),Se=Tg(W,he,$,r===qr.Partial,!0,S),ve=Mg(Se,E).map(Re=>Re.id),Ae=Se.map(Re=>Re.id);if(C.current!==Ae.length){C.current=Ae.length;const Re=cl(me,Ae);Re.length&&T?.(Re)}if(k.current!==ve.length){k.current=ve.length;const Re=cl(E,ve);Re.length&&A?.(Re)}N.setState({userSelectionRect:he})},K=se=>{if(se.button!==0)return;const{userSelectionRect:_}=N.getState();!z&&_&&se.target===v.current&&H?.(se),N.setState({nodesSelectionActive:C.current>0}),M(),u?.(se)},ae=se=>{z&&(N.setState({nodesSelectionActive:C.current>0}),u?.(se)),M()},te=V&&(n||z);return le.createElement("div",{className:$t(["react-flow__pane",{dragging:q,selection:n}]),onClick:te?void 0:Sd(H,v),onContextMenu:Sd(Z,v),onWheel:Sd(X,v),onMouseEnter:te?void 0:x,onMouseDown:te?oe:void 0,onMouseMove:te?I:m,onMouseUp:te?K:void 0,onMouseLeave:te?ae:p,ref:v,style:yf},b,le.createElement(dS,null))});Kg.displayName="Pane";function Jg(n,r){const o=n.parentNode||n.parentId;if(!o)return!1;const i=r.get(o);return i?i.selected?!0:Jg(i,r):!1}function t0(n,r,o){let i=n;do{if(i?.matches(r))return!0;if(i===o.current)return!1;i=i.parentElement}while(i);return!1}function mS(n,r,o,i){return Array.from(n.values()).filter(u=>(u.selected||u.id===i)&&(!u.parentNode||u.parentId||!Jg(u,n))&&(u.draggable||r&&typeof u.draggable>"u")).map(u=>({id:u.id,position:u.position||{x:0,y:0},positionAbsolute:u.positionAbsolute||{x:0,y:0},distance:{x:o.x-(u.positionAbsolute?.x??0),y:o.y-(u.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:u.extent,parentNode:u.parentNode||u.parentId,parentId:u.parentNode||u.parentId,width:u.width,height:u.height,expandParent:u.expandParent}))}function pS(n,r){return!r||r==="parent"?r:[r[0],[r[1][0]-(n.width||0),r[1][1]-(n.height||0)]]}function Ig(n,r,o,i,u=[0,0],f){const h=pS(n,n.extent||i);let g=h;const x=n.parentNode||n.parentId;if(n.extent==="parent"&&!n.expandParent)if(x&&n.width&&n.height){const b=o.get(x),{x:v,y:N}=fs(b,u).positionAbsolute;g=b&&yn(v)&&yn(N)&&yn(b.width)&&yn(b.height)?[[v+n.width*u[0],N+n.height*u[1]],[v+b.width-n.width+n.width*u[0],N+b.height-n.height+n.height*u[1]]]:g}else f?.("005",sa.error005()),g=h;else if(n.extent&&x&&n.extent!=="parent"){const b=o.get(x),{x:v,y:N}=fs(b,u).positionAbsolute;g=[[n.extent[0][0]+v,n.extent[0][1]+N],[n.extent[1][0]+v,n.extent[1][1]+N]]}let m={x:0,y:0};if(x){const b=o.get(x);m=fs(b,u).positionAbsolute}const p=g&&g!=="parent"?uf(r,g):r;return{position:{x:p.x-m.x,y:p.y-m.y},positionAbsolute:p}}function Ed({nodeId:n,dragItems:r,nodeInternals:o}){const i=r.map(u=>({...o.get(u.id),position:u.position,positionAbsolute:u.positionAbsolute}));return[n?i.find(u=>u.id===n):i[0],i]}const n0=(n,r,o,i)=>{const u=r.querySelectorAll(n);if(!u||!u.length)return null;const f=Array.from(u),h=r.getBoundingClientRect(),g={x:h.width*i[0],y:h.height*i[1]};return f.map(x=>{const m=x.getBoundingClientRect();return{id:x.getAttribute("data-handleid"),position:x.getAttribute("data-handlepos"),x:(m.left-h.left-g.x)/o,y:(m.top-h.top-g.y)/o,...cf(x)}})};function kr(n,r,o){return o===void 0?o:i=>{const u=r().nodeInternals.get(n);u&&o(i,{...u})}}function Wd({id:n,store:r,unselect:o=!1,nodeRef:i}){const{addSelectedNodes:u,unselectNodesAndEdges:f,multiSelectionActive:h,nodeInternals:g,onError:x}=r.getState(),m=g.get(n);if(!m){x?.("012",sa.error012(n));return}r.setState({nodesSelectionActive:!1}),m.selected?(o||m.selected&&h)&&(f({nodes:[m],edges:[]}),requestAnimationFrame(()=>i?.current?.blur())):u([n])}function xS(){const n=Nt();return j.useCallback(({sourceEvent:o})=>{const{transform:i,snapGrid:u,snapToGrid:f}=n.getState(),h=o.touches?o.touches[0].clientX:o.clientX,g=o.touches?o.touches[0].clientY:o.clientY,x={x:(h-i[0])/i[2],y:(g-i[1])/i[2]};return{xSnapped:f?u[0]*Math.round(x.x/u[0]):x.x,ySnapped:f?u[1]*Math.round(x.y/u[1]):x.y,...x}},[])}function kd(n){return(r,o,i)=>n?.(r,i)}function Fg({nodeRef:n,disabled:r=!1,noDragClassName:o,handleSelector:i,nodeId:u,isSelectable:f,selectNodesOnDrag:h}){const g=Nt(),[x,m]=j.useState(!1),p=j.useRef([]),b=j.useRef({x:null,y:null}),v=j.useRef(0),N=j.useRef(null),C=j.useRef({x:0,y:0}),k=j.useRef(null),R=j.useRef(!1),z=j.useRef(!1),V=j.useRef(!1),q=xS();return j.useEffect(()=>{if(n?.current){const M=gn(n.current),H=({x:oe,y:I})=>{const{nodeInternals:K,onNodeDrag:ae,onSelectionDrag:te,updateNodePositions:se,nodeExtent:_,snapGrid:W,snapToGrid:E,nodeOrigin:$,onError:T}=g.getState();b.current={x:oe,y:I};let A=!1,S={x:0,y:0,x2:0,y2:0};if(p.current.length>1&&_){const L=Ji(p.current,$);S=Br(L)}if(p.current=p.current.map(L=>{const F={x:oe-L.distance.x,y:I-L.distance.y};E&&(F.x=W[0]*Math.round(F.x/W[0]),F.y=W[1]*Math.round(F.y/W[1]));const ie=[[_[0][0],_[0][1]],[_[1][0],_[1][1]]];p.current.length>1&&_&&!L.extent&&(ie[0][0]=L.positionAbsolute.x-S.x+_[0][0],ie[1][0]=L.positionAbsolute.x+(L.width??0)-S.x2+_[1][0],ie[0][1]=L.positionAbsolute.y-S.y+_[0][1],ie[1][1]=L.positionAbsolute.y+(L.height??0)-S.y2+_[1][1]);const he=Ig(L,F,K,ie,$,T);return A=A||L.position.x!==he.position.x||L.position.y!==he.position.y,L.position=he.position,L.positionAbsolute=he.positionAbsolute,L}),!A)return;se(p.current,!0,!0),m(!0);const D=u?ae:kd(te);if(D&&k.current){const[L,F]=Ed({nodeId:u,dragItems:p.current,nodeInternals:K});D(k.current,L,F)}},Z=()=>{if(!N.current)return;const[oe,I]=yg(C.current,N.current);if(oe!==0||I!==0){const{transform:K,panBy:ae}=g.getState();b.current.x=(b.current.x??0)-oe/K[2],b.current.y=(b.current.y??0)-I/K[2],ae({x:oe,y:I})&&H(b.current)}v.current=requestAnimationFrame(Z)},X=oe=>{const{nodeInternals:I,multiSelectionActive:K,nodesDraggable:ae,unselectNodesAndEdges:te,onNodeDragStart:se,onSelectionDragStart:_}=g.getState();z.current=!0;const W=u?se:kd(_);(!h||!f)&&!K&&u&&(I.get(u)?.selected||te()),u&&f&&h&&Wd({id:u,store:g,nodeRef:n});const E=q(oe);if(b.current=E,p.current=mS(I,ae,E,u),W&&p.current){const[$,T]=Ed({nodeId:u,dragItems:p.current,nodeInternals:I});W(oe.sourceEvent,$,T)}};if(r)M.on(".drag",null);else{const oe=_N().on("start",I=>{const{domNode:K,nodeDragThreshold:ae}=g.getState();ae===0&&X(I),V.current=!1;const te=q(I);b.current=te,N.current=K?.getBoundingClientRect()||null,C.current=Ua(I.sourceEvent,N.current)}).on("drag",I=>{const K=q(I),{autoPanOnNodeDrag:ae,nodeDragThreshold:te}=g.getState();if(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1&&(V.current=!0),!V.current){if(!R.current&&z.current&&ae&&(R.current=!0,Z()),!z.current){const se=K.xSnapped-(b?.current?.x??0),_=K.ySnapped-(b?.current?.y??0);Math.sqrt(se*se+_*_)>te&&X(I)}(b.current.x!==K.xSnapped||b.current.y!==K.ySnapped)&&p.current&&z.current&&(k.current=I.sourceEvent,C.current=Ua(I.sourceEvent,N.current),H(K))}}).on("end",I=>{if(!(!z.current||V.current)&&(m(!1),R.current=!1,z.current=!1,cancelAnimationFrame(v.current),p.current)){const{updateNodePositions:K,nodeInternals:ae,onNodeDragStop:te,onSelectionDragStop:se}=g.getState(),_=u?te:kd(se);if(K(p.current,!1,!1),_){const[W,E]=Ed({nodeId:u,dragItems:p.current,nodeInternals:ae});_(I.sourceEvent,W,E)}}}).filter(I=>{const K=I.target;return!I.button&&(!o||!t0(K,`.${o}`,n))&&(!i||t0(K,i,n))});return M.call(oe),()=>{M.on(".drag",null)}}}},[n,r,o,i,f,g,u,h,q]),x}function Pg(){const n=Nt();return j.useCallback(o=>{const{nodeInternals:i,nodeExtent:u,updateNodePositions:f,getNodes:h,snapToGrid:g,snapGrid:x,onError:m,nodesDraggable:p}=n.getState(),b=h().filter(V=>V.selected&&(V.draggable||p&&typeof V.draggable>"u")),v=g?x[0]:5,N=g?x[1]:5,C=o.isShiftPressed?4:1,k=o.x*v*C,R=o.y*N*C,z=b.map(V=>{if(V.positionAbsolute){const q={x:V.positionAbsolute.x+k,y:V.positionAbsolute.y+R};g&&(q.x=x[0]*Math.round(q.x/x[0]),q.y=x[1]*Math.round(q.y/x[1]));const{positionAbsolute:M,position:H}=Ig(V,q,i,u,void 0,m);V.position=H,V.positionAbsolute=M}return V});f(z,!0,!1)},[])}const pl={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var _r=n=>{const r=({id:o,type:i,data:u,xPos:f,yPos:h,xPosOrigin:g,yPosOrigin:x,selected:m,onClick:p,onMouseEnter:b,onMouseMove:v,onMouseLeave:N,onContextMenu:C,onDoubleClick:k,style:R,className:z,isDraggable:V,isSelectable:q,isConnectable:M,isFocusable:H,selectNodesOnDrag:Z,sourcePosition:X,targetPosition:oe,hidden:I,resizeObserver:K,dragHandle:ae,zIndex:te,isParent:se,noDragClassName:_,noPanClassName:W,initialized:E,disableKeyboardA11y:$,ariaLabel:T,rfId:A,hasHandleBounds:S})=>{const D=Nt(),L=j.useRef(null),F=j.useRef(null),ie=j.useRef(X),he=j.useRef(oe),me=j.useRef(i),Se=q||V||p||b||v||N,ve=Pg(),Ae=kr(o,D.getState,b),Re=kr(o,D.getState,v),We=kr(o,D.getState,N),Te=kr(o,D.getState,C),be=kr(o,D.getState,k),B=re=>{const{nodeDragThreshold:ee}=D.getState();if(q&&(!Z||!V||ee>0)&&Wd({id:o,store:D,nodeRef:L}),p){const Ee=D.getState().nodeInternals.get(o);Ee&&p(re,{...Ee})}},Y=re=>{if(!Yd(re)&&!$)if(Ng.includes(re.key)&&q){const ee=re.key==="Escape";Wd({id:o,store:D,unselect:ee,nodeRef:L})}else V&&m&&Object.prototype.hasOwnProperty.call(pl,re.key)&&(D.setState({ariaLiveMessage:`Moved selected node ${re.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~f}, y: ${~~h}`}),ve({x:pl[re.key].x,y:pl[re.key].y,isShiftPressed:re.shiftKey}))};j.useEffect(()=>()=>{F.current&&(K?.unobserve(F.current),F.current=null)},[]),j.useEffect(()=>{if(L.current&&!I){const re=L.current;(!E||!S||F.current!==re)&&(F.current&&K?.unobserve(F.current),K?.observe(re),F.current=re)}},[I,E,S]),j.useEffect(()=>{const re=me.current!==i,ee=ie.current!==X,Ee=he.current!==oe;L.current&&(re||ee||Ee)&&(re&&(me.current=i),ee&&(ie.current=X),Ee&&(he.current=oe),D.getState().updateNodeDimensions([{id:o,nodeElement:L.current,forceUpdate:!0}]))},[o,i,X,oe]);const ue=Fg({nodeRef:L,disabled:I||!V,noDragClassName:_,handleSelector:ae,nodeId:o,isSelectable:q,selectNodesOnDrag:Z});return I?null:le.createElement("div",{className:$t(["react-flow__node",`react-flow__node-${i}`,{[W]:V},z,{selected:m,selectable:q,parent:se,dragging:ue}]),ref:L,style:{zIndex:te,transform:`translate(${g}px,${x}px)`,pointerEvents:Se?"all":"none",visibility:E?"visible":"hidden",...R},"data-id":o,"data-testid":`rf__node-${o}`,onMouseEnter:Ae,onMouseMove:Re,onMouseLeave:We,onContextMenu:Te,onClick:B,onDoubleClick:be,onKeyDown:H?Y:void 0,tabIndex:H?0:void 0,role:H?"button":void 0,"aria-describedby":$?void 0:`${Yg}-${A}`,"aria-label":T},le.createElement(M5,{value:o},le.createElement(n,{id:o,data:u,type:i,xPos:f,yPos:h,selected:m,isConnectable:M,sourcePosition:X,targetPosition:oe,dragging:ue,dragHandle:ae,zIndex:te})))};return r.displayName="NodeWrapper",j.memo(r)};const gS=n=>{const r=n.getNodes().filter(o=>o.selected);return{...Ji(r,n.nodeOrigin),transformString:`translate(${n.transform[0]}px,${n.transform[1]}px) scale(${n.transform[2]})`,userSelectionActive:n.userSelectionActive}};function yS({onSelectionContextMenu:n,noPanClassName:r,disableKeyboardA11y:o}){const i=Nt(),{width:u,height:f,x:h,y:g,transformString:x,userSelectionActive:m}=tt(gS,Tt),p=Pg(),b=j.useRef(null);if(j.useEffect(()=>{o||b.current?.focus({preventScroll:!0})},[o]),Fg({nodeRef:b}),m||!u||!f)return null;const v=n?C=>{const k=i.getState().getNodes().filter(R=>R.selected);n(C,k)}:void 0,N=C=>{Object.prototype.hasOwnProperty.call(pl,C.key)&&p({x:pl[C.key].x,y:pl[C.key].y,isShiftPressed:C.shiftKey})};return le.createElement("div",{className:$t(["react-flow__nodesselection","react-flow__container",r]),style:{transform:x}},le.createElement("div",{ref:b,className:"react-flow__nodesselection-rect",onContextMenu:v,tabIndex:o?void 0:-1,onKeyDown:o?void 0:N,style:{width:u,height:f,top:g,left:h}}))}var bS=j.memo(yS);const vS=n=>n.nodesSelectionActive,ey=({children:n,onPaneClick:r,onPaneMouseEnter:o,onPaneMouseMove:i,onPaneMouseLeave:u,onPaneContextMenu:f,onPaneScroll:h,deleteKeyCode:g,onMove:x,onMoveStart:m,onMoveEnd:p,selectionKeyCode:b,selectionOnDrag:v,selectionMode:N,onSelectionStart:C,onSelectionEnd:k,multiSelectionKeyCode:R,panActivationKeyCode:z,zoomActivationKeyCode:V,elementsSelectable:q,zoomOnScroll:M,zoomOnPinch:H,panOnScroll:Z,panOnScrollSpeed:X,panOnScrollMode:oe,zoomOnDoubleClick:I,panOnDrag:K,defaultViewport:ae,translateExtent:te,minZoom:se,maxZoom:_,preventScrolling:W,onSelectionContextMenu:E,noWheelClassName:$,noPanClassName:T,disableKeyboardA11y:A})=>{const S=tt(vS),D=Lr(b),L=Lr(z),F=L||K,ie=L||Z,he=D||v&&F!==!0;return lS({deleteKeyCode:g,multiSelectionKeyCode:R}),le.createElement(cS,{onMove:x,onMoveStart:m,onMoveEnd:p,onPaneContextMenu:f,elementsSelectable:q,zoomOnScroll:M,zoomOnPinch:H,panOnScroll:ie,panOnScrollSpeed:X,panOnScrollMode:oe,zoomOnDoubleClick:I,panOnDrag:!D&&F,defaultViewport:ae,translateExtent:te,minZoom:se,maxZoom:_,zoomActivationKeyCode:V,preventScrolling:W,noWheelClassName:$,noPanClassName:T},le.createElement(Kg,{onSelectionStart:C,onSelectionEnd:k,onPaneClick:r,onPaneMouseEnter:o,onPaneMouseMove:i,onPaneMouseLeave:u,onPaneContextMenu:f,onPaneScroll:h,panOnDrag:F,isSelecting:!!he,selectionMode:N},n,S&&le.createElement(bS,{onSelectionContextMenu:E,noPanClassName:T,disableKeyboardA11y:A})))};ey.displayName="FlowRenderer";var jS=j.memo(ey);function NS(n){return tt(j.useCallback(o=>n?Tg(o.nodeInternals,{x:0,y:0,width:o.width,height:o.height},o.transform,!0):o.getNodes(),[n]))}function wS(n){const r={input:_r(n.input||Ug),default:_r(n.default||Zd),output:_r(n.output||qg),group:_r(n.group||xf)},o={},i=Object.keys(n).filter(u=>!["input","default","output","group"].includes(u)).reduce((u,f)=>(u[f]=_r(n[f]||Zd),u),o);return{...r,...i}}const SS=({x:n,y:r,width:o,height:i,origin:u})=>!o||!i?{x:n,y:r}:u[0]<0||u[1]<0||u[0]>1||u[1]>1?{x:n,y:r}:{x:n-o*u[0],y:r-i*u[1]},ES=n=>({nodesDraggable:n.nodesDraggable,nodesConnectable:n.nodesConnectable,nodesFocusable:n.nodesFocusable,elementsSelectable:n.elementsSelectable,updateNodeDimensions:n.updateNodeDimensions,onError:n.onError}),ty=n=>{const{nodesDraggable:r,nodesConnectable:o,nodesFocusable:i,elementsSelectable:u,updateNodeDimensions:f,onError:h}=tt(ES,Tt),g=NS(n.onlyRenderVisibleElements),x=j.useRef(),m=j.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const p=new ResizeObserver(b=>{const v=b.map(N=>({id:N.target.getAttribute("data-id"),nodeElement:N.target,forceUpdate:!0}));f(v)});return x.current=p,p},[]);return j.useEffect(()=>()=>{x?.current?.disconnect()},[]),le.createElement("div",{className:"react-flow__nodes",style:yf},g.map(p=>{let b=p.type||"default";n.nodeTypes[b]||(h?.("003",sa.error003(b)),b="default");const v=n.nodeTypes[b]||n.nodeTypes.default,N=!!(p.draggable||r&&typeof p.draggable>"u"),C=!!(p.selectable||u&&typeof p.selectable>"u"),k=!!(p.connectable||o&&typeof p.connectable>"u"),R=!!(p.focusable||i&&typeof p.focusable>"u"),z=n.nodeExtent?uf(p.positionAbsolute,n.nodeExtent):p.positionAbsolute,V=z?.x??0,q=z?.y??0,M=SS({x:V,y:q,width:p.width??0,height:p.height??0,origin:n.nodeOrigin});return le.createElement(v,{key:p.id,id:p.id,className:p.className,style:p.style,type:b,data:p.data,sourcePosition:p.sourcePosition||xe.Bottom,targetPosition:p.targetPosition||xe.Top,hidden:p.hidden,xPos:V,yPos:q,xPosOrigin:M.x,yPosOrigin:M.y,selectNodesOnDrag:n.selectNodesOnDrag,onClick:n.onNodeClick,onMouseEnter:n.onNodeMouseEnter,onMouseMove:n.onNodeMouseMove,onMouseLeave:n.onNodeMouseLeave,onContextMenu:n.onNodeContextMenu,onDoubleClick:n.onNodeDoubleClick,selected:!!p.selected,isDraggable:N,isSelectable:C,isConnectable:k,isFocusable:R,resizeObserver:m,dragHandle:p.dragHandle,zIndex:p[ct]?.z??0,isParent:!!p[ct]?.isParent,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,initialized:!!p.width&&!!p.height,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,ariaLabel:p.ariaLabel,hasHandleBounds:!!p[ct]?.handleBounds})}))};ty.displayName="NodeRenderer";var kS=j.memo(ty);const _S=(n,r,o)=>o===xe.Left?n-r:o===xe.Right?n+r:n,CS=(n,r,o)=>o===xe.Top?n-r:o===xe.Bottom?n+r:n,a0="react-flow__edgeupdater",s0=({position:n,centerX:r,centerY:o,radius:i=10,onMouseDown:u,onMouseEnter:f,onMouseOut:h,type:g})=>le.createElement("circle",{onMouseDown:u,onMouseEnter:f,onMouseOut:h,className:$t([a0,`${a0}-${g}`]),cx:_S(r,i,n),cy:CS(o,i,n),r:i,stroke:"transparent",fill:"transparent"}),TS=()=>!0;var sl=n=>{const r=({id:o,className:i,type:u,data:f,onClick:h,onEdgeDoubleClick:g,selected:x,animated:m,label:p,labelStyle:b,labelShowBg:v,labelBgStyle:N,labelBgPadding:C,labelBgBorderRadius:k,style:R,source:z,target:V,sourceX:q,sourceY:M,targetX:H,targetY:Z,sourcePosition:X,targetPosition:oe,elementsSelectable:I,hidden:K,sourceHandleId:ae,targetHandleId:te,onContextMenu:se,onMouseEnter:_,onMouseMove:W,onMouseLeave:E,reconnectRadius:$,onReconnect:T,onReconnectStart:A,onReconnectEnd:S,markerEnd:D,markerStart:L,rfId:F,ariaLabel:ie,isFocusable:he,isReconnectable:me,pathOptions:Se,interactionWidth:ve,disableKeyboardA11y:Ae})=>{const Re=j.useRef(null),[We,Te]=j.useState(!1),[be,B]=j.useState(!1),Y=Nt(),ue=j.useMemo(()=>`url('#${Gd(L,F)}')`,[L,F]),re=j.useMemo(()=>`url('#${Gd(D,F)}')`,[D,F]);if(K)return null;const ee=Ve=>{const{edges:je,addSelectedEdges:Le,unselectNodesAndEdges:Ge,multiSelectionActive:Rt}=Y.getState(),Vt=je.find(Jt=>Jt.id===o);Vt&&(I&&(Y.setState({nodesSelectionActive:!1}),Vt.selected&&Rt?(Ge({nodes:[],edges:[Vt]}),Re.current?.blur()):Le([o])),h&&h(Ve,Vt))},Ee=Er(o,Y.getState,g),ge=Er(o,Y.getState,se),ke=Er(o,Y.getState,_),Oe=Er(o,Y.getState,W),ze=Er(o,Y.getState,E),Mt=(Ve,je)=>{if(Ve.button!==0)return;const{edges:Le,isValidConnection:Ge}=Y.getState(),Rt=je?V:z,Vt=(je?te:ae)||null,Jt=je?"target":"source",Nl=Ge||TS,ys=je,la=Le.find(Dn=>Dn.id===o);B(!0),A?.(Ve,la,Jt);const Ya=Dn=>{B(!1),S?.(Dn,la,Jt)};Og({event:Ve,handleId:Vt,nodeId:Rt,onConnect:Dn=>T?.(la,Dn),isTarget:ys,getState:Y.getState,setState:Y.setState,isValidConnection:Nl,edgeUpdaterType:Jt,onReconnectEnd:Ya})},At=Ve=>Mt(Ve,!0),ft=Ve=>Mt(Ve,!1),nt=()=>Te(!0),pt=()=>Te(!1),at=!I&&!h,pe=Ve=>{if(!Ae&&Ng.includes(Ve.key)&&I){const{unselectNodesAndEdges:je,addSelectedEdges:Le,edges:Ge}=Y.getState();Ve.key==="Escape"?(Re.current?.blur(),je({edges:[Ge.find(Vt=>Vt.id===o)]})):Le([o])}};return le.createElement("g",{className:$t(["react-flow__edge",`react-flow__edge-${u}`,i,{selected:x,animated:m,inactive:at,updating:We}]),onClick:ee,onDoubleClick:Ee,onContextMenu:ge,onMouseEnter:ke,onMouseMove:Oe,onMouseLeave:ze,onKeyDown:he?pe:void 0,tabIndex:he?0:void 0,role:he?"button":"img","data-testid":`rf__edge-${o}`,"aria-label":ie===null?void 0:ie||`Edge from ${z} to ${V}`,"aria-describedby":he?`${Vg}-${F}`:void 0,ref:Re},!be&&le.createElement(n,{id:o,source:z,target:V,selected:x,animated:m,label:p,labelStyle:b,labelShowBg:v,labelBgStyle:N,labelBgPadding:C,labelBgBorderRadius:k,data:f,style:R,sourceX:q,sourceY:M,targetX:H,targetY:Z,sourcePosition:X,targetPosition:oe,sourceHandleId:ae,targetHandleId:te,markerStart:ue,markerEnd:re,pathOptions:Se,interactionWidth:ve}),me&&le.createElement(le.Fragment,null,(me==="source"||me===!0)&&le.createElement(s0,{position:X,centerX:q,centerY:M,radius:$,onMouseDown:At,onMouseEnter:nt,onMouseOut:pt,type:"source"}),(me==="target"||me===!0)&&le.createElement(s0,{position:oe,centerX:H,centerY:Z,radius:$,onMouseDown:ft,onMouseEnter:nt,onMouseOut:pt,type:"target"})))};return r.displayName="EdgeWrapper",j.memo(r)};function MS(n){const r={default:sl(n.default||Li),straight:sl(n.bezier||hf),step:sl(n.step||ff),smoothstep:sl(n.step||Ki),simplebezier:sl(n.simplebezier||df)},o={},i=Object.keys(n).filter(u=>!["default","bezier"].includes(u)).reduce((u,f)=>(u[f]=sl(n[f]||Li),u),o);return{...r,...i}}function l0(n,r,o=null){const i=(o?.x||0)+r.x,u=(o?.y||0)+r.y,f=o?.width||r.width,h=o?.height||r.height;switch(n){case xe.Top:return{x:i+f/2,y:u};case xe.Right:return{x:i+f,y:u+h/2};case xe.Bottom:return{x:i+f/2,y:u+h};case xe.Left:return{x:i,y:u+h/2}}}function r0(n,r){return n?n.length===1||!r?n[0]:r&&n.find(o=>o.id===r)||null:null}const AS=(n,r,o,i,u,f)=>{const h=l0(o,n,r),g=l0(f,i,u);return{sourceX:h.x,sourceY:h.y,targetX:g.x,targetY:g.y}};function RS({sourcePos:n,targetPos:r,sourceWidth:o,sourceHeight:i,targetWidth:u,targetHeight:f,width:h,height:g,transform:x}){const m={x:Math.min(n.x,r.x),y:Math.min(n.y,r.y),x2:Math.max(n.x+o,r.x+u),y2:Math.max(n.y+i,r.y+f)};m.x===m.x2&&(m.x2+=1),m.y===m.y2&&(m.y2+=1);const p=Br({x:(0-x[0])/x[2],y:(0-x[1])/x[2],width:h/x[2],height:g/x[2]}),b=Math.max(0,Math.min(p.x2,m.x2)-Math.max(p.x,m.x)),v=Math.max(0,Math.min(p.y2,m.y2)-Math.max(p.y,m.y));return Math.ceil(b*v)>0}function o0(n){const r=n?.[ct]?.handleBounds||null,o=r&&n?.width&&n?.height&&typeof n?.positionAbsolute?.x<"u"&&typeof n?.positionAbsolute?.y<"u";return[{x:n?.positionAbsolute?.x||0,y:n?.positionAbsolute?.y||0,width:n?.width||0,height:n?.height||0},r,!!o]}const zS=[{level:0,isMaxLevel:!0,edges:[]}];function OS(n,r,o=!1){let i=-1;const u=n.reduce((h,g)=>{const x=yn(g.zIndex);let m=x?g.zIndex:0;if(o){const p=r.get(g.target),b=r.get(g.source),v=g.selected||p?.selected||b?.selected,N=Math.max(b?.[ct]?.z||0,p?.[ct]?.z||0,1e3);m=(x?g.zIndex:0)+(v?N:0)}return h[m]?h[m].push(g):h[m]=[g],i=m>i?m:i,h},{}),f=Object.entries(u).map(([h,g])=>{const x=+h;return{edges:g,level:x,isMaxLevel:x===i}});return f.length===0?zS:f}function DS(n,r,o){const i=tt(j.useCallback(u=>n?u.edges.filter(f=>{const h=r.get(f.source),g=r.get(f.target);return h?.width&&h?.height&&g?.width&&g?.height&&RS({sourcePos:h.positionAbsolute||{x:0,y:0},targetPos:g.positionAbsolute||{x:0,y:0},sourceWidth:h.width,sourceHeight:h.height,targetWidth:g.width,targetHeight:g.height,width:u.width,height:u.height,transform:u.transform})}):u.edges,[n,r]));return OS(i,r,o)}const HS=({color:n="none",strokeWidth:r=1})=>le.createElement("polyline",{style:{stroke:n,strokeWidth:r},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),$S=({color:n="none",strokeWidth:r=1})=>le.createElement("polyline",{style:{stroke:n,fill:n,strokeWidth:r},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),i0={[Ba.Arrow]:HS,[Ba.ArrowClosed]:$S};function US(n){const r=Nt();return j.useMemo(()=>Object.prototype.hasOwnProperty.call(i0,n)?i0[n]:(r.getState().onError?.("009",sa.error009(n)),null),[n])}const BS=({id:n,type:r,color:o,width:i=12.5,height:u=12.5,markerUnits:f="strokeWidth",strokeWidth:h,orient:g="auto-start-reverse"})=>{const x=US(r);return x?le.createElement("marker",{className:"react-flow__arrowhead",id:n,markerWidth:`${i}`,markerHeight:`${u}`,viewBox:"-10 -10 20 20",markerUnits:f,orient:g,refX:"0",refY:"0"},le.createElement(x,{color:o,strokeWidth:h})):null},qS=({defaultColor:n,rfId:r})=>o=>{const i=[];return o.edges.reduce((u,f)=>([f.markerStart,f.markerEnd].forEach(h=>{if(h&&typeof h=="object"){const g=Gd(h,r);i.includes(g)||(u.push({id:g,color:h.color||n,...h}),i.push(g))}}),u),[]).sort((u,f)=>u.id.localeCompare(f.id))},ny=({defaultColor:n,rfId:r})=>{const o=tt(j.useCallback(qS({defaultColor:n,rfId:r}),[n,r]),(i,u)=>!(i.length!==u.length||i.some((f,h)=>f.id!==u[h].id)));return le.createElement("defs",null,o.map(i=>le.createElement(BS,{id:i.id,key:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient})))};ny.displayName="MarkerDefinitions";var LS=j.memo(ny);const YS=n=>({nodesConnectable:n.nodesConnectable,edgesFocusable:n.edgesFocusable,edgesUpdatable:n.edgesUpdatable,elementsSelectable:n.elementsSelectable,width:n.width,height:n.height,connectionMode:n.connectionMode,nodeInternals:n.nodeInternals,onError:n.onError}),ay=({defaultMarkerColor:n,onlyRenderVisibleElements:r,elevateEdgesOnSelect:o,rfId:i,edgeTypes:u,noPanClassName:f,onEdgeContextMenu:h,onEdgeMouseEnter:g,onEdgeMouseMove:x,onEdgeMouseLeave:m,onEdgeClick:p,onEdgeDoubleClick:b,onReconnect:v,onReconnectStart:N,onReconnectEnd:C,reconnectRadius:k,children:R,disableKeyboardA11y:z})=>{const{edgesFocusable:V,edgesUpdatable:q,elementsSelectable:M,width:H,height:Z,connectionMode:X,nodeInternals:oe,onError:I}=tt(YS,Tt),K=DS(r,oe,o);return H?le.createElement(le.Fragment,null,K.map(({level:ae,edges:te,isMaxLevel:se})=>le.createElement("svg",{key:ae,style:{zIndex:ae},width:H,height:Z,className:"react-flow__edges react-flow__container"},se&&le.createElement(LS,{defaultColor:n,rfId:i}),le.createElement("g",null,te.map(_=>{const[W,E,$]=o0(oe.get(_.source)),[T,A,S]=o0(oe.get(_.target));if(!$||!S)return null;let D=_.type||"default";u[D]||(I?.("011",sa.error011(D)),D="default");const L=u[D]||u.default,F=X===ps.Strict?A.target:(A.target??[]).concat(A.source??[]),ie=r0(E.source,_.sourceHandle),he=r0(F,_.targetHandle),me=ie?.position||xe.Bottom,Se=he?.position||xe.Top,ve=!!(_.focusable||V&&typeof _.focusable>"u"),Ae=_.reconnectable||_.updatable,Re=typeof v<"u"&&(Ae||q&&typeof Ae>"u");if(!ie||!he)return I?.("008",sa.error008(ie,_)),null;const{sourceX:We,sourceY:Te,targetX:be,targetY:B}=AS(W,ie,me,T,he,Se);return le.createElement(L,{key:_.id,id:_.id,className:$t([_.className,f]),type:D,data:_.data,selected:!!_.selected,animated:!!_.animated,hidden:!!_.hidden,label:_.label,labelStyle:_.labelStyle,labelShowBg:_.labelShowBg,labelBgStyle:_.labelBgStyle,labelBgPadding:_.labelBgPadding,labelBgBorderRadius:_.labelBgBorderRadius,style:_.style,source:_.source,target:_.target,sourceHandleId:_.sourceHandle,targetHandleId:_.targetHandle,markerEnd:_.markerEnd,markerStart:_.markerStart,sourceX:We,sourceY:Te,targetX:be,targetY:B,sourcePosition:me,targetPosition:Se,elementsSelectable:M,onContextMenu:h,onMouseEnter:g,onMouseMove:x,onMouseLeave:m,onClick:p,onEdgeDoubleClick:b,onReconnect:v,onReconnectStart:N,onReconnectEnd:C,reconnectRadius:k,rfId:i,ariaLabel:_.ariaLabel,isFocusable:ve,isReconnectable:Re,pathOptions:"pathOptions"in _?_.pathOptions:void 0,interactionWidth:_.interactionWidth,disableKeyboardA11y:z})})))),R):null};ay.displayName="EdgeRenderer";var VS=j.memo(ay);const GS=n=>`translate(${n.transform[0]}px,${n.transform[1]}px) scale(${n.transform[2]})`;function XS({children:n}){const r=tt(GS);return le.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:r}},n)}function ZS(n){const r=gf(),o=j.useRef(!1);j.useEffect(()=>{!o.current&&r.viewportInitialized&&n&&(setTimeout(()=>n(r),1),o.current=!0)},[n,r.viewportInitialized])}const WS={[xe.Left]:xe.Right,[xe.Right]:xe.Left,[xe.Top]:xe.Bottom,[xe.Bottom]:xe.Top},sy=({nodeId:n,handleType:r,style:o,type:i=$a.Bezier,CustomComponent:u,connectionStatus:f})=>{const{fromNode:h,handleId:g,toX:x,toY:m,connectionMode:p}=tt(j.useCallback(Z=>({fromNode:Z.nodeInternals.get(n),handleId:Z.connectionHandleId,toX:(Z.connectionPosition.x-Z.transform[0])/Z.transform[2],toY:(Z.connectionPosition.y-Z.transform[1])/Z.transform[2],connectionMode:Z.connectionMode}),[n]),Tt),b=h?.[ct]?.handleBounds;let v=b?.[r];if(p===ps.Loose&&(v=v||b?.[r==="source"?"target":"source"]),!h||!v)return null;const N=g?v.find(Z=>Z.id===g):v[0],C=N?N.x+N.width/2:(h.width??0)/2,k=N?N.y+N.height/2:h.height??0,R=(h.positionAbsolute?.x??0)+C,z=(h.positionAbsolute?.y??0)+k,V=N?.position,q=V?WS[V]:null;if(!V||!q)return null;if(u)return le.createElement(u,{connectionLineType:i,connectionLineStyle:o,fromNode:h,fromHandle:N,fromX:R,fromY:z,toX:x,toY:m,fromPosition:V,toPosition:q,connectionStatus:f});let M="";const H={sourceX:R,sourceY:z,sourcePosition:V,targetX:x,targetY:m,targetPosition:q};return i===$a.Bezier?[M]=_g(H):i===$a.Step?[M]=Vd({...H,borderRadius:0}):i===$a.SmoothStep?[M]=Vd(H):i===$a.SimpleBezier?[M]=kg(H):M=`M${R},${z} ${x},${m}`,le.createElement("path",{d:M,fill:"none",className:"react-flow__connection-path",style:o})};sy.displayName="ConnectionLine";const QS=n=>({nodeId:n.connectionNodeId,handleType:n.connectionHandleType,nodesConnectable:n.nodesConnectable,connectionStatus:n.connectionStatus,width:n.width,height:n.height});function KS({containerStyle:n,style:r,type:o,component:i}){const{nodeId:u,handleType:f,nodesConnectable:h,width:g,height:x,connectionStatus:m}=tt(QS,Tt);return!(u&&f&&g&&h)?null:le.createElement("svg",{style:n,width:g,height:x,className:"react-flow__edges react-flow__connectionline react-flow__container"},le.createElement("g",{className:$t(["react-flow__connection",m])},le.createElement(sy,{nodeId:u,handleType:f,style:r,type:o,CustomComponent:i,connectionStatus:m})))}function c0(n,r){return j.useRef(null),Nt(),j.useMemo(()=>r(n),[n])}const ly=({nodeTypes:n,edgeTypes:r,onMove:o,onMoveStart:i,onMoveEnd:u,onInit:f,onNodeClick:h,onEdgeClick:g,onNodeDoubleClick:x,onEdgeDoubleClick:m,onNodeMouseEnter:p,onNodeMouseMove:b,onNodeMouseLeave:v,onNodeContextMenu:N,onSelectionContextMenu:C,onSelectionStart:k,onSelectionEnd:R,connectionLineType:z,connectionLineStyle:V,connectionLineComponent:q,connectionLineContainerStyle:M,selectionKeyCode:H,selectionOnDrag:Z,selectionMode:X,multiSelectionKeyCode:oe,panActivationKeyCode:I,zoomActivationKeyCode:K,deleteKeyCode:ae,onlyRenderVisibleElements:te,elementsSelectable:se,selectNodesOnDrag:_,defaultViewport:W,translateExtent:E,minZoom:$,maxZoom:T,preventScrolling:A,defaultMarkerColor:S,zoomOnScroll:D,zoomOnPinch:L,panOnScroll:F,panOnScrollSpeed:ie,panOnScrollMode:he,zoomOnDoubleClick:me,panOnDrag:Se,onPaneClick:ve,onPaneMouseEnter:Ae,onPaneMouseMove:Re,onPaneMouseLeave:We,onPaneScroll:Te,onPaneContextMenu:be,onEdgeContextMenu:B,onEdgeMouseEnter:Y,onEdgeMouseMove:ue,onEdgeMouseLeave:re,onReconnect:ee,onReconnectStart:Ee,onReconnectEnd:ge,reconnectRadius:ke,noDragClassName:Oe,noWheelClassName:ze,noPanClassName:Mt,elevateEdgesOnSelect:At,disableKeyboardA11y:ft,nodeOrigin:nt,nodeExtent:pt,rfId:at})=>{const pe=c0(n,wS),Ve=c0(r,MS);return ZS(f),le.createElement(jS,{onPaneClick:ve,onPaneMouseEnter:Ae,onPaneMouseMove:Re,onPaneMouseLeave:We,onPaneContextMenu:be,onPaneScroll:Te,deleteKeyCode:ae,selectionKeyCode:H,selectionOnDrag:Z,selectionMode:X,onSelectionStart:k,onSelectionEnd:R,multiSelectionKeyCode:oe,panActivationKeyCode:I,zoomActivationKeyCode:K,elementsSelectable:se,onMove:o,onMoveStart:i,onMoveEnd:u,zoomOnScroll:D,zoomOnPinch:L,zoomOnDoubleClick:me,panOnScroll:F,panOnScrollSpeed:ie,panOnScrollMode:he,panOnDrag:Se,defaultViewport:W,translateExtent:E,minZoom:$,maxZoom:T,onSelectionContextMenu:C,preventScrolling:A,noDragClassName:Oe,noWheelClassName:ze,noPanClassName:Mt,disableKeyboardA11y:ft},le.createElement(XS,null,le.createElement(VS,{edgeTypes:Ve,onEdgeClick:g,onEdgeDoubleClick:m,onlyRenderVisibleElements:te,onEdgeContextMenu:B,onEdgeMouseEnter:Y,onEdgeMouseMove:ue,onEdgeMouseLeave:re,onReconnect:ee,onReconnectStart:Ee,onReconnectEnd:ge,reconnectRadius:ke,defaultMarkerColor:S,noPanClassName:Mt,elevateEdgesOnSelect:!!At,disableKeyboardA11y:ft,rfId:at},le.createElement(KS,{style:V,type:z,component:q,containerStyle:M})),le.createElement("div",{className:"react-flow__edgelabel-renderer"}),le.createElement(kS,{nodeTypes:pe,onNodeClick:h,onNodeDoubleClick:x,onNodeMouseEnter:p,onNodeMouseMove:b,onNodeMouseLeave:v,onNodeContextMenu:N,selectNodesOnDrag:_,onlyRenderVisibleElements:te,noPanClassName:Mt,noDragClassName:Oe,disableKeyboardA11y:ft,nodeOrigin:nt,nodeExtent:pt,rfId:at})))};ly.displayName="GraphView";var JS=j.memo(ly);const Qd=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Oa={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Qd,nodeExtent:Qd,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ps.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:S5,isValidConnection:void 0},IS=()=>B2((n,r)=>({...Oa,setNodes:o=>{const{nodeInternals:i,nodeOrigin:u,elevateNodesOnSelect:f}=r();n({nodeInternals:wd(o,i,u,f)})},getNodes:()=>Array.from(r().nodeInternals.values()),setEdges:o=>{const{defaultEdgeOptions:i={}}=r();n({edges:o.map(u=>({...i,...u}))})},setDefaultNodesAndEdges:(o,i)=>{const u=typeof o<"u",f=typeof i<"u",h=u?wd(o,new Map,r().nodeOrigin,r().elevateNodesOnSelect):new Map;n({nodeInternals:h,edges:f?i:[],hasDefaultNodes:u,hasDefaultEdges:f})},updateNodeDimensions:o=>{const{onNodesChange:i,nodeInternals:u,fitViewOnInit:f,fitViewOnInitDone:h,fitViewOnInitOptions:g,domNode:x,nodeOrigin:m}=r(),p=x?.querySelector(".react-flow__viewport");if(!p)return;const b=window.getComputedStyle(p),{m22:v}=new window.DOMMatrixReadOnly(b.transform),N=o.reduce((k,R)=>{const z=u.get(R.id);if(z?.hidden)u.set(z.id,{...z,[ct]:{...z[ct],handleBounds:void 0}});else if(z){const V=cf(R.nodeElement);!!(V.width&&V.height&&(z.width!==V.width||z.height!==V.height||R.forceUpdate))&&(u.set(z.id,{...z,[ct]:{...z[ct],handleBounds:{source:n0(".source",R.nodeElement,v,m),target:n0(".target",R.nodeElement,v,m)}},...V}),k.push({id:z.id,type:"dimensions",dimensions:V}))}return k},[]);Xg(u,m);const C=h||f&&!h&&Zg(r,{initial:!0,...g});n({nodeInternals:new Map(u),fitViewOnInitDone:C}),N?.length>0&&i?.(N)},updateNodePositions:(o,i=!0,u=!1)=>{const{triggerNodeChanges:f}=r(),h=o.map(g=>{const x={id:g.id,type:"position",dragging:u};return i&&(x.positionAbsolute=g.positionAbsolute,x.position=g.position),x});f(h)},triggerNodeChanges:o=>{const{onNodesChange:i,nodeInternals:u,hasDefaultNodes:f,nodeOrigin:h,getNodes:g,elevateNodesOnSelect:x}=r();if(o?.length){if(f){const m=Qg(o,g()),p=wd(m,u,h,x);n({nodeInternals:p})}i?.(o)}},addSelectedNodes:o=>{const{multiSelectionActive:i,edges:u,getNodes:f}=r();let h,g=null;i?h=o.map(x=>Ha(x,!0)):(h=cl(f(),o),g=cl(u,[])),ji({changedNodes:h,changedEdges:g,get:r,set:n})},addSelectedEdges:o=>{const{multiSelectionActive:i,edges:u,getNodes:f}=r();let h,g=null;i?h=o.map(x=>Ha(x,!0)):(h=cl(u,o),g=cl(f(),[])),ji({changedNodes:g,changedEdges:h,get:r,set:n})},unselectNodesAndEdges:({nodes:o,edges:i}={})=>{const{edges:u,getNodes:f}=r(),h=o||f(),g=i||u,x=h.map(p=>(p.selected=!1,Ha(p.id,!1))),m=g.map(p=>Ha(p.id,!1));ji({changedNodes:x,changedEdges:m,get:r,set:n})},setMinZoom:o=>{const{d3Zoom:i,maxZoom:u}=r();i?.scaleExtent([o,u]),n({minZoom:o})},setMaxZoom:o=>{const{d3Zoom:i,minZoom:u}=r();i?.scaleExtent([u,o]),n({maxZoom:o})},setTranslateExtent:o=>{r().d3Zoom?.translateExtent(o),n({translateExtent:o})},resetSelectedElements:()=>{const{edges:o,getNodes:i}=r(),f=i().filter(g=>g.selected).map(g=>Ha(g.id,!1)),h=o.filter(g=>g.selected).map(g=>Ha(g.id,!1));ji({changedNodes:f,changedEdges:h,get:r,set:n})},setNodeExtent:o=>{const{nodeInternals:i}=r();i.forEach(u=>{u.positionAbsolute=uf(u.position,o)}),n({nodeExtent:o,nodeInternals:new Map(i)})},panBy:o=>{const{transform:i,width:u,height:f,d3Zoom:h,d3Selection:g,translateExtent:x}=r();if(!h||!g||!o.x&&!o.y)return!1;const m=ta.translate(i[0]+o.x,i[1]+o.y).scale(i[2]),p=[[0,0],[u,f]],b=h?.constrain()(m,p,x);return h.transform(g,b),i[0]!==b.x||i[1]!==b.y||i[2]!==b.k},cancelConnection:()=>n({connectionNodeId:Oa.connectionNodeId,connectionHandleId:Oa.connectionHandleId,connectionHandleType:Oa.connectionHandleType,connectionStatus:Oa.connectionStatus,connectionStartHandle:Oa.connectionStartHandle,connectionEndHandle:Oa.connectionEndHandle}),reset:()=>n({...Oa})}),Object.is),ry=({children:n})=>{const r=j.useRef(null);return r.current||(r.current=IS()),le.createElement(g5,{value:r.current},n)};ry.displayName="ReactFlowProvider";const oy=({children:n})=>j.useContext(Qi)?le.createElement(le.Fragment,null,n):le.createElement(ry,null,n);oy.displayName="ReactFlowWrapper";const FS={input:Ug,default:Zd,output:qg,group:xf},PS={default:Li,straight:hf,step:ff,smoothstep:Ki,simplebezier:df},e3=[0,0],t3=[15,15],n3={x:0,y:0,zoom:1},a3={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},bf=j.forwardRef(({nodes:n,edges:r,defaultNodes:o,defaultEdges:i,className:u,nodeTypes:f=FS,edgeTypes:h=PS,onNodeClick:g,onEdgeClick:x,onInit:m,onMove:p,onMoveStart:b,onMoveEnd:v,onConnect:N,onConnectStart:C,onConnectEnd:k,onClickConnectStart:R,onClickConnectEnd:z,onNodeMouseEnter:V,onNodeMouseMove:q,onNodeMouseLeave:M,onNodeContextMenu:H,onNodeDoubleClick:Z,onNodeDragStart:X,onNodeDrag:oe,onNodeDragStop:I,onNodesDelete:K,onEdgesDelete:ae,onSelectionChange:te,onSelectionDragStart:se,onSelectionDrag:_,onSelectionDragStop:W,onSelectionContextMenu:E,onSelectionStart:$,onSelectionEnd:T,connectionMode:A=ps.Strict,connectionLineType:S=$a.Bezier,connectionLineStyle:D,connectionLineComponent:L,connectionLineContainerStyle:F,deleteKeyCode:ie="Backspace",selectionKeyCode:he="Shift",selectionOnDrag:me=!1,selectionMode:Se=qr.Full,panActivationKeyCode:ve="Space",multiSelectionKeyCode:Ae=qi()?"Meta":"Control",zoomActivationKeyCode:Re=qi()?"Meta":"Control",snapToGrid:We=!1,snapGrid:Te=t3,onlyRenderVisibleElements:be=!1,selectNodesOnDrag:B=!0,nodesDraggable:Y,nodesConnectable:ue,nodesFocusable:re,nodeOrigin:ee=e3,edgesFocusable:Ee,edgesUpdatable:ge,elementsSelectable:ke,defaultViewport:Oe=n3,minZoom:ze=.5,maxZoom:Mt=2,translateExtent:At=Qd,preventScrolling:ft=!0,nodeExtent:nt,defaultMarkerColor:pt="#b1b1b7",zoomOnScroll:at=!0,zoomOnPinch:pe=!0,panOnScroll:Ve=!1,panOnScrollSpeed:je=.5,panOnScrollMode:Le=us.Free,zoomOnDoubleClick:Ge=!0,panOnDrag:Rt=!0,onPaneClick:Vt,onPaneMouseEnter:Jt,onPaneMouseMove:Nl,onPaneMouseLeave:ys,onPaneScroll:la,onPaneContextMenu:Ya,children:ra,onEdgeContextMenu:Dn,onEdgeDoubleClick:Qr,onEdgeMouseEnter:Kr,onEdgeMouseMove:wl,onEdgeMouseLeave:Sl,onEdgeUpdate:Jr,onEdgeUpdateStart:Ii,onEdgeUpdateEnd:_n,onReconnect:wt,onReconnectStart:Ut,onReconnectEnd:oa,reconnectRadius:El=10,edgeUpdaterRadius:Fi=10,onNodesChange:Pi,onEdgesChange:Ir,noDragClassName:Va="nodrag",noWheelClassName:kl="nowheel",noPanClassName:Hn="nopan",fitView:ia=!1,fitViewOptions:Ga,connectOnClick:ca=!0,attributionPosition:xt,proOptions:Fr,defaultEdgeOptions:Pr,elevateNodesOnSelect:$n=!0,elevateEdgesOnSelect:ua=!1,disableKeyboardA11y:eo=!1,autoPanOnConnect:to=!0,autoPanOnNodeDrag:no=!0,connectionRadius:ec=20,isValidConnection:bs,onError:vs,style:bn,id:js,nodeDragThreshold:ao,...da},_l)=>{const Xa=js||"1";return le.createElement("div",{...da,style:{...bn,...a3},ref:_l,className:$t(["react-flow",u]),"data-testid":"rf__wrapper",id:js},le.createElement(oy,null,le.createElement(JS,{onInit:m,onMove:p,onMoveStart:b,onMoveEnd:v,onNodeClick:g,onEdgeClick:x,onNodeMouseEnter:V,onNodeMouseMove:q,onNodeMouseLeave:M,onNodeContextMenu:H,onNodeDoubleClick:Z,nodeTypes:f,edgeTypes:h,connectionLineType:S,connectionLineStyle:D,connectionLineComponent:L,connectionLineContainerStyle:F,selectionKeyCode:he,selectionOnDrag:me,selectionMode:Se,deleteKeyCode:ie,multiSelectionKeyCode:Ae,panActivationKeyCode:ve,zoomActivationKeyCode:Re,onlyRenderVisibleElements:be,selectNodesOnDrag:B,defaultViewport:Oe,translateExtent:At,minZoom:ze,maxZoom:Mt,preventScrolling:ft,zoomOnScroll:at,zoomOnPinch:pe,zoomOnDoubleClick:Ge,panOnScroll:Ve,panOnScrollSpeed:je,panOnScrollMode:Le,panOnDrag:Rt,onPaneClick:Vt,onPaneMouseEnter:Jt,onPaneMouseMove:Nl,onPaneMouseLeave:ys,onPaneScroll:la,onPaneContextMenu:Ya,onSelectionContextMenu:E,onSelectionStart:$,onSelectionEnd:T,onEdgeContextMenu:Dn,onEdgeDoubleClick:Qr,onEdgeMouseEnter:Kr,onEdgeMouseMove:wl,onEdgeMouseLeave:Sl,onReconnect:wt??Jr,onReconnectStart:Ut??Ii,onReconnectEnd:oa??_n,reconnectRadius:El??Fi,defaultMarkerColor:pt,noDragClassName:Va,noWheelClassName:kl,noPanClassName:Hn,elevateEdgesOnSelect:ua,rfId:Xa,disableKeyboardA11y:eo,nodeOrigin:ee,nodeExtent:nt}),le.createElement(W5,{nodes:n,edges:r,defaultNodes:o,defaultEdges:i,onConnect:N,onConnectStart:C,onConnectEnd:k,onClickConnectStart:R,onClickConnectEnd:z,nodesDraggable:Y,nodesConnectable:ue,nodesFocusable:re,edgesFocusable:Ee,edgesUpdatable:ge,elementsSelectable:ke,elevateNodesOnSelect:$n,minZoom:ze,maxZoom:Mt,nodeExtent:nt,onNodesChange:Pi,onEdgesChange:Ir,snapToGrid:We,snapGrid:Te,connectionMode:A,translateExtent:At,connectOnClick:ca,defaultEdgeOptions:Pr,fitView:ia,fitViewOptions:Ga,onNodesDelete:K,onEdgesDelete:ae,onNodeDragStart:X,onNodeDrag:oe,onNodeDragStop:I,onSelectionDrag:_,onSelectionDragStart:se,onSelectionDragStop:W,noPanClassName:Hn,nodeOrigin:ee,rfId:Xa,autoPanOnConnect:to,autoPanOnNodeDrag:no,onError:vs,connectionRadius:ec,isValidConnection:bs,nodeDragThreshold:ao}),le.createElement(X5,{onSelectionChange:te}),ra,le.createElement(b5,{proOptions:Fr,position:xt}),le.createElement(F5,{rfId:Xa,disableKeyboardA11y:eo})))});bf.displayName="ReactFlow";function iy(n){return r=>{const[o,i]=j.useState(r),u=j.useCallback(f=>i(h=>n(f,h)),[]);return[o,i,u]}}const cy=iy(Qg),uy=iy(fS),dy=({id:n,x:r,y:o,width:i,height:u,style:f,color:h,strokeColor:g,strokeWidth:x,className:m,borderRadius:p,shapeRendering:b,onClick:v,selected:N})=>{const{background:C,backgroundColor:k}=f||{},R=h||C||k;return le.createElement("rect",{className:$t(["react-flow__minimap-node",{selected:N},m]),x:r,y:o,rx:p,ry:p,width:i,height:u,fill:R,stroke:g,strokeWidth:x,shapeRendering:b,onClick:v?z=>v(z,n):void 0})};dy.displayName="MiniMapNode";var s3=j.memo(dy);const l3=n=>n.nodeOrigin,r3=n=>n.getNodes().filter(r=>!r.hidden&&r.width&&r.height),_d=n=>n instanceof Function?n:()=>n;function o3({nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:u=2,nodeComponent:f=s3,onClick:h}){const g=tt(r3,Tt),x=tt(l3),m=_d(r),p=_d(n),b=_d(o),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return le.createElement(le.Fragment,null,g.map(N=>{const{x:C,y:k}=fs(N,x).positionAbsolute;return le.createElement(f,{key:N.id,x:C,y:k,width:N.width,height:N.height,style:N.style,selected:N.selected,className:b(N),color:m(N),borderRadius:i,strokeColor:p(N),strokeWidth:u,shapeRendering:v,onClick:h,id:N.id})}))}var i3=j.memo(o3);const c3=200,u3=150,d3=n=>{const r=n.getNodes(),o={x:-n.transform[0]/n.transform[2],y:-n.transform[1]/n.transform[2],width:n.width/n.transform[2],height:n.height/n.transform[2]};return{viewBB:o,boundingRect:r.length>0?N5(Ji(r,n.nodeOrigin),o):o,rfId:n.rfId}},f3="react-flow__minimap-desc";function fy({style:n,className:r,nodeStrokeColor:o="transparent",nodeColor:i="#e2e2e2",nodeClassName:u="",nodeBorderRadius:f=5,nodeStrokeWidth:h=2,nodeComponent:g,maskColor:x="rgb(240, 240, 240, 0.6)",maskStrokeColor:m="none",maskStrokeWidth:p=1,position:b="bottom-right",onClick:v,onNodeClick:N,pannable:C=!1,zoomable:k=!1,ariaLabel:R="React Flow mini map",inversePan:z=!1,zoomStep:V=10,offsetScale:q=5}){const M=Nt(),H=j.useRef(null),{boundingRect:Z,viewBB:X,rfId:oe}=tt(d3,Tt),I=n?.width??c3,K=n?.height??u3,ae=Z.width/I,te=Z.height/K,se=Math.max(ae,te),_=se*I,W=se*K,E=q*se,$=Z.x-(_-Z.width)/2-E,T=Z.y-(W-Z.height)/2-E,A=_+E*2,S=W+E*2,D=`${f3}-${oe}`,L=j.useRef(0);L.current=se,j.useEffect(()=>{if(H.current){const he=gn(H.current),me=Ae=>{const{transform:Re,d3Selection:We,d3Zoom:Te}=M.getState();if(Ae.sourceEvent.type!=="wheel"||!We||!Te)return;const be=-Ae.sourceEvent.deltaY*(Ae.sourceEvent.deltaMode===1?.05:Ae.sourceEvent.deltaMode?1:.002)*V,B=Re[2]*Math.pow(2,be);Te.scaleTo(We,B)},Se=Ae=>{const{transform:Re,d3Selection:We,d3Zoom:Te,translateExtent:be,width:B,height:Y}=M.getState();if(Ae.sourceEvent.type!=="mousemove"||!We||!Te)return;const ue=L.current*Math.max(1,Re[2])*(z?-1:1),re={x:Re[0]-Ae.sourceEvent.movementX*ue,y:Re[1]-Ae.sourceEvent.movementY*ue},ee=[[0,0],[B,Y]],Ee=ta.translate(re.x,re.y).scale(Re[2]),ge=Te.constrain()(Ee,ee,be);Te.transform(We,ge)},ve=xg().on("zoom",C?Se:null).on("zoom.wheel",k?me:null);return he.call(ve),()=>{he.on("zoom",null)}}},[C,k,z,V]);const F=v?he=>{const me=Sn(he);v(he,{x:me[0],y:me[1]})}:void 0,ie=N?(he,me)=>{const Se=M.getState().nodeInternals.get(me);N(he,Se)}:void 0;return le.createElement(of,{position:b,style:n,className:$t(["react-flow__minimap",r]),"data-testid":"rf__minimap"},le.createElement("svg",{width:I,height:K,viewBox:`${$} ${T} ${A} ${S}`,role:"img","aria-labelledby":D,ref:H,onClick:F},R&&le.createElement("title",{id:D},R),le.createElement(i3,{onClick:ie,nodeColor:i,nodeStrokeColor:o,nodeBorderRadius:f,nodeClassName:u,nodeStrokeWidth:h,nodeComponent:g}),le.createElement("path",{className:"react-flow__minimap-mask",d:`M${$-E},${T-E}h${A+E*2}v${S+E*2}h${-A-E*2}z
412
- M${X.x},${X.y}h${X.width}v${X.height}h${-X.width}z`,fill:x,fillRule:"evenodd",stroke:m,strokeWidth:p,pointerEvents:"none"})))}fy.displayName="MiniMap";var h3=j.memo(fy);function m3(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},le.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function p3(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},le.createElement("path",{d:"M0 0h32v4.2H0z"}))}function x3(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},le.createElement("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 g3(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},le.createElement("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 y3(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},le.createElement("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"}))}const Ar=({children:n,className:r,...o})=>le.createElement("button",{type:"button",className:$t(["react-flow__controls-button",r]),...o},n);Ar.displayName="ControlButton";const b3=n=>({isInteractive:n.nodesDraggable||n.nodesConnectable||n.elementsSelectable,minZoomReached:n.transform[2]<=n.minZoom,maxZoomReached:n.transform[2]>=n.maxZoom}),hy=({style:n,showZoom:r=!0,showFitView:o=!0,showInteractive:i=!0,fitViewOptions:u,onZoomIn:f,onZoomOut:h,onFitView:g,onInteractiveChange:x,className:m,children:p,position:b="bottom-left"})=>{const v=Nt(),[N,C]=j.useState(!1),{isInteractive:k,minZoomReached:R,maxZoomReached:z}=tt(b3,Tt),{zoomIn:V,zoomOut:q,fitView:M}=gf();if(j.useEffect(()=>{C(!0)},[]),!N)return null;const H=()=>{V(),f?.()},Z=()=>{q(),h?.()},X=()=>{M(u),g?.()},oe=()=>{v.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),x?.(!k)};return le.createElement(of,{className:$t(["react-flow__controls",m]),position:b,style:n,"data-testid":"rf__controls"},r&&le.createElement(le.Fragment,null,le.createElement(Ar,{onClick:H,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:z},le.createElement(m3,null)),le.createElement(Ar,{onClick:Z,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:R},le.createElement(p3,null))),o&&le.createElement(Ar,{className:"react-flow__controls-fitview",onClick:X,title:"fit view","aria-label":"fit view"},le.createElement(x3,null)),i&&le.createElement(Ar,{className:"react-flow__controls-interactive",onClick:oe,title:"toggle interactivity","aria-label":"toggle interactivity"},k?le.createElement(y3,null):le.createElement(g3,null)),p)};hy.displayName="Controls";var my=j.memo(hy),ln;(function(n){n.Lines="lines",n.Dots="dots",n.Cross="cross"})(ln||(ln={}));function v3({color:n,dimensions:r,lineWidth:o}){return le.createElement("path",{stroke:n,strokeWidth:o,d:`M${r[0]/2} 0 V${r[1]} M0 ${r[1]/2} H${r[0]}`})}function j3({color:n,radius:r}){return le.createElement("circle",{cx:r,cy:r,r,fill:n})}const N3={[ln.Dots]:"#91919a",[ln.Lines]:"#eee",[ln.Cross]:"#e2e2e2"},w3={[ln.Dots]:1,[ln.Lines]:1,[ln.Cross]:6},S3=n=>({transform:n.transform,patternId:`pattern-${n.rfId}`});function py({id:n,variant:r=ln.Dots,gap:o=20,size:i,lineWidth:u=1,offset:f=2,color:h,style:g,className:x}){const m=j.useRef(null),{transform:p,patternId:b}=tt(S3,Tt),v=h||N3[r],N=i||w3[r],C=r===ln.Dots,k=r===ln.Cross,R=Array.isArray(o)?o:[o,o],z=[R[0]*p[2]||1,R[1]*p[2]||1],V=N*p[2],q=k?[V,V]:z,M=C?[V/f,V/f]:[q[0]/f,q[1]/f];return le.createElement("svg",{className:$t(["react-flow__background",x]),style:{...g,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:m,"data-testid":"rf__background"},le.createElement("pattern",{id:b+n,x:p[0]%z[0],y:p[1]%z[1],width:z[0],height:z[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${M[0]},-${M[1]})`},C?le.createElement(j3,{color:v,radius:V/f}):le.createElement(v3,{dimensions:q,color:v,lineWidth:u})),le.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${b+n})`}))}py.displayName="Background";var xy=j.memo(py);const u0={GET:{bg:"bg-emerald-500/10",text:"text-emerald-400",dot:"#34d399"},POST:{bg:"bg-[color:var(--brand)]/10",text:"text-[color:var(--brand)]",dot:"var(--brand)"},PUT:{bg:"bg-amber-500/10",text:"text-amber-400",dot:"#fbbf24"},PATCH:{bg:"bg-orange-500/10",text:"text-orange-400",dot:"#fb923c"},DELETE:{bg:"bg-red-500/10",text:"text-red-400",dot:"#f87171"},HEAD:{bg:"theme-bg-overlay-md",text:"theme-text-muted",dot:"var(--text-muted)"},OPTIONS:{bg:"bg-[color:var(--brand)]/10",text:"text-[color:var(--brand)]",dot:"var(--brand)"}};function vf(n){return u0[n.toUpperCase()]??u0.GET}const d0=["exists","not_exists","is_empty","is_not_empty"];function f0(n,r){return n.replace(/\{\{([^}]+)\}\}/g,(o,i)=>{const u=i.trim();if(u.includes(":")){const f=u.indexOf(":"),h=u.slice(0,f),g=u.slice(f+1);return r[`${h}:${g}`]??r[g]??""}return r[u]??""})}function E3(n,r){const o=f0(n.left,r),i=n.right!==void 0?f0(n.right,r):void 0;switch(n.operator){case"equals":return o===i;case"not_equals":return o!==i;case"greater_than":return Number(o)>Number(i);case"greater_than_or_equal":return Number(o)>=Number(i);case"less_than":return Number(o)<Number(i);case"less_than_or_equal":return Number(o)<=Number(i);case"exists":return o!==""&&o!==void 0;case"not_exists":return o===""||o===void 0;case"is_empty":return o===""||o===null;case"is_not_empty":return o!==""&&o!==null;case"contains":return i!==void 0&&o.includes(i);case"not_contains":return i!==void 0&&!o.includes(i);case"starts_with":return i!==void 0&&o.startsWith(i);case"ends_with":return i!==void 0&&o.endsWith(i);default:return!1}}function k3(n,r){const{rules:o}=n,i=o?.all??o?.any??[],u=!!o?.all;if(i.length===0)return{passed:!0,reason:"No rules"};const f=i.map(m=>({rule:m,ok:E3(m,r)})),h=u?f.every(m=>m.ok):f.some(m=>m.ok),g=f.filter(m=>!m.ok),x=h?`All conditions met (${u?"AND":"OR"})`:`Failed: ${g.map(m=>`${m.rule.left} ${m.rule.operator}${m.rule.right!==void 0?" "+m.rule.right:""}`).join(", ")}`;return{passed:h,reason:x}}async function _3(n,r){const o=n.replace(/^workflows\//,"").replace(/\.json$/,"");await fetch(`/api/workflows/${encodeURIComponent(o)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({steps:r})})}function C3({method:n}){const r=vf(n);return s.jsx("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium tracking-widest ${r.bg} ${r.text}`,children:n.toUpperCase()})}async function T3(){const n=await fetch("/api/workflows");if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}async function M3(n){const r=n.replace(/^workflows\//,"").replace(/\.json$/,""),o=await fetch(`/api/workflows/${encodeURIComponent(r)}`,{method:"DELETE"});if(!o.ok){const i=await o.json().catch(()=>({}));throw new Error(i.error??`HTTP ${o.status}`)}}const h0=/\{\{\s*human:([^}]+?)\s*\}\}/g;function jf(n){const r=new Set;for(const o of[n.path,JSON.stringify(n.body??{}),JSON.stringify(n.inject??{}),JSON.stringify(n.condition??{})]){if(!o)continue;h0.lastIndex=0;let i;for(;(i=h0.exec(o))!==null;){const u=i[1].trim();u&&r.add(u)}}return[...r]}function A3(n){const r=new Set;return n.forEach(o=>jf(o).forEach(i=>r.add(i))),[...r]}function R3(n){return/pass|secret|token|pwd|private|credential/i.test(n)}function z3({title:n,subtitle:r,fields:o,values:i,onChange:u,onSubmit:f,onCancel:h,submitLabel:g,error:x,submitting:m}){return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:s.jsxs("div",{className:"w-full max-w-sm rounded-xl border border-amber-500/25 theme-bg-overlay shadow-2xl",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b theme-border",children:[s.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-amber-500/15 text-amber-400",children:s.jsx(zr,{className:"h-3.5 w-3.5",strokeWidth:2})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-[12px] font-medium theme-text-primary",children:n}),r&&s.jsx("p",{className:"text-[10px] theme-text-faint truncate",children:r})]})]}),s.jsxs("div",{className:"space-y-2.5 p-4",children:[s.jsx("p",{className:"text-[11px] theme-text-muted",children:"This workflow needs a value only you know. The run stays paused until you answer."}),o.map(p=>s.jsxs("div",{children:[s.jsx("label",{className:"mb-1 block font-mono text-[10px] text-amber-400/90",children:`{{human:${p.key}}}`}),s.jsx("input",{autoFocus:o.length===1,type:R3(p.key)?"password":"text",value:i[p.key]??"",onChange:b=>u(p.key,b.target.value),onKeyDown:b=>{b.key==="Enter"&&f()},placeholder:p.hint??`Enter ${p.key}…`,className:"h-8 w-full rounded-lg border border-amber-500/30 theme-bg-overlay-md px-2.5 text-[12px] theme-text-primary placeholder-[var(--text-faint)] outline-none focus:border-amber-500/70 transition-colors"})]},p.key)),x&&s.jsx("p",{className:"text-[10px] text-red-400 leading-tight",children:x}),s.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[s.jsxs("button",{type:"button",onClick:f,disabled:!!m,className:"flex h-8 flex-1 items-center justify-center gap-1.5 rounded-lg bg-amber-500/20 border border-amber-500/40 px-3 text-[11px] font-medium text-amber-300 hover:bg-amber-500/30 transition-colors disabled:opacity-40 hover:cursor-pointer",children:[m?s.jsx(dt,{className:"h-3 w-3 animate-spin",strokeWidth:2}):s.jsx(ut,{className:"h-3 w-3",strokeWidth:2}),g]}),h&&s.jsxs("button",{type:"button",onClick:h,className:"flex h-8 items-center gap-1 rounded-lg border theme-border px-3 text-[11px] theme-text-muted hover:theme-text transition-colors hover:cursor-pointer",children:[s.jsx(Ct,{className:"h-3 w-3",strokeWidth:2})," Cancel run"]})]})]})]})})}const gy=230,Kd=64;function O3({data:n}){const r=vf(n.method),o={idle:"theme-border",running:"border-[color:var(--brand)]/60",passed:"border-emerald-500/40",failed:"border-red-500/40",skipped:"theme-border"},i={idle:"",running:"shadow-[0_0_12px_color-mix(in_srgb,var(--brand)_28%,transparent)]",passed:"shadow-[0_0_8px_rgba(52,211,153,0.15)]",failed:"shadow-[0_0_8px_rgba(248,113,113,0.15)]",skipped:""},u=n.status??"idle";return s.jsxs("div",{className:`rounded-lg border theme-bg-overlay flex items-center gap-2.5 px-3 overflow-hidden transition-all duration-300 ${o[u]} ${i[u]}`,style:{width:gy,height:Kd},children:[s.jsx(jt,{type:"target",position:xe.Top,style:{background:"transparent",border:"none"}}),s.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-[3px] transition-colors duration-300",style:{background:u==="running"?"var(--brand)":u==="passed"?r.dot:u==="failed"?"#f87171":`color-mix(in srgb, ${r.dot} 40%, transparent)`}}),s.jsxs("div",{className:"shrink-0 flex items-center justify-center",children:[u==="running"&&s.jsx(dt,{className:"h-3.5 w-3.5 text-[color:var(--brand)] animate-spin",strokeWidth:2}),u==="passed"&&s.jsx(ut,{className:"h-3.5 w-3.5 text-emerald-400",strokeWidth:2}),u==="failed"&&s.jsx(_t,{className:"h-3.5 w-3.5 text-red-400",strokeWidth:2}),u==="idle"&&s.jsx("span",{className:"flex h-3.5 w-3.5 items-center justify-center rounded-full border theme-border text-[8px] font-medium theme-text-faint",children:n.index+1}),u==="skipped"&&s.jsx("span",{className:"h-3.5 w-3.5 rounded-full border theme-border theme-bg-overlay-md"})]}),s.jsxs("div",{className:"min-w-0 flex-1 pl-0.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[s.jsx("span",{className:`text-[9px] font-medium ${r.text}`,children:n.method}),s.jsx("span",{className:"font-mono text-[10px] theme-text truncate",children:n.path}),n.result&&s.jsxs("span",{className:`ml-auto shrink-0 font-mono text-[9px] ${n.result.passed?"text-emerald-400":"text-red-400"}`,children:[n.result.status>0?n.result.status:"ERR"," · ",n.result.durationMs,"ms"]})]}),s.jsx("p",{className:"text-[9px] theme-text-faint truncate",children:n.name})]}),s.jsx(jt,{type:"source",position:xe.Bottom,style:{background:"transparent",border:"none"}})]})}function D3({data:n}){const r=n.passed,o=r===void 0?"color-mix(in srgb, var(--brand) 50%, transparent)":r?"rgba(52,211,153,0.7)":"rgba(248,113,113,0.7)";return s.jsxs("div",{style:{width:40,height:40,position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[s.jsx(jt,{type:"target",position:xe.Top,style:{background:"transparent",border:"none"}}),s.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",children:[s.jsx("polygon",{points:"20,2 38,20 20,38 2,20",fill:"none",stroke:o,strokeWidth:"1.5"}),s.jsx("polygon",{points:"20,8 32,20 20,32 8,20",fill:o,fillOpacity:.12,stroke:"none"})]}),s.jsx("span",{style:{position:"absolute",fontSize:8,fontFamily:"monospace",color:o,top:"50%",left:"50%",transform:"translate(-50%,-50%)",whiteSpace:"nowrap"},children:"◇"}),s.jsx(jt,{type:"source",position:xe.Bottom,style:{background:"transparent",border:"none"}})]})}const H3={step:O3,condition:D3};function $3({steps:n,runState:r}){const[o,i,u]=cy([]),[f,h,g]=uy([]);j.useEffect(()=>{const v=[],N=[];let C=40;for(let k=0;k<n.length;k++){const R=n[k],z=r.stepStatuses[k]??"idle",V=r.stepResults[k]??null;if(v.push({id:`step-${k}`,type:"step",position:{x:0,y:C},data:{index:k,name:R.name,method:R.method,path:R.path,status:z,result:V}}),C+=Kd+36,R.condition){const q=`cond-${k}`,M=V?.conditionResult;v.push({id:q,type:"condition",position:{x:gy/2-20,y:C},data:{passed:M?.passed}});const H=z==="passed"?"rgba(52,211,153,0.3)":z==="failed"?"rgba(248,113,113,0.3)":"color-mix(in srgb, var(--brand) 18%, transparent)";if(N.push({id:`e-${k}-cond`,source:`step-${k}`,target:q,style:{stroke:H,strokeWidth:1.5},markerEnd:{type:Ba.ArrowClosed,color:H},animated:z==="running"}),C+=64,k<n.length-1){const Z=M?.passed===!0?"rgba(52,211,153,0.5)":"color-mix(in srgb, var(--brand) 18%, transparent)",X=M?.passed===!1?"rgba(248,113,113,0.5)":"color-mix(in srgb, var(--brand) 10%, transparent)";N.push({id:`e-${k}-cond-pass`,source:q,target:`step-${k+1}`,label:"PASS",labelStyle:{fill:"rgba(52,211,153,0.8)",fontSize:8,fontFamily:"monospace"},labelBgStyle:{fill:"transparent"},style:{stroke:Z,strokeWidth:1.2},markerEnd:{type:Ba.ArrowClosed,color:Z}}),N.push({id:`e-${k}-cond-fail`,source:q,target:`step-${k+1}`,label:`FAIL→${R.condition.onFail.toUpperCase()}`,labelStyle:{fill:"rgba(248,113,113,0.8)",fontSize:8,fontFamily:"monospace"},labelBgStyle:{fill:"transparent"},style:{stroke:X,strokeWidth:1.2,strokeDasharray:"4 3"}})}}else if(k<n.length-1){const q=Object.keys(R.capture??{}),M=q.length>0?q.map(X=>X.split(":").pop()).join(", "):void 0,H=r.stepStatuses[k]??"idle",Z=H==="passed"?"rgba(52,211,153,0.3)":H==="failed"?"rgba(248,113,113,0.3)":"color-mix(in srgb, var(--brand) 18%, transparent)";N.push({id:`e-${k}`,source:`step-${k}`,target:`step-${k+1}`,label:M,labelStyle:{fill:"color-mix(in srgb, var(--brand) 70%, transparent)",fontSize:9,fontFamily:"monospace"},labelBgStyle:{fill:"transparent"},style:{stroke:Z,strokeWidth:1.5,strokeDasharray:H==="idle"||H==="running"?"5 5":void 0},markerEnd:{type:Ba.ArrowClosed,color:H==="passed"?"rgba(52,211,153,0.4)":"color-mix(in srgb, var(--brand) 30%, transparent)"},animated:H==="running"})}}i(v),h(N)},[n,r.stepStatuses,r.stepResults]);const x=n.reduce((m,p)=>m+Kd+36+(p.condition?64:0),40);return s.jsx("div",{style:{height:Math.max(400,x)},className:"w-full rounded-lg overflow-hidden",children:s.jsxs(bf,{nodes:o,edges:f,onNodesChange:u,onEdgesChange:g,nodeTypes:H3,fitView:!0,fitViewOptions:{padding:.3},proOptions:{hideAttribution:!0},minZoom:.3,maxZoom:2,children:[s.jsx(xy,{variant:ln.Dots,gap:20,size:1,color:"var(--border)"}),s.jsx(my,{showInteractive:!1,className:"theme-bg-overlay border theme-border"})]})})}function U3({runState:n,steps:r,waitingStepIndex:o}){const i=j.useRef(null);return j.useEffect(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[n.stepResults,n.phase]),n.phase==="idle"?null:s.jsxs("div",{className:"mt-3 rounded-lg border theme-border theme-bg-overlay",children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b theme-border theme-bg-overlay-md",children:[s.jsx("span",{className:"text-[10px] font-semibold theme-text-muted uppercase tracking-wider",children:"Run Log"}),n.baseUrl&&s.jsxs("span",{className:"font-mono text-[10px] theme-text-faint",children:["→ ",n.baseUrl]}),s.jsxs("span",{className:"ml-auto flex items-center gap-2 text-[10px]",children:[n.passed>0&&s.jsxs("span",{className:"text-emerald-400",children:[n.passed," passed"]}),n.failed>0&&s.jsxs("span",{className:"text-red-400",children:[n.failed," failed"]}),n.phase==="running"&&s.jsx(dt,{className:"h-3 w-3 text-[color:var(--brand)] animate-spin",strokeWidth:2}),n.phase==="done"&&s.jsx(ut,{className:"h-3 w-3 text-emerald-400",strokeWidth:2}),n.phase==="aborted"&&s.jsx(_t,{className:"h-3 w-3 text-red-400",strokeWidth:2})]})]}),s.jsxs("div",{ref:i,className:"overflow-y-auto max-h-80 font-mono text-[11px] p-3 space-y-1",children:[s.jsx("p",{className:"theme-text-faint",children:"▶ Starting workflow execution…"}),n.humanUnsupported&&s.jsxs("p",{className:"text-red-400",children:["⚠ Connected server doesn't support ","{{human:*}}"," — restart `jetic dev` from the latest build. Human values will resolve empty and the dialog will never appear."]}),(n.humanKeys??[]).filter(u=>u.source==="prompt").map(u=>s.jsxs("p",{className:"text-amber-400",children:["◉ will ask for ",`{{human:${u.key}}}`," when reached"]},`need-${u.key}`)),(n.humanKeys??[]).filter(u=>u.source!=="prompt").map(u=>s.jsxs("p",{className:"theme-text-faint",children:["↳ human ",`{{human:${u.key}}}`," ← ",yy[u.source]??u.source," (ready)"]},`have-${u.key}`)),(n.notes??[]).map((u,f)=>s.jsx("p",{className:"theme-text-faint",children:u},`note-${f}`)),n.stepResults.map((u,f)=>{if(!u&&n.stepStatuses[f]!=="running")return null;const h=r[f],g=vf(h.method);return n.stepStatuses[f]==="running"?s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 theme-text-muted",children:[s.jsx(dt,{className:"h-3 w-3 animate-spin text-[color:var(--brand)]",strokeWidth:2}),s.jsxs("span",{className:"theme-text-faint",children:["Step ",f+1,"/",r.length]}),s.jsx("span",{className:g.text,children:h.method}),s.jsx("span",{className:"theme-text",children:h.path}),s.jsx("span",{className:"theme-text-faint",children:"…"})]}),o===f&&s.jsx("p",{className:"pl-5 text-amber-400",children:"⏳ Waiting for your input — answer the dialog to resume the run."})]},f):u?s.jsxs("div",{className:"space-y-0.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:u.passed?"text-emerald-400":"text-red-400",children:u.passed?"✓":"✗"}),s.jsxs("span",{className:"theme-text-faint",children:["Step ",f+1,"/",r.length]}),s.jsx("span",{className:`${g.text}`,children:h.method.padEnd(6)}),s.jsx("span",{className:"theme-text",children:h.path}),s.jsx("span",{className:`${u.passed?"text-emerald-400":"text-red-400"}`,children:u.status>0?u.status:"NO RESPONSE"}),s.jsxs("span",{className:"theme-text-faint",children:[u.durationMs,"ms"]})]}),h.name&&s.jsx("p",{className:"pl-5 theme-text-faint italic",children:h.name}),Object.entries(u.injected??{}).filter(([m])=>m!=="Content-Type").map(([m,p])=>s.jsxs("p",{className:"pl-5 theme-text-faint",children:["↳ ",s.jsxs("span",{className:"text-amber-500/80",children:[m,":"]})," ",s.jsx("span",{className:"theme-text-faint",children:String(p).length>60?String(p).slice(0,57)+"…":p})]},m)),u.captured.map((m,p)=>s.jsxs("p",{className:"pl-5 text-emerald-400",children:["↳ captured ",m]},p)),u.conditionResult&&s.jsxs("p",{className:`pl-5 ${u.conditionResult.passed?"text-[color:var(--brand)]":"text-orange-400"}`,children:["◇ condition ",u.conditionResult.passed?"passed":"failed"," — ",u.conditionResult.reason,!u.conditionResult.passed&&h.condition&&s.jsxs("span",{className:"text-orange-300/70",children:[" → ",h.condition.onFail,h.condition.onFail==="switch"&&h.condition.switchToWorkflow?`: ${h.condition.switchToWorkflow}`:""]})]}),u.error&&s.jsxs("p",{className:"pl-5 text-red-400",children:["Error: ",u.error]}),!u.passed&&u.responseBody&&!u.error&&s.jsxs("p",{className:"pl-5 text-red-400/80 truncate",children:["Response: ",typeof u.responseBody=="string"?u.responseBody.slice(0,120):JSON.stringify(u.responseBody).slice(0,120)]})]},f):null}),n.phase==="done"&&s.jsxs("p",{className:`mt-1 ${n.failed===0?"text-emerald-400":"text-amber-400"}`,children:["✓ Done — ",n.passed,"/",n.passed+n.failed," steps passed"]}),n.phase==="aborted"&&s.jsxs("p",{className:"mt-1 text-red-400",children:["✗ Aborted — ",n.error]}),n.phase==="error"&&s.jsxs("p",{className:"mt-1 text-red-400",children:["✗ Error — ",n.error]})]})]})}const B3=[{label:"Equality",ops:[{value:"equals",label:"equals"},{value:"not_equals",label:"not equals"}]},{label:"Comparison",ops:[{value:"greater_than",label:"greater than"},{value:"greater_than_or_equal",label:"greater than or equal"},{value:"less_than",label:"less than"},{value:"less_than_or_equal",label:"less than or equal"}]},{label:"Existence",ops:[{value:"exists",label:"exists"},{value:"not_exists",label:"does not exist"},{value:"is_empty",label:"is empty"},{value:"is_not_empty",label:"is not empty"}]},{label:"Text / Collection",ops:[{value:"contains",label:"contains"},{value:"not_contains",label:"does not contain"},{value:"starts_with",label:"starts with"},{value:"ends_with",label:"ends with"}]}];function m0(){return{left:"",operator:"equals",right:""}}function q3({stepIndex:n,existingCondition:r,capturedKeys:o,onSave:i,onRemove:u,onCancel:f}){const[h,g]=j.useState(r?.rules?.all?"all":r?.rules?.any?"any":"all"),x=r?.rules?.all??r?.rules?.any??[],[m,p]=j.useState(x.length>0?x:[m0()]),[b,v]=j.useState(r?.onFail??"abort"),[N,C]=j.useState(r?.switchToWorkflow??""),[k,R]=j.useState(r?.returnOnComplete??!0),z=(X,oe)=>{p(I=>I.map((K,ae)=>ae===X?{...K,...oe}:K))},V=()=>p(X=>[...X,m0()]),q=X=>p(oe=>oe.filter((I,K)=>K!==X)),M=()=>{const X=m.filter(I=>I.left.trim()!=="");if(X.length===0)return;const oe={rules:h==="all"?{all:X}:{any:X},onFail:b,...b==="switch"&&N.trim()?{switchToWorkflow:N.trim(),returnOnComplete:k}:{}};i(oe)},H="h-7 rounded-lg border theme-border theme-bg-overlay-md px-2 text-[11px] theme-text-primary placeholder-[var(--text-faint)] outline-none focus:border-[color:var(--brand)]/60 transition-colors",Z=`${H} cursor-pointer`;return s.jsxs("div",{className:"mt-2 rounded-lg border border-[color:var(--brand)]/20 bg-[color:var(--brand)]/[0.04] p-3 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ea,{className:"h-3 w-3 text-[color:var(--brand)]",strokeWidth:2}),s.jsx("span",{className:"text-[10px] font-semibold text-[color:var(--brand)] uppercase tracking-wider",children:"Step Condition"}),s.jsx("span",{className:"text-[10px] theme-text-faint ml-1",children:"— evaluated after this step runs"}),s.jsx("div",{className:"ml-auto flex items-center gap-1",children:["all","any"].map(X=>s.jsx("button",{type:"button",onClick:()=>g(X),className:`px-2 py-0.5 rounded text-[9px] font-semibold transition-colors hover:cursor-pointer ${h===X?"bg-[color:var(--brand)]/20 text-[color:var(--brand)] border border-[color:var(--brand)]/40":"theme-bg-overlay-md theme-text-faint border theme-border hover:theme-text-muted"}`,children:X==="all"?"AND":"OR"},X))})]}),s.jsxs("div",{className:"space-y-2",children:[m.map((X,oe)=>s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("input",{list:`cond-left-${n}-${oe}`,value:X.left,onChange:I=>z(oe,{left:I.target.value}),placeholder:"{{workflow:key}} or value",className:`flex-1 min-w-0 ${H}`}),s.jsx("datalist",{id:`cond-left-${n}-${oe}`,children:o.map(I=>s.jsx("option",{value:`{{${I}}}`},I))}),s.jsx("select",{value:X.operator,onChange:I=>z(oe,{operator:I.target.value,right:d0.includes(I.target.value)?void 0:X.right}),className:`w-44 shrink-0 ${Z}`,children:B3.map(I=>s.jsx("optgroup",{label:I.label,children:I.ops.map(K=>s.jsx("option",{value:K.value,children:K.label},K.value))},I.label))}),d0.includes(X.operator)?s.jsx("div",{className:"flex-1"}):s.jsx("input",{value:X.right??"",onChange:I=>z(oe,{right:I.target.value}),placeholder:"value or {{workflow:key}}",className:`flex-1 min-w-0 ${H}`}),m.length>1&&s.jsx("button",{type:"button",onClick:()=>q(oe),className:"shrink-0 theme-text-faint hover:text-red-400 transition-colors hover:cursor-pointer",children:s.jsx(Ct,{className:"h-3 w-3",strokeWidth:2})})]},oe)),s.jsxs("button",{type:"button",onClick:V,className:"flex items-center gap-1 text-[10px] text-[color:var(--brand)]/70 hover:text-[color:var(--brand)] transition-colors hover:cursor-pointer",children:[s.jsx(Ht,{className:"h-3 w-3",strokeWidth:2})," Add rule"]})]}),s.jsxs("div",{className:"flex flex-col gap-2 pt-1 border-t border-[color:var(--brand)]/10",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[10px] theme-text-faint shrink-0",children:"If condition fails →"}),["abort","continue","switch"].map(X=>s.jsx("button",{type:"button",onClick:()=>v(X),className:`px-2 py-0.5 rounded text-[9px] font-medium capitalize transition-colors border hover:cursor-pointer ${b===X?X==="abort"?"bg-red-500/20 text-red-400 border-red-500/40":X==="continue"?"bg-emerald-500/20 text-emerald-400 border-emerald-500/40":"bg-[color:var(--brand)]/20 text-[color:var(--brand)] border-[color:var(--brand)]/40":"theme-bg-overlay-md theme-text-faint theme-border hover:theme-text-muted"}`,children:X},X)),b==="switch"&&s.jsx("input",{value:N,onChange:X=>C(X.target.value),placeholder:"workflow-slug",className:`flex-1 ${H}`})]}),b==="switch"&&s.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] theme-text-muted cursor-pointer select-none ml-1",children:[s.jsx("input",{type:"checkbox",checked:k,onChange:X=>R(X.target.checked),className:"rounded theme-border theme-bg-overlay-md text-[color:var(--brand)] focus:ring-0"}),s.jsxs("span",{children:["Return to main workflow after completing ",s.jsx("code",{className:"text-[color:var(--brand)]",children:N||"sub-workflow"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[s.jsxs("button",{type:"button",onClick:M,disabled:m.every(X=>!X.left.trim()),className:"flex items-center gap-1 rounded-lg bg-[color:var(--brand)]/20 border border-[color:var(--brand)]/40 px-3 py-1 text-[10px] text-[color:var(--brand)] hover:bg-[color:var(--brand)]/30 transition-colors disabled:opacity-40 hover:cursor-pointer",children:[s.jsx(ut,{className:"h-3 w-3",strokeWidth:2})," Save Condition"]}),r&&s.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-1 text-[10px] text-red-400/80 hover:bg-red-500/15 transition-colors hover:cursor-pointer",children:[s.jsx(Yt,{className:"h-3 w-3",strokeWidth:2})," Remove"]}),s.jsxs("button",{type:"button",onClick:f,className:"ml-auto flex items-center gap-1 rounded-lg border theme-border px-3 py-1 text-[10px] theme-text-muted hover:theme-text transition-colors hover:cursor-pointer",children:[s.jsx(Ct,{className:"h-3 w-3",strokeWidth:2})," Cancel"]})]})]})}function L3({step:n,index:r,total:o,status:i,result:u,allSteps:f,onConditionChange:h,waitingHuman:g}){const[x,m]=j.useState(!1),[p,b]=j.useState(!1),v=n.capture&&Object.keys(n.capture).length>0,N=n.inject&&Object.keys(n.inject).length>0,C=n.body&&Object.keys(n.body).length>0,k=!!n.condition,R=jf(n),z=[];for(let M=0;M<=r;M++){const H=f[M];Object.keys(H.capture??{}).forEach(Z=>z.push(Z)),Object.keys(H.captureInput??{}).forEach(Z=>z.push(Z))}const V=g?s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-amber-500/15 text-amber-400",title:"Waiting for your input — answer the dialog to resume",children:s.jsx(zr,{className:"h-3 w-3 animate-pulse",strokeWidth:2})}):{idle:s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full border theme-border text-[9px] theme-text-faint",children:r+1}),running:s.jsx(dt,{className:"h-5 w-5 text-[color:var(--brand)] animate-spin",strokeWidth:2}),passed:s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-emerald-500/10 text-emerald-400",children:s.jsx(ut,{className:"h-3 w-3",strokeWidth:2})}),failed:s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-red-500/10 text-red-400",children:s.jsx(_t,{className:"h-3 w-3",strokeWidth:2})}),skipped:s.jsx("span",{className:"h-5 w-5 rounded-full border theme-border theme-bg-overlay-md"})}[i],q=k&&n.condition?(()=>{const M=n.condition.rules.all??n.condition.rules.any??[],H=n.condition.rules.all?"AND":"OR";return`${M.length} rule${M.length!==1?"s":""} ${H} → ${n.condition.onFail}`})():null;return s.jsxs("div",{className:"relative",children:[r<o-1&&s.jsx("div",{className:`absolute left-[19px] top-[38px] bottom-0 w-px z-0 transition-colors duration-500 ${i==="passed"?"bg-emerald-500/20":"bg-[var(--border)]"}`}),s.jsxs("div",{className:"relative z-10",children:[s.jsxs("button",{type:"button",onClick:()=>m(M=>!M),className:"flex w-full items-center gap-3 px-4 py-2.5 hover:theme-bg-overlay-md transition-colors text-left hover:cursor-pointer",children:[s.jsx("span",{className:"shrink-0",children:V}),s.jsx(C3,{method:n.method}),s.jsx("span",{className:"font-mono text-xs theme-text flex-1 truncate",children:n.path}),u&&s.jsxs("span",{className:`font-mono text-[10px] ${u.passed?"text-emerald-400":"text-red-400"}`,children:[u.status>0?u.status:"ERR"," · ",u.durationMs,"ms"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[N&&s.jsx("span",{className:"rounded bg-amber-500/10 px-1 py-0.5 text-[9px] text-amber-400",children:"auth"}),v&&s.jsx("span",{className:"rounded bg-[color:var(--brand)]/10 px-1 py-0.5 text-[9px] text-[color:var(--brand)]",children:"capture"}),R.length>0&&s.jsxs("span",{title:`Needs human input at runtime: ${R.map(M=>`{{human:${M}}}`).join(", ")}`,className:"rounded bg-orange-500/10 px-1 py-0.5 text-[9px] text-orange-400 flex items-center gap-0.5",children:[s.jsx(zr,{className:"h-2.5 w-2.5",strokeWidth:2})," human"]}),k&&s.jsxs("span",{className:"rounded bg-[color:var(--brand)]/10 px-1 py-0.5 text-[9px] text-[color:var(--brand)] flex items-center gap-0.5",children:[s.jsx(ea,{className:"h-2.5 w-2.5",strokeWidth:2})," condition"]}),u?.conditionResult&&s.jsxs("span",{className:`rounded px-1 py-0.5 text-[9px] ${u.conditionResult.passed?"bg-[color:var(--brand)]/10 text-[color:var(--brand)]":"bg-orange-500/10 text-orange-400"}`,children:["◇ ",u.conditionResult.passed?"passed":"failed"]})]}),s.jsx("span",{className:"theme-text-faint shrink-0",children:x?s.jsx(qa,{className:"h-3.5 w-3.5"}):s.jsx(vl,{className:"h-3.5 w-3.5"})})]}),x&&s.jsxs("div",{className:"ml-12 mr-4 my-3 space-y-2.5 rounded-lg border-y theme-border theme-bg-overlay p-3",children:[n.description&&s.jsx("p",{className:"text-[11px] theme-text-muted",children:n.description}),u&&s.jsxs("div",{className:`rounded-lg border px-3 py-2 ${u.passed?"border-emerald-500/15 bg-emerald-500/[0.05]":"border-red-500/15 bg-red-500/[0.05]"}`,children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1 uppercase tracking-wider",children:"Response"}),u.error?s.jsx("p",{className:"text-[11px] text-red-400",children:u.error}):s.jsx("pre",{className:"text-[10px] theme-text-muted overflow-auto max-h-24 whitespace-pre-wrap break-all",children:typeof u.responseBody=="string"?u.responseBody.slice(0,300):JSON.stringify(u.responseBody,null,2).slice(0,300)})]}),C&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1 uppercase tracking-wider",children:"Request Body"}),s.jsx("div",{className:"space-y-1",children:Object.entries(n.body).map(([M,H])=>s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border theme-border theme-bg-overlay-md px-3 py-1.5",children:[s.jsx("span",{className:"font-mono text-[10px] theme-text",children:M}),s.jsx("span",{className:"font-mono text-[10px] text-[color:var(--brand)]/80 truncate",children:String(H)})]},M))})]}),N&&s.jsxs("div",{children:[s.jsxs("p",{className:"text-[10px] theme-text-faint mb-1 uppercase tracking-wider flex items-center gap-1",children:[s.jsx(M0,{className:"h-3 w-3",strokeWidth:2})," Inject"]}),s.jsx("div",{className:"space-y-1",children:Object.entries(n.inject).map(([M,H])=>s.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-500/[0.05] border border-amber-500/15 px-3 py-1.5",children:[s.jsx("span",{className:"font-mono text-[10px] text-amber-400/80",children:M}),s.jsx(dl,{className:"h-3 w-3 theme-text-faint shrink-0",strokeWidth:2}),s.jsx("span",{className:"font-mono text-[10px] theme-text-muted",children:H})]},M))})]}),v&&s.jsxs("div",{children:[s.jsxs("p",{className:"text-[10px] theme-text-faint mb-1 uppercase tracking-wider flex items-center gap-1",children:[s.jsx(hs,{className:"h-3 w-3",strokeWidth:2})," Capture"]}),s.jsx("div",{className:"space-y-1",children:Object.entries(n.capture).map(([M,H])=>s.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-[color:var(--brand)]/[0.05] border border-[color:var(--brand)]/15 px-3 py-1.5",children:[s.jsx("span",{className:"font-mono text-[10px] text-[color:var(--brand)]",children:M}),s.jsx(dl,{className:"h-3 w-3 theme-text-faint shrink-0",strokeWidth:2}),s.jsx("span",{className:"font-mono text-[10px] theme-text-muted",children:H})]},M))})]}),s.jsxs("div",{className:"pt-1",children:[k&&q&&!p&&s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-[color:var(--brand)]/20 bg-[color:var(--brand)]/[0.04] px-3 py-2 mb-2",children:[s.jsx(ea,{className:"h-3 w-3 text-[color:var(--brand)] shrink-0",strokeWidth:2}),s.jsx("span",{className:"text-[10px] text-[color:var(--brand)] flex-1",children:q}),u?.conditionResult&&s.jsx("span",{className:`text-[9px] font-medium ${u.conditionResult.passed?"text-[color:var(--brand)]":"text-orange-400"}`,children:u.conditionResult.passed?"✓ passed":"✗ failed"}),s.jsx("button",{type:"button",onClick:()=>b(!0),className:"shrink-0 theme-text-faint hover:text-[color:var(--brand)] transition-colors hover:cursor-pointer",children:s.jsx(Bv,{className:"h-3 w-3",strokeWidth:2})})]}),p?s.jsx(q3,{stepIndex:r,existingCondition:n.condition,capturedKeys:z,onSave:M=>{h(r,M),b(!1)},onRemove:()=>{h(r,void 0),b(!1)},onCancel:()=>b(!1)}):!k&&s.jsxs("button",{type:"button",onClick:()=>b(!0),className:"flex items-center gap-1.5 text-[10px] theme-text-faint hover:text-[color:var(--brand)] transition-colors hover:cursor-pointer",children:[s.jsx(Ht,{className:"h-3 w-3",strokeWidth:2}),s.jsx(ea,{className:"h-3 w-3",strokeWidth:2}),"Add Condition"]})]})]})]})]})}function Cd(n){return{phase:"idle",currentStep:-1,stepStatuses:Array(n).fill("idle"),stepResults:Array(n).fill(null),passed:0,failed:0,humanKeys:[],notes:[]}}const yy={run:"pre-seeded for this run",env:"environment variable",memory:"saved human memory",prompt:"your answer"};function Y3({workflow:n,onDelete:r,onViewTraces:o}){const[i,u]=j.useState(n),[f,h]=j.useState("list"),[g,x]=j.useState(!1),[m,p]=j.useState(!1),[b,v]=j.useState(!1),[N,C]=j.useState(()=>Cd(i.steps.length)),[k,R]=j.useState(void 0),[z,V]=j.useState([]),[q,M]=j.useState(null),[H,Z]=j.useState(""),X=j.useRef(!1),oe=j.useRef(null),I=j.useRef(""),K=j.useRef("local-sim"),ae=j.useRef({}),te=j.useRef(new Set),se=j.useRef(null),[_,W]=j.useState(null),[E,$]=j.useState(""),[T,A]=j.useState(null),[S,D]=j.useState(!1),L=j.useRef(null),F=async(B,Y)=>{const ue=i.steps.map((ee,Ee)=>{if(Ee!==B)return ee;if(Y===void 0){const{condition:ge,...ke}=ee;return ke}return{...ee,condition:Y}}),re={...i,steps:ue};u(re);try{await _3(i._file,ue)}catch{}};j.useEffect(()=>{fetch("/api/model/environments").then(B=>B.ok?B.json():null).then(B=>{if(!B)return;const Y=B.environments??[];V(Y);const ue=B.defaultEnvironment??Y.find(ee=>ee.default)?.name??Y[0]?.name??null;M(ue);const re=Y.find(ee=>ee.name===ue);re&&Z(re.baseUrl)}).catch(()=>{})},[]);const ie=async()=>{if(confirm(`Delete workflow "${i.name}"? This cannot be undone.`)){v(!0);try{await M3(i._file),r()}catch(B){alert(`Failed to delete: ${B.message}`),v(!1)}}},he=()=>{if(X.current=!0,oe.current?.close(),oe.current=null,L.current){const B=L.current;L.current=null,W(null),B(null)}else _&&ve();C(B=>({...B,phase:B.phase==="running"?"aborted":B.phase}))},me=async(B,Y)=>{if(!se.current)throw new Error("Run id lost — please re-run the workflow.");const ue=await fetch("/api/workflows/human-input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runId:se.current,key:B,value:Y})}),re=await ue.json().catch(()=>({}));if(!ue.ok)throw new Error(re.error??`HTTP ${ue.status}`)},Se=async()=>{if(_){if(L.current){const B=L.current;L.current=null,W(null),$(""),B(E);return}D(!0),A(null);try{await me(_.key,E),W(null),$("")}catch(B){A(B.message)}finally{D(!1)}}},ve=async()=>{if(_){if(L.current){const B=L.current;L.current=null,W(null),$(""),A(null),B(null);return}try{await me(_.key,null)}catch{}W(null),$(""),A(null)}},Ae=()=>{he(),C(Cd(i.steps.length))},Re=async(B,Y,ue)=>{const re=new Date().toISOString(),ee={id:crypto.randomUUID(),workflowName:i.name,workflowFile:i._file,startedAt:ue,finishedAt:re,durationMs:B.stepResults.reduce((ge,ke)=>ge+(ke?.durationMs??0),0),phase:B.phase==="done"?"done":B.phase==="aborted"?"aborted":"error",passed:B.passed,failed:B.failed,baseUrl:B.baseUrl,source:Y,steps:i.steps.map((ge,ke)=>{const Oe=B.stepResults[ke];return{index:ke,name:ge.name,method:ge.method,path:ge.path,description:ge.description,status:Oe?.status??0,passed:Oe?.passed??!1,durationMs:Oe?.durationMs??0,captured:Object.fromEntries((Oe?.captured??[]).map(ze=>[ze,"(captured)"])),injected:Oe?.injected??{},requestBody:ge.body,responseBody:Oe?.responseBody,error:Oe?.error??null,expectStatus:ge.expectStatus,captureSpec:ge.capture,injectSpec:ge.inject,conditionSpec:ge.condition,conditionResult:Oe?.conditionResult}})},Ee=await E2(ee);R(Ee)},We=B=>{X.current=!1,se.current=null,te.current=new Set,L.current=null,W(null),$(""),A(null);const Y=i.steps.length;C({...Cd(Y),baseUrl:H||void 0}),R(void 0),I.current=new Date().toISOString(),K.current="local-sim",x(!0);const ue=(ee,Ee,ge)=>new Promise(ke=>{$(""),A(null),W({key:ee,stepIndex:Ee,stepName:ge}),L.current=ke}),re=async()=>{C(Oe=>({...Oe,phase:"running",baseUrl:H||Oe.baseUrl})),ae.current={};let ee=0,Ee=0,ge=!1,ke="";for(let Oe=0;Oe<Y&&!(X.current||ge);Oe++){const ze=i.steps[Oe],Mt=jf(ze);for(const pe of Mt){if(X.current)break;if(ae.current[`human:${pe}`]!==void 0)continue;C(je=>{const Le=[...je.stepStatuses];return Le[Oe]="running",{...je,stepStatuses:Le,currentStep:Oe}});const Ve=await ue(pe,Oe,ze.name);if(Ve===null||X.current){C(je=>({...je,phase:"aborted",error:"Run cancelled by user"}));return}ae.current[`human:${pe}`]=Ve,C(je=>({...je,notes:[...je.notes??[],`↳ human {{human:${pe}}} ← your answer`]}))}if(X.current)break;C(pe=>{const Ve=[...pe.stepStatuses];return Ve[Oe]="running",{...pe,stepStatuses:Ve,currentStep:Oe}});const At=600+Math.random()*800;if(await new Promise(pe=>{const Ve=setTimeout(pe,At),je=setInterval(()=>{X.current&&(clearTimeout(Ve),clearInterval(je),pe())},50);setTimeout(()=>clearInterval(je),At+100)}),X.current)break;Object.keys(ze.capture??{}).forEach(pe=>{ae.current[pe]="[simulated]"}),Object.keys(ze.captureInput??{}).forEach(pe=>{ae.current[pe]="[simulated]"});let ft;if(ze.condition&&(ft=k3(ze.condition,ae.current),!ft.passed)){const{onFail:pe,returnOnComplete:Ve}=ze.condition;pe==="abort"?(ge=!0,ke=`Condition failed at step ${Oe+1}: ${ft.reason}`):pe==="continue"?(ge=!0,ke="Condition failed → continuing without remaining steps"):pe==="switch"&&(Ve||(ge=!0,ke=`Condition failed → switched to: ${ze.condition.switchToWorkflow??"unknown"}`))}const nt=!0,pt=Math.round(At),at={index:Oe,step:{name:ze.name,method:ze.method,path:ze.path,description:ze.description},status:200,passed:nt,durationMs:pt,captured:Object.keys(ze.capture??{}).map(pe=>pe.split(":").pop()??pe),injected:{},responseBody:{simulated:!0},error:null,conditionResult:ft};if(ee++,C(pe=>{const Ve=[...pe.stepStatuses],je=[...pe.stepResults];return Ve[Oe]="passed",je[Oe]=at,{...pe,stepStatuses:Ve,stepResults:je,passed:ee,failed:Ee}}),ge)break}if(!X.current)if(ge){const Oe={phase:"aborted",stepStatuses:N.stepStatuses,stepResults:N.stepResults,passed:ee,failed:Ee,baseUrl:H||void 0};C(ze=>({...ze,phase:"aborted",error:ke})),Re(Oe,"local-sim",I.current)}else{const Oe={phase:"done",stepStatuses:Array(Y).fill("passed"),stepResults:i.steps.map((ze,Mt)=>({index:Mt,step:{name:ze.name,method:ze.method,path:ze.path,description:ze.description},status:200,passed:!0,durationMs:Math.round(600+Math.random()*800),captured:Object.keys(ze.capture??{}).map(At=>At.split(":").pop()??At),injected:{},responseBody:{simulated:!0},error:null})),passed:ee,failed:Ee};C(ze=>({...ze,phase:"done",passed:ee,failed:Ee})),Re(Oe,"local-sim",I.current)}};fetch("/api/workflows/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:i._file,baseUrl:H||void 0,humanInputs:B})}).then(ee=>{if(!ee.ok||!ee.body){re();return}K.current="api";const Ee=ee.body.getReader(),ge=new TextDecoder;let ke="";C(ze=>({...ze,phase:"running"})),(async()=>{let ze=!1;for(;!X.current;){const{value:Mt,done:At}=await Ee.read();if(At)break;ze=!0,ke+=ge.decode(Mt,{stream:!0});const ft=ke.split(`
413
- `);ke=ft.pop()??"";for(const nt of ft){const pt=nt.trim();if(!pt.startsWith("data:"))continue;const at=pt.slice(5).trim();if(!at)continue;let pe;try{pe=JSON.parse(at)}catch{continue}if(pe.type==="human_input_required"){$(""),A(null),W({key:String(pe.key??""),stepIndex:Number(pe.stepIndex??-1),stepName:String(pe.stepName??"")});continue}C(Ve=>{const je={...Ve};if(pe.type==="start")je.phase="running",je.baseUrl=pe.baseUrl,je.humanKeys=Array.isArray(pe.humanKeys)?pe.humanKeys:[],je.notes=[],je.humanUnsupported=!Array.isArray(pe.humanKeys)&&A3(i.steps).length>0,typeof pe.runId=="string"&&(se.current=pe.runId);else if(pe.type==="human_resolved"){const Le=`${pe.index}:${pe.key}`;if(!te.current.has(Le)){te.current.add(Le);const Ge=yy[String(pe.source)]??String(pe.source??"run");je.notes=[...je.notes??[],`↳ human {{human:${pe.key}}} ← ${Ge}`]}}else if(pe.type==="step_start"){const Le=pe.index,Ge=[...je.stepStatuses];Ge[Le]="running",je.stepStatuses=Ge,je.currentStep=Le}else if(pe.type==="step_result"){const Le=pe.index,Ge=[...je.stepStatuses],Rt=[...je.stepResults];Ge[Le]=pe.passed?"passed":"failed",Rt[Le]={index:pe.index,step:pe.step??{name:"",method:"",path:""},status:pe.status,passed:pe.passed,durationMs:pe.durationMs,captured:pe.captured??[],injected:pe.injected??{},responseBody:pe.responseBody,error:pe.error??null},pe.passed?je.passed=(je.passed??0)+1:je.failed=(je.failed??0)+1,je.stepStatuses=Ge,je.stepResults=Rt}else if(pe.type==="condition_result"){const Le=pe.index,Ge=[...je.stepResults];Ge[Le]&&(Ge[Le]={...Ge[Le],conditionResult:{passed:pe.passed,reason:pe.reason}},je.stepResults=Ge)}else if(pe.type==="aborted"){const Le=[...je.stepStatuses];for(let Ge=0;Ge<Le.length;Ge++)Le[Ge]==="running"?Le[Ge]="failed":Le[Ge]==="idle"&&(Le[Ge]="skipped");je.stepStatuses=Le,je.phase="aborted",je.error=pe.reason,Re(je,"api",I.current)}else pe.type==="done"&&(je.phase="done",(pe.passed>0||pe.failed>0)&&(je.passed=pe.passed,je.failed=pe.failed),pe.conditionBranch==="continue"?je.error="Condition failed → remaining steps skipped":pe.conditionBranch==="switch"&&(je.error=`Condition failed → switched to: ${pe.switchToWorkflow??"unknown"}`),Re(je,"api",I.current));return je})}}!ze&&!X.current&&re()})().catch(()=>{X.current||re()})}).catch(()=>{X.current||re()})},Te=N.phase==="running",be=N.phase!=="idle";return s.jsxs("div",{className:"relative",children:[s.jsxs("button",{type:"button",onClick:()=>We(),className:"absolute -top-2 -right-2 flex items-center gap-1 rounded-full theme-bg-brand px-2 py-0.5 text-[10px] font-medium text-[color:var(--brand-foreground)] shadow-sm z-10 hover:opacity-90 transition-colors hover:cursor-pointer",children:[s.jsx(Ad,{size:10})," Run Workflow"]}),s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2.5 px-4 py-3 border-b theme-border",children:[s.jsx("button",{type:"button",onClick:()=>p(B=>!B),className:"text-[color:var(--brand)]/70 hover:text-[color:var(--brand)] transition-colors shrink-0 hover:cursor-pointer",children:m?s.jsx(vl,{className:"h-3.5 w-3.5"}):s.jsx(qa,{className:"h-3.5 w-3.5"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"theme-text-primary truncate",children:i.name}),i.generatedAt&&s.jsxs("p",{className:"flex items-center gap-1 text-[10px] theme-text-faint mt-0.5",children:[s.jsx(Gr,{className:"h-2.5 w-2.5",strokeWidth:2}),new Date(i.generatedAt).toLocaleString()]})]}),s.jsxs("span",{className:"rounded-full border theme-border theme-bg-overlay-md px-2 py-0.5 text-[10px] theme-text-muted shrink-0",children:[i.steps.length," steps"]}),be&&s.jsxs("span",{className:`flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] shrink-0 ${N.phase==="done"&&N.failed===0?"bg-emerald-500/10 text-emerald-400":N.phase==="running"?"bg-[color:var(--brand)]/10 text-[color:var(--brand)]":"bg-red-500/10 text-red-400"}`,children:[N.phase==="running"&&s.jsx(dt,{className:"h-2.5 w-2.5 animate-spin",strokeWidth:2}),N.phase==="done"&&N.failed===0&&s.jsx(ut,{className:"h-2.5 w-2.5",strokeWidth:2}),(N.phase==="done"||N.phase==="aborted")&&N.failed>0&&s.jsx(_t,{className:"h-2.5 w-2.5",strokeWidth:2}),N.phase==="running"?"Running…":N.phase==="done"?`${N.passed}/${N.passed+N.failed}`:N.phase==="aborted"?"Aborted":"Error"]}),N.humanUnsupported&&s.jsxs("span",{title:"The connected jetic dev server predates human-input support. Restart it from the latest build — human values will otherwise resolve empty and no dialog appears.",className:"flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] shrink-0 bg-red-500/10 text-red-400",children:[s.jsx(_t,{className:"h-2.5 w-2.5",strokeWidth:2}),"Old server — no human dialog"]}),!m&&s.jsx("div",{className:"flex items-center gap-0.5 rounded-lg border theme-border theme-bg-overlay-md p-0.5 shrink-0",children:["list","graph"].map(B=>s.jsxs("button",{type:"button",onClick:()=>h(B),className:`flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium transition-colors hover:cursor-pointer ${f===B?"bg-[color:var(--brand)]/20 text-[color:var(--brand)]":"theme-text-faint hover:theme-text-muted"}`,children:[B==="list"?s.jsx(R0,{className:"h-3 w-3",strokeWidth:2}):s.jsx(Pd,{className:"h-3 w-3",strokeWidth:2}),B.charAt(0).toUpperCase()+B.slice(1)]},B))}),be&&!m&&s.jsxs("button",{type:"button",onClick:()=>x(B=>!B),className:`flex items-center gap-1 rounded-lg px-2.5 py-1 text-[10px] transition-colors border theme-border hover:cursor-pointer ${g?"theme-bg-overlay-md theme-text":"theme-text-faint hover:theme-text theme-bg-overlay"}`,children:[s.jsx(Rv,{className:"h-3 w-3",strokeWidth:2})," Log"]}),Te&&s.jsxs("button",{type:"button",onClick:he,className:"flex items-center gap-1 rounded-lg border border-red-500/30 bg-red-500/10 px-2.5 py-1 text-[10px] text-red-400 hover:bg-red-500/20 transition-colors shrink-0 hover:cursor-pointer",children:[s.jsx(n2,{className:"h-3 w-3",strokeWidth:2})," Stop"]}),be&&!Te&&s.jsxs("button",{type:"button",onClick:Ae,className:"flex items-center gap-1 rounded-lg border theme-border theme-bg-overlay px-2.5 py-1 text-[10px] theme-text-muted hover:theme-text transition-colors shrink-0 hover:cursor-pointer",children:[s.jsx(Gv,{className:"h-3 w-3",strokeWidth:2})," Reset"]}),be&&!Te&&o&&s.jsxs("button",{type:"button",onClick:()=>o(i.name,k),className:"flex items-center gap-1 rounded-lg border border-[color:var(--brand)]/30 bg-[color:var(--brand)]/10 px-2.5 py-1 text-[10px] text-[color:var(--brand)] hover:bg-[color:var(--brand)]/20 transition-colors shrink-0 hover:cursor-pointer",children:[s.jsx(Vr,{className:"h-3 w-3",strokeWidth:2}),k?"View Trace":"Traces"]}),!Te&&s.jsxs("button",{type:"button",onClick:()=>We(),className:"hidden items-center gap-1.5 rounded-lg theme-bg-brand px-3 py-1.5 text-[10px] font-medium text-[color:var(--brand-foreground)] hover:opacity-90 transition-colors shrink-0 hover:cursor-pointer",children:[s.jsx(Ad,{className:"h-3 w-3",strokeWidth:2}),be?"Re-run":"Run"]}),!i._legacy&&!Te&&s.jsx("button",{type:"button",onClick:ie,disabled:b,title:"Delete workflow",className:"flex items-center gap-1 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-2 py-1 text-[10px] text-red-400/80 hover:bg-red-500/20 hover:text-red-400 transition-colors shrink-0 disabled:opacity-40 hover:cursor-pointer",children:b?s.jsx(dt,{className:"h-3 w-3 animate-spin",strokeWidth:2}):s.jsx(Yt,{className:"h-3 w-3",strokeWidth:2})})]}),!m&&s.jsxs(s.Fragment,{children:[z.length>0&&s.jsxs("div",{className:"flex items-center gap-2 border-b theme-border px-4 py-2 theme-bg-overlay-md flex-wrap",children:[s.jsx(jl,{className:"h-3 w-3 theme-text-faint shrink-0",strokeWidth:2}),s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint mr-1",children:"Env:"}),z.map(B=>{const Y=q===B.name;return s.jsxs("button",{type:"button",onClick:()=>{M(B.name),Z(B.baseUrl)},className:`flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-[10px] font-medium transition-all hover:cursor-pointer ${Y?"border-[color:var(--brand)]/40 bg-[color:var(--brand)]/10 text-[color:var(--brand)]":"theme-border theme-text-faint hover:border-[color:var(--brand)]/20 hover:theme-text-muted"}`,children:[s.jsx("span",{className:`h-1.5 w-1.5 rounded-full shrink-0 ${Y?"bg-[color:var(--brand)]":"bg-[var(--text-faint)]"}`}),B.name]},B.name)}),q&&s.jsx("span",{className:"ml-auto font-mono text-[10px] theme-text-faint truncate max-w-[180px]",children:H})]}),g&&s.jsx("div",{className:"border-b theme-border",children:s.jsx(U3,{runState:N,steps:i.steps,waitingStepIndex:_?.stepIndex??null})}),f==="list"&&s.jsx("div",{className:"divide-y divide-[var(--border)]",children:i.steps.map((B,Y)=>s.jsx(L3,{step:B,index:Y,total:i.steps.length,status:N.stepStatuses[Y]??"idle",result:N.stepResults[Y]??null,allSteps:i.steps,onConditionChange:F,waitingHuman:_?.stepIndex===Y},Y))}),f==="graph"&&s.jsx("div",{className:"p-4",children:s.jsx($3,{steps:i.steps,runState:N})})]})]}),_&&s.jsx(z3,{title:"Human input required",subtitle:_.stepName?`Step ${_.stepIndex+1} · ${_.stepName}`:`Step ${_.stepIndex+1}`,fields:[{key:_.key}],values:{[_.key]:E},onChange:(B,Y)=>$(Y),onSubmit:Se,onCancel:ve,submitLabel:"Submit & resume run",error:T,submitting:S})]})}function V3(){return s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-5 py-20 text-center",children:[s.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[s.jsx("div",{className:"absolute inset-0 rounded-full bg-[color:var(--brand)]/10 blur-xl"}),s.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full border theme-border theme-bg-overlay text-[color:var(--brand)]",children:s.jsx(ea,{className:"h-7 w-7",strokeWidth:2})})]}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium theme-text-primary",children:"No workflows yet"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted"}),s.jsxs("p",{className:"mt-1 text-[11px] theme-text-faint",children:["Workflows are stored in ",s.jsx("code",{className:"theme-text-faint",children:".jetic/workflows/"})]})]})]})}function G3({onViewTraces:n}){const[r,o]=j.useState([]),[i,u]=j.useState(!0),[f,h]=j.useState(!1),[g,x]=j.useState(null),m=j.useCallback(async(b=!1)=>{b?h(!0):u(!0),x(null);try{o(await T3())}catch(v){x(v.message)}finally{u(!1),h(!1)}},[]);j.useEffect(()=>{m()},[m]);const p=b=>{o(v=>v.filter(N=>N._file!==b))};return s.jsxs("div",{className:"flex min-h-full w-full flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5 sticky",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium theme-text-primary leading-none",children:"Simulations"}),s.jsx("p",{className:"mt-0.5 text-[11px] theme-text-muted",children:i?"Loading…":`${r.length} workflow${r.length!==1?"s":""} found`})]})}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("button",{type:"button",onClick:()=>m(!0),disabled:f||i,className:"flex h-6 w-6 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-muted hover:theme-bg-overlay-md hover:theme-text disabled:opacity-40 transition-all hover:cursor-pointer",children:s.jsx(na,{className:`h-3.5 w-3.5 ${f?"animate-spin":""}`,strokeWidth:2})})})]}),s.jsxs("div",{className:"flex flex-1 flex-col gap-4 p-6 overflow-y-auto max-h[(calc(100vh-60px))]",children:[i&&s.jsx("div",{className:"space-y-3",children:[1,2].map(b=>s.jsx("div",{className:"h-16 animate-pulse rounded-lg border theme-border theme-bg-overlay",style:{opacity:1-b*.3}},b))}),!i&&g&&s.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-red-500/20 bg-red-500/[0.06] p-10 text-center",children:[s.jsx(_t,{className:"h-8 w-8 text-red-400",strokeWidth:2}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-red-300",children:"Could not load simulations"}),s.jsx("p",{className:"mt-1 text-[11px] text-red-400/80",children:g})]}),s.jsx("button",{type:"button",onClick:()=>m(),className:"rounded-lg border border-red-500/20 bg-red-500/10 px-4 py-1.5 text-[11px] text-red-400 hover:bg-red-500/20 transition-colors hover:cursor-pointer",children:"Retry"})]}),!i&&!g&&r.length===0&&s.jsx(V3,{}),!i&&!g&&r.length>0&&s.jsx("div",{className:"space-y-5",children:r.map((b,v)=>s.jsx(Y3,{workflow:b,onDelete:()=>p(b._file),onViewTraces:n?(N,C)=>n({workflowName:N,traceId:C}):void 0},`${b._file}-${v}`))}),!i&&!g&&r.length>0&&s.jsxs("div",{className:"flex items-center gap-1.5 border-t theme-border pt-3 text-[10px] theme-text-faint",children:["Workflows from ",s.jsx("code",{className:"theme-text-faint",children:".jetic/workflows/"})]})]})]})}const X3={GET:{bg:"bg-emerald-500/10",text:"text-emerald-400",dot:"#34d399"},POST:{bg:"bg-[color:var(--brand)]/10",text:"text-[color:var(--brand)]",dot:"var(--brand)"},PUT:{bg:"bg-amber-500/10",text:"text-amber-400",dot:"#fbbf24"},PATCH:{bg:"bg-orange-500/10",text:"text-orange-400",dot:"#fb923c"},DELETE:{bg:"bg-red-500/10",text:"text-red-400",dot:"#f87171"},HEAD:{bg:"theme-bg-overlay-md",text:"theme-text-muted",dot:"var(--text-muted)"},OPTIONS:{bg:"bg-[color:var(--brand)]/10",text:"text-[color:var(--brand)]",dot:"var(--brand)"}};function by(n){return X3[n.toUpperCase()]??{bg:"theme-bg-overlay-md",text:"theme-text-muted",dot:"var(--text-muted)"}}async function Z3(){const n=await fetch("/api/model");if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}async function W3(){const n=await fetch("/api/model/scan",{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error??`Scan failed (${n.status})`)}return(await n.json()).model}async function Q3(n,r){const o=await fetch(`/api/model/endpoint/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw new Error(`Save failed (${o.status})`)}async function K3(n){const r=await fetch("/api/model/endpoint",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const o=await r.json().catch(()=>({}));throw new Error(o.error??`Create failed (${r.status})`)}return r.json()}function J3({method:n}){const r=by(n);return s.jsx("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] tracking-widest ${r.bg} ${r.text}`,children:n.toUpperCase()})}function p0({value:n,onSave:r,mono:o=!0}){const[i,u]=j.useState(!1),[f,h]=j.useState(n),[g,x]=j.useState(!1),m=j.useRef(null);j.useEffect(()=>{i&&m.current?.focus()},[i]);const p=async()=>{if(f===n){u(!1);return}x(!0);try{await r(f)}finally{x(!1),u(!1)}};return i?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("input",{ref:m,value:f,onChange:b=>h(b.target.value),onKeyDown:b=>{b.key==="Enter"&&p(),b.key==="Escape"&&(h(n),u(!1))},className:`rounded border border-[color:var(--brand)]/40 theme-bg-overlay-md px-1.5 py-0.5 text-xs theme-text-primary outline-none w-56 ${o?"font-mono":""}`}),s.jsx("button",{type:"button",onClick:p,disabled:g,className:"text-emerald-400 hover:text-emerald-300 hover:cursor-pointer",children:g?s.jsx(dt,{className:"h-3 w-3 animate-spin"}):s.jsx(ut,{className:"h-3 w-3"})}),s.jsx("button",{type:"button",onClick:()=>{h(n),u(!1)},className:"theme-text-faint hover:theme-text-muted hover:cursor-pointer",children:s.jsx(Ct,{className:"h-3 w-3"})})]}):s.jsxs("button",{type:"button",onClick:()=>u(!0),className:`group/ie inline-flex items-center gap-1 rounded px-1 py-0.5 hover:theme-bg-overlay-md transition-colors hover:cursor-pointer ${o?"font-mono":""}`,children:[s.jsx("span",{className:"text-xs theme-text",children:n}),s.jsx(ef,{className:"h-2.5 w-2.5 theme-text-faint opacity-0 group-hover/ie:opacity-100 transition-opacity"})]})}function I3({ep:n,onUpdate:r,onInspect:o,onViewTraces:i,onEdit:u}){const[f,h]=j.useState(!1),[g,x]=j.useState(""),m=async(v,N)=>{x("");try{await Q3(v,N),r(v,N)}catch(C){x(C.message)}},p=n.requestBody?.fields??{},b=n.responses??{};return s.jsxs("div",{className:"border-b theme-border last:border-0",children:[s.jsxs("button",{type:"button",onClick:()=>h(v=>!v),className:"group flex w-full items-center gap-3 px-7 py-2.5 hover:theme-bg-overlay-md transition-colors text-left hover:cursor-pointer",children:[s.jsx("span",{className:"shrink-0 theme-text-faint",children:f?s.jsx(qa,{className:"h-3.5 w-3.5"}):s.jsx(vl,{className:"h-3.5 w-3.5"})}),s.jsx(J3,{method:n.method}),s.jsx("span",{className:"font-mono text-xs theme-text flex-1 truncate",children:n.path}),n.security&&n.security.length>0&&s.jsx(La,{className:"h-3 w-3 text-amber-500/60 shrink-0"}),n.deprecated&&s.jsx("span",{className:"rounded text-[9px] font-medium text-amber-500/60 border border-amber-500/20 px-1 py-0.5",children:"deprecated"}),s.jsxs("span",{onClick:v=>{v.stopPropagation(),u(n)},className:"inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] border theme-border theme-text-faint hover:theme-bg-overlay-md hover:theme-text hover:cursor-pointer transition-colors",children:[s.jsx(ef,{className:"h-2.5 w-2.5"})," EDIT"]}),s.jsx("span",{onClick:v=>{v.stopPropagation(),o(n)},className:"inline-flex items-center rounded px-1.5 py-0.5 text-[10px] border border-[color:var(--brand)]/40 text-[color:var(--brand)] hover:bg-[color:var(--brand)]/10 hover:border-[color:var(--brand)]/60 hover:cursor-pointer transition-colors",children:"INSPECT"}),i&&s.jsxs("span",{onClick:v=>{v.stopPropagation(),i(n.path)},className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] border border-[color:var(--brand)]/30 text-[color:var(--brand)] hover:bg-[color:var(--brand)]/10 hover:cursor-pointer transition-colors",children:[s.jsx(Vr,{className:"h-2.5 w-2.5"})," Traces"]}),s.jsx("span",{className:"hidden sm:block text-[10px] theme-text-faint truncate max-w-[180px]",children:n.handlerName})]}),f&&s.jsxs("div",{className:"px-10 pb-4 pt-1 space-y-3 theme-bg-overlay",children:[g&&s.jsx("p",{className:"text-xs text-red-400 rounded border border-red-500/20 bg-red-500/10 px-2 py-1",children:g}),s.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1 uppercase tracking-wider",children:"Method"}),s.jsx("select",{value:n.method,onChange:v=>m(n.id,{method:v.target.value}),className:"rounded-lg border theme-border theme-bg-overlay-md px-2 py-1 text-xs theme-text outline-none hover:cursor-pointer",children:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"].map(v=>s.jsx("option",{children:v},v))})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1 uppercase tracking-wider",children:"Path"}),s.jsx(p0,{value:n.path,onSave:v=>m(n.id,{path:v})})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1 uppercase tracking-wider",children:"Handler"}),s.jsx(p0,{value:n.handlerName??"—",onSave:v=>m(n.id,{handlerName:v}),mono:!1})]})]}),n.source&&s.jsxs("p",{className:"flex items-center gap-1.5 text-[10px] theme-text-faint",children:[s.jsx(Id,{className:"h-3 w-3 shrink-0",strokeWidth:2}),n.source.file.split(/[/\\]/).slice(-2).join("/"),":",n.source.line]}),Object.keys(p).length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1.5 uppercase tracking-wider",children:"Request Body"}),s.jsx("div",{className:"space-y-1",children:Object.entries(p).map(([v,N])=>s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border theme-border theme-bg-overlay-md px-3 py-1.5",children:[s.jsx("span",{className:"font-mono text-[11px] theme-text",children:v}),s.jsx("span",{className:"text-[10px] theme-text-faint",children:N.type}),N.required&&s.jsx("span",{className:"text-[10px] text-rose-400",children:"required"})]},v))})]}),Object.keys(b).length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1.5 uppercase tracking-wider",children:"Responses"}),s.jsx("div",{className:"space-y-1",children:Object.entries(b).map(([v,N])=>s.jsxs("div",{className:"flex items-start gap-2 rounded-lg border theme-border theme-bg-overlay-md px-3 py-1.5",children:[s.jsx("span",{className:`font-mono text-[11px] ${v.startsWith("2")?"text-emerald-400":"text-red-400"}`,children:v}),N.schema&&s.jsx("span",{className:"text-[10px] theme-text-muted",children:Object.keys(N.schema).join(", ")})]},v))})]}),n.middleware&&n.middleware.length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1.5 uppercase tracking-wider",children:"Middleware"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.middleware.map((v,N)=>s.jsx("span",{className:"rounded-lg border theme-border theme-bg-overlay-md px-2 py-0.5 text-[10px] theme-text-muted",children:v.name},N))})]})]})]})}function F3({prefix:n,endpoints:r,onUpdate:o,onInspect:i,onViewTraces:u,onEdit:f}){const[h,g]=j.useState(!1);return s.jsxs("div",{children:[s.jsxs("button",{type:"button",onClick:()=>g(x=>!x),className:"flex w-full items-center gap-3 px-4 py-2 hover:theme-bg-overlay-md transition-colors theme-bg-overlay hover:cursor-pointer",children:[s.jsx("span",{className:"text-[color:var(--brand)]",children:h?s.jsx(vl,{className:"h-3 w-3"}):s.jsx(qa,{className:"h-3 w-3"})}),s.jsx("span",{className:"font-mono text-xs font-medium text-[color:var(--brand)]",children:n}),s.jsx("span",{className:"ml-auto rounded-full border theme-border theme-bg-overlay-md px-2 py-0.5 text-[10px] theme-text-muted",children:r.length})]}),s.jsx("div",{className:"flex flex-col overflow-y-auto max-h-[calc(100vh-280px)]",children:!h&&r.map(x=>s.jsx(I3,{ep:x,onUpdate:o,onInspect:i,onViewTraces:u,onEdit:f},x.id))})]})}const ll=210,Cr=52,Td=100,x0=14,rl=36;function P3({endpoints:n}){const r=j.useRef(null),o=new Map;for(const x of n){const m="/"+(x.path.split("/")[1]??"");o.has(m)||o.set(m,[]),o.get(m).push(x)}const i=Array.from(o.entries()),u=Math.max(1,...i.map(([,x])=>x.length)),f=i.length*ll+(i.length-1)*Td+rl*2,h=u*Cr+(u-1)*x0+rl*2+24,g=new Map;return i.forEach(([,x],m)=>{const p=rl+m*(ll+Td);x.forEach((b,v)=>{g.set(b.id,{x:p,y:rl+24+v*(Cr+x0)})})}),j.useEffect(()=>{const x=r.current;if(!x)return;const m=x.getContext("2d");if(!m)return;m.clearRect(0,0,x.width,x.height);const p=getComputedStyle(document.documentElement).getPropertyValue("--brand").trim()||"#ffffff";m.strokeStyle=p,m.globalAlpha=.14,i.forEach(([,b],v)=>{if(v>=i.length-1)return;const N=i[v+1][1];b.forEach(C=>{const k=g.get(C.id);N.forEach(R=>{const z=g.get(R.id),V=k.x+ll,q=k.y+Cr/2,M=z.x,H=z.y+Cr/2,Z=(V+M)/2;m.beginPath(),m.lineWidth=1,m.moveTo(V,q),m.bezierCurveTo(Z,q,Z,H,M,H),m.stroke()})})})}),s.jsxs("div",{className:"relative overflow-auto",style:{minWidth:f,minHeight:h},children:[s.jsx("canvas",{ref:r,width:f,height:h,className:"absolute inset-0 pointer-events-none"}),i.map(([x],m)=>s.jsx("div",{className:"absolute text-[9px] font-medium text-[color:var(--brand)]/70 uppercase tracking-widest text-center",style:{left:rl+m*(ll+Td),top:rl,width:ll},children:x},x)),n.map(x=>{const m=g.get(x.id);if(!m)return null;const p=by(x.method);return s.jsxs("div",{className:"absolute rounded-lg border theme-border theme-bg-overlay shadow-md flex items-center gap-2 px-3 overflow-hidden hover:border-[color:var(--brand)]/30 transition-colors",style:{left:m.x,top:m.y,width:ll,height:Cr},children:[s.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-[3px]",style:{background:p.dot}}),s.jsx("span",{className:`shrink-0 text-[9px] font-medium ${p.text}`,children:x.method}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-mono text-[10px] theme-text truncate",children:x.path}),s.jsx("p",{className:"text-[9px] theme-text-faint truncate",children:x.handlerName})]})]},x.id)})]})}function e4({onScan:n,scanning:r,error:o}){return s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-5 py-20 text-center",children:[s.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[s.jsx("div",{className:"absolute inset-0 rounded-full bg-[color:var(--brand)]/10 blur-xl"}),s.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full border theme-border theme-bg-overlay text-[color:var(--brand)]",children:s.jsx(Ri,{className:"h-7 w-7",strokeWidth:2})})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium theme-text-primary",children:"No model found"}),s.jsxs("p",{className:"mt-1 text-xs theme-text-muted",children:["Scan your project to generate ",s.jsx("code",{className:"theme-text",children:".jetic/model.json"})]})]}),o&&s.jsx("p",{className:"text-xs text-red-400 max-w-xs",children:o}),s.jsxs("button",{type:"button",onClick:n,disabled:r,className:"flex items-center gap-2 rounded-lg bg-[var(--action)] px-5 py-2.5 text-sm font-medium text-[color:var(--action-foreground)] hover:bg-[var(--action-hover)] disabled:opacity-50 transition-colors hover:cursor-pointer",children:[r?s.jsx(dt,{className:"h-4 w-4 animate-spin",strokeWidth:2}):s.jsx(Ri,{className:"h-4 w-4",strokeWidth:2}),r?"Scanning project…":"Scan Project"]})]})}const Yi=["application/json","application/x-www-form-urlencoded","multipart/form-data","text/plain","application/xml","application/octet-stream"],vy=["string","integer","number","boolean","array","object"];function t4({open:n,onClose:r,onCreated:o}){const[i,u]=j.useState("basic"),[f,h]=j.useState(!1),[g,x]=j.useState(""),[m,p]=j.useState("GET"),[b,v]=j.useState(""),[N,C]=j.useState(""),[k,R]=j.useState(""),[z,V]=j.useState(""),[q,M]=j.useState([]),[H,Z]=j.useState("application/json"),[X,oe]=j.useState(""),[I,K]=j.useState(""),[ae,te]=j.useState(!1),[se,_]=j.useState([]),[W,E]=j.useState([]),[$,T]=j.useState(!1),A=$&&!b.trim(),S=j.useRef(null);j.useEffect(()=>{n&&(u("basic"),p("GET"),v(""),C(""),R(""),V(""),M([]),Z("application/json"),oe(""),K(""),te(!1),_([]),E([]),T(!1),x(""),h(!1))},[n]),j.useEffect(()=>{if(!n)return;const Y=ue=>{ue.key==="Escape"&&r()};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[n,r]);const D=()=>M(Y=>[...Y,{name:"",in:"query",type:"string",required:!1,description:"",example:""}]),L=(Y,ue)=>M(re=>re.map((ee,Ee)=>Ee===Y?{...ee,...ue}:ee)),F=Y=>M(ue=>ue.filter((re,ee)=>ee!==Y)),ie=()=>_(Y=>[...Y,{status:"200",description:"",contentType:"application/json",schema:"",example:""}]),he=(Y,ue)=>_(re=>re.map((ee,Ee)=>Ee===Y?{...ee,...ue}:ee)),me=Y=>_(ue=>ue.filter((re,ee)=>ee!==Y)),Se=()=>E(Y=>[...Y,{name:""}]),ve=(Y,ue)=>E(re=>re.map((ee,Ee)=>Ee===Y?{name:ue}:ee)),Ae=Y=>E(ue=>ue.filter((re,ee)=>ee!==Y)),Re=(Y,ue)=>E(re=>{const ee=[...re],Ee=Y+ue;return Ee<0||Ee>=ee.length||([ee[Y],ee[Ee]]=[ee[Ee],ee[Y]]),ee}),We=async()=>{if(T(!0),!b.trim()){u("basic");return}h(!0),x("");try{const Y={method:m.toUpperCase(),path:b.startsWith("/")?b:"/"+b};N.trim()&&(Y.name=N.trim()),k.trim()&&(Y.description=k.trim()),z.trim()&&(Y.tags=z.split(",").map(ge=>ge.trim()).filter(Boolean));const ue=W.filter(ge=>ge.name.trim());Y.middleware=ue.map(ge=>({name:ge.name.trim()}));const re=q.filter(ge=>ge.name.trim());if(re.length>0&&(Y.parameters=re.map(ge=>{const ke={name:ge.name,in:ge.in,schema:{type:ge.type},required:ge.required};return ge.description.trim()&&(ke.description=ge.description),ge.example.trim()&&(ke.example=ge.example),ke})),X.trim()||I.trim()){const ge={},ke={};if(X.trim())try{ke.schema=JSON.parse(X)}catch{ke.schema=X}if(I.trim())try{ke.example=JSON.parse(I)}catch{ke.example=I}ge[H]=ke,Y.requestBody={required:ae,content:ge}}const ee=se.filter(ge=>ge.status.trim());if(ee.length>0){const ge={};for(const ke of ee){const Oe={};if(ke.description.trim()&&(Oe.description=ke.description),ke.schema.trim()||ke.example.trim()){const ze={};if(ke.schema.trim())try{ze.schema=JSON.parse(ke.schema)}catch{ze.schema=ke.schema}if(ke.example.trim())try{ze.example=JSON.parse(ke.example)}catch{ze.example=ke.example}Oe.content={[ke.contentType]:ze}}ge[ke.status]=Oe}Y.responses=ge}const Ee=await K3(Y);o(Ee.endpoint,Ee.model),r()}catch(Y){x(Y.message)}finally{h(!1)}};if(!n)return null;const Te=[{key:"basic",label:"Basic"},{key:"request",label:"Request"},{key:"responses",label:"Responses"},{key:"middleware",label:`Middleware${W.length>0?` (${W.length})`:""}`}],be="w-full rounded-lg border theme-border theme-bg-overlay px-3 py-2 text-xs theme-text placeholder-[var(--text-faint)] outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md transition-all",B="block text-[10px] theme-text-faint mb-1.5 uppercase tracking-wider font-medium";return s.jsx("div",{ref:S,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:Y=>{Y.target===S.current&&r()},children:s.jsxs("div",{className:"relative w-full max-w-2xl max-h-[85vh] flex flex-col rounded-2xl border border-[var(--border-md)] shadow-2xl overflow-hidden theme-bg-surface",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b theme-border",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-[color:var(--brand)]/10",children:s.jsx(av,{className:"h-4 w-4 text-[color:var(--brand)]"})}),s.jsx("h2",{className:"text-sm font-medium theme-text-primary",children:"Add Endpoint"})]}),s.jsx("button",{type:"button",onClick:r,className:"theme-text-faint hover:theme-text transition-colors hover:cursor-pointer",children:s.jsx(Ct,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"flex items-center gap-1 px-6 pt-4 pb-2",children:Te.map(Y=>s.jsx("button",{type:"button",onClick:()=>u(Y.key),className:`rounded-lg px-3 py-1.5 text-[11px] font-medium transition-all duration-200 hover:cursor-pointer ${i===Y.key?"bg-[color:var(--brand)]/15 text-[color:var(--brand)] shadow-sm":"theme-text-faint hover:theme-text-muted hover:theme-bg-overlay"}`,children:Y.label},Y.key))}),g&&s.jsxs("div",{className:"mx-6 mt-2 flex items-center gap-2 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2 text-xs text-red-400",children:[s.jsx(_t,{className:"h-3.5 w-3.5 shrink-0"}),g]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-4",children:[i==="basic"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-[140px_1fr] gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Method *"}),s.jsx("select",{value:m,onChange:Y=>p(Y.target.value),className:`${be} hover:cursor-pointer`,children:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"].map(Y=>s.jsx("option",{children:Y},Y))})]}),s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Path *"}),s.jsx("input",{value:b,onChange:Y=>v(Y.target.value),placeholder:"/api/users",className:`${be} font-mono ${A?"border-red-500/60 focus:border-red-500/80":""}`}),A&&s.jsx("p",{className:"text-[10px] text-red-400 mt-1",children:"Path is required"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Name"}),s.jsx("input",{value:N,onChange:Y=>C(Y.target.value),placeholder:"Create User",className:be})]}),s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Description"}),s.jsx("textarea",{value:k,onChange:Y=>R(Y.target.value),placeholder:"Creates a new user account",rows:2,className:`${be} resize-none`})]}),s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Tags"}),s.jsx("input",{value:z,onChange:Y=>V(Y.target.value),placeholder:"users, auth, public",className:be}),s.jsx("p",{className:"text-[10px] theme-text-faint mt-1",children:"Comma-separated"})]})]}),i==="request"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("p",{className:B+" mb-0",children:"Parameters"}),s.jsxs("button",{type:"button",onClick:D,className:"flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] font-medium text-[color:var(--brand)] hover:bg-[color:var(--brand)]/10 transition-colors hover:cursor-pointer",children:[s.jsx(Ht,{className:"h-3 w-3"})," Add Parameter"]})]}),q.length===0&&s.jsx("p",{className:"text-[10px] theme-text-faint italic",children:"No parameters added yet"}),s.jsx("div",{className:"space-y-2",children:q.map((Y,ue)=>s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay p-3 space-y-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"flex-1",children:s.jsx("input",{value:Y.name,onChange:re=>L(ue,{name:re.target.value}),placeholder:"Parameter name",className:`${be} font-mono`})}),s.jsx("select",{value:Y.in,onChange:re=>L(ue,{in:re.target.value}),className:`${be} w-28 hover:cursor-pointer`,children:["query","path","header","cookie"].map(re=>s.jsx("option",{children:re},re))}),s.jsx("select",{value:Y.type,onChange:re=>L(ue,{type:re.target.value}),className:`${be} w-28 hover:cursor-pointer`,children:vy.map(re=>s.jsx("option",{children:re},re))}),s.jsx("button",{type:"button",onClick:()=>F(ue),className:"mt-1.5 theme-text-faint hover:text-red-400 transition-colors hover:cursor-pointer",children:s.jsx(Yt,{className:"h-3.5 w-3.5"})})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] theme-text-muted hover:cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:Y.required,onChange:re=>L(ue,{required:re.target.checked}),className:"accent-[color:var(--brand)]"}),"Required"]}),s.jsx("input",{value:Y.description,onChange:re=>L(ue,{description:re.target.value}),placeholder:"Description",className:`${be} flex-1 text-[10px]`}),s.jsx("input",{value:Y.example,onChange:re=>L(ue,{example:re.target.value}),placeholder:"Example",className:`${be} w-32 text-[10px] font-mono`})]})]},ue))})]}),s.jsx("div",{className:"border-t theme-border"}),s.jsxs("div",{children:[s.jsx("p",{className:B,children:"Request Body"}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:B,children:"Content Type"}),s.jsx("select",{value:H,onChange:Y=>Z(Y.target.value),className:`${be} hover:cursor-pointer`,children:Yi.map(Y=>s.jsx("option",{children:Y},Y))})]}),s.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] theme-text-muted mt-5 hover:cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:ae,onChange:Y=>te(Y.target.checked),className:"accent-[color:var(--brand)]"}),"Required"]})]}),s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Schema (JSON)"}),s.jsx("textarea",{value:X,onChange:Y=>oe(Y.target.value),placeholder:`{
411
+ */var bx;function M2(){if(bx)return pd;bx=1;var n=Yr(),r=T2();function o(m,p){return m===p&&(m!==0||1/m===1/p)||m!==m&&p!==p}var i=typeof Object.is=="function"?Object.is:o,u=r.useSyncExternalStore,f=n.useRef,h=n.useEffect,g=n.useMemo,x=n.useDebugValue;return pd.useSyncExternalStoreWithSelector=function(m,p,b,v,N){var C=f(null);if(C.current===null){var k={hasValue:!1,value:null};C.current=k}else k=C.current;C=g(function(){function z(Z){if(!V){if(V=!0,q=Z,Z=v(Z),N!==void 0&&k.hasValue){var X=k.value;if(N(X,Z))return M=X}return M=Z}if(X=M,i(q,Z))return X;var oe=v(Z);return N!==void 0&&N(X,oe)?(q=Z,X):(q=Z,M=oe)}var V=!1,q,M,H=b===void 0?null:b;return[function(){return z(p())},H===null?void 0:function(){return z(H())}]},[p,b,v,N]);var R=u(m,C[0],C[1]);return h(function(){k.hasValue=!0,k.value=R},[R]),x(R),R},pd}var vx;function A2(){return vx||(vx=1,md.exports=M2()),md.exports}var R2=A2();const z2=S0(R2),O2={},jx=n=>{let r;const o=new Set,i=(p,b)=>{const v=typeof p=="function"?p(r):p;if(!Object.is(v,r)){const N=r;r=b??(typeof v!="object"||v===null)?v:Object.assign({},r,v),o.forEach(C=>C(r,N))}},u=()=>r,x={setState:i,getState:u,getInitialState:()=>m,subscribe:p=>(o.add(p),()=>o.delete(p)),destroy:()=>{(O2?"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."),o.clear()}},m=r=n(i,u,x);return x},D2=n=>n?jx(n):jx,{useDebugValue:H2}=le,{useSyncExternalStoreWithSelector:$2}=z2,U2=n=>n;function Y0(n,r=U2,o){const i=$2(n.subscribe,n.getState,n.getServerState||n.getInitialState,r,o);return H2(i),i}const Nx=(n,r)=>{const o=D2(n),i=(u,f=r)=>Y0(o,u,f);return Object.assign(i,o),i},B2=(n,r)=>n?Nx(n,r):Nx;function Mt(n,r){if(Object.is(n,r))return!0;if(typeof n!="object"||n===null||typeof r!="object"||r===null)return!1;if(n instanceof Map&&r instanceof Map){if(n.size!==r.size)return!1;for(const[i,u]of n)if(!Object.is(u,r.get(i)))return!1;return!0}if(n instanceof Set&&r instanceof Set){if(n.size!==r.size)return!1;for(const i of n)if(!r.has(i))return!1;return!0}const o=Object.keys(n);if(o.length!==Object.keys(r).length)return!1;for(const i of o)if(!Object.prototype.hasOwnProperty.call(r,i)||!Object.is(n[i],r[i]))return!1;return!0}var q2={value:()=>{}};function Gi(){for(var n=0,r=arguments.length,o={},i;n<r;++n){if(!(i=arguments[n]+"")||i in o||/[\s.]/.test(i))throw new Error("illegal type: "+i);o[i]=[]}return new Ci(o)}function Ci(n){this._=n}function L2(n,r){return n.trim().split(/^|\s+/).map(function(o){var i="",u=o.indexOf(".");if(u>=0&&(i=o.slice(u+1),o=o.slice(0,u)),o&&!r.hasOwnProperty(o))throw new Error("unknown type: "+o);return{type:o,name:i}})}Ci.prototype=Gi.prototype={constructor:Ci,on:function(n,r){var o=this._,i=L2(n+"",o),u,f=-1,h=i.length;if(arguments.length<2){for(;++f<h;)if((u=(n=i[f]).type)&&(u=Y2(o[u],n.name)))return u;return}if(r!=null&&typeof r!="function")throw new Error("invalid callback: "+r);for(;++f<h;)if(u=(n=i[f]).type)o[u]=wx(o[u],n.name,r);else if(r==null)for(u in o)o[u]=wx(o[u],n.name,null);return this},copy:function(){var n={},r=this._;for(var o in r)n[o]=r[o].slice();return new Ci(n)},call:function(n,r){if((u=arguments.length-2)>0)for(var o=new Array(u),i=0,u,f;i<u;++i)o[i]=arguments[i+2];if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(f=this._[n],i=0,u=f.length;i<u;++i)f[i].value.apply(r,o)},apply:function(n,r,o){if(!this._.hasOwnProperty(n))throw new Error("unknown type: "+n);for(var i=this._[n],u=0,f=i.length;u<f;++u)i[u].value.apply(r,o)}};function Y2(n,r){for(var o=0,i=n.length,u;o<i;++o)if((u=n[o]).name===r)return u.value}function wx(n,r,o){for(var i=0,u=n.length;i<u;++i)if(n[i].name===r){n[i]=q2,n=n.slice(0,i).concat(n.slice(i+1));break}return o!=null&&n.push({name:r,value:o}),n}var zd="http://www.w3.org/1999/xhtml";const Sx={svg:"http://www.w3.org/2000/svg",xhtml:zd,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function Xi(n){var r=n+="",o=r.indexOf(":");return o>=0&&(r=n.slice(0,o))!=="xmlns"&&(n=n.slice(o+1)),Sx.hasOwnProperty(r)?{space:Sx[r],local:n}:n}function V2(n){return function(){var r=this.ownerDocument,o=this.namespaceURI;return o===zd&&r.documentElement.namespaceURI===zd?r.createElement(n):r.createElementNS(o,n)}}function G2(n){return function(){return this.ownerDocument.createElementNS(n.space,n.local)}}function V0(n){var r=Xi(n);return(r.local?G2:V2)(r)}function X2(){}function tf(n){return n==null?X2:function(){return this.querySelector(n)}}function Z2(n){typeof n!="function"&&(n=tf(n));for(var r=this._groups,o=r.length,i=new Array(o),u=0;u<o;++u)for(var f=r[u],h=f.length,g=i[u]=new Array(h),x,m,p=0;p<h;++p)(x=f[p])&&(m=n.call(x,x.__data__,p,f))&&("__data__"in x&&(m.__data__=x.__data__),g[p]=m);return new on(i,this._parents)}function W2(n){return n==null?[]:Array.isArray(n)?n:Array.from(n)}function Q2(){return[]}function G0(n){return n==null?Q2:function(){return this.querySelectorAll(n)}}function K2(n){return function(){return W2(n.apply(this,arguments))}}function J2(n){typeof n=="function"?n=K2(n):n=G0(n);for(var r=this._groups,o=r.length,i=[],u=[],f=0;f<o;++f)for(var h=r[f],g=h.length,x,m=0;m<g;++m)(x=h[m])&&(i.push(n.call(x,x.__data__,m,h)),u.push(x));return new on(i,u)}function X0(n){return function(){return this.matches(n)}}function Z0(n){return function(r){return r.matches(n)}}var I2=Array.prototype.find;function F2(n){return function(){return I2.call(this.children,n)}}function P2(){return this.firstElementChild}function ej(n){return this.select(n==null?P2:F2(typeof n=="function"?n:Z0(n)))}var tj=Array.prototype.filter;function nj(){return Array.from(this.children)}function aj(n){return function(){return tj.call(this.children,n)}}function sj(n){return this.selectAll(n==null?nj:aj(typeof n=="function"?n:Z0(n)))}function lj(n){typeof n!="function"&&(n=X0(n));for(var r=this._groups,o=r.length,i=new Array(o),u=0;u<o;++u)for(var f=r[u],h=f.length,g=i[u]=[],x,m=0;m<h;++m)(x=f[m])&&n.call(x,x.__data__,m,f)&&g.push(x);return new on(i,this._parents)}function W0(n){return new Array(n.length)}function rj(){return new on(this._enter||this._groups.map(W0),this._parents)}function Oi(n,r){this.ownerDocument=n.ownerDocument,this.namespaceURI=n.namespaceURI,this._next=null,this._parent=n,this.__data__=r}Oi.prototype={constructor:Oi,appendChild:function(n){return this._parent.insertBefore(n,this._next)},insertBefore:function(n,r){return this._parent.insertBefore(n,r)},querySelector:function(n){return this._parent.querySelector(n)},querySelectorAll:function(n){return this._parent.querySelectorAll(n)}};function oj(n){return function(){return n}}function ij(n,r,o,i,u,f){for(var h=0,g,x=r.length,m=f.length;h<m;++h)(g=r[h])?(g.__data__=f[h],i[h]=g):o[h]=new Oi(n,f[h]);for(;h<x;++h)(g=r[h])&&(u[h]=g)}function cj(n,r,o,i,u,f,h){var g,x,m=new Map,p=r.length,b=f.length,v=new Array(p),N;for(g=0;g<p;++g)(x=r[g])&&(v[g]=N=h.call(x,x.__data__,g,r)+"",m.has(N)?u[g]=x:m.set(N,x));for(g=0;g<b;++g)N=h.call(n,f[g],g,f)+"",(x=m.get(N))?(i[g]=x,x.__data__=f[g],m.delete(N)):o[g]=new Oi(n,f[g]);for(g=0;g<p;++g)(x=r[g])&&m.get(v[g])===x&&(u[g]=x)}function uj(n){return n.__data__}function dj(n,r){if(!arguments.length)return Array.from(this,uj);var o=r?cj:ij,i=this._parents,u=this._groups;typeof n!="function"&&(n=oj(n));for(var f=u.length,h=new Array(f),g=new Array(f),x=new Array(f),m=0;m<f;++m){var p=i[m],b=u[m],v=b.length,N=fj(n.call(p,p&&p.__data__,m,i)),C=N.length,k=g[m]=new Array(C),R=h[m]=new Array(C),z=x[m]=new Array(v);o(p,b,k,R,z,N,r);for(var V=0,q=0,M,H;V<C;++V)if(M=k[V]){for(V>=q&&(q=V+1);!(H=R[q])&&++q<C;);M._next=H||null}}return h=new on(h,i),h._enter=g,h._exit=x,h}function fj(n){return typeof n=="object"&&"length"in n?n:Array.from(n)}function hj(){return new on(this._exit||this._groups.map(W0),this._parents)}function mj(n,r,o){var i=this.enter(),u=this,f=this.exit();return typeof n=="function"?(i=n(i),i&&(i=i.selection())):i=i.append(n+""),r!=null&&(u=r(u),u&&(u=u.selection())),o==null?f.remove():o(f),i&&u?i.merge(u).order():u}function pj(n){for(var r=n.selection?n.selection():n,o=this._groups,i=r._groups,u=o.length,f=i.length,h=Math.min(u,f),g=new Array(u),x=0;x<h;++x)for(var m=o[x],p=i[x],b=m.length,v=g[x]=new Array(b),N,C=0;C<b;++C)(N=m[C]||p[C])&&(v[C]=N);for(;x<u;++x)g[x]=o[x];return new on(g,this._parents)}function xj(){for(var n=this._groups,r=-1,o=n.length;++r<o;)for(var i=n[r],u=i.length-1,f=i[u],h;--u>=0;)(h=i[u])&&(f&&h.compareDocumentPosition(f)^4&&f.parentNode.insertBefore(h,f),f=h);return this}function gj(n){n||(n=yj);function r(b,v){return b&&v?n(b.__data__,v.__data__):!b-!v}for(var o=this._groups,i=o.length,u=new Array(i),f=0;f<i;++f){for(var h=o[f],g=h.length,x=u[f]=new Array(g),m,p=0;p<g;++p)(m=h[p])&&(x[p]=m);x.sort(r)}return new on(u,this._parents).order()}function yj(n,r){return n<r?-1:n>r?1:n>=r?0:NaN}function bj(){var n=arguments[0];return arguments[0]=this,n.apply(null,arguments),this}function vj(){return Array.from(this)}function jj(){for(var n=this._groups,r=0,o=n.length;r<o;++r)for(var i=n[r],u=0,f=i.length;u<f;++u){var h=i[u];if(h)return h}return null}function Nj(){let n=0;for(const r of this)++n;return n}function wj(){return!this.node()}function Sj(n){for(var r=this._groups,o=0,i=r.length;o<i;++o)for(var u=r[o],f=0,h=u.length,g;f<h;++f)(g=u[f])&&n.call(g,g.__data__,f,u);return this}function Ej(n){return function(){this.removeAttribute(n)}}function kj(n){return function(){this.removeAttributeNS(n.space,n.local)}}function _j(n,r){return function(){this.setAttribute(n,r)}}function Cj(n,r){return function(){this.setAttributeNS(n.space,n.local,r)}}function Tj(n,r){return function(){var o=r.apply(this,arguments);o==null?this.removeAttribute(n):this.setAttribute(n,o)}}function Mj(n,r){return function(){var o=r.apply(this,arguments);o==null?this.removeAttributeNS(n.space,n.local):this.setAttributeNS(n.space,n.local,o)}}function Aj(n,r){var o=Xi(n);if(arguments.length<2){var i=this.node();return o.local?i.getAttributeNS(o.space,o.local):i.getAttribute(o)}return this.each((r==null?o.local?kj:Ej:typeof r=="function"?o.local?Mj:Tj:o.local?Cj:_j)(o,r))}function Q0(n){return n.ownerDocument&&n.ownerDocument.defaultView||n.document&&n||n.defaultView}function Rj(n){return function(){this.style.removeProperty(n)}}function zj(n,r,o){return function(){this.style.setProperty(n,r,o)}}function Oj(n,r,o){return function(){var i=r.apply(this,arguments);i==null?this.style.removeProperty(n):this.style.setProperty(n,i,o)}}function Dj(n,r,o){return arguments.length>1?this.each((r==null?Rj:typeof r=="function"?Oj:zj)(n,r,o??"")):xl(this.node(),n)}function xl(n,r){return n.style.getPropertyValue(r)||Q0(n).getComputedStyle(n,null).getPropertyValue(r)}function Hj(n){return function(){delete this[n]}}function $j(n,r){return function(){this[n]=r}}function Uj(n,r){return function(){var o=r.apply(this,arguments);o==null?delete this[n]:this[n]=o}}function Bj(n,r){return arguments.length>1?this.each((r==null?Hj:typeof r=="function"?Uj:$j)(n,r)):this.node()[n]}function K0(n){return n.trim().split(/^|\s+/)}function nf(n){return n.classList||new J0(n)}function J0(n){this._node=n,this._names=K0(n.getAttribute("class")||"")}J0.prototype={add:function(n){var r=this._names.indexOf(n);r<0&&(this._names.push(n),this._node.setAttribute("class",this._names.join(" ")))},remove:function(n){var r=this._names.indexOf(n);r>=0&&(this._names.splice(r,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(n){return this._names.indexOf(n)>=0}};function I0(n,r){for(var o=nf(n),i=-1,u=r.length;++i<u;)o.add(r[i])}function F0(n,r){for(var o=nf(n),i=-1,u=r.length;++i<u;)o.remove(r[i])}function qj(n){return function(){I0(this,n)}}function Lj(n){return function(){F0(this,n)}}function Yj(n,r){return function(){(r.apply(this,arguments)?I0:F0)(this,n)}}function Vj(n,r){var o=K0(n+"");if(arguments.length<2){for(var i=nf(this.node()),u=-1,f=o.length;++u<f;)if(!i.contains(o[u]))return!1;return!0}return this.each((typeof r=="function"?Yj:r?qj:Lj)(o,r))}function Gj(){this.textContent=""}function Xj(n){return function(){this.textContent=n}}function Zj(n){return function(){var r=n.apply(this,arguments);this.textContent=r??""}}function Wj(n){return arguments.length?this.each(n==null?Gj:(typeof n=="function"?Zj:Xj)(n)):this.node().textContent}function Qj(){this.innerHTML=""}function Kj(n){return function(){this.innerHTML=n}}function Jj(n){return function(){var r=n.apply(this,arguments);this.innerHTML=r??""}}function Ij(n){return arguments.length?this.each(n==null?Qj:(typeof n=="function"?Jj:Kj)(n)):this.node().innerHTML}function Fj(){this.nextSibling&&this.parentNode.appendChild(this)}function Pj(){return this.each(Fj)}function eN(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function tN(){return this.each(eN)}function nN(n){var r=typeof n=="function"?n:V0(n);return this.select(function(){return this.appendChild(r.apply(this,arguments))})}function aN(){return null}function sN(n,r){var o=typeof n=="function"?n:V0(n),i=r==null?aN:typeof r=="function"?r:tf(r);return this.select(function(){return this.insertBefore(o.apply(this,arguments),i.apply(this,arguments)||null)})}function lN(){var n=this.parentNode;n&&n.removeChild(this)}function rN(){return this.each(lN)}function oN(){var n=this.cloneNode(!1),r=this.parentNode;return r?r.insertBefore(n,this.nextSibling):n}function iN(){var n=this.cloneNode(!0),r=this.parentNode;return r?r.insertBefore(n,this.nextSibling):n}function cN(n){return this.select(n?iN:oN)}function uN(n){return arguments.length?this.property("__data__",n):this.node().__data__}function dN(n){return function(r){n.call(this,r,this.__data__)}}function fN(n){return n.trim().split(/^|\s+/).map(function(r){var o="",i=r.indexOf(".");return i>=0&&(o=r.slice(i+1),r=r.slice(0,i)),{type:r,name:o}})}function hN(n){return function(){var r=this.__on;if(r){for(var o=0,i=-1,u=r.length,f;o<u;++o)f=r[o],(!n.type||f.type===n.type)&&f.name===n.name?this.removeEventListener(f.type,f.listener,f.options):r[++i]=f;++i?r.length=i:delete this.__on}}}function mN(n,r,o){return function(){var i=this.__on,u,f=dN(r);if(i){for(var h=0,g=i.length;h<g;++h)if((u=i[h]).type===n.type&&u.name===n.name){this.removeEventListener(u.type,u.listener,u.options),this.addEventListener(u.type,u.listener=f,u.options=o),u.value=r;return}}this.addEventListener(n.type,f,o),u={type:n.type,name:n.name,value:r,listener:f,options:o},i?i.push(u):this.__on=[u]}}function pN(n,r,o){var i=fN(n+""),u,f=i.length,h;if(arguments.length<2){var g=this.node().__on;if(g){for(var x=0,m=g.length,p;x<m;++x)for(u=0,p=g[x];u<f;++u)if((h=i[u]).type===p.type&&h.name===p.name)return p.value}return}for(g=r?mN:hN,u=0;u<f;++u)this.each(g(i[u],r,o));return this}function P0(n,r,o){var i=Q0(n),u=i.CustomEvent;typeof u=="function"?u=new u(r,o):(u=i.document.createEvent("Event"),o?(u.initEvent(r,o.bubbles,o.cancelable),u.detail=o.detail):u.initEvent(r,!1,!1)),n.dispatchEvent(u)}function xN(n,r){return function(){return P0(this,n,r)}}function gN(n,r){return function(){return P0(this,n,r.apply(this,arguments))}}function yN(n,r){return this.each((typeof r=="function"?gN:xN)(n,r))}function*bN(){for(var n=this._groups,r=0,o=n.length;r<o;++r)for(var i=n[r],u=0,f=i.length,h;u<f;++u)(h=i[u])&&(yield h)}var eg=[null];function on(n,r){this._groups=n,this._parents=r}function Xr(){return new on([[document.documentElement]],eg)}function vN(){return this}on.prototype=Xr.prototype={constructor:on,select:Z2,selectAll:J2,selectChild:ej,selectChildren:sj,filter:lj,data:dj,enter:rj,exit:hj,join:mj,merge:pj,selection:vN,order:xj,sort:gj,call:bj,nodes:vj,node:jj,size:Nj,empty:wj,each:Sj,attr:Aj,style:Dj,property:Bj,classed:Vj,text:Wj,html:Ij,raise:Pj,lower:tN,append:nN,insert:sN,remove:rN,clone:cN,datum:uN,on:pN,dispatch:yN,[Symbol.iterator]:bN};function yn(n){return typeof n=="string"?new on([[document.querySelector(n)]],[document.documentElement]):new on([[n]],eg)}function jN(n){let r;for(;r=n.sourceEvent;)n=r;return n}function Sn(n,r){if(n=jN(n),r===void 0&&(r=n.currentTarget),r){var o=r.ownerSVGElement||r;if(o.createSVGPoint){var i=o.createSVGPoint();return i.x=n.clientX,i.y=n.clientY,i=i.matrixTransform(r.getScreenCTM().inverse()),[i.x,i.y]}if(r.getBoundingClientRect){var u=r.getBoundingClientRect();return[n.clientX-u.left-r.clientLeft,n.clientY-u.top-r.clientTop]}}return[n.pageX,n.pageY]}const NN={passive:!1},Or={capture:!0,passive:!1};function yd(n){n.stopImmediatePropagation()}function hl(n){n.preventDefault(),n.stopImmediatePropagation()}function tg(n){var r=n.document.documentElement,o=yn(n).on("dragstart.drag",hl,Or);"onselectstart"in r?o.on("selectstart.drag",hl,Or):(r.__noselect=r.style.MozUserSelect,r.style.MozUserSelect="none")}function ng(n,r){var o=n.document.documentElement,i=yn(n).on("dragstart.drag",null);r&&(i.on("click.drag",hl,Or),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in o?i.on("selectstart.drag",null):(o.style.MozUserSelect=o.__noselect,delete o.__noselect)}const mi=n=>()=>n;function Od(n,{sourceEvent:r,subject:o,target:i,identifier:u,active:f,x:h,y:g,dx:x,dy:m,dispatch:p}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},subject:{value:o,enumerable:!0,configurable:!0},target:{value:i,enumerable:!0,configurable:!0},identifier:{value:u,enumerable:!0,configurable:!0},active:{value:f,enumerable:!0,configurable:!0},x:{value:h,enumerable:!0,configurable:!0},y:{value:g,enumerable:!0,configurable:!0},dx:{value:x,enumerable:!0,configurable:!0},dy:{value:m,enumerable:!0,configurable:!0},_:{value:p}})}Od.prototype.on=function(){var n=this._.on.apply(this._,arguments);return n===this._?this:n};function wN(n){return!n.ctrlKey&&!n.button}function SN(){return this.parentNode}function EN(n,r){return r??{x:n.x,y:n.y}}function kN(){return navigator.maxTouchPoints||"ontouchstart"in this}function _N(){var n=wN,r=SN,o=EN,i=kN,u={},f=Gi("start","drag","end"),h=0,g,x,m,p,b=0;function v(M){M.on("mousedown.drag",N).filter(i).on("touchstart.drag",R).on("touchmove.drag",z,NN).on("touchend.drag touchcancel.drag",V).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function N(M,H){if(!(p||!n.call(this,M,H))){var Z=q(this,r.call(this,M,H),M,H,"mouse");Z&&(yn(M.view).on("mousemove.drag",C,Or).on("mouseup.drag",k,Or),tg(M.view),yd(M),m=!1,g=M.clientX,x=M.clientY,Z("start",M))}}function C(M){if(hl(M),!m){var H=M.clientX-g,Z=M.clientY-x;m=H*H+Z*Z>b}u.mouse("drag",M)}function k(M){yn(M.view).on("mousemove.drag mouseup.drag",null),ng(M.view,m),hl(M),u.mouse("end",M)}function R(M,H){if(n.call(this,M,H)){var Z=M.changedTouches,X=r.call(this,M,H),oe=Z.length,I,K;for(I=0;I<oe;++I)(K=q(this,X,M,H,Z[I].identifier,Z[I]))&&(yd(M),K("start",M,Z[I]))}}function z(M){var H=M.changedTouches,Z=H.length,X,oe;for(X=0;X<Z;++X)(oe=u[H[X].identifier])&&(hl(M),oe("drag",M,H[X]))}function V(M){var H=M.changedTouches,Z=H.length,X,oe;for(p&&clearTimeout(p),p=setTimeout(function(){p=null},500),X=0;X<Z;++X)(oe=u[H[X].identifier])&&(yd(M),oe("end",M,H[X]))}function q(M,H,Z,X,oe,I){var K=f.copy(),ae=Sn(I||Z,H),te,se,_;if((_=o.call(M,new Od("beforestart",{sourceEvent:Z,target:v,identifier:oe,active:h,x:ae[0],y:ae[1],dx:0,dy:0,dispatch:K}),X))!=null)return te=_.x-ae[0]||0,se=_.y-ae[1]||0,function W(E,$,T){var A=ae,S;switch(E){case"start":u[oe]=W,S=h++;break;case"end":delete u[oe],--h;case"drag":ae=Sn(T||$,H),S=h;break}K.call(E,M,new Od(E,{sourceEvent:$,subject:_,target:v,identifier:oe,active:S,x:ae[0]+te,y:ae[1]+se,dx:ae[0]-A[0],dy:ae[1]-A[1],dispatch:K}),X)}}return v.filter=function(M){return arguments.length?(n=typeof M=="function"?M:mi(!!M),v):n},v.container=function(M){return arguments.length?(r=typeof M=="function"?M:mi(M),v):r},v.subject=function(M){return arguments.length?(o=typeof M=="function"?M:mi(M),v):o},v.touchable=function(M){return arguments.length?(i=typeof M=="function"?M:mi(!!M),v):i},v.on=function(){var M=f.on.apply(f,arguments);return M===f?v:M},v.clickDistance=function(M){return arguments.length?(b=(M=+M)*M,v):Math.sqrt(b)},v}function af(n,r,o){n.prototype=r.prototype=o,o.constructor=n}function ag(n,r){var o=Object.create(n.prototype);for(var i in r)o[i]=r[i];return o}function Zr(){}var Dr=.7,Di=1/Dr,ml="\\s*([+-]?\\d+)\\s*",Hr="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",zn="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",CN=/^#([0-9a-f]{3,8})$/,TN=new RegExp(`^rgb\\(${ml},${ml},${ml}\\)$`),MN=new RegExp(`^rgb\\(${zn},${zn},${zn}\\)$`),AN=new RegExp(`^rgba\\(${ml},${ml},${ml},${Hr}\\)$`),RN=new RegExp(`^rgba\\(${zn},${zn},${zn},${Hr}\\)$`),zN=new RegExp(`^hsl\\(${Hr},${zn},${zn}\\)$`),ON=new RegExp(`^hsla\\(${Hr},${zn},${zn},${Hr}\\)$`),Ex={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};af(Zr,$r,{copy(n){return Object.assign(new this.constructor,this,n)},displayable(){return this.rgb().displayable()},hex:kx,formatHex:kx,formatHex8:DN,formatHsl:HN,formatRgb:_x,toString:_x});function kx(){return this.rgb().formatHex()}function DN(){return this.rgb().formatHex8()}function HN(){return sg(this).formatHsl()}function _x(){return this.rgb().formatRgb()}function $r(n){var r,o;return n=(n+"").trim().toLowerCase(),(r=CN.exec(n))?(o=r[1].length,r=parseInt(r[1],16),o===6?Cx(r):o===3?new Jt(r>>8&15|r>>4&240,r>>4&15|r&240,(r&15)<<4|r&15,1):o===8?pi(r>>24&255,r>>16&255,r>>8&255,(r&255)/255):o===4?pi(r>>12&15|r>>8&240,r>>8&15|r>>4&240,r>>4&15|r&240,((r&15)<<4|r&15)/255):null):(r=TN.exec(n))?new Jt(r[1],r[2],r[3],1):(r=MN.exec(n))?new Jt(r[1]*255/100,r[2]*255/100,r[3]*255/100,1):(r=AN.exec(n))?pi(r[1],r[2],r[3],r[4]):(r=RN.exec(n))?pi(r[1]*255/100,r[2]*255/100,r[3]*255/100,r[4]):(r=zN.exec(n))?Ax(r[1],r[2]/100,r[3]/100,1):(r=ON.exec(n))?Ax(r[1],r[2]/100,r[3]/100,r[4]):Ex.hasOwnProperty(n)?Cx(Ex[n]):n==="transparent"?new Jt(NaN,NaN,NaN,0):null}function Cx(n){return new Jt(n>>16&255,n>>8&255,n&255,1)}function pi(n,r,o,i){return i<=0&&(n=r=o=NaN),new Jt(n,r,o,i)}function $N(n){return n instanceof Zr||(n=$r(n)),n?(n=n.rgb(),new Jt(n.r,n.g,n.b,n.opacity)):new Jt}function Dd(n,r,o,i){return arguments.length===1?$N(n):new Jt(n,r,o,i??1)}function Jt(n,r,o,i){this.r=+n,this.g=+r,this.b=+o,this.opacity=+i}af(Jt,Dd,ag(Zr,{brighter(n){return n=n==null?Di:Math.pow(Di,n),new Jt(this.r*n,this.g*n,this.b*n,this.opacity)},darker(n){return n=n==null?Dr:Math.pow(Dr,n),new Jt(this.r*n,this.g*n,this.b*n,this.opacity)},rgb(){return this},clamp(){return new Jt(ds(this.r),ds(this.g),ds(this.b),Hi(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:Tx,formatHex:Tx,formatHex8:UN,formatRgb:Mx,toString:Mx}));function Tx(){return`#${cs(this.r)}${cs(this.g)}${cs(this.b)}`}function UN(){return`#${cs(this.r)}${cs(this.g)}${cs(this.b)}${cs((isNaN(this.opacity)?1:this.opacity)*255)}`}function Mx(){const n=Hi(this.opacity);return`${n===1?"rgb(":"rgba("}${ds(this.r)}, ${ds(this.g)}, ${ds(this.b)}${n===1?")":`, ${n})`}`}function Hi(n){return isNaN(n)?1:Math.max(0,Math.min(1,n))}function ds(n){return Math.max(0,Math.min(255,Math.round(n)||0))}function cs(n){return n=ds(n),(n<16?"0":"")+n.toString(16)}function Ax(n,r,o,i){return i<=0?n=r=o=NaN:o<=0||o>=1?n=r=NaN:r<=0&&(n=NaN),new En(n,r,o,i)}function sg(n){if(n instanceof En)return new En(n.h,n.s,n.l,n.opacity);if(n instanceof Zr||(n=$r(n)),!n)return new En;if(n instanceof En)return n;n=n.rgb();var r=n.r/255,o=n.g/255,i=n.b/255,u=Math.min(r,o,i),f=Math.max(r,o,i),h=NaN,g=f-u,x=(f+u)/2;return g?(r===f?h=(o-i)/g+(o<i)*6:o===f?h=(i-r)/g+2:h=(r-o)/g+4,g/=x<.5?f+u:2-f-u,h*=60):g=x>0&&x<1?0:h,new En(h,g,x,n.opacity)}function BN(n,r,o,i){return arguments.length===1?sg(n):new En(n,r,o,i??1)}function En(n,r,o,i){this.h=+n,this.s=+r,this.l=+o,this.opacity=+i}af(En,BN,ag(Zr,{brighter(n){return n=n==null?Di:Math.pow(Di,n),new En(this.h,this.s,this.l*n,this.opacity)},darker(n){return n=n==null?Dr:Math.pow(Dr,n),new En(this.h,this.s,this.l*n,this.opacity)},rgb(){var n=this.h%360+(this.h<0)*360,r=isNaN(n)||isNaN(this.s)?0:this.s,o=this.l,i=o+(o<.5?o:1-o)*r,u=2*o-i;return new Jt(bd(n>=240?n-240:n+120,u,i),bd(n,u,i),bd(n<120?n+240:n-120,u,i),this.opacity)},clamp(){return new En(Rx(this.h),xi(this.s),xi(this.l),Hi(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 n=Hi(this.opacity);return`${n===1?"hsl(":"hsla("}${Rx(this.h)}, ${xi(this.s)*100}%, ${xi(this.l)*100}%${n===1?")":`, ${n})`}`}}));function Rx(n){return n=(n||0)%360,n<0?n+360:n}function xi(n){return Math.max(0,Math.min(1,n||0))}function bd(n,r,o){return(n<60?r+(o-r)*n/60:n<180?o:n<240?r+(o-r)*(240-n)/60:r)*255}const lg=n=>()=>n;function qN(n,r){return function(o){return n+o*r}}function LN(n,r,o){return n=Math.pow(n,o),r=Math.pow(r,o)-n,o=1/o,function(i){return Math.pow(n+i*r,o)}}function YN(n){return(n=+n)==1?rg:function(r,o){return o-r?LN(r,o,n):lg(isNaN(r)?o:r)}}function rg(n,r){var o=r-n;return o?qN(n,o):lg(isNaN(n)?r:n)}const zx=(function n(r){var o=YN(r);function i(u,f){var h=o((u=Dd(u)).r,(f=Dd(f)).r),g=o(u.g,f.g),x=o(u.b,f.b),m=rg(u.opacity,f.opacity);return function(p){return u.r=h(p),u.g=g(p),u.b=x(p),u.opacity=m(p),u+""}}return i.gamma=n,i})(1);function Da(n,r){return n=+n,r=+r,function(o){return n*(1-o)+r*o}}var Hd=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,vd=new RegExp(Hd.source,"g");function VN(n){return function(){return n}}function GN(n){return function(r){return n(r)+""}}function XN(n,r){var o=Hd.lastIndex=vd.lastIndex=0,i,u,f,h=-1,g=[],x=[];for(n=n+"",r=r+"";(i=Hd.exec(n))&&(u=vd.exec(r));)(f=u.index)>o&&(f=r.slice(o,f),g[h]?g[h]+=f:g[++h]=f),(i=i[0])===(u=u[0])?g[h]?g[h]+=u:g[++h]=u:(g[++h]=null,x.push({i:h,x:Da(i,u)})),o=vd.lastIndex;return o<r.length&&(f=r.slice(o),g[h]?g[h]+=f:g[++h]=f),g.length<2?x[0]?GN(x[0].x):VN(r):(r=x.length,function(m){for(var p=0,b;p<r;++p)g[(b=x[p]).i]=b.x(m);return g.join("")})}var Ox=180/Math.PI,$d={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function og(n,r,o,i,u,f){var h,g,x;return(h=Math.sqrt(n*n+r*r))&&(n/=h,r/=h),(x=n*o+r*i)&&(o-=n*x,i-=r*x),(g=Math.sqrt(o*o+i*i))&&(o/=g,i/=g,x/=g),n*i<r*o&&(n=-n,r=-r,x=-x,h=-h),{translateX:u,translateY:f,rotate:Math.atan2(r,n)*Ox,skewX:Math.atan(x)*Ox,scaleX:h,scaleY:g}}var gi;function ZN(n){const r=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(n+"");return r.isIdentity?$d:og(r.a,r.b,r.c,r.d,r.e,r.f)}function WN(n){return n==null||(gi||(gi=document.createElementNS("http://www.w3.org/2000/svg","g")),gi.setAttribute("transform",n),!(n=gi.transform.baseVal.consolidate()))?$d:(n=n.matrix,og(n.a,n.b,n.c,n.d,n.e,n.f))}function ig(n,r,o,i){function u(m){return m.length?m.pop()+" ":""}function f(m,p,b,v,N,C){if(m!==b||p!==v){var k=N.push("translate(",null,r,null,o);C.push({i:k-4,x:Da(m,b)},{i:k-2,x:Da(p,v)})}else(b||v)&&N.push("translate("+b+r+v+o)}function h(m,p,b,v){m!==p?(m-p>180?p+=360:p-m>180&&(m+=360),v.push({i:b.push(u(b)+"rotate(",null,i)-2,x:Da(m,p)})):p&&b.push(u(b)+"rotate("+p+i)}function g(m,p,b,v){m!==p?v.push({i:b.push(u(b)+"skewX(",null,i)-2,x:Da(m,p)}):p&&b.push(u(b)+"skewX("+p+i)}function x(m,p,b,v,N,C){if(m!==b||p!==v){var k=N.push(u(N)+"scale(",null,",",null,")");C.push({i:k-4,x:Da(m,b)},{i:k-2,x:Da(p,v)})}else(b!==1||v!==1)&&N.push(u(N)+"scale("+b+","+v+")")}return function(m,p){var b=[],v=[];return m=n(m),p=n(p),f(m.translateX,m.translateY,p.translateX,p.translateY,b,v),h(m.rotate,p.rotate,b,v),g(m.skewX,p.skewX,b,v),x(m.scaleX,m.scaleY,p.scaleX,p.scaleY,b,v),m=p=null,function(N){for(var C=-1,k=v.length,R;++C<k;)b[(R=v[C]).i]=R.x(N);return b.join("")}}}var QN=ig(ZN,"px, ","px)","deg)"),KN=ig(WN,", ",")",")"),JN=1e-12;function Dx(n){return((n=Math.exp(n))+1/n)/2}function IN(n){return((n=Math.exp(n))-1/n)/2}function FN(n){return((n=Math.exp(2*n))-1)/(n+1)}const PN=(function n(r,o,i){function u(f,h){var g=f[0],x=f[1],m=f[2],p=h[0],b=h[1],v=h[2],N=p-g,C=b-x,k=N*N+C*C,R,z;if(k<JN)z=Math.log(v/m)/r,R=function(X){return[g+X*N,x+X*C,m*Math.exp(r*X*z)]};else{var V=Math.sqrt(k),q=(v*v-m*m+i*k)/(2*m*o*V),M=(v*v-m*m-i*k)/(2*v*o*V),H=Math.log(Math.sqrt(q*q+1)-q),Z=Math.log(Math.sqrt(M*M+1)-M);z=(Z-H)/r,R=function(X){var oe=X*z,I=Dx(H),K=m/(o*V)*(I*FN(r*oe+H)-IN(H));return[g+K*N,x+K*C,m*I/Dx(r*oe+H)]}}return R.duration=z*1e3*r/Math.SQRT2,R}return u.rho=function(f){var h=Math.max(.001,+f),g=h*h,x=g*g;return n(h,g,x)},u})(Math.SQRT2,2,4);var gl=0,Tr=0,wr=0,cg=1e3,$i,Mr,Ui=0,ms=0,Zi=0,Ur=typeof performance=="object"&&performance.now?performance:Date,ug=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(n){setTimeout(n,17)};function sf(){return ms||(ug(ew),ms=Ur.now()+Zi)}function ew(){ms=0}function Bi(){this._call=this._time=this._next=null}Bi.prototype=dg.prototype={constructor:Bi,restart:function(n,r,o){if(typeof n!="function")throw new TypeError("callback is not a function");o=(o==null?sf():+o)+(r==null?0:+r),!this._next&&Mr!==this&&(Mr?Mr._next=this:$i=this,Mr=this),this._call=n,this._time=o,Ud()},stop:function(){this._call&&(this._call=null,this._time=1/0,Ud())}};function dg(n,r,o){var i=new Bi;return i.restart(n,r,o),i}function tw(){sf(),++gl;for(var n=$i,r;n;)(r=ms-n._time)>=0&&n._call.call(void 0,r),n=n._next;--gl}function Hx(){ms=(Ui=Ur.now())+Zi,gl=Tr=0;try{tw()}finally{gl=0,aw(),ms=0}}function nw(){var n=Ur.now(),r=n-Ui;r>cg&&(Zi-=r,Ui=n)}function aw(){for(var n,r=$i,o,i=1/0;r;)r._call?(i>r._time&&(i=r._time),n=r,r=r._next):(o=r._next,r._next=null,r=n?n._next=o:$i=o);Mr=n,Ud(i)}function Ud(n){if(!gl){Tr&&(Tr=clearTimeout(Tr));var r=n-ms;r>24?(n<1/0&&(Tr=setTimeout(Hx,n-Ur.now()-Zi)),wr&&(wr=clearInterval(wr))):(wr||(Ui=Ur.now(),wr=setInterval(nw,cg)),gl=1,ug(Hx))}}function $x(n,r,o){var i=new Bi;return r=r==null?0:+r,i.restart(u=>{i.stop(),n(u+r)},r,o),i}var sw=Gi("start","end","cancel","interrupt"),lw=[],fg=0,Ux=1,Bd=2,Ti=3,Bx=4,qd=5,Mi=6;function Wi(n,r,o,i,u,f){var h=n.__transition;if(!h)n.__transition={};else if(o in h)return;rw(n,o,{name:r,index:i,group:u,on:sw,tween:lw,time:f.time,delay:f.delay,duration:f.duration,ease:f.ease,timer:null,state:fg})}function lf(n,r){var o=kn(n,r);if(o.state>fg)throw new Error("too late; already scheduled");return o}function On(n,r){var o=kn(n,r);if(o.state>Ti)throw new Error("too late; already running");return o}function kn(n,r){var o=n.__transition;if(!o||!(o=o[r]))throw new Error("transition not found");return o}function rw(n,r,o){var i=n.__transition,u;i[r]=o,o.timer=dg(f,0,o.time);function f(m){o.state=Ux,o.timer.restart(h,o.delay,o.time),o.delay<=m&&h(m-o.delay)}function h(m){var p,b,v,N;if(o.state!==Ux)return x();for(p in i)if(N=i[p],N.name===o.name){if(N.state===Ti)return $x(h);N.state===Bx?(N.state=Mi,N.timer.stop(),N.on.call("interrupt",n,n.__data__,N.index,N.group),delete i[p]):+p<r&&(N.state=Mi,N.timer.stop(),N.on.call("cancel",n,n.__data__,N.index,N.group),delete i[p])}if($x(function(){o.state===Ti&&(o.state=Bx,o.timer.restart(g,o.delay,o.time),g(m))}),o.state=Bd,o.on.call("start",n,n.__data__,o.index,o.group),o.state===Bd){for(o.state=Ti,u=new Array(v=o.tween.length),p=0,b=-1;p<v;++p)(N=o.tween[p].value.call(n,n.__data__,o.index,o.group))&&(u[++b]=N);u.length=b+1}}function g(m){for(var p=m<o.duration?o.ease.call(null,m/o.duration):(o.timer.restart(x),o.state=qd,1),b=-1,v=u.length;++b<v;)u[b].call(n,p);o.state===qd&&(o.on.call("end",n,n.__data__,o.index,o.group),x())}function x(){o.state=Mi,o.timer.stop(),delete i[r];for(var m in i)return;delete n.__transition}}function Ai(n,r){var o=n.__transition,i,u,f=!0,h;if(o){r=r==null?null:r+"";for(h in o){if((i=o[h]).name!==r){f=!1;continue}u=i.state>Bd&&i.state<qd,i.state=Mi,i.timer.stop(),i.on.call(u?"interrupt":"cancel",n,n.__data__,i.index,i.group),delete o[h]}f&&delete n.__transition}}function ow(n){return this.each(function(){Ai(this,n)})}function iw(n,r){var o,i;return function(){var u=On(this,n),f=u.tween;if(f!==o){i=o=f;for(var h=0,g=i.length;h<g;++h)if(i[h].name===r){i=i.slice(),i.splice(h,1);break}}u.tween=i}}function cw(n,r,o){var i,u;if(typeof o!="function")throw new Error;return function(){var f=On(this,n),h=f.tween;if(h!==i){u=(i=h).slice();for(var g={name:r,value:o},x=0,m=u.length;x<m;++x)if(u[x].name===r){u[x]=g;break}x===m&&u.push(g)}f.tween=u}}function uw(n,r){var o=this._id;if(n+="",arguments.length<2){for(var i=kn(this.node(),o).tween,u=0,f=i.length,h;u<f;++u)if((h=i[u]).name===n)return h.value;return null}return this.each((r==null?iw:cw)(o,n,r))}function rf(n,r,o){var i=n._id;return n.each(function(){var u=On(this,i);(u.value||(u.value={}))[r]=o.apply(this,arguments)}),function(u){return kn(u,i).value[r]}}function hg(n,r){var o;return(typeof r=="number"?Da:r instanceof $r?zx:(o=$r(r))?(r=o,zx):XN)(n,r)}function dw(n){return function(){this.removeAttribute(n)}}function fw(n){return function(){this.removeAttributeNS(n.space,n.local)}}function hw(n,r,o){var i,u=o+"",f;return function(){var h=this.getAttribute(n);return h===u?null:h===i?f:f=r(i=h,o)}}function mw(n,r,o){var i,u=o+"",f;return function(){var h=this.getAttributeNS(n.space,n.local);return h===u?null:h===i?f:f=r(i=h,o)}}function pw(n,r,o){var i,u,f;return function(){var h,g=o(this),x;return g==null?void this.removeAttribute(n):(h=this.getAttribute(n),x=g+"",h===x?null:h===i&&x===u?f:(u=x,f=r(i=h,g)))}}function xw(n,r,o){var i,u,f;return function(){var h,g=o(this),x;return g==null?void this.removeAttributeNS(n.space,n.local):(h=this.getAttributeNS(n.space,n.local),x=g+"",h===x?null:h===i&&x===u?f:(u=x,f=r(i=h,g)))}}function gw(n,r){var o=Xi(n),i=o==="transform"?KN:hg;return this.attrTween(n,typeof r=="function"?(o.local?xw:pw)(o,i,rf(this,"attr."+n,r)):r==null?(o.local?fw:dw)(o):(o.local?mw:hw)(o,i,r))}function yw(n,r){return function(o){this.setAttribute(n,r.call(this,o))}}function bw(n,r){return function(o){this.setAttributeNS(n.space,n.local,r.call(this,o))}}function vw(n,r){var o,i;function u(){var f=r.apply(this,arguments);return f!==i&&(o=(i=f)&&bw(n,f)),o}return u._value=r,u}function jw(n,r){var o,i;function u(){var f=r.apply(this,arguments);return f!==i&&(o=(i=f)&&yw(n,f)),o}return u._value=r,u}function Nw(n,r){var o="attr."+n;if(arguments.length<2)return(o=this.tween(o))&&o._value;if(r==null)return this.tween(o,null);if(typeof r!="function")throw new Error;var i=Xi(n);return this.tween(o,(i.local?vw:jw)(i,r))}function ww(n,r){return function(){lf(this,n).delay=+r.apply(this,arguments)}}function Sw(n,r){return r=+r,function(){lf(this,n).delay=r}}function Ew(n){var r=this._id;return arguments.length?this.each((typeof n=="function"?ww:Sw)(r,n)):kn(this.node(),r).delay}function kw(n,r){return function(){On(this,n).duration=+r.apply(this,arguments)}}function _w(n,r){return r=+r,function(){On(this,n).duration=r}}function Cw(n){var r=this._id;return arguments.length?this.each((typeof n=="function"?kw:_w)(r,n)):kn(this.node(),r).duration}function Tw(n,r){if(typeof r!="function")throw new Error;return function(){On(this,n).ease=r}}function Mw(n){var r=this._id;return arguments.length?this.each(Tw(r,n)):kn(this.node(),r).ease}function Aw(n,r){return function(){var o=r.apply(this,arguments);if(typeof o!="function")throw new Error;On(this,n).ease=o}}function Rw(n){if(typeof n!="function")throw new Error;return this.each(Aw(this._id,n))}function zw(n){typeof n!="function"&&(n=X0(n));for(var r=this._groups,o=r.length,i=new Array(o),u=0;u<o;++u)for(var f=r[u],h=f.length,g=i[u]=[],x,m=0;m<h;++m)(x=f[m])&&n.call(x,x.__data__,m,f)&&g.push(x);return new aa(i,this._parents,this._name,this._id)}function Ow(n){if(n._id!==this._id)throw new Error;for(var r=this._groups,o=n._groups,i=r.length,u=o.length,f=Math.min(i,u),h=new Array(i),g=0;g<f;++g)for(var x=r[g],m=o[g],p=x.length,b=h[g]=new Array(p),v,N=0;N<p;++N)(v=x[N]||m[N])&&(b[N]=v);for(;g<i;++g)h[g]=r[g];return new aa(h,this._parents,this._name,this._id)}function Dw(n){return(n+"").trim().split(/^|\s+/).every(function(r){var o=r.indexOf(".");return o>=0&&(r=r.slice(0,o)),!r||r==="start"})}function Hw(n,r,o){var i,u,f=Dw(r)?lf:On;return function(){var h=f(this,n),g=h.on;g!==i&&(u=(i=g).copy()).on(r,o),h.on=u}}function $w(n,r){var o=this._id;return arguments.length<2?kn(this.node(),o).on.on(n):this.each(Hw(o,n,r))}function Uw(n){return function(){var r=this.parentNode;for(var o in this.__transition)if(+o!==n)return;r&&r.removeChild(this)}}function Bw(){return this.on("end.remove",Uw(this._id))}function qw(n){var r=this._name,o=this._id;typeof n!="function"&&(n=tf(n));for(var i=this._groups,u=i.length,f=new Array(u),h=0;h<u;++h)for(var g=i[h],x=g.length,m=f[h]=new Array(x),p,b,v=0;v<x;++v)(p=g[v])&&(b=n.call(p,p.__data__,v,g))&&("__data__"in p&&(b.__data__=p.__data__),m[v]=b,Wi(m[v],r,o,v,m,kn(p,o)));return new aa(f,this._parents,r,o)}function Lw(n){var r=this._name,o=this._id;typeof n!="function"&&(n=G0(n));for(var i=this._groups,u=i.length,f=[],h=[],g=0;g<u;++g)for(var x=i[g],m=x.length,p,b=0;b<m;++b)if(p=x[b]){for(var v=n.call(p,p.__data__,b,x),N,C=kn(p,o),k=0,R=v.length;k<R;++k)(N=v[k])&&Wi(N,r,o,k,v,C);f.push(v),h.push(p)}return new aa(f,h,r,o)}var Yw=Xr.prototype.constructor;function Vw(){return new Yw(this._groups,this._parents)}function Gw(n,r){var o,i,u;return function(){var f=xl(this,n),h=(this.style.removeProperty(n),xl(this,n));return f===h?null:f===o&&h===i?u:u=r(o=f,i=h)}}function mg(n){return function(){this.style.removeProperty(n)}}function Xw(n,r,o){var i,u=o+"",f;return function(){var h=xl(this,n);return h===u?null:h===i?f:f=r(i=h,o)}}function Zw(n,r,o){var i,u,f;return function(){var h=xl(this,n),g=o(this),x=g+"";return g==null&&(x=g=(this.style.removeProperty(n),xl(this,n))),h===x?null:h===i&&x===u?f:(u=x,f=r(i=h,g))}}function Ww(n,r){var o,i,u,f="style."+r,h="end."+f,g;return function(){var x=On(this,n),m=x.on,p=x.value[f]==null?g||(g=mg(r)):void 0;(m!==o||u!==p)&&(i=(o=m).copy()).on(h,u=p),x.on=i}}function Qw(n,r,o){var i=(n+="")=="transform"?QN:hg;return r==null?this.styleTween(n,Gw(n,i)).on("end.style."+n,mg(n)):typeof r=="function"?this.styleTween(n,Zw(n,i,rf(this,"style."+n,r))).each(Ww(this._id,n)):this.styleTween(n,Xw(n,i,r),o).on("end.style."+n,null)}function Kw(n,r,o){return function(i){this.style.setProperty(n,r.call(this,i),o)}}function Jw(n,r,o){var i,u;function f(){var h=r.apply(this,arguments);return h!==u&&(i=(u=h)&&Kw(n,h,o)),i}return f._value=r,f}function Iw(n,r,o){var i="style."+(n+="");if(arguments.length<2)return(i=this.tween(i))&&i._value;if(r==null)return this.tween(i,null);if(typeof r!="function")throw new Error;return this.tween(i,Jw(n,r,o??""))}function Fw(n){return function(){this.textContent=n}}function Pw(n){return function(){var r=n(this);this.textContent=r??""}}function e5(n){return this.tween("text",typeof n=="function"?Pw(rf(this,"text",n)):Fw(n==null?"":n+""))}function t5(n){return function(r){this.textContent=n.call(this,r)}}function n5(n){var r,o;function i(){var u=n.apply(this,arguments);return u!==o&&(r=(o=u)&&t5(u)),r}return i._value=n,i}function a5(n){var r="text";if(arguments.length<1)return(r=this.tween(r))&&r._value;if(n==null)return this.tween(r,null);if(typeof n!="function")throw new Error;return this.tween(r,n5(n))}function s5(){for(var n=this._name,r=this._id,o=pg(),i=this._groups,u=i.length,f=0;f<u;++f)for(var h=i[f],g=h.length,x,m=0;m<g;++m)if(x=h[m]){var p=kn(x,r);Wi(x,n,o,m,h,{time:p.time+p.delay+p.duration,delay:0,duration:p.duration,ease:p.ease})}return new aa(i,this._parents,n,o)}function l5(){var n,r,o=this,i=o._id,u=o.size();return new Promise(function(f,h){var g={value:h},x={value:function(){--u===0&&f()}};o.each(function(){var m=On(this,i),p=m.on;p!==n&&(r=(n=p).copy(),r._.cancel.push(g),r._.interrupt.push(g),r._.end.push(x)),m.on=r}),u===0&&f()})}var r5=0;function aa(n,r,o,i){this._groups=n,this._parents=r,this._name=o,this._id=i}function pg(){return++r5}var Fn=Xr.prototype;aa.prototype={constructor:aa,select:qw,selectAll:Lw,selectChild:Fn.selectChild,selectChildren:Fn.selectChildren,filter:zw,merge:Ow,selection:Vw,transition:s5,call:Fn.call,nodes:Fn.nodes,node:Fn.node,size:Fn.size,empty:Fn.empty,each:Fn.each,on:$w,attr:gw,attrTween:Nw,style:Qw,styleTween:Iw,text:e5,textTween:a5,remove:Bw,tween:uw,delay:Ew,duration:Cw,ease:Mw,easeVarying:Rw,end:l5,[Symbol.iterator]:Fn[Symbol.iterator]};function o5(n){return((n*=2)<=1?n*n*n:(n-=2)*n*n+2)/2}var i5={time:null,delay:0,duration:250,ease:o5};function c5(n,r){for(var o;!(o=n.__transition)||!(o=o[r]);)if(!(n=n.parentNode))throw new Error(`transition ${r} not found`);return o}function u5(n){var r,o;n instanceof aa?(r=n._id,n=n._name):(r=pg(),(o=i5).time=sf(),n=n==null?null:n+"");for(var i=this._groups,u=i.length,f=0;f<u;++f)for(var h=i[f],g=h.length,x,m=0;m<g;++m)(x=h[m])&&Wi(x,n,r,m,h,o||c5(x,r));return new aa(i,this._parents,n,r)}Xr.prototype.interrupt=ow;Xr.prototype.transition=u5;const yi=n=>()=>n;function d5(n,{sourceEvent:r,target:o,transform:i,dispatch:u}){Object.defineProperties(this,{type:{value:n,enumerable:!0,configurable:!0},sourceEvent:{value:r,enumerable:!0,configurable:!0},target:{value:o,enumerable:!0,configurable:!0},transform:{value:i,enumerable:!0,configurable:!0},_:{value:u}})}function Pn(n,r,o){this.k=n,this.x=r,this.y=o}Pn.prototype={constructor:Pn,scale:function(n){return n===1?this:new Pn(this.k*n,this.x,this.y)},translate:function(n,r){return n===0&r===0?this:new Pn(this.k,this.x+this.k*n,this.y+this.k*r)},apply:function(n){return[n[0]*this.k+this.x,n[1]*this.k+this.y]},applyX:function(n){return n*this.k+this.x},applyY:function(n){return n*this.k+this.y},invert:function(n){return[(n[0]-this.x)/this.k,(n[1]-this.y)/this.k]},invertX:function(n){return(n-this.x)/this.k},invertY:function(n){return(n-this.y)/this.k},rescaleX:function(n){return n.copy().domain(n.range().map(this.invertX,this).map(n.invert,n))},rescaleY:function(n){return n.copy().domain(n.range().map(this.invertY,this).map(n.invert,n))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var ta=new Pn(1,0,0);Pn.prototype;function jd(n){n.stopImmediatePropagation()}function Sr(n){n.preventDefault(),n.stopImmediatePropagation()}function f5(n){return(!n.ctrlKey||n.type==="wheel")&&!n.button}function h5(){var n=this;return n instanceof SVGElement?(n=n.ownerSVGElement||n,n.hasAttribute("viewBox")?(n=n.viewBox.baseVal,[[n.x,n.y],[n.x+n.width,n.y+n.height]]):[[0,0],[n.width.baseVal.value,n.height.baseVal.value]]):[[0,0],[n.clientWidth,n.clientHeight]]}function qx(){return this.__zoom||ta}function m5(n){return-n.deltaY*(n.deltaMode===1?.05:n.deltaMode?1:.002)*(n.ctrlKey?10:1)}function p5(){return navigator.maxTouchPoints||"ontouchstart"in this}function x5(n,r,o){var i=n.invertX(r[0][0])-o[0][0],u=n.invertX(r[1][0])-o[1][0],f=n.invertY(r[0][1])-o[0][1],h=n.invertY(r[1][1])-o[1][1];return n.translate(u>i?(i+u)/2:Math.min(0,i)||Math.max(0,u),h>f?(f+h)/2:Math.min(0,f)||Math.max(0,h))}function xg(){var n=f5,r=h5,o=x5,i=m5,u=p5,f=[0,1/0],h=[[-1/0,-1/0],[1/0,1/0]],g=250,x=PN,m=Gi("start","zoom","end"),p,b,v,N=500,C=150,k=0,R=10;function z(_){_.property("__zoom",qx).on("wheel.zoom",oe,{passive:!1}).on("mousedown.zoom",I).on("dblclick.zoom",K).filter(u).on("touchstart.zoom",ae).on("touchmove.zoom",te).on("touchend.zoom touchcancel.zoom",se).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}z.transform=function(_,W,E,$){var T=_.selection?_.selection():_;T.property("__zoom",qx),_!==T?H(_,W,E,$):T.interrupt().each(function(){Z(this,arguments).event($).start().zoom(null,typeof W=="function"?W.apply(this,arguments):W).end()})},z.scaleBy=function(_,W,E,$){z.scaleTo(_,function(){var T=this.__zoom.k,A=typeof W=="function"?W.apply(this,arguments):W;return T*A},E,$)},z.scaleTo=function(_,W,E,$){z.transform(_,function(){var T=r.apply(this,arguments),A=this.__zoom,S=E==null?M(T):typeof E=="function"?E.apply(this,arguments):E,D=A.invert(S),L=typeof W=="function"?W.apply(this,arguments):W;return o(q(V(A,L),S,D),T,h)},E,$)},z.translateBy=function(_,W,E,$){z.transform(_,function(){return o(this.__zoom.translate(typeof W=="function"?W.apply(this,arguments):W,typeof E=="function"?E.apply(this,arguments):E),r.apply(this,arguments),h)},null,$)},z.translateTo=function(_,W,E,$,T){z.transform(_,function(){var A=r.apply(this,arguments),S=this.__zoom,D=$==null?M(A):typeof $=="function"?$.apply(this,arguments):$;return o(ta.translate(D[0],D[1]).scale(S.k).translate(typeof W=="function"?-W.apply(this,arguments):-W,typeof E=="function"?-E.apply(this,arguments):-E),A,h)},$,T)};function V(_,W){return W=Math.max(f[0],Math.min(f[1],W)),W===_.k?_:new Pn(W,_.x,_.y)}function q(_,W,E){var $=W[0]-E[0]*_.k,T=W[1]-E[1]*_.k;return $===_.x&&T===_.y?_:new Pn(_.k,$,T)}function M(_){return[(+_[0][0]+ +_[1][0])/2,(+_[0][1]+ +_[1][1])/2]}function H(_,W,E,$){_.on("start.zoom",function(){Z(this,arguments).event($).start()}).on("interrupt.zoom end.zoom",function(){Z(this,arguments).event($).end()}).tween("zoom",function(){var T=this,A=arguments,S=Z(T,A).event($),D=r.apply(T,A),L=E==null?M(D):typeof E=="function"?E.apply(T,A):E,F=Math.max(D[1][0]-D[0][0],D[1][1]-D[0][1]),ie=T.__zoom,he=typeof W=="function"?W.apply(T,A):W,me=x(ie.invert(L).concat(F/ie.k),he.invert(L).concat(F/he.k));return function(Se){if(Se===1)Se=he;else{var ve=me(Se),Ae=F/ve[2];Se=new Pn(Ae,L[0]-ve[0]*Ae,L[1]-ve[1]*Ae)}S.zoom(null,Se)}})}function Z(_,W,E){return!E&&_.__zooming||new X(_,W)}function X(_,W){this.that=_,this.args=W,this.active=0,this.sourceEvent=null,this.extent=r.apply(_,W),this.taps=0}X.prototype={event:function(_){return _&&(this.sourceEvent=_),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(_,W){return this.mouse&&_!=="mouse"&&(this.mouse[1]=W.invert(this.mouse[0])),this.touch0&&_!=="touch"&&(this.touch0[1]=W.invert(this.touch0[0])),this.touch1&&_!=="touch"&&(this.touch1[1]=W.invert(this.touch1[0])),this.that.__zoom=W,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(_){var W=yn(this.that).datum();m.call(_,this.that,new d5(_,{sourceEvent:this.sourceEvent,target:z,transform:this.that.__zoom,dispatch:m}),W)}};function oe(_,...W){if(!n.apply(this,arguments))return;var E=Z(this,W).event(_),$=this.__zoom,T=Math.max(f[0],Math.min(f[1],$.k*Math.pow(2,i.apply(this,arguments)))),A=Sn(_);if(E.wheel)(E.mouse[0][0]!==A[0]||E.mouse[0][1]!==A[1])&&(E.mouse[1]=$.invert(E.mouse[0]=A)),clearTimeout(E.wheel);else{if($.k===T)return;E.mouse=[A,$.invert(A)],Ai(this),E.start()}Sr(_),E.wheel=setTimeout(S,C),E.zoom("mouse",o(q(V($,T),E.mouse[0],E.mouse[1]),E.extent,h));function S(){E.wheel=null,E.end()}}function I(_,...W){if(v||!n.apply(this,arguments))return;var E=_.currentTarget,$=Z(this,W,!0).event(_),T=yn(_.view).on("mousemove.zoom",L,!0).on("mouseup.zoom",F,!0),A=Sn(_,E),S=_.clientX,D=_.clientY;tg(_.view),jd(_),$.mouse=[A,this.__zoom.invert(A)],Ai(this),$.start();function L(ie){if(Sr(ie),!$.moved){var he=ie.clientX-S,me=ie.clientY-D;$.moved=he*he+me*me>k}$.event(ie).zoom("mouse",o(q($.that.__zoom,$.mouse[0]=Sn(ie,E),$.mouse[1]),$.extent,h))}function F(ie){T.on("mousemove.zoom mouseup.zoom",null),ng(ie.view,$.moved),Sr(ie),$.event(ie).end()}}function K(_,...W){if(n.apply(this,arguments)){var E=this.__zoom,$=Sn(_.changedTouches?_.changedTouches[0]:_,this),T=E.invert($),A=E.k*(_.shiftKey?.5:2),S=o(q(V(E,A),$,T),r.apply(this,W),h);Sr(_),g>0?yn(this).transition().duration(g).call(H,S,$,_):yn(this).call(z.transform,S,$,_)}}function ae(_,...W){if(n.apply(this,arguments)){var E=_.touches,$=E.length,T=Z(this,W,_.changedTouches.length===$).event(_),A,S,D,L;for(jd(_),S=0;S<$;++S)D=E[S],L=Sn(D,this),L=[L,this.__zoom.invert(L),D.identifier],T.touch0?!T.touch1&&T.touch0[2]!==L[2]&&(T.touch1=L,T.taps=0):(T.touch0=L,A=!0,T.taps=1+!!p);p&&(p=clearTimeout(p)),A&&(T.taps<2&&(b=L[0],p=setTimeout(function(){p=null},N)),Ai(this),T.start())}}function te(_,...W){if(this.__zooming){var E=Z(this,W).event(_),$=_.changedTouches,T=$.length,A,S,D,L;for(Sr(_),A=0;A<T;++A)S=$[A],D=Sn(S,this),E.touch0&&E.touch0[2]===S.identifier?E.touch0[0]=D:E.touch1&&E.touch1[2]===S.identifier&&(E.touch1[0]=D);if(S=E.that.__zoom,E.touch1){var F=E.touch0[0],ie=E.touch0[1],he=E.touch1[0],me=E.touch1[1],Se=(Se=he[0]-F[0])*Se+(Se=he[1]-F[1])*Se,ve=(ve=me[0]-ie[0])*ve+(ve=me[1]-ie[1])*ve;S=V(S,Math.sqrt(Se/ve)),D=[(F[0]+he[0])/2,(F[1]+he[1])/2],L=[(ie[0]+me[0])/2,(ie[1]+me[1])/2]}else if(E.touch0)D=E.touch0[0],L=E.touch0[1];else return;E.zoom("touch",o(q(S,D,L),E.extent,h))}}function se(_,...W){if(this.__zooming){var E=Z(this,W).event(_),$=_.changedTouches,T=$.length,A,S;for(jd(_),v&&clearTimeout(v),v=setTimeout(function(){v=null},N),A=0;A<T;++A)S=$[A],E.touch0&&E.touch0[2]===S.identifier?delete E.touch0:E.touch1&&E.touch1[2]===S.identifier&&delete E.touch1;if(E.touch1&&!E.touch0&&(E.touch0=E.touch1,delete E.touch1),E.touch0)E.touch0[1]=this.__zoom.invert(E.touch0[0]);else if(E.end(),E.taps===2&&(S=Sn(S,this),Math.hypot(b[0]-S[0],b[1]-S[1])<R)){var D=yn(this).on("dblclick.zoom");D&&D.apply(this,arguments)}}}return z.wheelDelta=function(_){return arguments.length?(i=typeof _=="function"?_:yi(+_),z):i},z.filter=function(_){return arguments.length?(n=typeof _=="function"?_:yi(!!_),z):n},z.touchable=function(_){return arguments.length?(u=typeof _=="function"?_:yi(!!_),z):u},z.extent=function(_){return arguments.length?(r=typeof _=="function"?_:yi([[+_[0][0],+_[0][1]],[+_[1][0],+_[1][1]]]),z):r},z.scaleExtent=function(_){return arguments.length?(f[0]=+_[0],f[1]=+_[1],z):[f[0],f[1]]},z.translateExtent=function(_){return arguments.length?(h[0][0]=+_[0][0],h[1][0]=+_[1][0],h[0][1]=+_[0][1],h[1][1]=+_[1][1],z):[[h[0][0],h[0][1]],[h[1][0],h[1][1]]]},z.constrain=function(_){return arguments.length?(o=_,z):o},z.duration=function(_){return arguments.length?(g=+_,z):g},z.interpolate=function(_){return arguments.length?(x=_,z):x},z.on=function(){var _=m.on.apply(m,arguments);return _===m?z:_},z.clickDistance=function(_){return arguments.length?(k=(_=+_)*_,z):Math.sqrt(k)},z.tapDistance=function(_){return arguments.length?(R=+_,z):R},z}E0();const Qi=j.createContext(null),g5=Qi.Provider,sa={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:n=>`Node type "${n}" 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:n=>`The old edge with id=${n} does not exist.`,error009:n=>`Marker type "${n}" doesn't exist.`,error008:(n,r)=>`Couldn't create edge for ${n?"target":"source"} handle id: "${n?r.targetHandle:r.sourceHandle}", edge id: ${r.id}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:n=>`Edge type "${n}" not found. Using fallback type "default".`,error012:n=>`Node with id "${n}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`},gg=sa.error001();function tt(n,r){const o=j.useContext(Qi);if(o===null)throw new Error(gg);return Y0(o,n,r)}const wt=()=>{const n=j.useContext(Qi);if(n===null)throw new Error(gg);return j.useMemo(()=>({getState:n.getState,setState:n.setState,subscribe:n.subscribe,destroy:n.destroy}),[n])},y5=n=>n.userSelectionActive?"none":"all";function of({position:n,children:r,className:o,style:i,...u}){const f=tt(y5),h=`${n}`.split("-");return le.createElement("div",{className:Ut(["react-flow__panel",o,...h]),style:{...i,pointerEvents:f},...u},r)}function b5({proOptions:n,position:r="bottom-right"}){return n?.hideAttribution?null:le.createElement(of,{position:r,className:"react-flow__attribution","data-message":"Please only hide this attribution when you are subscribed to React Flow Pro: https://reactflow.dev/pro"},le.createElement("a",{href:"https://reactflow.dev",target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution"},"React Flow"))}const v5=({x:n,y:r,label:o,labelStyle:i={},labelShowBg:u=!0,labelBgStyle:f={},labelBgPadding:h=[2,4],labelBgBorderRadius:g=2,children:x,className:m,...p})=>{const b=j.useRef(null),[v,N]=j.useState({x:0,y:0,width:0,height:0}),C=Ut(["react-flow__edge-textwrapper",m]);return j.useEffect(()=>{if(b.current){const k=b.current.getBBox();N({x:k.x,y:k.y,width:k.width,height:k.height})}},[o]),typeof o>"u"||!o?null:le.createElement("g",{transform:`translate(${n-v.width/2} ${r-v.height/2})`,className:C,visibility:v.width?"visible":"hidden",...p},u&&le.createElement("rect",{width:v.width+2*h[0],x:-h[0],y:-h[1],height:v.height+2*h[1],className:"react-flow__edge-textbg",style:f,rx:g,ry:g}),le.createElement("text",{className:"react-flow__edge-text",y:v.height/2,dy:"0.3em",ref:b,style:i},o),x)};var j5=j.memo(v5);const cf=n=>({width:n.offsetWidth,height:n.offsetHeight}),yl=(n,r=0,o=1)=>Math.min(Math.max(n,r),o),uf=(n={x:0,y:0},r)=>({x:yl(n.x,r[0][0],r[1][0]),y:yl(n.y,r[0][1],r[1][1])}),Lx=(n,r,o)=>n<r?yl(Math.abs(n-r),1,50)/50:n>o?-yl(Math.abs(n-o),1,50)/50:0,yg=(n,r)=>{const o=Lx(n.x,35,r.width-35)*20,i=Lx(n.y,35,r.height-35)*20;return[o,i]},bg=n=>n.getRootNode?.()||window?.document,vg=(n,r)=>({x:Math.min(n.x,r.x),y:Math.min(n.y,r.y),x2:Math.max(n.x2,r.x2),y2:Math.max(n.y2,r.y2)}),Br=({x:n,y:r,width:o,height:i})=>({x:n,y:r,x2:n+o,y2:r+i}),jg=({x:n,y:r,x2:o,y2:i})=>({x:n,y:r,width:o-n,height:i-r}),Yx=n=>({...n.positionAbsolute||{x:0,y:0},width:n.width||0,height:n.height||0}),N5=(n,r)=>jg(vg(Br(n),Br(r))),Ld=(n,r)=>{const o=Math.max(0,Math.min(n.x+n.width,r.x+r.width)-Math.max(n.x,r.x)),i=Math.max(0,Math.min(n.y+n.height,r.y+r.height)-Math.max(n.y,r.y));return Math.ceil(o*i)},w5=n=>bn(n.width)&&bn(n.height)&&bn(n.x)&&bn(n.y),bn=n=>!isNaN(n)&&isFinite(n),ct=Symbol.for("internals"),Ng=["Enter"," ","Escape"],S5=(n,r)=>{},E5=n=>"nativeEvent"in n;function Yd(n){const o=(E5(n)?n.nativeEvent:n).composedPath?.()?.[0]||n.target;return["INPUT","SELECT","TEXTAREA"].includes(o?.nodeName)||o?.hasAttribute("contenteditable")||!!o?.closest(".nokey")}const wg=n=>"clientX"in n,Ua=(n,r)=>{const o=wg(n),i=o?n.clientX:n.touches?.[0].clientX,u=o?n.clientY:n.touches?.[0].clientY;return{x:i-(r?.left??0),y:u-(r?.top??0)}},qi=()=>typeof navigator<"u"&&navigator?.userAgent?.indexOf("Mac")>=0,Wr=({id:n,path:r,labelX:o,labelY:i,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:m,style:p,markerEnd:b,markerStart:v,interactionWidth:N=20})=>le.createElement(le.Fragment,null,le.createElement("path",{id:n,style:p,d:r,fill:"none",className:"react-flow__edge-path",markerEnd:b,markerStart:v}),N&&le.createElement("path",{d:r,fill:"none",strokeOpacity:0,strokeWidth:N,className:"react-flow__edge-interaction"}),u&&bn(o)&&bn(i)?le.createElement(j5,{x:o,y:i,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:m}):null);Wr.displayName="BaseEdge";function Er(n,r,o){return o===void 0?o:i=>{const u=r().edges.find(f=>f.id===n);u&&o(i,{...u})}}function Sg({sourceX:n,sourceY:r,targetX:o,targetY:i}){const u=Math.abs(o-n)/2,f=o<n?o+u:o-u,h=Math.abs(i-r)/2,g=i<r?i+h:i-h;return[f,g,u,h]}function Eg({sourceX:n,sourceY:r,targetX:o,targetY:i,sourceControlX:u,sourceControlY:f,targetControlX:h,targetControlY:g}){const x=n*.125+u*.375+h*.375+o*.125,m=r*.125+f*.375+g*.375+i*.125,p=Math.abs(x-n),b=Math.abs(m-r);return[x,m,p,b]}var ps;(function(n){n.Strict="strict",n.Loose="loose"})(ps||(ps={}));var us;(function(n){n.Free="free",n.Vertical="vertical",n.Horizontal="horizontal"})(us||(us={}));var qr;(function(n){n.Partial="partial",n.Full="full"})(qr||(qr={}));var $a;(function(n){n.Bezier="default",n.Straight="straight",n.Step="step",n.SmoothStep="smoothstep",n.SimpleBezier="simplebezier"})($a||($a={}));var Ba;(function(n){n.Arrow="arrow",n.ArrowClosed="arrowclosed"})(Ba||(Ba={}));var xe;(function(n){n.Left="left",n.Top="top",n.Right="right",n.Bottom="bottom"})(xe||(xe={}));function Vx({pos:n,x1:r,y1:o,x2:i,y2:u}){return n===xe.Left||n===xe.Right?[.5*(r+i),o]:[r,.5*(o+u)]}function kg({sourceX:n,sourceY:r,sourcePosition:o=xe.Bottom,targetX:i,targetY:u,targetPosition:f=xe.Top}){const[h,g]=Vx({pos:o,x1:n,y1:r,x2:i,y2:u}),[x,m]=Vx({pos:f,x1:i,y1:u,x2:n,y2:r}),[p,b,v,N]=Eg({sourceX:n,sourceY:r,targetX:i,targetY:u,sourceControlX:h,sourceControlY:g,targetControlX:x,targetControlY:m});return[`M${n},${r} C${h},${g} ${x},${m} ${i},${u}`,p,b,v,N]}const df=j.memo(({sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:u=xe.Bottom,targetPosition:f=xe.Top,label:h,labelStyle:g,labelShowBg:x,labelBgStyle:m,labelBgPadding:p,labelBgBorderRadius:b,style:v,markerEnd:N,markerStart:C,interactionWidth:k})=>{const[R,z,V]=kg({sourceX:n,sourceY:r,sourcePosition:u,targetX:o,targetY:i,targetPosition:f});return le.createElement(Wr,{path:R,labelX:z,labelY:V,label:h,labelStyle:g,labelShowBg:x,labelBgStyle:m,labelBgPadding:p,labelBgBorderRadius:b,style:v,markerEnd:N,markerStart:C,interactionWidth:k})});df.displayName="SimpleBezierEdge";const Gx={[xe.Left]:{x:-1,y:0},[xe.Right]:{x:1,y:0},[xe.Top]:{x:0,y:-1},[xe.Bottom]:{x:0,y:1}},k5=({source:n,sourcePosition:r=xe.Bottom,target:o})=>r===xe.Left||r===xe.Right?n.x<o.x?{x:1,y:0}:{x:-1,y:0}:n.y<o.y?{x:0,y:1}:{x:0,y:-1},Xx=(n,r)=>Math.sqrt(Math.pow(r.x-n.x,2)+Math.pow(r.y-n.y,2));function _5({source:n,sourcePosition:r=xe.Bottom,target:o,targetPosition:i=xe.Top,center:u,offset:f}){const h=Gx[r],g=Gx[i],x={x:n.x+h.x*f,y:n.y+h.y*f},m={x:o.x+g.x*f,y:o.y+g.y*f},p=k5({source:x,sourcePosition:r,target:m}),b=p.x!==0?"x":"y",v=p[b];let N=[],C,k;const R={x:0,y:0},z={x:0,y:0},[V,q,M,H]=Sg({sourceX:n.x,sourceY:n.y,targetX:o.x,targetY:o.y});if(h[b]*g[b]===-1){C=u.x??V,k=u.y??q;const X=[{x:C,y:x.y},{x:C,y:m.y}],oe=[{x:x.x,y:k},{x:m.x,y:k}];h[b]===v?N=b==="x"?X:oe:N=b==="x"?oe:X}else{const X=[{x:x.x,y:m.y}],oe=[{x:m.x,y:x.y}];if(b==="x"?N=h.x===v?oe:X:N=h.y===v?X:oe,r===i){const se=Math.abs(n[b]-o[b]);if(se<=f){const _=Math.min(f-1,f-se);h[b]===v?R[b]=(x[b]>n[b]?-1:1)*_:z[b]=(m[b]>o[b]?-1:1)*_}}if(r!==i){const se=b==="x"?"y":"x",_=h[b]===g[se],W=x[se]>m[se],E=x[se]<m[se];(h[b]===1&&(!_&&W||_&&E)||h[b]!==1&&(!_&&E||_&&W))&&(N=b==="x"?X:oe)}const I={x:x.x+R.x,y:x.y+R.y},K={x:m.x+z.x,y:m.y+z.y},ae=Math.max(Math.abs(I.x-N[0].x),Math.abs(K.x-N[0].x)),te=Math.max(Math.abs(I.y-N[0].y),Math.abs(K.y-N[0].y));ae>=te?(C=(I.x+K.x)/2,k=N[0].y):(C=N[0].x,k=(I.y+K.y)/2)}return[[n,{x:x.x+R.x,y:x.y+R.y},...N,{x:m.x+z.x,y:m.y+z.y},o],C,k,M,H]}function C5(n,r,o,i){const u=Math.min(Xx(n,r)/2,Xx(r,o)/2,i),{x:f,y:h}=r;if(n.x===f&&f===o.x||n.y===h&&h===o.y)return`L${f} ${h}`;if(n.y===h){const m=n.x<o.x?-1:1,p=n.y<o.y?1:-1;return`L ${f+u*m},${h}Q ${f},${h} ${f},${h+u*p}`}const g=n.x<o.x?1:-1,x=n.y<o.y?-1:1;return`L ${f},${h+u*x}Q ${f},${h} ${f+u*g},${h}`}function Vd({sourceX:n,sourceY:r,sourcePosition:o=xe.Bottom,targetX:i,targetY:u,targetPosition:f=xe.Top,borderRadius:h=5,centerX:g,centerY:x,offset:m=20}){const[p,b,v,N,C]=_5({source:{x:n,y:r},sourcePosition:o,target:{x:i,y:u},targetPosition:f,center:{x:g,y:x},offset:m});return[p.reduce((R,z,V)=>{let q="";return V>0&&V<p.length-1?q=C5(p[V-1],z,p[V+1],h):q=`${V===0?"M":"L"}${z.x} ${z.y}`,R+=q,R},""),b,v,N,C]}const Ki=j.memo(({sourceX:n,sourceY:r,targetX:o,targetY:i,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:m,style:p,sourcePosition:b=xe.Bottom,targetPosition:v=xe.Top,markerEnd:N,markerStart:C,pathOptions:k,interactionWidth:R})=>{const[z,V,q]=Vd({sourceX:n,sourceY:r,sourcePosition:b,targetX:o,targetY:i,targetPosition:v,borderRadius:k?.borderRadius,offset:k?.offset});return le.createElement(Wr,{path:z,labelX:V,labelY:q,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:m,style:p,markerEnd:N,markerStart:C,interactionWidth:R})});Ki.displayName="SmoothStepEdge";const ff=j.memo(n=>le.createElement(Ki,{...n,pathOptions:j.useMemo(()=>({borderRadius:0,offset:n.pathOptions?.offset}),[n.pathOptions?.offset])}));ff.displayName="StepEdge";function T5({sourceX:n,sourceY:r,targetX:o,targetY:i}){const[u,f,h,g]=Sg({sourceX:n,sourceY:r,targetX:o,targetY:i});return[`M ${n},${r}L ${o},${i}`,u,f,h,g]}const hf=j.memo(({sourceX:n,sourceY:r,targetX:o,targetY:i,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:m,style:p,markerEnd:b,markerStart:v,interactionWidth:N})=>{const[C,k,R]=T5({sourceX:n,sourceY:r,targetX:o,targetY:i});return le.createElement(Wr,{path:C,labelX:k,labelY:R,label:u,labelStyle:f,labelShowBg:h,labelBgStyle:g,labelBgPadding:x,labelBgBorderRadius:m,style:p,markerEnd:b,markerStart:v,interactionWidth:N})});hf.displayName="StraightEdge";function bi(n,r){return n>=0?.5*n:r*25*Math.sqrt(-n)}function Zx({pos:n,x1:r,y1:o,x2:i,y2:u,c:f}){switch(n){case xe.Left:return[r-bi(r-i,f),o];case xe.Right:return[r+bi(i-r,f),o];case xe.Top:return[r,o-bi(o-u,f)];case xe.Bottom:return[r,o+bi(u-o,f)]}}function _g({sourceX:n,sourceY:r,sourcePosition:o=xe.Bottom,targetX:i,targetY:u,targetPosition:f=xe.Top,curvature:h=.25}){const[g,x]=Zx({pos:o,x1:n,y1:r,x2:i,y2:u,c:h}),[m,p]=Zx({pos:f,x1:i,y1:u,x2:n,y2:r,c:h}),[b,v,N,C]=Eg({sourceX:n,sourceY:r,targetX:i,targetY:u,sourceControlX:g,sourceControlY:x,targetControlX:m,targetControlY:p});return[`M${n},${r} C${g},${x} ${m},${p} ${i},${u}`,b,v,N,C]}const Li=j.memo(({sourceX:n,sourceY:r,targetX:o,targetY:i,sourcePosition:u=xe.Bottom,targetPosition:f=xe.Top,label:h,labelStyle:g,labelShowBg:x,labelBgStyle:m,labelBgPadding:p,labelBgBorderRadius:b,style:v,markerEnd:N,markerStart:C,pathOptions:k,interactionWidth:R})=>{const[z,V,q]=_g({sourceX:n,sourceY:r,sourcePosition:u,targetX:o,targetY:i,targetPosition:f,curvature:k?.curvature});return le.createElement(Wr,{path:z,labelX:V,labelY:q,label:h,labelStyle:g,labelShowBg:x,labelBgStyle:m,labelBgPadding:p,labelBgBorderRadius:b,style:v,markerEnd:N,markerStart:C,interactionWidth:R})});Li.displayName="BezierEdge";const mf=j.createContext(null),M5=mf.Provider;mf.Consumer;const A5=()=>j.useContext(mf),R5=n=>"id"in n&&"source"in n&&"target"in n,z5=({source:n,sourceHandle:r,target:o,targetHandle:i})=>`reactflow__edge-${n}${r||""}-${o}${i||""}`,Gd=(n,r)=>typeof n>"u"?"":typeof n=="string"?n:`${r?`${r}__`:""}${Object.keys(n).sort().map(i=>`${i}=${n[i]}`).join("&")}`,O5=(n,r)=>r.some(o=>o.source===n.source&&o.target===n.target&&(o.sourceHandle===n.sourceHandle||!o.sourceHandle&&!n.sourceHandle)&&(o.targetHandle===n.targetHandle||!o.targetHandle&&!n.targetHandle)),D5=(n,r)=>{if(!n.source||!n.target)return r;let o;return R5(n)?o={...n}:o={...n,id:z5(n)},O5(o,r)?r:r.concat(o)},Xd=({x:n,y:r},[o,i,u],f,[h,g])=>{const x={x:(n-o)/u,y:(r-i)/u};return f?{x:h*Math.round(x.x/h),y:g*Math.round(x.y/g)}:x},Cg=({x:n,y:r},[o,i,u])=>({x:n*u+o,y:r*u+i}),fs=(n,r=[0,0])=>{if(!n)return{x:0,y:0,positionAbsolute:{x:0,y:0}};const o=(n.width??0)*r[0],i=(n.height??0)*r[1],u={x:n.position.x-o,y:n.position.y-i};return{...u,positionAbsolute:n.positionAbsolute?{x:n.positionAbsolute.x-o,y:n.positionAbsolute.y-i}:u}},Ji=(n,r=[0,0])=>{if(n.length===0)return{x:0,y:0,width:0,height:0};const o=n.reduce((i,u)=>{const{x:f,y:h}=fs(u,r).positionAbsolute;return vg(i,Br({x:f,y:h,width:u.width||0,height:u.height||0}))},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return jg(o)},Tg=(n,r,[o,i,u]=[0,0,1],f=!1,h=!1,g=[0,0])=>{const x={x:(r.x-o)/u,y:(r.y-i)/u,width:r.width/u,height:r.height/u},m=[];return n.forEach(p=>{const{width:b,height:v,selectable:N=!0,hidden:C=!1}=p;if(h&&!N||C)return!1;const{positionAbsolute:k}=fs(p,g),R={x:k.x,y:k.y,width:b||0,height:v||0},z=Ld(x,R),V=typeof b>"u"||typeof v>"u"||b===null||v===null,q=f&&z>0,M=(b||0)*(v||0);(V||q||z>=M||p.dragging)&&m.push(p)}),m},Mg=(n,r)=>{const o=n.map(i=>i.id);return r.filter(i=>o.includes(i.source)||o.includes(i.target))},Ag=(n,r,o,i,u,f=.1)=>{const h=r/(n.width*(1+f)),g=o/(n.height*(1+f)),x=Math.min(h,g),m=yl(x,i,u),p=n.x+n.width/2,b=n.y+n.height/2,v=r/2-p*m,N=o/2-b*m;return{x:v,y:N,zoom:m}},is=(n,r=0)=>n.transition().duration(r);function Wx(n,r,o,i){return(r[o]||[]).reduce((u,f)=>(`${n.id}-${f.id}-${o}`!==i&&u.push({id:f.id||null,type:o,nodeId:n.id,x:(n.positionAbsolute?.x??0)+f.x+f.width/2,y:(n.positionAbsolute?.y??0)+f.y+f.height/2}),u),[])}function H5(n,r,o,i,u,f){const{x:h,y:g}=Ua(n),m=r.elementsFromPoint(h,g).find(C=>C.classList.contains("react-flow__handle"));if(m){const C=m.getAttribute("data-nodeid");if(C){const k=pf(void 0,m),R=m.getAttribute("data-handleid"),z=f({nodeId:C,id:R,type:k});if(z){const V=u.find(q=>q.nodeId===C&&q.type===k&&q.id===R);return{handle:{id:R,type:k,nodeId:C,x:V?.x||o.x,y:V?.y||o.y},validHandleResult:z}}}}let p=[],b=1/0;if(u.forEach(C=>{const k=Math.sqrt((C.x-o.x)**2+(C.y-o.y)**2);if(k<=i){const R=f(C);k<=b&&(k<b?p=[{handle:C,validHandleResult:R}]:k===b&&p.push({handle:C,validHandleResult:R}),b=k)}}),!p.length)return{handle:null,validHandleResult:Rg()};if(p.length===1)return p[0];const v=p.some(({validHandleResult:C})=>C.isValid),N=p.some(({handle:C})=>C.type==="target");return p.find(({handle:C,validHandleResult:k})=>N?C.type==="target":v?k.isValid:!0)||p[0]}const $5={source:null,target:null,sourceHandle:null,targetHandle:null},Rg=()=>({handleDomNode:null,isValid:!1,connection:$5,endHandle:null});function zg(n,r,o,i,u,f,h){const g=u==="target",x=h.querySelector(`.react-flow__handle[data-id="${n?.nodeId}-${n?.id}-${n?.type}"]`),m={...Rg(),handleDomNode:x};if(x){const p=pf(void 0,x),b=x.getAttribute("data-nodeid"),v=x.getAttribute("data-handleid"),N=x.classList.contains("connectable"),C=x.classList.contains("connectableend"),k={source:g?b:o,sourceHandle:g?v:i,target:g?o:b,targetHandle:g?i:v};m.connection=k,N&&C&&(r===ps.Strict?g&&p==="source"||!g&&p==="target":b!==o||v!==i)&&(m.endHandle={nodeId:b,handleId:v,type:p},m.isValid=f(k))}return m}function U5({nodes:n,nodeId:r,handleId:o,handleType:i}){return n.reduce((u,f)=>{if(f[ct]){const{handleBounds:h}=f[ct];let g=[],x=[];h&&(g=Wx(f,h,"source",`${r}-${o}-${i}`),x=Wx(f,h,"target",`${r}-${o}-${i}`)),u.push(...g,...x)}return u},[])}function pf(n,r){return n||(r?.classList.contains("target")?"target":r?.classList.contains("source")?"source":null)}function Nd(n){n?.classList.remove("valid","connecting","react-flow__handle-valid","react-flow__handle-connecting")}function B5(n,r){let o=null;return r?o="valid":n&&!r&&(o="invalid"),o}function Og({event:n,handleId:r,nodeId:o,onConnect:i,isTarget:u,getState:f,setState:h,isValidConnection:g,edgeUpdaterType:x,onReconnectEnd:m}){const p=bg(n.target),{connectionMode:b,domNode:v,autoPanOnConnect:N,connectionRadius:C,onConnectStart:k,panBy:R,getNodes:z,cancelConnection:V}=f();let q=0,M;const{x:H,y:Z}=Ua(n),X=p?.elementFromPoint(H,Z),oe=pf(x,X),I=v?.getBoundingClientRect();if(!I||!oe)return;let K,ae=Ua(n,I),te=!1,se=null,_=!1,W=null;const E=U5({nodes:z(),nodeId:o,handleId:r,handleType:oe}),$=()=>{if(!N)return;const[S,D]=yg(ae,I);R({x:S,y:D}),q=requestAnimationFrame($)};h({connectionPosition:ae,connectionStatus:null,connectionNodeId:o,connectionHandleId:r,connectionHandleType:oe,connectionStartHandle:{nodeId:o,handleId:r,type:oe},connectionEndHandle:null}),k?.(n,{nodeId:o,handleId:r,handleType:oe});function T(S){const{transform:D}=f();ae=Ua(S,I);const{handle:L,validHandleResult:F}=H5(S,p,Xd(ae,D,!1,[1,1]),C,E,ie=>zg(ie,b,o,r,u?"target":"source",g,p));if(M=L,te||($(),te=!0),W=F.handleDomNode,se=F.connection,_=F.isValid,h({connectionPosition:M&&_?Cg({x:M.x,y:M.y},D):ae,connectionStatus:B5(!!M,_),connectionEndHandle:F.endHandle}),!M&&!_&&!W)return Nd(K);se.source!==se.target&&W&&(Nd(K),K=W,W.classList.add("connecting","react-flow__handle-connecting"),W.classList.toggle("valid",_),W.classList.toggle("react-flow__handle-valid",_))}function A(S){(M||W)&&se&&_&&i?.(se),f().onConnectEnd?.(S),x&&m?.(S),Nd(K),V(),cancelAnimationFrame(q),te=!1,_=!1,se=null,W=null,p.removeEventListener("mousemove",T),p.removeEventListener("mouseup",A),p.removeEventListener("touchmove",T),p.removeEventListener("touchend",A)}p.addEventListener("mousemove",T),p.addEventListener("mouseup",A),p.addEventListener("touchmove",T),p.addEventListener("touchend",A)}const Qx=()=>!0,q5=n=>({connectionStartHandle:n.connectionStartHandle,connectOnClick:n.connectOnClick,noPanClassName:n.noPanClassName}),L5=(n,r,o)=>i=>{const{connectionStartHandle:u,connectionEndHandle:f,connectionClickStartHandle:h}=i;return{connecting:u?.nodeId===n&&u?.handleId===r&&u?.type===o||f?.nodeId===n&&f?.handleId===r&&f?.type===o,clickConnecting:h?.nodeId===n&&h?.handleId===r&&h?.type===o}},Dg=j.forwardRef(({type:n="source",position:r=xe.Top,isValidConnection:o,isConnectable:i=!0,isConnectableStart:u=!0,isConnectableEnd:f=!0,id:h,onConnect:g,children:x,className:m,onMouseDown:p,onTouchStart:b,...v},N)=>{const C=h||null,k=n==="target",R=wt(),z=A5(),{connectOnClick:V,noPanClassName:q}=tt(q5,Mt),{connecting:M,clickConnecting:H}=tt(L5(z,C,n),Mt);z||R.getState().onError?.("010",sa.error010());const Z=I=>{const{defaultEdgeOptions:K,onConnect:ae,hasDefaultEdges:te}=R.getState(),se={...K,...I};if(te){const{edges:_,setEdges:W}=R.getState();W(D5(se,_))}ae?.(se),g?.(se)},X=I=>{if(!z)return;const K=wg(I);u&&(K&&I.button===0||!K)&&Og({event:I,handleId:C,nodeId:z,onConnect:Z,isTarget:k,getState:R.getState,setState:R.setState,isValidConnection:o||R.getState().isValidConnection||Qx}),K?p?.(I):b?.(I)},oe=I=>{const{onClickConnectStart:K,onClickConnectEnd:ae,connectionClickStartHandle:te,connectionMode:se,isValidConnection:_}=R.getState();if(!z||!te&&!u)return;if(!te){K?.(I,{nodeId:z,handleId:C,handleType:n}),R.setState({connectionClickStartHandle:{nodeId:z,type:n,handleId:C}});return}const W=bg(I.target),E=o||_||Qx,{connection:$,isValid:T}=zg({nodeId:z,id:C,type:n},se,te.nodeId,te.handleId||null,te.type,E,W);T&&Z($),ae?.(I),R.setState({connectionClickStartHandle:null})};return le.createElement("div",{"data-handleid":C,"data-nodeid":z,"data-handlepos":r,"data-id":`${z}-${C}-${n}`,className:Ut(["react-flow__handle",`react-flow__handle-${r}`,"nodrag",q,m,{source:!k,target:k,connectable:i,connectablestart:u,connectableend:f,connecting:H,connectionindicator:i&&(u&&!M||f&&M)}]),onMouseDown:X,onTouchStart:X,onClick:V?oe:void 0,ref:N,...v},x)});Dg.displayName="Handle";var Nt=j.memo(Dg);const Hg=({data:n,isConnectable:r,targetPosition:o=xe.Top,sourcePosition:i=xe.Bottom})=>le.createElement(le.Fragment,null,le.createElement(Nt,{type:"target",position:o,isConnectable:r}),n?.label,le.createElement(Nt,{type:"source",position:i,isConnectable:r}));Hg.displayName="DefaultNode";var Zd=j.memo(Hg);const $g=({data:n,isConnectable:r,sourcePosition:o=xe.Bottom})=>le.createElement(le.Fragment,null,n?.label,le.createElement(Nt,{type:"source",position:o,isConnectable:r}));$g.displayName="InputNode";var Ug=j.memo($g);const Bg=({data:n,isConnectable:r,targetPosition:o=xe.Top})=>le.createElement(le.Fragment,null,le.createElement(Nt,{type:"target",position:o,isConnectable:r}),n?.label);Bg.displayName="OutputNode";var qg=j.memo(Bg);const xf=()=>null;xf.displayName="GroupNode";const Y5=n=>({selectedNodes:n.getNodes().filter(r=>r.selected),selectedEdges:n.edges.filter(r=>r.selected).map(r=>({...r}))}),vi=n=>n.id;function V5(n,r){return Mt(n.selectedNodes.map(vi),r.selectedNodes.map(vi))&&Mt(n.selectedEdges.map(vi),r.selectedEdges.map(vi))}const Lg=j.memo(({onSelectionChange:n})=>{const r=wt(),{selectedNodes:o,selectedEdges:i}=tt(Y5,V5);return j.useEffect(()=>{const u={nodes:o,edges:i};n?.(u),r.getState().onSelectionChange.forEach(f=>f(u))},[o,i,n]),null});Lg.displayName="SelectionListener";const G5=n=>!!n.onSelectionChange;function X5({onSelectionChange:n}){const r=tt(G5);return n||r?le.createElement(Lg,{onSelectionChange:n}):null}const Z5=n=>({setNodes:n.setNodes,setEdges:n.setEdges,setDefaultNodesAndEdges:n.setDefaultNodesAndEdges,setMinZoom:n.setMinZoom,setMaxZoom:n.setMaxZoom,setTranslateExtent:n.setTranslateExtent,setNodeExtent:n.setNodeExtent,reset:n.reset});function tl(n,r){j.useEffect(()=>{typeof n<"u"&&r(n)},[n])}function Ue(n,r,o){j.useEffect(()=>{typeof r<"u"&&o({[n]:r})},[r])}const W5=({nodes:n,edges:r,defaultNodes:o,defaultEdges:i,onConnect:u,onConnectStart:f,onConnectEnd:h,onClickConnectStart:g,onClickConnectEnd:x,nodesDraggable:m,nodesConnectable:p,nodesFocusable:b,edgesFocusable:v,edgesUpdatable:N,elevateNodesOnSelect:C,minZoom:k,maxZoom:R,nodeExtent:z,onNodesChange:V,onEdgesChange:q,elementsSelectable:M,connectionMode:H,snapGrid:Z,snapToGrid:X,translateExtent:oe,connectOnClick:I,defaultEdgeOptions:K,fitView:ae,fitViewOptions:te,onNodesDelete:se,onEdgesDelete:_,onNodeDrag:W,onNodeDragStart:E,onNodeDragStop:$,onSelectionDrag:T,onSelectionDragStart:A,onSelectionDragStop:S,noPanClassName:D,nodeOrigin:L,rfId:F,autoPanOnConnect:ie,autoPanOnNodeDrag:he,onError:me,connectionRadius:Se,isValidConnection:ve,nodeDragThreshold:Ae})=>{const{setNodes:Re,setEdges:We,setDefaultNodesAndEdges:Te,setMinZoom:be,setMaxZoom:B,setTranslateExtent:Y,setNodeExtent:ue,reset:re}=tt(Z5,Mt),ee=wt();return j.useEffect(()=>{const Ee=i?.map(ge=>({...ge,...K}));return Te(o,Ee),()=>{re()}},[]),Ue("defaultEdgeOptions",K,ee.setState),Ue("connectionMode",H,ee.setState),Ue("onConnect",u,ee.setState),Ue("onConnectStart",f,ee.setState),Ue("onConnectEnd",h,ee.setState),Ue("onClickConnectStart",g,ee.setState),Ue("onClickConnectEnd",x,ee.setState),Ue("nodesDraggable",m,ee.setState),Ue("nodesConnectable",p,ee.setState),Ue("nodesFocusable",b,ee.setState),Ue("edgesFocusable",v,ee.setState),Ue("edgesUpdatable",N,ee.setState),Ue("elementsSelectable",M,ee.setState),Ue("elevateNodesOnSelect",C,ee.setState),Ue("snapToGrid",X,ee.setState),Ue("snapGrid",Z,ee.setState),Ue("onNodesChange",V,ee.setState),Ue("onEdgesChange",q,ee.setState),Ue("connectOnClick",I,ee.setState),Ue("fitViewOnInit",ae,ee.setState),Ue("fitViewOnInitOptions",te,ee.setState),Ue("onNodesDelete",se,ee.setState),Ue("onEdgesDelete",_,ee.setState),Ue("onNodeDrag",W,ee.setState),Ue("onNodeDragStart",E,ee.setState),Ue("onNodeDragStop",$,ee.setState),Ue("onSelectionDrag",T,ee.setState),Ue("onSelectionDragStart",A,ee.setState),Ue("onSelectionDragStop",S,ee.setState),Ue("noPanClassName",D,ee.setState),Ue("nodeOrigin",L,ee.setState),Ue("rfId",F,ee.setState),Ue("autoPanOnConnect",ie,ee.setState),Ue("autoPanOnNodeDrag",he,ee.setState),Ue("onError",me,ee.setState),Ue("connectionRadius",Se,ee.setState),Ue("isValidConnection",ve,ee.setState),Ue("nodeDragThreshold",Ae,ee.setState),tl(n,Re),tl(r,We),tl(k,be),tl(R,B),tl(oe,Y),tl(z,ue),null},Kx={display:"none"},Q5={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},Yg="react-flow__node-desc",Vg="react-flow__edge-desc",K5="react-flow__aria-live",J5=n=>n.ariaLiveMessage;function I5({rfId:n}){const r=tt(J5);return le.createElement("div",{id:`${K5}-${n}`,"aria-live":"assertive","aria-atomic":"true",style:Q5},r)}function F5({rfId:n,disableKeyboardA11y:r}){return le.createElement(le.Fragment,null,le.createElement("div",{id:`${Yg}-${n}`,style:Kx},"Press enter or space to select a node.",!r&&"You can then use the arrow keys to move the node around."," Press delete to remove it and escape to cancel."," "),le.createElement("div",{id:`${Vg}-${n}`,style:Kx},"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel."),!r&&le.createElement(I5,{rfId:n}))}var Lr=(n=null,r={actInsideInputWithModifier:!0})=>{const[o,i]=j.useState(!1),u=j.useRef(!1),f=j.useRef(new Set([])),[h,g]=j.useMemo(()=>{if(n!==null){const m=(Array.isArray(n)?n:[n]).filter(b=>typeof b=="string").map(b=>b.split("+")),p=m.reduce((b,v)=>b.concat(...v),[]);return[m,p]}return[[],[]]},[n]);return j.useEffect(()=>{const x=typeof document<"u"?document:null,m=r?.target||x;if(n!==null){const p=N=>{if(u.current=N.ctrlKey||N.metaKey||N.shiftKey,(!u.current||u.current&&!r.actInsideInputWithModifier)&&Yd(N))return!1;const k=Ix(N.code,g);f.current.add(N[k]),Jx(h,f.current,!1)&&(N.preventDefault(),i(!0))},b=N=>{if((!u.current||u.current&&!r.actInsideInputWithModifier)&&Yd(N))return!1;const k=Ix(N.code,g);Jx(h,f.current,!0)?(i(!1),f.current.clear()):f.current.delete(N[k]),N.key==="Meta"&&f.current.clear(),u.current=!1},v=()=>{f.current.clear(),i(!1)};return m?.addEventListener("keydown",p),m?.addEventListener("keyup",b),window.addEventListener("blur",v),()=>{m?.removeEventListener("keydown",p),m?.removeEventListener("keyup",b),window.removeEventListener("blur",v)}}},[n,i]),o};function Jx(n,r,o){return n.filter(i=>o||i.length===r.size).some(i=>i.every(u=>r.has(u)))}function Ix(n,r){return r.includes(n)?"code":"key"}function Gg(n,r,o,i){const u=n.parentNode||n.parentId;if(!u)return o;const f=r.get(u),h=fs(f,i);return Gg(f,r,{x:(o.x??0)+h.x,y:(o.y??0)+h.y,z:(f[ct]?.z??0)>(o.z??0)?f[ct]?.z??0:o.z??0},i)}function Xg(n,r,o){n.forEach(i=>{const u=i.parentNode||i.parentId;if(u&&!n.has(u))throw new Error(`Parent node ${u} not found`);if(u||o?.[i.id]){const{x:f,y:h,z:g}=Gg(i,n,{...i.position,z:i[ct]?.z??0},r);i.positionAbsolute={x:f,y:h},i[ct].z=g,o?.[i.id]&&(i[ct].isParent=!0)}})}function wd(n,r,o,i){const u=new Map,f={},h=i?1e3:0;return n.forEach(g=>{const x=(bn(g.zIndex)?g.zIndex:0)+(g.selected?h:0),m=r.get(g.id),p={...g,positionAbsolute:{x:g.position.x,y:g.position.y}},b=g.parentNode||g.parentId;b&&(f[b]=!0);const v=m?.type&&m?.type!==g.type;Object.defineProperty(p,ct,{enumerable:!1,value:{handleBounds:v?void 0:m?.[ct]?.handleBounds,z:x}}),u.set(g.id,p)}),Xg(u,o,f),u}function Zg(n,r={}){const{getNodes:o,width:i,height:u,minZoom:f,maxZoom:h,d3Zoom:g,d3Selection:x,fitViewOnInitDone:m,fitViewOnInit:p,nodeOrigin:b}=n(),v=r.initial&&!m&&p;if(g&&x&&(v||!r.initial)){const C=o().filter(R=>{const z=r.includeHiddenNodes?R.width&&R.height:!R.hidden;return r.nodes?.length?z&&r.nodes.some(V=>V.id===R.id):z}),k=C.every(R=>R.width&&R.height);if(C.length>0&&k){const R=Ji(C,b),{x:z,y:V,zoom:q}=Ag(R,i,u,r.minZoom??f,r.maxZoom??h,r.padding??.1),M=ta.translate(z,V).scale(q);return typeof r.duration=="number"&&r.duration>0?g.transform(is(x,r.duration),M):g.transform(x,M),!0}}return!1}function P5(n,r){return n.forEach(o=>{const i=r.get(o.id);i&&r.set(i.id,{...i,[ct]:i[ct],selected:o.selected})}),new Map(r)}function eS(n,r){return r.map(o=>{const i=n.find(u=>u.id===o.id);return i&&(o.selected=i.selected),o})}function ji({changedNodes:n,changedEdges:r,get:o,set:i}){const{nodeInternals:u,edges:f,onNodesChange:h,onEdgesChange:g,hasDefaultNodes:x,hasDefaultEdges:m}=o();n?.length&&(x&&i({nodeInternals:P5(n,u)}),h?.(n)),r?.length&&(m&&i({edges:eS(r,f)}),g?.(r))}const nl=()=>{},tS={zoomIn:nl,zoomOut:nl,zoomTo:nl,getZoom:()=>1,setViewport:nl,getViewport:()=>({x:0,y:0,zoom:1}),fitView:()=>!1,setCenter:nl,fitBounds:nl,project:n=>n,screenToFlowPosition:n=>n,flowToScreenPosition:n=>n,viewportInitialized:!1},nS=n=>({d3Zoom:n.d3Zoom,d3Selection:n.d3Selection}),aS=()=>{const n=wt(),{d3Zoom:r,d3Selection:o}=tt(nS,Mt);return j.useMemo(()=>o&&r?{zoomIn:u=>r.scaleBy(is(o,u?.duration),1.2),zoomOut:u=>r.scaleBy(is(o,u?.duration),1/1.2),zoomTo:(u,f)=>r.scaleTo(is(o,f?.duration),u),getZoom:()=>n.getState().transform[2],setViewport:(u,f)=>{const[h,g,x]=n.getState().transform,m=ta.translate(u.x??h,u.y??g).scale(u.zoom??x);r.transform(is(o,f?.duration),m)},getViewport:()=>{const[u,f,h]=n.getState().transform;return{x:u,y:f,zoom:h}},fitView:u=>Zg(n.getState,u),setCenter:(u,f,h)=>{const{width:g,height:x,maxZoom:m}=n.getState(),p=typeof h?.zoom<"u"?h.zoom:m,b=g/2-u*p,v=x/2-f*p,N=ta.translate(b,v).scale(p);r.transform(is(o,h?.duration),N)},fitBounds:(u,f)=>{const{width:h,height:g,minZoom:x,maxZoom:m}=n.getState(),{x:p,y:b,zoom:v}=Ag(u,h,g,x,m,f?.padding??.1),N=ta.translate(p,b).scale(v);r.transform(is(o,f?.duration),N)},project:u=>{const{transform:f,snapToGrid:h,snapGrid:g}=n.getState();return console.warn("[DEPRECATED] `project` is deprecated. Instead use `screenToFlowPosition`. There is no need to subtract the react flow bounds anymore! https://reactflow.dev/api-reference/types/react-flow-instance#screen-to-flow-position"),Xd(u,f,h,g)},screenToFlowPosition:u=>{const{transform:f,snapToGrid:h,snapGrid:g,domNode:x}=n.getState();if(!x)return u;const{x:m,y:p}=x.getBoundingClientRect(),b={x:u.x-m,y:u.y-p};return Xd(b,f,h,g)},flowToScreenPosition:u=>{const{transform:f,domNode:h}=n.getState();if(!h)return u;const{x:g,y:x}=h.getBoundingClientRect(),m=Cg(u,f);return{x:m.x+g,y:m.y+x}},viewportInitialized:!0}:tS,[r,o])};function gf(){const n=aS(),r=wt(),o=j.useCallback(()=>r.getState().getNodes().map(k=>({...k})),[]),i=j.useCallback(k=>r.getState().nodeInternals.get(k),[]),u=j.useCallback(()=>{const{edges:k=[]}=r.getState();return k.map(R=>({...R}))},[]),f=j.useCallback(k=>{const{edges:R=[]}=r.getState();return R.find(z=>z.id===k)},[]),h=j.useCallback(k=>{const{getNodes:R,setNodes:z,hasDefaultNodes:V,onNodesChange:q}=r.getState(),M=R(),H=typeof k=="function"?k(M):k;if(V)z(H);else if(q){const Z=H.length===0?M.map(X=>({type:"remove",id:X.id})):H.map(X=>({item:X,type:"reset"}));q(Z)}},[]),g=j.useCallback(k=>{const{edges:R=[],setEdges:z,hasDefaultEdges:V,onEdgesChange:q}=r.getState(),M=typeof k=="function"?k(R):k;if(V)z(M);else if(q){const H=M.length===0?R.map(Z=>({type:"remove",id:Z.id})):M.map(Z=>({item:Z,type:"reset"}));q(H)}},[]),x=j.useCallback(k=>{const R=Array.isArray(k)?k:[k],{getNodes:z,setNodes:V,hasDefaultNodes:q,onNodesChange:M}=r.getState();if(q){const Z=[...z(),...R];V(Z)}else if(M){const H=R.map(Z=>({item:Z,type:"add"}));M(H)}},[]),m=j.useCallback(k=>{const R=Array.isArray(k)?k:[k],{edges:z=[],setEdges:V,hasDefaultEdges:q,onEdgesChange:M}=r.getState();if(q)V([...z,...R]);else if(M){const H=R.map(Z=>({item:Z,type:"add"}));M(H)}},[]),p=j.useCallback(()=>{const{getNodes:k,edges:R=[],transform:z}=r.getState(),[V,q,M]=z;return{nodes:k().map(H=>({...H})),edges:R.map(H=>({...H})),viewport:{x:V,y:q,zoom:M}}},[]),b=j.useCallback(({nodes:k,edges:R})=>{const{nodeInternals:z,getNodes:V,edges:q,hasDefaultNodes:M,hasDefaultEdges:H,onNodesDelete:Z,onEdgesDelete:X,onNodesChange:oe,onEdgesChange:I}=r.getState(),K=(k||[]).map(W=>W.id),ae=(R||[]).map(W=>W.id),te=V().reduce((W,E)=>{const $=E.parentNode||E.parentId,T=!K.includes(E.id)&&$&&W.find(S=>S.id===$);return(typeof E.deletable=="boolean"?E.deletable:!0)&&(K.includes(E.id)||T)&&W.push(E),W},[]),se=q.filter(W=>typeof W.deletable=="boolean"?W.deletable:!0),_=se.filter(W=>ae.includes(W.id));if(te||_){const W=Mg(te,se),E=[..._,...W],$=E.reduce((T,A)=>(T.includes(A.id)||T.push(A.id),T),[]);if((H||M)&&(H&&r.setState({edges:q.filter(T=>!$.includes(T.id))}),M&&(te.forEach(T=>{z.delete(T.id)}),r.setState({nodeInternals:new Map(z)}))),$.length>0&&(X?.(E),I&&I($.map(T=>({id:T,type:"remove"})))),te.length>0&&(Z?.(te),oe)){const T=te.map(A=>({id:A.id,type:"remove"}));oe(T)}}},[]),v=j.useCallback(k=>{const R=w5(k),z=R?null:r.getState().nodeInternals.get(k.id);return!R&&!z?[null,null,R]:[R?k:Yx(z),z,R]},[]),N=j.useCallback((k,R=!0,z)=>{const[V,q,M]=v(k);return V?(z||r.getState().getNodes()).filter(H=>{if(!M&&(H.id===q.id||!H.positionAbsolute))return!1;const Z=Yx(H),X=Ld(Z,V);return R&&X>0||X>=V.width*V.height}):[]},[]),C=j.useCallback((k,R,z=!0)=>{const[V]=v(k);if(!V)return!1;const q=Ld(V,R);return z&&q>0||q>=V.width*V.height},[]);return j.useMemo(()=>({...n,getNodes:o,getNode:i,getEdges:u,getEdge:f,setNodes:h,setEdges:g,addNodes:x,addEdges:m,toObject:p,deleteElements:b,getIntersectingNodes:N,isNodeIntersecting:C}),[n,o,i,u,f,h,g,x,m,p,b,N,C])}const sS={actInsideInputWithModifier:!1};var lS=({deleteKeyCode:n,multiSelectionKeyCode:r})=>{const o=wt(),{deleteElements:i}=gf(),u=Lr(n,sS),f=Lr(r);j.useEffect(()=>{if(u){const{edges:h,getNodes:g}=o.getState(),x=g().filter(p=>p.selected),m=h.filter(p=>p.selected);i({nodes:x,edges:m}),o.setState({nodesSelectionActive:!1})}},[u]),j.useEffect(()=>{o.setState({multiSelectionActive:f})},[f])};function rS(n){const r=wt();j.useEffect(()=>{let o;const i=()=>{if(!n.current)return;const u=cf(n.current);(u.height===0||u.width===0)&&r.getState().onError?.("004",sa.error004()),r.setState({width:u.width||500,height:u.height||500})};return i(),window.addEventListener("resize",i),n.current&&(o=new ResizeObserver(()=>i()),o.observe(n.current)),()=>{window.removeEventListener("resize",i),o&&n.current&&o.unobserve(n.current)}},[])}const yf={position:"absolute",width:"100%",height:"100%",top:0,left:0},oS=(n,r)=>n.x!==r.x||n.y!==r.y||n.zoom!==r.k,Ni=n=>({x:n.x,y:n.y,zoom:n.k}),al=(n,r)=>n.target.closest(`.${r}`),Fx=(n,r)=>r===2&&Array.isArray(n)&&n.includes(2),Px=n=>{const r=n.ctrlKey&&qi()?10:1;return-n.deltaY*(n.deltaMode===1?.05:n.deltaMode?1:.002)*r},iS=n=>({d3Zoom:n.d3Zoom,d3Selection:n.d3Selection,d3ZoomHandler:n.d3ZoomHandler,userSelectionActive:n.userSelectionActive}),cS=({onMove:n,onMoveStart:r,onMoveEnd:o,onPaneContextMenu:i,zoomOnScroll:u=!0,zoomOnPinch:f=!0,panOnScroll:h=!1,panOnScrollSpeed:g=.5,panOnScrollMode:x=us.Free,zoomOnDoubleClick:m=!0,elementsSelectable:p,panOnDrag:b=!0,defaultViewport:v,translateExtent:N,minZoom:C,maxZoom:k,zoomActivationKeyCode:R,preventScrolling:z=!0,children:V,noWheelClassName:q,noPanClassName:M})=>{const H=j.useRef(),Z=wt(),X=j.useRef(!1),oe=j.useRef(!1),I=j.useRef(null),K=j.useRef({x:0,y:0,zoom:0}),{d3Zoom:ae,d3Selection:te,d3ZoomHandler:se,userSelectionActive:_}=tt(iS,Mt),W=Lr(R),E=j.useRef(0),$=j.useRef(!1),T=j.useRef();return rS(I),j.useEffect(()=>{if(I.current){const A=I.current.getBoundingClientRect(),S=xg().scaleExtent([C,k]).translateExtent(N),D=yn(I.current).call(S),L=ta.translate(v.x,v.y).scale(yl(v.zoom,C,k)),F=[[0,0],[A.width,A.height]],ie=S.constrain()(L,F,N);S.transform(D,ie),S.wheelDelta(Px),Z.setState({d3Zoom:S,d3Selection:D,d3ZoomHandler:D.on("wheel.zoom"),transform:[ie.x,ie.y,ie.k],domNode:I.current.closest(".react-flow")})}},[]),j.useEffect(()=>{te&&ae&&(h&&!W&&!_?te.on("wheel.zoom",A=>{if(al(A,q))return!1;A.preventDefault(),A.stopImmediatePropagation();const S=te.property("__zoom").k||1;if(A.ctrlKey&&f){const ve=Sn(A),Ae=Px(A),Re=S*Math.pow(2,Ae);ae.scaleTo(te,Re,ve,A);return}const D=A.deltaMode===1?20:1;let L=x===us.Vertical?0:A.deltaX*D,F=x===us.Horizontal?0:A.deltaY*D;!qi()&&A.shiftKey&&x!==us.Vertical&&(L=A.deltaY*D,F=0),ae.translateBy(te,-(L/S)*g,-(F/S)*g,{internal:!0});const ie=Ni(te.property("__zoom")),{onViewportChangeStart:he,onViewportChange:me,onViewportChangeEnd:Se}=Z.getState();clearTimeout(T.current),$.current||($.current=!0,r?.(A,ie),he?.(ie)),$.current&&(n?.(A,ie),me?.(ie),T.current=setTimeout(()=>{o?.(A,ie),Se?.(ie),$.current=!1},150))},{passive:!1}):typeof se<"u"&&te.on("wheel.zoom",function(A,S){if(!z&&A.type==="wheel"&&!A.ctrlKey||al(A,q))return null;A.preventDefault(),se.call(this,A,S)},{passive:!1}))},[_,h,x,te,ae,se,W,f,z,q,r,n,o]),j.useEffect(()=>{ae&&ae.on("start",A=>{if(!A.sourceEvent||A.sourceEvent.internal)return null;E.current=A.sourceEvent?.button;const{onViewportChangeStart:S}=Z.getState(),D=Ni(A.transform);X.current=!0,K.current=D,A.sourceEvent?.type==="mousedown"&&Z.setState({paneDragging:!0}),S?.(D),r?.(A.sourceEvent,D)})},[ae,r]),j.useEffect(()=>{ae&&(_&&!X.current?ae.on("zoom",null):_||ae.on("zoom",A=>{const{onViewportChange:S}=Z.getState();if(Z.setState({transform:[A.transform.x,A.transform.y,A.transform.k]}),oe.current=!!(i&&Fx(b,E.current??0)),(n||S)&&!A.sourceEvent?.internal){const D=Ni(A.transform);S?.(D),n?.(A.sourceEvent,D)}}))},[_,ae,n,b,i]),j.useEffect(()=>{ae&&ae.on("end",A=>{if(!A.sourceEvent||A.sourceEvent.internal)return null;const{onViewportChangeEnd:S}=Z.getState();if(X.current=!1,Z.setState({paneDragging:!1}),i&&Fx(b,E.current??0)&&!oe.current&&i(A.sourceEvent),oe.current=!1,(o||S)&&oS(K.current,A.transform)){const D=Ni(A.transform);K.current=D,clearTimeout(H.current),H.current=setTimeout(()=>{S?.(D),o?.(A.sourceEvent,D)},h?150:0)}})},[ae,h,b,o,i]),j.useEffect(()=>{ae&&ae.filter(A=>{const S=W||u,D=f&&A.ctrlKey;if((b===!0||Array.isArray(b)&&b.includes(1))&&A.button===1&&A.type==="mousedown"&&(al(A,"react-flow__node")||al(A,"react-flow__edge")))return!0;if(!b&&!S&&!h&&!m&&!f||_||!m&&A.type==="dblclick"||al(A,q)&&A.type==="wheel"||al(A,M)&&(A.type!=="wheel"||h&&A.type==="wheel"&&!W)||!f&&A.ctrlKey&&A.type==="wheel"||!S&&!h&&!D&&A.type==="wheel"||!b&&(A.type==="mousedown"||A.type==="touchstart")||Array.isArray(b)&&!b.includes(A.button)&&A.type==="mousedown")return!1;const L=Array.isArray(b)&&b.includes(A.button)||!A.button||A.button<=1;return(!A.ctrlKey||A.type==="wheel")&&L})},[_,ae,u,f,h,m,b,p,W]),le.createElement("div",{className:"react-flow__renderer",ref:I,style:yf},V)},uS=n=>({userSelectionActive:n.userSelectionActive,userSelectionRect:n.userSelectionRect});function dS(){const{userSelectionActive:n,userSelectionRect:r}=tt(uS,Mt);return n&&r?le.createElement("div",{className:"react-flow__selection react-flow__container",style:{width:r.width,height:r.height,transform:`translate(${r.x}px, ${r.y}px)`}}):null}function e0(n,r){const o=r.parentNode||r.parentId,i=n.find(u=>u.id===o);if(i){const u=r.position.x+r.width-i.width,f=r.position.y+r.height-i.height;if(u>0||f>0||r.position.x<0||r.position.y<0){if(i.style={...i.style},i.style.width=i.style.width??i.width,i.style.height=i.style.height??i.height,u>0&&(i.style.width+=u),f>0&&(i.style.height+=f),r.position.x<0){const h=Math.abs(r.position.x);i.position.x=i.position.x-h,i.style.width+=h,r.position.x=0}if(r.position.y<0){const h=Math.abs(r.position.y);i.position.y=i.position.y-h,i.style.height+=h,r.position.y=0}i.width=i.style.width,i.height=i.style.height}}}function Wg(n,r){if(n.some(i=>i.type==="reset"))return n.filter(i=>i.type==="reset").map(i=>i.item);const o=n.filter(i=>i.type==="add").map(i=>i.item);return r.reduce((i,u)=>{const f=n.filter(g=>g.id===u.id);if(f.length===0)return i.push(u),i;const h={...u};for(const g of f)if(g)switch(g.type){case"select":{h.selected=g.selected;break}case"position":{typeof g.position<"u"&&(h.position=g.position),typeof g.positionAbsolute<"u"&&(h.positionAbsolute=g.positionAbsolute),typeof g.dragging<"u"&&(h.dragging=g.dragging),h.expandParent&&e0(i,h);break}case"dimensions":{typeof g.dimensions<"u"&&(h.width=g.dimensions.width,h.height=g.dimensions.height),typeof g.updateStyle<"u"&&(h.style={...h.style||{},...g.dimensions}),typeof g.resizing=="boolean"&&(h.resizing=g.resizing),h.expandParent&&e0(i,h);break}case"remove":return i}return i.push(h),i},o)}function Qg(n,r){return Wg(n,r)}function fS(n,r){return Wg(n,r)}const Ha=(n,r)=>({id:n,type:"select",selected:r});function cl(n,r){return n.reduce((o,i)=>{const u=r.includes(i.id);return!i.selected&&u?(i.selected=!0,o.push(Ha(i.id,!0))):i.selected&&!u&&(i.selected=!1,o.push(Ha(i.id,!1))),o},[])}const Sd=(n,r)=>o=>{o.target===r.current&&n?.(o)},hS=n=>({userSelectionActive:n.userSelectionActive,elementsSelectable:n.elementsSelectable,dragging:n.paneDragging}),Kg=j.memo(({isSelecting:n,selectionMode:r=qr.Full,panOnDrag:o,onSelectionStart:i,onSelectionEnd:u,onPaneClick:f,onPaneContextMenu:h,onPaneScroll:g,onPaneMouseEnter:x,onPaneMouseMove:m,onPaneMouseLeave:p,children:b})=>{const v=j.useRef(null),N=wt(),C=j.useRef(0),k=j.useRef(0),R=j.useRef(),{userSelectionActive:z,elementsSelectable:V,dragging:q}=tt(hS,Mt),M=()=>{N.setState({userSelectionActive:!1,userSelectionRect:null}),C.current=0,k.current=0},H=se=>{f?.(se),N.getState().resetSelectedElements(),N.setState({nodesSelectionActive:!1})},Z=se=>{if(Array.isArray(o)&&o?.includes(2)){se.preventDefault();return}h?.(se)},X=g?se=>g(se):void 0,oe=se=>{const{resetSelectedElements:_,domNode:W}=N.getState();if(R.current=W?.getBoundingClientRect(),!V||!n||se.button!==0||se.target!==v.current||!R.current)return;const{x:E,y:$}=Ua(se,R.current);_(),N.setState({userSelectionRect:{width:0,height:0,startX:E,startY:$,x:E,y:$}}),i?.(se)},I=se=>{const{userSelectionRect:_,nodeInternals:W,edges:E,transform:$,onNodesChange:T,onEdgesChange:A,nodeOrigin:S,getNodes:D}=N.getState();if(!n||!R.current||!_)return;N.setState({userSelectionActive:!0,nodesSelectionActive:!1});const L=Ua(se,R.current),F=_.startX??0,ie=_.startY??0,he={..._,x:L.x<F?L.x:F,y:L.y<ie?L.y:ie,width:Math.abs(L.x-F),height:Math.abs(L.y-ie)},me=D(),Se=Tg(W,he,$,r===qr.Partial,!0,S),ve=Mg(Se,E).map(Re=>Re.id),Ae=Se.map(Re=>Re.id);if(C.current!==Ae.length){C.current=Ae.length;const Re=cl(me,Ae);Re.length&&T?.(Re)}if(k.current!==ve.length){k.current=ve.length;const Re=cl(E,ve);Re.length&&A?.(Re)}N.setState({userSelectionRect:he})},K=se=>{if(se.button!==0)return;const{userSelectionRect:_}=N.getState();!z&&_&&se.target===v.current&&H?.(se),N.setState({nodesSelectionActive:C.current>0}),M(),u?.(se)},ae=se=>{z&&(N.setState({nodesSelectionActive:C.current>0}),u?.(se)),M()},te=V&&(n||z);return le.createElement("div",{className:Ut(["react-flow__pane",{dragging:q,selection:n}]),onClick:te?void 0:Sd(H,v),onContextMenu:Sd(Z,v),onWheel:Sd(X,v),onMouseEnter:te?void 0:x,onMouseDown:te?oe:void 0,onMouseMove:te?I:m,onMouseUp:te?K:void 0,onMouseLeave:te?ae:p,ref:v,style:yf},b,le.createElement(dS,null))});Kg.displayName="Pane";function Jg(n,r){const o=n.parentNode||n.parentId;if(!o)return!1;const i=r.get(o);return i?i.selected?!0:Jg(i,r):!1}function t0(n,r,o){let i=n;do{if(i?.matches(r))return!0;if(i===o.current)return!1;i=i.parentElement}while(i);return!1}function mS(n,r,o,i){return Array.from(n.values()).filter(u=>(u.selected||u.id===i)&&(!u.parentNode||u.parentId||!Jg(u,n))&&(u.draggable||r&&typeof u.draggable>"u")).map(u=>({id:u.id,position:u.position||{x:0,y:0},positionAbsolute:u.positionAbsolute||{x:0,y:0},distance:{x:o.x-(u.positionAbsolute?.x??0),y:o.y-(u.positionAbsolute?.y??0)},delta:{x:0,y:0},extent:u.extent,parentNode:u.parentNode||u.parentId,parentId:u.parentNode||u.parentId,width:u.width,height:u.height,expandParent:u.expandParent}))}function pS(n,r){return!r||r==="parent"?r:[r[0],[r[1][0]-(n.width||0),r[1][1]-(n.height||0)]]}function Ig(n,r,o,i,u=[0,0],f){const h=pS(n,n.extent||i);let g=h;const x=n.parentNode||n.parentId;if(n.extent==="parent"&&!n.expandParent)if(x&&n.width&&n.height){const b=o.get(x),{x:v,y:N}=fs(b,u).positionAbsolute;g=b&&bn(v)&&bn(N)&&bn(b.width)&&bn(b.height)?[[v+n.width*u[0],N+n.height*u[1]],[v+b.width-n.width+n.width*u[0],N+b.height-n.height+n.height*u[1]]]:g}else f?.("005",sa.error005()),g=h;else if(n.extent&&x&&n.extent!=="parent"){const b=o.get(x),{x:v,y:N}=fs(b,u).positionAbsolute;g=[[n.extent[0][0]+v,n.extent[0][1]+N],[n.extent[1][0]+v,n.extent[1][1]+N]]}let m={x:0,y:0};if(x){const b=o.get(x);m=fs(b,u).positionAbsolute}const p=g&&g!=="parent"?uf(r,g):r;return{position:{x:p.x-m.x,y:p.y-m.y},positionAbsolute:p}}function Ed({nodeId:n,dragItems:r,nodeInternals:o}){const i=r.map(u=>({...o.get(u.id),position:u.position,positionAbsolute:u.positionAbsolute}));return[n?i.find(u=>u.id===n):i[0],i]}const n0=(n,r,o,i)=>{const u=r.querySelectorAll(n);if(!u||!u.length)return null;const f=Array.from(u),h=r.getBoundingClientRect(),g={x:h.width*i[0],y:h.height*i[1]};return f.map(x=>{const m=x.getBoundingClientRect();return{id:x.getAttribute("data-handleid"),position:x.getAttribute("data-handlepos"),x:(m.left-h.left-g.x)/o,y:(m.top-h.top-g.y)/o,...cf(x)}})};function kr(n,r,o){return o===void 0?o:i=>{const u=r().nodeInternals.get(n);u&&o(i,{...u})}}function Wd({id:n,store:r,unselect:o=!1,nodeRef:i}){const{addSelectedNodes:u,unselectNodesAndEdges:f,multiSelectionActive:h,nodeInternals:g,onError:x}=r.getState(),m=g.get(n);if(!m){x?.("012",sa.error012(n));return}r.setState({nodesSelectionActive:!1}),m.selected?(o||m.selected&&h)&&(f({nodes:[m],edges:[]}),requestAnimationFrame(()=>i?.current?.blur())):u([n])}function xS(){const n=wt();return j.useCallback(({sourceEvent:o})=>{const{transform:i,snapGrid:u,snapToGrid:f}=n.getState(),h=o.touches?o.touches[0].clientX:o.clientX,g=o.touches?o.touches[0].clientY:o.clientY,x={x:(h-i[0])/i[2],y:(g-i[1])/i[2]};return{xSnapped:f?u[0]*Math.round(x.x/u[0]):x.x,ySnapped:f?u[1]*Math.round(x.y/u[1]):x.y,...x}},[])}function kd(n){return(r,o,i)=>n?.(r,i)}function Fg({nodeRef:n,disabled:r=!1,noDragClassName:o,handleSelector:i,nodeId:u,isSelectable:f,selectNodesOnDrag:h}){const g=wt(),[x,m]=j.useState(!1),p=j.useRef([]),b=j.useRef({x:null,y:null}),v=j.useRef(0),N=j.useRef(null),C=j.useRef({x:0,y:0}),k=j.useRef(null),R=j.useRef(!1),z=j.useRef(!1),V=j.useRef(!1),q=xS();return j.useEffect(()=>{if(n?.current){const M=yn(n.current),H=({x:oe,y:I})=>{const{nodeInternals:K,onNodeDrag:ae,onSelectionDrag:te,updateNodePositions:se,nodeExtent:_,snapGrid:W,snapToGrid:E,nodeOrigin:$,onError:T}=g.getState();b.current={x:oe,y:I};let A=!1,S={x:0,y:0,x2:0,y2:0};if(p.current.length>1&&_){const L=Ji(p.current,$);S=Br(L)}if(p.current=p.current.map(L=>{const F={x:oe-L.distance.x,y:I-L.distance.y};E&&(F.x=W[0]*Math.round(F.x/W[0]),F.y=W[1]*Math.round(F.y/W[1]));const ie=[[_[0][0],_[0][1]],[_[1][0],_[1][1]]];p.current.length>1&&_&&!L.extent&&(ie[0][0]=L.positionAbsolute.x-S.x+_[0][0],ie[1][0]=L.positionAbsolute.x+(L.width??0)-S.x2+_[1][0],ie[0][1]=L.positionAbsolute.y-S.y+_[0][1],ie[1][1]=L.positionAbsolute.y+(L.height??0)-S.y2+_[1][1]);const he=Ig(L,F,K,ie,$,T);return A=A||L.position.x!==he.position.x||L.position.y!==he.position.y,L.position=he.position,L.positionAbsolute=he.positionAbsolute,L}),!A)return;se(p.current,!0,!0),m(!0);const D=u?ae:kd(te);if(D&&k.current){const[L,F]=Ed({nodeId:u,dragItems:p.current,nodeInternals:K});D(k.current,L,F)}},Z=()=>{if(!N.current)return;const[oe,I]=yg(C.current,N.current);if(oe!==0||I!==0){const{transform:K,panBy:ae}=g.getState();b.current.x=(b.current.x??0)-oe/K[2],b.current.y=(b.current.y??0)-I/K[2],ae({x:oe,y:I})&&H(b.current)}v.current=requestAnimationFrame(Z)},X=oe=>{const{nodeInternals:I,multiSelectionActive:K,nodesDraggable:ae,unselectNodesAndEdges:te,onNodeDragStart:se,onSelectionDragStart:_}=g.getState();z.current=!0;const W=u?se:kd(_);(!h||!f)&&!K&&u&&(I.get(u)?.selected||te()),u&&f&&h&&Wd({id:u,store:g,nodeRef:n});const E=q(oe);if(b.current=E,p.current=mS(I,ae,E,u),W&&p.current){const[$,T]=Ed({nodeId:u,dragItems:p.current,nodeInternals:I});W(oe.sourceEvent,$,T)}};if(r)M.on(".drag",null);else{const oe=_N().on("start",I=>{const{domNode:K,nodeDragThreshold:ae}=g.getState();ae===0&&X(I),V.current=!1;const te=q(I);b.current=te,N.current=K?.getBoundingClientRect()||null,C.current=Ua(I.sourceEvent,N.current)}).on("drag",I=>{const K=q(I),{autoPanOnNodeDrag:ae,nodeDragThreshold:te}=g.getState();if(I.sourceEvent.type==="touchmove"&&I.sourceEvent.touches.length>1&&(V.current=!0),!V.current){if(!R.current&&z.current&&ae&&(R.current=!0,Z()),!z.current){const se=K.xSnapped-(b?.current?.x??0),_=K.ySnapped-(b?.current?.y??0);Math.sqrt(se*se+_*_)>te&&X(I)}(b.current.x!==K.xSnapped||b.current.y!==K.ySnapped)&&p.current&&z.current&&(k.current=I.sourceEvent,C.current=Ua(I.sourceEvent,N.current),H(K))}}).on("end",I=>{if(!(!z.current||V.current)&&(m(!1),R.current=!1,z.current=!1,cancelAnimationFrame(v.current),p.current)){const{updateNodePositions:K,nodeInternals:ae,onNodeDragStop:te,onSelectionDragStop:se}=g.getState(),_=u?te:kd(se);if(K(p.current,!1,!1),_){const[W,E]=Ed({nodeId:u,dragItems:p.current,nodeInternals:ae});_(I.sourceEvent,W,E)}}}).filter(I=>{const K=I.target;return!I.button&&(!o||!t0(K,`.${o}`,n))&&(!i||t0(K,i,n))});return M.call(oe),()=>{M.on(".drag",null)}}}},[n,r,o,i,f,g,u,h,q]),x}function Pg(){const n=wt();return j.useCallback(o=>{const{nodeInternals:i,nodeExtent:u,updateNodePositions:f,getNodes:h,snapToGrid:g,snapGrid:x,onError:m,nodesDraggable:p}=n.getState(),b=h().filter(V=>V.selected&&(V.draggable||p&&typeof V.draggable>"u")),v=g?x[0]:5,N=g?x[1]:5,C=o.isShiftPressed?4:1,k=o.x*v*C,R=o.y*N*C,z=b.map(V=>{if(V.positionAbsolute){const q={x:V.positionAbsolute.x+k,y:V.positionAbsolute.y+R};g&&(q.x=x[0]*Math.round(q.x/x[0]),q.y=x[1]*Math.round(q.y/x[1]));const{positionAbsolute:M,position:H}=Ig(V,q,i,u,void 0,m);V.position=H,V.positionAbsolute=M}return V});f(z,!0,!1)},[])}const pl={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}};var _r=n=>{const r=({id:o,type:i,data:u,xPos:f,yPos:h,xPosOrigin:g,yPosOrigin:x,selected:m,onClick:p,onMouseEnter:b,onMouseMove:v,onMouseLeave:N,onContextMenu:C,onDoubleClick:k,style:R,className:z,isDraggable:V,isSelectable:q,isConnectable:M,isFocusable:H,selectNodesOnDrag:Z,sourcePosition:X,targetPosition:oe,hidden:I,resizeObserver:K,dragHandle:ae,zIndex:te,isParent:se,noDragClassName:_,noPanClassName:W,initialized:E,disableKeyboardA11y:$,ariaLabel:T,rfId:A,hasHandleBounds:S})=>{const D=wt(),L=j.useRef(null),F=j.useRef(null),ie=j.useRef(X),he=j.useRef(oe),me=j.useRef(i),Se=q||V||p||b||v||N,ve=Pg(),Ae=kr(o,D.getState,b),Re=kr(o,D.getState,v),We=kr(o,D.getState,N),Te=kr(o,D.getState,C),be=kr(o,D.getState,k),B=re=>{const{nodeDragThreshold:ee}=D.getState();if(q&&(!Z||!V||ee>0)&&Wd({id:o,store:D,nodeRef:L}),p){const Ee=D.getState().nodeInternals.get(o);Ee&&p(re,{...Ee})}},Y=re=>{if(!Yd(re)&&!$)if(Ng.includes(re.key)&&q){const ee=re.key==="Escape";Wd({id:o,store:D,unselect:ee,nodeRef:L})}else V&&m&&Object.prototype.hasOwnProperty.call(pl,re.key)&&(D.setState({ariaLiveMessage:`Moved selected node ${re.key.replace("Arrow","").toLowerCase()}. New position, x: ${~~f}, y: ${~~h}`}),ve({x:pl[re.key].x,y:pl[re.key].y,isShiftPressed:re.shiftKey}))};j.useEffect(()=>()=>{F.current&&(K?.unobserve(F.current),F.current=null)},[]),j.useEffect(()=>{if(L.current&&!I){const re=L.current;(!E||!S||F.current!==re)&&(F.current&&K?.unobserve(F.current),K?.observe(re),F.current=re)}},[I,E,S]),j.useEffect(()=>{const re=me.current!==i,ee=ie.current!==X,Ee=he.current!==oe;L.current&&(re||ee||Ee)&&(re&&(me.current=i),ee&&(ie.current=X),Ee&&(he.current=oe),D.getState().updateNodeDimensions([{id:o,nodeElement:L.current,forceUpdate:!0}]))},[o,i,X,oe]);const ue=Fg({nodeRef:L,disabled:I||!V,noDragClassName:_,handleSelector:ae,nodeId:o,isSelectable:q,selectNodesOnDrag:Z});return I?null:le.createElement("div",{className:Ut(["react-flow__node",`react-flow__node-${i}`,{[W]:V},z,{selected:m,selectable:q,parent:se,dragging:ue}]),ref:L,style:{zIndex:te,transform:`translate(${g}px,${x}px)`,pointerEvents:Se?"all":"none",visibility:E?"visible":"hidden",...R},"data-id":o,"data-testid":`rf__node-${o}`,onMouseEnter:Ae,onMouseMove:Re,onMouseLeave:We,onContextMenu:Te,onClick:B,onDoubleClick:be,onKeyDown:H?Y:void 0,tabIndex:H?0:void 0,role:H?"button":void 0,"aria-describedby":$?void 0:`${Yg}-${A}`,"aria-label":T},le.createElement(M5,{value:o},le.createElement(n,{id:o,data:u,type:i,xPos:f,yPos:h,selected:m,isConnectable:M,sourcePosition:X,targetPosition:oe,dragging:ue,dragHandle:ae,zIndex:te})))};return r.displayName="NodeWrapper",j.memo(r)};const gS=n=>{const r=n.getNodes().filter(o=>o.selected);return{...Ji(r,n.nodeOrigin),transformString:`translate(${n.transform[0]}px,${n.transform[1]}px) scale(${n.transform[2]})`,userSelectionActive:n.userSelectionActive}};function yS({onSelectionContextMenu:n,noPanClassName:r,disableKeyboardA11y:o}){const i=wt(),{width:u,height:f,x:h,y:g,transformString:x,userSelectionActive:m}=tt(gS,Mt),p=Pg(),b=j.useRef(null);if(j.useEffect(()=>{o||b.current?.focus({preventScroll:!0})},[o]),Fg({nodeRef:b}),m||!u||!f)return null;const v=n?C=>{const k=i.getState().getNodes().filter(R=>R.selected);n(C,k)}:void 0,N=C=>{Object.prototype.hasOwnProperty.call(pl,C.key)&&p({x:pl[C.key].x,y:pl[C.key].y,isShiftPressed:C.shiftKey})};return le.createElement("div",{className:Ut(["react-flow__nodesselection","react-flow__container",r]),style:{transform:x}},le.createElement("div",{ref:b,className:"react-flow__nodesselection-rect",onContextMenu:v,tabIndex:o?void 0:-1,onKeyDown:o?void 0:N,style:{width:u,height:f,top:g,left:h}}))}var bS=j.memo(yS);const vS=n=>n.nodesSelectionActive,ey=({children:n,onPaneClick:r,onPaneMouseEnter:o,onPaneMouseMove:i,onPaneMouseLeave:u,onPaneContextMenu:f,onPaneScroll:h,deleteKeyCode:g,onMove:x,onMoveStart:m,onMoveEnd:p,selectionKeyCode:b,selectionOnDrag:v,selectionMode:N,onSelectionStart:C,onSelectionEnd:k,multiSelectionKeyCode:R,panActivationKeyCode:z,zoomActivationKeyCode:V,elementsSelectable:q,zoomOnScroll:M,zoomOnPinch:H,panOnScroll:Z,panOnScrollSpeed:X,panOnScrollMode:oe,zoomOnDoubleClick:I,panOnDrag:K,defaultViewport:ae,translateExtent:te,minZoom:se,maxZoom:_,preventScrolling:W,onSelectionContextMenu:E,noWheelClassName:$,noPanClassName:T,disableKeyboardA11y:A})=>{const S=tt(vS),D=Lr(b),L=Lr(z),F=L||K,ie=L||Z,he=D||v&&F!==!0;return lS({deleteKeyCode:g,multiSelectionKeyCode:R}),le.createElement(cS,{onMove:x,onMoveStart:m,onMoveEnd:p,onPaneContextMenu:f,elementsSelectable:q,zoomOnScroll:M,zoomOnPinch:H,panOnScroll:ie,panOnScrollSpeed:X,panOnScrollMode:oe,zoomOnDoubleClick:I,panOnDrag:!D&&F,defaultViewport:ae,translateExtent:te,minZoom:se,maxZoom:_,zoomActivationKeyCode:V,preventScrolling:W,noWheelClassName:$,noPanClassName:T},le.createElement(Kg,{onSelectionStart:C,onSelectionEnd:k,onPaneClick:r,onPaneMouseEnter:o,onPaneMouseMove:i,onPaneMouseLeave:u,onPaneContextMenu:f,onPaneScroll:h,panOnDrag:F,isSelecting:!!he,selectionMode:N},n,S&&le.createElement(bS,{onSelectionContextMenu:E,noPanClassName:T,disableKeyboardA11y:A})))};ey.displayName="FlowRenderer";var jS=j.memo(ey);function NS(n){return tt(j.useCallback(o=>n?Tg(o.nodeInternals,{x:0,y:0,width:o.width,height:o.height},o.transform,!0):o.getNodes(),[n]))}function wS(n){const r={input:_r(n.input||Ug),default:_r(n.default||Zd),output:_r(n.output||qg),group:_r(n.group||xf)},o={},i=Object.keys(n).filter(u=>!["input","default","output","group"].includes(u)).reduce((u,f)=>(u[f]=_r(n[f]||Zd),u),o);return{...r,...i}}const SS=({x:n,y:r,width:o,height:i,origin:u})=>!o||!i?{x:n,y:r}:u[0]<0||u[1]<0||u[0]>1||u[1]>1?{x:n,y:r}:{x:n-o*u[0],y:r-i*u[1]},ES=n=>({nodesDraggable:n.nodesDraggable,nodesConnectable:n.nodesConnectable,nodesFocusable:n.nodesFocusable,elementsSelectable:n.elementsSelectable,updateNodeDimensions:n.updateNodeDimensions,onError:n.onError}),ty=n=>{const{nodesDraggable:r,nodesConnectable:o,nodesFocusable:i,elementsSelectable:u,updateNodeDimensions:f,onError:h}=tt(ES,Mt),g=NS(n.onlyRenderVisibleElements),x=j.useRef(),m=j.useMemo(()=>{if(typeof ResizeObserver>"u")return null;const p=new ResizeObserver(b=>{const v=b.map(N=>({id:N.target.getAttribute("data-id"),nodeElement:N.target,forceUpdate:!0}));f(v)});return x.current=p,p},[]);return j.useEffect(()=>()=>{x?.current?.disconnect()},[]),le.createElement("div",{className:"react-flow__nodes",style:yf},g.map(p=>{let b=p.type||"default";n.nodeTypes[b]||(h?.("003",sa.error003(b)),b="default");const v=n.nodeTypes[b]||n.nodeTypes.default,N=!!(p.draggable||r&&typeof p.draggable>"u"),C=!!(p.selectable||u&&typeof p.selectable>"u"),k=!!(p.connectable||o&&typeof p.connectable>"u"),R=!!(p.focusable||i&&typeof p.focusable>"u"),z=n.nodeExtent?uf(p.positionAbsolute,n.nodeExtent):p.positionAbsolute,V=z?.x??0,q=z?.y??0,M=SS({x:V,y:q,width:p.width??0,height:p.height??0,origin:n.nodeOrigin});return le.createElement(v,{key:p.id,id:p.id,className:p.className,style:p.style,type:b,data:p.data,sourcePosition:p.sourcePosition||xe.Bottom,targetPosition:p.targetPosition||xe.Top,hidden:p.hidden,xPos:V,yPos:q,xPosOrigin:M.x,yPosOrigin:M.y,selectNodesOnDrag:n.selectNodesOnDrag,onClick:n.onNodeClick,onMouseEnter:n.onNodeMouseEnter,onMouseMove:n.onNodeMouseMove,onMouseLeave:n.onNodeMouseLeave,onContextMenu:n.onNodeContextMenu,onDoubleClick:n.onNodeDoubleClick,selected:!!p.selected,isDraggable:N,isSelectable:C,isConnectable:k,isFocusable:R,resizeObserver:m,dragHandle:p.dragHandle,zIndex:p[ct]?.z??0,isParent:!!p[ct]?.isParent,noDragClassName:n.noDragClassName,noPanClassName:n.noPanClassName,initialized:!!p.width&&!!p.height,rfId:n.rfId,disableKeyboardA11y:n.disableKeyboardA11y,ariaLabel:p.ariaLabel,hasHandleBounds:!!p[ct]?.handleBounds})}))};ty.displayName="NodeRenderer";var kS=j.memo(ty);const _S=(n,r,o)=>o===xe.Left?n-r:o===xe.Right?n+r:n,CS=(n,r,o)=>o===xe.Top?n-r:o===xe.Bottom?n+r:n,a0="react-flow__edgeupdater",s0=({position:n,centerX:r,centerY:o,radius:i=10,onMouseDown:u,onMouseEnter:f,onMouseOut:h,type:g})=>le.createElement("circle",{onMouseDown:u,onMouseEnter:f,onMouseOut:h,className:Ut([a0,`${a0}-${g}`]),cx:_S(r,i,n),cy:CS(o,i,n),r:i,stroke:"transparent",fill:"transparent"}),TS=()=>!0;var sl=n=>{const r=({id:o,className:i,type:u,data:f,onClick:h,onEdgeDoubleClick:g,selected:x,animated:m,label:p,labelStyle:b,labelShowBg:v,labelBgStyle:N,labelBgPadding:C,labelBgBorderRadius:k,style:R,source:z,target:V,sourceX:q,sourceY:M,targetX:H,targetY:Z,sourcePosition:X,targetPosition:oe,elementsSelectable:I,hidden:K,sourceHandleId:ae,targetHandleId:te,onContextMenu:se,onMouseEnter:_,onMouseMove:W,onMouseLeave:E,reconnectRadius:$,onReconnect:T,onReconnectStart:A,onReconnectEnd:S,markerEnd:D,markerStart:L,rfId:F,ariaLabel:ie,isFocusable:he,isReconnectable:me,pathOptions:Se,interactionWidth:ve,disableKeyboardA11y:Ae})=>{const Re=j.useRef(null),[We,Te]=j.useState(!1),[be,B]=j.useState(!1),Y=wt(),ue=j.useMemo(()=>`url('#${Gd(L,F)}')`,[L,F]),re=j.useMemo(()=>`url('#${Gd(D,F)}')`,[D,F]);if(K)return null;const ee=Ve=>{const{edges:je,addSelectedEdges:Le,unselectNodesAndEdges:Ge,multiSelectionActive:zt}=Y.getState(),Vt=je.find(It=>It.id===o);Vt&&(I&&(Y.setState({nodesSelectionActive:!1}),Vt.selected&&zt?(Ge({nodes:[],edges:[Vt]}),Re.current?.blur()):Le([o])),h&&h(Ve,Vt))},Ee=Er(o,Y.getState,g),ge=Er(o,Y.getState,se),ke=Er(o,Y.getState,_),Oe=Er(o,Y.getState,W),ze=Er(o,Y.getState,E),At=(Ve,je)=>{if(Ve.button!==0)return;const{edges:Le,isValidConnection:Ge}=Y.getState(),zt=je?V:z,Vt=(je?te:ae)||null,It=je?"target":"source",Nl=Ge||TS,ys=je,la=Le.find(Dn=>Dn.id===o);B(!0),A?.(Ve,la,It);const Ya=Dn=>{B(!1),S?.(Dn,la,It)};Og({event:Ve,handleId:Vt,nodeId:zt,onConnect:Dn=>T?.(la,Dn),isTarget:ys,getState:Y.getState,setState:Y.setState,isValidConnection:Nl,edgeUpdaterType:It,onReconnectEnd:Ya})},Rt=Ve=>At(Ve,!0),ft=Ve=>At(Ve,!1),nt=()=>Te(!0),xt=()=>Te(!1),at=!I&&!h,pe=Ve=>{if(!Ae&&Ng.includes(Ve.key)&&I){const{unselectNodesAndEdges:je,addSelectedEdges:Le,edges:Ge}=Y.getState();Ve.key==="Escape"?(Re.current?.blur(),je({edges:[Ge.find(Vt=>Vt.id===o)]})):Le([o])}};return le.createElement("g",{className:Ut(["react-flow__edge",`react-flow__edge-${u}`,i,{selected:x,animated:m,inactive:at,updating:We}]),onClick:ee,onDoubleClick:Ee,onContextMenu:ge,onMouseEnter:ke,onMouseMove:Oe,onMouseLeave:ze,onKeyDown:he?pe:void 0,tabIndex:he?0:void 0,role:he?"button":"img","data-testid":`rf__edge-${o}`,"aria-label":ie===null?void 0:ie||`Edge from ${z} to ${V}`,"aria-describedby":he?`${Vg}-${F}`:void 0,ref:Re},!be&&le.createElement(n,{id:o,source:z,target:V,selected:x,animated:m,label:p,labelStyle:b,labelShowBg:v,labelBgStyle:N,labelBgPadding:C,labelBgBorderRadius:k,data:f,style:R,sourceX:q,sourceY:M,targetX:H,targetY:Z,sourcePosition:X,targetPosition:oe,sourceHandleId:ae,targetHandleId:te,markerStart:ue,markerEnd:re,pathOptions:Se,interactionWidth:ve}),me&&le.createElement(le.Fragment,null,(me==="source"||me===!0)&&le.createElement(s0,{position:X,centerX:q,centerY:M,radius:$,onMouseDown:Rt,onMouseEnter:nt,onMouseOut:xt,type:"source"}),(me==="target"||me===!0)&&le.createElement(s0,{position:oe,centerX:H,centerY:Z,radius:$,onMouseDown:ft,onMouseEnter:nt,onMouseOut:xt,type:"target"})))};return r.displayName="EdgeWrapper",j.memo(r)};function MS(n){const r={default:sl(n.default||Li),straight:sl(n.bezier||hf),step:sl(n.step||ff),smoothstep:sl(n.step||Ki),simplebezier:sl(n.simplebezier||df)},o={},i=Object.keys(n).filter(u=>!["default","bezier"].includes(u)).reduce((u,f)=>(u[f]=sl(n[f]||Li),u),o);return{...r,...i}}function l0(n,r,o=null){const i=(o?.x||0)+r.x,u=(o?.y||0)+r.y,f=o?.width||r.width,h=o?.height||r.height;switch(n){case xe.Top:return{x:i+f/2,y:u};case xe.Right:return{x:i+f,y:u+h/2};case xe.Bottom:return{x:i+f/2,y:u+h};case xe.Left:return{x:i,y:u+h/2}}}function r0(n,r){return n?n.length===1||!r?n[0]:r&&n.find(o=>o.id===r)||null:null}const AS=(n,r,o,i,u,f)=>{const h=l0(o,n,r),g=l0(f,i,u);return{sourceX:h.x,sourceY:h.y,targetX:g.x,targetY:g.y}};function RS({sourcePos:n,targetPos:r,sourceWidth:o,sourceHeight:i,targetWidth:u,targetHeight:f,width:h,height:g,transform:x}){const m={x:Math.min(n.x,r.x),y:Math.min(n.y,r.y),x2:Math.max(n.x+o,r.x+u),y2:Math.max(n.y+i,r.y+f)};m.x===m.x2&&(m.x2+=1),m.y===m.y2&&(m.y2+=1);const p=Br({x:(0-x[0])/x[2],y:(0-x[1])/x[2],width:h/x[2],height:g/x[2]}),b=Math.max(0,Math.min(p.x2,m.x2)-Math.max(p.x,m.x)),v=Math.max(0,Math.min(p.y2,m.y2)-Math.max(p.y,m.y));return Math.ceil(b*v)>0}function o0(n){const r=n?.[ct]?.handleBounds||null,o=r&&n?.width&&n?.height&&typeof n?.positionAbsolute?.x<"u"&&typeof n?.positionAbsolute?.y<"u";return[{x:n?.positionAbsolute?.x||0,y:n?.positionAbsolute?.y||0,width:n?.width||0,height:n?.height||0},r,!!o]}const zS=[{level:0,isMaxLevel:!0,edges:[]}];function OS(n,r,o=!1){let i=-1;const u=n.reduce((h,g)=>{const x=bn(g.zIndex);let m=x?g.zIndex:0;if(o){const p=r.get(g.target),b=r.get(g.source),v=g.selected||p?.selected||b?.selected,N=Math.max(b?.[ct]?.z||0,p?.[ct]?.z||0,1e3);m=(x?g.zIndex:0)+(v?N:0)}return h[m]?h[m].push(g):h[m]=[g],i=m>i?m:i,h},{}),f=Object.entries(u).map(([h,g])=>{const x=+h;return{edges:g,level:x,isMaxLevel:x===i}});return f.length===0?zS:f}function DS(n,r,o){const i=tt(j.useCallback(u=>n?u.edges.filter(f=>{const h=r.get(f.source),g=r.get(f.target);return h?.width&&h?.height&&g?.width&&g?.height&&RS({sourcePos:h.positionAbsolute||{x:0,y:0},targetPos:g.positionAbsolute||{x:0,y:0},sourceWidth:h.width,sourceHeight:h.height,targetWidth:g.width,targetHeight:g.height,width:u.width,height:u.height,transform:u.transform})}):u.edges,[n,r]));return OS(i,r,o)}const HS=({color:n="none",strokeWidth:r=1})=>le.createElement("polyline",{style:{stroke:n,strokeWidth:r},strokeLinecap:"round",strokeLinejoin:"round",fill:"none",points:"-5,-4 0,0 -5,4"}),$S=({color:n="none",strokeWidth:r=1})=>le.createElement("polyline",{style:{stroke:n,fill:n,strokeWidth:r},strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"}),i0={[Ba.Arrow]:HS,[Ba.ArrowClosed]:$S};function US(n){const r=wt();return j.useMemo(()=>Object.prototype.hasOwnProperty.call(i0,n)?i0[n]:(r.getState().onError?.("009",sa.error009(n)),null),[n])}const BS=({id:n,type:r,color:o,width:i=12.5,height:u=12.5,markerUnits:f="strokeWidth",strokeWidth:h,orient:g="auto-start-reverse"})=>{const x=US(r);return x?le.createElement("marker",{className:"react-flow__arrowhead",id:n,markerWidth:`${i}`,markerHeight:`${u}`,viewBox:"-10 -10 20 20",markerUnits:f,orient:g,refX:"0",refY:"0"},le.createElement(x,{color:o,strokeWidth:h})):null},qS=({defaultColor:n,rfId:r})=>o=>{const i=[];return o.edges.reduce((u,f)=>([f.markerStart,f.markerEnd].forEach(h=>{if(h&&typeof h=="object"){const g=Gd(h,r);i.includes(g)||(u.push({id:g,color:h.color||n,...h}),i.push(g))}}),u),[]).sort((u,f)=>u.id.localeCompare(f.id))},ny=({defaultColor:n,rfId:r})=>{const o=tt(j.useCallback(qS({defaultColor:n,rfId:r}),[n,r]),(i,u)=>!(i.length!==u.length||i.some((f,h)=>f.id!==u[h].id)));return le.createElement("defs",null,o.map(i=>le.createElement(BS,{id:i.id,key:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient})))};ny.displayName="MarkerDefinitions";var LS=j.memo(ny);const YS=n=>({nodesConnectable:n.nodesConnectable,edgesFocusable:n.edgesFocusable,edgesUpdatable:n.edgesUpdatable,elementsSelectable:n.elementsSelectable,width:n.width,height:n.height,connectionMode:n.connectionMode,nodeInternals:n.nodeInternals,onError:n.onError}),ay=({defaultMarkerColor:n,onlyRenderVisibleElements:r,elevateEdgesOnSelect:o,rfId:i,edgeTypes:u,noPanClassName:f,onEdgeContextMenu:h,onEdgeMouseEnter:g,onEdgeMouseMove:x,onEdgeMouseLeave:m,onEdgeClick:p,onEdgeDoubleClick:b,onReconnect:v,onReconnectStart:N,onReconnectEnd:C,reconnectRadius:k,children:R,disableKeyboardA11y:z})=>{const{edgesFocusable:V,edgesUpdatable:q,elementsSelectable:M,width:H,height:Z,connectionMode:X,nodeInternals:oe,onError:I}=tt(YS,Mt),K=DS(r,oe,o);return H?le.createElement(le.Fragment,null,K.map(({level:ae,edges:te,isMaxLevel:se})=>le.createElement("svg",{key:ae,style:{zIndex:ae},width:H,height:Z,className:"react-flow__edges react-flow__container"},se&&le.createElement(LS,{defaultColor:n,rfId:i}),le.createElement("g",null,te.map(_=>{const[W,E,$]=o0(oe.get(_.source)),[T,A,S]=o0(oe.get(_.target));if(!$||!S)return null;let D=_.type||"default";u[D]||(I?.("011",sa.error011(D)),D="default");const L=u[D]||u.default,F=X===ps.Strict?A.target:(A.target??[]).concat(A.source??[]),ie=r0(E.source,_.sourceHandle),he=r0(F,_.targetHandle),me=ie?.position||xe.Bottom,Se=he?.position||xe.Top,ve=!!(_.focusable||V&&typeof _.focusable>"u"),Ae=_.reconnectable||_.updatable,Re=typeof v<"u"&&(Ae||q&&typeof Ae>"u");if(!ie||!he)return I?.("008",sa.error008(ie,_)),null;const{sourceX:We,sourceY:Te,targetX:be,targetY:B}=AS(W,ie,me,T,he,Se);return le.createElement(L,{key:_.id,id:_.id,className:Ut([_.className,f]),type:D,data:_.data,selected:!!_.selected,animated:!!_.animated,hidden:!!_.hidden,label:_.label,labelStyle:_.labelStyle,labelShowBg:_.labelShowBg,labelBgStyle:_.labelBgStyle,labelBgPadding:_.labelBgPadding,labelBgBorderRadius:_.labelBgBorderRadius,style:_.style,source:_.source,target:_.target,sourceHandleId:_.sourceHandle,targetHandleId:_.targetHandle,markerEnd:_.markerEnd,markerStart:_.markerStart,sourceX:We,sourceY:Te,targetX:be,targetY:B,sourcePosition:me,targetPosition:Se,elementsSelectable:M,onContextMenu:h,onMouseEnter:g,onMouseMove:x,onMouseLeave:m,onClick:p,onEdgeDoubleClick:b,onReconnect:v,onReconnectStart:N,onReconnectEnd:C,reconnectRadius:k,rfId:i,ariaLabel:_.ariaLabel,isFocusable:ve,isReconnectable:Re,pathOptions:"pathOptions"in _?_.pathOptions:void 0,interactionWidth:_.interactionWidth,disableKeyboardA11y:z})})))),R):null};ay.displayName="EdgeRenderer";var VS=j.memo(ay);const GS=n=>`translate(${n.transform[0]}px,${n.transform[1]}px) scale(${n.transform[2]})`;function XS({children:n}){const r=tt(GS);return le.createElement("div",{className:"react-flow__viewport react-flow__container",style:{transform:r}},n)}function ZS(n){const r=gf(),o=j.useRef(!1);j.useEffect(()=>{!o.current&&r.viewportInitialized&&n&&(setTimeout(()=>n(r),1),o.current=!0)},[n,r.viewportInitialized])}const WS={[xe.Left]:xe.Right,[xe.Right]:xe.Left,[xe.Top]:xe.Bottom,[xe.Bottom]:xe.Top},sy=({nodeId:n,handleType:r,style:o,type:i=$a.Bezier,CustomComponent:u,connectionStatus:f})=>{const{fromNode:h,handleId:g,toX:x,toY:m,connectionMode:p}=tt(j.useCallback(Z=>({fromNode:Z.nodeInternals.get(n),handleId:Z.connectionHandleId,toX:(Z.connectionPosition.x-Z.transform[0])/Z.transform[2],toY:(Z.connectionPosition.y-Z.transform[1])/Z.transform[2],connectionMode:Z.connectionMode}),[n]),Mt),b=h?.[ct]?.handleBounds;let v=b?.[r];if(p===ps.Loose&&(v=v||b?.[r==="source"?"target":"source"]),!h||!v)return null;const N=g?v.find(Z=>Z.id===g):v[0],C=N?N.x+N.width/2:(h.width??0)/2,k=N?N.y+N.height/2:h.height??0,R=(h.positionAbsolute?.x??0)+C,z=(h.positionAbsolute?.y??0)+k,V=N?.position,q=V?WS[V]:null;if(!V||!q)return null;if(u)return le.createElement(u,{connectionLineType:i,connectionLineStyle:o,fromNode:h,fromHandle:N,fromX:R,fromY:z,toX:x,toY:m,fromPosition:V,toPosition:q,connectionStatus:f});let M="";const H={sourceX:R,sourceY:z,sourcePosition:V,targetX:x,targetY:m,targetPosition:q};return i===$a.Bezier?[M]=_g(H):i===$a.Step?[M]=Vd({...H,borderRadius:0}):i===$a.SmoothStep?[M]=Vd(H):i===$a.SimpleBezier?[M]=kg(H):M=`M${R},${z} ${x},${m}`,le.createElement("path",{d:M,fill:"none",className:"react-flow__connection-path",style:o})};sy.displayName="ConnectionLine";const QS=n=>({nodeId:n.connectionNodeId,handleType:n.connectionHandleType,nodesConnectable:n.nodesConnectable,connectionStatus:n.connectionStatus,width:n.width,height:n.height});function KS({containerStyle:n,style:r,type:o,component:i}){const{nodeId:u,handleType:f,nodesConnectable:h,width:g,height:x,connectionStatus:m}=tt(QS,Mt);return!(u&&f&&g&&h)?null:le.createElement("svg",{style:n,width:g,height:x,className:"react-flow__edges react-flow__connectionline react-flow__container"},le.createElement("g",{className:Ut(["react-flow__connection",m])},le.createElement(sy,{nodeId:u,handleType:f,style:r,type:o,CustomComponent:i,connectionStatus:m})))}function c0(n,r){return j.useRef(null),wt(),j.useMemo(()=>r(n),[n])}const ly=({nodeTypes:n,edgeTypes:r,onMove:o,onMoveStart:i,onMoveEnd:u,onInit:f,onNodeClick:h,onEdgeClick:g,onNodeDoubleClick:x,onEdgeDoubleClick:m,onNodeMouseEnter:p,onNodeMouseMove:b,onNodeMouseLeave:v,onNodeContextMenu:N,onSelectionContextMenu:C,onSelectionStart:k,onSelectionEnd:R,connectionLineType:z,connectionLineStyle:V,connectionLineComponent:q,connectionLineContainerStyle:M,selectionKeyCode:H,selectionOnDrag:Z,selectionMode:X,multiSelectionKeyCode:oe,panActivationKeyCode:I,zoomActivationKeyCode:K,deleteKeyCode:ae,onlyRenderVisibleElements:te,elementsSelectable:se,selectNodesOnDrag:_,defaultViewport:W,translateExtent:E,minZoom:$,maxZoom:T,preventScrolling:A,defaultMarkerColor:S,zoomOnScroll:D,zoomOnPinch:L,panOnScroll:F,panOnScrollSpeed:ie,panOnScrollMode:he,zoomOnDoubleClick:me,panOnDrag:Se,onPaneClick:ve,onPaneMouseEnter:Ae,onPaneMouseMove:Re,onPaneMouseLeave:We,onPaneScroll:Te,onPaneContextMenu:be,onEdgeContextMenu:B,onEdgeMouseEnter:Y,onEdgeMouseMove:ue,onEdgeMouseLeave:re,onReconnect:ee,onReconnectStart:Ee,onReconnectEnd:ge,reconnectRadius:ke,noDragClassName:Oe,noWheelClassName:ze,noPanClassName:At,elevateEdgesOnSelect:Rt,disableKeyboardA11y:ft,nodeOrigin:nt,nodeExtent:xt,rfId:at})=>{const pe=c0(n,wS),Ve=c0(r,MS);return ZS(f),le.createElement(jS,{onPaneClick:ve,onPaneMouseEnter:Ae,onPaneMouseMove:Re,onPaneMouseLeave:We,onPaneContextMenu:be,onPaneScroll:Te,deleteKeyCode:ae,selectionKeyCode:H,selectionOnDrag:Z,selectionMode:X,onSelectionStart:k,onSelectionEnd:R,multiSelectionKeyCode:oe,panActivationKeyCode:I,zoomActivationKeyCode:K,elementsSelectable:se,onMove:o,onMoveStart:i,onMoveEnd:u,zoomOnScroll:D,zoomOnPinch:L,zoomOnDoubleClick:me,panOnScroll:F,panOnScrollSpeed:ie,panOnScrollMode:he,panOnDrag:Se,defaultViewport:W,translateExtent:E,minZoom:$,maxZoom:T,onSelectionContextMenu:C,preventScrolling:A,noDragClassName:Oe,noWheelClassName:ze,noPanClassName:At,disableKeyboardA11y:ft},le.createElement(XS,null,le.createElement(VS,{edgeTypes:Ve,onEdgeClick:g,onEdgeDoubleClick:m,onlyRenderVisibleElements:te,onEdgeContextMenu:B,onEdgeMouseEnter:Y,onEdgeMouseMove:ue,onEdgeMouseLeave:re,onReconnect:ee,onReconnectStart:Ee,onReconnectEnd:ge,reconnectRadius:ke,defaultMarkerColor:S,noPanClassName:At,elevateEdgesOnSelect:!!Rt,disableKeyboardA11y:ft,rfId:at},le.createElement(KS,{style:V,type:z,component:q,containerStyle:M})),le.createElement("div",{className:"react-flow__edgelabel-renderer"}),le.createElement(kS,{nodeTypes:pe,onNodeClick:h,onNodeDoubleClick:x,onNodeMouseEnter:p,onNodeMouseMove:b,onNodeMouseLeave:v,onNodeContextMenu:N,selectNodesOnDrag:_,onlyRenderVisibleElements:te,noPanClassName:At,noDragClassName:Oe,disableKeyboardA11y:ft,nodeOrigin:nt,nodeExtent:xt,rfId:at})))};ly.displayName="GraphView";var JS=j.memo(ly);const Qd=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],Oa={rfId:"1",width:0,height:0,transform:[0,0,1],nodeInternals:new Map,edges:[],onNodesChange:null,onEdgesChange:null,hasDefaultNodes:!1,hasDefaultEdges:!1,d3Zoom:null,d3Selection:null,d3ZoomHandler:void 0,minZoom:.5,maxZoom:2,translateExtent:Qd,nodeExtent:Qd,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionNodeId:null,connectionHandleId:null,connectionHandleType:"source",connectionPosition:{x:0,y:0},connectionStatus:null,connectionMode:ps.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:[0,0],nodeDragThreshold:0,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesUpdatable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,fitViewOnInit:!1,fitViewOnInitDone:!1,fitViewOnInitOptions:void 0,onSelectionChange:[],multiSelectionActive:!1,connectionStartHandle:null,connectionEndHandle:null,connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,connectionRadius:20,onError:S5,isValidConnection:void 0},IS=()=>B2((n,r)=>({...Oa,setNodes:o=>{const{nodeInternals:i,nodeOrigin:u,elevateNodesOnSelect:f}=r();n({nodeInternals:wd(o,i,u,f)})},getNodes:()=>Array.from(r().nodeInternals.values()),setEdges:o=>{const{defaultEdgeOptions:i={}}=r();n({edges:o.map(u=>({...i,...u}))})},setDefaultNodesAndEdges:(o,i)=>{const u=typeof o<"u",f=typeof i<"u",h=u?wd(o,new Map,r().nodeOrigin,r().elevateNodesOnSelect):new Map;n({nodeInternals:h,edges:f?i:[],hasDefaultNodes:u,hasDefaultEdges:f})},updateNodeDimensions:o=>{const{onNodesChange:i,nodeInternals:u,fitViewOnInit:f,fitViewOnInitDone:h,fitViewOnInitOptions:g,domNode:x,nodeOrigin:m}=r(),p=x?.querySelector(".react-flow__viewport");if(!p)return;const b=window.getComputedStyle(p),{m22:v}=new window.DOMMatrixReadOnly(b.transform),N=o.reduce((k,R)=>{const z=u.get(R.id);if(z?.hidden)u.set(z.id,{...z,[ct]:{...z[ct],handleBounds:void 0}});else if(z){const V=cf(R.nodeElement);!!(V.width&&V.height&&(z.width!==V.width||z.height!==V.height||R.forceUpdate))&&(u.set(z.id,{...z,[ct]:{...z[ct],handleBounds:{source:n0(".source",R.nodeElement,v,m),target:n0(".target",R.nodeElement,v,m)}},...V}),k.push({id:z.id,type:"dimensions",dimensions:V}))}return k},[]);Xg(u,m);const C=h||f&&!h&&Zg(r,{initial:!0,...g});n({nodeInternals:new Map(u),fitViewOnInitDone:C}),N?.length>0&&i?.(N)},updateNodePositions:(o,i=!0,u=!1)=>{const{triggerNodeChanges:f}=r(),h=o.map(g=>{const x={id:g.id,type:"position",dragging:u};return i&&(x.positionAbsolute=g.positionAbsolute,x.position=g.position),x});f(h)},triggerNodeChanges:o=>{const{onNodesChange:i,nodeInternals:u,hasDefaultNodes:f,nodeOrigin:h,getNodes:g,elevateNodesOnSelect:x}=r();if(o?.length){if(f){const m=Qg(o,g()),p=wd(m,u,h,x);n({nodeInternals:p})}i?.(o)}},addSelectedNodes:o=>{const{multiSelectionActive:i,edges:u,getNodes:f}=r();let h,g=null;i?h=o.map(x=>Ha(x,!0)):(h=cl(f(),o),g=cl(u,[])),ji({changedNodes:h,changedEdges:g,get:r,set:n})},addSelectedEdges:o=>{const{multiSelectionActive:i,edges:u,getNodes:f}=r();let h,g=null;i?h=o.map(x=>Ha(x,!0)):(h=cl(u,o),g=cl(f(),[])),ji({changedNodes:g,changedEdges:h,get:r,set:n})},unselectNodesAndEdges:({nodes:o,edges:i}={})=>{const{edges:u,getNodes:f}=r(),h=o||f(),g=i||u,x=h.map(p=>(p.selected=!1,Ha(p.id,!1))),m=g.map(p=>Ha(p.id,!1));ji({changedNodes:x,changedEdges:m,get:r,set:n})},setMinZoom:o=>{const{d3Zoom:i,maxZoom:u}=r();i?.scaleExtent([o,u]),n({minZoom:o})},setMaxZoom:o=>{const{d3Zoom:i,minZoom:u}=r();i?.scaleExtent([u,o]),n({maxZoom:o})},setTranslateExtent:o=>{r().d3Zoom?.translateExtent(o),n({translateExtent:o})},resetSelectedElements:()=>{const{edges:o,getNodes:i}=r(),f=i().filter(g=>g.selected).map(g=>Ha(g.id,!1)),h=o.filter(g=>g.selected).map(g=>Ha(g.id,!1));ji({changedNodes:f,changedEdges:h,get:r,set:n})},setNodeExtent:o=>{const{nodeInternals:i}=r();i.forEach(u=>{u.positionAbsolute=uf(u.position,o)}),n({nodeExtent:o,nodeInternals:new Map(i)})},panBy:o=>{const{transform:i,width:u,height:f,d3Zoom:h,d3Selection:g,translateExtent:x}=r();if(!h||!g||!o.x&&!o.y)return!1;const m=ta.translate(i[0]+o.x,i[1]+o.y).scale(i[2]),p=[[0,0],[u,f]],b=h?.constrain()(m,p,x);return h.transform(g,b),i[0]!==b.x||i[1]!==b.y||i[2]!==b.k},cancelConnection:()=>n({connectionNodeId:Oa.connectionNodeId,connectionHandleId:Oa.connectionHandleId,connectionHandleType:Oa.connectionHandleType,connectionStatus:Oa.connectionStatus,connectionStartHandle:Oa.connectionStartHandle,connectionEndHandle:Oa.connectionEndHandle}),reset:()=>n({...Oa})}),Object.is),ry=({children:n})=>{const r=j.useRef(null);return r.current||(r.current=IS()),le.createElement(g5,{value:r.current},n)};ry.displayName="ReactFlowProvider";const oy=({children:n})=>j.useContext(Qi)?le.createElement(le.Fragment,null,n):le.createElement(ry,null,n);oy.displayName="ReactFlowWrapper";const FS={input:Ug,default:Zd,output:qg,group:xf},PS={default:Li,straight:hf,step:ff,smoothstep:Ki,simplebezier:df},e3=[0,0],t3=[15,15],n3={x:0,y:0,zoom:1},a3={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0},bf=j.forwardRef(({nodes:n,edges:r,defaultNodes:o,defaultEdges:i,className:u,nodeTypes:f=FS,edgeTypes:h=PS,onNodeClick:g,onEdgeClick:x,onInit:m,onMove:p,onMoveStart:b,onMoveEnd:v,onConnect:N,onConnectStart:C,onConnectEnd:k,onClickConnectStart:R,onClickConnectEnd:z,onNodeMouseEnter:V,onNodeMouseMove:q,onNodeMouseLeave:M,onNodeContextMenu:H,onNodeDoubleClick:Z,onNodeDragStart:X,onNodeDrag:oe,onNodeDragStop:I,onNodesDelete:K,onEdgesDelete:ae,onSelectionChange:te,onSelectionDragStart:se,onSelectionDrag:_,onSelectionDragStop:W,onSelectionContextMenu:E,onSelectionStart:$,onSelectionEnd:T,connectionMode:A=ps.Strict,connectionLineType:S=$a.Bezier,connectionLineStyle:D,connectionLineComponent:L,connectionLineContainerStyle:F,deleteKeyCode:ie="Backspace",selectionKeyCode:he="Shift",selectionOnDrag:me=!1,selectionMode:Se=qr.Full,panActivationKeyCode:ve="Space",multiSelectionKeyCode:Ae=qi()?"Meta":"Control",zoomActivationKeyCode:Re=qi()?"Meta":"Control",snapToGrid:We=!1,snapGrid:Te=t3,onlyRenderVisibleElements:be=!1,selectNodesOnDrag:B=!0,nodesDraggable:Y,nodesConnectable:ue,nodesFocusable:re,nodeOrigin:ee=e3,edgesFocusable:Ee,edgesUpdatable:ge,elementsSelectable:ke,defaultViewport:Oe=n3,minZoom:ze=.5,maxZoom:At=2,translateExtent:Rt=Qd,preventScrolling:ft=!0,nodeExtent:nt,defaultMarkerColor:xt="#b1b1b7",zoomOnScroll:at=!0,zoomOnPinch:pe=!0,panOnScroll:Ve=!1,panOnScrollSpeed:je=.5,panOnScrollMode:Le=us.Free,zoomOnDoubleClick:Ge=!0,panOnDrag:zt=!0,onPaneClick:Vt,onPaneMouseEnter:It,onPaneMouseMove:Nl,onPaneMouseLeave:ys,onPaneScroll:la,onPaneContextMenu:Ya,children:ra,onEdgeContextMenu:Dn,onEdgeDoubleClick:Qr,onEdgeMouseEnter:Kr,onEdgeMouseMove:wl,onEdgeMouseLeave:Sl,onEdgeUpdate:Jr,onEdgeUpdateStart:Ii,onEdgeUpdateEnd:_n,onReconnect:St,onReconnectStart:Bt,onReconnectEnd:oa,reconnectRadius:El=10,edgeUpdaterRadius:Fi=10,onNodesChange:Pi,onEdgesChange:Ir,noDragClassName:Va="nodrag",noWheelClassName:kl="nowheel",noPanClassName:Hn="nopan",fitView:ia=!1,fitViewOptions:Ga,connectOnClick:ca=!0,attributionPosition:gt,proOptions:Fr,defaultEdgeOptions:Pr,elevateNodesOnSelect:$n=!0,elevateEdgesOnSelect:ua=!1,disableKeyboardA11y:eo=!1,autoPanOnConnect:to=!0,autoPanOnNodeDrag:no=!0,connectionRadius:ec=20,isValidConnection:bs,onError:vs,style:vn,id:js,nodeDragThreshold:ao,...da},_l)=>{const Xa=js||"1";return le.createElement("div",{...da,style:{...vn,...a3},ref:_l,className:Ut(["react-flow",u]),"data-testid":"rf__wrapper",id:js},le.createElement(oy,null,le.createElement(JS,{onInit:m,onMove:p,onMoveStart:b,onMoveEnd:v,onNodeClick:g,onEdgeClick:x,onNodeMouseEnter:V,onNodeMouseMove:q,onNodeMouseLeave:M,onNodeContextMenu:H,onNodeDoubleClick:Z,nodeTypes:f,edgeTypes:h,connectionLineType:S,connectionLineStyle:D,connectionLineComponent:L,connectionLineContainerStyle:F,selectionKeyCode:he,selectionOnDrag:me,selectionMode:Se,deleteKeyCode:ie,multiSelectionKeyCode:Ae,panActivationKeyCode:ve,zoomActivationKeyCode:Re,onlyRenderVisibleElements:be,selectNodesOnDrag:B,defaultViewport:Oe,translateExtent:Rt,minZoom:ze,maxZoom:At,preventScrolling:ft,zoomOnScroll:at,zoomOnPinch:pe,zoomOnDoubleClick:Ge,panOnScroll:Ve,panOnScrollSpeed:je,panOnScrollMode:Le,panOnDrag:zt,onPaneClick:Vt,onPaneMouseEnter:It,onPaneMouseMove:Nl,onPaneMouseLeave:ys,onPaneScroll:la,onPaneContextMenu:Ya,onSelectionContextMenu:E,onSelectionStart:$,onSelectionEnd:T,onEdgeContextMenu:Dn,onEdgeDoubleClick:Qr,onEdgeMouseEnter:Kr,onEdgeMouseMove:wl,onEdgeMouseLeave:Sl,onReconnect:St??Jr,onReconnectStart:Bt??Ii,onReconnectEnd:oa??_n,reconnectRadius:El??Fi,defaultMarkerColor:xt,noDragClassName:Va,noWheelClassName:kl,noPanClassName:Hn,elevateEdgesOnSelect:ua,rfId:Xa,disableKeyboardA11y:eo,nodeOrigin:ee,nodeExtent:nt}),le.createElement(W5,{nodes:n,edges:r,defaultNodes:o,defaultEdges:i,onConnect:N,onConnectStart:C,onConnectEnd:k,onClickConnectStart:R,onClickConnectEnd:z,nodesDraggable:Y,nodesConnectable:ue,nodesFocusable:re,edgesFocusable:Ee,edgesUpdatable:ge,elementsSelectable:ke,elevateNodesOnSelect:$n,minZoom:ze,maxZoom:At,nodeExtent:nt,onNodesChange:Pi,onEdgesChange:Ir,snapToGrid:We,snapGrid:Te,connectionMode:A,translateExtent:Rt,connectOnClick:ca,defaultEdgeOptions:Pr,fitView:ia,fitViewOptions:Ga,onNodesDelete:K,onEdgesDelete:ae,onNodeDragStart:X,onNodeDrag:oe,onNodeDragStop:I,onSelectionDrag:_,onSelectionDragStart:se,onSelectionDragStop:W,noPanClassName:Hn,nodeOrigin:ee,rfId:Xa,autoPanOnConnect:to,autoPanOnNodeDrag:no,onError:vs,connectionRadius:ec,isValidConnection:bs,nodeDragThreshold:ao}),le.createElement(X5,{onSelectionChange:te}),ra,le.createElement(b5,{proOptions:Fr,position:gt}),le.createElement(F5,{rfId:Xa,disableKeyboardA11y:eo})))});bf.displayName="ReactFlow";function iy(n){return r=>{const[o,i]=j.useState(r),u=j.useCallback(f=>i(h=>n(f,h)),[]);return[o,i,u]}}const cy=iy(Qg),uy=iy(fS),dy=({id:n,x:r,y:o,width:i,height:u,style:f,color:h,strokeColor:g,strokeWidth:x,className:m,borderRadius:p,shapeRendering:b,onClick:v,selected:N})=>{const{background:C,backgroundColor:k}=f||{},R=h||C||k;return le.createElement("rect",{className:Ut(["react-flow__minimap-node",{selected:N},m]),x:r,y:o,rx:p,ry:p,width:i,height:u,fill:R,stroke:g,strokeWidth:x,shapeRendering:b,onClick:v?z=>v(z,n):void 0})};dy.displayName="MiniMapNode";var s3=j.memo(dy);const l3=n=>n.nodeOrigin,r3=n=>n.getNodes().filter(r=>!r.hidden&&r.width&&r.height),_d=n=>n instanceof Function?n:()=>n;function o3({nodeStrokeColor:n="transparent",nodeColor:r="#e2e2e2",nodeClassName:o="",nodeBorderRadius:i=5,nodeStrokeWidth:u=2,nodeComponent:f=s3,onClick:h}){const g=tt(r3,Mt),x=tt(l3),m=_d(r),p=_d(n),b=_d(o),v=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return le.createElement(le.Fragment,null,g.map(N=>{const{x:C,y:k}=fs(N,x).positionAbsolute;return le.createElement(f,{key:N.id,x:C,y:k,width:N.width,height:N.height,style:N.style,selected:N.selected,className:b(N),color:m(N),borderRadius:i,strokeColor:p(N),strokeWidth:u,shapeRendering:v,onClick:h,id:N.id})}))}var i3=j.memo(o3);const c3=200,u3=150,d3=n=>{const r=n.getNodes(),o={x:-n.transform[0]/n.transform[2],y:-n.transform[1]/n.transform[2],width:n.width/n.transform[2],height:n.height/n.transform[2]};return{viewBB:o,boundingRect:r.length>0?N5(Ji(r,n.nodeOrigin),o):o,rfId:n.rfId}},f3="react-flow__minimap-desc";function fy({style:n,className:r,nodeStrokeColor:o="transparent",nodeColor:i="#e2e2e2",nodeClassName:u="",nodeBorderRadius:f=5,nodeStrokeWidth:h=2,nodeComponent:g,maskColor:x="rgb(240, 240, 240, 0.6)",maskStrokeColor:m="none",maskStrokeWidth:p=1,position:b="bottom-right",onClick:v,onNodeClick:N,pannable:C=!1,zoomable:k=!1,ariaLabel:R="React Flow mini map",inversePan:z=!1,zoomStep:V=10,offsetScale:q=5}){const M=wt(),H=j.useRef(null),{boundingRect:Z,viewBB:X,rfId:oe}=tt(d3,Mt),I=n?.width??c3,K=n?.height??u3,ae=Z.width/I,te=Z.height/K,se=Math.max(ae,te),_=se*I,W=se*K,E=q*se,$=Z.x-(_-Z.width)/2-E,T=Z.y-(W-Z.height)/2-E,A=_+E*2,S=W+E*2,D=`${f3}-${oe}`,L=j.useRef(0);L.current=se,j.useEffect(()=>{if(H.current){const he=yn(H.current),me=Ae=>{const{transform:Re,d3Selection:We,d3Zoom:Te}=M.getState();if(Ae.sourceEvent.type!=="wheel"||!We||!Te)return;const be=-Ae.sourceEvent.deltaY*(Ae.sourceEvent.deltaMode===1?.05:Ae.sourceEvent.deltaMode?1:.002)*V,B=Re[2]*Math.pow(2,be);Te.scaleTo(We,B)},Se=Ae=>{const{transform:Re,d3Selection:We,d3Zoom:Te,translateExtent:be,width:B,height:Y}=M.getState();if(Ae.sourceEvent.type!=="mousemove"||!We||!Te)return;const ue=L.current*Math.max(1,Re[2])*(z?-1:1),re={x:Re[0]-Ae.sourceEvent.movementX*ue,y:Re[1]-Ae.sourceEvent.movementY*ue},ee=[[0,0],[B,Y]],Ee=ta.translate(re.x,re.y).scale(Re[2]),ge=Te.constrain()(Ee,ee,be);Te.transform(We,ge)},ve=xg().on("zoom",C?Se:null).on("zoom.wheel",k?me:null);return he.call(ve),()=>{he.on("zoom",null)}}},[C,k,z,V]);const F=v?he=>{const me=Sn(he);v(he,{x:me[0],y:me[1]})}:void 0,ie=N?(he,me)=>{const Se=M.getState().nodeInternals.get(me);N(he,Se)}:void 0;return le.createElement(of,{position:b,style:n,className:Ut(["react-flow__minimap",r]),"data-testid":"rf__minimap"},le.createElement("svg",{width:I,height:K,viewBox:`${$} ${T} ${A} ${S}`,role:"img","aria-labelledby":D,ref:H,onClick:F},R&&le.createElement("title",{id:D},R),le.createElement(i3,{onClick:ie,nodeColor:i,nodeStrokeColor:o,nodeBorderRadius:f,nodeClassName:u,nodeStrokeWidth:h,nodeComponent:g}),le.createElement("path",{className:"react-flow__minimap-mask",d:`M${$-E},${T-E}h${A+E*2}v${S+E*2}h${-A-E*2}z
412
+ M${X.x},${X.y}h${X.width}v${X.height}h${-X.width}z`,fill:x,fillRule:"evenodd",stroke:m,strokeWidth:p,pointerEvents:"none"})))}fy.displayName="MiniMap";var h3=j.memo(fy);function m3(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32"},le.createElement("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"}))}function p3(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5"},le.createElement("path",{d:"M0 0h32v4.2H0z"}))}function x3(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30"},le.createElement("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 g3(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},le.createElement("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 y3(){return le.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32"},le.createElement("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"}))}const Ar=({children:n,className:r,...o})=>le.createElement("button",{type:"button",className:Ut(["react-flow__controls-button",r]),...o},n);Ar.displayName="ControlButton";const b3=n=>({isInteractive:n.nodesDraggable||n.nodesConnectable||n.elementsSelectable,minZoomReached:n.transform[2]<=n.minZoom,maxZoomReached:n.transform[2]>=n.maxZoom}),hy=({style:n,showZoom:r=!0,showFitView:o=!0,showInteractive:i=!0,fitViewOptions:u,onZoomIn:f,onZoomOut:h,onFitView:g,onInteractiveChange:x,className:m,children:p,position:b="bottom-left"})=>{const v=wt(),[N,C]=j.useState(!1),{isInteractive:k,minZoomReached:R,maxZoomReached:z}=tt(b3,Mt),{zoomIn:V,zoomOut:q,fitView:M}=gf();if(j.useEffect(()=>{C(!0)},[]),!N)return null;const H=()=>{V(),f?.()},Z=()=>{q(),h?.()},X=()=>{M(u),g?.()},oe=()=>{v.setState({nodesDraggable:!k,nodesConnectable:!k,elementsSelectable:!k}),x?.(!k)};return le.createElement(of,{className:Ut(["react-flow__controls",m]),position:b,style:n,"data-testid":"rf__controls"},r&&le.createElement(le.Fragment,null,le.createElement(Ar,{onClick:H,className:"react-flow__controls-zoomin",title:"zoom in","aria-label":"zoom in",disabled:z},le.createElement(m3,null)),le.createElement(Ar,{onClick:Z,className:"react-flow__controls-zoomout",title:"zoom out","aria-label":"zoom out",disabled:R},le.createElement(p3,null))),o&&le.createElement(Ar,{className:"react-flow__controls-fitview",onClick:X,title:"fit view","aria-label":"fit view"},le.createElement(x3,null)),i&&le.createElement(Ar,{className:"react-flow__controls-interactive",onClick:oe,title:"toggle interactivity","aria-label":"toggle interactivity"},k?le.createElement(y3,null):le.createElement(g3,null)),p)};hy.displayName="Controls";var my=j.memo(hy),rn;(function(n){n.Lines="lines",n.Dots="dots",n.Cross="cross"})(rn||(rn={}));function v3({color:n,dimensions:r,lineWidth:o}){return le.createElement("path",{stroke:n,strokeWidth:o,d:`M${r[0]/2} 0 V${r[1]} M0 ${r[1]/2} H${r[0]}`})}function j3({color:n,radius:r}){return le.createElement("circle",{cx:r,cy:r,r,fill:n})}const N3={[rn.Dots]:"#91919a",[rn.Lines]:"#eee",[rn.Cross]:"#e2e2e2"},w3={[rn.Dots]:1,[rn.Lines]:1,[rn.Cross]:6},S3=n=>({transform:n.transform,patternId:`pattern-${n.rfId}`});function py({id:n,variant:r=rn.Dots,gap:o=20,size:i,lineWidth:u=1,offset:f=2,color:h,style:g,className:x}){const m=j.useRef(null),{transform:p,patternId:b}=tt(S3,Mt),v=h||N3[r],N=i||w3[r],C=r===rn.Dots,k=r===rn.Cross,R=Array.isArray(o)?o:[o,o],z=[R[0]*p[2]||1,R[1]*p[2]||1],V=N*p[2],q=k?[V,V]:z,M=C?[V/f,V/f]:[q[0]/f,q[1]/f];return le.createElement("svg",{className:Ut(["react-flow__background",x]),style:{...g,position:"absolute",width:"100%",height:"100%",top:0,left:0},ref:m,"data-testid":"rf__background"},le.createElement("pattern",{id:b+n,x:p[0]%z[0],y:p[1]%z[1],width:z[0],height:z[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${M[0]},-${M[1]})`},C?le.createElement(j3,{color:v,radius:V/f}):le.createElement(v3,{dimensions:q,color:v,lineWidth:u})),le.createElement("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${b+n})`}))}py.displayName="Background";var xy=j.memo(py);const u0={GET:{bg:"bg-emerald-500/10",text:"text-emerald-400",dot:"#34d399"},POST:{bg:"bg-[color:var(--brand)]/10",text:"text-[color:var(--brand)]",dot:"var(--brand)"},PUT:{bg:"bg-amber-500/10",text:"text-amber-400",dot:"#fbbf24"},PATCH:{bg:"bg-orange-500/10",text:"text-orange-400",dot:"#fb923c"},DELETE:{bg:"bg-red-500/10",text:"text-red-400",dot:"#f87171"},HEAD:{bg:"theme-bg-overlay-md",text:"theme-text-muted",dot:"var(--text-muted)"},OPTIONS:{bg:"bg-[color:var(--brand)]/10",text:"text-[color:var(--brand)]",dot:"var(--brand)"}};function vf(n){return u0[n.toUpperCase()]??u0.GET}const d0=["exists","not_exists","is_empty","is_not_empty"];function f0(n,r){return n.replace(/\{\{([^}]+)\}\}/g,(o,i)=>{const u=i.trim();if(u.includes(":")){const f=u.indexOf(":"),h=u.slice(0,f),g=u.slice(f+1);return r[`${h}:${g}`]??r[g]??""}return r[u]??""})}function E3(n,r){const o=f0(n.left,r),i=n.right!==void 0?f0(n.right,r):void 0;switch(n.operator){case"equals":return o===i;case"not_equals":return o!==i;case"greater_than":return Number(o)>Number(i);case"greater_than_or_equal":return Number(o)>=Number(i);case"less_than":return Number(o)<Number(i);case"less_than_or_equal":return Number(o)<=Number(i);case"exists":return o!==""&&o!==void 0;case"not_exists":return o===""||o===void 0;case"is_empty":return o===""||o===null;case"is_not_empty":return o!==""&&o!==null;case"contains":return i!==void 0&&o.includes(i);case"not_contains":return i!==void 0&&!o.includes(i);case"starts_with":return i!==void 0&&o.startsWith(i);case"ends_with":return i!==void 0&&o.endsWith(i);default:return!1}}function k3(n,r){const{rules:o}=n,i=o?.all??o?.any??[],u=!!o?.all;if(i.length===0)return{passed:!0,reason:"No rules"};const f=i.map(m=>({rule:m,ok:E3(m,r)})),h=u?f.every(m=>m.ok):f.some(m=>m.ok),g=f.filter(m=>!m.ok),x=h?`All conditions met (${u?"AND":"OR"})`:`Failed: ${g.map(m=>`${m.rule.left} ${m.rule.operator}${m.rule.right!==void 0?" "+m.rule.right:""}`).join(", ")}`;return{passed:h,reason:x}}async function _3(n,r){const o=n.replace(/^workflows\//,"").replace(/\.json$/,"");await fetch(`/api/workflows/${encodeURIComponent(o)}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({steps:r})})}function C3({method:n}){const r=vf(n);return s.jsx("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium tracking-widest ${r.bg} ${r.text}`,children:n.toUpperCase()})}async function T3(){const n=await fetch("/api/workflows");if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}async function M3(n){const r=n.replace(/^workflows\//,"").replace(/\.json$/,""),o=await fetch(`/api/workflows/${encodeURIComponent(r)}`,{method:"DELETE"});if(!o.ok){const i=await o.json().catch(()=>({}));throw new Error(i.error??`HTTP ${o.status}`)}}const h0=/\{\{\s*human:([^}]+?)\s*\}\}/g;function jf(n){const r=new Set;for(const o of[n.path,JSON.stringify(n.body??{}),JSON.stringify(n.inject??{}),JSON.stringify(n.condition??{})]){if(!o)continue;h0.lastIndex=0;let i;for(;(i=h0.exec(o))!==null;){const u=i[1].trim();u&&r.add(u)}}return[...r]}function A3(n){const r=new Set;return n.forEach(o=>jf(o).forEach(i=>r.add(i))),[...r]}function R3(n){return/pass|secret|token|pwd|private|credential/i.test(n)}function z3({title:n,subtitle:r,fields:o,values:i,onChange:u,onSubmit:f,onCancel:h,submitLabel:g,error:x,submitting:m}){return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4",children:s.jsxs("div",{className:"w-full max-w-sm rounded-xl border border-amber-500/25 theme-bg-overlay shadow-2xl",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 border-b theme-border",children:[s.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-amber-500/15 text-amber-400",children:s.jsx(zr,{className:"h-3.5 w-3.5",strokeWidth:2})}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-[12px] font-medium theme-text-primary",children:n}),r&&s.jsx("p",{className:"text-[10px] theme-text-faint truncate",children:r})]})]}),s.jsxs("div",{className:"space-y-2.5 p-4",children:[s.jsx("p",{className:"text-[11px] theme-text-muted",children:"This workflow needs a value only you know. The run stays paused until you answer."}),o.map(p=>s.jsxs("div",{children:[s.jsx("label",{className:"mb-1 block font-mono text-[10px] text-amber-400/90",children:`{{human:${p.key}}}`}),s.jsx("input",{autoFocus:o.length===1,type:R3(p.key)?"password":"text",value:i[p.key]??"",onChange:b=>u(p.key,b.target.value),onKeyDown:b=>{b.key==="Enter"&&f()},placeholder:p.hint??`Enter ${p.key}…`,className:"h-8 w-full rounded-lg border border-amber-500/30 theme-bg-overlay-md px-2.5 text-[12px] theme-text-primary placeholder-[var(--text-faint)] outline-none focus:border-amber-500/70 transition-colors"})]},p.key)),x&&s.jsx("p",{className:"text-[10px] text-red-400 leading-tight",children:x}),s.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[s.jsxs("button",{type:"button",onClick:f,disabled:!!m,className:"flex h-8 flex-1 items-center justify-center gap-1.5 rounded-lg bg-amber-500/20 border border-amber-500/40 px-3 text-[11px] font-medium text-amber-300 hover:bg-amber-500/30 transition-colors disabled:opacity-40 hover:cursor-pointer",children:[m?s.jsx(dt,{className:"h-3 w-3 animate-spin",strokeWidth:2}):s.jsx(ut,{className:"h-3 w-3",strokeWidth:2}),g]}),h&&s.jsxs("button",{type:"button",onClick:h,className:"flex h-8 items-center gap-1 rounded-lg border theme-border px-3 text-[11px] theme-text-muted hover:theme-text transition-colors hover:cursor-pointer",children:[s.jsx(Tt,{className:"h-3 w-3",strokeWidth:2})," Cancel run"]})]})]})]})})}const gy=230,Kd=64;function O3({data:n}){const r=vf(n.method),o={idle:"theme-border",running:"border-[color:var(--brand)]/60",passed:"border-emerald-500/40",failed:"border-red-500/40",skipped:"theme-border"},i={idle:"",running:"shadow-[0_0_12px_color-mix(in_srgb,var(--brand)_28%,transparent)]",passed:"shadow-[0_0_8px_rgba(52,211,153,0.15)]",failed:"shadow-[0_0_8px_rgba(248,113,113,0.15)]",skipped:""},u=n.status??"idle";return s.jsxs("div",{className:`rounded-lg border theme-bg-overlay flex items-center gap-2.5 px-3 overflow-hidden transition-all duration-300 ${o[u]} ${i[u]}`,style:{width:gy,height:Kd},children:[s.jsx(Nt,{type:"target",position:xe.Top,style:{background:"transparent",border:"none"}}),s.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-[3px] transition-colors duration-300",style:{background:u==="running"?"var(--brand)":u==="passed"?r.dot:u==="failed"?"#f87171":`color-mix(in srgb, ${r.dot} 40%, transparent)`}}),s.jsxs("div",{className:"shrink-0 flex items-center justify-center",children:[u==="running"&&s.jsx(dt,{className:"h-3.5 w-3.5 text-[color:var(--brand)] animate-spin",strokeWidth:2}),u==="passed"&&s.jsx(ut,{className:"h-3.5 w-3.5 text-emerald-400",strokeWidth:2}),u==="failed"&&s.jsx(Ct,{className:"h-3.5 w-3.5 text-red-400",strokeWidth:2}),u==="idle"&&s.jsx("span",{className:"flex h-3.5 w-3.5 items-center justify-center rounded-full border theme-border text-[8px] font-medium theme-text-faint",children:n.index+1}),u==="skipped"&&s.jsx("span",{className:"h-3.5 w-3.5 rounded-full border theme-border theme-bg-overlay-md"})]}),s.jsxs("div",{className:"min-w-0 flex-1 pl-0.5",children:[s.jsxs("div",{className:"flex items-center gap-1.5 mb-0.5",children:[s.jsx("span",{className:`text-[9px] font-medium ${r.text}`,children:n.method}),s.jsx("span",{className:"font-mono text-[10px] theme-text truncate",children:n.path}),n.result&&s.jsxs("span",{className:`ml-auto shrink-0 font-mono text-[9px] ${n.result.passed?"text-emerald-400":"text-red-400"}`,children:[n.result.status>0?n.result.status:"ERR"," · ",n.result.durationMs,"ms"]})]}),s.jsx("p",{className:"text-[9px] theme-text-faint truncate",children:n.name})]}),s.jsx(Nt,{type:"source",position:xe.Bottom,style:{background:"transparent",border:"none"}})]})}function D3({data:n}){const r=n.passed,o=r===void 0?"color-mix(in srgb, var(--brand) 50%, transparent)":r?"rgba(52,211,153,0.7)":"rgba(248,113,113,0.7)";return s.jsxs("div",{style:{width:40,height:40,position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[s.jsx(Nt,{type:"target",position:xe.Top,style:{background:"transparent",border:"none"}}),s.jsxs("svg",{width:"40",height:"40",viewBox:"0 0 40 40",children:[s.jsx("polygon",{points:"20,2 38,20 20,38 2,20",fill:"none",stroke:o,strokeWidth:"1.5"}),s.jsx("polygon",{points:"20,8 32,20 20,32 8,20",fill:o,fillOpacity:.12,stroke:"none"})]}),s.jsx("span",{style:{position:"absolute",fontSize:8,fontFamily:"monospace",color:o,top:"50%",left:"50%",transform:"translate(-50%,-50%)",whiteSpace:"nowrap"},children:"◇"}),s.jsx(Nt,{type:"source",position:xe.Bottom,style:{background:"transparent",border:"none"}})]})}const H3={step:O3,condition:D3};function $3({steps:n,runState:r}){const[o,i,u]=cy([]),[f,h,g]=uy([]);j.useEffect(()=>{const v=[],N=[];let C=40;for(let k=0;k<n.length;k++){const R=n[k],z=r.stepStatuses[k]??"idle",V=r.stepResults[k]??null;if(v.push({id:`step-${k}`,type:"step",position:{x:0,y:C},data:{index:k,name:R.name,method:R.method,path:R.path,status:z,result:V}}),C+=Kd+36,R.condition){const q=`cond-${k}`,M=V?.conditionResult;v.push({id:q,type:"condition",position:{x:gy/2-20,y:C},data:{passed:M?.passed}});const H=z==="passed"?"rgba(52,211,153,0.3)":z==="failed"?"rgba(248,113,113,0.3)":"color-mix(in srgb, var(--brand) 18%, transparent)";if(N.push({id:`e-${k}-cond`,source:`step-${k}`,target:q,style:{stroke:H,strokeWidth:1.5},markerEnd:{type:Ba.ArrowClosed,color:H},animated:z==="running"}),C+=64,k<n.length-1){const Z=M?.passed===!0?"rgba(52,211,153,0.5)":"color-mix(in srgb, var(--brand) 18%, transparent)",X=M?.passed===!1?"rgba(248,113,113,0.5)":"color-mix(in srgb, var(--brand) 10%, transparent)";N.push({id:`e-${k}-cond-pass`,source:q,target:`step-${k+1}`,label:"PASS",labelStyle:{fill:"rgba(52,211,153,0.8)",fontSize:8,fontFamily:"monospace"},labelBgStyle:{fill:"transparent"},style:{stroke:Z,strokeWidth:1.2},markerEnd:{type:Ba.ArrowClosed,color:Z}}),N.push({id:`e-${k}-cond-fail`,source:q,target:`step-${k+1}`,label:`FAIL→${R.condition.onFail.toUpperCase()}`,labelStyle:{fill:"rgba(248,113,113,0.8)",fontSize:8,fontFamily:"monospace"},labelBgStyle:{fill:"transparent"},style:{stroke:X,strokeWidth:1.2,strokeDasharray:"4 3"}})}}else if(k<n.length-1){const q=Object.keys(R.capture??{}),M=q.length>0?q.map(X=>X.split(":").pop()).join(", "):void 0,H=r.stepStatuses[k]??"idle",Z=H==="passed"?"rgba(52,211,153,0.3)":H==="failed"?"rgba(248,113,113,0.3)":"color-mix(in srgb, var(--brand) 18%, transparent)";N.push({id:`e-${k}`,source:`step-${k}`,target:`step-${k+1}`,label:M,labelStyle:{fill:"color-mix(in srgb, var(--brand) 70%, transparent)",fontSize:9,fontFamily:"monospace"},labelBgStyle:{fill:"transparent"},style:{stroke:Z,strokeWidth:1.5,strokeDasharray:H==="idle"||H==="running"?"5 5":void 0},markerEnd:{type:Ba.ArrowClosed,color:H==="passed"?"rgba(52,211,153,0.4)":"color-mix(in srgb, var(--brand) 30%, transparent)"},animated:H==="running"})}}i(v),h(N)},[n,r.stepStatuses,r.stepResults]);const x=n.reduce((m,p)=>m+Kd+36+(p.condition?64:0),40);return s.jsx("div",{style:{height:Math.max(400,x)},className:"w-full rounded-lg overflow-hidden",children:s.jsxs(bf,{nodes:o,edges:f,onNodesChange:u,onEdgesChange:g,nodeTypes:H3,fitView:!0,fitViewOptions:{padding:.3},proOptions:{hideAttribution:!0},minZoom:.3,maxZoom:2,children:[s.jsx(xy,{variant:rn.Dots,gap:20,size:1,color:"var(--border)"}),s.jsx(my,{showInteractive:!1,className:"theme-bg-overlay border theme-border"})]})})}function U3({runState:n,steps:r,waitingStepIndex:o}){const i=j.useRef(null);return j.useEffect(()=>{i.current&&(i.current.scrollTop=i.current.scrollHeight)},[n.stepResults,n.phase]),n.phase==="idle"?null:s.jsxs("div",{className:"mt-3 rounded-lg border theme-border theme-bg-overlay",children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2 border-b theme-border theme-bg-overlay-md",children:[s.jsx("span",{className:"text-[10px] font-semibold theme-text-muted uppercase tracking-wider",children:"Run Log"}),n.baseUrl&&s.jsxs("span",{className:"font-mono text-[10px] theme-text-faint",children:["→ ",n.baseUrl]}),s.jsxs("span",{className:"ml-auto flex items-center gap-2 text-[10px]",children:[n.passed>0&&s.jsxs("span",{className:"text-emerald-400",children:[n.passed," passed"]}),n.failed>0&&s.jsxs("span",{className:"text-red-400",children:[n.failed," failed"]}),n.phase==="running"&&s.jsx(dt,{className:"h-3 w-3 text-[color:var(--brand)] animate-spin",strokeWidth:2}),n.phase==="done"&&s.jsx(ut,{className:"h-3 w-3 text-emerald-400",strokeWidth:2}),n.phase==="aborted"&&s.jsx(Ct,{className:"h-3 w-3 text-red-400",strokeWidth:2})]})]}),s.jsxs("div",{ref:i,className:"overflow-y-auto max-h-80 font-mono text-[11px] p-3 space-y-1",children:[s.jsx("p",{className:"theme-text-faint",children:"▶ Starting workflow execution…"}),n.humanUnsupported&&s.jsxs("p",{className:"text-red-400",children:["⚠ Connected server doesn't support ","{{human:*}}"," — restart `jetic dev` from the latest build. Human values will resolve empty and the dialog will never appear."]}),(n.humanKeys??[]).filter(u=>u.source==="prompt").map(u=>s.jsxs("p",{className:"text-amber-400",children:["◉ will ask for ",`{{human:${u.key}}}`," when reached"]},`need-${u.key}`)),(n.humanKeys??[]).filter(u=>u.source!=="prompt").map(u=>s.jsxs("p",{className:"theme-text-faint",children:["↳ human ",`{{human:${u.key}}}`," ← ",yy[u.source]??u.source," (ready)"]},`have-${u.key}`)),(n.notes??[]).map((u,f)=>s.jsx("p",{className:"theme-text-faint",children:u},`note-${f}`)),n.stepResults.map((u,f)=>{if(!u&&n.stepStatuses[f]!=="running")return null;const h=r[f],g=vf(h.method);return n.stepStatuses[f]==="running"?s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center gap-2 theme-text-muted",children:[s.jsx(dt,{className:"h-3 w-3 animate-spin text-[color:var(--brand)]",strokeWidth:2}),s.jsxs("span",{className:"theme-text-faint",children:["Step ",f+1,"/",r.length]}),s.jsx("span",{className:g.text,children:h.method}),s.jsx("span",{className:"theme-text",children:h.path}),s.jsx("span",{className:"theme-text-faint",children:"…"})]}),o===f&&s.jsx("p",{className:"pl-5 text-amber-400",children:"⏳ Waiting for your input — answer the dialog to resume the run."})]},f):u?s.jsxs("div",{className:"space-y-0.5",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:u.passed?"text-emerald-400":"text-red-400",children:u.passed?"✓":"✗"}),s.jsxs("span",{className:"theme-text-faint",children:["Step ",f+1,"/",r.length]}),s.jsx("span",{className:`${g.text}`,children:h.method.padEnd(6)}),s.jsx("span",{className:"theme-text",children:h.path}),s.jsx("span",{className:`${u.passed?"text-emerald-400":"text-red-400"}`,children:u.status>0?u.status:"NO RESPONSE"}),s.jsxs("span",{className:"theme-text-faint",children:[u.durationMs,"ms"]})]}),h.name&&s.jsx("p",{className:"pl-5 theme-text-faint italic",children:h.name}),Object.entries(u.injected??{}).filter(([m])=>m!=="Content-Type").map(([m,p])=>s.jsxs("p",{className:"pl-5 theme-text-faint",children:["↳ ",s.jsxs("span",{className:"text-amber-500/80",children:[m,":"]})," ",s.jsx("span",{className:"theme-text-faint",children:String(p).length>60?String(p).slice(0,57)+"…":p})]},m)),u.captured.map((m,p)=>s.jsxs("p",{className:"pl-5 text-emerald-400",children:["↳ captured ",m]},p)),u.conditionResult&&s.jsxs("p",{className:`pl-5 ${u.conditionResult.passed?"text-[color:var(--brand)]":"text-orange-400"}`,children:["◇ condition ",u.conditionResult.passed?"passed":"failed"," — ",u.conditionResult.reason,!u.conditionResult.passed&&h.condition&&s.jsxs("span",{className:"text-orange-300/70",children:[" → ",h.condition.onFail,h.condition.onFail==="switch"&&h.condition.switchToWorkflow?`: ${h.condition.switchToWorkflow}`:""]})]}),u.error&&s.jsxs("p",{className:"pl-5 text-red-400",children:["Error: ",u.error]}),!u.passed&&u.responseBody&&!u.error&&s.jsxs("p",{className:"pl-5 text-red-400/80 truncate",children:["Response: ",typeof u.responseBody=="string"?u.responseBody.slice(0,120):JSON.stringify(u.responseBody).slice(0,120)]})]},f):null}),n.phase==="done"&&s.jsxs("p",{className:`mt-1 ${n.failed===0?"text-emerald-400":"text-amber-400"}`,children:["✓ Done — ",n.passed,"/",n.passed+n.failed," steps passed"]}),n.phase==="aborted"&&s.jsxs("p",{className:"mt-1 text-red-400",children:["✗ Aborted — ",n.error]}),n.phase==="error"&&s.jsxs("p",{className:"mt-1 text-red-400",children:["✗ Error — ",n.error]})]})]})}const B3=[{label:"Equality",ops:[{value:"equals",label:"equals"},{value:"not_equals",label:"not equals"}]},{label:"Comparison",ops:[{value:"greater_than",label:"greater than"},{value:"greater_than_or_equal",label:"greater than or equal"},{value:"less_than",label:"less than"},{value:"less_than_or_equal",label:"less than or equal"}]},{label:"Existence",ops:[{value:"exists",label:"exists"},{value:"not_exists",label:"does not exist"},{value:"is_empty",label:"is empty"},{value:"is_not_empty",label:"is not empty"}]},{label:"Text / Collection",ops:[{value:"contains",label:"contains"},{value:"not_contains",label:"does not contain"},{value:"starts_with",label:"starts with"},{value:"ends_with",label:"ends with"}]}];function m0(){return{left:"",operator:"equals",right:""}}function q3({stepIndex:n,existingCondition:r,capturedKeys:o,onSave:i,onRemove:u,onCancel:f}){const[h,g]=j.useState(r?.rules?.all?"all":r?.rules?.any?"any":"all"),x=r?.rules?.all??r?.rules?.any??[],[m,p]=j.useState(x.length>0?x:[m0()]),[b,v]=j.useState(r?.onFail??"abort"),[N,C]=j.useState(r?.switchToWorkflow??""),[k,R]=j.useState(r?.returnOnComplete??!0),z=(X,oe)=>{p(I=>I.map((K,ae)=>ae===X?{...K,...oe}:K))},V=()=>p(X=>[...X,m0()]),q=X=>p(oe=>oe.filter((I,K)=>K!==X)),M=()=>{const X=m.filter(I=>I.left.trim()!=="");if(X.length===0)return;const oe={rules:h==="all"?{all:X}:{any:X},onFail:b,...b==="switch"&&N.trim()?{switchToWorkflow:N.trim(),returnOnComplete:k}:{}};i(oe)},H="h-7 rounded-lg border theme-border theme-bg-overlay-md px-2 text-[11px] theme-text-primary placeholder-[var(--text-faint)] outline-none focus:border-[color:var(--brand)]/60 transition-colors",Z=`${H} cursor-pointer`;return s.jsxs("div",{className:"mt-2 rounded-lg border border-[color:var(--brand)]/20 bg-[color:var(--brand)]/[0.04] p-3 space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(ea,{className:"h-3 w-3 text-[color:var(--brand)]",strokeWidth:2}),s.jsx("span",{className:"text-[10px] font-semibold text-[color:var(--brand)] uppercase tracking-wider",children:"Step Condition"}),s.jsx("span",{className:"text-[10px] theme-text-faint ml-1",children:"— evaluated after this step runs"}),s.jsx("div",{className:"ml-auto flex items-center gap-1",children:["all","any"].map(X=>s.jsx("button",{type:"button",onClick:()=>g(X),className:`px-2 py-0.5 rounded text-[9px] font-semibold transition-colors hover:cursor-pointer ${h===X?"bg-[color:var(--brand)]/20 text-[color:var(--brand)] border border-[color:var(--brand)]/40":"theme-bg-overlay-md theme-text-faint border theme-border hover:theme-text-muted"}`,children:X==="all"?"AND":"OR"},X))})]}),s.jsxs("div",{className:"space-y-2",children:[m.map((X,oe)=>s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("input",{list:`cond-left-${n}-${oe}`,value:X.left,onChange:I=>z(oe,{left:I.target.value}),placeholder:"{{workflow:key}} or value",className:`flex-1 min-w-0 ${H}`}),s.jsx("datalist",{id:`cond-left-${n}-${oe}`,children:o.map(I=>s.jsx("option",{value:`{{${I}}}`},I))}),s.jsx("select",{value:X.operator,onChange:I=>z(oe,{operator:I.target.value,right:d0.includes(I.target.value)?void 0:X.right}),className:`w-44 shrink-0 ${Z}`,children:B3.map(I=>s.jsx("optgroup",{label:I.label,children:I.ops.map(K=>s.jsx("option",{value:K.value,children:K.label},K.value))},I.label))}),d0.includes(X.operator)?s.jsx("div",{className:"flex-1"}):s.jsx("input",{value:X.right??"",onChange:I=>z(oe,{right:I.target.value}),placeholder:"value or {{workflow:key}}",className:`flex-1 min-w-0 ${H}`}),m.length>1&&s.jsx("button",{type:"button",onClick:()=>q(oe),className:"shrink-0 theme-text-faint hover:text-red-400 transition-colors hover:cursor-pointer",children:s.jsx(Tt,{className:"h-3 w-3",strokeWidth:2})})]},oe)),s.jsxs("button",{type:"button",onClick:V,className:"flex items-center gap-1 text-[10px] text-[color:var(--brand)]/70 hover:text-[color:var(--brand)] transition-colors hover:cursor-pointer",children:[s.jsx($t,{className:"h-3 w-3",strokeWidth:2})," Add rule"]})]}),s.jsxs("div",{className:"flex flex-col gap-2 pt-1 border-t border-[color:var(--brand)]/10",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("span",{className:"text-[10px] theme-text-faint shrink-0",children:"If condition fails →"}),["abort","continue","switch"].map(X=>s.jsx("button",{type:"button",onClick:()=>v(X),className:`px-2 py-0.5 rounded text-[9px] font-medium capitalize transition-colors border hover:cursor-pointer ${b===X?X==="abort"?"bg-red-500/20 text-red-400 border-red-500/40":X==="continue"?"bg-emerald-500/20 text-emerald-400 border-emerald-500/40":"bg-[color:var(--brand)]/20 text-[color:var(--brand)] border-[color:var(--brand)]/40":"theme-bg-overlay-md theme-text-faint theme-border hover:theme-text-muted"}`,children:X},X)),b==="switch"&&s.jsx("input",{value:N,onChange:X=>C(X.target.value),placeholder:"workflow-slug",className:`flex-1 ${H}`})]}),b==="switch"&&s.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] theme-text-muted cursor-pointer select-none ml-1",children:[s.jsx("input",{type:"checkbox",checked:k,onChange:X=>R(X.target.checked),className:"rounded theme-border theme-bg-overlay-md text-[color:var(--brand)] focus:ring-0"}),s.jsxs("span",{children:["Return to main workflow after completing ",s.jsx("code",{className:"text-[color:var(--brand)]",children:N||"sub-workflow"})]})]})]}),s.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[s.jsxs("button",{type:"button",onClick:M,disabled:m.every(X=>!X.left.trim()),className:"flex items-center gap-1 rounded-lg bg-[color:var(--brand)]/20 border border-[color:var(--brand)]/40 px-3 py-1 text-[10px] text-[color:var(--brand)] hover:bg-[color:var(--brand)]/30 transition-colors disabled:opacity-40 hover:cursor-pointer",children:[s.jsx(ut,{className:"h-3 w-3",strokeWidth:2})," Save Condition"]}),r&&s.jsxs("button",{type:"button",onClick:u,className:"flex items-center gap-1 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-1 text-[10px] text-red-400/80 hover:bg-red-500/15 transition-colors hover:cursor-pointer",children:[s.jsx(Yt,{className:"h-3 w-3",strokeWidth:2})," Remove"]}),s.jsxs("button",{type:"button",onClick:f,className:"ml-auto flex items-center gap-1 rounded-lg border theme-border px-3 py-1 text-[10px] theme-text-muted hover:theme-text transition-colors hover:cursor-pointer",children:[s.jsx(Tt,{className:"h-3 w-3",strokeWidth:2})," Cancel"]})]})]})}function L3({step:n,index:r,total:o,status:i,result:u,allSteps:f,onConditionChange:h,waitingHuman:g}){const[x,m]=j.useState(!1),[p,b]=j.useState(!1),v=n.capture&&Object.keys(n.capture).length>0,N=n.inject&&Object.keys(n.inject).length>0,C=n.body&&Object.keys(n.body).length>0,k=!!n.condition,R=jf(n),z=[];for(let M=0;M<=r;M++){const H=f[M];Object.keys(H.capture??{}).forEach(Z=>z.push(Z)),Object.keys(H.captureInput??{}).forEach(Z=>z.push(Z))}const V=g?s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-amber-500/15 text-amber-400",title:"Waiting for your input — answer the dialog to resume",children:s.jsx(zr,{className:"h-3 w-3 animate-pulse",strokeWidth:2})}):{idle:s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full border theme-border text-[9px] theme-text-faint",children:r+1}),running:s.jsx(dt,{className:"h-5 w-5 text-[color:var(--brand)] animate-spin",strokeWidth:2}),passed:s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-emerald-500/10 text-emerald-400",children:s.jsx(ut,{className:"h-3 w-3",strokeWidth:2})}),failed:s.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-red-500/10 text-red-400",children:s.jsx(Ct,{className:"h-3 w-3",strokeWidth:2})}),skipped:s.jsx("span",{className:"h-5 w-5 rounded-full border theme-border theme-bg-overlay-md"})}[i],q=k&&n.condition?(()=>{const M=n.condition.rules.all??n.condition.rules.any??[],H=n.condition.rules.all?"AND":"OR";return`${M.length} rule${M.length!==1?"s":""} ${H} → ${n.condition.onFail}`})():null;return s.jsxs("div",{className:"relative",children:[r<o-1&&s.jsx("div",{className:`absolute left-[19px] top-[38px] bottom-0 w-px z-0 transition-colors duration-500 ${i==="passed"?"bg-emerald-500/20":"bg-[var(--border)]"}`}),s.jsxs("div",{className:"relative z-10",children:[s.jsxs("button",{type:"button",onClick:()=>m(M=>!M),className:"flex w-full items-center gap-3 px-4 py-2.5 hover:theme-bg-overlay-md transition-colors text-left hover:cursor-pointer",children:[s.jsx("span",{className:"shrink-0",children:V}),s.jsx(C3,{method:n.method}),s.jsx("span",{className:"font-mono text-xs theme-text flex-1 truncate",children:n.path}),u&&s.jsxs("span",{className:`font-mono text-[10px] ${u.passed?"text-emerald-400":"text-red-400"}`,children:[u.status>0?u.status:"ERR"," · ",u.durationMs,"ms"]}),s.jsxs("span",{className:"flex items-center gap-1",children:[N&&s.jsx("span",{className:"rounded bg-amber-500/10 px-1 py-0.5 text-[9px] text-amber-400",children:"auth"}),v&&s.jsx("span",{className:"rounded bg-[color:var(--brand)]/10 px-1 py-0.5 text-[9px] text-[color:var(--brand)]",children:"capture"}),R.length>0&&s.jsxs("span",{title:`Needs human input at runtime: ${R.map(M=>`{{human:${M}}}`).join(", ")}`,className:"rounded bg-orange-500/10 px-1 py-0.5 text-[9px] text-orange-400 flex items-center gap-0.5",children:[s.jsx(zr,{className:"h-2.5 w-2.5",strokeWidth:2})," human"]}),k&&s.jsxs("span",{className:"rounded bg-[color:var(--brand)]/10 px-1 py-0.5 text-[9px] text-[color:var(--brand)] flex items-center gap-0.5",children:[s.jsx(ea,{className:"h-2.5 w-2.5",strokeWidth:2})," condition"]}),u?.conditionResult&&s.jsxs("span",{className:`rounded px-1 py-0.5 text-[9px] ${u.conditionResult.passed?"bg-[color:var(--brand)]/10 text-[color:var(--brand)]":"bg-orange-500/10 text-orange-400"}`,children:["◇ ",u.conditionResult.passed?"passed":"failed"]})]}),s.jsx("span",{className:"theme-text-faint shrink-0",children:x?s.jsx(qa,{className:"h-3.5 w-3.5"}):s.jsx(vl,{className:"h-3.5 w-3.5"})})]}),x&&s.jsxs("div",{className:"ml-12 mr-4 my-3 space-y-2.5 rounded-lg border-y theme-border theme-bg-overlay p-3",children:[n.description&&s.jsx("p",{className:"text-[11px] theme-text-muted",children:n.description}),u&&s.jsxs("div",{className:`rounded-lg border px-3 py-2 ${u.passed?"border-emerald-500/15 bg-emerald-500/[0.05]":"border-red-500/15 bg-red-500/[0.05]"}`,children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1 uppercase tracking-wider",children:"Response"}),u.error?s.jsx("p",{className:"text-[11px] text-red-400",children:u.error}):s.jsx("pre",{className:"text-[10px] theme-text-muted overflow-auto max-h-24 whitespace-pre-wrap break-all",children:typeof u.responseBody=="string"?u.responseBody.slice(0,300):JSON.stringify(u.responseBody,null,2).slice(0,300)})]}),C&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1 uppercase tracking-wider",children:"Request Body"}),s.jsx("div",{className:"space-y-1",children:Object.entries(n.body).map(([M,H])=>s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border theme-border theme-bg-overlay-md px-3 py-1.5",children:[s.jsx("span",{className:"font-mono text-[10px] theme-text",children:M}),s.jsx("span",{className:"font-mono text-[10px] text-[color:var(--brand)]/80 truncate",children:String(H)})]},M))})]}),N&&s.jsxs("div",{children:[s.jsxs("p",{className:"text-[10px] theme-text-faint mb-1 uppercase tracking-wider flex items-center gap-1",children:[s.jsx(M0,{className:"h-3 w-3",strokeWidth:2})," Inject"]}),s.jsx("div",{className:"space-y-1",children:Object.entries(n.inject).map(([M,H])=>s.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-amber-500/[0.05] border border-amber-500/15 px-3 py-1.5",children:[s.jsx("span",{className:"font-mono text-[10px] text-amber-400/80",children:M}),s.jsx(dl,{className:"h-3 w-3 theme-text-faint shrink-0",strokeWidth:2}),s.jsx("span",{className:"font-mono text-[10px] theme-text-muted",children:H})]},M))})]}),v&&s.jsxs("div",{children:[s.jsxs("p",{className:"text-[10px] theme-text-faint mb-1 uppercase tracking-wider flex items-center gap-1",children:[s.jsx(hs,{className:"h-3 w-3",strokeWidth:2})," Capture"]}),s.jsx("div",{className:"space-y-1",children:Object.entries(n.capture).map(([M,H])=>s.jsxs("div",{className:"flex items-center gap-2 rounded-lg bg-[color:var(--brand)]/[0.05] border border-[color:var(--brand)]/15 px-3 py-1.5",children:[s.jsx("span",{className:"font-mono text-[10px] text-[color:var(--brand)]",children:M}),s.jsx(dl,{className:"h-3 w-3 theme-text-faint shrink-0",strokeWidth:2}),s.jsx("span",{className:"font-mono text-[10px] theme-text-muted",children:H})]},M))})]}),s.jsxs("div",{className:"pt-1",children:[k&&q&&!p&&s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-[color:var(--brand)]/20 bg-[color:var(--brand)]/[0.04] px-3 py-2 mb-2",children:[s.jsx(ea,{className:"h-3 w-3 text-[color:var(--brand)] shrink-0",strokeWidth:2}),s.jsx("span",{className:"text-[10px] text-[color:var(--brand)] flex-1",children:q}),u?.conditionResult&&s.jsx("span",{className:`text-[9px] font-medium ${u.conditionResult.passed?"text-[color:var(--brand)]":"text-orange-400"}`,children:u.conditionResult.passed?"✓ passed":"✗ failed"}),s.jsx("button",{type:"button",onClick:()=>b(!0),className:"shrink-0 theme-text-faint hover:text-[color:var(--brand)] transition-colors hover:cursor-pointer",children:s.jsx(Bv,{className:"h-3 w-3",strokeWidth:2})})]}),p?s.jsx(q3,{stepIndex:r,existingCondition:n.condition,capturedKeys:z,onSave:M=>{h(r,M),b(!1)},onRemove:()=>{h(r,void 0),b(!1)},onCancel:()=>b(!1)}):!k&&s.jsxs("button",{type:"button",onClick:()=>b(!0),className:"flex items-center gap-1.5 text-[10px] theme-text-faint hover:text-[color:var(--brand)] transition-colors hover:cursor-pointer",children:[s.jsx($t,{className:"h-3 w-3",strokeWidth:2}),s.jsx(ea,{className:"h-3 w-3",strokeWidth:2}),"Add Condition"]})]})]})]})]})}function Cd(n){return{phase:"idle",currentStep:-1,stepStatuses:Array(n).fill("idle"),stepResults:Array(n).fill(null),passed:0,failed:0,humanKeys:[],notes:[]}}const yy={run:"pre-seeded for this run",env:"environment variable",memory:"saved human memory",prompt:"your answer"};function Y3({workflow:n,onDelete:r,onViewTraces:o}){const[i,u]=j.useState(n),[f,h]=j.useState("list"),[g,x]=j.useState(!1),[m,p]=j.useState(!1),[b,v]=j.useState(!1),[N,C]=j.useState(()=>Cd(i.steps.length)),[k,R]=j.useState(void 0),[z,V]=j.useState([]),[q,M]=j.useState(null),[H,Z]=j.useState(""),X=j.useRef(!1),oe=j.useRef(null),I=j.useRef(""),K=j.useRef("local-sim"),ae=j.useRef({}),te=j.useRef(new Set),se=j.useRef(null),[_,W]=j.useState(null),[E,$]=j.useState(""),[T,A]=j.useState(null),[S,D]=j.useState(!1),L=j.useRef(null),F=async(B,Y)=>{const ue=i.steps.map((ee,Ee)=>{if(Ee!==B)return ee;if(Y===void 0){const{condition:ge,...ke}=ee;return ke}return{...ee,condition:Y}}),re={...i,steps:ue};u(re);try{await _3(i._file,ue)}catch{}};j.useEffect(()=>{fetch("/api/model/environments").then(B=>B.ok?B.json():null).then(B=>{if(!B)return;const Y=B.environments??[];V(Y);const ue=B.defaultEnvironment??Y.find(ee=>ee.default)?.name??Y[0]?.name??null;M(ue);const re=Y.find(ee=>ee.name===ue);re&&Z(re.baseUrl)}).catch(()=>{})},[]);const ie=async()=>{if(confirm(`Delete workflow "${i.name}"? This cannot be undone.`)){v(!0);try{await M3(i._file),r()}catch(B){alert(`Failed to delete: ${B.message}`),v(!1)}}},he=()=>{if(X.current=!0,oe.current?.close(),oe.current=null,L.current){const B=L.current;L.current=null,W(null),B(null)}else _&&ve();C(B=>({...B,phase:B.phase==="running"?"aborted":B.phase}))},me=async(B,Y)=>{if(!se.current)throw new Error("Run id lost — please re-run the workflow.");const ue=await fetch("/api/workflows/human-input",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({runId:se.current,key:B,value:Y})}),re=await ue.json().catch(()=>({}));if(!ue.ok)throw new Error(re.error??`HTTP ${ue.status}`)},Se=async()=>{if(_){if(L.current){const B=L.current;L.current=null,W(null),$(""),B(E);return}D(!0),A(null);try{await me(_.key,E),W(null),$("")}catch(B){A(B.message)}finally{D(!1)}}},ve=async()=>{if(_){if(L.current){const B=L.current;L.current=null,W(null),$(""),A(null),B(null);return}try{await me(_.key,null)}catch{}W(null),$(""),A(null)}},Ae=()=>{he(),C(Cd(i.steps.length))},Re=async(B,Y,ue)=>{const re=new Date().toISOString(),ee={id:crypto.randomUUID(),workflowName:i.name,workflowFile:i._file,startedAt:ue,finishedAt:re,durationMs:B.stepResults.reduce((ge,ke)=>ge+(ke?.durationMs??0),0),phase:B.phase==="done"?"done":B.phase==="aborted"?"aborted":"error",passed:B.passed,failed:B.failed,baseUrl:B.baseUrl,source:Y,steps:i.steps.map((ge,ke)=>{const Oe=B.stepResults[ke];return{index:ke,name:ge.name,method:ge.method,path:ge.path,description:ge.description,status:Oe?.status??0,passed:Oe?.passed??!1,durationMs:Oe?.durationMs??0,captured:Object.fromEntries((Oe?.captured??[]).map(ze=>[ze,"(captured)"])),injected:Oe?.injected??{},requestBody:ge.body,responseBody:Oe?.responseBody,error:Oe?.error??null,expectStatus:ge.expectStatus,captureSpec:ge.capture,injectSpec:ge.inject,conditionSpec:ge.condition,conditionResult:Oe?.conditionResult}})},Ee=await E2(ee);R(Ee)},We=B=>{X.current=!1,se.current=null,te.current=new Set,L.current=null,W(null),$(""),A(null);const Y=i.steps.length;C({...Cd(Y),baseUrl:H||void 0}),R(void 0),I.current=new Date().toISOString(),K.current="local-sim",x(!0);const ue=(ee,Ee,ge)=>new Promise(ke=>{$(""),A(null),W({key:ee,stepIndex:Ee,stepName:ge}),L.current=ke}),re=async()=>{C(Oe=>({...Oe,phase:"running",baseUrl:H||Oe.baseUrl})),ae.current={};let ee=0,Ee=0,ge=!1,ke="";for(let Oe=0;Oe<Y&&!(X.current||ge);Oe++){const ze=i.steps[Oe],At=jf(ze);for(const pe of At){if(X.current)break;if(ae.current[`human:${pe}`]!==void 0)continue;C(je=>{const Le=[...je.stepStatuses];return Le[Oe]="running",{...je,stepStatuses:Le,currentStep:Oe}});const Ve=await ue(pe,Oe,ze.name);if(Ve===null||X.current){C(je=>({...je,phase:"aborted",error:"Run cancelled by user"}));return}ae.current[`human:${pe}`]=Ve,C(je=>({...je,notes:[...je.notes??[],`↳ human {{human:${pe}}} ← your answer`]}))}if(X.current)break;C(pe=>{const Ve=[...pe.stepStatuses];return Ve[Oe]="running",{...pe,stepStatuses:Ve,currentStep:Oe}});const Rt=600+Math.random()*800;if(await new Promise(pe=>{const Ve=setTimeout(pe,Rt),je=setInterval(()=>{X.current&&(clearTimeout(Ve),clearInterval(je),pe())},50);setTimeout(()=>clearInterval(je),Rt+100)}),X.current)break;Object.keys(ze.capture??{}).forEach(pe=>{ae.current[pe]="[simulated]"}),Object.keys(ze.captureInput??{}).forEach(pe=>{ae.current[pe]="[simulated]"});let ft;if(ze.condition&&(ft=k3(ze.condition,ae.current),!ft.passed)){const{onFail:pe,returnOnComplete:Ve}=ze.condition;pe==="abort"?(ge=!0,ke=`Condition failed at step ${Oe+1}: ${ft.reason}`):pe==="continue"?(ge=!0,ke="Condition failed → continuing without remaining steps"):pe==="switch"&&(Ve||(ge=!0,ke=`Condition failed → switched to: ${ze.condition.switchToWorkflow??"unknown"}`))}const nt=!0,xt=Math.round(Rt),at={index:Oe,step:{name:ze.name,method:ze.method,path:ze.path,description:ze.description},status:200,passed:nt,durationMs:xt,captured:Object.keys(ze.capture??{}).map(pe=>pe.split(":").pop()??pe),injected:{},responseBody:{simulated:!0},error:null,conditionResult:ft};if(ee++,C(pe=>{const Ve=[...pe.stepStatuses],je=[...pe.stepResults];return Ve[Oe]="passed",je[Oe]=at,{...pe,stepStatuses:Ve,stepResults:je,passed:ee,failed:Ee}}),ge)break}if(!X.current)if(ge){const Oe={phase:"aborted",stepStatuses:N.stepStatuses,stepResults:N.stepResults,passed:ee,failed:Ee,baseUrl:H||void 0};C(ze=>({...ze,phase:"aborted",error:ke})),Re(Oe,"local-sim",I.current)}else{const Oe={phase:"done",stepStatuses:Array(Y).fill("passed"),stepResults:i.steps.map((ze,At)=>({index:At,step:{name:ze.name,method:ze.method,path:ze.path,description:ze.description},status:200,passed:!0,durationMs:Math.round(600+Math.random()*800),captured:Object.keys(ze.capture??{}).map(Rt=>Rt.split(":").pop()??Rt),injected:{},responseBody:{simulated:!0},error:null})),passed:ee,failed:Ee};C(ze=>({...ze,phase:"done",passed:ee,failed:Ee})),Re(Oe,"local-sim",I.current)}};fetch("/api/workflows/run",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file:i._file,baseUrl:H||void 0,humanInputs:B})}).then(ee=>{if(!ee.ok||!ee.body){re();return}K.current="api";const Ee=ee.body.getReader(),ge=new TextDecoder;let ke="";C(ze=>({...ze,phase:"running"})),(async()=>{let ze=!1;for(;!X.current;){const{value:At,done:Rt}=await Ee.read();if(Rt)break;ze=!0,ke+=ge.decode(At,{stream:!0});const ft=ke.split(`
413
+ `);ke=ft.pop()??"";for(const nt of ft){const xt=nt.trim();if(!xt.startsWith("data:"))continue;const at=xt.slice(5).trim();if(!at)continue;let pe;try{pe=JSON.parse(at)}catch{continue}if(pe.type==="human_input_required"){$(""),A(null),W({key:String(pe.key??""),stepIndex:Number(pe.stepIndex??-1),stepName:String(pe.stepName??"")});continue}C(Ve=>{const je={...Ve};if(pe.type==="start")je.phase="running",je.baseUrl=pe.baseUrl,je.humanKeys=Array.isArray(pe.humanKeys)?pe.humanKeys:[],je.notes=[],je.humanUnsupported=!Array.isArray(pe.humanKeys)&&A3(i.steps).length>0,typeof pe.runId=="string"&&(se.current=pe.runId);else if(pe.type==="human_resolved"){const Le=`${pe.index}:${pe.key}`;if(!te.current.has(Le)){te.current.add(Le);const Ge=yy[String(pe.source)]??String(pe.source??"run");je.notes=[...je.notes??[],`↳ human {{human:${pe.key}}} ← ${Ge}`]}}else if(pe.type==="step_start"){const Le=pe.index,Ge=[...je.stepStatuses];Ge[Le]="running",je.stepStatuses=Ge,je.currentStep=Le}else if(pe.type==="step_result"){const Le=pe.index,Ge=[...je.stepStatuses],zt=[...je.stepResults];Ge[Le]=pe.passed?"passed":"failed",zt[Le]={index:pe.index,step:pe.step??{name:"",method:"",path:""},status:pe.status,passed:pe.passed,durationMs:pe.durationMs,captured:pe.captured??[],injected:pe.injected??{},responseBody:pe.responseBody,error:pe.error??null},pe.passed?je.passed=(je.passed??0)+1:je.failed=(je.failed??0)+1,je.stepStatuses=Ge,je.stepResults=zt}else if(pe.type==="condition_result"){const Le=pe.index,Ge=[...je.stepResults];Ge[Le]&&(Ge[Le]={...Ge[Le],conditionResult:{passed:pe.passed,reason:pe.reason}},je.stepResults=Ge)}else if(pe.type==="aborted"){const Le=[...je.stepStatuses];for(let Ge=0;Ge<Le.length;Ge++)Le[Ge]==="running"?Le[Ge]="failed":Le[Ge]==="idle"&&(Le[Ge]="skipped");je.stepStatuses=Le,je.phase="aborted",je.error=pe.reason,Re(je,"api",I.current)}else pe.type==="done"&&(je.phase="done",(pe.passed>0||pe.failed>0)&&(je.passed=pe.passed,je.failed=pe.failed),pe.conditionBranch==="continue"?je.error="Condition failed → remaining steps skipped":pe.conditionBranch==="switch"&&(je.error=`Condition failed → switched to: ${pe.switchToWorkflow??"unknown"}`),Re(je,"api",I.current));return je})}}!ze&&!X.current&&re()})().catch(()=>{X.current||re()})}).catch(()=>{X.current||re()})},Te=N.phase==="running",be=N.phase!=="idle";return s.jsxs("div",{className:"relative",children:[s.jsxs("button",{type:"button",onClick:()=>We(),className:"absolute -top-2 -right-2 flex items-center gap-1 rounded-full theme-bg-brand px-2 py-0.5 text-[10px] font-medium text-[color:var(--brand-foreground)] shadow-sm z-10 hover:opacity-90 transition-colors hover:cursor-pointer",children:[s.jsx(Ad,{size:10})," Run Workflow"]}),s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2.5 px-4 py-3 border-b theme-border",children:[s.jsx("button",{type:"button",onClick:()=>p(B=>!B),className:"text-[color:var(--brand)]/70 hover:text-[color:var(--brand)] transition-colors shrink-0 hover:cursor-pointer",children:m?s.jsx(vl,{className:"h-3.5 w-3.5"}):s.jsx(qa,{className:"h-3.5 w-3.5"})}),s.jsxs("div",{className:"flex-1 min-w-0",children:[s.jsx("p",{className:"theme-text-primary truncate",children:i.name}),i.generatedAt&&s.jsxs("p",{className:"flex items-center gap-1 text-[10px] theme-text-faint mt-0.5",children:[s.jsx(Gr,{className:"h-2.5 w-2.5",strokeWidth:2}),new Date(i.generatedAt).toLocaleString()]})]}),s.jsxs("span",{className:"rounded-full border theme-border theme-bg-overlay-md px-2 py-0.5 text-[10px] theme-text-muted shrink-0",children:[i.steps.length," steps"]}),be&&s.jsxs("span",{className:`flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] shrink-0 ${N.phase==="done"&&N.failed===0?"bg-emerald-500/10 text-emerald-400":N.phase==="running"?"bg-[color:var(--brand)]/10 text-[color:var(--brand)]":"bg-red-500/10 text-red-400"}`,children:[N.phase==="running"&&s.jsx(dt,{className:"h-2.5 w-2.5 animate-spin",strokeWidth:2}),N.phase==="done"&&N.failed===0&&s.jsx(ut,{className:"h-2.5 w-2.5",strokeWidth:2}),(N.phase==="done"||N.phase==="aborted")&&N.failed>0&&s.jsx(Ct,{className:"h-2.5 w-2.5",strokeWidth:2}),N.phase==="running"?"Running…":N.phase==="done"?`${N.passed}/${N.passed+N.failed}`:N.phase==="aborted"?"Aborted":"Error"]}),N.humanUnsupported&&s.jsxs("span",{title:"The connected jetic dev server predates human-input support. Restart it from the latest build — human values will otherwise resolve empty and no dialog appears.",className:"flex items-center gap-1 rounded-full px-2 py-0.5 text-[10px] shrink-0 bg-red-500/10 text-red-400",children:[s.jsx(Ct,{className:"h-2.5 w-2.5",strokeWidth:2}),"Old server — no human dialog"]}),!m&&s.jsx("div",{className:"flex items-center gap-0.5 rounded-lg border theme-border theme-bg-overlay-md p-0.5 shrink-0",children:["list","graph"].map(B=>s.jsxs("button",{type:"button",onClick:()=>h(B),className:`flex items-center gap-1 rounded px-2 py-1 text-[10px] font-medium transition-colors hover:cursor-pointer ${f===B?"bg-[color:var(--brand)]/20 text-[color:var(--brand)]":"theme-text-faint hover:theme-text-muted"}`,children:[B==="list"?s.jsx(R0,{className:"h-3 w-3",strokeWidth:2}):s.jsx(Pd,{className:"h-3 w-3",strokeWidth:2}),B.charAt(0).toUpperCase()+B.slice(1)]},B))}),be&&!m&&s.jsxs("button",{type:"button",onClick:()=>x(B=>!B),className:`flex items-center gap-1 rounded-lg px-2.5 py-1 text-[10px] transition-colors border theme-border hover:cursor-pointer ${g?"theme-bg-overlay-md theme-text":"theme-text-faint hover:theme-text theme-bg-overlay"}`,children:[s.jsx(Rv,{className:"h-3 w-3",strokeWidth:2})," Log"]}),Te&&s.jsxs("button",{type:"button",onClick:he,className:"flex items-center gap-1 rounded-lg border border-red-500/30 bg-red-500/10 px-2.5 py-1 text-[10px] text-red-400 hover:bg-red-500/20 transition-colors shrink-0 hover:cursor-pointer",children:[s.jsx(n2,{className:"h-3 w-3",strokeWidth:2})," Stop"]}),be&&!Te&&s.jsxs("button",{type:"button",onClick:Ae,className:"flex items-center gap-1 rounded-lg border theme-border theme-bg-overlay px-2.5 py-1 text-[10px] theme-text-muted hover:theme-text transition-colors shrink-0 hover:cursor-pointer",children:[s.jsx(Gv,{className:"h-3 w-3",strokeWidth:2})," Reset"]}),be&&!Te&&o&&s.jsxs("button",{type:"button",onClick:()=>o(i.name,k),className:"flex items-center gap-1 rounded-lg border border-[color:var(--brand)]/30 bg-[color:var(--brand)]/10 px-2.5 py-1 text-[10px] text-[color:var(--brand)] hover:bg-[color:var(--brand)]/20 transition-colors shrink-0 hover:cursor-pointer",children:[s.jsx(Vr,{className:"h-3 w-3",strokeWidth:2}),k?"View Trace":"Traces"]}),!Te&&s.jsxs("button",{type:"button",onClick:()=>We(),className:"hidden items-center gap-1.5 rounded-lg theme-bg-brand px-3 py-1.5 text-[10px] font-medium text-[color:var(--brand-foreground)] hover:opacity-90 transition-colors shrink-0 hover:cursor-pointer",children:[s.jsx(Ad,{className:"h-3 w-3",strokeWidth:2}),be?"Re-run":"Run"]}),!i._legacy&&!Te&&s.jsx("button",{type:"button",onClick:ie,disabled:b,title:"Delete workflow",className:"flex items-center gap-1 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-2 py-1 text-[10px] text-red-400/80 hover:bg-red-500/20 hover:text-red-400 transition-colors shrink-0 disabled:opacity-40 hover:cursor-pointer",children:b?s.jsx(dt,{className:"h-3 w-3 animate-spin",strokeWidth:2}):s.jsx(Yt,{className:"h-3 w-3",strokeWidth:2})})]}),!m&&s.jsxs(s.Fragment,{children:[z.length>0&&s.jsxs("div",{className:"flex items-center gap-2 border-b theme-border px-4 py-2 theme-bg-overlay-md flex-wrap",children:[s.jsx(jl,{className:"h-3 w-3 theme-text-faint shrink-0",strokeWidth:2}),s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint mr-1",children:"Env:"}),z.map(B=>{const Y=q===B.name;return s.jsxs("button",{type:"button",onClick:()=>{M(B.name),Z(B.baseUrl)},className:`flex items-center gap-1.5 rounded-full border px-2.5 py-0.5 text-[10px] font-medium transition-all hover:cursor-pointer ${Y?"border-[color:var(--brand)]/40 bg-[color:var(--brand)]/10 text-[color:var(--brand)]":"theme-border theme-text-faint hover:border-[color:var(--brand)]/20 hover:theme-text-muted"}`,children:[s.jsx("span",{className:`h-1.5 w-1.5 rounded-full shrink-0 ${Y?"bg-[color:var(--brand)]":"bg-[var(--text-faint)]"}`}),B.name]},B.name)}),q&&s.jsx("span",{className:"ml-auto font-mono text-[10px] theme-text-faint truncate max-w-[180px]",children:H})]}),g&&s.jsx("div",{className:"border-b theme-border",children:s.jsx(U3,{runState:N,steps:i.steps,waitingStepIndex:_?.stepIndex??null})}),f==="list"&&s.jsx("div",{className:"divide-y divide-[var(--border)]",children:i.steps.map((B,Y)=>s.jsx(L3,{step:B,index:Y,total:i.steps.length,status:N.stepStatuses[Y]??"idle",result:N.stepResults[Y]??null,allSteps:i.steps,onConditionChange:F,waitingHuman:_?.stepIndex===Y},Y))}),f==="graph"&&s.jsx("div",{className:"p-4",children:s.jsx($3,{steps:i.steps,runState:N})})]})]}),_&&s.jsx(z3,{title:"Human input required",subtitle:_.stepName?`Step ${_.stepIndex+1} · ${_.stepName}`:`Step ${_.stepIndex+1}`,fields:[{key:_.key}],values:{[_.key]:E},onChange:(B,Y)=>$(Y),onSubmit:Se,onCancel:ve,submitLabel:"Submit & resume run",error:T,submitting:S})]})}function V3(){return s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-5 py-20 text-center",children:[s.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[s.jsx("div",{className:"absolute inset-0 rounded-full bg-[color:var(--brand)]/10 blur-xl"}),s.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full border theme-border theme-bg-overlay text-[color:var(--brand)]",children:s.jsx(ea,{className:"h-7 w-7",strokeWidth:2})})]}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium theme-text-primary",children:"No workflows yet"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted"}),s.jsxs("p",{className:"mt-1 text-[11px] theme-text-faint",children:["Workflows are stored in ",s.jsx("code",{className:"theme-text-faint",children:".jetic/workflows/"})]})]})]})}function G3({onViewTraces:n}){const[r,o]=j.useState([]),[i,u]=j.useState(!0),[f,h]=j.useState(!1),[g,x]=j.useState(null),m=j.useCallback(async(b=!1)=>{b?h(!0):u(!0),x(null);try{o(await T3())}catch(v){x(v.message)}finally{u(!1),h(!1)}},[]);j.useEffect(()=>{m()},[m]);const p=b=>{o(v=>v.filter(N=>N._file!==b))};return s.jsxs("div",{className:"flex min-h-full w-full flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5 sticky",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium theme-text-primary leading-none",children:"Simulations"}),s.jsx("p",{className:"mt-0.5 text-[11px] theme-text-muted",children:i?"Loading…":`${r.length} workflow${r.length!==1?"s":""} found`})]})}),s.jsx("div",{className:"flex items-center gap-2",children:s.jsx("button",{type:"button",onClick:()=>m(!0),disabled:f||i,className:"flex h-6 w-6 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-muted hover:theme-bg-overlay-md hover:theme-text disabled:opacity-40 transition-all hover:cursor-pointer",children:s.jsx(na,{className:`h-3.5 w-3.5 ${f?"animate-spin":""}`,strokeWidth:2})})})]}),s.jsxs("div",{className:"flex flex-1 flex-col gap-4 p-6 overflow-y-auto max-h[(calc(100vh-60px))]",children:[i&&s.jsx("div",{className:"space-y-3",children:[1,2].map(b=>s.jsx("div",{className:"h-16 animate-pulse rounded-lg border theme-border theme-bg-overlay",style:{opacity:1-b*.3}},b))}),!i&&g&&s.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-red-500/20 bg-red-500/[0.06] p-10 text-center",children:[s.jsx(Ct,{className:"h-8 w-8 text-red-400",strokeWidth:2}),s.jsxs("div",{children:[s.jsx("p",{className:"font-medium text-red-300",children:"Could not load simulations"}),s.jsx("p",{className:"mt-1 text-[11px] text-red-400/80",children:g})]}),s.jsx("button",{type:"button",onClick:()=>m(),className:"rounded-lg border border-red-500/20 bg-red-500/10 px-4 py-1.5 text-[11px] text-red-400 hover:bg-red-500/20 transition-colors hover:cursor-pointer",children:"Retry"})]}),!i&&!g&&r.length===0&&s.jsx(V3,{}),!i&&!g&&r.length>0&&s.jsx("div",{className:"space-y-5",children:r.map((b,v)=>s.jsx(Y3,{workflow:b,onDelete:()=>p(b._file),onViewTraces:n?(N,C)=>n({workflowName:N,traceId:C}):void 0},`${b._file}-${v}`))}),!i&&!g&&r.length>0&&s.jsxs("div",{className:"flex items-center gap-1.5 border-t theme-border pt-3 text-[10px] theme-text-faint",children:["Workflows from ",s.jsx("code",{className:"theme-text-faint",children:".jetic/workflows/"})]})]})]})}const X3={GET:{bg:"bg-emerald-500/10",text:"text-emerald-400",dot:"#34d399"},POST:{bg:"bg-[color:var(--brand)]/10",text:"text-[color:var(--brand)]",dot:"var(--brand)"},PUT:{bg:"bg-amber-500/10",text:"text-amber-400",dot:"#fbbf24"},PATCH:{bg:"bg-orange-500/10",text:"text-orange-400",dot:"#fb923c"},DELETE:{bg:"bg-red-500/10",text:"text-red-400",dot:"#f87171"},HEAD:{bg:"theme-bg-overlay-md",text:"theme-text-muted",dot:"var(--text-muted)"},OPTIONS:{bg:"bg-[color:var(--brand)]/10",text:"text-[color:var(--brand)]",dot:"var(--brand)"}};function by(n){return X3[n.toUpperCase()]??{bg:"theme-bg-overlay-md",text:"theme-text-muted",dot:"var(--text-muted)"}}async function Z3(){const n=await fetch("/api/model");if(!n.ok)throw new Error(`HTTP ${n.status}`);return n.json()}async function W3(){const n=await fetch("/api/model/scan",{method:"POST"});if(!n.ok){const r=await n.json().catch(()=>({}));throw new Error(r.error??`Scan failed (${n.status})`)}return(await n.json()).model}async function Q3(n,r){const o=await fetch(`/api/model/endpoint/${n}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!o.ok)throw new Error(`Save failed (${o.status})`)}async function K3(n){const r=await fetch("/api/model/endpoint",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!r.ok){const o=await r.json().catch(()=>({}));throw new Error(o.error??`Create failed (${r.status})`)}return r.json()}function J3({method:n}){const r=by(n);return s.jsx("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] tracking-widest ${r.bg} ${r.text}`,children:n.toUpperCase()})}function p0({value:n,onSave:r,mono:o=!0}){const[i,u]=j.useState(!1),[f,h]=j.useState(n),[g,x]=j.useState(!1),m=j.useRef(null);j.useEffect(()=>{i&&m.current?.focus()},[i]);const p=async()=>{if(f===n){u(!1);return}x(!0);try{await r(f)}finally{x(!1),u(!1)}};return i?s.jsxs("span",{className:"inline-flex items-center gap-1",children:[s.jsx("input",{ref:m,value:f,onChange:b=>h(b.target.value),onKeyDown:b=>{b.key==="Enter"&&p(),b.key==="Escape"&&(h(n),u(!1))},className:`rounded border border-[color:var(--brand)]/40 theme-bg-overlay-md px-1.5 py-0.5 text-xs theme-text-primary outline-none w-56 ${o?"font-mono":""}`}),s.jsx("button",{type:"button",onClick:p,disabled:g,className:"text-emerald-400 hover:text-emerald-300 hover:cursor-pointer",children:g?s.jsx(dt,{className:"h-3 w-3 animate-spin"}):s.jsx(ut,{className:"h-3 w-3"})}),s.jsx("button",{type:"button",onClick:()=>{h(n),u(!1)},className:"theme-text-faint hover:theme-text-muted hover:cursor-pointer",children:s.jsx(Tt,{className:"h-3 w-3"})})]}):s.jsxs("button",{type:"button",onClick:()=>u(!0),className:`group/ie inline-flex items-center gap-1 rounded px-1 py-0.5 hover:theme-bg-overlay-md transition-colors hover:cursor-pointer ${o?"font-mono":""}`,children:[s.jsx("span",{className:"text-xs theme-text",children:n}),s.jsx(ef,{className:"h-2.5 w-2.5 theme-text-faint opacity-0 group-hover/ie:opacity-100 transition-opacity"})]})}function I3({ep:n,onUpdate:r,onInspect:o,onViewTraces:i,onEdit:u}){const[f,h]=j.useState(!1),[g,x]=j.useState(""),m=async(v,N)=>{x("");try{await Q3(v,N),r(v,N)}catch(C){x(C.message)}},p=n.requestBody?.fields??{},b=n.responses??{};return s.jsxs("div",{className:"border-b theme-border last:border-0",children:[s.jsxs("button",{type:"button",onClick:()=>h(v=>!v),className:"group flex w-full items-center gap-3 px-7 py-2.5 hover:theme-bg-overlay-md transition-colors text-left hover:cursor-pointer",children:[s.jsx("span",{className:"shrink-0 theme-text-faint",children:f?s.jsx(qa,{className:"h-3.5 w-3.5"}):s.jsx(vl,{className:"h-3.5 w-3.5"})}),s.jsx(J3,{method:n.method}),s.jsx("span",{className:"font-mono text-xs theme-text flex-1 truncate",children:n.path}),n.security&&n.security.length>0&&s.jsx(La,{className:"h-3 w-3 text-amber-500/60 shrink-0"}),n.deprecated&&s.jsx("span",{className:"rounded text-[9px] font-medium text-amber-500/60 border border-amber-500/20 px-1 py-0.5",children:"deprecated"}),s.jsxs("span",{onClick:v=>{v.stopPropagation(),u(n)},className:"inline-flex items-center gap-0.5 rounded px-1.5 py-0.5 text-[10px] border theme-border theme-text-faint hover:theme-bg-overlay-md hover:theme-text hover:cursor-pointer transition-colors",children:[s.jsx(ef,{className:"h-2.5 w-2.5"})," EDIT"]}),s.jsx("span",{onClick:v=>{v.stopPropagation(),o(n)},className:"inline-flex items-center rounded px-1.5 py-0.5 text-[10px] border border-[color:var(--brand)]/40 text-[color:var(--brand)] hover:bg-[color:var(--brand)]/10 hover:border-[color:var(--brand)]/60 hover:cursor-pointer transition-colors",children:"INSPECT"}),i&&s.jsxs("span",{onClick:v=>{v.stopPropagation(),i(n.path)},className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] border border-[color:var(--brand)]/30 text-[color:var(--brand)] hover:bg-[color:var(--brand)]/10 hover:cursor-pointer transition-colors",children:[s.jsx(Vr,{className:"h-2.5 w-2.5"})," Traces"]}),s.jsx("span",{className:"hidden sm:block text-[10px] theme-text-faint truncate max-w-[180px]",children:n.handlerName})]}),f&&s.jsxs("div",{className:"px-10 pb-4 pt-1 space-y-3 theme-bg-overlay",children:[g&&s.jsx("p",{className:"text-xs text-red-400 rounded border border-red-500/20 bg-red-500/10 px-2 py-1",children:g}),s.jsxs("div",{className:"flex flex-wrap gap-x-6 gap-y-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1 uppercase tracking-wider",children:"Method"}),s.jsx("select",{value:n.method,onChange:v=>m(n.id,{method:v.target.value}),className:"rounded-lg border theme-border theme-bg-overlay-md px-2 py-1 text-xs theme-text outline-none hover:cursor-pointer",children:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"].map(v=>s.jsx("option",{children:v},v))})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1 uppercase tracking-wider",children:"Path"}),s.jsx(p0,{value:n.path,onSave:v=>m(n.id,{path:v})})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1 uppercase tracking-wider",children:"Handler"}),s.jsx(p0,{value:n.handlerName??"—",onSave:v=>m(n.id,{handlerName:v}),mono:!1})]})]}),n.source&&s.jsxs("p",{className:"flex items-center gap-1.5 text-[10px] theme-text-faint",children:[s.jsx(Id,{className:"h-3 w-3 shrink-0",strokeWidth:2}),n.source.file.split(/[/\\]/).slice(-2).join("/"),":",n.source.line]}),Object.keys(p).length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1.5 uppercase tracking-wider",children:"Request Body"}),s.jsx("div",{className:"space-y-1",children:Object.entries(p).map(([v,N])=>s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border theme-border theme-bg-overlay-md px-3 py-1.5",children:[s.jsx("span",{className:"font-mono text-[11px] theme-text",children:v}),s.jsx("span",{className:"text-[10px] theme-text-faint",children:N.type}),N.required&&s.jsx("span",{className:"text-[10px] text-rose-400",children:"required"})]},v))})]}),Object.keys(b).length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1.5 uppercase tracking-wider",children:"Responses"}),s.jsx("div",{className:"space-y-1",children:Object.entries(b).map(([v,N])=>s.jsxs("div",{className:"flex items-start gap-2 rounded-lg border theme-border theme-bg-overlay-md px-3 py-1.5",children:[s.jsx("span",{className:`font-mono text-[11px] ${v.startsWith("2")?"text-emerald-400":"text-red-400"}`,children:v}),N.schema&&s.jsx("span",{className:"text-[10px] theme-text-muted",children:Object.keys(N.schema).join(", ")})]},v))})]}),n.middleware&&n.middleware.length>0&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] theme-text-faint mb-1.5 uppercase tracking-wider",children:"Middleware"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.middleware.map((v,N)=>s.jsx("span",{className:"rounded-lg border theme-border theme-bg-overlay-md px-2 py-0.5 text-[10px] theme-text-muted",children:v.name},N))})]})]})]})}function F3({prefix:n,endpoints:r,onUpdate:o,onInspect:i,onViewTraces:u,onEdit:f}){const[h,g]=j.useState(!1);return s.jsxs("div",{children:[s.jsxs("button",{type:"button",onClick:()=>g(x=>!x),className:"flex w-full items-center gap-3 px-4 py-2 hover:theme-bg-overlay-md transition-colors theme-bg-overlay hover:cursor-pointer",children:[s.jsx("span",{className:"text-[color:var(--brand)]",children:h?s.jsx(vl,{className:"h-3 w-3"}):s.jsx(qa,{className:"h-3 w-3"})}),s.jsx("span",{className:"font-mono text-xs font-medium text-[color:var(--brand)]",children:n}),s.jsx("span",{className:"ml-auto rounded-full border theme-border theme-bg-overlay-md px-2 py-0.5 text-[10px] theme-text-muted",children:r.length})]}),s.jsx("div",{className:"flex flex-col overflow-y-auto max-h-[calc(100vh-280px)]",children:!h&&r.map(x=>s.jsx(I3,{ep:x,onUpdate:o,onInspect:i,onViewTraces:u,onEdit:f},x.id))})]})}const ll=210,Cr=52,Td=100,x0=14,rl=36;function P3({endpoints:n}){const r=j.useRef(null),o=new Map;for(const x of n){const m="/"+(x.path.split("/")[1]??"");o.has(m)||o.set(m,[]),o.get(m).push(x)}const i=Array.from(o.entries()),u=Math.max(1,...i.map(([,x])=>x.length)),f=i.length*ll+(i.length-1)*Td+rl*2,h=u*Cr+(u-1)*x0+rl*2+24,g=new Map;return i.forEach(([,x],m)=>{const p=rl+m*(ll+Td);x.forEach((b,v)=>{g.set(b.id,{x:p,y:rl+24+v*(Cr+x0)})})}),j.useEffect(()=>{const x=r.current;if(!x)return;const m=x.getContext("2d");if(!m)return;m.clearRect(0,0,x.width,x.height);const p=getComputedStyle(document.documentElement).getPropertyValue("--brand").trim()||"#ffffff";m.strokeStyle=p,m.globalAlpha=.14,i.forEach(([,b],v)=>{if(v>=i.length-1)return;const N=i[v+1][1];b.forEach(C=>{const k=g.get(C.id);N.forEach(R=>{const z=g.get(R.id),V=k.x+ll,q=k.y+Cr/2,M=z.x,H=z.y+Cr/2,Z=(V+M)/2;m.beginPath(),m.lineWidth=1,m.moveTo(V,q),m.bezierCurveTo(Z,q,Z,H,M,H),m.stroke()})})})}),s.jsxs("div",{className:"relative overflow-auto",style:{minWidth:f,minHeight:h},children:[s.jsx("canvas",{ref:r,width:f,height:h,className:"absolute inset-0 pointer-events-none"}),i.map(([x],m)=>s.jsx("div",{className:"absolute text-[9px] font-medium text-[color:var(--brand)]/70 uppercase tracking-widest text-center",style:{left:rl+m*(ll+Td),top:rl,width:ll},children:x},x)),n.map(x=>{const m=g.get(x.id);if(!m)return null;const p=by(x.method);return s.jsxs("div",{className:"absolute rounded-lg border theme-border theme-bg-overlay shadow-md flex items-center gap-2 px-3 overflow-hidden hover:border-[color:var(--brand)]/30 transition-colors",style:{left:m.x,top:m.y,width:ll,height:Cr},children:[s.jsx("div",{className:"absolute left-0 top-0 bottom-0 w-[3px]",style:{background:p.dot}}),s.jsx("span",{className:`shrink-0 text-[9px] font-medium ${p.text}`,children:x.method}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"font-mono text-[10px] theme-text truncate",children:x.path}),s.jsx("p",{className:"text-[9px] theme-text-faint truncate",children:x.handlerName})]})]},x.id)})]})}function e4({onScan:n,scanning:r,error:o}){return s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-5 py-20 text-center",children:[s.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[s.jsx("div",{className:"absolute inset-0 rounded-full bg-[color:var(--brand)]/10 blur-xl"}),s.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-full border theme-border theme-bg-overlay text-[color:var(--brand)]",children:s.jsx(Ri,{className:"h-7 w-7",strokeWidth:2})})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-sm font-medium theme-text-primary",children:"No model found"}),s.jsxs("p",{className:"mt-1 text-xs theme-text-muted",children:["Scan your project to generate ",s.jsx("code",{className:"theme-text",children:".jetic/model.json"})]})]}),o&&s.jsx("p",{className:"text-xs text-red-400 max-w-xs",children:o}),s.jsxs("button",{type:"button",onClick:n,disabled:r,className:"flex items-center gap-2 rounded-lg bg-[var(--action)] px-5 py-2.5 text-sm font-medium text-[color:var(--action-foreground)] hover:bg-[var(--action-hover)] disabled:opacity-50 transition-colors hover:cursor-pointer",children:[r?s.jsx(dt,{className:"h-4 w-4 animate-spin",strokeWidth:2}):s.jsx(Ri,{className:"h-4 w-4",strokeWidth:2}),r?"Scanning project…":"Scan Project"]})]})}const Yi=["application/json","application/x-www-form-urlencoded","multipart/form-data","text/plain","application/xml","application/octet-stream"],vy=["string","integer","number","boolean","array","object"];function t4({open:n,onClose:r,onCreated:o}){const[i,u]=j.useState("basic"),[f,h]=j.useState(!1),[g,x]=j.useState(""),[m,p]=j.useState("GET"),[b,v]=j.useState(""),[N,C]=j.useState(""),[k,R]=j.useState(""),[z,V]=j.useState(""),[q,M]=j.useState([]),[H,Z]=j.useState("application/json"),[X,oe]=j.useState(""),[I,K]=j.useState(""),[ae,te]=j.useState(!1),[se,_]=j.useState([]),[W,E]=j.useState([]),[$,T]=j.useState(!1),A=$&&!b.trim(),S=j.useRef(null);j.useEffect(()=>{n&&(u("basic"),p("GET"),v(""),C(""),R(""),V(""),M([]),Z("application/json"),oe(""),K(""),te(!1),_([]),E([]),T(!1),x(""),h(!1))},[n]),j.useEffect(()=>{if(!n)return;const Y=ue=>{ue.key==="Escape"&&r()};return window.addEventListener("keydown",Y),()=>window.removeEventListener("keydown",Y)},[n,r]);const D=()=>M(Y=>[...Y,{name:"",in:"query",type:"string",required:!1,description:"",example:""}]),L=(Y,ue)=>M(re=>re.map((ee,Ee)=>Ee===Y?{...ee,...ue}:ee)),F=Y=>M(ue=>ue.filter((re,ee)=>ee!==Y)),ie=()=>_(Y=>[...Y,{status:"200",description:"",contentType:"application/json",schema:"",example:""}]),he=(Y,ue)=>_(re=>re.map((ee,Ee)=>Ee===Y?{...ee,...ue}:ee)),me=Y=>_(ue=>ue.filter((re,ee)=>ee!==Y)),Se=()=>E(Y=>[...Y,{name:""}]),ve=(Y,ue)=>E(re=>re.map((ee,Ee)=>Ee===Y?{name:ue}:ee)),Ae=Y=>E(ue=>ue.filter((re,ee)=>ee!==Y)),Re=(Y,ue)=>E(re=>{const ee=[...re],Ee=Y+ue;return Ee<0||Ee>=ee.length||([ee[Y],ee[Ee]]=[ee[Ee],ee[Y]]),ee}),We=async()=>{if(T(!0),!b.trim()){u("basic");return}h(!0),x("");try{const Y={method:m.toUpperCase(),path:b.startsWith("/")?b:"/"+b};N.trim()&&(Y.name=N.trim()),k.trim()&&(Y.description=k.trim()),z.trim()&&(Y.tags=z.split(",").map(ge=>ge.trim()).filter(Boolean));const ue=W.filter(ge=>ge.name.trim());Y.middleware=ue.map(ge=>({name:ge.name.trim()}));const re=q.filter(ge=>ge.name.trim());if(re.length>0&&(Y.parameters=re.map(ge=>{const ke={name:ge.name,in:ge.in,schema:{type:ge.type},required:ge.required};return ge.description.trim()&&(ke.description=ge.description),ge.example.trim()&&(ke.example=ge.example),ke})),X.trim()||I.trim()){const ge={},ke={};if(X.trim())try{ke.schema=JSON.parse(X)}catch{ke.schema=X}if(I.trim())try{ke.example=JSON.parse(I)}catch{ke.example=I}ge[H]=ke,Y.requestBody={required:ae,content:ge}}const ee=se.filter(ge=>ge.status.trim());if(ee.length>0){const ge={};for(const ke of ee){const Oe={};if(ke.description.trim()&&(Oe.description=ke.description),ke.schema.trim()||ke.example.trim()){const ze={};if(ke.schema.trim())try{ze.schema=JSON.parse(ke.schema)}catch{ze.schema=ke.schema}if(ke.example.trim())try{ze.example=JSON.parse(ke.example)}catch{ze.example=ke.example}Oe.content={[ke.contentType]:ze}}ge[ke.status]=Oe}Y.responses=ge}const Ee=await K3(Y);o(Ee.endpoint,Ee.model),r()}catch(Y){x(Y.message)}finally{h(!1)}};if(!n)return null;const Te=[{key:"basic",label:"Basic"},{key:"request",label:"Request"},{key:"responses",label:"Responses"},{key:"middleware",label:`Middleware${W.length>0?` (${W.length})`:""}`}],be="w-full rounded-lg border theme-border theme-bg-overlay px-3 py-2 text-xs theme-text placeholder-[var(--text-faint)] outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md transition-all",B="block text-[10px] theme-text-faint mb-1.5 uppercase tracking-wider font-medium";return s.jsx("div",{ref:S,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:Y=>{Y.target===S.current&&r()},children:s.jsxs("div",{className:"relative w-full max-w-2xl max-h-[85vh] flex flex-col rounded-2xl border border-[var(--border-md)] shadow-2xl overflow-hidden theme-bg-surface",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b theme-border",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-[color:var(--brand)]/10",children:s.jsx(av,{className:"h-4 w-4 text-[color:var(--brand)]"})}),s.jsx("h2",{className:"text-sm font-medium theme-text-primary",children:"Add Endpoint"})]}),s.jsx("button",{type:"button",onClick:r,className:"theme-text-faint hover:theme-text transition-colors hover:cursor-pointer",children:s.jsx(Tt,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"flex items-center gap-1 px-6 pt-4 pb-2",children:Te.map(Y=>s.jsx("button",{type:"button",onClick:()=>u(Y.key),className:`rounded-lg px-3 py-1.5 text-[11px] font-medium transition-all duration-200 hover:cursor-pointer ${i===Y.key?"bg-[color:var(--brand)]/15 text-[color:var(--brand)] shadow-sm":"theme-text-faint hover:theme-text-muted hover:theme-bg-overlay"}`,children:Y.label},Y.key))}),g&&s.jsxs("div",{className:"mx-6 mt-2 flex items-center gap-2 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2 text-xs text-red-400",children:[s.jsx(Ct,{className:"h-3.5 w-3.5 shrink-0"}),g]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-4",children:[i==="basic"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-[140px_1fr] gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Method *"}),s.jsx("select",{value:m,onChange:Y=>p(Y.target.value),className:`${be} hover:cursor-pointer`,children:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"].map(Y=>s.jsx("option",{children:Y},Y))})]}),s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Path *"}),s.jsx("input",{value:b,onChange:Y=>v(Y.target.value),placeholder:"/api/users",className:`${be} font-mono ${A?"border-red-500/60 focus:border-red-500/80":""}`}),A&&s.jsx("p",{className:"text-[10px] text-red-400 mt-1",children:"Path is required"})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Name"}),s.jsx("input",{value:N,onChange:Y=>C(Y.target.value),placeholder:"Create User",className:be})]}),s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Description"}),s.jsx("textarea",{value:k,onChange:Y=>R(Y.target.value),placeholder:"Creates a new user account",rows:2,className:`${be} resize-none`})]}),s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Tags"}),s.jsx("input",{value:z,onChange:Y=>V(Y.target.value),placeholder:"users, auth, public",className:be}),s.jsx("p",{className:"text-[10px] theme-text-faint mt-1",children:"Comma-separated"})]})]}),i==="request"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("p",{className:B+" mb-0",children:"Parameters"}),s.jsxs("button",{type:"button",onClick:D,className:"flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] font-medium text-[color:var(--brand)] hover:bg-[color:var(--brand)]/10 transition-colors hover:cursor-pointer",children:[s.jsx($t,{className:"h-3 w-3"})," Add Parameter"]})]}),q.length===0&&s.jsx("p",{className:"text-[10px] theme-text-faint italic",children:"No parameters added yet"}),s.jsx("div",{className:"space-y-2",children:q.map((Y,ue)=>s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay p-3 space-y-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"flex-1",children:s.jsx("input",{value:Y.name,onChange:re=>L(ue,{name:re.target.value}),placeholder:"Parameter name",className:`${be} font-mono`})}),s.jsx("select",{value:Y.in,onChange:re=>L(ue,{in:re.target.value}),className:`${be} w-28 hover:cursor-pointer`,children:["query","path","header","cookie"].map(re=>s.jsx("option",{children:re},re))}),s.jsx("select",{value:Y.type,onChange:re=>L(ue,{type:re.target.value}),className:`${be} w-28 hover:cursor-pointer`,children:vy.map(re=>s.jsx("option",{children:re},re))}),s.jsx("button",{type:"button",onClick:()=>F(ue),className:"mt-1.5 theme-text-faint hover:text-red-400 transition-colors hover:cursor-pointer",children:s.jsx(Yt,{className:"h-3.5 w-3.5"})})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] theme-text-muted hover:cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:Y.required,onChange:re=>L(ue,{required:re.target.checked}),className:"accent-[color:var(--brand)]"}),"Required"]}),s.jsx("input",{value:Y.description,onChange:re=>L(ue,{description:re.target.value}),placeholder:"Description",className:`${be} flex-1 text-[10px]`}),s.jsx("input",{value:Y.example,onChange:re=>L(ue,{example:re.target.value}),placeholder:"Example",className:`${be} w-32 text-[10px] font-mono`})]})]},ue))})]}),s.jsx("div",{className:"border-t theme-border"}),s.jsxs("div",{children:[s.jsx("p",{className:B,children:"Request Body"}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:B,children:"Content Type"}),s.jsx("select",{value:H,onChange:Y=>Z(Y.target.value),className:`${be} hover:cursor-pointer`,children:Yi.map(Y=>s.jsx("option",{children:Y},Y))})]}),s.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] theme-text-muted mt-5 hover:cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:ae,onChange:Y=>te(Y.target.checked),className:"accent-[color:var(--brand)]"}),"Required"]})]}),s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Schema (JSON)"}),s.jsx("textarea",{value:X,onChange:Y=>oe(Y.target.value),placeholder:`{
414
414
  "type": "object",
415
415
  "properties": {
416
416
  "email": { "type": "string", "format": "email" },
@@ -420,11 +420,11 @@ Error generating stack: `+a.message+`
420
420
  }`,rows:5,className:`${be} resize-none font-mono text-[11px] leading-relaxed`})]}),s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Example"}),s.jsx("textarea",{value:I,onChange:Y=>K(Y.target.value),placeholder:`{
421
421
  "email": "test@example.com",
422
422
  "password": "password123"
423
- }`,rows:3,className:`${be} resize-none font-mono text-[11px] leading-relaxed`})]})]})]})]}),i==="responses"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("p",{className:B+" mb-0",children:"Responses"}),s.jsxs("button",{type:"button",onClick:ie,className:"flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] font-medium text-[color:var(--brand)] hover:bg-[color:var(--brand)]/10 transition-colors hover:cursor-pointer",children:[s.jsx(Ht,{className:"h-3 w-3"})," Add Response"]})]}),se.length===0&&s.jsx("p",{className:"text-[10px] theme-text-faint italic",children:'No responses defined yet. Click "Add Response" above.'}),s.jsx("div",{className:"space-y-3",children:se.map((Y,ue)=>s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay p-3 space-y-3",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"w-24",children:[s.jsx("label",{className:B,children:"Status"}),s.jsx("input",{value:Y.status,onChange:re=>he(ue,{status:re.target.value}),placeholder:"200",className:`${be} font-mono`})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:B,children:"Description"}),s.jsx("input",{value:Y.description,onChange:re=>he(ue,{description:re.target.value}),placeholder:"Success",className:be})]}),s.jsxs("div",{className:"w-48",children:[s.jsx("label",{className:B,children:"Content Type"}),s.jsx("select",{value:Y.contentType,onChange:re=>he(ue,{contentType:re.target.value}),className:`${be} hover:cursor-pointer`,children:Yi.map(re=>s.jsx("option",{children:re},re))})]}),s.jsx("button",{type:"button",onClick:()=>me(ue),className:"mt-5 theme-text-faint hover:text-red-400 transition-colors hover:cursor-pointer",children:s.jsx(Yt,{className:"h-3.5 w-3.5"})})]}),s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Body Schema (JSON)"}),s.jsx("textarea",{value:Y.schema,onChange:re=>he(ue,{schema:re.target.value}),placeholder:`{
423
+ }`,rows:3,className:`${be} resize-none font-mono text-[11px] leading-relaxed`})]})]})]})]}),i==="responses"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("p",{className:B+" mb-0",children:"Responses"}),s.jsxs("button",{type:"button",onClick:ie,className:"flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] font-medium text-[color:var(--brand)] hover:bg-[color:var(--brand)]/10 transition-colors hover:cursor-pointer",children:[s.jsx($t,{className:"h-3 w-3"})," Add Response"]})]}),se.length===0&&s.jsx("p",{className:"text-[10px] theme-text-faint italic",children:'No responses defined yet. Click "Add Response" above.'}),s.jsx("div",{className:"space-y-3",children:se.map((Y,ue)=>s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay p-3 space-y-3",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"w-24",children:[s.jsx("label",{className:B,children:"Status"}),s.jsx("input",{value:Y.status,onChange:re=>he(ue,{status:re.target.value}),placeholder:"200",className:`${be} font-mono`})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:B,children:"Description"}),s.jsx("input",{value:Y.description,onChange:re=>he(ue,{description:re.target.value}),placeholder:"Success",className:be})]}),s.jsxs("div",{className:"w-48",children:[s.jsx("label",{className:B,children:"Content Type"}),s.jsx("select",{value:Y.contentType,onChange:re=>he(ue,{contentType:re.target.value}),className:`${be} hover:cursor-pointer`,children:Yi.map(re=>s.jsx("option",{children:re},re))})]}),s.jsx("button",{type:"button",onClick:()=>me(ue),className:"mt-5 theme-text-faint hover:text-red-400 transition-colors hover:cursor-pointer",children:s.jsx(Yt,{className:"h-3.5 w-3.5"})})]}),s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Body Schema (JSON)"}),s.jsx("textarea",{value:Y.schema,onChange:re=>he(ue,{schema:re.target.value}),placeholder:`{
424
424
  "type": "object",
425
425
  "properties": { ... }
426
426
  }`,rows:3,className:`${be} resize-none font-mono text-[11px] leading-relaxed`})]}),s.jsxs("div",{children:[s.jsx("label",{className:B,children:"Example"}),s.jsx("textarea",{value:Y.example,onChange:re=>he(ue,{example:re.target.value}),placeholder:`{
427
427
  "id": "abc123",
428
428
  "email": "test@example.com"
429
- }`,rows:2,className:`${be} resize-none font-mono text-[11px] leading-relaxed`})]})]},ue))})]}),i==="middleware"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:B+" mb-0",children:"Middleware Chain"}),s.jsx("p",{className:"text-[10px] theme-text-faint mt-0.5",children:"Executed in order, top → bottom"})]}),s.jsxs("button",{type:"button",onClick:Se,className:"flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] font-medium text-[color:var(--brand)] hover:bg-[color:var(--brand)]/10 transition-colors hover:cursor-pointer",children:[s.jsx(Ht,{className:"h-3 w-3"})," Add Middleware"]})]}),W.length===0&&s.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 rounded-lg border border-dashed theme-border text-center",children:[s.jsx(La,{className:"h-6 w-6 theme-text-faint",strokeWidth:1.5}),s.jsxs("p",{className:"text-[10px] theme-text-faint italic",children:["No middleware added yet.",s.jsx("br",{}),'Click "Add Middleware" to get started.']})]}),s.jsx("div",{className:"space-y-2",children:W.map((Y,ue)=>s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border theme-border theme-bg-overlay px-3 py-2",children:[s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("button",{type:"button",onClick:()=>Re(ue,-1),disabled:ue===0,className:"theme-text-faint hover:theme-text disabled:opacity-25 hover:cursor-pointer transition-colors leading-none",title:"Move up",children:s.jsx(qa,{className:"h-3 w-3 rotate-180"})}),s.jsx("button",{type:"button",onClick:()=>Re(ue,1),disabled:ue===W.length-1,className:"theme-text-faint hover:theme-text disabled:opacity-25 hover:cursor-pointer transition-colors leading-none",title:"Move down",children:s.jsx(qa,{className:"h-3 w-3"})})]}),s.jsx("span",{className:"text-[10px] theme-text-faint w-4 text-center shrink-0",children:ue+1}),s.jsx("input",{value:Y.name,onChange:re=>ve(ue,re.target.value),placeholder:"e.g. authenticateToken",className:`${be} flex-1 font-mono`}),s.jsx("button",{type:"button",onClick:()=>Ae(ue),className:"theme-text-faint hover:text-red-400 transition-colors hover:cursor-pointer shrink-0",title:"Remove",children:s.jsx(Yt,{className:"h-3.5 w-3.5"})})]},ue))})]})]}),s.jsxs("div",{className:"flex items-center justify-between border-t theme-border px-6 py-4",children:[s.jsxs("p",{className:"text-[10px] theme-text-faint",children:["Only ",s.jsx("span",{className:"theme-text-muted",children:"Method"})," and ",s.jsx("span",{className:"theme-text-muted",children:"Path"})," are required"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:r,className:"rounded-lg border theme-border px-4 py-2 text-xs font-medium theme-text-muted hover:theme-bg-overlay-md hover:theme-text transition-colors hover:cursor-pointer",children:"Cancel"}),s.jsxs("button",{type:"button",onClick:We,disabled:f,className:"flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-4 py-2 text-xs font-medium text-[color:var(--action-foreground)] hover:bg-[var(--action-hover)] disabled:opacity-50 transition-colors hover:cursor-pointer",children:[f?s.jsx(dt,{className:"h-3.5 w-3.5 animate-spin"}):s.jsx(Ht,{className:"h-3.5 w-3.5"}),f?"Adding…":"Add Endpoint"]})]})]})]})})}function n4({endpoint:n,onClose:r,onSaved:o}){const[i,u]=j.useState("basic"),[f,h]=j.useState(!1),[g,x]=j.useState(""),[m,p]=j.useState(n.method),[b,v]=j.useState(n.path),[N,C]=j.useState(n.name??""),[k,R]=j.useState(n.description??""),[z,V]=j.useState((n.tags??[]).join(", ")),[q,M]=j.useState(n.deprecated??!1),[H,Z]=j.useState(()=>(n.parameters??[]).filter(B=>B.in!=="body").map(B=>({name:B.name,in:B.in??"query",type:B.type,required:B.required??!1,description:B.description??"",example:B.example?String(B.example):""}))),[X,oe]=j.useState(n.requestBody?.contentType??"application/json"),[I,K]=j.useState(n.requestBody?.required??!1),[ae,te]=j.useState(()=>{const B=n.requestBody?.fields;if(!B||Object.keys(B).length===0)return"";const Y={},ue=[];for(const[re,ee]of Object.entries(B))Y[re]={type:ee.type,...ee.format?{format:ee.format}:{},...ee.description?{description:ee.description}:{}},ee.required&&ue.push(re);return JSON.stringify({type:"object",properties:Y,...ue.length>0?{required:ue}:{}},null,2)}),[se,_]=j.useState(""),[W,E]=j.useState(()=>Object.entries(n.responses??{}).map(([B,Y])=>({status:B,description:Y.description??"",contentType:Y.contentType??"application/json",schema:Y.schema?JSON.stringify(Y.schema,null,2):"",example:""}))),[$,T]=j.useState((n.middleware??[]).map(B=>({name:B.name}))),A=j.useRef(null);j.useEffect(()=>{if(!open)return;const B=Y=>{Y.key==="Escape"&&r()};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[r]);const S=()=>Z(B=>[...B,{name:"",in:"query",type:"string",required:!1,description:"",example:""}]),D=(B,Y)=>Z(ue=>ue.map((re,ee)=>ee===B?{...re,...Y}:re)),L=B=>Z(Y=>Y.filter((ue,re)=>re!==B)),F=()=>E(B=>[...B,{status:"200",description:"",contentType:"application/json",schema:"",example:""}]),ie=(B,Y)=>E(ue=>ue.map((re,ee)=>ee===B?{...re,...Y}:re)),he=B=>E(Y=>Y.filter((ue,re)=>re!==B)),me=()=>T(B=>[...B,{name:""}]),Se=(B,Y)=>T(ue=>ue.map((re,ee)=>ee===B?{name:Y}:re)),ve=B=>T(Y=>Y.filter((ue,re)=>re!==B)),Ae=(B,Y)=>T(ue=>{const re=[...ue],ee=B+Y;return ee<0||ee>=re.length||([re[B],re[ee]]=[re[ee],re[B]]),re}),Re=async()=>{if(!b.trim()){u("basic");return}h(!0),x("");try{const B={id:n.id,method:m.toUpperCase(),path:b.startsWith("/")?b:"/"+b};N.trim()&&(B.name=N.trim()),k.trim()&&(B.description=k.trim()),z.trim()&&(B.tags=z.split(",").map(ee=>ee.trim()).filter(Boolean)),q&&(B.deprecated=!0),n.handlerName&&(B.handlerName=n.handlerName),n.source&&(B.source=n.source),n.security&&(B.security=n.security),B.middleware=$.filter(ee=>ee.name.trim()).map(ee=>({name:ee.name.trim()}));const Y=H.filter(ee=>ee.name.trim());if(Y.length>0&&(B.parameters=Y.map(ee=>({name:ee.name,in:ee.in,schema:{type:ee.type},required:ee.required,...ee.description?{description:ee.description}:{},...ee.example?{example:ee.example}:{}}))),ae.trim()){const ee={};try{ee.schema=JSON.parse(ae)}catch{ee.schema=ae}if(se.trim())try{ee.example=JSON.parse(se)}catch{ee.example=se}B.requestBody={required:I,content:{[X]:ee}}}const ue=W.filter(ee=>ee.status.trim());if(ue.length>0){const ee={};for(const Ee of ue){const ge={};if(Ee.description.trim()&&(ge.description=Ee.description),Ee.schema.trim())try{ge.schema=JSON.parse(Ee.schema)}catch{ge.schema=Ee.schema}ee[Ee.status]=ge}B.responses=ee}const re=await fetch(`/api/model/endpoint/${n.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)});if(!re.ok){const ee=await re.json().catch(()=>({}));throw new Error(ee.error??`Save failed (${re.status})`)}o({...n,...B})}catch(B){x(B.message)}finally{h(!1)}},We=[{key:"basic",label:"Basic"},{key:"request",label:"Request"},{key:"responses",label:"Responses"},{key:"middleware",label:`Middleware${$.length>0?` (${$.length})`:""}`}],Te="w-full rounded-lg border theme-border theme-bg-overlay px-3 py-2 text-xs theme-text placeholder-[var(--text-faint)] outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md transition-all",be="block text-[10px] theme-text-faint mb-1.5 uppercase tracking-wider font-medium";return s.jsx("div",{ref:A,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:B=>{B.target===A.current&&r()},children:s.jsxs("div",{className:"relative w-full max-w-2xl max-h-[85vh] flex flex-col rounded-2xl border border-[var(--border-md)] shadow-2xl overflow-hidden theme-bg-surface",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b theme-border",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-amber-500/10",children:s.jsx(ef,{className:"h-4 w-4 text-amber-400"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-medium theme-text-primary",children:"Edit Endpoint"}),s.jsxs("p",{className:"text-[10px] theme-text-faint font-mono",children:[n.method," ",n.path]})]})]}),s.jsx("button",{type:"button",onClick:r,className:"theme-text-faint hover:theme-text transition-colors hover:cursor-pointer",children:s.jsx(Ct,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"flex items-center gap-1 px-6 pt-4 pb-2",children:We.map(B=>s.jsx("button",{type:"button",onClick:()=>u(B.key),className:`rounded-lg px-3 py-1.5 text-[11px] font-medium transition-all duration-200 hover:cursor-pointer ${i===B.key?"bg-amber-500/15 text-amber-400 shadow-sm":"theme-text-faint hover:theme-text-muted hover:theme-bg-overlay"}`,children:B.label},B.key))}),g&&s.jsxs("div",{className:"mx-6 mt-2 flex items-center gap-2 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2 text-xs text-red-400",children:[s.jsx(_t,{className:"h-3.5 w-3.5 shrink-0"}),g]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-4",children:[i==="basic"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-[140px_1fr] gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Method *"}),s.jsx("select",{value:m,onChange:B=>p(B.target.value),className:`${Te} hover:cursor-pointer`,children:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"].map(B=>s.jsx("option",{children:B},B))})]}),s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Path *"}),s.jsx("input",{value:b,onChange:B=>v(B.target.value),placeholder:"/api/users",className:`${Te} font-mono`})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Name"}),s.jsx("input",{value:N,onChange:B=>C(B.target.value),placeholder:"Create User",className:Te})]}),s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Description"}),s.jsx("textarea",{value:k,onChange:B=>R(B.target.value),rows:2,className:`${Te} resize-none`})]}),s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Tags"}),s.jsx("input",{value:z,onChange:B=>V(B.target.value),placeholder:"users, auth, public",className:Te}),s.jsx("p",{className:"text-[10px] theme-text-faint mt-1",children:"Comma-separated"})]}),s.jsxs("label",{className:"flex items-center gap-2 text-[11px] theme-text-muted hover:cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:q,onChange:B=>M(B.target.checked),className:"accent-amber-500"}),"Mark as deprecated"]})]}),i==="request"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("p",{className:be+" mb-0",children:"Parameters"}),s.jsxs("button",{type:"button",onClick:S,className:"flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] font-medium text-amber-400 hover:bg-amber-500/10 transition-colors hover:cursor-pointer",children:[s.jsx(Ht,{className:"h-3 w-3"})," Add Parameter"]})]}),H.length===0&&s.jsx("p",{className:"text-[10px] theme-text-faint italic",children:"No parameters"}),s.jsx("div",{className:"space-y-2",children:H.map((B,Y)=>s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay p-3 space-y-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"flex-1",children:s.jsx("input",{value:B.name,onChange:ue=>D(Y,{name:ue.target.value}),placeholder:"name",className:`${Te} font-mono`})}),s.jsx("select",{value:B.in,onChange:ue=>D(Y,{in:ue.target.value}),className:`${Te} w-28 hover:cursor-pointer`,children:["query","path","header","cookie"].map(ue=>s.jsx("option",{children:ue},ue))}),s.jsx("select",{value:B.type,onChange:ue=>D(Y,{type:ue.target.value}),className:`${Te} w-28 hover:cursor-pointer`,children:vy.map(ue=>s.jsx("option",{children:ue},ue))}),s.jsx("button",{type:"button",onClick:()=>L(Y),className:"mt-1.5 theme-text-faint hover:text-red-400 transition-colors hover:cursor-pointer",children:s.jsx(Yt,{className:"h-3.5 w-3.5"})})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] theme-text-muted hover:cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:B.required,onChange:ue=>D(Y,{required:ue.target.checked}),className:"accent-amber-500"})," Required"]}),s.jsx("input",{value:B.description,onChange:ue=>D(Y,{description:ue.target.value}),placeholder:"Description",className:`${Te} flex-1 text-[10px]`})]})]},Y))})]}),s.jsx("div",{className:"border-t theme-border"}),s.jsxs("div",{children:[s.jsx("p",{className:be,children:"Request Body"}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:be,children:"Content Type"}),s.jsx("select",{value:X,onChange:B=>oe(B.target.value),className:`${Te} hover:cursor-pointer`,children:Yi.map(B=>s.jsx("option",{children:B},B))})]}),s.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] theme-text-muted mt-5 hover:cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:I,onChange:B=>K(B.target.checked),className:"accent-amber-500"})," Required"]})]}),s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Schema (JSON)"}),s.jsx("textarea",{value:ae,onChange:B=>te(B.target.value),rows:5,className:`${Te} resize-none font-mono text-[11px] leading-relaxed`})]}),s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Example"}),s.jsx("textarea",{value:se,onChange:B=>_(B.target.value),rows:3,className:`${Te} resize-none font-mono text-[11px] leading-relaxed`})]})]})]})]}),i==="responses"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("p",{className:be+" mb-0",children:"Responses"}),s.jsxs("button",{type:"button",onClick:F,className:"flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] font-medium text-amber-400 hover:bg-amber-500/10 transition-colors hover:cursor-pointer",children:[s.jsx(Ht,{className:"h-3 w-3"})," Add Response"]})]}),W.length===0&&s.jsx("p",{className:"text-[10px] theme-text-faint italic",children:"No responses defined."}),s.jsx("div",{className:"space-y-3",children:W.map((B,Y)=>s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay p-3 space-y-3",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"w-24",children:[s.jsx("label",{className:be,children:"Status"}),s.jsx("input",{value:B.status,onChange:ue=>ie(Y,{status:ue.target.value}),placeholder:"200",className:`${Te} font-mono`})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:be,children:"Description"}),s.jsx("input",{value:B.description,onChange:ue=>ie(Y,{description:ue.target.value}),placeholder:"Success",className:Te})]}),s.jsxs("div",{className:"w-48",children:[s.jsx("label",{className:be,children:"Content Type"}),s.jsx("select",{value:B.contentType,onChange:ue=>ie(Y,{contentType:ue.target.value}),className:`${Te} hover:cursor-pointer`,children:Yi.map(ue=>s.jsx("option",{children:ue},ue))})]}),s.jsx("button",{type:"button",onClick:()=>he(Y),className:"mt-5 theme-text-faint hover:text-red-400 transition-colors hover:cursor-pointer",children:s.jsx(Yt,{className:"h-3.5 w-3.5"})})]}),s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Body Schema (JSON)"}),s.jsx("textarea",{value:B.schema,onChange:ue=>ie(Y,{schema:ue.target.value}),rows:3,className:`${Te} resize-none font-mono text-[11px] leading-relaxed`})]})]},Y))})]}),i==="middleware"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:be+" mb-0",children:"Middleware Chain"}),s.jsx("p",{className:"text-[10px] theme-text-faint mt-0.5",children:"Executed in order, top → bottom"})]}),s.jsxs("button",{type:"button",onClick:me,className:"flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] font-medium text-amber-400 hover:bg-amber-500/10 transition-colors hover:cursor-pointer",children:[s.jsx(Ht,{className:"h-3 w-3"})," Add Middleware"]})]}),$.length===0&&s.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 rounded-lg border border-dashed theme-border text-center",children:[s.jsx(La,{className:"h-6 w-6 theme-text-faint",strokeWidth:1.5}),s.jsx("p",{className:"text-[10px] theme-text-faint italic",children:'No middleware. Click "Add Middleware" to get started.'})]}),s.jsx("div",{className:"space-y-2",children:$.map((B,Y)=>s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border theme-border theme-bg-overlay px-3 py-2",children:[s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("button",{type:"button",onClick:()=>Ae(Y,-1),disabled:Y===0,className:"theme-text-faint hover:theme-text disabled:opacity-25 hover:cursor-pointer transition-colors leading-none",title:"Move up",children:s.jsx(qa,{className:"h-3 w-3 rotate-180"})}),s.jsx("button",{type:"button",onClick:()=>Ae(Y,1),disabled:Y===$.length-1,className:"theme-text-faint hover:theme-text disabled:opacity-25 hover:cursor-pointer transition-colors leading-none",title:"Move down",children:s.jsx(qa,{className:"h-3 w-3"})})]}),s.jsx("span",{className:"text-[10px] theme-text-faint w-4 text-center shrink-0",children:Y+1}),s.jsx("input",{value:B.name,onChange:ue=>Se(Y,ue.target.value),placeholder:"e.g. authenticateToken",className:`${Te} flex-1 font-mono`}),s.jsx("button",{type:"button",onClick:()=>ve(Y),className:"theme-text-faint hover:text-red-400 transition-colors hover:cursor-pointer shrink-0",title:"Remove",children:s.jsx(Yt,{className:"h-3.5 w-3.5"})})]},Y))})]})]}),s.jsxs("div",{className:"flex items-center justify-between border-t theme-border px-6 py-4",children:[s.jsxs("p",{className:"text-[10px] theme-text-faint",children:["ID: ",s.jsx("span",{className:"font-mono",children:n.id})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:r,className:"rounded-lg border theme-border px-4 py-2 text-xs font-medium theme-text-muted hover:theme-bg-overlay-md hover:theme-text transition-colors hover:cursor-pointer",children:"Cancel"}),s.jsxs("button",{type:"button",onClick:Re,disabled:f,className:"flex items-center gap-1.5 rounded-lg bg-amber-500 px-4 py-2 text-xs font-medium theme-text-primary hover:bg-amber-400 disabled:opacity-50 transition-colors hover:cursor-pointer",children:[f?s.jsx(dt,{className:"h-3.5 w-3.5 animate-spin"}):s.jsx(ut,{className:"h-3.5 w-3.5"}),f?"Saving…":"Save Changes"]})]})]})]})})}function a4({onInspect:n,onViewTraces:r}){const[o,i]=j.useState(null),[u,f]=j.useState(!0),[h,g]=j.useState(!1),[x,m]=j.useState(!1),[p,b]=j.useState(null),[v,N]=j.useState(""),[C,k]=j.useState("list"),[R,z]=j.useState(""),[V,q]=j.useState(!1),[M,H]=j.useState(null),Z=j.useCallback(async(te=!1)=>{te?g(!0):f(!0),b(null);try{i(await Z3())}catch(se){b(se.message)}finally{f(!1),g(!1)}},[]);j.useEffect(()=>{Z()},[Z]);const X=async()=>{m(!0),N("");try{i(await W3())}catch(te){N(te.message)}finally{m(!1)}},oe=(te,se)=>{i(_=>_&&{..._,endpoints:_.endpoints.map(W=>W.id===te?{...W,...se}:W)})},I=(te,se)=>{i(se)},K=(o?.endpoints??[]).filter(te=>!R||te.path.toLowerCase().includes(R.toLowerCase())||te.method.toLowerCase().includes(R.toLowerCase())||(te.handlerName??"").toLowerCase().includes(R.toLowerCase())),ae=new Map;for(const te of K){const se="/"+(te.path.split("/")[1]??"");ae.has(se)||ae.set(se,[]),ae.get(se).push(te)}return s.jsxs("div",{className:"flex min-h-full w-full flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium theme-text-primary leading-none",children:o?.project?.name??"Model"}),s.jsx("p",{className:"mt-0.5 text-[11px] theme-text-muted",children:u?"Loading…":o?`v${o.version} · ${o.endpoints.length} endpoints · ${o.project.framework??o.project.language??""}`:"No model generated yet"})]})}),s.jsxs("div",{className:"flex items-center gap-2",children:[o&&s.jsx("div",{className:"flex items-center gap-1 rounded-xl border theme-border theme-bg-overlay p-1",children:["list","graph"].map(te=>s.jsxs("button",{type:"button",onClick:()=>k(te),className:`flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[11px] font-medium transition-all duration-200 hover:cursor-pointer ${C===te?"bg-[color:var(--brand)]/15 text-[color:var(--brand)] shadow-sm":"theme-text-faint hover:theme-text-muted"}`,children:[te==="list"?s.jsx(R0,{className:"h-3.5 w-3.5",strokeWidth:2}):s.jsx(Pd,{className:"h-3.5 w-3.5",strokeWidth:2}),te.charAt(0).toUpperCase()+te.slice(1)]},te))}),s.jsx("button",{type:"button",onClick:()=>Z(!0),disabled:h||u,className:"flex h-8 w-8 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-muted hover:theme-bg-overlay-md hover:theme-text disabled:opacity-40 transition-all hover:cursor-pointer",children:s.jsx(na,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`,strokeWidth:2})}),s.jsxs("button",{type:"button",onClick:X,disabled:x,className:"flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-3 py-1.5 text-sm font-medium text-[color:var(--action-foreground)] hover:bg-[var(--action-hover)] disabled:opacity-50 transition-colors hover:cursor-pointer",children:[x?s.jsx(dt,{className:"h-3.5 w-3.5 animate-spin",strokeWidth:2}):s.jsx(Ri,{className:"h-3.5 w-3.5",strokeWidth:2}),x?"Scanning…":"Re-scan"]}),s.jsxs("button",{type:"button",onClick:()=>q(!0),className:"flex items-center gap-1.5 rounded-lg bg-emerald-500 px-3 py-1.5 text-sm font-medium theme-text-primary hover:bg-emerald-400 transition-colors hover:cursor-pointer",children:[s.jsx(Ht,{className:"h-3.5 w-3.5",strokeWidth:2}),"Add Endpoint"]})]})]}),v&&s.jsxs("div",{className:"flex items-center gap-2 border-b border-red-500/20 bg-red-500/[0.06] px-6 py-2 text-xs text-red-400",children:[s.jsx(_t,{className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),v,s.jsx("button",{type:"button",onClick:()=>N(""),className:"ml-auto hover:cursor-pointer",children:s.jsx(Ct,{className:"h-3.5 w-3.5",strokeWidth:2})})]}),s.jsxs("div",{className:"flex flex-1 flex-col",children:[u&&s.jsx("div",{className:"space-y-2 p-6",children:[1,2,3,4].map(te=>s.jsx("div",{className:"h-10 animate-pulse rounded-lg border theme-border theme-bg-overlay",style:{opacity:1-te*.18}},te))}),!u&&p&&s.jsxs("div",{className:"flex flex-col items-center gap-4 m-6 rounded-lg border border-red-500/20 bg-red-500/[0.06] p-10 text-center",children:[s.jsx(_t,{className:"h-8 w-8 text-red-400",strokeWidth:2}),s.jsx("p",{className:"text-sm text-red-300",children:p}),s.jsx("button",{type:"button",onClick:()=>Z(),className:"rounded-lg border border-red-500/20 bg-red-500/10 px-4 py-1.5 text-xs text-red-400 hover:bg-red-500/20 transition-colors hover:cursor-pointer",children:"Retry"})]}),!u&&!p&&!o&&s.jsx(e4,{onScan:X,scanning:x,error:v}),!u&&!p&&o&&C==="graph"&&s.jsx("div",{className:"flex-1 overflow-auto p-6",children:s.jsx(P3,{endpoints:K})}),!u&&!p&&o&&C==="list"&&s.jsxs("div",{className:"flex flex-1 flex-col",children:[s.jsxs("div",{className:"flex items-center gap-3 border-b theme-border px-6 py-3",children:[s.jsx("input",{value:R,onChange:te=>z(te.target.value),placeholder:"Filter by path, method or handler…",className:"w-full max-w-sm rounded-lg border theme-border theme-bg-overlay py-1.5 px-3 text-xs theme-text placeholder-[var(--text-faint)] outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md transition-all"}),R&&s.jsx("button",{type:"button",onClick:()=>z(""),className:"theme-text-faint hover:theme-text hover:cursor-pointer",children:s.jsx(Ct,{className:"h-3.5 w-3.5",strokeWidth:2})}),s.jsxs("span",{className:"ml-auto text-[10px] theme-text-faint",children:[K.length," endpoint",K.length!==1?"s":""]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto max-h-[calc(100vh-170px)] divide-y divide-[var(--border)]",children:[Array.from(ae.entries()).map(([te,se])=>s.jsx(F3,{prefix:te,endpoints:se,onUpdate:oe,onInspect:_=>n?.(_),onViewTraces:r?_=>r({endpointPath:_}):void 0,onEdit:_=>H(_)},te)),K.length===0&&s.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-center",children:[s.jsxs("p",{className:"text-sm theme-text-muted",children:['No endpoints match "',R,'"']}),s.jsx("button",{type:"button",onClick:()=>z(""),className:"text-xs text-[color:var(--brand)] hover:text-[color:var(--brand)] transition-colors hover:cursor-pointer",children:"Clear filter"})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 border-t theme-border px-6 py-2.5 text-[10px] theme-text-faint",children:["Generated ",new Date(o.generatedAt).toLocaleString(),s.jsx("span",{className:"ml-auto",children:s.jsx("button",{type:"button",onClick:()=>Z(!0),className:"theme-text-faint hover:theme-text transition-colors hover:cursor-pointer",children:"Refresh"})})]})]})]}),s.jsx(t4,{open:V,onClose:()=>q(!1),onCreated:I}),M&&s.jsx(n4,{endpoint:M,onClose:()=>H(null),onSaved:te=>{i(se=>se&&{...se,endpoints:se.endpoints.map(_=>_.id===te.id?te:_)}),H(null)}})]})}const g0={GET:{bg:"bg-emerald-500/10",text:"text-emerald-400",border:"border-emerald-500/30"},POST:{bg:"bg-[color:var(--brand)]/10",text:"text-[color:var(--brand)]",border:"border-[color:var(--brand)]/30"},PUT:{bg:"bg-amber-500/10",text:"text-amber-400",border:"border-amber-500/30"},PATCH:{bg:"bg-orange-500/10",text:"text-orange-400",border:"border-orange-500/30"},DELETE:{bg:"bg-red-500/10",text:"text-red-400",border:"border-red-500/30"},HEAD:{bg:"theme-bg-overlay-md",text:"theme-text-muted",border:"theme-border"},OPTIONS:{bg:"bg-[color:var(--brand)]/10",text:"text-[color:var(--brand)]",border:"border-[color:var(--brand)]/30"}};function s4(n){return g0[n.toUpperCase()]??g0.GET}function Jd({method:n,size:r="md"}){const o=s4(n);return s.jsx("span",{className:`inline-flex items-center rounded font-medium tracking-widest border ${o.bg} ${o.text} ${o.border} ${r==="sm"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-[11px]"}`,children:n.toUpperCase()})}function y0(n,r,o){const i=n.toLowerCase();return i.includes("email")?"user@example.com":i.includes("name")?"Jane Doe":i.includes("username")?"jane_doe":i.includes("password")?"P@ssw0rd123!":i.includes("phone")?"+14155552671":i.includes("url")?"https://example.com":i.includes("id")?Math.random().toString(36).slice(2,10):i.includes("date")||o==="date"?new Date().toISOString().split("T")[0]:i.includes("time")||o==="date-time"?new Date().toISOString():r==="integer"||r==="number"?String(Math.floor(Math.random()*100)+1):r==="boolean"?"true":r==="array"?"[]":r==="object"?"{}":`fake_${i}`}function ul({children:n,className:r=""}){return s.jsx("div",{className:`rounded-lg border theme-border theme-bg-overlay overflow-hidden ${r}`,children:n})}function Rr({icon:n,label:r,count:o,action:i}){return s.jsxs("div",{className:"flex items-center gap-2.5 border-b theme-border px-4 py-2.5 theme-bg-overlay-md",children:[s.jsx(n,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2}),s.jsx("span",{className:"text-[11px] font-semibold tracking-wider theme-text-faint uppercase",children:r}),o!==void 0&&s.jsx("span",{className:"rounded-full border theme-border theme-bg-overlay px-2 py-0.5 text-[10px] theme-text-muted",children:o}),i&&s.jsx("div",{className:"ml-auto",children:i})]})}function l4({endpoint:n}){const[r,o]=j.useState(null),[i,u]=j.useState(1),[f,h]=j.useState(!1),[g,x]=j.useState(""),m=j.useCallback(async()=>{if(n.source){h(!0),x(""),o(null);try{const N=await fetch(`/api/model/source?file=${encodeURIComponent(n.source.file)}&line=${n.source.line}`);if(!N.ok){if((N.headers.get("content-type")??"").includes("application/json")){const R=await N.json().catch(()=>({}));throw new Error(R.error??`HTTP ${N.status}`)}throw new Error(`HTTP ${N.status}`)}if((N.headers.get("content-type")??"").includes("application/json")){const k=await N.json();o(k.source??k.content??""),u(k.startLine??1)}else o(await N.text()),u(1)}catch(N){x(N.message)}finally{h(!1)}}},[n]);if(j.useEffect(()=>{m()},[m]),!n.source)return null;const p=n.source.file.split(/[/\\]/).slice(-3).join("/"),b=r?r.split(`
430
- `):[],v=n.source.line-i;return s.jsxs(ul,{children:[s.jsxs("div",{className:"flex items-center gap-2.5 border-b theme-border px-4 py-2.5 theme-bg-overlay-md",children:[s.jsx(Id,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2}),s.jsx("span",{className:"text-[11px] font-semibold tracking-wider theme-text-faint uppercase",children:"Source"}),s.jsx("span",{className:"ml-2 font-mono text-[11px] theme-text-muted truncate",children:p}),s.jsxs("span",{className:"rounded border theme-border theme-bg-overlay px-1.5 py-0.5 font-mono text-[10px] theme-text",children:[":",n.source.line]}),s.jsx("button",{type:"button",onClick:m,disabled:f,className:"ml-auto flex h-6 w-6 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-muted hover:theme-bg-overlay-md hover:theme-text transition-colors hover:cursor-pointer",children:s.jsx(na,{className:`h-3 w-3 ${f?"animate-spin":""}`,strokeWidth:2})})]}),s.jsxs("div",{className:"relative bg-[var(--sidebar-bg)]",children:[f&&s.jsxs("div",{className:"flex items-center gap-2 px-4 py-4 text-[11px] theme-text-muted",children:[s.jsx(dt,{className:"h-3.5 w-3.5 animate-spin",strokeWidth:2})," Loading source…"]}),g&&s.jsxs("div",{className:"flex items-start gap-2 px-4 py-3 text-[11px] text-red-400",children:[s.jsx(_t,{className:"h-3.5 w-3.5 mt-0.5 shrink-0",strokeWidth:2}),s.jsxs("span",{children:["Source unavailable — ",g]})]}),r&&!f&&s.jsx("div",{className:"overflow-auto max-h-[340px]",children:s.jsx("table",{className:"w-full border-collapse",children:s.jsx("tbody",{children:b.map((N,C)=>{const k=i+C,R=C===v;return s.jsxs("tr",{className:R?"bg-[color:var(--brand)]/[0.08]":"hover:theme-bg-overlay-md",children:[s.jsx("td",{className:`select-none w-12 px-3 py-0 text-right font-mono text-[10px] border-r theme-border leading-5 ${R?"text-[color:var(--brand)]":"theme-text-faint"}`,children:k}),s.jsx("td",{className:`px-4 py-0 font-mono text-[11px] whitespace-pre leading-5 ${R?"theme-text-primary":"theme-text-muted"}`,children:N||" "})]},C)})})})})]})]})}function r4({endpoint:n}){const[r,o]=j.useState([]),[i,u]=j.useState(!0),[f,h]=j.useState("");j.useEffect(()=>{u(!0),h(""),o([]),fetch(`/api/model/related?id=${encodeURIComponent(n.id)}`).then(x=>{const m=x.headers.get("content-type")??"";if(!x.ok||!m.includes("application/json"))throw new Error(`HTTP ${x.status}`);return x.json()}).then(x=>o(x?.files??[])).catch(x=>h(x.message)).finally(()=>u(!1))},[n.id]);const g={ts:"text-[color:var(--brand)]",tsx:"text-[color:var(--brand)]",js:"text-amber-400",jsx:"text-amber-300",json:"text-emerald-400"};return s.jsxs(ul,{children:[s.jsx(Rr,{icon:Fd,label:"Related Files",count:!i&&!f?r.length:void 0}),s.jsxs("div",{className:"divide-y divide-[var(--border)]",children:[i&&s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 text-[11px] theme-text-muted",children:[s.jsx(dt,{className:"h-3.5 w-3.5 animate-spin",strokeWidth:2})," Resolving files…"]}),!i&&f&&s.jsxs("div",{className:"flex items-start gap-2 px-4 py-3 text-[11px] text-red-400",children:[s.jsx(_t,{className:"h-3.5 w-3.5 mt-0.5 shrink-0",strokeWidth:2}),s.jsxs("span",{children:["Could not resolve — ",f]})]}),!i&&!f&&r.length===0&&s.jsx("p",{className:"px-4 py-4 text-[12px] theme-text-faint italic",children:"No related files resolved"}),r.map(x=>{const m=x.split(/[/\\]/),p=m.pop()??x,b=m.slice(-2).join("/"),v=p.split(".").pop()??"",N=g[v]??"theme-text-faint";return s.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 hover:theme-bg-overlay-md transition-colors",children:[s.jsx(Vi,{className:`h-[15px] w-[15px] shrink-0 ${N}`,strokeWidth:2}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-[13px] theme-text truncate",children:p}),b&&s.jsx("p",{className:"text-[10px] theme-text-faint truncate font-mono",children:b})]}),s.jsxs("span",{className:`shrink-0 rounded border theme-border theme-bg-overlay-md px-1.5 py-0.5 text-[10px] font-mono ${N}`,children:[".",v]})]},x)})]})]})}function b0({endpoint:n}){const[r,o]=j.useState("fake"),[i,u]=j.useState(""),[f,h]=j.useState({}),[g,x]=j.useState(!1),[m,p]=j.useState(null),[b,v]=j.useState("http://localhost:3000"),[N,C]=j.useState([]),[k,R]=j.useState(null),[z,V]=j.useState(!1);j.useEffect(()=>{fetch("/api/model/environments").then(K=>K.ok?K.json():null).then(K=>{if(!K)return;C(K.environments??[]);const ae=K.defaultEnvironment??K.environments?.find(se=>se.default)?.name??K.environments?.[0]?.name??null;R(ae);const te=(K.environments??[]).find(se=>se.name===ae);te&&v(te.baseUrl)}).catch(()=>{}).finally(()=>V(!0))},[]);const q=n.requestBody?.fields??{},M=(n.security?.length??0)>0,H=["POST","PUT","PATCH"].includes(n.method.toUpperCase());j.useEffect(()=>{p(null),h({})},[n.id]);const Z=()=>{const K={};for(const[ae,te]of Object.entries(q))K[ae]=y0(ae,te.type,te.format);return K},X=()=>{const K={};for(const[ae,te]of Object.entries(q)){const se=f[ae]??"";se&&(te.type==="integer"||te.type==="number"?K[ae]=Number(se):te.type==="boolean"?K[ae]=se.toLowerCase()==="true":K[ae]=se)}return K},oe=async()=>{x(!0),p(null);const K=Date.now();try{const ae=r==="fake"?Z():X(),te={};(H||r==="fake")&&(te["Content-Type"]="application/json"),i&&(te.Authorization=`Bearer ${i}`);const se=`${b}${n.path}`,_=await fetch(se,{method:n.method.toUpperCase(),headers:te,body:H?JSON.stringify(ae):void 0}),W=Date.now()-K;let E;try{E=await _.json()}catch{E=await _.text().catch(()=>"(no body)")}p({status:_.status,body:E,durationMs:W})}catch(ae){p({status:0,body:null,durationMs:Date.now()-K,error:ae.message})}finally{x(!1)}},I=m&&m.status>=200&&m.status<300;return s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border theme-border theme-bg-overlay px-3 py-2",children:[s.jsx(Jd,{method:n.method,size:"sm"}),s.jsx("code",{className:"font-mono text-[12px] theme-text truncate",children:n.path})]}),s.jsx("p",{className:"hidden",children:z}),s.jsxs("div",{className:"flex items-center gap-2 rounded-xl border theme-border theme-bg-overlay p-1",children:[s.jsxs("button",{type:"button",onClick:()=>o("fake"),className:`flex flex-1 items-center justify-center gap-1.5 rounded-lg py-1.5 text-[11px] font-medium transition-all duration-200 hover:cursor-pointer ${r==="fake"?"bg-[color:var(--brand)]/15 text-[color:var(--brand)] shadow-sm":"theme-text-faint hover:theme-text-muted"}`,children:[s.jsx(hs,{className:"h-3 w-3 shrink-0",strokeWidth:2}),"Fake Data"]}),s.jsxs("button",{type:"button",onClick:()=>o("real"),className:`flex flex-1 items-center justify-center gap-1.5 rounded-lg py-1.5 text-[11px] font-medium transition-all duration-200 hover:cursor-pointer ${r==="real"?"bg-[color:var(--brand)]/15 text-[color:var(--brand)] shadow-sm":"theme-text-faint hover:theme-text-muted"}`,children:[s.jsx(Rd,{className:"h-3 w-3 shrink-0",strokeWidth:2}),"Real Data"]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint",children:"Base URL"}),N.length>0?s.jsx("div",{className:"rounded-lg border theme-border theme-bg-overlay overflow-hidden",children:N.map(K=>{const ae=k===K.name;return s.jsxs("button",{type:"button",onClick:()=>{R(K.name),v(K.baseUrl)},className:`group flex w-full items-center gap-2.5 px-3 py-2 text-left transition-colors hover:cursor-pointer border-t theme-border ${ae?"bg-[color:var(--brand)]/10":"hover:theme-bg-overlay-md"}`,children:[s.jsx("div",{className:`flex h-4 w-4 shrink-0 items-center justify-center rounded-full border-2 transition-colors ${ae?"border-[color:var(--brand)] bg-[color:var(--brand)]/20":"theme-border bg-transparent"}`,children:ae&&s.jsx(ut,{className:"h-2.5 w-2.5 text-[color:var(--brand)]",strokeWidth:3})}),s.jsx(jl,{className:`h-3 w-3 shrink-0 ${ae?"text-[color:var(--brand)]":"theme-text-faint"}`,strokeWidth:2}),s.jsx("span",{className:`text-[11px] w-14 shrink-0 font-medium ${ae?"text-[color:var(--brand)]":"theme-text-muted"}`,children:K.name}),s.jsx("span",{className:"font-mono text-[11px] theme-text-faint truncate",children:K.baseUrl})]},K.name)})}):s.jsx("input",{value:b,onChange:K=>v(K.target.value),className:"w-full rounded-lg border theme-border theme-bg-overlay px-3 py-1.5 font-mono text-[12px] theme-text-primary outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md placeholder-[var(--text-faint)] transition-colors",placeholder:"http://localhost:3000"})]}),(M||r==="real")&&s.jsxs("label",{className:"flex flex-col gap-1.5",children:[s.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint flex items-center gap-1",children:[s.jsx(M0,{className:"h-3 w-3",strokeWidth:2})," Bearer Token"]}),s.jsx("input",{type:"password",value:i,onChange:K=>u(K.target.value),className:"w-full rounded-lg border border-amber-500/25 bg-amber-500/[0.04] px-3 py-1.5 font-mono text-[12px] theme-text-primary outline-none focus:border-amber-400/50 focus:bg-amber-500/[0.07] placeholder-[var(--text-faint)] transition-colors",placeholder:"Optional"})]}),r==="fake"&&Object.keys(q).length>0&&s.jsxs("div",{children:[s.jsxs("p",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider theme-text-faint flex items-center gap-1.5",children:[s.jsx(hs,{className:"h-3 w-3 text-[color:var(--brand)]",strokeWidth:2})," Auto-generated body"]}),s.jsx("div",{className:"space-y-1",children:Object.entries(q).map(([K,ae])=>s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border theme-border theme-bg-overlay px-3 py-2",children:[s.jsx("span",{className:"text-[11px] theme-text w-20 truncate shrink-0",children:K}),s.jsx("span",{className:"text-[11px] theme-text-faint shrink-0",children:ae.type}),s.jsx("span",{className:"ml-auto font-mono text-[11px] text-[color:var(--brand)]/80 truncate",children:y0(K,ae.type,ae.format)})]},K))})]}),r==="real"&&Object.keys(q).length>0&&s.jsxs("div",{children:[s.jsxs("p",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider theme-text-faint flex items-center gap-1.5",children:[s.jsx(Rd,{className:"h-3 w-3 text-[color:var(--brand)]",strokeWidth:2})," Request body"]}),s.jsx("div",{className:"space-y-2",children:Object.entries(q).map(([K,ae])=>s.jsxs("label",{className:"flex flex-col gap-1",children:[s.jsxs("span",{className:"text-[11px] theme-text",children:[K,ae.required&&s.jsx("span",{className:"ml-1 text-[10px] text-rose-400",children:"*"})]}),s.jsx("input",{value:f[K]??"",onChange:te=>h(se=>({...se,[K]:te.target.value})),placeholder:`${ae.type}${ae.format?` (${ae.format})`:""}`,className:"rounded-lg border theme-border theme-bg-overlay px-3 py-1.5 font-mono text-[12px] theme-text-primary outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md placeholder-[var(--text-faint)] transition-colors"})]},K))})]}),r==="real"&&Object.keys(q).length===0&&!H&&s.jsxs("p",{className:"text-[12px] theme-text-faint italic",children:["No body required for ",n.method.toUpperCase()," requests."]}),s.jsxs("button",{type:"button",onClick:oe,disabled:g,className:"flex w-full items-center justify-center gap-2 rounded-lg border theme-border bg-[var(--action)] py-2 text-[12px] font-medium text-[color:var(--action-foreground)] hover:bg-[var(--action-hover)] disabled:opacity-50 transition-colors hover:cursor-pointer",children:[g?s.jsx(dt,{className:"h-[15px] w-[15px] animate-spin",strokeWidth:2}):s.jsx(Ad,{className:"h-[15px] w-[15px]",strokeWidth:2}),g?"Sending…":`Run ${r==="fake"?"with Fake Data":"with Real Data"}`]}),m&&s.jsxs("div",{className:`rounded-lg border overflow-hidden ${I?"border-emerald-500/25 bg-emerald-500/[0.05]":"border-red-500/25 bg-red-500/[0.05]"}`,children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b theme-border",children:[I?s.jsx(ut,{className:"h-[15px] w-[15px] text-emerald-400",strokeWidth:2}):s.jsx(_t,{className:"h-[15px] w-[15px] text-red-400",strokeWidth:2}),s.jsx("span",{className:`text-[12px] font-medium ${I?"text-emerald-400":"text-red-400"}`,children:m.status>0?m.status:"Error"}),s.jsxs("span",{className:"text-[11px] theme-text-faint",children:[m.durationMs,"ms"]}),s.jsx("button",{type:"button",onClick:()=>p(null),className:"ml-auto flex h-6 w-6 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-faint hover:theme-text transition-colors hover:cursor-pointer",children:s.jsx(Ct,{className:"h-3 w-3",strokeWidth:2})})]}),m.error&&s.jsx("p",{className:"px-3 py-2.5 text-[12px] text-red-400",children:m.error}),!m.error&&m.body!=null&&s.jsx("pre",{className:"overflow-auto max-h-72 p-3 text-[11px] theme-text-muted whitespace-pre-wrap break-all leading-5",children:typeof m.body=="string"?m.body:JSON.stringify(m.body,null,2)})]})]})}const o4=({endpoint:n,onBack:r})=>{if(!n)return s.jsxs("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-5 text-center p-12",children:[s.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[s.jsx("div",{className:"absolute inset-0 rounded-full bg-[color:var(--brand)]/10 blur-xl"}),s.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-lg border theme-border theme-bg-overlay text-[color:var(--brand)]",children:s.jsx(Id,{className:"h-7 w-7",strokeWidth:2})})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[13.5px] font-medium theme-text-primary",children:"No endpoint selected"}),s.jsxs("p",{className:"mt-1 text-[12px] theme-text-muted",children:["Click ",s.jsx("span",{className:"text-[color:var(--brand)] font-medium",children:"INSPECT"})," on any endpoint in the Model view."]})]}),s.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 rounded-lg border theme-border theme-bg-overlay px-4 py-2 text-[12px] theme-text-muted hover:theme-bg-overlay-md hover:theme-text transition-colors hover:cursor-pointer",children:[s.jsx(fx,{className:"h-[15px] w-[15px]",strokeWidth:2})," Back to Model"]})]});const o=n.requestBody?.fields??{},i=n.responses??{},u=Object.keys(o).length>0,f=Object.keys(i).length>0,h=(n.security?.length??0)>0,g=(n.middleware?.length??0)>0,x=n.source?n.source.file.split(/[/\\]/).slice(-3).join("/")+":"+n.source.line:null;return s.jsxs("div",{className:"flex min-h-full w-full",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsxs("div",{className:"flex items-center gap-4 border-b theme-border px-6 py-5",children:[s.jsx("button",{type:"button",onClick:r,className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-muted hover:theme-bg-overlay-md hover:theme-text transition-colors hover:cursor-pointer",children:s.jsx(fx,{className:"h-[15px] w-[15px]",strokeWidth:2})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(Jd,{method:n.method}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h1",{className:"text-[13.5px] font-medium theme-text-primary leading-none truncate",children:n.path}),n.handlerName&&s.jsx("p",{className:"mt-0.5 text-[11px] theme-text-muted truncate",children:n.handlerName})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[h&&s.jsxs("span",{className:"flex items-center gap-1.5 rounded-lg border border-amber-500/25 bg-amber-500/[0.07] px-2.5 py-1 text-[11px] text-amber-400",children:[s.jsx(La,{className:"h-[15px] w-[15px]",strokeWidth:2}),n.security[0].scheme]}),x&&s.jsx("span",{className:"hidden sm:block font-mono text-[11px] theme-text-faint truncate max-w-[200px]",children:x})]})]}),s.jsxs("div",{className:"flex-1 overflow-auto p-6 space-y-4",children:[s.jsxs(ul,{children:[s.jsx(Rr,{icon:Fd,label:"Details"}),s.jsxs("div",{className:"p-4 grid grid-cols-2 sm:grid-cols-3 gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint mb-1.5",children:"Method"}),s.jsx(Jd,{method:n.method})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint mb-1.5",children:"Path"}),s.jsx("code",{className:"font-mono text-[12px] theme-text",children:n.path})]}),n.handlerName&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint mb-1.5",children:"Handler"}),s.jsx("code",{className:"font-mono text-[12px] theme-text-muted",children:n.handlerName})]}),n.source&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint mb-1.5",children:"Source"}),s.jsx("code",{className:"font-mono text-[11px] theme-text-faint",children:x})]}),n.requestBody?.contentType&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint mb-1.5",children:"Content-Type"}),s.jsx("code",{className:"font-mono text-[11px] theme-text-faint",children:n.requestBody.contentType})]}),g&&s.jsxs("div",{className:"col-span-2 sm:col-span-3",children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint mb-1.5",children:"Middleware"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.middleware.map((m,p)=>s.jsx("span",{className:"rounded-lg border theme-border theme-bg-overlay-md px-2.5 py-0.5 text-[11px] theme-text",children:m.name},p))})]})]})]}),u&&s.jsxs(ul,{children:[s.jsx(Rr,{icon:Rd,label:"Request Body",count:Object.keys(o).length}),s.jsxs("div",{className:"p-4 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center gap-4 px-3 py-1.5 text-[10px] font-semibold uppercase tracking-wider theme-text-faint",children:[s.jsx("span",{className:"w-28",children:"Field"}),s.jsx("span",{className:"w-16",children:"Type"}),s.jsx("span",{children:"Format"}),s.jsx("span",{className:"ml-auto",children:"Required"})]}),Object.entries(o).map(([m,p])=>s.jsxs("div",{className:"flex items-center gap-4 rounded-lg border theme-border theme-bg-overlay px-3 py-2 hover:theme-bg-overlay-md transition-colors",children:[s.jsx("span",{className:"w-28 shrink-0 font-mono text-[12px] theme-text-primary truncate",children:m}),s.jsx("span",{className:"w-16 shrink-0 text-[11px] text-[color:var(--brand)]",children:p.type}),s.jsx("span",{className:"flex-1 text-[11px] theme-text-faint",children:p.format??"—"}),p.required?s.jsx("span",{className:"ml-auto shrink-0 rounded border border-rose-500/25 bg-rose-500/10 px-1.5 py-0.5 text-[10px] text-rose-400",children:"required"}):s.jsx("span",{className:"ml-auto shrink-0 text-[10px] theme-text-faint",children:"optional"})]},m))]})]}),f&&s.jsxs(ul,{children:[s.jsx(Rr,{icon:ut,label:"Responses",count:Object.keys(i).length}),s.jsx("div",{className:"p-4 space-y-1.5",children:Object.entries(i).map(([m,p])=>{const b=m.startsWith("2");return s.jsxs("div",{className:`flex items-start gap-3 rounded-lg border px-3 py-2 ${b?"border-emerald-500/20 bg-emerald-500/[0.05]":"border-red-500/20 bg-red-500/[0.05]"}`,children:[s.jsx("span",{className:`shrink-0 w-10 font-mono text-[12px] font-medium ${b?"text-emerald-400":"text-red-400"}`,children:m}),p.schema&&s.jsx("div",{className:"flex flex-wrap gap-1",children:Object.keys(p.schema).map(v=>s.jsx("span",{className:"rounded border theme-border theme-bg-overlay-md px-1.5 py-0.5 font-mono text-[10px] theme-text-muted",children:v},v))})]},m)})})]}),s.jsx(l4,{endpoint:n}),s.jsx(r4,{endpoint:n}),s.jsxs(ul,{className:"lg:hidden",children:[s.jsx(Rr,{icon:hs,label:"Simulate Endpoint"}),s.jsx("div",{className:"p-4",children:s.jsx(b0,{endpoint:n})})]})]})]}),s.jsxs("aside",{className:"hidden lg:flex w-[400px] shrink-0 flex-col border-l theme-border bg-[var(--sidebar-bg)]",children:[s.jsxs("div",{className:"flex items-center gap-2.5 border-b theme-border px-5 py-[18px]",children:[s.jsx(hs,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2}),s.jsx("span",{className:"text-[13.5px] font-medium theme-text-primary",children:"Simulate Endpoint"})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5",children:s.jsx(b0,{endpoint:n})})]})]})};function i4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Agents"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Delegate work to agents in this workspace."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}function c4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Tools"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Connect the tools agents can call."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}function u4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Context"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Ground agents with shared context and files."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}const Nf="/api/memory";async function v0(){const n=await fetch(Nf);if(!n.ok)throw new Error(`Failed to fetch memory (${n.status})`);return n.json()}async function d4(){try{const n=await fetch("/api/model");return n.ok?(await n.json())?.environments??[]:[]}catch{return[]}}async function f4(n,r){const o=await fetch(Nf,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:n,value:r})});if(!o.ok){const i=await o.json().catch(()=>({}));throw new Error(i.error??`Failed to add entry (${o.status})`)}}async function h4(n){const r=await fetch(Nf,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:n})});if(!r.ok)throw new Error(`Failed to delete entry (${r.status})`)}function j0(n){return typeof n=="object"&&n!==null?JSON.stringify(n):String(n)}function m4(n){const r=n.indexOf(":");return r!==-1?n.slice(r+1):n}function wi(n){return n.includes(":")?n.split(":")[0]:"global"}function p4({value:n}){const[r,o]=j.useState(!1),i=n.length>200?n.slice(0,200)+"…":n;return s.jsx("div",{onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),className:"cursor-pointer max-w-[300px]",children:r?s.jsx("p",{className:"text-[12px] break-all transition-colors truncate theme-text",children:i}):s.jsx("p",{className:"text-[12px] font-mono tracking-widest select-none theme-text-faint",children:"••••••"})})}function x4({onClose:n,onSave:r,defaultScope:o}){const[i,u]=j.useState(o?`${o}:`:""),[f,h]=j.useState(""),[g,x]=j.useState(!1),[m,p]=j.useState(""),b=j.useRef(null);j.useEffect(()=>{b.current?.focus()},[]);const v=async N=>{if(N.preventDefault(),!i.trim()){p("Key is required");return}if(f.trim()===""){p("Value is required");return}x(!0),p("");try{await r(i.trim(),f.trim()),n()}catch(C){p(C.message??"An error occurred"),x(!1)}};return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:N=>{N.target===N.currentTarget&&n()},children:s.jsxs("div",{className:"relative w-full max-w-md rounded-lg p-6 shadow-2xl shadow-black/60 border theme-border theme-sidebar",children:[s.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg border theme-border theme-bg-overlay",children:s.jsx(Ht,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2})}),s.jsx("h2",{className:"text-[13.5px] font-medium theme-text-primary",children:"Add Memory Entry"})]}),s.jsx("button",{onClick:n,className:"flex h-7 w-7 items-center justify-center rounded-lg transition-colors hover:cursor-pointer hover:theme-bg-overlay-md hover:theme-text border theme-border theme-bg-overlay theme-text-muted",children:s.jsx(Ct,{className:"h-[15px] w-[15px]",strokeWidth:2})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-1.5 block text-[11px] font-semibold uppercase tracking-wider theme-text-faint",children:"Key / Identifier"}),s.jsx("input",{ref:b,value:i,onChange:N=>u(N.target.value),placeholder:"global:myKey or myKey",className:"w-full rounded-lg px-3 py-2 text-[12px] outline-none transition-colors focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md border theme-border theme-bg-overlay theme-text-primary"}),s.jsxs("p",{className:"mt-1.5 text-[10px] theme-text-faint",children:["Prefix with"," ",s.jsx("code",{className:"rounded px-1 py-0.5 text-[10px] border theme-border theme-bg-overlay-md theme-text-muted",children:"scope:"})," ","to organise by scope (e.g."," ",s.jsx("code",{className:"rounded px-1 py-0.5 text-[10px] border theme-border theme-bg-overlay-md theme-text-muted",children:"user:name"}),"). Defaults to"," ",s.jsx("code",{className:"rounded px-1 py-0.5 text-[10px] border theme-border theme-bg-overlay-md theme-text-muted",children:"global"}),"."]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-1.5 block text-[11px] font-semibold uppercase tracking-wider theme-text-faint",children:"Value"}),s.jsx("textarea",{value:f,onChange:N=>h(N.target.value),placeholder:"Enter a string value…",rows:4,className:"w-full resize-none rounded-lg px-3 py-2 text-[12px] outline-none transition-colors focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md border theme-border theme-bg-overlay theme-text-primary"})]}),m&&s.jsx("div",{className:"flex items-center gap-2 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2.5",children:s.jsx("p",{className:"text-[12px] text-red-400",children:m})}),s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[s.jsx("button",{type:"button",onClick:n,className:"rounded-lg px-4 py-2 text-[12px] transition-colors hover:cursor-pointer hover:theme-bg-overlay-md hover:theme-text border theme-border theme-bg-overlay theme-text-muted",children:"Cancel"}),s.jsxs("button",{onClick:v,disabled:g,className:"flex items-center gap-2 rounded-lg bg-[var(--action)] px-4 py-2 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)] disabled:cursor-not-allowed disabled:opacity-50",children:[g&&s.jsx(dt,{className:"h-[15px] w-[15px] animate-spin",strokeWidth:2}),g?"Saving…":"Save Entry"]})]})]})]})})}function g4({onClose:n,onSave:r}){const[o,i]=j.useState(""),[u,f]=j.useState(""),h=j.useRef(null);j.useEffect(()=>{h.current?.focus()},[]);const g=x=>{x.preventDefault();const m=o.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"");if(!m){f("Enter a valid scope name");return}r(m),n()};return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:x=>{x.target===x.currentTarget&&n()},children:s.jsxs("div",{className:"relative w-full max-w-sm rounded-lg p-6 shadow-2xl shadow-black/60 border theme-border theme-sidebar",children:[s.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg border theme-border theme-bg-overlay",children:s.jsx(Ht,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2})}),s.jsx("h2",{className:"text-[13.5px] font-medium theme-text-primary",children:"Add Scope"})]}),s.jsx("button",{onClick:n,className:"flex h-7 w-7 items-center justify-center rounded-lg transition-colors hover:cursor-pointer hover:theme-bg-overlay-md border theme-border theme-bg-overlay theme-text-muted",children:s.jsx(Ct,{className:"h-[15px] w-[15px]",strokeWidth:2})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-1.5 block text-[11px] font-semibold uppercase tracking-wider theme-text-faint",children:"Scope Name"}),s.jsx("input",{ref:h,value:o,onChange:x=>{i(x.target.value),f("")},placeholder:"e.g. session, user, cart",className:"w-full rounded-lg px-3 py-2 text-[12px] outline-none transition-colors focus:border-[color:var(--brand)]/50 border theme-border theme-bg-overlay theme-text-primary"}),s.jsxs("p",{className:"mt-1.5 text-[10px] theme-text-faint",children:["Memory entries under this scope will be keyed as"," ",s.jsxs("code",{className:"rounded px-1 py-0.5 text-[10px] border theme-border theme-bg-overlay-md theme-text-muted",children:[o.trim()?o.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""):"scope",":key"]})]})]}),u&&s.jsx("p",{className:"text-[12px] text-red-400",children:u}),s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[s.jsx("button",{type:"button",onClick:n,className:"rounded-lg px-4 py-2 text-[12px] transition-colors hover:cursor-pointer hover:theme-bg-overlay-md border theme-border theme-bg-overlay theme-text-muted",children:"Cancel"}),s.jsxs("button",{onClick:g,className:"flex items-center gap-2 rounded-lg bg-[var(--action)] px-4 py-2 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)]",children:[s.jsx(ut,{className:"h-[14px] w-[14px]",strokeWidth:2})," Create Scope"]})]})]})]})})}const y4={workflow:_i,global:kv},b4={workflow:{border:"border-[color:var(--brand)]/20",bg:"bg-[color:var(--brand)]/5",dot:"bg-[color:var(--brand)]/40",text:"text-[color:var(--brand)]",activeBg:"bg-[color:var(--brand)]/15",activeBorder:"border-[color:var(--brand)]/40"},environment:{border:"border-emerald-500/20",bg:"bg-emerald-500/5",dot:"bg-emerald-500/40",text:"text-emerald-400",activeBg:"bg-emerald-500/15",activeBorder:"border-emerald-500/40"},global:{border:"theme-border",bg:"theme-bg-overlay",dot:"bg-[var(--text-faint)]",text:"theme-text-muted",activeBg:"theme-bg-overlay-md",activeBorder:"theme-border"}},v4={border:"border-[color:var(--brand)]/20",bg:"bg-[color:var(--brand)]/5",dot:"bg-[color:var(--brand)]/40",text:"text-[color:var(--brand)]",activeBg:"bg-[color:var(--brand)]/15",activeBorder:"border-[color:var(--brand)]/40"};function jy(n){return b4[n]??v4}function j4({scope:n,active:r,onClick:o}){const i=jy(n.id),u=y4[n.id]??ki;return s.jsxs("button",{type:"button",onClick:o,className:`group relative flex flex-col gap-2 rounded-lg border p-3.5 text-left transition-all duration-200 hover:cursor-pointer ${r?`${i.activeBg} ${i.activeBorder}`:`${i.border} ${i.bg} hover:${i.activeBg}`}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:`flex h-7 w-7 items-center justify-center rounded-lg border ${i.border} theme-bg-overlay`,children:s.jsx(u,{className:`h-[14px] w-[14px] ${i.text}`,strokeWidth:2})}),r&&s.jsx("div",{className:`flex h-4 w-4 items-center justify-center rounded-full ${i.activeBg}`,children:s.jsx(ut,{className:`h-2.5 w-2.5 ${i.text}`,strokeWidth:3})})]}),s.jsxs("div",{children:[s.jsx("p",{className:`text-[12px] font-medium ${i.text}`,children:n.label}),s.jsxs("p",{className:"text-[10px] theme-text-faint",children:[n.count," ",n.count===1?"entry":"entries"]})]})]})}function N4(){const[n,r]=j.useState([]),[o,i]=j.useState([]),[u,f]=j.useState([]),[h,g]=j.useState(null),[x,m]=j.useState(!0),[p,b]=j.useState(!1),[v,N]=j.useState(null),[C,k]=j.useState(""),[R,z]=j.useState(!1),[V,q]=j.useState(!1),[M,H]=j.useState(null),Z=j.useCallback(async(T=!1)=>{T?b(!0):m(!0),N(null);try{const[A,S]=await Promise.all([v0(),d4()]);r(A),i(S)}catch(A){N(A.message??"Could not load memory data. Is `jetic dev` running?")}finally{m(!1),b(!1)}},[]);j.useEffect(()=>{Z()},[Z]);const X=async T=>{H(T);try{await h4(T),r(A=>A.filter(S=>S.key!==T))}catch(A){N(A.message??"Failed to delete entry")}finally{H(null)}},oe=async(T,A)=>{await f4(T,A);const S=await v0();r(S)},I=Array.from(new Set(n.map(T=>wi(T.key)))),K=T=>n.filter(A=>wi(A.key)===T).length,ae=[{id:"workflow",label:"Workflow",count:K("workflow"),isBuiltIn:!0},...o.map(T=>({id:`environment.${T.name}`,label:T.name,count:K(`environment.${T.name}`),isBuiltIn:!0}))],te=new Set(["workflow",...o.map(T=>`environment.${T.name}`)]),se=I.filter(T=>!te.has(T)&&T!=="global"),_=Array.from(new Set([...u,...se])),W=[...ae,..._.map(T=>({id:T,label:T.charAt(0).toUpperCase()+T.slice(1),count:K(T),isCustom:!0})),{id:"global",label:"Global",count:K("global"),isBuiltIn:!0}],E=h?n.filter(T=>wi(T.key)===h):n,$=E.filter(T=>!C||T.key.toLowerCase().includes(C.toLowerCase())||j0(T.value).toLowerCase().includes(C.toLowerCase()));return s.jsxs("div",{className:"flex h-full w-full flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-5 border-b theme-border",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Memory"}),s.jsx("p",{className:"mt-0.5 text-[11px] theme-text-muted",children:x?"Loading…":h?`${$.length} entries in ${h}`:`${n.length} entr${n.length===1?"y":"ies"} stored`})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>Z(!0),disabled:p||x,title:"Refresh",className:"flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:cursor-pointer hover:theme-bg-overlay-md hover:theme-text disabled:opacity-40 border theme-border theme-bg-overlay theme-text-muted",children:s.jsx(na,{className:`h-[15px] w-[15px] ${p?"animate-spin":""}`,strokeWidth:2})}),s.jsxs("button",{onClick:()=>z(!0),className:"flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-3 py-1.5 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)]",children:[s.jsx(Ht,{className:"h-[15px] w-[15px]",strokeWidth:2}),"Add Entry"]})]})]}),s.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-6",children:[!x&&!v&&s.jsxs("div",{children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint",children:"Scopes"}),s.jsxs("button",{onClick:()=>q(!0),className:"flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] font-medium transition-colors hover:cursor-pointer hover:theme-bg-overlay-md border theme-border theme-text-faint",children:[s.jsx(Ht,{className:"h-3 w-3",strokeWidth:2})," Add Scope"]})]}),s.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5",children:W.map(T=>s.jsx(j4,{scope:T,active:h===T.id,onClick:()=>g(A=>A===T.id?null:T.id)},T.id))}),h&&s.jsx("button",{type:"button",onClick:()=>g(null),className:"mt-2 text-[11px] transition-colors hover:cursor-pointer hover:text-[color:var(--brand)] theme-text-faint",children:"← Show all scopes"})]}),!x&&!v&&s.jsx("div",{className:"border-t theme-border"}),!x&&n.length>0&&s.jsxs("div",{className:"relative",children:[s.jsx(zi,{className:"absolute left-3 top-1/2 h-[15px] w-[15px] -translate-y-1/2 theme-text-faint",strokeWidth:2}),s.jsx("input",{value:C,onChange:T=>k(T.target.value),placeholder:h?`Filter ${h} entries…`:"Filter by key or value…",className:"w-full rounded-lg py-2 pl-9 pr-9 text-[12px] outline-none transition-colors focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md border theme-border theme-bg-overlay theme-text"}),C&&s.jsx("button",{onClick:()=>k(""),className:"absolute right-3 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-lg transition-colors hover:cursor-pointer hover:theme-text border theme-border theme-bg-overlay-md theme-text-faint",children:s.jsx(Ct,{className:"h-3 w-3",strokeWidth:2})})]}),x&&s.jsx("div",{className:"space-y-3",children:[1,2,3].map(T=>s.jsx("div",{className:"h-14 animate-pulse rounded-lg border theme-border theme-bg-overlay",style:{opacity:1-T*.2}},T))}),!x&&v&&s.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-red-500/20 bg-red-500/[0.04] p-10 text-center",children:[s.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg border border-red-500/20 bg-red-500/10 text-red-400",children:s.jsx(ki,{className:"h-6 w-6",strokeWidth:2})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[13.5px] font-medium text-red-300",children:"Could not load memory"}),s.jsx("p",{className:"mt-1 text-[11px] text-red-500/70",children:v})]}),s.jsx("button",{onClick:()=>Z(),className:"rounded-lg border border-red-500/20 bg-red-500/10 px-4 py-1.5 text-[12px] text-red-400 transition-colors hover:cursor-pointer hover:bg-red-500/20",children:"Retry"})]}),!x&&!v&&n.length===0&&s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 py-20 text-center",children:[s.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[s.jsx("div",{className:"absolute inset-0 rounded-full bg-[color:var(--brand)]/10 blur-xl"}),s.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-lg text-[color:var(--brand)] border theme-border theme-bg-overlay",children:s.jsx(ki,{className:"h-7 w-7",strokeWidth:2})})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[13.5px] font-medium theme-text",children:"Memory is empty"}),s.jsxs("p",{className:"mt-1 text-[12px] theme-text-faint",children:["Add your first entry or run"," ",s.jsx("code",{className:"rounded px-1.5 py-0.5 text-[11px] border theme-border theme-bg-overlay-md theme-text-muted",children:"jetic memory add"})," ","in the CLI."]})]}),s.jsxs("button",{onClick:()=>z(!0),className:"flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-4 py-2 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)]",children:[s.jsx(Ht,{className:"h-[15px] w-[15px]",strokeWidth:2}),"Add Entry"]})]}),!x&&!v&&n.length>0&&h&&$.length===0&&!C&&s.jsxs("div",{className:"flex flex-col items-center gap-3 py-12 text-center",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg border theme-border theme-bg-overlay",children:s.jsx(ki,{className:"h-[15px] w-[15px] theme-text-faint",strokeWidth:2})}),s.jsxs("p",{className:"text-[13px] theme-text-muted",children:["No entries in ",s.jsx("code",{className:"text-[color:var(--brand)]",children:h})," scope"]}),s.jsxs("button",{onClick:()=>z(!0),className:"flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-3 py-1.5 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)]",children:[s.jsx(Ht,{className:"h-[14px] w-[14px]",strokeWidth:2})," Add to ",h]})]}),!x&&!v&&n.length>0&&C&&$.length===0&&s.jsxs("div",{className:"flex flex-col items-center gap-3 py-12 text-center",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg border theme-border theme-bg-overlay",children:s.jsx(zi,{className:"h-[15px] w-[15px] theme-text-faint",strokeWidth:2})}),s.jsxs("p",{className:"text-[13px] theme-text-muted",children:['No entries match "',C,'"']}),s.jsx("button",{onClick:()=>k(""),className:"text-[12px] text-[color:var(--brand)] transition-colors hover:cursor-pointer hover:text-[color:var(--brand)]",children:"Clear filter"})]}),!x&&!v&&$.length>0&&s.jsx("div",{className:"overflow-y-auto rounded-lg border theme-border theme-bg-overlay",children:s.jsxs("table",{className:"w-full text-left whitespace-nowrap",children:[s.jsx("thead",{className:"border-b theme-border theme-bg-overlay",children:s.jsxs("tr",{children:[s.jsx("th",{className:"w-32 px-4 py-3 text-[10px] font-semibold uppercase tracking-wider theme-text-faint",children:"Scope"}),s.jsx("th",{className:"w-48 px-4 py-3 text-[10px] font-semibold uppercase tracking-wider theme-text-faint",children:"Key"}),s.jsx("th",{className:"px-4 py-3 text-[10px] font-semibold uppercase tracking-wider theme-text-faint",children:"Value"}),s.jsx("th",{className:"w-16 px-4 py-3 text-right text-[10px] font-semibold uppercase tracking-wider theme-text-faint",children:"Actions"})]})}),s.jsx("tbody",{children:$.map((T,A)=>{const S=wi(T.key),D=m4(T.key),L=j0(T.value),F=M===T.key,ie=jy(S);return s.jsxs("tr",{className:`group transition-colors hover:theme-bg-overlay-md ${A!==0?"border-t theme-border":""}`,children:[s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider border theme-bg-overlay-md ${ie.border} ${ie.text}`,children:S})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:"inline-flex items-center rounded-lg px-2.5 py-0.5 font-mono text-[11px] border theme-border theme-bg-overlay-md theme-text",children:D})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(p4,{value:L})}),s.jsx("td",{className:"px-4 py-3 text-right",children:s.jsx("button",{onClick:()=>X(T.key),disabled:F,title:"Delete entry",className:"inline-flex h-7 w-7 items-center justify-center rounded-lg transition-colors hover:cursor-pointer hover:border-red-500/30 hover:bg-red-500/10 hover:text-red-400 disabled:cursor-not-allowed disabled:opacity-50 border theme-border theme-bg-overlay theme-text-faint",children:F?s.jsx(dt,{className:"h-[15px] w-[15px] animate-spin",strokeWidth:2}):s.jsx(Yt,{className:"h-[15px] w-[15px]",strokeWidth:2})})})]},T.key)})})]})}),!x&&!v&&C&&$.length>0&&s.jsxs("p",{className:"text-center text-[11px] theme-text-faint",children:["Showing ",$.length," of ",E.length," entries"]})]}),!x&&!v&&n.length>0&&s.jsxs("div",{className:"flex items-center gap-1.5 px-6 py-3 text-[11px] border-t theme-border theme-text-faint",children:[s.jsx(Gr,{className:"h-[15px] w-[15px]",strokeWidth:2}),"Data read from"," ",s.jsx("code",{className:"rounded px-1.5 py-0.5 text-[10px] border theme-border theme-bg-overlay-md theme-text-muted",children:".jetic/memory.json"}),s.jsx("span",{className:"ml-auto",children:s.jsx("button",{onClick:()=>Z(!0),className:"text-[11px] transition-colors hover:cursor-pointer hover:text-[color:var(--brand)] theme-text-faint",children:"Refresh"})})]}),R&&s.jsx(x4,{onClose:()=>z(!1),onSave:oe,defaultScope:h??void 0}),V&&s.jsx(g4,{onClose:()=>q(!1),onSave:T=>f(A=>A.includes(T)?A:[...A,T])})]})}function w4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"APIs"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Register the APIs and services this workspace talks to."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}function S4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Email"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Configure outbound and inbound email."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}function E4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"OAuth"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Manage OAuth providers and credentials."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}function k4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Webhooks"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Subscribe to events with outgoing webhooks."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}const N0={GET:{bg:"#052e16",text:"#4ade80",border:"#166534",dot:"#34d399"},POST:{bg:"var(--bg-overlay-md)",text:"var(--text-primary)",border:"var(--border-md)",dot:"var(--text-primary)"},PUT:{bg:"#422006",text:"#fbbf24",border:"#92400e",dot:"#fbbf24"},PATCH:{bg:"#431407",text:"#fb923c",border:"#9a3412",dot:"#fb923c"},DELETE:{bg:"#3f0000",text:"#f87171",border:"#991b1b",dot:"#f87171"},HEAD:{bg:"var(--bg-overlay-md)",text:"var(--text-muted)",border:"var(--text-faint)",dot:"var(--text-muted)"},OPTIONS:{bg:"var(--bg-overlay-md)",text:"var(--text-primary)",border:"var(--border-md)",dot:"var(--text-primary)"}};function Ny(n){return N0[n.toUpperCase()]??N0.GET}function _4({data:n}){const r=Ny(n.method),o=n.passed?"#34d399":"#f87171",i=n.selected?"var(--brand)":n.passed===!0?"#166534":n.passed===!1?"#991b1b":"var(--text-faint)";return s.jsxs("div",{onClick:n.onSelect,style:{width:260,border:`1.5px solid ${i}`,borderRadius:10,background:"var(--bg-surface)",cursor:"pointer",boxShadow:n.selected?"0 0 0 2px color-mix(in srgb, var(--brand) 40%, transparent)":"0 2px 12px rgba(0,0,0,0.4)",transition:"box-shadow 0.15s ease",overflow:"hidden"},children:[s.jsx(jt,{type:"target",position:xe.Top,style:{background:"transparent",border:"none"}}),s.jsxs("div",{style:{background:r.bg,borderBottom:`1px solid ${r.border}`,padding:"8px 12px",display:"flex",alignItems:"center",gap:8},children:[s.jsx("span",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.1em",color:r.text,background:`color-mix(in srgb, ${r.dot} 8%, transparent)`,border:`1px solid color-mix(in srgb, ${r.dot} 25%, transparent)`,borderRadius:4,padding:"2px 6px"},children:n.method}),s.jsx("span",{style:{fontSize:11,color:"var(--text-primary)",fontFamily:"monospace",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.path}),n.status>0&&s.jsx("span",{style:{fontSize:10,color:o,fontFamily:"monospace",fontWeight:600,flexShrink:0},children:n.status})]}),s.jsxs("div",{style:{padding:"8px 12px",display:"flex",flexDirection:"column",gap:5},children:[n.name&&s.jsx("span",{style:{fontSize:10,color:"var(--text-muted)",fontStyle:"italic"},children:n.name}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[s.jsx("span",{style:{fontSize:9,fontWeight:600,letterSpacing:"0.08em",color:n.passed?"#4ade80":"#f87171",background:n.passed?"rgba(74,222,128,0.08)":"rgba(248,113,113,0.08)",border:`1px solid ${n.passed?"rgba(74,222,128,0.2)":"rgba(248,113,113,0.2)"}`,borderRadius:4,padding:"2px 6px"},children:n.passed?"✓ PASSED":"✗ FAILED"}),n.durationMs>0&&s.jsxs("span",{style:{fontSize:10,color:"var(--text-faint)"},children:[n.durationMs,"ms"]})]}),n.injectSpec&&Object.keys(n.injectSpec).length>0&&s.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:Object.entries(n.injectSpec).map(([u,f])=>s.jsxs("span",{style:{fontSize:9,color:"var(--brand)",background:"color-mix(in srgb, var(--brand) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--brand) 20%, transparent)",borderRadius:4,padding:"1px 5px"},children:["📥 ",u," ← ","{{",f,"}}"]},u))}),(n.conditionSpec||n.conditionResult)&&s.jsx("div",{style:{display:"flex",alignItems:"center",gap:4,marginTop:2},children:s.jsxs("span",{style:{fontSize:9,fontWeight:600,color:n.conditionResult?n.conditionResult.passed?"var(--brand)":"#fb923c":"var(--brand)",background:n.conditionResult?.passed===!1?"rgba(251,146,60,0.1)":"color-mix(in srgb, var(--brand) 10%, transparent)",border:`1px solid ${n.conditionResult?.passed===!1?"rgba(251,146,60,0.3)":"color-mix(in srgb, var(--brand) 30%, transparent)"}`,borderRadius:4,padding:"1px 5px",display:"flex",alignItems:"center",gap:3},children:[s.jsx(ea,{style:{width:9,height:9}}),n.conditionResult?n.conditionResult.passed?"cond passed":"cond FAILED":"has condition"]})}),n.error&&s.jsxs("span",{style:{fontSize:9,color:"#f87171",marginTop:2},children:["⚠ ",n.error]}),s.jsx("span",{style:{fontSize:9,color:"var(--text-faint)",marginTop:2},children:"Click for details"})]}),s.jsx(jt,{type:"source",position:xe.Bottom,style:{background:"transparent",border:"none"}})]})}function C4({data:n}){const r=Object.entries(n.captured??{});return s.jsxs("div",{style:{width:200,border:"1.5px solid color-mix(in srgb, var(--brand) 35%, transparent)",borderRadius:10,background:"color-mix(in srgb, var(--brand) 7%, transparent)",padding:"8px 12px",backdropFilter:"blur(4px)"},children:[s.jsx(jt,{type:"target",position:xe.Top,style:{background:"transparent",border:"none"}}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6},children:[s.jsx(fl,{style:{width:12,height:12,color:"var(--brand)"}}),s.jsx("span",{style:{fontSize:10,fontWeight:600,color:"var(--brand)",letterSpacing:"0.06em"},children:"MEMORY"})]}),r.length===0&&s.jsx("span",{style:{fontSize:9,color:"var(--text-faint)"},children:"No variables captured"}),r.map(([o,i])=>s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:3},children:[s.jsx("span",{style:{fontSize:10,color:"var(--brand)",fontFamily:"monospace"},children:o}),s.jsx(dl,{style:{width:10,height:10,color:"var(--text-faint)",flexShrink:0}}),s.jsx("span",{style:{fontSize:9,color:"var(--text-muted)",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:String(i).length>20?String(i).slice(0,20)+"…":i})]},o)),s.jsx(jt,{type:"source",position:xe.Bottom,style:{background:"transparent",border:"none"}})]})}function T4({data:n}){return s.jsxs("div",{style:{width:120,border:"1.5px solid color-mix(in srgb, var(--brand) 40%, transparent)",borderRadius:20,background:"color-mix(in srgb, var(--brand) 8%, transparent)",padding:"7px 14px",textAlign:"center"},children:[s.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--brand)",letterSpacing:"0.05em"},children:n.label}),s.jsx(jt,{type:"source",position:xe.Bottom,style:{background:"transparent",border:"none"}})]})}function M4({data:n}){const r=n.phase==="done"&&n.failed===0?"#4ade80":n.phase==="aborted"?"#f87171":"#fbbf24";return s.jsxs("div",{style:{width:140,border:`1.5px solid ${r}40`,borderRadius:20,background:`${r}0d`,padding:"7px 14px",textAlign:"center"},children:[s.jsx(jt,{type:"target",position:xe.Top,style:{background:"transparent",border:"none"}}),s.jsx("span",{style:{fontSize:11,fontWeight:600,color:r,letterSpacing:"0.05em"},children:n.phase==="done"&&n.failed===0?"✓ PASSED":n.phase==="aborted"?"✗ ABORTED":`${n.passed}/${n.passed+n.failed} PASSED`})]})}function A4({data:n}){const r=n.conditionResult?.passed,o=r===void 0?"var(--brand)":r?"#4ade80":"#fb923c";return s.jsxs("div",{style:{width:44,height:44,position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[s.jsx(jt,{type:"target",position:xe.Top,style:{background:"transparent",border:"none"}}),s.jsxs("svg",{width:"44",height:"44",viewBox:"0 0 44 44",children:[s.jsx("polygon",{points:"22,2 42,22 22,42 2,22",fill:"none",stroke:o,strokeWidth:"1.5"}),s.jsx("polygon",{points:"22,8 36,22 22,36 8,22",fill:o,fillOpacity:.15,stroke:"none"})]}),s.jsx("span",{style:{position:"absolute",fontSize:9,fontFamily:"monospace",fontWeight:700,color:o,top:"50%",left:"50%",transform:"translate(-50%,-50%)",whiteSpace:"nowrap"},children:"◇"}),s.jsx(jt,{type:"source",position:xe.Bottom,id:"pass",style:{background:"transparent",border:"none"}}),s.jsx(jt,{type:"source",position:xe.Right,id:"fail",style:{background:"transparent",border:"none"}})]})}function R4({data:n}){return s.jsxs("div",{style:{width:210,border:"1.5px dashed rgba(251,146,60,0.45)",borderRadius:12,background:"rgba(251,146,60,0.06)",padding:"9px 13px",backdropFilter:"blur(4px)"},children:[s.jsx(jt,{type:"target",position:xe.Left,style:{background:"transparent",border:"none"}}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[s.jsx(Pd,{style:{width:11,height:11,color:"#fb923c"}}),s.jsx("span",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.08em",color:"#fb923c"},children:"SWITCHED WORKFLOW"})]}),s.jsx("span",{style:{fontSize:11,color:"#fdba74",fontFamily:"monospace"},children:n.workflowName||"unknown"}),n.returnsOnComplete&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginTop:6},children:[s.jsx(na,{style:{width:9,height:9,color:"var(--text-muted)"}}),s.jsx("span",{style:{fontSize:9,color:"var(--text-muted)"},children:"resumes main flow after"})]}),s.jsx(jt,{type:"source",position:xe.Right,id:"return",style:{background:"transparent",border:"none"}})]})}const z4={step:_4,memory:C4,condition:A4,start:T4,end:M4,branch:R4},il=260,O4=130,D4=200,H4=90,$4=il+90,Si=50;function ol(n,r={}){return{type:"smoothstep",pathOptions:{borderRadius:14},animated:!!r.animated,style:{stroke:n,strokeWidth:r.width??1.5,strokeDasharray:r.dashed?"5 4":void 0},markerEnd:{type:Ba.ArrowClosed,color:n,width:16,height:16},labelStyle:{fill:n,fontSize:9,fontWeight:600,fontFamily:"monospace"},labelBgStyle:r.labelBg===!1?{fill:"transparent"}:{fill:"var(--bg-base)",fillOpacity:.9},labelBgPadding:[4,2],labelBgBorderRadius:4}}function U4(n,r,o){const i=[],u=[];let f=0;i.push({id:"start",type:"start",position:{x:(il-120)/2,y:f},data:{label:`▶ START · ${new Date(n.startedAt).toLocaleTimeString()}`},draggable:!1}),f+=50+Si;for(let m=0;m<n.steps.length;m++){const p=n.steps[m],b=p.captureSpec&&Object.keys(p.captureSpec).length>0,v=p.captured&&Object.keys(p.captured).length>0,N=!!(p.conditionSpec||p.conditionResult),C=!!p.conditionSpec?.switchToWorkflow,k=p.passed?"#4ade80":"#f87171";i.push({id:`step-${m}`,type:"step",position:{x:0,y:f},data:{index:m,name:p.name,method:p.method,path:p.path,status:p.status,passed:p.passed,durationMs:p.durationMs,error:p.error,injectSpec:p.injectSpec,captureSpec:p.captureSpec,conditionSpec:p.conditionSpec,conditionResult:p.conditionResult,selected:r===m,onSelect:()=>o(m)},draggable:!1});const R=m===0?"start":Ei(n,m-1)?`cond-${m-1}`:w0(n,m-1)?`mem-${m-1}`:`step-${m-1}`,z=m>0&&Ei(n,m-1)?"pass":void 0;u.push({id:`e-${m}`,source:R,sourceHandle:z,target:`step-${m}`,...ol(k,{width:2}),label:m>0&&n.steps[m-1].injectSpec?Object.keys(n.steps[m-1].injectSpec??{}).map(q=>`{{${q}}}`).join(", "):void 0}),f+=O4+Si;let V=`step-${m}`;if((b||v)&&(i.push({id:`mem-${m}`,type:"memory",position:{x:(il-D4)/2,y:f},data:{captured:v?p.captured:Object.fromEntries(Object.keys(p.captureSpec??{}).map(q=>[q.split(":").pop()??q,"…"]))},draggable:!1}),u.push({id:`e-mem-${m}`,source:`step-${m}`,target:`mem-${m}`,...ol("var(--brand)",{dashed:!0,width:1.2}),label:"capture"}),f+=H4+Si,V=`mem-${m}`),N){const q=p.conditionResult?.passed===!1?"#fb923c":"var(--brand)",M=f;if(i.push({id:`cond-${m}`,type:"condition",position:{x:(il-44)/2,y:M},data:{conditionSpec:p.conditionSpec,conditionResult:p.conditionResult},draggable:!1}),u.push({id:`e-cond-${m}`,source:V,target:`cond-${m}`,...ol(q,{width:1.4}),label:p.conditionResult?p.conditionResult.passed?"PASS":"FAIL":"eval"}),C&&(i.push({id:`branch-${m}`,type:"branch",position:{x:$4,y:M-10},data:{workflowName:p.conditionSpec?.switchToWorkflow,returnsOnComplete:p.conditionSpec?.returnOnComplete},draggable:!1}),u.push({id:`e-branch-${m}`,source:`cond-${m}`,sourceHandle:"fail",target:`branch-${m}`,...ol("#fb923c",{dashed:!0,width:1.6,labelBg:!0}),label:"on FAIL → switch"}),p.conditionSpec?.returnOnComplete)){const H=m<n.steps.length-1?`step-${m+1}`:"end";u.push({id:`e-branch-return-${m}`,source:`branch-${m}`,sourceHandle:"return",target:H,...ol("var(--brand)",{dashed:!0,width:1.2,labelBg:!0}),label:"resume"})}f+=44+Si}}i.push({id:"end",type:"end",position:{x:(il-140)/2,y:f},data:{phase:n.phase,passed:n.passed,failed:n.failed},draggable:!1});const h=n.steps.length-1,g=n.steps.length>0?Ei(n,h)?`cond-${h}`:w0(n,h)?`mem-${h}`:`step-${h}`:"start",x=n.steps.length>0&&Ei(n,h)?"pass":void 0;return u.push({id:"e-end",source:g,sourceHandle:x,target:"end",...ol(n.phase==="done"&&n.failed===0?"#4ade80":"#f87171",{width:2})}),i.push({id:"spine-rail",type:"default",position:{x:il/2-1,y:0},data:{label:""},draggable:!1,selectable:!1,focusable:!1,style:{width:2,height:f,background:"linear-gradient(to bottom, color-mix(in srgb, var(--brand) 18%, transparent), color-mix(in srgb, var(--brand) 12%, transparent), rgba(74,222,128,0.18))",border:"none",borderRadius:2,pointerEvents:"none"},zIndex:-1}),{nodes:i,edges:u}}function Ei(n,r){const o=n.steps[r];return o?!!(o.conditionSpec||o.conditionResult):!1}function w0(n,r){const o=n.steps[r];return o?o.captureSpec&&Object.keys(o.captureSpec).length>0||o.captured&&Object.keys(o.captured).length>0:!1}function B4({trace:n,selectedStep:r,onSelectStep:o}){const[i,u,f]=cy([]),[h,g,x]=uy([]);return j.useEffect(()=>{const{nodes:m,edges:p}=U4(n,r,o);u(m),g(p)},[n,r]),s.jsxs(bf,{nodes:i,edges:h,onNodesChange:f,onEdgesChange:x,nodeTypes:z4,fitView:!0,fitViewOptions:{padding:.3},proOptions:{hideAttribution:!0},minZoom:.15,maxZoom:2,defaultEdgeOptions:{type:"smoothstep"},style:{background:"transparent"},children:[s.jsx(xy,{variant:ln.Dots,gap:24,size:1,color:"rgba(255,255,255,0.04)"}),s.jsx(my,{className:"theme-bg-surface border theme-border rounded-lg",showInteractive:!1}),s.jsx(h3,{nodeColor:m=>m.type==="memory"?"color-mix(in srgb, var(--brand) 50%, transparent)":m.type==="branch"?"rgba(251,146,60,0.5)":m.type==="start"||m.type==="end"?"color-mix(in srgb, var(--brand) 50%, transparent)":m.id==="spine-rail"?"transparent":m.data?.passed?"rgba(74,222,128,0.5)":"rgba(248,113,113,0.5)",className:"theme-bg-elevated border theme-border rounded-lg",maskColor:"rgba(0,0,0,0.4)"})]})}function q4({step:n,onClose:r}){const o=Ny(n.method),[i,u]=j.useState("overview");return s.jsxs("div",{className:"flex flex-col h-full",style:{width:360,borderLeft:"1px solid var(--border)",backgroundColor:"var(--bg-surface)",flexShrink:0},children:[s.jsxs("div",{style:{borderBottom:"1px solid var(--border)",padding:"12px 16px",display:"flex",alignItems:"center",gap:10,backgroundColor:"var(--bg-elevated)"},children:[s.jsx("span",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.1em",color:o.text,background:o.bg,border:`1px solid ${o.border}`,borderRadius:4,padding:"2px 8px"},children:n.method}),s.jsx("span",{style:{fontFamily:"monospace",fontSize:12,color:"var(--text-primary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.path}),s.jsx("button",{onClick:r,className:"theme-text-faint flex items-center",children:s.jsx(Ct,{className:"h-4 w-4"})})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 16px",borderBottom:"1px solid var(--border)",backgroundColor:n.passed?"rgba(74,222,128,0.04)":"rgba(248,113,113,0.04)"},children:[n.passed?s.jsx(ut,{className:"h-4 w-4 text-emerald-400 shrink-0"}):s.jsx(_t,{className:"h-4 w-4 text-red-400 shrink-0"}),s.jsxs("span",{style:{fontSize:11,fontWeight:600,color:n.passed?"#4ade80":"#f87171"},children:["HTTP ",n.status>0?n.status:"ERROR"," · ",n.durationMs,"ms"]}),n.expectStatus&&s.jsxs("span",{style:{fontSize:10,color:"var(--text-muted)",marginLeft:"auto"},children:["expected ",n.expectStatus]})]}),s.jsx("div",{className:"flex border-b theme-border",children:["overview","request","response","vars","conditions"].map(f=>s.jsx("button",{onClick:()=>u(f),style:{flex:1,padding:"8px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.05em",textTransform:"capitalize",color:i===f?"var(--brand)":"var(--text-muted)",borderBottom:i===f?"2px solid var(--brand)":"2px solid transparent",background:"transparent",cursor:"pointer",transition:"color 0.15s"},children:f},f))}),s.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:[i==="overview"&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[s.jsxs(wn,{title:"Step",children:[s.jsx(Lt,{k:"Index",v:`#${n.index+1}`}),s.jsx(Lt,{k:"Name",v:n.name||"—"}),s.jsx(Lt,{k:"Method",v:n.method}),s.jsx(Lt,{k:"Path",v:n.path,mono:!0}),n.description&&s.jsx(Lt,{k:"Description",v:n.description})]}),s.jsxs(wn,{title:"Timing",children:[s.jsx(Lt,{k:"Duration",v:`${n.durationMs}ms`,accent:"var(--brand)"}),n.expectStatus&&s.jsx(Lt,{k:"Expected status",v:String(n.expectStatus)}),s.jsx(Lt,{k:"Actual status",v:n.status>0?String(n.status):"No response",accent:n.passed?"#4ade80":"#f87171"})]}),n.error&&s.jsx(wn,{title:"Error",children:s.jsx("div",{style:{background:"rgba(248,113,113,0.06)",border:"1px solid rgba(248,113,113,0.2)",borderRadius:6,padding:"8px 10px"},children:s.jsx("span",{style:{fontSize:11,color:"#f87171",fontFamily:"monospace"},children:n.error})})})]}),i==="request"&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[Object.keys(n.injected??{}).length>0&&s.jsx(wn,{title:"Headers (injected)",children:Object.entries(n.injected??{}).map(([f,h])=>s.jsx(Lt,{k:f,v:String(h),mono:!0},f))}),n.injectSpec&&Object.keys(n.injectSpec).length>0&&s.jsx(wn,{title:"Variable injection spec",children:Object.entries(n.injectSpec).map(([f,h])=>s.jsx(Lt,{k:f,v:`← {{${h}}}`,mono:!0,accent:"var(--brand)"},f))}),n.requestBody?s.jsx(wn,{title:"Request body",children:s.jsx("pre",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"monospace",background:"var(--bg-overlay)",border:"1px solid var(--border)",borderRadius:6,padding:10,overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:JSON.stringify(n.requestBody,null,2)})}):s.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"No request body"})]}),i==="response"&&s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:14},children:n.responseBody!==void 0?s.jsx(wn,{title:`Response body · HTTP ${n.status}`,children:s.jsx("pre",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"monospace",background:"var(--bg-overlay)",border:"1px solid var(--border)",borderRadius:6,padding:10,overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:typeof n.responseBody=="string"?n.responseBody:JSON.stringify(n.responseBody,null,2)})}):s.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"No response body recorded"})}),i==="vars"&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[n.captureSpec&&Object.keys(n.captureSpec).length>0&&s.jsx(wn,{title:"Capture spec (JSONPath)",children:Object.entries(n.captureSpec).map(([f,h])=>s.jsx(Lt,{k:f,v:h,mono:!0,accent:"var(--brand)"},f))}),n.captured&&Object.keys(n.captured).length>0?s.jsx(wn,{title:"Captured values",children:Object.entries(n.captured).map(([f,h])=>s.jsx(Lt,{k:f,v:String(h),mono:!0,accent:"#4ade80"},f))}):s.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"No variables captured in this step"})]}),i==="conditions"&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[n.conditionResult&&s.jsx(wn,{title:"Condition Evaluation Result",children:s.jsxs("div",{style:{padding:"8px 10px",borderRadius:6,border:`1px solid ${n.conditionResult.passed?"rgba(74,222,128,0.2)":"rgba(251,146,60,0.2)"}`,background:n.conditionResult.passed?"rgba(74,222,128,0.06)":"rgba(251,146,60,0.06)"},children:[s.jsxs("span",{style:{fontSize:11,fontWeight:600,color:n.conditionResult.passed?"#4ade80":"#fb923c"},children:["◇ Condition ",n.conditionResult.passed?"PASSED":"FAILED"]}),s.jsx("p",{style:{fontSize:10,color:"var(--text-secondary)",marginTop:4,fontFamily:"monospace"},children:n.conditionResult.reason})]})}),n.conditionSpec?s.jsxs(wn,{title:"Condition Rules",children:[s.jsx(Lt,{k:"Logic mode",v:n.conditionSpec.rules.all?"AND (all rules must pass)":"OR (any rule can pass)"}),s.jsx(Lt,{k:"Failure action",v:n.conditionSpec.onFail,accent:"#fb923c"}),n.conditionSpec.switchToWorkflow&&s.jsx(Lt,{k:"Switch workflow",v:n.conditionSpec.switchToWorkflow,mono:!0,accent:"var(--brand)"}),n.conditionSpec.returnOnComplete!==void 0&&s.jsx(Lt,{k:"Return on complete",v:n.conditionSpec.returnOnComplete?"Yes (resumes main workflow)":"No (permanent switch)"}),s.jsxs("div",{style:{marginTop:6},children:[s.jsx("p",{style:{fontSize:9,color:"var(--text-faint)",textTransform:"uppercase",marginBottom:4},children:"Rules list"}),(n.conditionSpec.rules.all??n.conditionSpec.rules.any??[]).map((f,h)=>s.jsxs("div",{style:{fontSize:10,color:"var(--brand)",fontFamily:"monospace",background:"var(--bg-overlay)",padding:"4px 8px",borderRadius:4,marginBottom:3},children:[f.left," ",s.jsx("span",{style:{color:"var(--brand)"},children:f.operator})," ",f.right!==void 0?f.right:""]},h))]})]}):s.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"No condition configured for this step"})]})]})]})}function wn({title:n,children:r}){return s.jsxs("div",{children:[s.jsx("p",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.1em",color:"var(--text-faint)",textTransform:"uppercase",marginBottom:8},children:n}),s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:5},children:r})]})}function Lt({k:n,v:r,mono:o=!1,accent:i}){return s.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[s.jsx("span",{style:{fontSize:10,color:"var(--text-muted)",minWidth:100,flexShrink:0},children:n}),s.jsx("span",{style:{fontSize:10,color:i??"var(--text-secondary)",fontFamily:o?"monospace":void 0,wordBreak:"break-all"},children:r})]})}function L4({trace:n}){const[r,o]=j.useState(null),i=n.steps.reduce((f,h)=>f+h.durationMs,0)||1,u=j.useCallback(f=>{o(h=>h===f?null:f)},[]);return s.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minWidth:0},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"14px 20px",borderBottom:"1px solid var(--border)",backgroundColor:"var(--bg-elevated)",flexShrink:0},children:[s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.workflowName}),s.jsxs("p",{style:{fontSize:10,color:"var(--text-muted)",marginTop:2,display:"flex",alignItems:"center",gap:6},children:[s.jsx(Gr,{className:"h-3 w-3 inline"}),new Date(n.startedAt).toLocaleString(),n.baseUrl&&s.jsxs(s.Fragment,{children:[" · ",s.jsx("code",{className:"theme-text-faint",children:n.baseUrl})]}),"· ",s.jsx("span",{className:"theme-text-faint",children:n.source==="local-sim"?"Simulated locally":"Real API run"})]})]}),s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,flexShrink:0,fontSize:11,fontWeight:600,padding:"4px 12px",borderRadius:20,color:n.phase==="done"&&n.failed===0?"#4ade80":n.phase==="aborted"?"#f87171":"#fbbf24",background:n.phase==="done"&&n.failed===0?"rgba(74,222,128,0.08)":"rgba(248,113,113,0.08)",border:`1px solid ${n.phase==="done"&&n.failed===0?"rgba(74,222,128,0.2)":"rgba(248,113,113,0.2)"}`},children:[n.phase==="done"&&n.failed===0?s.jsx(ut,{className:"h-3.5 w-3.5"}):s.jsx(_t,{className:"h-3.5 w-3.5"}),n.passed,"/",n.passed+n.failed," passed · ",n.durationMs,"ms"]})]}),s.jsxs("div",{style:{padding:"10px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[s.jsxs("p",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.1em",color:"var(--text-faint)",marginBottom:6,textTransform:"uppercase"},children:["Timeline · ",n.steps.length," steps · ",n.durationMs,"ms total"]}),s.jsx("div",{style:{display:"flex",gap:2,height:8,borderRadius:4,overflow:"hidden"},children:n.steps.map((f,h)=>s.jsx("div",{onClick:()=>u(h),title:`${f.method} ${f.path} — ${f.durationMs}ms`,style:{flex:f.durationMs/i,minWidth:4,background:f.passed?"#22c55e":"#ef4444",cursor:"pointer",opacity:r===h?1:.7,borderRadius:2,transition:"opacity 0.15s"}},h))}),s.jsx("div",{style:{display:"flex",gap:2,marginTop:4},children:n.steps.map((f,h)=>s.jsx("div",{style:{flex:f.durationMs/i,minWidth:4,fontSize:8,color:"var(--text-faint)",overflow:"hidden",cursor:"pointer"},onClick:()=>u(h),children:h+1},h))})]}),s.jsxs("div",{style:{flex:1,display:"flex",minHeight:0},children:[s.jsx("div",{style:{flex:1,minWidth:0,position:"relative"},children:s.jsx(B4,{trace:n,selectedStep:r,onSelectStep:u})}),r!==null&&n.steps[r]&&s.jsx(q4,{step:n.steps[r],onClose:()=>o(null)})]})]})}function Y4({trace:n,selected:r,onClick:o,onDelete:i}){const u=n.phase==="done"&&n.failed===0?"#4ade80":n.phase==="aborted"?"#f87171":"#fbbf24",f=()=>{const h=Date.now()-new Date(n.startedAt).getTime();return h<6e4?`${Math.round(h/1e3)}s ago`:h<36e5?`${Math.round(h/6e4)}m ago`:`${Math.round(h/36e5)}h ago`};return s.jsx("div",{onClick:o,style:{padding:"10px 14px",borderBottom:"1px solid var(--border)",cursor:"pointer",backgroundColor:r?"color-mix(in srgb, var(--brand) 6%, transparent)":"transparent",borderLeft:r?"3px solid var(--brand)":"3px solid transparent",transition:"background 0.1s",position:"relative"},className:"group",children:s.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[s.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:u,flexShrink:0,marginTop:4}}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsx("p",{style:{fontSize:11,fontWeight:500,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.workflowName}),s.jsxs("p",{style:{fontSize:9,color:"var(--text-muted)",marginTop:2,display:"flex",alignItems:"center",gap:4},children:[s.jsx(Gr,{className:"h-2.5 w-2.5 inline shrink-0"}),f()," · ",n.steps.length," steps · ",n.durationMs,"ms"]}),s.jsxs("div",{style:{display:"flex",gap:4,marginTop:4,flexWrap:"wrap"},children:[n.passed>0&&s.jsxs("span",{style:{fontSize:9,color:"#4ade80",background:"rgba(74,222,128,0.08)",border:"1px solid rgba(74,222,128,0.2)",borderRadius:4,padding:"1px 5px"},children:[n.passed," ✓"]}),n.failed>0&&s.jsxs("span",{style:{fontSize:9,color:"#f87171",background:"rgba(248,113,113,0.08)",border:"1px solid rgba(248,113,113,0.2)",borderRadius:4,padding:"1px 5px"},children:[n.failed," ✗"]}),s.jsx("span",{style:{fontSize:9,color:"var(--text-faint)",background:"var(--bg-overlay)",border:"1px solid var(--border)",borderRadius:4,padding:"1px 5px"},children:n.source==="local-sim"?"sim":"api"}),n.steps.some(h=>h.conditionSpec||h.conditionResult)&&s.jsxs("span",{style:{fontSize:9,color:"var(--brand)",background:"color-mix(in srgb, var(--brand) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--brand) 20%, transparent)",borderRadius:4,padding:"1px 5px",display:"flex",alignItems:"center",gap:2},children:[s.jsx(ea,{style:{width:8,height:8}})," cond"]})]})]}),s.jsx("button",{onClick:h=>{h.stopPropagation(),i()},style:{opacity:0,transition:"opacity 0.1s",color:"var(--text-faint)",display:"flex",alignItems:"center",padding:2,borderRadius:4},className:"group-hover:opacity-100",title:"Delete trace",children:s.jsx(Yt,{className:"h-3 w-3"})})]})})}function V4(){return s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:12,padding:"40px 20px",textAlign:"center"},children:[s.jsxs("div",{style:{position:"relative",width:52,height:52,display:"flex",alignItems:"center",justifyContent:"center"},children:[s.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"color-mix(in srgb, var(--brand) 10%, transparent)",filter:"blur(8px)"}}),s.jsx("div",{style:{position:"relative",width:52,height:52,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--border)",backgroundColor:"var(--bg-overlay)",color:"var(--brand)"},children:s.jsx(Vr,{className:"h-6 w-6"})})]}),s.jsx("p",{style:{fontSize:12,fontWeight:500,color:"var(--text-secondary)"},children:"No traces yet"}),s.jsx("p",{style:{fontSize:10,color:"var(--text-muted)",maxWidth:200},children:"Run a simulation from the Simulations page to generate a trace."})]})}function G4(){return s.jsxs("div",{style:{display:"flex",flex:1,flexDirection:"column",alignItems:"center",justifyContent:"center",gap:14,textAlign:"center",padding:32},children:[s.jsxs("div",{style:{position:"relative",width:64,height:64,display:"flex",alignItems:"center",justifyContent:"center"},children:[s.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"color-mix(in srgb, var(--brand) 10%, transparent)",filter:"blur(12px)"}}),s.jsx("div",{style:{position:"relative",width:64,height:64,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--border)",backgroundColor:"var(--bg-overlay)",color:"var(--brand)"},children:s.jsx(Vi,{className:"h-8 w-8"})})]}),s.jsxs("div",{children:[s.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-secondary)"},children:"Select a trace"}),s.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:"Pick a run from the list to visualize its execution graph"})]}),s.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:10,padding:"12px 16px",backgroundColor:"var(--bg-overlay)",maxWidth:340,textAlign:"left"},children:[s.jsx("p",{style:{fontSize:10,fontWeight:600,color:"var(--text-faint)",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.08em"},children:"What you'll see"}),[["HTTP step nodes","Every request in the workflow shown as a graph node with method, path, status, and timing"],["Memory nodes","Variables captured from responses (tokens, IDs, etc.) shown in between steps"],["Branch forks","Conditions that switch workflows peel off into a side branch, then merge back if they resume"],["Execution flow","Arrows colored green/red showing the success/failure path through your workflow"],["Step detail drawer","Click any node to see full request/response bodies, headers, and capture specs"]].map(([n,r])=>s.jsxs("div",{style:{display:"flex",gap:8,marginBottom:8},children:[s.jsx("span",{style:{color:"var(--brand)",flexShrink:0,marginTop:1},children:"→"}),s.jsxs("div",{children:[s.jsx("span",{style:{fontSize:11,fontWeight:500,color:"var(--text-secondary)"},children:n}),s.jsx("p",{style:{fontSize:10,color:"var(--text-muted)",marginTop:1},children:r})]})]},n))]})]})}function X4({initialFilter:n,onNavigate:r}){const[o,i]=j.useState([]),[u,f]=j.useState(!0),[h,g]=j.useState(""),[x,m]=j.useState(null),p=j.useRef(!1),b=j.useCallback(async()=>{f(!0);try{const k=await xx();if(i(k),!p.current&&n?.traceId){const R=k.find(z=>z.id===n.traceId);R&&(m(R),p.current=!0)}else if(!p.current&&n?.workflowName&&k.length>0){const R=k.find(z=>z.workflowName===n.workflowName);R&&(m(R),p.current=!0)}}finally{f(!1)}},[n?.traceId,n?.workflowName]);j.useEffect(()=>{b()},[b]),j.useEffect(()=>{const k=setInterval(()=>{xx().then(R=>{(R.length!==o.length||R.some((z,V)=>z.id!==o[V]?.id))&&i(R)}).catch(()=>{})},5e3);return()=>clearInterval(k)},[o]),j.useEffect(()=>{if(n?.traceId&&o.length>0){const k=o.find(R=>R.id===n.traceId);k&&m(k)}},[n?.traceId,o]);const v=async k=>{await k2(k),x?.id===k&&m(null),i(R=>R.filter(z=>z.id!==k))},N=async()=>{confirm("Delete all traces? This cannot be undone.")&&(await _2(),i([]),m(null))},C=o.filter(k=>!h.trim()||k.workflowName.toLowerCase().includes(h.toLowerCase())||k.steps.some(R=>R.path.toLowerCase().includes(h.toLowerCase())));return s.jsxs("div",{style:{display:"flex",height:"100%"},className:"w-full",children:[s.jsxs("div",{style:{width:280,flexShrink:0,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border)",backgroundColor:"var(--bg-surface)"},children:[s.jsxs("div",{style:{padding:"14px 14px 10px",borderBottom:"1px solid var(--border)",backgroundColor:"var(--bg-elevated)",flexShrink:0},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[s.jsxs("div",{children:[s.jsx("p",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",lineHeight:1},children:"Traces"}),s.jsx("p",{style:{fontSize:10,color:"var(--text-muted)",marginTop:3},children:u?"Loading…":`${o.length} run${o.length!==1?"s":""} stored`})]}),s.jsxs("div",{style:{display:"flex",gap:6},children:[s.jsx("button",{onClick:b,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:7,border:"1px solid var(--border)",background:"var(--bg-overlay)",color:"var(--text-muted)",cursor:"pointer"},children:s.jsx(na,{className:"h-3.5 w-3.5"})}),o.length>0&&s.jsx("button",{onClick:N,title:"Clear all",style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:7,border:"1px solid rgba(239,68,68,0.25)",background:"rgba(239,68,68,0.06)",color:"#f87171",cursor:"pointer"},children:s.jsx(Yt,{className:"h-3.5 w-3.5"})})]})]}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(zi,{style:{position:"absolute",left:8,top:"50%",transform:"translateY(-50%)",width:13,height:13,color:"var(--text-faint)",pointerEvents:"none"}}),s.jsx("input",{value:h,onChange:k=>g(k.target.value),placeholder:"Search traces…",style:{width:"100%",paddingLeft:28,paddingRight:h?28:10,paddingTop:6,paddingBottom:6,fontSize:11,border:"1px solid var(--border)",borderRadius:8,backgroundColor:"var(--bg-overlay)",color:"var(--text-secondary)",outline:"none",boxSizing:"border-box"}}),h&&s.jsx("button",{onClick:()=>g(""),style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",color:"var(--text-faint)",display:"flex",background:"none",border:"none",cursor:"pointer",padding:0},children:s.jsx(Ct,{className:"h-3 w-3"})})]})]}),s.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[u&&s.jsx("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:8},children:[1,2,3].map(k=>s.jsx("div",{style:{height:64,borderRadius:8,border:"1px solid var(--border)",backgroundColor:"var(--bg-overlay)",opacity:1-k*.25,animation:"pulse 2s cubic-bezier(0.4,0,0.6,1) infinite"}},k))}),!u&&C.length===0&&s.jsx(V4,{}),!u&&C.map(k=>s.jsx(Y4,{trace:k,selected:x?.id===k.id,onClick:()=>m(k),onDelete:()=>v(k.id)},k.id))]}),r&&s.jsxs("div",{style:{padding:"10px 14px",borderTop:"1px solid var(--border)",display:"flex",gap:10},children:[s.jsxs("button",{onClick:()=>r("simulations"),style:{display:"flex",alignItems:"center",gap:4,fontSize:10,color:"var(--brand)",background:"none",border:"none",cursor:"pointer",padding:0},children:[s.jsx(ea,{className:"h-3 w-3"})," Simulations ",s.jsx(Md,{className:"h-2.5 w-2.5"})]}),s.jsxs("button",{onClick:()=>r("model"),style:{display:"flex",alignItems:"center",gap:4,fontSize:10,color:"var(--brand)",background:"none",border:"none",cursor:"pointer",padding:0},children:[s.jsx(A0,{className:"h-3 w-3"})," Model ",s.jsx(Md,{className:"h-2.5 w-2.5"})]})]})]}),s.jsx("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",backgroundColor:"var(--bg-base)"},children:x?s.jsx(L4,{trace:x,onNavigate:r}):s.jsx(G4,{})})]})}function Z4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Events"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Stream of events emitted by the workspace."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}function W4(n){const r=n.split(".").pop()?.toLowerCase()??"";return["ts","tsx","js","jsx","mjs","py","go","rs"].includes(r)?{icon:hv,color:"text-[color:var(--brand)]"}:["json","yaml","yml","toml","env"].includes(r)?{icon:Fd,color:"text-amber-400"}:["sql","prisma","graphql","gql"].includes(r)?{icon:fl,color:"text-emerald-400"}:{icon:xv,color:"theme-text-muted"}}function Q4(n){try{const r=Math.floor((Date.now()-new Date(n).getTime())/1e3);return r<5?"just now":r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function K4({onNavigate:n}={}){const[r,o]=j.useState(null),[i,u]=j.useState(!0),[f,h]=j.useState(null),[g,x]=j.useState(!1),[m,p]=j.useState(""),[b,v]=j.useState(null),[N,C]=j.useState(!1),k=j.useCallback(async(M=!1)=>{M||u(!0);try{const H=await fetch("/api/changes");if(!H.ok)throw new Error(`HTTP ${H.status}`);o(await H.json()),h(null)}catch(H){h(H.message??"Failed to fetch changes")}finally{M||u(!1)}},[]),R=async()=>{if(!N){C(!0);try{await fetch("/api/changes",{method:"DELETE"}),await k(!0)}catch(M){alert(`Clear failed: ${M.message}`)}finally{C(!1)}}},z=M=>{navigator.clipboard.writeText(M),v(M),setTimeout(()=>v(null),2e3)};j.useEffect(()=>{k();let M=null,H=null;try{M=new EventSource("/api/changes/stream"),M.onopen=()=>x(!0),M.onmessage=Z=>{try{o(JSON.parse(Z.data))}catch{}},M.onerror=()=>{x(!1),H||(H=setInterval(()=>k(!0),2e3))}}catch{H=setInterval(()=>k(!0),2e3)}return()=>{M?.close(),H&&clearInterval(H)}},[k]);const V=j.useMemo(()=>{if(!r?.changes)return[];if(!m)return r.changes;const M=m.toLowerCase();return r.changes.filter(H=>H.filePath.toLowerCase().includes(M))},[r,m]),q=r?.changes?.length??0;return s.jsxs("div",{className:"flex flex-1 flex-col min-h-0 theme-bg-base theme-text-primary",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b theme-border theme-sidebar",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx(T0,{className:"h-[15px] w-[15px] shrink-0 theme-text-muted",strokeWidth:2}),s.jsx("span",{className:"text-[13.5px] font-medium tracking-tight theme-text-primary",children:"File Changes"}),q>0&&s.jsx("span",{className:"rounded-full px-2 py-0.5 text-[11px] font-medium border theme-border theme-bg-overlay-md theme-text-muted",children:q}),s.jsxs("div",{className:"flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] font-medium border theme-border theme-bg-overlay theme-text-muted",children:[s.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${g?"theme-bg-brand animate-pulse":"bg-[var(--text-faint)]"}`}),g?"Live":"Polling"]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("button",{type:"button",onClick:()=>k(!1),disabled:i,className:"flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium transition-colors border theme-border theme-bg-overlay theme-text-muted",children:[s.jsx(na,{className:`h-3 w-3 shrink-0 ${i?"animate-spin":""}`,strokeWidth:2}),"Refresh"]}),s.jsxs("button",{type:"button",onClick:R,disabled:N||q===0,className:"flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium transition-colors disabled:opacity-40 border theme-border theme-bg-overlay theme-text-muted",children:[s.jsx(Yt,{className:"h-3 w-3 shrink-0",strokeWidth:2}),N?"Clearing…":"Clear"]})]})]}),s.jsx("div",{className:"px-4 py-2.5 border-b theme-border",children:s.jsxs("div",{className:"relative",children:[s.jsx(zi,{className:"absolute left-2.5 top-1/2 h-3 w-3 -translate-y-1/2 shrink-0 theme-text-faint",strokeWidth:2}),s.jsx("input",{type:"text",placeholder:"Filter by filename or path…",value:m,onChange:M=>p(M.target.value),className:"w-full rounded-lg py-1.5 pl-8 pr-3 text-[12px] focus:outline-none focus:ring-1 focus:ring-[color:var(--brand)]/50 border theme-border theme-bg-overlay theme-text-primary"}),m&&s.jsx("button",{type:"button",onClick:()=>p(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-[10px] theme-text-muted",children:"Clear"})]})}),f&&s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 text-[11px] border-b theme-border theme-text-muted",children:[s.jsx(_t,{className:"h-3.5 w-3.5 shrink-0 text-red-400",strokeWidth:2}),f]}),s.jsx("div",{className:"flex flex-1 flex-col overflow-y-auto",children:i&&!r?s.jsxs("div",{className:"flex items-center justify-center gap-2 p-10 theme-text-muted",children:[s.jsx(na,{className:"h-4 w-4 animate-spin text-[color:var(--brand)]",strokeWidth:2}),s.jsx("span",{className:"text-[12px]",children:"Connecting…"})]}):V.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center gap-1 p-10 text-center",children:[s.jsx(ut,{className:"h-5 w-5 mb-1 text-[color:var(--brand)]",strokeWidth:2}),s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:q===0?"No pending changes":"No files match filter"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:q===0?"File edits appear here in real-time.":"Try a different search."})]}):V.map(M=>{const{icon:H,color:Z}=W4(M.filePath),X=M.filePath.split("/"),oe=X.pop()??M.filePath,I=X.join("/"),K=b===M.filePath;return s.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 transition-colors hover:theme-bg-overlay border-b theme-border",children:[s.jsx(H,{className:`h-[15px] w-[15px] shrink-0 ${Z}`,strokeWidth:1.75}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsx("span",{className:"truncate text-[12.5px] font-medium theme-text-primary",children:oe}),I&&s.jsxs("span",{className:"truncate text-[11px] theme-text-faint",children:[I,"/"]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsx("span",{className:"rounded px-1.5 py-0.5 text-[10px] border theme-border theme-bg-overlay theme-text-faint",children:M.eventType}),s.jsx("span",{className:"w-14 text-right text-[11px] theme-text-muted",children:Q4(M.changedAt)}),s.jsx("button",{type:"button",onClick:()=>z(M.filePath),title:"Copy path",className:"flex h-6 w-6 items-center justify-center rounded transition-colors border theme-border theme-bg-overlay theme-text-faint",children:K?s.jsx(ut,{className:"h-3 w-3 text-[color:var(--brand)]",strokeWidth:2}):s.jsx(C0,{className:"h-3 w-3",strokeWidth:2})})]})]},M.filePath)})})]})}function xs({icon:n,label:r,description:o}){return s.jsxs("div",{className:"flex items-start gap-3 pb-4 border-b theme-border",children:[s.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border theme-border theme-bg-overlay",children:s.jsx(n,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[13.5px] font-medium theme-text-primary",children:r}),o&&s.jsx("p",{className:"mt-0.5 text-[11px] theme-text-muted",children:o})]})]})}function lt({label:n,description:r,children:o}){return s.jsxs("div",{className:"flex items-center justify-between gap-4 py-3 border-b theme-border last:border-0",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-[13px] theme-text-primary",children:n}),r&&s.jsx("p",{className:"text-[11px] theme-text-muted mt-0.5",children:r})]}),s.jsx("div",{className:"shrink-0",children:o})]})}function sn({value:n,onChange:r}){return s.jsx("button",{onClick:()=>r(!n),className:`relative flex h-5 w-9 items-center rounded-full border transition-colors ${n?"bg-[var(--action)] border-[color:var(--brand)]":"theme-bg-overlay-md theme-border"}`,children:s.jsx("span",{className:`absolute h-3.5 w-3.5 rounded-full bg-[color:var(--action-foreground)] shadow transition-transform ${n?"translate-x-4":"translate-x-0.5"}`})})}function J4({value:n,onChange:r,placeholder:o,mono:i=!1,type:u="text"}){return s.jsx("input",{type:u,value:n,onChange:f=>r(f.target.value),placeholder:o,className:`w-56 rounded-lg border theme-border theme-bg-overlay px-3 py-1.5 text-[12px] theme-text-primary outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md placeholder:theme-text-faint transition-colors ${i?"font-mono":""}`})}function bl({value:n,onChange:r,options:o}){return s.jsx("select",{value:n,onChange:i=>r(i.target.value),className:"rounded-lg border theme-border theme-bg-surface px-3 py-1.5 text-[12px] theme-text-primary outline-none focus:border-[color:var(--brand)]/50 transition-colors",children:o.map(i=>s.jsx("option",{value:i,children:i},i))})}function gs({children:n,className:r=""}){return s.jsx("div",{className:`rounded-lg border theme-border theme-bg-overlay p-5 space-y-1 ${r}`,children:n})}function wy({saving:n,onClick:r}){return s.jsxs("button",{onClick:r,disabled:n,className:"flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-3 py-1.5 text-[12px] font-medium text-[color:var(--action-foreground)] hover:bg-[var(--action-hover)] disabled:opacity-50 transition-colors",children:[n?s.jsx(dt,{className:"h-3.5 w-3.5 animate-spin",strokeWidth:2}):s.jsx(Zv,{className:"h-3.5 w-3.5",strokeWidth:2}),n?"Saving…":"Save"]})}const I4=[{id:"general",label:"General",icon:zr},{id:"environments",label:"Environments",icon:jl},{id:"appearance",label:"Appearance",icon:z0},{id:"editor",label:"Editor",icon:Vi},{id:"notifications",label:"Notifications",icon:_0},{id:"api",label:"API & Auth",icon:La},{id:"advanced",label:"Advanced",icon:O0}];function F4({model:n}){const[r,o]=j.useState(n?.project?.name??""),[i,u]=j.useState(n?.project?.language??"TypeScript"),[f,h]=j.useState(n?.project?.framework??"Express"),[g,x]=j.useState(!1),[m,p]=j.useState(!1);j.useEffect(()=>{o(n?.project?.name??""),u(n?.project?.language??"TypeScript"),h(n?.project?.framework??"Express")},[n]);const b=async()=>{x(!0),await new Promise(v=>setTimeout(v,600)),x(!1),p(!0),setTimeout(()=>p(!1),2e3)};return s.jsxs("div",{className:"space-y-5",children:[s.jsx(xs,{icon:zr,label:"General",description:"Project identity and basic configuration"}),s.jsxs(gs,{children:[s.jsx(lt,{label:"Project Name",description:"Display name shown in the dashboard",children:s.jsx(J4,{value:r,onChange:o,placeholder:"My API"})}),s.jsx(lt,{label:"Language",description:"Primary language of your backend",children:s.jsx(bl,{value:i,onChange:u,options:["TypeScript","JavaScript","Python","Go","Rust"]})}),s.jsx(lt,{label:"Framework",description:"HTTP framework used by your server",children:s.jsx(bl,{value:f,onChange:h,options:["Express","Fastify","Hono","Koa","NestJS","Other"]})}),s.jsxs("div",{className:"flex justify-end pt-2 gap-2",children:[m&&s.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-emerald-400",children:[s.jsx(ut,{className:"h-3.5 w-3.5",strokeWidth:2})," Saved"]}),s.jsx(wy,{saving:g,onClick:b})]})]})]})}function P4({model:n}){const[r,o]=j.useState(n?.environments??[{name:"local",baseUrl:"http://localhost:3000"}]),[i,u]=j.useState(!1),[f,h]=j.useState(!1);j.useEffect(()=>{o(n?.environments??[{name:"local",baseUrl:"http://localhost:3000"}])},[n]);const g=()=>o(b=>[...b,{name:"",baseUrl:""}]),x=b=>o(v=>v.filter((N,C)=>C!==b)),m=(b,v,N)=>o(C=>C.map((k,R)=>R===b?{...k,[v]:N}:k)),p=async()=>{u(!0),await new Promise(b=>setTimeout(b,600)),u(!1),h(!0),setTimeout(()=>h(!1),2e3)};return s.jsxs("div",{className:"space-y-5",children:[s.jsx(xs,{icon:jl,label:"Environments",description:"Configure your API base URLs for simulation"}),s.jsxs(gs,{children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-4 px-1 mb-2",children:[s.jsx("p",{className:"w-24 text-[10px] uppercase tracking-wider theme-text-faint font-semibold",children:"Name"}),s.jsx("p",{className:"flex-1 text-[10px] uppercase tracking-wider theme-text-faint font-semibold",children:"Base URL"})]}),r.map((b,v)=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{value:b.name,onChange:N=>m(v,"name",N.target.value),placeholder:"local",className:"w-24 rounded-lg border theme-border theme-bg-overlay px-3 py-1.5 text-[12px] theme-text-primary outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md placeholder:theme-text-faint transition-colors"}),s.jsx("input",{value:b.baseUrl,onChange:N=>m(v,"baseUrl",N.target.value),placeholder:"http://localhost:3000",className:"flex-1 rounded-lg border theme-border theme-bg-overlay px-3 py-1.5 font-mono text-[12px] theme-text-primary outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md placeholder:theme-text-faint transition-colors"}),s.jsx("button",{onClick:()=>x(v),className:"flex h-7 w-7 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-muted hover:bg-red-500/10 hover:border-red-500/30 hover:text-red-400 transition-colors",children:s.jsx(Ct,{className:"h-3.5 w-3.5",strokeWidth:2})})]},v)),s.jsx("button",{onClick:g,className:"text-[12px] text-[color:var(--brand)] hover:text-[color:var(--brand)] transition-colors mt-1",children:"+ Add environment"})]}),s.jsxs("div",{className:"flex justify-end pt-3 gap-2 border-t theme-border",children:[f&&s.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-emerald-400",children:[s.jsx(ut,{className:"h-3.5 w-3.5",strokeWidth:2})," Saved"]}),s.jsx(wy,{saving:i,onClick:p})]})]}),s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay px-4 py-3 flex items-start gap-2.5",children:[s.jsx(Nv,{className:"h-3.5 w-3.5 text-[color:var(--brand)]/70 shrink-0 mt-0.5",strokeWidth:2}),s.jsxs("p",{className:"text-[11px] theme-text-muted",children:["The"," ",s.jsx("code",{className:"theme-text-primary theme-bg-overlay-md px-1 py-0.5 rounded text-[10px]",children:"local"})," ","environment is used as the default base URL for simulations and endpoint testing."]})]})]})}function eE(){const[n,r]=j.useState("dark"),[o,i]=j.useState("blue"),[u,f]=j.useState("comfortable"),[h,g]=j.useState(!0),x=["blue","violet","emerald","amber","rose"],m={blue:"var(--brand)",violet:"var(--brand)",emerald:"#34d399",amber:"#fbbf24",rose:"#fb7185"};return s.jsxs("div",{className:"space-y-5",children:[s.jsx(xs,{icon:z0,label:"Appearance",description:"Customize the look and feel of the dashboard"}),s.jsxs(gs,{children:[s.jsx(lt,{label:"Theme",description:"Choose your preferred colour scheme",children:s.jsx("div",{className:"flex gap-px overflow-hidden rounded-lg border theme-border",children:["dark","darker"].map(p=>s.jsx("button",{onClick:()=>r(p),className:`px-3 py-1.5 text-[12px] transition-colors capitalize ${n===p?"bg-[var(--action)] text-[color:var(--action-foreground)]":"theme-text-muted hover:theme-text-primary theme-bg-overlay hover:theme-bg-overlay-md"}`,children:p},p))})}),s.jsx(lt,{label:"Accent Colour",description:"Primary highlight colour throughout the UI",children:s.jsx("div",{className:"flex items-center gap-2",children:x.map(p=>s.jsx("button",{onClick:()=>i(p),className:`h-5 w-5 rounded-full border-2 transition-transform ${o===p?"scale-110 theme-border-md":"border-transparent hover:scale-105"}`,style:{background:m[p]}},p))})}),s.jsx(lt,{label:"Density",description:"Controls spacing throughout the layout",children:s.jsx("div",{className:"flex gap-px overflow-hidden rounded-lg border theme-border",children:["comfortable","compact"].map(p=>s.jsx("button",{onClick:()=>f(p),className:`px-3 py-1.5 text-[12px] transition-colors capitalize ${u===p?"bg-[var(--action)] text-[color:var(--action-foreground)]":"theme-text-muted hover:theme-text-primary theme-bg-overlay hover:theme-bg-overlay-md"}`,children:p},p))})}),s.jsx(lt,{label:"Animations",description:"Smooth transitions and micro-animations",children:s.jsx(sn,{value:h,onChange:g})})]})]})}function tE(){const[n,r]=j.useState("11"),[o,i]=j.useState("2"),[u,f]=j.useState(!0),[h,g]=j.useState(!0),[x,m]=j.useState(!0);return s.jsxs("div",{className:"space-y-5",children:[s.jsx(xs,{icon:Vi,label:"Editor",description:"Source viewer and code display preferences"}),s.jsxs(gs,{children:[s.jsx(lt,{label:"Font Size",description:"Monospace font size in the source viewer",children:s.jsx(bl,{value:n,onChange:r,options:["10","11","12","13","14"]})}),s.jsx(lt,{label:"Tab Size",description:"Number of spaces per indentation level",children:s.jsx(bl,{value:o,onChange:i,options:["2","4","8"]})}),s.jsx(lt,{label:"Word Wrap",description:"Wrap long lines in the source viewer",children:s.jsx(sn,{value:u,onChange:f})}),s.jsx(lt,{label:"Line Numbers",description:"Show line numbers in the source viewer gutter",children:s.jsx(sn,{value:h,onChange:g})}),s.jsx(lt,{label:"Highlight Handler Line",description:"Highlight the matched handler line in source view",children:s.jsx(sn,{value:x,onChange:m})})]})]})}function nE(){const[n,r]=j.useState(!0),[o,i]=j.useState(!0),[u,f]=j.useState(!0),[h,g]=j.useState(!1),[x,m]=j.useState(!1);return s.jsxs("div",{className:"space-y-5",children:[s.jsx(xs,{icon:_0,label:"Notifications",description:"Control when and how you're notified"}),s.jsxs(gs,{children:[s.jsx(lt,{label:"Scan complete",description:"Notify when a project scan finishes",children:s.jsx(sn,{value:n,onChange:r})}),s.jsx(lt,{label:"Simulation complete",description:"Notify when a workflow run finishes",children:s.jsx(sn,{value:o,onChange:i})}),s.jsx(lt,{label:"Simulation failure",description:"Notify when a workflow step fails",children:s.jsx(sn,{value:u,onChange:f})}),s.jsx(lt,{label:"Memory updates",description:"Notify on runtime memory changes",children:s.jsx(sn,{value:h,onChange:g})}),s.jsx(lt,{label:"Desktop notifications",description:"Show browser push notifications",children:s.jsx(sn,{value:x,onChange:m})})]})]})}function aE(){const[n,r]=j.useState(""),[o,i]=j.useState("10000"),[u,f]=j.useState(!1),[h,g]=j.useState(!1);return s.jsxs("div",{className:"space-y-5",children:[s.jsx(xs,{icon:La,label:"API & Auth",description:"Default request settings for endpoint simulation"}),s.jsxs(gs,{children:[s.jsx(lt,{label:"Default Bearer Token",description:"Pre-fill bearer token in simulate panels",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("input",{type:h?"text":"password",value:n,onChange:x=>r(x.target.value),placeholder:"eyJ…",className:"w-48 rounded-lg border theme-border theme-bg-overlay px-3 py-1.5 font-mono text-[12px] theme-text-primary outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md placeholder:text-[color:var(--text-muted)] transition-colors"}),s.jsx("button",{onClick:()=>g(x=>!x),className:"text-[11px] theme-text-muted hover:theme-text transition-colors",children:h?"Hide":"Show"})]})}),s.jsx(lt,{label:"Request Timeout",description:"Milliseconds before a simulated request times out",children:s.jsx(bl,{value:o,onChange:i,options:["5000","10000","15000","30000","60000"]})}),s.jsx(lt,{label:"Auto-retry on 5xx",description:"Automatically retry failed requests once",children:s.jsx(sn,{value:u,onChange:f})})]})]})}function sE({onClearMemory:n}){const[r,o]=j.useState(!1),[i,u]=j.useState(!1),[f,h]=j.useState(!1),[g,x]=j.useState("30"),[m,p]=j.useState(!1),[b,v]=j.useState(!1),N=async()=>{p(!0),await new Promise(C=>setTimeout(C,800)),p(!1),v(!0),setTimeout(()=>v(!1),2e3),n()};return s.jsxs("div",{className:"space-y-5",children:[s.jsx(xs,{icon:O0,label:"Advanced",description:"Developer and diagnostic options"}),s.jsxs(gs,{children:[s.jsx(lt,{label:"Scan on start",description:"Auto-scan project when the dashboard loads",children:s.jsx(sn,{value:r,onChange:o})}),s.jsx(lt,{label:"Auto-refresh model",description:"Periodically reload model.json from disk",children:s.jsx(sn,{value:f,onChange:h})}),f&&s.jsx(lt,{label:"Refresh interval",description:"How often to poll for model changes",children:s.jsx(bl,{value:g,onChange:x,options:["10","30","60","120"]})}),s.jsx(lt,{label:"Debug mode",description:"Verbose logging in the browser console",children:s.jsx(sn,{value:i,onChange:u})})]}),s.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/[0.03] overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-red-500/10",children:[s.jsx(Yt,{className:"h-[15px] w-[15px] text-red-400/60",strokeWidth:2}),s.jsx("span",{className:"text-[11px] font-semibold tracking-wider text-red-400/70",children:"DANGER ZONE"})]}),s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[13px] theme-text-primary",children:"Clear Runtime Memory"}),s.jsx("p",{className:"text-[11px] theme-text-muted mt-0.5",children:"Delete all stored memory keys and values"})]}),s.jsxs("button",{onClick:N,disabled:m,className:"flex items-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/[0.06] px-3 py-1.5 text-[12px] text-red-400 hover:bg-red-500/10 disabled:opacity-50 transition-colors",children:[m?s.jsx(dt,{className:"h-3.5 w-3.5 animate-spin",strokeWidth:2}):b?s.jsx(ut,{className:"h-3.5 w-3.5",strokeWidth:2}):s.jsx(Yt,{className:"h-3.5 w-3.5",strokeWidth:2}),m?"Clearing…":b?"Cleared":"Clear Memory"]})]}),s.jsxs("div",{className:"flex items-center justify-between gap-4 pt-3 border-t border-red-500/10",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[13px] theme-text-primary",children:"Reset Model"}),s.jsxs("p",{className:"text-[11px] theme-text-muted mt-0.5",children:["Delete"," ",s.jsx("code",{className:"theme-text-muted theme-bg-overlay-md px-1 py-0.5 rounded text-[10px]",children:".jetic/model.json"})," ","and start fresh"]})]}),s.jsxs("button",{className:"flex items-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/[0.06] px-3 py-1.5 text-[12px] text-red-400 hover:bg-red-500/10 transition-colors",children:[s.jsx(Yt,{className:"h-3.5 w-3.5",strokeWidth:2})," Reset Model"]})]})]})]})]})}function lE(){return s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay p-4 flex items-center gap-3",children:[s.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg border theme-border theme-bg-overlay-md",children:s.jsx(hs,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[13.5px] font-medium theme-text-primary",children:"Jetic Studio"}),s.jsx("p",{className:"text-[11px] theme-text-muted",children:"v0.1.0 · Local development dashboard"})]}),s.jsxs("div",{className:"ml-auto flex items-center gap-1.5 rounded-full border theme-border theme-bg-overlay px-2.5 py-1",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full theme-bg-brand animate-pulse"}),s.jsx("span",{className:"text-[11px] theme-text-muted font-medium",children:"Running"})]})]})}function rE({icon:n,label:r,active:o,onClick:i}){return s.jsxs("button",{type:"button",onClick:i,className:`relative flex w-full items-center gap-3 rounded-lg px-3 py-1.5 text-left text-[13.5px] transition-colors ${o?"theme-bg-overlay-md theme-text-primary font-medium":"theme-text-muted hover:theme-bg-overlay hover:theme-text-primary"}`,children:[o&&s.jsx("span",{className:"absolute -left-3 top-1/2 h-4 w-[3px] -translate-y-1/2 rounded-full theme-bg-brand"}),s.jsx(n,{className:"h-[15px] w-[15px] shrink-0",strokeWidth:2}),s.jsx("span",{children:r}),o&&s.jsx(vl,{className:"ml-auto h-3.5 w-3.5 opacity-40",strokeWidth:2})]})}function oE(){const[n,r]=j.useState("general"),[o,i]=j.useState(null),[u,f]=j.useState(!0);j.useEffect(()=>{fetch("/api/model").then(g=>g.ok?g.json():null).then(g=>i(g)).catch(()=>{}).finally(()=>f(!1))},[]);const h=()=>{switch(n){case"general":return s.jsx(F4,{model:o});case"environments":return s.jsx(P4,{model:o});case"appearance":return s.jsx(eE,{});case"editor":return s.jsx(tE,{});case"notifications":return s.jsx(nE,{});case"api":return s.jsx(aE,{});case"advanced":return s.jsx(sE,{onClearMemory:()=>{}});default:return null}};return s.jsxs("div",{className:"flex min-h-full w-full flex-col",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium theme-text-primary leading-none",children:"Settings"}),s.jsx("p",{className:"mt-0.5 text-[11px] theme-text-muted",children:"Configure Jetic Studio"})]})}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsxs("nav",{className:"w-52 shrink-0 border-r theme-border theme-sidebar select-none overflow-y-auto p-3 space-y-0.5",children:[s.jsx("span",{className:"px-3 pb-1.5 pt-1 block text-[11px] font-semibold tracking-wider theme-text-muted",children:"CONFIGURATION"}),s.jsx("div",{className:"flex flex-col gap-0.5",children:I4.map(({id:g,label:x,icon:m})=>s.jsx(rE,{icon:m,label:x,active:n===g,onClick:()=>r(g)},g))}),s.jsx("div",{className:"hidden pt-4 mt-2 border-t theme-border",children:s.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border theme-border theme-bg-overlay px-2.5 py-1 w-fit",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full theme-bg-brand"}),s.jsx("span",{className:"text-[11px] font-medium theme-text-muted",children:"v0.1.0"})]})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-5",children:u?s.jsx("div",{className:"space-y-3",children:[1,2,3].map(g=>s.jsx("div",{className:"h-16 animate-pulse rounded-lg border theme-border theme-bg-overlay",style:{opacity:1-g*.25}},g))}):s.jsxs(s.Fragment,{children:[s.jsx(lE,{}),h()]})})]})]})}function iE(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Docs"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Guides and references for Jetic Local Studio."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}const cE=["overview","simulations","model","inspect","agents","tools","context","memory","apis","email","oauth","webhooks","traces","events","changes","settings","docs"],uE=5e3;function dE(){const{theme:n}=H0();return s.jsxs("div",{className:"jetic-surface flex h-screen w-full flex-col items-center justify-center gap-7",children:[s.jsx(j2,{size:56,loop:!0,sheen:n==="dark"?"#000":"#fff",className:"theme-text-primary"}),s.jsxs("div",{className:"flex flex-col items-center gap-1.5 text-center",children:[s.jsx("span",{className:"text-[13.5px] font-medium tracking-tight theme-text-primary",children:"Jetic Local Studio is loading…"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"Preparing your workspace"})]}),s.jsx("div",{className:"h-[3px] w-40 overflow-hidden rounded-full theme-bg-overlay",children:s.jsx("div",{className:"jetic-loader-bar h-full w-full origin-left rounded-full theme-bg-brand"})})]})}function fE(){const[n,r]=j.useState(!0),[o,i]=j.useState(()=>{const C=localStorage.getItem("active_sidebar_item");return cE.includes(C)?C:"overview"}),[u,f]=j.useState(!1),[h,g]=j.useState(()=>{try{const C=localStorage.getItem("inspected_endpoint");return C?JSON.parse(C):null}catch{return null}}),[x,m]=j.useState(void 0);j.useEffect(()=>{const C=setTimeout(()=>r(!1),uE);return()=>clearTimeout(C)},[]),j.useEffect(()=>{localStorage.setItem("active_sidebar_item",o)},[o]),j.useEffect(()=>{h?localStorage.setItem("inspected_endpoint",JSON.stringify(h)):localStorage.removeItem("inspected_endpoint")},[h]);const p=C=>{C!=="inspect"&&g(null),C!=="traces"&&m(void 0),i(C)},b=C=>{g(C),i("inspect")},v=C=>{m(C),i("traces")},N=()=>{switch(o){case"overview":return s.jsx(px,{onNavigate:p});case"simulations":return s.jsx(G3,{onViewTraces:v});case"model":return s.jsx(a4,{onInspect:b,onViewTraces:v});case"inspect":return s.jsx(o4,{endpoint:h,onBack:()=>p("model")});case"agents":return s.jsx(i4,{});case"tools":return s.jsx(c4,{});case"context":return s.jsx(u4,{});case"memory":return s.jsx(N4,{});case"apis":return s.jsx(w4,{});case"email":return s.jsx(S4,{});case"oauth":return s.jsx(E4,{});case"webhooks":return s.jsx(k4,{});case"traces":return s.jsx(X4,{initialFilter:x,onNavigate:p});case"events":return s.jsx(Z4,{});case"changes":return s.jsx(K4,{onNavigate:p});case"settings":return s.jsx(oE,{});case"docs":return s.jsx(iE,{});default:return s.jsx(px,{})}};return n?s.jsx(dE,{}):s.jsxs("div",{className:"flex h-screen w-full overflow-hidden antialiased [font-feature-settings:'ss01'] font-sans text-xs transition-colors duration-300 theme-bg-base theme-text",children:[s.jsx(g2,{currentPage:o,onNavigate:p,onToggleAssistant:()=>f(!u),isAssistantOpen:u}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col relative",children:[s.jsx("div",{className:"flex min-h-0 flex-1 overflow-auto transition-colors duration-300 theme-bg-base",children:N()}),s.jsx(y2,{isOpen:u,onClose:()=>f(!1)}),s.jsx(b2,{onNavigateToChanges:()=>p("changes")})]})]})}const hE=()=>s.jsx(h2,{children:s.jsx(fE,{})});Ub.createRoot(document.getElementById("root")).render(s.jsx(j.StrictMode,{children:s.jsx(hE,{})}));
429
+ }`,rows:2,className:`${be} resize-none font-mono text-[11px] leading-relaxed`})]})]},ue))})]}),i==="middleware"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:B+" mb-0",children:"Middleware Chain"}),s.jsx("p",{className:"text-[10px] theme-text-faint mt-0.5",children:"Executed in order, top → bottom"})]}),s.jsxs("button",{type:"button",onClick:Se,className:"flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] font-medium text-[color:var(--brand)] hover:bg-[color:var(--brand)]/10 transition-colors hover:cursor-pointer",children:[s.jsx($t,{className:"h-3 w-3"})," Add Middleware"]})]}),W.length===0&&s.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 rounded-lg border border-dashed theme-border text-center",children:[s.jsx(La,{className:"h-6 w-6 theme-text-faint",strokeWidth:1.5}),s.jsxs("p",{className:"text-[10px] theme-text-faint italic",children:["No middleware added yet.",s.jsx("br",{}),'Click "Add Middleware" to get started.']})]}),s.jsx("div",{className:"space-y-2",children:W.map((Y,ue)=>s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border theme-border theme-bg-overlay px-3 py-2",children:[s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("button",{type:"button",onClick:()=>Re(ue,-1),disabled:ue===0,className:"theme-text-faint hover:theme-text disabled:opacity-25 hover:cursor-pointer transition-colors leading-none",title:"Move up",children:s.jsx(qa,{className:"h-3 w-3 rotate-180"})}),s.jsx("button",{type:"button",onClick:()=>Re(ue,1),disabled:ue===W.length-1,className:"theme-text-faint hover:theme-text disabled:opacity-25 hover:cursor-pointer transition-colors leading-none",title:"Move down",children:s.jsx(qa,{className:"h-3 w-3"})})]}),s.jsx("span",{className:"text-[10px] theme-text-faint w-4 text-center shrink-0",children:ue+1}),s.jsx("input",{value:Y.name,onChange:re=>ve(ue,re.target.value),placeholder:"e.g. authenticateToken",className:`${be} flex-1 font-mono`}),s.jsx("button",{type:"button",onClick:()=>Ae(ue),className:"theme-text-faint hover:text-red-400 transition-colors hover:cursor-pointer shrink-0",title:"Remove",children:s.jsx(Yt,{className:"h-3.5 w-3.5"})})]},ue))})]})]}),s.jsxs("div",{className:"flex items-center justify-between border-t theme-border px-6 py-4",children:[s.jsxs("p",{className:"text-[10px] theme-text-faint",children:["Only ",s.jsx("span",{className:"theme-text-muted",children:"Method"})," and ",s.jsx("span",{className:"theme-text-muted",children:"Path"})," are required"]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:r,className:"rounded-lg border theme-border px-4 py-2 text-xs font-medium theme-text-muted hover:theme-bg-overlay-md hover:theme-text transition-colors hover:cursor-pointer",children:"Cancel"}),s.jsxs("button",{type:"button",onClick:We,disabled:f,className:"flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-4 py-2 text-xs font-medium text-[color:var(--action-foreground)] hover:bg-[var(--action-hover)] disabled:opacity-50 transition-colors hover:cursor-pointer",children:[f?s.jsx(dt,{className:"h-3.5 w-3.5 animate-spin"}):s.jsx($t,{className:"h-3.5 w-3.5"}),f?"Adding…":"Add Endpoint"]})]})]})]})})}function n4({endpoint:n,onClose:r,onSaved:o}){const[i,u]=j.useState("basic"),[f,h]=j.useState(!1),[g,x]=j.useState(""),[m,p]=j.useState(n.method),[b,v]=j.useState(n.path),[N,C]=j.useState(n.name??""),[k,R]=j.useState(n.description??""),[z,V]=j.useState((n.tags??[]).join(", ")),[q,M]=j.useState(n.deprecated??!1),[H,Z]=j.useState(()=>(n.parameters??[]).filter(B=>B.in!=="body").map(B=>({name:B.name,in:B.in??"query",type:B.type,required:B.required??!1,description:B.description??"",example:B.example?String(B.example):""}))),[X,oe]=j.useState(n.requestBody?.contentType??"application/json"),[I,K]=j.useState(n.requestBody?.required??!1),[ae,te]=j.useState(()=>{const B=n.requestBody?.fields;if(!B||Object.keys(B).length===0)return"";const Y={},ue=[];for(const[re,ee]of Object.entries(B))Y[re]={type:ee.type,...ee.format?{format:ee.format}:{},...ee.description?{description:ee.description}:{}},ee.required&&ue.push(re);return JSON.stringify({type:"object",properties:Y,...ue.length>0?{required:ue}:{}},null,2)}),[se,_]=j.useState(""),[W,E]=j.useState(()=>Object.entries(n.responses??{}).map(([B,Y])=>({status:B,description:Y.description??"",contentType:Y.contentType??"application/json",schema:Y.schema?JSON.stringify(Y.schema,null,2):"",example:""}))),[$,T]=j.useState((n.middleware??[]).map(B=>({name:B.name}))),A=j.useRef(null);j.useEffect(()=>{if(!open)return;const B=Y=>{Y.key==="Escape"&&r()};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[r]);const S=()=>Z(B=>[...B,{name:"",in:"query",type:"string",required:!1,description:"",example:""}]),D=(B,Y)=>Z(ue=>ue.map((re,ee)=>ee===B?{...re,...Y}:re)),L=B=>Z(Y=>Y.filter((ue,re)=>re!==B)),F=()=>E(B=>[...B,{status:"200",description:"",contentType:"application/json",schema:"",example:""}]),ie=(B,Y)=>E(ue=>ue.map((re,ee)=>ee===B?{...re,...Y}:re)),he=B=>E(Y=>Y.filter((ue,re)=>re!==B)),me=()=>T(B=>[...B,{name:""}]),Se=(B,Y)=>T(ue=>ue.map((re,ee)=>ee===B?{name:Y}:re)),ve=B=>T(Y=>Y.filter((ue,re)=>re!==B)),Ae=(B,Y)=>T(ue=>{const re=[...ue],ee=B+Y;return ee<0||ee>=re.length||([re[B],re[ee]]=[re[ee],re[B]]),re}),Re=async()=>{if(!b.trim()){u("basic");return}h(!0),x("");try{const B={id:n.id,method:m.toUpperCase(),path:b.startsWith("/")?b:"/"+b};N.trim()&&(B.name=N.trim()),k.trim()&&(B.description=k.trim()),z.trim()&&(B.tags=z.split(",").map(ee=>ee.trim()).filter(Boolean)),q&&(B.deprecated=!0),n.handlerName&&(B.handlerName=n.handlerName),n.source&&(B.source=n.source),n.security&&(B.security=n.security),B.middleware=$.filter(ee=>ee.name.trim()).map(ee=>({name:ee.name.trim()}));const Y=H.filter(ee=>ee.name.trim());if(Y.length>0&&(B.parameters=Y.map(ee=>({name:ee.name,in:ee.in,schema:{type:ee.type},required:ee.required,...ee.description?{description:ee.description}:{},...ee.example?{example:ee.example}:{}}))),ae.trim()){const ee={};try{ee.schema=JSON.parse(ae)}catch{ee.schema=ae}if(se.trim())try{ee.example=JSON.parse(se)}catch{ee.example=se}B.requestBody={required:I,content:{[X]:ee}}}const ue=W.filter(ee=>ee.status.trim());if(ue.length>0){const ee={};for(const Ee of ue){const ge={};if(Ee.description.trim()&&(ge.description=Ee.description),Ee.schema.trim())try{ge.schema=JSON.parse(Ee.schema)}catch{ge.schema=Ee.schema}ee[Ee.status]=ge}B.responses=ee}const re=await fetch(`/api/model/endpoint/${n.id}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(B)});if(!re.ok){const ee=await re.json().catch(()=>({}));throw new Error(ee.error??`Save failed (${re.status})`)}o({...n,...B})}catch(B){x(B.message)}finally{h(!1)}},We=[{key:"basic",label:"Basic"},{key:"request",label:"Request"},{key:"responses",label:"Responses"},{key:"middleware",label:`Middleware${$.length>0?` (${$.length})`:""}`}],Te="w-full rounded-lg border theme-border theme-bg-overlay px-3 py-2 text-xs theme-text placeholder-[var(--text-faint)] outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md transition-all",be="block text-[10px] theme-text-faint mb-1.5 uppercase tracking-wider font-medium";return s.jsx("div",{ref:A,className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:B=>{B.target===A.current&&r()},children:s.jsxs("div",{className:"relative w-full max-w-2xl max-h-[85vh] flex flex-col rounded-2xl border border-[var(--border-md)] shadow-2xl overflow-hidden theme-bg-surface",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-4 border-b theme-border",children:[s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-amber-500/10",children:s.jsx(ef,{className:"h-4 w-4 text-amber-400"})}),s.jsxs("div",{children:[s.jsx("h2",{className:"text-sm font-medium theme-text-primary",children:"Edit Endpoint"}),s.jsxs("p",{className:"text-[10px] theme-text-faint font-mono",children:[n.method," ",n.path]})]})]}),s.jsx("button",{type:"button",onClick:r,className:"theme-text-faint hover:theme-text transition-colors hover:cursor-pointer",children:s.jsx(Tt,{className:"h-4 w-4"})})]}),s.jsx("div",{className:"flex items-center gap-1 px-6 pt-4 pb-2",children:We.map(B=>s.jsx("button",{type:"button",onClick:()=>u(B.key),className:`rounded-lg px-3 py-1.5 text-[11px] font-medium transition-all duration-200 hover:cursor-pointer ${i===B.key?"bg-amber-500/15 text-amber-400 shadow-sm":"theme-text-faint hover:theme-text-muted hover:theme-bg-overlay"}`,children:B.label},B.key))}),g&&s.jsxs("div",{className:"mx-6 mt-2 flex items-center gap-2 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2 text-xs text-red-400",children:[s.jsx(Ct,{className:"h-3.5 w-3.5 shrink-0"}),g]}),s.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4 space-y-4",children:[i==="basic"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"grid grid-cols-[140px_1fr] gap-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Method *"}),s.jsx("select",{value:m,onChange:B=>p(B.target.value),className:`${Te} hover:cursor-pointer`,children:["GET","POST","PUT","PATCH","DELETE","HEAD","OPTIONS"].map(B=>s.jsx("option",{children:B},B))})]}),s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Path *"}),s.jsx("input",{value:b,onChange:B=>v(B.target.value),placeholder:"/api/users",className:`${Te} font-mono`})]})]}),s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Name"}),s.jsx("input",{value:N,onChange:B=>C(B.target.value),placeholder:"Create User",className:Te})]}),s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Description"}),s.jsx("textarea",{value:k,onChange:B=>R(B.target.value),rows:2,className:`${Te} resize-none`})]}),s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Tags"}),s.jsx("input",{value:z,onChange:B=>V(B.target.value),placeholder:"users, auth, public",className:Te}),s.jsx("p",{className:"text-[10px] theme-text-faint mt-1",children:"Comma-separated"})]}),s.jsxs("label",{className:"flex items-center gap-2 text-[11px] theme-text-muted hover:cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:q,onChange:B=>M(B.target.checked),className:"accent-amber-500"}),"Mark as deprecated"]})]}),i==="request"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("p",{className:be+" mb-0",children:"Parameters"}),s.jsxs("button",{type:"button",onClick:S,className:"flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] font-medium text-amber-400 hover:bg-amber-500/10 transition-colors hover:cursor-pointer",children:[s.jsx($t,{className:"h-3 w-3"})," Add Parameter"]})]}),H.length===0&&s.jsx("p",{className:"text-[10px] theme-text-faint italic",children:"No parameters"}),s.jsx("div",{className:"space-y-2",children:H.map((B,Y)=>s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay p-3 space-y-2",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsx("div",{className:"flex-1",children:s.jsx("input",{value:B.name,onChange:ue=>D(Y,{name:ue.target.value}),placeholder:"name",className:`${Te} font-mono`})}),s.jsx("select",{value:B.in,onChange:ue=>D(Y,{in:ue.target.value}),className:`${Te} w-28 hover:cursor-pointer`,children:["query","path","header","cookie"].map(ue=>s.jsx("option",{children:ue},ue))}),s.jsx("select",{value:B.type,onChange:ue=>D(Y,{type:ue.target.value}),className:`${Te} w-28 hover:cursor-pointer`,children:vy.map(ue=>s.jsx("option",{children:ue},ue))}),s.jsx("button",{type:"button",onClick:()=>L(Y),className:"mt-1.5 theme-text-faint hover:text-red-400 transition-colors hover:cursor-pointer",children:s.jsx(Yt,{className:"h-3.5 w-3.5"})})]}),s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] theme-text-muted hover:cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:B.required,onChange:ue=>D(Y,{required:ue.target.checked}),className:"accent-amber-500"})," Required"]}),s.jsx("input",{value:B.description,onChange:ue=>D(Y,{description:ue.target.value}),placeholder:"Description",className:`${Te} flex-1 text-[10px]`})]})]},Y))})]}),s.jsx("div",{className:"border-t theme-border"}),s.jsxs("div",{children:[s.jsx("p",{className:be,children:"Request Body"}),s.jsxs("div",{className:"space-y-3",children:[s.jsxs("div",{className:"flex items-center gap-3",children:[s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:be,children:"Content Type"}),s.jsx("select",{value:X,onChange:B=>oe(B.target.value),className:`${Te} hover:cursor-pointer`,children:Yi.map(B=>s.jsx("option",{children:B},B))})]}),s.jsxs("label",{className:"flex items-center gap-1.5 text-[10px] theme-text-muted mt-5 hover:cursor-pointer select-none",children:[s.jsx("input",{type:"checkbox",checked:I,onChange:B=>K(B.target.checked),className:"accent-amber-500"})," Required"]})]}),s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Schema (JSON)"}),s.jsx("textarea",{value:ae,onChange:B=>te(B.target.value),rows:5,className:`${Te} resize-none font-mono text-[11px] leading-relaxed`})]}),s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Example"}),s.jsx("textarea",{value:se,onChange:B=>_(B.target.value),rows:3,className:`${Te} resize-none font-mono text-[11px] leading-relaxed`})]})]})]})]}),i==="responses"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsx("p",{className:be+" mb-0",children:"Responses"}),s.jsxs("button",{type:"button",onClick:F,className:"flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] font-medium text-amber-400 hover:bg-amber-500/10 transition-colors hover:cursor-pointer",children:[s.jsx($t,{className:"h-3 w-3"})," Add Response"]})]}),W.length===0&&s.jsx("p",{className:"text-[10px] theme-text-faint italic",children:"No responses defined."}),s.jsx("div",{className:"space-y-3",children:W.map((B,Y)=>s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay p-3 space-y-3",children:[s.jsxs("div",{className:"flex items-start gap-2",children:[s.jsxs("div",{className:"w-24",children:[s.jsx("label",{className:be,children:"Status"}),s.jsx("input",{value:B.status,onChange:ue=>ie(Y,{status:ue.target.value}),placeholder:"200",className:`${Te} font-mono`})]}),s.jsxs("div",{className:"flex-1",children:[s.jsx("label",{className:be,children:"Description"}),s.jsx("input",{value:B.description,onChange:ue=>ie(Y,{description:ue.target.value}),placeholder:"Success",className:Te})]}),s.jsxs("div",{className:"w-48",children:[s.jsx("label",{className:be,children:"Content Type"}),s.jsx("select",{value:B.contentType,onChange:ue=>ie(Y,{contentType:ue.target.value}),className:`${Te} hover:cursor-pointer`,children:Yi.map(ue=>s.jsx("option",{children:ue},ue))})]}),s.jsx("button",{type:"button",onClick:()=>he(Y),className:"mt-5 theme-text-faint hover:text-red-400 transition-colors hover:cursor-pointer",children:s.jsx(Yt,{className:"h-3.5 w-3.5"})})]}),s.jsxs("div",{children:[s.jsx("label",{className:be,children:"Body Schema (JSON)"}),s.jsx("textarea",{value:B.schema,onChange:ue=>ie(Y,{schema:ue.target.value}),rows:3,className:`${Te} resize-none font-mono text-[11px] leading-relaxed`})]})]},Y))})]}),i==="middleware"&&s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"flex items-center justify-between mb-2",children:[s.jsxs("div",{children:[s.jsx("p",{className:be+" mb-0",children:"Middleware Chain"}),s.jsx("p",{className:"text-[10px] theme-text-faint mt-0.5",children:"Executed in order, top → bottom"})]}),s.jsxs("button",{type:"button",onClick:me,className:"flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] font-medium text-amber-400 hover:bg-amber-500/10 transition-colors hover:cursor-pointer",children:[s.jsx($t,{className:"h-3 w-3"})," Add Middleware"]})]}),$.length===0&&s.jsxs("div",{className:"flex flex-col items-center gap-2 py-8 rounded-lg border border-dashed theme-border text-center",children:[s.jsx(La,{className:"h-6 w-6 theme-text-faint",strokeWidth:1.5}),s.jsx("p",{className:"text-[10px] theme-text-faint italic",children:'No middleware. Click "Add Middleware" to get started.'})]}),s.jsx("div",{className:"space-y-2",children:$.map((B,Y)=>s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border theme-border theme-bg-overlay px-3 py-2",children:[s.jsxs("div",{className:"flex flex-col gap-0.5",children:[s.jsx("button",{type:"button",onClick:()=>Ae(Y,-1),disabled:Y===0,className:"theme-text-faint hover:theme-text disabled:opacity-25 hover:cursor-pointer transition-colors leading-none",title:"Move up",children:s.jsx(qa,{className:"h-3 w-3 rotate-180"})}),s.jsx("button",{type:"button",onClick:()=>Ae(Y,1),disabled:Y===$.length-1,className:"theme-text-faint hover:theme-text disabled:opacity-25 hover:cursor-pointer transition-colors leading-none",title:"Move down",children:s.jsx(qa,{className:"h-3 w-3"})})]}),s.jsx("span",{className:"text-[10px] theme-text-faint w-4 text-center shrink-0",children:Y+1}),s.jsx("input",{value:B.name,onChange:ue=>Se(Y,ue.target.value),placeholder:"e.g. authenticateToken",className:`${Te} flex-1 font-mono`}),s.jsx("button",{type:"button",onClick:()=>ve(Y),className:"theme-text-faint hover:text-red-400 transition-colors hover:cursor-pointer shrink-0",title:"Remove",children:s.jsx(Yt,{className:"h-3.5 w-3.5"})})]},Y))})]})]}),s.jsxs("div",{className:"flex items-center justify-between border-t theme-border px-6 py-4",children:[s.jsxs("p",{className:"text-[10px] theme-text-faint",children:["ID: ",s.jsx("span",{className:"font-mono",children:n.id})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{type:"button",onClick:r,className:"rounded-lg border theme-border px-4 py-2 text-xs font-medium theme-text-muted hover:theme-bg-overlay-md hover:theme-text transition-colors hover:cursor-pointer",children:"Cancel"}),s.jsxs("button",{type:"button",onClick:Re,disabled:f,className:"flex items-center gap-1.5 rounded-lg bg-amber-500 px-4 py-2 text-xs font-medium theme-text-primary hover:bg-amber-400 disabled:opacity-50 transition-colors hover:cursor-pointer",children:[f?s.jsx(dt,{className:"h-3.5 w-3.5 animate-spin"}):s.jsx(ut,{className:"h-3.5 w-3.5"}),f?"Saving…":"Save Changes"]})]})]})]})})}function a4({onInspect:n,onViewTraces:r}){const[o,i]=j.useState(null),[u,f]=j.useState(!0),[h,g]=j.useState(!1),[x,m]=j.useState(!1),[p,b]=j.useState(null),[v,N]=j.useState(""),[C,k]=j.useState("list"),[R,z]=j.useState(""),[V,q]=j.useState(!1),[M,H]=j.useState(null),Z=j.useCallback(async(te=!1)=>{te?g(!0):f(!0),b(null);try{i(await Z3())}catch(se){b(se.message)}finally{f(!1),g(!1)}},[]);j.useEffect(()=>{Z()},[Z]);const X=async()=>{m(!0),N("");try{i(await W3())}catch(te){N(te.message)}finally{m(!1)}},oe=(te,se)=>{i(_=>_&&{..._,endpoints:_.endpoints.map(W=>W.id===te?{...W,...se}:W)})},I=(te,se)=>{i(se)},K=(o?.endpoints??[]).filter(te=>!R||te.path.toLowerCase().includes(R.toLowerCase())||te.method.toLowerCase().includes(R.toLowerCase())||(te.handlerName??"").toLowerCase().includes(R.toLowerCase())),ae=new Map;for(const te of K){const se="/"+(te.path.split("/")[1]??"");ae.has(se)||ae.set(se,[]),ae.get(se).push(te)}return s.jsxs("div",{className:"flex min-h-full w-full flex-col",children:[s.jsxs("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:[s.jsx("div",{className:"flex items-center gap-3",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium theme-text-primary leading-none",children:o?.project?.name??"Model"}),s.jsx("p",{className:"mt-0.5 text-[11px] theme-text-muted",children:u?"Loading…":o?`v${o.version} · ${o.endpoints.length} endpoints · ${o.project.framework??o.project.language??""}`:"No model generated yet"})]})}),s.jsxs("div",{className:"flex items-center gap-2",children:[o&&s.jsx("div",{className:"flex items-center gap-1 rounded-xl border theme-border theme-bg-overlay p-1",children:["list","graph"].map(te=>s.jsxs("button",{type:"button",onClick:()=>k(te),className:`flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[11px] font-medium transition-all duration-200 hover:cursor-pointer ${C===te?"bg-[color:var(--brand)]/15 text-[color:var(--brand)] shadow-sm":"theme-text-faint hover:theme-text-muted"}`,children:[te==="list"?s.jsx(R0,{className:"h-3.5 w-3.5",strokeWidth:2}):s.jsx(Pd,{className:"h-3.5 w-3.5",strokeWidth:2}),te.charAt(0).toUpperCase()+te.slice(1)]},te))}),s.jsx("button",{type:"button",onClick:()=>Z(!0),disabled:h||u,className:"flex h-8 w-8 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-muted hover:theme-bg-overlay-md hover:theme-text disabled:opacity-40 transition-all hover:cursor-pointer",children:s.jsx(na,{className:`h-3.5 w-3.5 ${h?"animate-spin":""}`,strokeWidth:2})}),s.jsxs("button",{type:"button",onClick:X,disabled:x,className:"flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-3 py-1.5 text-sm font-medium text-[color:var(--action-foreground)] hover:bg-[var(--action-hover)] disabled:opacity-50 transition-colors hover:cursor-pointer",children:[x?s.jsx(dt,{className:"h-3.5 w-3.5 animate-spin",strokeWidth:2}):s.jsx(Ri,{className:"h-3.5 w-3.5",strokeWidth:2}),x?"Scanning…":"Re-scan"]}),s.jsxs("button",{type:"button",onClick:()=>q(!0),className:"flex items-center gap-1.5 rounded-lg bg-emerald-500 px-3 py-1.5 text-sm font-medium theme-text-primary hover:bg-emerald-400 transition-colors hover:cursor-pointer",children:[s.jsx($t,{className:"h-3.5 w-3.5",strokeWidth:2}),"Add Endpoint"]})]})]}),v&&s.jsxs("div",{className:"flex items-center gap-2 border-b border-red-500/20 bg-red-500/[0.06] px-6 py-2 text-xs text-red-400",children:[s.jsx(Ct,{className:"h-3.5 w-3.5 shrink-0",strokeWidth:2}),v,s.jsx("button",{type:"button",onClick:()=>N(""),className:"ml-auto hover:cursor-pointer",children:s.jsx(Tt,{className:"h-3.5 w-3.5",strokeWidth:2})})]}),s.jsxs("div",{className:"flex flex-1 flex-col",children:[u&&s.jsx("div",{className:"space-y-2 p-6",children:[1,2,3,4].map(te=>s.jsx("div",{className:"h-10 animate-pulse rounded-lg border theme-border theme-bg-overlay",style:{opacity:1-te*.18}},te))}),!u&&p&&s.jsxs("div",{className:"flex flex-col items-center gap-4 m-6 rounded-lg border border-red-500/20 bg-red-500/[0.06] p-10 text-center",children:[s.jsx(Ct,{className:"h-8 w-8 text-red-400",strokeWidth:2}),s.jsx("p",{className:"text-sm text-red-300",children:p}),s.jsx("button",{type:"button",onClick:()=>Z(),className:"rounded-lg border border-red-500/20 bg-red-500/10 px-4 py-1.5 text-xs text-red-400 hover:bg-red-500/20 transition-colors hover:cursor-pointer",children:"Retry"})]}),!u&&!p&&!o&&s.jsx(e4,{onScan:X,scanning:x,error:v}),!u&&!p&&o&&C==="graph"&&s.jsx("div",{className:"flex-1 overflow-auto p-6",children:s.jsx(P3,{endpoints:K})}),!u&&!p&&o&&C==="list"&&s.jsxs("div",{className:"flex flex-1 flex-col",children:[s.jsxs("div",{className:"flex items-center gap-3 border-b theme-border px-6 py-3",children:[s.jsx("input",{value:R,onChange:te=>z(te.target.value),placeholder:"Filter by path, method or handler…",className:"w-full max-w-sm rounded-lg border theme-border theme-bg-overlay py-1.5 px-3 text-xs theme-text placeholder-[var(--text-faint)] outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md transition-all"}),R&&s.jsx("button",{type:"button",onClick:()=>z(""),className:"theme-text-faint hover:theme-text hover:cursor-pointer",children:s.jsx(Tt,{className:"h-3.5 w-3.5",strokeWidth:2})}),s.jsxs("span",{className:"ml-auto text-[10px] theme-text-faint",children:[K.length," endpoint",K.length!==1?"s":""]})]}),s.jsxs("div",{className:"flex-1 overflow-y-auto max-h-[calc(100vh-170px)] divide-y divide-[var(--border)]",children:[Array.from(ae.entries()).map(([te,se])=>s.jsx(F3,{prefix:te,endpoints:se,onUpdate:oe,onInspect:_=>n?.(_),onViewTraces:r?_=>r({endpointPath:_}):void 0,onEdit:_=>H(_)},te)),K.length===0&&s.jsxs("div",{className:"flex flex-col items-center gap-2 py-12 text-center",children:[s.jsxs("p",{className:"text-sm theme-text-muted",children:['No endpoints match "',R,'"']}),s.jsx("button",{type:"button",onClick:()=>z(""),className:"text-xs text-[color:var(--brand)] hover:text-[color:var(--brand)] transition-colors hover:cursor-pointer",children:"Clear filter"})]})]}),s.jsxs("div",{className:"flex items-center gap-1.5 border-t theme-border px-6 py-2.5 text-[10px] theme-text-faint",children:["Generated ",new Date(o.generatedAt).toLocaleString(),s.jsx("span",{className:"ml-auto",children:s.jsx("button",{type:"button",onClick:()=>Z(!0),className:"theme-text-faint hover:theme-text transition-colors hover:cursor-pointer",children:"Refresh"})})]})]})]}),s.jsx(t4,{open:V,onClose:()=>q(!1),onCreated:I}),M&&s.jsx(n4,{endpoint:M,onClose:()=>H(null),onSaved:te=>{i(se=>se&&{...se,endpoints:se.endpoints.map(_=>_.id===te.id?te:_)}),H(null)}})]})}const g0={GET:{bg:"bg-emerald-500/10",text:"text-emerald-400",border:"border-emerald-500/30"},POST:{bg:"bg-[color:var(--brand)]/10",text:"text-[color:var(--brand)]",border:"border-[color:var(--brand)]/30"},PUT:{bg:"bg-amber-500/10",text:"text-amber-400",border:"border-amber-500/30"},PATCH:{bg:"bg-orange-500/10",text:"text-orange-400",border:"border-orange-500/30"},DELETE:{bg:"bg-red-500/10",text:"text-red-400",border:"border-red-500/30"},HEAD:{bg:"theme-bg-overlay-md",text:"theme-text-muted",border:"theme-border"},OPTIONS:{bg:"bg-[color:var(--brand)]/10",text:"text-[color:var(--brand)]",border:"border-[color:var(--brand)]/30"}};function s4(n){return g0[n.toUpperCase()]??g0.GET}function Jd({method:n,size:r="md"}){const o=s4(n);return s.jsx("span",{className:`inline-flex items-center rounded font-medium tracking-widest border ${o.bg} ${o.text} ${o.border} ${r==="sm"?"px-1.5 py-0.5 text-[10px]":"px-2 py-0.5 text-[11px]"}`,children:n.toUpperCase()})}function y0(n,r,o){const i=n.toLowerCase();return i.includes("email")?"user@example.com":i.includes("name")?"Jane Doe":i.includes("username")?"jane_doe":i.includes("password")?"P@ssw0rd123!":i.includes("phone")?"+14155552671":i.includes("url")?"https://example.com":i.includes("id")?Math.random().toString(36).slice(2,10):i.includes("date")||o==="date"?new Date().toISOString().split("T")[0]:i.includes("time")||o==="date-time"?new Date().toISOString():r==="integer"||r==="number"?String(Math.floor(Math.random()*100)+1):r==="boolean"?"true":r==="array"?"[]":r==="object"?"{}":`fake_${i}`}function ul({children:n,className:r=""}){return s.jsx("div",{className:`rounded-lg border theme-border theme-bg-overlay overflow-hidden ${r}`,children:n})}function Rr({icon:n,label:r,count:o,action:i}){return s.jsxs("div",{className:"flex items-center gap-2.5 border-b theme-border px-4 py-2.5 theme-bg-overlay-md",children:[s.jsx(n,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2}),s.jsx("span",{className:"text-[11px] font-semibold tracking-wider theme-text-faint uppercase",children:r}),o!==void 0&&s.jsx("span",{className:"rounded-full border theme-border theme-bg-overlay px-2 py-0.5 text-[10px] theme-text-muted",children:o}),i&&s.jsx("div",{className:"ml-auto",children:i})]})}function l4({endpoint:n}){const[r,o]=j.useState(null),[i,u]=j.useState(1),[f,h]=j.useState(!1),[g,x]=j.useState(""),m=j.useCallback(async()=>{if(n.source){h(!0),x(""),o(null);try{const N=await fetch(`/api/model/source?file=${encodeURIComponent(n.source.file)}&line=${n.source.line}`);if(!N.ok){if((N.headers.get("content-type")??"").includes("application/json")){const R=await N.json().catch(()=>({}));throw new Error(R.error??`HTTP ${N.status}`)}throw new Error(`HTTP ${N.status}`)}if((N.headers.get("content-type")??"").includes("application/json")){const k=await N.json();o(k.source??k.content??""),u(k.startLine??1)}else o(await N.text()),u(1)}catch(N){x(N.message)}finally{h(!1)}}},[n]);if(j.useEffect(()=>{m()},[m]),!n.source)return null;const p=n.source.file.split(/[/\\]/).slice(-3).join("/"),b=r?r.split(`
430
+ `):[],v=n.source.line-i;return s.jsxs(ul,{children:[s.jsxs("div",{className:"flex items-center gap-2.5 border-b theme-border px-4 py-2.5 theme-bg-overlay-md",children:[s.jsx(Id,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2}),s.jsx("span",{className:"text-[11px] font-semibold tracking-wider theme-text-faint uppercase",children:"Source"}),s.jsx("span",{className:"ml-2 font-mono text-[11px] theme-text-muted truncate",children:p}),s.jsxs("span",{className:"rounded border theme-border theme-bg-overlay px-1.5 py-0.5 font-mono text-[10px] theme-text",children:[":",n.source.line]}),s.jsx("button",{type:"button",onClick:m,disabled:f,className:"ml-auto flex h-6 w-6 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-muted hover:theme-bg-overlay-md hover:theme-text transition-colors hover:cursor-pointer",children:s.jsx(na,{className:`h-3 w-3 ${f?"animate-spin":""}`,strokeWidth:2})})]}),s.jsxs("div",{className:"relative bg-[var(--sidebar-bg)]",children:[f&&s.jsxs("div",{className:"flex items-center gap-2 px-4 py-4 text-[11px] theme-text-muted",children:[s.jsx(dt,{className:"h-3.5 w-3.5 animate-spin",strokeWidth:2})," Loading source…"]}),g&&s.jsxs("div",{className:"flex items-start gap-2 px-4 py-3 text-[11px] text-red-400",children:[s.jsx(Ct,{className:"h-3.5 w-3.5 mt-0.5 shrink-0",strokeWidth:2}),s.jsxs("span",{children:["Source unavailable — ",g]})]}),r&&!f&&s.jsx("div",{className:"overflow-auto max-h-[340px]",children:s.jsx("table",{className:"w-full border-collapse",children:s.jsx("tbody",{children:b.map((N,C)=>{const k=i+C,R=C===v;return s.jsxs("tr",{className:R?"bg-[color:var(--brand)]/[0.08]":"hover:theme-bg-overlay-md",children:[s.jsx("td",{className:`select-none w-12 px-3 py-0 text-right font-mono text-[10px] border-r theme-border leading-5 ${R?"text-[color:var(--brand)]":"theme-text-faint"}`,children:k}),s.jsx("td",{className:`px-4 py-0 font-mono text-[11px] whitespace-pre leading-5 ${R?"theme-text-primary":"theme-text-muted"}`,children:N||" "})]},C)})})})})]})]})}function r4({endpoint:n}){const[r,o]=j.useState([]),[i,u]=j.useState(!0),[f,h]=j.useState("");j.useEffect(()=>{u(!0),h(""),o([]),fetch(`/api/model/related?id=${encodeURIComponent(n.id)}`).then(x=>{const m=x.headers.get("content-type")??"";if(!x.ok||!m.includes("application/json"))throw new Error(`HTTP ${x.status}`);return x.json()}).then(x=>o(x?.files??[])).catch(x=>h(x.message)).finally(()=>u(!1))},[n.id]);const g={ts:"text-[color:var(--brand)]",tsx:"text-[color:var(--brand)]",js:"text-amber-400",jsx:"text-amber-300",json:"text-emerald-400"};return s.jsxs(ul,{children:[s.jsx(Rr,{icon:Fd,label:"Related Files",count:!i&&!f?r.length:void 0}),s.jsxs("div",{className:"divide-y divide-[var(--border)]",children:[i&&s.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 text-[11px] theme-text-muted",children:[s.jsx(dt,{className:"h-3.5 w-3.5 animate-spin",strokeWidth:2})," Resolving files…"]}),!i&&f&&s.jsxs("div",{className:"flex items-start gap-2 px-4 py-3 text-[11px] text-red-400",children:[s.jsx(Ct,{className:"h-3.5 w-3.5 mt-0.5 shrink-0",strokeWidth:2}),s.jsxs("span",{children:["Could not resolve — ",f]})]}),!i&&!f&&r.length===0&&s.jsx("p",{className:"px-4 py-4 text-[12px] theme-text-faint italic",children:"No related files resolved"}),r.map(x=>{const m=x.split(/[/\\]/),p=m.pop()??x,b=m.slice(-2).join("/"),v=p.split(".").pop()??"",N=g[v]??"theme-text-faint";return s.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 hover:theme-bg-overlay-md transition-colors",children:[s.jsx(Vi,{className:`h-[15px] w-[15px] shrink-0 ${N}`,strokeWidth:2}),s.jsxs("div",{className:"min-w-0 flex-1",children:[s.jsx("p",{className:"text-[13px] theme-text truncate",children:p}),b&&s.jsx("p",{className:"text-[10px] theme-text-faint truncate font-mono",children:b})]}),s.jsxs("span",{className:`shrink-0 rounded border theme-border theme-bg-overlay-md px-1.5 py-0.5 text-[10px] font-mono ${N}`,children:[".",v]})]},x)})]})]})}function b0({endpoint:n}){const[r,o]=j.useState("fake"),[i,u]=j.useState(""),[f,h]=j.useState({}),[g,x]=j.useState(!1),[m,p]=j.useState(null),[b,v]=j.useState("http://localhost:3000"),[N,C]=j.useState([]),[k,R]=j.useState(null),[z,V]=j.useState(!1);j.useEffect(()=>{fetch("/api/model/environments").then(K=>K.ok?K.json():null).then(K=>{if(!K)return;C(K.environments??[]);const ae=K.defaultEnvironment??K.environments?.find(se=>se.default)?.name??K.environments?.[0]?.name??null;R(ae);const te=(K.environments??[]).find(se=>se.name===ae);te&&v(te.baseUrl)}).catch(()=>{}).finally(()=>V(!0))},[]);const q=n.requestBody?.fields??{},M=(n.security?.length??0)>0,H=["POST","PUT","PATCH"].includes(n.method.toUpperCase());j.useEffect(()=>{p(null),h({})},[n.id]);const Z=()=>{const K={};for(const[ae,te]of Object.entries(q))K[ae]=y0(ae,te.type,te.format);return K},X=()=>{const K={};for(const[ae,te]of Object.entries(q)){const se=f[ae]??"";se&&(te.type==="integer"||te.type==="number"?K[ae]=Number(se):te.type==="boolean"?K[ae]=se.toLowerCase()==="true":K[ae]=se)}return K},oe=async()=>{x(!0),p(null);const K=Date.now();try{const ae=r==="fake"?Z():X(),te={};(H||r==="fake")&&(te["Content-Type"]="application/json"),i&&(te.Authorization=`Bearer ${i}`);const se=`${b}${n.path}`,_=await fetch(se,{method:n.method.toUpperCase(),headers:te,body:H?JSON.stringify(ae):void 0}),W=Date.now()-K;let E;try{E=await _.json()}catch{E=await _.text().catch(()=>"(no body)")}p({status:_.status,body:E,durationMs:W})}catch(ae){p({status:0,body:null,durationMs:Date.now()-K,error:ae.message})}finally{x(!1)}},I=m&&m.status>=200&&m.status<300;return s.jsxs("div",{className:"flex flex-col gap-4",children:[s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border theme-border theme-bg-overlay px-3 py-2",children:[s.jsx(Jd,{method:n.method,size:"sm"}),s.jsx("code",{className:"font-mono text-[12px] theme-text truncate",children:n.path})]}),s.jsx("p",{className:"hidden",children:z}),s.jsxs("div",{className:"flex items-center gap-2 rounded-xl border theme-border theme-bg-overlay p-1",children:[s.jsxs("button",{type:"button",onClick:()=>o("fake"),className:`flex flex-1 items-center justify-center gap-1.5 rounded-lg py-1.5 text-[11px] font-medium transition-all duration-200 hover:cursor-pointer ${r==="fake"?"bg-[color:var(--brand)]/15 text-[color:var(--brand)] shadow-sm":"theme-text-faint hover:theme-text-muted"}`,children:[s.jsx(hs,{className:"h-3 w-3 shrink-0",strokeWidth:2}),"Fake Data"]}),s.jsxs("button",{type:"button",onClick:()=>o("real"),className:`flex flex-1 items-center justify-center gap-1.5 rounded-lg py-1.5 text-[11px] font-medium transition-all duration-200 hover:cursor-pointer ${r==="real"?"bg-[color:var(--brand)]/15 text-[color:var(--brand)] shadow-sm":"theme-text-faint hover:theme-text-muted"}`,children:[s.jsx(Rd,{className:"h-3 w-3 shrink-0",strokeWidth:2}),"Real Data"]})]}),s.jsxs("div",{className:"space-y-1.5",children:[s.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint",children:"Base URL"}),N.length>0?s.jsx("div",{className:"rounded-lg border theme-border theme-bg-overlay overflow-hidden",children:N.map(K=>{const ae=k===K.name;return s.jsxs("button",{type:"button",onClick:()=>{R(K.name),v(K.baseUrl)},className:`group flex w-full items-center gap-2.5 px-3 py-2 text-left transition-colors hover:cursor-pointer border-t theme-border ${ae?"bg-[color:var(--brand)]/10":"hover:theme-bg-overlay-md"}`,children:[s.jsx("div",{className:`flex h-4 w-4 shrink-0 items-center justify-center rounded-full border-2 transition-colors ${ae?"border-[color:var(--brand)] bg-[color:var(--brand)]/20":"theme-border bg-transparent"}`,children:ae&&s.jsx(ut,{className:"h-2.5 w-2.5 text-[color:var(--brand)]",strokeWidth:3})}),s.jsx(jl,{className:`h-3 w-3 shrink-0 ${ae?"text-[color:var(--brand)]":"theme-text-faint"}`,strokeWidth:2}),s.jsx("span",{className:`text-[11px] w-14 shrink-0 font-medium ${ae?"text-[color:var(--brand)]":"theme-text-muted"}`,children:K.name}),s.jsx("span",{className:"font-mono text-[11px] theme-text-faint truncate",children:K.baseUrl})]},K.name)})}):s.jsx("input",{value:b,onChange:K=>v(K.target.value),className:"w-full rounded-lg border theme-border theme-bg-overlay px-3 py-1.5 font-mono text-[12px] theme-text-primary outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md placeholder-[var(--text-faint)] transition-colors",placeholder:"http://localhost:3000"})]}),(M||r==="real")&&s.jsxs("label",{className:"flex flex-col gap-1.5",children:[s.jsxs("span",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint flex items-center gap-1",children:[s.jsx(M0,{className:"h-3 w-3",strokeWidth:2})," Bearer Token"]}),s.jsx("input",{type:"password",value:i,onChange:K=>u(K.target.value),className:"w-full rounded-lg border border-amber-500/25 bg-amber-500/[0.04] px-3 py-1.5 font-mono text-[12px] theme-text-primary outline-none focus:border-amber-400/50 focus:bg-amber-500/[0.07] placeholder-[var(--text-faint)] transition-colors",placeholder:"Optional"})]}),r==="fake"&&Object.keys(q).length>0&&s.jsxs("div",{children:[s.jsxs("p",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider theme-text-faint flex items-center gap-1.5",children:[s.jsx(hs,{className:"h-3 w-3 text-[color:var(--brand)]",strokeWidth:2})," Auto-generated body"]}),s.jsx("div",{className:"space-y-1",children:Object.entries(q).map(([K,ae])=>s.jsxs("div",{className:"flex items-center gap-2 rounded-lg border theme-border theme-bg-overlay px-3 py-2",children:[s.jsx("span",{className:"text-[11px] theme-text w-20 truncate shrink-0",children:K}),s.jsx("span",{className:"text-[11px] theme-text-faint shrink-0",children:ae.type}),s.jsx("span",{className:"ml-auto font-mono text-[11px] text-[color:var(--brand)]/80 truncate",children:y0(K,ae.type,ae.format)})]},K))})]}),r==="real"&&Object.keys(q).length>0&&s.jsxs("div",{children:[s.jsxs("p",{className:"mb-2 text-[10px] font-semibold uppercase tracking-wider theme-text-faint flex items-center gap-1.5",children:[s.jsx(Rd,{className:"h-3 w-3 text-[color:var(--brand)]",strokeWidth:2})," Request body"]}),s.jsx("div",{className:"space-y-2",children:Object.entries(q).map(([K,ae])=>s.jsxs("label",{className:"flex flex-col gap-1",children:[s.jsxs("span",{className:"text-[11px] theme-text",children:[K,ae.required&&s.jsx("span",{className:"ml-1 text-[10px] text-rose-400",children:"*"})]}),s.jsx("input",{value:f[K]??"",onChange:te=>h(se=>({...se,[K]:te.target.value})),placeholder:`${ae.type}${ae.format?` (${ae.format})`:""}`,className:"rounded-lg border theme-border theme-bg-overlay px-3 py-1.5 font-mono text-[12px] theme-text-primary outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md placeholder-[var(--text-faint)] transition-colors"})]},K))})]}),r==="real"&&Object.keys(q).length===0&&!H&&s.jsxs("p",{className:"text-[12px] theme-text-faint italic",children:["No body required for ",n.method.toUpperCase()," requests."]}),s.jsxs("button",{type:"button",onClick:oe,disabled:g,className:"flex w-full items-center justify-center gap-2 rounded-lg border theme-border bg-[var(--action)] py-2 text-[12px] font-medium text-[color:var(--action-foreground)] hover:bg-[var(--action-hover)] disabled:opacity-50 transition-colors hover:cursor-pointer",children:[g?s.jsx(dt,{className:"h-[15px] w-[15px] animate-spin",strokeWidth:2}):s.jsx(Ad,{className:"h-[15px] w-[15px]",strokeWidth:2}),g?"Sending…":`Run ${r==="fake"?"with Fake Data":"with Real Data"}`]}),m&&s.jsxs("div",{className:`rounded-lg border overflow-hidden ${I?"border-emerald-500/25 bg-emerald-500/[0.05]":"border-red-500/25 bg-red-500/[0.05]"}`,children:[s.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b theme-border",children:[I?s.jsx(ut,{className:"h-[15px] w-[15px] text-emerald-400",strokeWidth:2}):s.jsx(Ct,{className:"h-[15px] w-[15px] text-red-400",strokeWidth:2}),s.jsx("span",{className:`text-[12px] font-medium ${I?"text-emerald-400":"text-red-400"}`,children:m.status>0?m.status:"Error"}),s.jsxs("span",{className:"text-[11px] theme-text-faint",children:[m.durationMs,"ms"]}),s.jsx("button",{type:"button",onClick:()=>p(null),className:"ml-auto flex h-6 w-6 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-faint hover:theme-text transition-colors hover:cursor-pointer",children:s.jsx(Tt,{className:"h-3 w-3",strokeWidth:2})})]}),m.error&&s.jsx("p",{className:"px-3 py-2.5 text-[12px] text-red-400",children:m.error}),!m.error&&m.body!=null&&s.jsx("pre",{className:"overflow-auto max-h-72 p-3 text-[11px] theme-text-muted whitespace-pre-wrap break-all leading-5",children:typeof m.body=="string"?m.body:JSON.stringify(m.body,null,2)})]})]})}const o4=({endpoint:n,onBack:r})=>{if(!n)return s.jsxs("div",{className:"flex min-h-full w-full flex-col items-center justify-center gap-5 text-center p-12",children:[s.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[s.jsx("div",{className:"absolute inset-0 rounded-full bg-[color:var(--brand)]/10 blur-xl"}),s.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-lg border theme-border theme-bg-overlay text-[color:var(--brand)]",children:s.jsx(Id,{className:"h-7 w-7",strokeWidth:2})})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[13.5px] font-medium theme-text-primary",children:"No endpoint selected"}),s.jsxs("p",{className:"mt-1 text-[12px] theme-text-muted",children:["Click ",s.jsx("span",{className:"text-[color:var(--brand)] font-medium",children:"INSPECT"})," on any endpoint in the Model view."]})]}),s.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-1.5 rounded-lg border theme-border theme-bg-overlay px-4 py-2 text-[12px] theme-text-muted hover:theme-bg-overlay-md hover:theme-text transition-colors hover:cursor-pointer",children:[s.jsx(fx,{className:"h-[15px] w-[15px]",strokeWidth:2})," Back to Model"]})]});const o=n.requestBody?.fields??{},i=n.responses??{},u=Object.keys(o).length>0,f=Object.keys(i).length>0,h=(n.security?.length??0)>0,g=(n.middleware?.length??0)>0,x=n.source?n.source.file.split(/[/\\]/).slice(-3).join("/")+":"+n.source.line:null;return s.jsxs("div",{className:"flex min-h-full w-full",children:[s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsxs("div",{className:"flex items-center gap-4 border-b theme-border px-6 py-5",children:[s.jsx("button",{type:"button",onClick:r,className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-muted hover:theme-bg-overlay-md hover:theme-text transition-colors hover:cursor-pointer",children:s.jsx(fx,{className:"h-[15px] w-[15px]",strokeWidth:2})}),s.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[s.jsx(Jd,{method:n.method}),s.jsxs("div",{className:"min-w-0",children:[s.jsx("h1",{className:"text-[13.5px] font-medium theme-text-primary leading-none truncate",children:n.path}),n.handlerName&&s.jsx("p",{className:"mt-0.5 text-[11px] theme-text-muted truncate",children:n.handlerName})]})]}),s.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[h&&s.jsxs("span",{className:"flex items-center gap-1.5 rounded-lg border border-amber-500/25 bg-amber-500/[0.07] px-2.5 py-1 text-[11px] text-amber-400",children:[s.jsx(La,{className:"h-[15px] w-[15px]",strokeWidth:2}),n.security[0].scheme]}),x&&s.jsx("span",{className:"hidden sm:block font-mono text-[11px] theme-text-faint truncate max-w-[200px]",children:x})]})]}),s.jsxs("div",{className:"flex-1 overflow-auto p-6 space-y-4",children:[s.jsxs(ul,{children:[s.jsx(Rr,{icon:Fd,label:"Details"}),s.jsxs("div",{className:"p-4 grid grid-cols-2 sm:grid-cols-3 gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint mb-1.5",children:"Method"}),s.jsx(Jd,{method:n.method})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint mb-1.5",children:"Path"}),s.jsx("code",{className:"font-mono text-[12px] theme-text",children:n.path})]}),n.handlerName&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint mb-1.5",children:"Handler"}),s.jsx("code",{className:"font-mono text-[12px] theme-text-muted",children:n.handlerName})]}),n.source&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint mb-1.5",children:"Source"}),s.jsx("code",{className:"font-mono text-[11px] theme-text-faint",children:x})]}),n.requestBody?.contentType&&s.jsxs("div",{children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint mb-1.5",children:"Content-Type"}),s.jsx("code",{className:"font-mono text-[11px] theme-text-faint",children:n.requestBody.contentType})]}),g&&s.jsxs("div",{className:"col-span-2 sm:col-span-3",children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint mb-1.5",children:"Middleware"}),s.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.middleware.map((m,p)=>s.jsx("span",{className:"rounded-lg border theme-border theme-bg-overlay-md px-2.5 py-0.5 text-[11px] theme-text",children:m.name},p))})]})]})]}),u&&s.jsxs(ul,{children:[s.jsx(Rr,{icon:Rd,label:"Request Body",count:Object.keys(o).length}),s.jsxs("div",{className:"p-4 space-y-1.5",children:[s.jsxs("div",{className:"flex items-center gap-4 px-3 py-1.5 text-[10px] font-semibold uppercase tracking-wider theme-text-faint",children:[s.jsx("span",{className:"w-28",children:"Field"}),s.jsx("span",{className:"w-16",children:"Type"}),s.jsx("span",{children:"Format"}),s.jsx("span",{className:"ml-auto",children:"Required"})]}),Object.entries(o).map(([m,p])=>s.jsxs("div",{className:"flex items-center gap-4 rounded-lg border theme-border theme-bg-overlay px-3 py-2 hover:theme-bg-overlay-md transition-colors",children:[s.jsx("span",{className:"w-28 shrink-0 font-mono text-[12px] theme-text-primary truncate",children:m}),s.jsx("span",{className:"w-16 shrink-0 text-[11px] text-[color:var(--brand)]",children:p.type}),s.jsx("span",{className:"flex-1 text-[11px] theme-text-faint",children:p.format??"—"}),p.required?s.jsx("span",{className:"ml-auto shrink-0 rounded border border-rose-500/25 bg-rose-500/10 px-1.5 py-0.5 text-[10px] text-rose-400",children:"required"}):s.jsx("span",{className:"ml-auto shrink-0 text-[10px] theme-text-faint",children:"optional"})]},m))]})]}),f&&s.jsxs(ul,{children:[s.jsx(Rr,{icon:ut,label:"Responses",count:Object.keys(i).length}),s.jsx("div",{className:"p-4 space-y-1.5",children:Object.entries(i).map(([m,p])=>{const b=m.startsWith("2");return s.jsxs("div",{className:`flex items-start gap-3 rounded-lg border px-3 py-2 ${b?"border-emerald-500/20 bg-emerald-500/[0.05]":"border-red-500/20 bg-red-500/[0.05]"}`,children:[s.jsx("span",{className:`shrink-0 w-10 font-mono text-[12px] font-medium ${b?"text-emerald-400":"text-red-400"}`,children:m}),p.schema&&s.jsx("div",{className:"flex flex-wrap gap-1",children:Object.keys(p.schema).map(v=>s.jsx("span",{className:"rounded border theme-border theme-bg-overlay-md px-1.5 py-0.5 font-mono text-[10px] theme-text-muted",children:v},v))})]},m)})})]}),s.jsx(l4,{endpoint:n}),s.jsx(r4,{endpoint:n}),s.jsxs(ul,{className:"lg:hidden",children:[s.jsx(Rr,{icon:hs,label:"Simulate Endpoint"}),s.jsx("div",{className:"p-4",children:s.jsx(b0,{endpoint:n})})]})]})]}),s.jsxs("aside",{className:"hidden lg:flex w-[400px] shrink-0 flex-col border-l theme-border bg-[var(--sidebar-bg)]",children:[s.jsxs("div",{className:"flex items-center gap-2.5 border-b theme-border px-5 py-[18px]",children:[s.jsx(hs,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2}),s.jsx("span",{className:"text-[13.5px] font-medium theme-text-primary",children:"Simulate Endpoint"})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-5",children:s.jsx(b0,{endpoint:n})})]})]})};function i4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Agents"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Delegate work to agents in this workspace."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}function c4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Tools"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Connect the tools agents can call."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}function u4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Context"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Ground agents with shared context and files."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}const Nf="/api/memory";async function v0(){const n=await fetch(Nf);if(!n.ok)throw new Error(`Failed to fetch memory (${n.status})`);return n.json()}async function d4(){try{const n=await fetch("/api/model");return n.ok?(await n.json())?.environments??[]:[]}catch{return[]}}async function f4(n,r){const o=await fetch(Nf,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:n,value:r})});if(!o.ok){const i=await o.json().catch(()=>({}));throw new Error(i.error??`Failed to add entry (${o.status})`)}}async function h4(n){const r=await fetch(Nf,{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:n})});if(!r.ok)throw new Error(`Failed to delete entry (${r.status})`)}function j0(n){return typeof n=="object"&&n!==null?JSON.stringify(n):String(n)}function m4(n){const r=n.indexOf(":");return r!==-1?n.slice(r+1):n}function wi(n){return n.includes(":")?n.split(":")[0]:"global"}function p4({value:n}){const[r,o]=j.useState(!1),i=n.length>200?n.slice(0,200)+"…":n;return s.jsx("div",{onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),className:"cursor-pointer max-w-[300px]",children:r?s.jsx("p",{className:"text-[12px] break-all transition-colors truncate theme-text",children:i}):s.jsx("p",{className:"text-[12px] font-mono tracking-widest select-none theme-text-faint",children:"••••••"})})}function x4({onClose:n,onSave:r,defaultScope:o}){const[i,u]=j.useState(o?`${o}:`:""),[f,h]=j.useState(""),[g,x]=j.useState(!1),[m,p]=j.useState(""),b=j.useRef(null);j.useEffect(()=>{b.current?.focus()},[]);const v=async N=>{if(N.preventDefault(),!i.trim()){p("Key is required");return}if(f.trim()===""){p("Value is required");return}x(!0),p("");try{await r(i.trim(),f.trim()),n()}catch(C){p(C.message??"An error occurred"),x(!1)}};return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:N=>{N.target===N.currentTarget&&n()},children:s.jsxs("div",{className:"relative w-full max-w-md rounded-lg p-6 shadow-2xl shadow-black/60 border theme-border theme-sidebar",children:[s.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg border theme-border theme-bg-overlay",children:s.jsx($t,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2})}),s.jsx("h2",{className:"text-[13.5px] font-medium theme-text-primary",children:"Add Memory Entry"})]}),s.jsx("button",{onClick:n,className:"flex h-7 w-7 items-center justify-center rounded-lg transition-colors hover:cursor-pointer hover:theme-bg-overlay-md hover:theme-text border theme-border theme-bg-overlay theme-text-muted",children:s.jsx(Tt,{className:"h-[15px] w-[15px]",strokeWidth:2})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-1.5 block text-[11px] font-semibold uppercase tracking-wider theme-text-faint",children:"Key / Identifier"}),s.jsx("input",{ref:b,value:i,onChange:N=>u(N.target.value),placeholder:"global:myKey or myKey",className:"w-full rounded-lg px-3 py-2 text-[12px] outline-none transition-colors focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md border theme-border theme-bg-overlay theme-text-primary"}),s.jsxs("p",{className:"mt-1.5 text-[10px] theme-text-faint",children:["Prefix with"," ",s.jsx("code",{className:"rounded px-1 py-0.5 text-[10px] border theme-border theme-bg-overlay-md theme-text-muted",children:"scope:"})," ","to organise by scope (e.g."," ",s.jsx("code",{className:"rounded px-1 py-0.5 text-[10px] border theme-border theme-bg-overlay-md theme-text-muted",children:"user:name"}),"). Defaults to"," ",s.jsx("code",{className:"rounded px-1 py-0.5 text-[10px] border theme-border theme-bg-overlay-md theme-text-muted",children:"global"}),"."]})]}),s.jsxs("div",{children:[s.jsx("label",{className:"mb-1.5 block text-[11px] font-semibold uppercase tracking-wider theme-text-faint",children:"Value"}),s.jsx("textarea",{value:f,onChange:N=>h(N.target.value),placeholder:"Enter a string value…",rows:4,className:"w-full resize-none rounded-lg px-3 py-2 text-[12px] outline-none transition-colors focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md border theme-border theme-bg-overlay theme-text-primary"})]}),m&&s.jsx("div",{className:"flex items-center gap-2 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2.5",children:s.jsx("p",{className:"text-[12px] text-red-400",children:m})}),s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[s.jsx("button",{type:"button",onClick:n,className:"rounded-lg px-4 py-2 text-[12px] transition-colors hover:cursor-pointer hover:theme-bg-overlay-md hover:theme-text border theme-border theme-bg-overlay theme-text-muted",children:"Cancel"}),s.jsxs("button",{onClick:v,disabled:g,className:"flex items-center gap-2 rounded-lg bg-[var(--action)] px-4 py-2 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)] disabled:cursor-not-allowed disabled:opacity-50",children:[g&&s.jsx(dt,{className:"h-[15px] w-[15px] animate-spin",strokeWidth:2}),g?"Saving…":"Save Entry"]})]})]})]})})}function g4({onClose:n,onSave:r}){const[o,i]=j.useState(""),[u,f]=j.useState(""),h=j.useRef(null);j.useEffect(()=>{h.current?.focus()},[]);const g=x=>{x.preventDefault();const m=o.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"");if(!m){f("Enter a valid scope name");return}r(m),n()};return s.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm",onClick:x=>{x.target===x.currentTarget&&n()},children:s.jsxs("div",{className:"relative w-full max-w-sm rounded-lg p-6 shadow-2xl shadow-black/60 border theme-border theme-sidebar",children:[s.jsxs("div",{className:"mb-5 flex items-center justify-between",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-lg border theme-border theme-bg-overlay",children:s.jsx($t,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2})}),s.jsx("h2",{className:"text-[13.5px] font-medium theme-text-primary",children:"Add Scope"})]}),s.jsx("button",{onClick:n,className:"flex h-7 w-7 items-center justify-center rounded-lg transition-colors hover:cursor-pointer hover:theme-bg-overlay-md border theme-border theme-bg-overlay theme-text-muted",children:s.jsx(Tt,{className:"h-[15px] w-[15px]",strokeWidth:2})})]}),s.jsxs("div",{className:"space-y-4",children:[s.jsxs("div",{children:[s.jsx("label",{className:"mb-1.5 block text-[11px] font-semibold uppercase tracking-wider theme-text-faint",children:"Scope Name"}),s.jsx("input",{ref:h,value:o,onChange:x=>{i(x.target.value),f("")},placeholder:"e.g. session, user, cart",className:"w-full rounded-lg px-3 py-2 text-[12px] outline-none transition-colors focus:border-[color:var(--brand)]/50 border theme-border theme-bg-overlay theme-text-primary"}),s.jsxs("p",{className:"mt-1.5 text-[10px] theme-text-faint",children:["Memory entries under this scope will be keyed as"," ",s.jsxs("code",{className:"rounded px-1 py-0.5 text-[10px] border theme-border theme-bg-overlay-md theme-text-muted",children:[o.trim()?o.trim().toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""):"scope",":key"]})]})]}),u&&s.jsx("p",{className:"text-[12px] text-red-400",children:u}),s.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[s.jsx("button",{type:"button",onClick:n,className:"rounded-lg px-4 py-2 text-[12px] transition-colors hover:cursor-pointer hover:theme-bg-overlay-md border theme-border theme-bg-overlay theme-text-muted",children:"Cancel"}),s.jsxs("button",{onClick:g,className:"flex items-center gap-2 rounded-lg bg-[var(--action)] px-4 py-2 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)]",children:[s.jsx(ut,{className:"h-[14px] w-[14px]",strokeWidth:2})," Create Scope"]})]})]})]})})}const y4={workflow:_i,global:kv},b4={workflow:{border:"border-[color:var(--brand)]/20",bg:"bg-[color:var(--brand)]/5",dot:"bg-[color:var(--brand)]/40",text:"text-[color:var(--brand)]",activeBg:"bg-[color:var(--brand)]/15",activeBorder:"border-[color:var(--brand)]/40"},environment:{border:"border-emerald-500/20",bg:"bg-emerald-500/5",dot:"bg-emerald-500/40",text:"text-emerald-400",activeBg:"bg-emerald-500/15",activeBorder:"border-emerald-500/40"},global:{border:"theme-border",bg:"theme-bg-overlay",dot:"bg-[var(--text-faint)]",text:"theme-text-muted",activeBg:"theme-bg-overlay-md",activeBorder:"theme-border"}},v4={border:"border-[color:var(--brand)]/20",bg:"bg-[color:var(--brand)]/5",dot:"bg-[color:var(--brand)]/40",text:"text-[color:var(--brand)]",activeBg:"bg-[color:var(--brand)]/15",activeBorder:"border-[color:var(--brand)]/40"};function jy(n){return b4[n]??v4}function j4({scope:n,active:r,onClick:o}){const i=jy(n.id),u=y4[n.id]??ki;return s.jsxs("button",{type:"button",onClick:o,className:`group relative flex flex-col gap-2 rounded-lg border p-3.5 text-left transition-all duration-200 hover:cursor-pointer ${r?`${i.activeBg} ${i.activeBorder}`:`${i.border} ${i.bg} hover:${i.activeBg}`}`,children:[s.jsxs("div",{className:"flex items-center justify-between",children:[s.jsx("div",{className:`flex h-7 w-7 items-center justify-center rounded-lg border ${i.border} theme-bg-overlay`,children:s.jsx(u,{className:`h-[14px] w-[14px] ${i.text}`,strokeWidth:2})}),r&&s.jsx("div",{className:`flex h-4 w-4 items-center justify-center rounded-full ${i.activeBg}`,children:s.jsx(ut,{className:`h-2.5 w-2.5 ${i.text}`,strokeWidth:3})})]}),s.jsxs("div",{children:[s.jsx("p",{className:`text-[12px] font-medium ${i.text}`,children:n.label}),s.jsxs("p",{className:"text-[10px] theme-text-faint",children:[n.count," ",n.count===1?"entry":"entries"]})]})]})}function N4(){const[n,r]=j.useState([]),[o,i]=j.useState([]),[u,f]=j.useState([]),[h,g]=j.useState(null),[x,m]=j.useState(!0),[p,b]=j.useState(!1),[v,N]=j.useState(null),[C,k]=j.useState(""),[R,z]=j.useState(!1),[V,q]=j.useState(!1),[M,H]=j.useState(null),Z=j.useCallback(async(T=!1)=>{T?b(!0):m(!0),N(null);try{const[A,S]=await Promise.all([v0(),d4()]);r(A),i(S)}catch(A){N(A.message??"Could not load memory data. Is `jetic dev` running?")}finally{m(!1),b(!1)}},[]);j.useEffect(()=>{Z()},[Z]);const X=async T=>{H(T);try{await h4(T),r(A=>A.filter(S=>S.key!==T))}catch(A){N(A.message??"Failed to delete entry")}finally{H(null)}},oe=async(T,A)=>{await f4(T,A);const S=await v0();r(S)},I=Array.from(new Set(n.map(T=>wi(T.key)))),K=T=>n.filter(A=>wi(A.key)===T).length,ae=[{id:"workflow",label:"Workflow",count:K("workflow"),isBuiltIn:!0},...o.map(T=>({id:`environment.${T.name}`,label:T.name,count:K(`environment.${T.name}`),isBuiltIn:!0}))],te=new Set(["workflow",...o.map(T=>`environment.${T.name}`)]),se=I.filter(T=>!te.has(T)&&T!=="global"),_=Array.from(new Set([...u,...se])),W=[...ae,..._.map(T=>({id:T,label:T.charAt(0).toUpperCase()+T.slice(1),count:K(T),isCustom:!0})),{id:"global",label:"Global",count:K("global"),isBuiltIn:!0}],E=h?n.filter(T=>wi(T.key)===h):n,$=E.filter(T=>!C||T.key.toLowerCase().includes(C.toLowerCase())||j0(T.value).toLowerCase().includes(C.toLowerCase()));return s.jsxs("div",{className:"flex h-full w-full flex-col overflow-hidden",children:[s.jsxs("div",{className:"flex items-center justify-between px-6 py-5 border-b theme-border",children:[s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Memory"}),s.jsx("p",{className:"mt-0.5 text-[11px] theme-text-muted",children:x?"Loading…":h?`${$.length} entries in ${h}`:`${n.length} entr${n.length===1?"y":"ies"} stored`})]}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("button",{onClick:()=>Z(!0),disabled:p||x,title:"Refresh",className:"flex h-8 w-8 items-center justify-center rounded-lg transition-colors hover:cursor-pointer hover:theme-bg-overlay-md hover:theme-text disabled:opacity-40 border theme-border theme-bg-overlay theme-text-muted",children:s.jsx(na,{className:`h-[15px] w-[15px] ${p?"animate-spin":""}`,strokeWidth:2})}),s.jsxs("button",{onClick:()=>z(!0),className:"flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-3 py-1.5 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)]",children:[s.jsx($t,{className:"h-[15px] w-[15px]",strokeWidth:2}),"Add Entry"]})]})]}),s.jsxs("div",{className:"flex flex-1 flex-col gap-4 overflow-y-auto p-6",children:[!x&&!v&&s.jsxs("div",{children:[s.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[s.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wider theme-text-faint",children:"Scopes"}),s.jsxs("button",{onClick:()=>q(!0),className:"flex items-center gap-1 rounded-lg px-2 py-1 text-[10px] font-medium transition-colors hover:cursor-pointer hover:theme-bg-overlay-md border theme-border theme-text-faint",children:[s.jsx($t,{className:"h-3 w-3",strokeWidth:2})," Add Scope"]})]}),s.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5",children:W.map(T=>s.jsx(j4,{scope:T,active:h===T.id,onClick:()=>g(A=>A===T.id?null:T.id)},T.id))}),h&&s.jsx("button",{type:"button",onClick:()=>g(null),className:"mt-2 text-[11px] transition-colors hover:cursor-pointer hover:text-[color:var(--brand)] theme-text-faint",children:"← Show all scopes"})]}),!x&&!v&&s.jsx("div",{className:"border-t theme-border"}),!x&&n.length>0&&s.jsxs("div",{className:"relative",children:[s.jsx(zi,{className:"absolute left-3 top-1/2 h-[15px] w-[15px] -translate-y-1/2 theme-text-faint",strokeWidth:2}),s.jsx("input",{value:C,onChange:T=>k(T.target.value),placeholder:h?`Filter ${h} entries…`:"Filter by key or value…",className:"w-full rounded-lg py-2 pl-9 pr-9 text-[12px] outline-none transition-colors focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md border theme-border theme-bg-overlay theme-text"}),C&&s.jsx("button",{onClick:()=>k(""),className:"absolute right-3 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-lg transition-colors hover:cursor-pointer hover:theme-text border theme-border theme-bg-overlay-md theme-text-faint",children:s.jsx(Tt,{className:"h-3 w-3",strokeWidth:2})})]}),x&&s.jsx("div",{className:"space-y-3",children:[1,2,3].map(T=>s.jsx("div",{className:"h-14 animate-pulse rounded-lg border theme-border theme-bg-overlay",style:{opacity:1-T*.2}},T))}),!x&&v&&s.jsxs("div",{className:"flex flex-col items-center gap-4 rounded-lg border border-red-500/20 bg-red-500/[0.04] p-10 text-center",children:[s.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-lg border border-red-500/20 bg-red-500/10 text-red-400",children:s.jsx(ki,{className:"h-6 w-6",strokeWidth:2})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[13.5px] font-medium text-red-300",children:"Could not load memory"}),s.jsx("p",{className:"mt-1 text-[11px] text-red-500/70",children:v})]}),s.jsx("button",{onClick:()=>Z(),className:"rounded-lg border border-red-500/20 bg-red-500/10 px-4 py-1.5 text-[12px] text-red-400 transition-colors hover:cursor-pointer hover:bg-red-500/20",children:"Retry"})]}),!x&&!v&&n.length===0&&s.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-4 py-20 text-center",children:[s.jsxs("div",{className:"relative flex h-16 w-16 items-center justify-center",children:[s.jsx("div",{className:"absolute inset-0 rounded-full bg-[color:var(--brand)]/10 blur-xl"}),s.jsx("div",{className:"relative flex h-16 w-16 items-center justify-center rounded-lg text-[color:var(--brand)] border theme-border theme-bg-overlay",children:s.jsx(ki,{className:"h-7 w-7",strokeWidth:2})})]}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[13.5px] font-medium theme-text",children:"Memory is empty"}),s.jsxs("p",{className:"mt-1 text-[12px] theme-text-faint",children:["Add your first entry or run"," ",s.jsx("code",{className:"rounded px-1.5 py-0.5 text-[11px] border theme-border theme-bg-overlay-md theme-text-muted",children:"jetic memory add"})," ","in the CLI."]})]}),s.jsxs("button",{onClick:()=>z(!0),className:"flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-4 py-2 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)]",children:[s.jsx($t,{className:"h-[15px] w-[15px]",strokeWidth:2}),"Add Entry"]})]}),!x&&!v&&n.length>0&&h&&$.length===0&&!C&&s.jsxs("div",{className:"flex flex-col items-center gap-3 py-12 text-center",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg border theme-border theme-bg-overlay",children:s.jsx(ki,{className:"h-[15px] w-[15px] theme-text-faint",strokeWidth:2})}),s.jsxs("p",{className:"text-[13px] theme-text-muted",children:["No entries in ",s.jsx("code",{className:"text-[color:var(--brand)]",children:h})," scope"]}),s.jsxs("button",{onClick:()=>z(!0),className:"flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-3 py-1.5 text-[12px] font-medium text-[color:var(--action-foreground)] transition-colors hover:cursor-pointer hover:bg-[var(--action-hover)]",children:[s.jsx($t,{className:"h-[14px] w-[14px]",strokeWidth:2})," Add to ",h]})]}),!x&&!v&&n.length>0&&C&&$.length===0&&s.jsxs("div",{className:"flex flex-col items-center gap-3 py-12 text-center",children:[s.jsx("div",{className:"flex h-10 w-10 items-center justify-center rounded-lg border theme-border theme-bg-overlay",children:s.jsx(zi,{className:"h-[15px] w-[15px] theme-text-faint",strokeWidth:2})}),s.jsxs("p",{className:"text-[13px] theme-text-muted",children:['No entries match "',C,'"']}),s.jsx("button",{onClick:()=>k(""),className:"text-[12px] text-[color:var(--brand)] transition-colors hover:cursor-pointer hover:text-[color:var(--brand)]",children:"Clear filter"})]}),!x&&!v&&$.length>0&&s.jsx("div",{className:"overflow-y-auto rounded-lg border theme-border theme-bg-overlay",children:s.jsxs("table",{className:"w-full text-left whitespace-nowrap",children:[s.jsx("thead",{className:"border-b theme-border theme-bg-overlay",children:s.jsxs("tr",{children:[s.jsx("th",{className:"w-32 px-4 py-3 text-[10px] font-semibold uppercase tracking-wider theme-text-faint",children:"Scope"}),s.jsx("th",{className:"w-48 px-4 py-3 text-[10px] font-semibold uppercase tracking-wider theme-text-faint",children:"Key"}),s.jsx("th",{className:"px-4 py-3 text-[10px] font-semibold uppercase tracking-wider theme-text-faint",children:"Value"}),s.jsx("th",{className:"w-16 px-4 py-3 text-right text-[10px] font-semibold uppercase tracking-wider theme-text-faint",children:"Actions"})]})}),s.jsx("tbody",{children:$.map((T,A)=>{const S=wi(T.key),D=m4(T.key),L=j0(T.value),F=M===T.key,ie=jy(S);return s.jsxs("tr",{className:`group transition-colors hover:theme-bg-overlay-md ${A!==0?"border-t theme-border":""}`,children:[s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wider border theme-bg-overlay-md ${ie.border} ${ie.text}`,children:S})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx("span",{className:"inline-flex items-center rounded-lg px-2.5 py-0.5 font-mono text-[11px] border theme-border theme-bg-overlay-md theme-text",children:D})}),s.jsx("td",{className:"px-4 py-3",children:s.jsx(p4,{value:L})}),s.jsx("td",{className:"px-4 py-3 text-right",children:s.jsx("button",{onClick:()=>X(T.key),disabled:F,title:"Delete entry",className:"inline-flex h-7 w-7 items-center justify-center rounded-lg transition-colors hover:cursor-pointer hover:border-red-500/30 hover:bg-red-500/10 hover:text-red-400 disabled:cursor-not-allowed disabled:opacity-50 border theme-border theme-bg-overlay theme-text-faint",children:F?s.jsx(dt,{className:"h-[15px] w-[15px] animate-spin",strokeWidth:2}):s.jsx(Yt,{className:"h-[15px] w-[15px]",strokeWidth:2})})})]},T.key)})})]})}),!x&&!v&&C&&$.length>0&&s.jsxs("p",{className:"text-center text-[11px] theme-text-faint",children:["Showing ",$.length," of ",E.length," entries"]})]}),!x&&!v&&n.length>0&&s.jsxs("div",{className:"flex items-center gap-1.5 px-6 py-3 text-[11px] border-t theme-border theme-text-faint",children:[s.jsx(Gr,{className:"h-[15px] w-[15px]",strokeWidth:2}),"Data read from"," ",s.jsx("code",{className:"rounded px-1.5 py-0.5 text-[10px] border theme-border theme-bg-overlay-md theme-text-muted",children:".jetic/memory.json"}),s.jsx("span",{className:"ml-auto",children:s.jsx("button",{onClick:()=>Z(!0),className:"text-[11px] transition-colors hover:cursor-pointer hover:text-[color:var(--brand)] theme-text-faint",children:"Refresh"})})]}),R&&s.jsx(x4,{onClose:()=>z(!1),onSave:oe,defaultScope:h??void 0}),V&&s.jsx(g4,{onClose:()=>q(!1),onSave:T=>f(A=>A.includes(T)?A:[...A,T])})]})}function w4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"APIs"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Register the APIs and services this workspace talks to."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}function S4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Email"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Configure outbound and inbound email."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}function E4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"OAuth"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Manage OAuth providers and credentials."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}function k4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Webhooks"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Subscribe to events with outgoing webhooks."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}const N0={GET:{bg:"#052e16",text:"#4ade80",border:"#166534",dot:"#34d399"},POST:{bg:"var(--bg-overlay-md)",text:"var(--text-primary)",border:"var(--border-md)",dot:"var(--text-primary)"},PUT:{bg:"#422006",text:"#fbbf24",border:"#92400e",dot:"#fbbf24"},PATCH:{bg:"#431407",text:"#fb923c",border:"#9a3412",dot:"#fb923c"},DELETE:{bg:"#3f0000",text:"#f87171",border:"#991b1b",dot:"#f87171"},HEAD:{bg:"var(--bg-overlay-md)",text:"var(--text-muted)",border:"var(--text-faint)",dot:"var(--text-muted)"},OPTIONS:{bg:"var(--bg-overlay-md)",text:"var(--text-primary)",border:"var(--border-md)",dot:"var(--text-primary)"}};function Ny(n){return N0[n.toUpperCase()]??N0.GET}function _4({data:n}){const r=Ny(n.method),o=n.passed?"#34d399":"#f87171",i=n.selected?"var(--brand)":n.passed===!0?"#166534":n.passed===!1?"#991b1b":"var(--text-faint)";return s.jsxs("div",{onClick:n.onSelect,style:{width:260,border:`1.5px solid ${i}`,borderRadius:10,background:"var(--bg-surface)",cursor:"pointer",boxShadow:n.selected?"0 0 0 2px color-mix(in srgb, var(--brand) 40%, transparent)":"0 2px 12px rgba(0,0,0,0.4)",transition:"box-shadow 0.15s ease",overflow:"hidden"},children:[s.jsx(Nt,{type:"target",position:xe.Top,style:{background:"transparent",border:"none"}}),s.jsxs("div",{style:{background:r.bg,borderBottom:`1px solid ${r.border}`,padding:"8px 12px",display:"flex",alignItems:"center",gap:8},children:[s.jsx("span",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.1em",color:r.text,background:`color-mix(in srgb, ${r.dot} 8%, transparent)`,border:`1px solid color-mix(in srgb, ${r.dot} 25%, transparent)`,borderRadius:4,padding:"2px 6px"},children:n.method}),s.jsx("span",{style:{fontSize:11,color:"var(--text-primary)",fontFamily:"monospace",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.path}),n.status>0&&s.jsx("span",{style:{fontSize:10,color:o,fontFamily:"monospace",fontWeight:600,flexShrink:0},children:n.status})]}),s.jsxs("div",{style:{padding:"8px 12px",display:"flex",flexDirection:"column",gap:5},children:[n.name&&s.jsx("span",{style:{fontSize:10,color:"var(--text-muted)",fontStyle:"italic"},children:n.name}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},children:[s.jsx("span",{style:{fontSize:9,fontWeight:600,letterSpacing:"0.08em",color:n.passed?"#4ade80":"#f87171",background:n.passed?"rgba(74,222,128,0.08)":"rgba(248,113,113,0.08)",border:`1px solid ${n.passed?"rgba(74,222,128,0.2)":"rgba(248,113,113,0.2)"}`,borderRadius:4,padding:"2px 6px"},children:n.passed?"✓ PASSED":"✗ FAILED"}),n.durationMs>0&&s.jsxs("span",{style:{fontSize:10,color:"var(--text-faint)"},children:[n.durationMs,"ms"]})]}),n.injectSpec&&Object.keys(n.injectSpec).length>0&&s.jsx("div",{style:{display:"flex",flexWrap:"wrap",gap:4,marginTop:2},children:Object.entries(n.injectSpec).map(([u,f])=>s.jsxs("span",{style:{fontSize:9,color:"var(--brand)",background:"color-mix(in srgb, var(--brand) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--brand) 20%, transparent)",borderRadius:4,padding:"1px 5px"},children:["📥 ",u," ← ","{{",f,"}}"]},u))}),(n.conditionSpec||n.conditionResult)&&s.jsx("div",{style:{display:"flex",alignItems:"center",gap:4,marginTop:2},children:s.jsxs("span",{style:{fontSize:9,fontWeight:600,color:n.conditionResult?n.conditionResult.passed?"var(--brand)":"#fb923c":"var(--brand)",background:n.conditionResult?.passed===!1?"rgba(251,146,60,0.1)":"color-mix(in srgb, var(--brand) 10%, transparent)",border:`1px solid ${n.conditionResult?.passed===!1?"rgba(251,146,60,0.3)":"color-mix(in srgb, var(--brand) 30%, transparent)"}`,borderRadius:4,padding:"1px 5px",display:"flex",alignItems:"center",gap:3},children:[s.jsx(ea,{style:{width:9,height:9}}),n.conditionResult?n.conditionResult.passed?"cond passed":"cond FAILED":"has condition"]})}),n.error&&s.jsxs("span",{style:{fontSize:9,color:"#f87171",marginTop:2},children:["⚠ ",n.error]}),s.jsx("span",{style:{fontSize:9,color:"var(--text-faint)",marginTop:2},children:"Click for details"})]}),s.jsx(Nt,{type:"source",position:xe.Bottom,style:{background:"transparent",border:"none"}})]})}function C4({data:n}){const r=Object.entries(n.captured??{});return s.jsxs("div",{style:{width:200,border:"1.5px solid color-mix(in srgb, var(--brand) 35%, transparent)",borderRadius:10,background:"color-mix(in srgb, var(--brand) 7%, transparent)",padding:"8px 12px",backdropFilter:"blur(4px)"},children:[s.jsx(Nt,{type:"target",position:xe.Top,style:{background:"transparent",border:"none"}}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:6},children:[s.jsx(fl,{style:{width:12,height:12,color:"var(--brand)"}}),s.jsx("span",{style:{fontSize:10,fontWeight:600,color:"var(--brand)",letterSpacing:"0.06em"},children:"MEMORY"})]}),r.length===0&&s.jsx("span",{style:{fontSize:9,color:"var(--text-faint)"},children:"No variables captured"}),r.map(([o,i])=>s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:3},children:[s.jsx("span",{style:{fontSize:10,color:"var(--brand)",fontFamily:"monospace"},children:o}),s.jsx(dl,{style:{width:10,height:10,color:"var(--text-faint)",flexShrink:0}}),s.jsx("span",{style:{fontSize:9,color:"var(--text-muted)",fontFamily:"monospace",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",flex:1},children:String(i).length>20?String(i).slice(0,20)+"…":i})]},o)),s.jsx(Nt,{type:"source",position:xe.Bottom,style:{background:"transparent",border:"none"}})]})}function T4({data:n}){return s.jsxs("div",{style:{width:120,border:"1.5px solid color-mix(in srgb, var(--brand) 40%, transparent)",borderRadius:20,background:"color-mix(in srgb, var(--brand) 8%, transparent)",padding:"7px 14px",textAlign:"center"},children:[s.jsx("span",{style:{fontSize:11,fontWeight:600,color:"var(--brand)",letterSpacing:"0.05em"},children:n.label}),s.jsx(Nt,{type:"source",position:xe.Bottom,style:{background:"transparent",border:"none"}})]})}function M4({data:n}){const r=n.phase==="done"&&n.failed===0?"#4ade80":n.phase==="aborted"?"#f87171":"#fbbf24";return s.jsxs("div",{style:{width:140,border:`1.5px solid ${r}40`,borderRadius:20,background:`${r}0d`,padding:"7px 14px",textAlign:"center"},children:[s.jsx(Nt,{type:"target",position:xe.Top,style:{background:"transparent",border:"none"}}),s.jsx("span",{style:{fontSize:11,fontWeight:600,color:r,letterSpacing:"0.05em"},children:n.phase==="done"&&n.failed===0?"✓ PASSED":n.phase==="aborted"?"✗ ABORTED":`${n.passed}/${n.passed+n.failed} PASSED`})]})}function A4({data:n}){const r=n.conditionResult?.passed,o=r===void 0?"var(--brand)":r?"#4ade80":"#fb923c";return s.jsxs("div",{style:{width:44,height:44,position:"relative",display:"flex",alignItems:"center",justifyContent:"center"},children:[s.jsx(Nt,{type:"target",position:xe.Top,style:{background:"transparent",border:"none"}}),s.jsxs("svg",{width:"44",height:"44",viewBox:"0 0 44 44",children:[s.jsx("polygon",{points:"22,2 42,22 22,42 2,22",fill:"none",stroke:o,strokeWidth:"1.5"}),s.jsx("polygon",{points:"22,8 36,22 22,36 8,22",fill:o,fillOpacity:.15,stroke:"none"})]}),s.jsx("span",{style:{position:"absolute",fontSize:9,fontFamily:"monospace",fontWeight:700,color:o,top:"50%",left:"50%",transform:"translate(-50%,-50%)",whiteSpace:"nowrap"},children:"◇"}),s.jsx(Nt,{type:"source",position:xe.Bottom,id:"pass",style:{background:"transparent",border:"none"}}),s.jsx(Nt,{type:"source",position:xe.Right,id:"fail",style:{background:"transparent",border:"none"}})]})}function R4({data:n}){return s.jsxs("div",{style:{width:210,border:"1.5px dashed rgba(251,146,60,0.45)",borderRadius:12,background:"rgba(251,146,60,0.06)",padding:"9px 13px",backdropFilter:"blur(4px)"},children:[s.jsx(Nt,{type:"target",position:xe.Left,style:{background:"transparent",border:"none"}}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[s.jsx(Pd,{style:{width:11,height:11,color:"#fb923c"}}),s.jsx("span",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.08em",color:"#fb923c"},children:"SWITCHED WORKFLOW"})]}),s.jsx("span",{style:{fontSize:11,color:"#fdba74",fontFamily:"monospace"},children:n.workflowName||"unknown"}),n.returnsOnComplete&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:4,marginTop:6},children:[s.jsx(na,{style:{width:9,height:9,color:"var(--text-muted)"}}),s.jsx("span",{style:{fontSize:9,color:"var(--text-muted)"},children:"resumes main flow after"})]}),s.jsx(Nt,{type:"source",position:xe.Right,id:"return",style:{background:"transparent",border:"none"}})]})}const z4={step:_4,memory:C4,condition:A4,start:T4,end:M4,branch:R4},il=260,O4=130,D4=200,H4=90,$4=il+90,Si=50;function ol(n,r={}){return{type:"smoothstep",pathOptions:{borderRadius:14},animated:!!r.animated,style:{stroke:n,strokeWidth:r.width??1.5,strokeDasharray:r.dashed?"5 4":void 0},markerEnd:{type:Ba.ArrowClosed,color:n,width:16,height:16},labelStyle:{fill:n,fontSize:9,fontWeight:600,fontFamily:"monospace"},labelBgStyle:r.labelBg===!1?{fill:"transparent"}:{fill:"var(--bg-base)",fillOpacity:.9},labelBgPadding:[4,2],labelBgBorderRadius:4}}function U4(n,r,o){const i=[],u=[];let f=0;i.push({id:"start",type:"start",position:{x:(il-120)/2,y:f},data:{label:`▶ START · ${new Date(n.startedAt).toLocaleTimeString()}`},draggable:!1}),f+=50+Si;for(let m=0;m<n.steps.length;m++){const p=n.steps[m],b=p.captureSpec&&Object.keys(p.captureSpec).length>0,v=p.captured&&Object.keys(p.captured).length>0,N=!!(p.conditionSpec||p.conditionResult),C=!!p.conditionSpec?.switchToWorkflow,k=p.passed?"#4ade80":"#f87171";i.push({id:`step-${m}`,type:"step",position:{x:0,y:f},data:{index:m,name:p.name,method:p.method,path:p.path,status:p.status,passed:p.passed,durationMs:p.durationMs,error:p.error,injectSpec:p.injectSpec,captureSpec:p.captureSpec,conditionSpec:p.conditionSpec,conditionResult:p.conditionResult,selected:r===m,onSelect:()=>o(m)},draggable:!1});const R=m===0?"start":Ei(n,m-1)?`cond-${m-1}`:w0(n,m-1)?`mem-${m-1}`:`step-${m-1}`,z=m>0&&Ei(n,m-1)?"pass":void 0;u.push({id:`e-${m}`,source:R,sourceHandle:z,target:`step-${m}`,...ol(k,{width:2}),label:m>0&&n.steps[m-1].injectSpec?Object.keys(n.steps[m-1].injectSpec??{}).map(q=>`{{${q}}}`).join(", "):void 0}),f+=O4+Si;let V=`step-${m}`;if((b||v)&&(i.push({id:`mem-${m}`,type:"memory",position:{x:(il-D4)/2,y:f},data:{captured:v?p.captured:Object.fromEntries(Object.keys(p.captureSpec??{}).map(q=>[q.split(":").pop()??q,"…"]))},draggable:!1}),u.push({id:`e-mem-${m}`,source:`step-${m}`,target:`mem-${m}`,...ol("var(--brand)",{dashed:!0,width:1.2}),label:"capture"}),f+=H4+Si,V=`mem-${m}`),N){const q=p.conditionResult?.passed===!1?"#fb923c":"var(--brand)",M=f;if(i.push({id:`cond-${m}`,type:"condition",position:{x:(il-44)/2,y:M},data:{conditionSpec:p.conditionSpec,conditionResult:p.conditionResult},draggable:!1}),u.push({id:`e-cond-${m}`,source:V,target:`cond-${m}`,...ol(q,{width:1.4}),label:p.conditionResult?p.conditionResult.passed?"PASS":"FAIL":"eval"}),C&&(i.push({id:`branch-${m}`,type:"branch",position:{x:$4,y:M-10},data:{workflowName:p.conditionSpec?.switchToWorkflow,returnsOnComplete:p.conditionSpec?.returnOnComplete},draggable:!1}),u.push({id:`e-branch-${m}`,source:`cond-${m}`,sourceHandle:"fail",target:`branch-${m}`,...ol("#fb923c",{dashed:!0,width:1.6,labelBg:!0}),label:"on FAIL → switch"}),p.conditionSpec?.returnOnComplete)){const H=m<n.steps.length-1?`step-${m+1}`:"end";u.push({id:`e-branch-return-${m}`,source:`branch-${m}`,sourceHandle:"return",target:H,...ol("var(--brand)",{dashed:!0,width:1.2,labelBg:!0}),label:"resume"})}f+=44+Si}}i.push({id:"end",type:"end",position:{x:(il-140)/2,y:f},data:{phase:n.phase,passed:n.passed,failed:n.failed},draggable:!1});const h=n.steps.length-1,g=n.steps.length>0?Ei(n,h)?`cond-${h}`:w0(n,h)?`mem-${h}`:`step-${h}`:"start",x=n.steps.length>0&&Ei(n,h)?"pass":void 0;return u.push({id:"e-end",source:g,sourceHandle:x,target:"end",...ol(n.phase==="done"&&n.failed===0?"#4ade80":"#f87171",{width:2})}),i.push({id:"spine-rail",type:"default",position:{x:il/2-1,y:0},data:{label:""},draggable:!1,selectable:!1,focusable:!1,style:{width:2,height:f,background:"linear-gradient(to bottom, color-mix(in srgb, var(--brand) 18%, transparent), color-mix(in srgb, var(--brand) 12%, transparent), rgba(74,222,128,0.18))",border:"none",borderRadius:2,pointerEvents:"none"},zIndex:-1}),{nodes:i,edges:u}}function Ei(n,r){const o=n.steps[r];return o?!!(o.conditionSpec||o.conditionResult):!1}function w0(n,r){const o=n.steps[r];return o?o.captureSpec&&Object.keys(o.captureSpec).length>0||o.captured&&Object.keys(o.captured).length>0:!1}function B4({trace:n,selectedStep:r,onSelectStep:o}){const[i,u,f]=cy([]),[h,g,x]=uy([]);return j.useEffect(()=>{const{nodes:m,edges:p}=U4(n,r,o);u(m),g(p)},[n,r]),s.jsxs(bf,{nodes:i,edges:h,onNodesChange:f,onEdgesChange:x,nodeTypes:z4,fitView:!0,fitViewOptions:{padding:.3},proOptions:{hideAttribution:!0},minZoom:.15,maxZoom:2,defaultEdgeOptions:{type:"smoothstep"},style:{background:"transparent"},children:[s.jsx(xy,{variant:rn.Dots,gap:24,size:1,color:"rgba(255,255,255,0.04)"}),s.jsx(my,{className:"theme-bg-surface border theme-border rounded-lg",showInteractive:!1}),s.jsx(h3,{nodeColor:m=>m.type==="memory"?"color-mix(in srgb, var(--brand) 50%, transparent)":m.type==="branch"?"rgba(251,146,60,0.5)":m.type==="start"||m.type==="end"?"color-mix(in srgb, var(--brand) 50%, transparent)":m.id==="spine-rail"?"transparent":m.data?.passed?"rgba(74,222,128,0.5)":"rgba(248,113,113,0.5)",className:"theme-bg-elevated border theme-border rounded-lg",maskColor:"rgba(0,0,0,0.4)"})]})}function q4({step:n,onClose:r}){const o=Ny(n.method),[i,u]=j.useState("overview");return s.jsxs("div",{className:"flex flex-col h-full",style:{width:360,borderLeft:"1px solid var(--border)",backgroundColor:"var(--bg-surface)",flexShrink:0},children:[s.jsxs("div",{style:{borderBottom:"1px solid var(--border)",padding:"12px 16px",display:"flex",alignItems:"center",gap:10,backgroundColor:"var(--bg-elevated)"},children:[s.jsx("span",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.1em",color:o.text,background:o.bg,border:`1px solid ${o.border}`,borderRadius:4,padding:"2px 8px"},children:n.method}),s.jsx("span",{style:{fontFamily:"monospace",fontSize:12,color:"var(--text-primary)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.path}),s.jsx("button",{onClick:r,className:"theme-text-faint flex items-center",children:s.jsx(Tt,{className:"h-4 w-4"})})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"8px 16px",borderBottom:"1px solid var(--border)",backgroundColor:n.passed?"rgba(74,222,128,0.04)":"rgba(248,113,113,0.04)"},children:[n.passed?s.jsx(ut,{className:"h-4 w-4 text-emerald-400 shrink-0"}):s.jsx(Ct,{className:"h-4 w-4 text-red-400 shrink-0"}),s.jsxs("span",{style:{fontSize:11,fontWeight:600,color:n.passed?"#4ade80":"#f87171"},children:["HTTP ",n.status>0?n.status:"ERROR"," · ",n.durationMs,"ms"]}),n.expectStatus&&s.jsxs("span",{style:{fontSize:10,color:"var(--text-muted)",marginLeft:"auto"},children:["expected ",n.expectStatus]})]}),s.jsx("div",{className:"flex border-b theme-border",children:["overview","request","response","vars","conditions"].map(f=>s.jsx("button",{onClick:()=>u(f),style:{flex:1,padding:"8px 4px",fontSize:10,fontWeight:600,letterSpacing:"0.05em",textTransform:"capitalize",color:i===f?"var(--brand)":"var(--text-muted)",borderBottom:i===f?"2px solid var(--brand)":"2px solid transparent",background:"transparent",cursor:"pointer",transition:"color 0.15s"},children:f},f))}),s.jsxs("div",{style:{flex:1,overflowY:"auto",padding:"14px 16px"},children:[i==="overview"&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[s.jsxs(Kt,{title:"Step",children:[s.jsx(pt,{k:"Index",v:`#${n.index+1}`}),s.jsx(pt,{k:"Name",v:n.name||"—"}),s.jsx(pt,{k:"Method",v:n.method}),s.jsx(pt,{k:"Path",v:n.path,mono:!0}),n.description&&s.jsx(pt,{k:"Description",v:n.description})]}),s.jsxs(Kt,{title:"Timing",children:[s.jsx(pt,{k:"Duration",v:`${n.durationMs}ms`,accent:"var(--brand)"}),n.startedAt&&s.jsx(pt,{k:"Started",v:new Date(n.startedAt).toLocaleTimeString()}),n.finishedAt&&s.jsx(pt,{k:"Finished",v:new Date(n.finishedAt).toLocaleTimeString()}),n.expectStatus&&s.jsx(pt,{k:"Expected status",v:String(n.expectStatus)}),s.jsx(pt,{k:"Actual status",v:n.status>0?String(n.status):"No response",accent:n.passed?"#4ade80":"#f87171"})]}),n.error&&s.jsx(Kt,{title:"Error",children:s.jsx("div",{style:{background:"rgba(248,113,113,0.06)",border:"1px solid rgba(248,113,113,0.2)",borderRadius:6,padding:"8px 10px"},children:s.jsx("span",{style:{fontSize:11,color:"#f87171",fontFamily:"monospace"},children:n.error})})})]}),i==="request"&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[n.resolvedUrl&&s.jsx(Kt,{title:"Request URL",children:s.jsx(pt,{k:n.method,v:n.resolvedUrl,mono:!0})}),n.requestHeaders&&Object.keys(n.requestHeaders).length>0?s.jsx(Kt,{title:"Headers (sent)",children:Object.entries(n.requestHeaders).map(([f,h])=>s.jsx(pt,{k:f,v:String(h),mono:!0},f))}):Object.keys(n.injected??{}).length>0&&s.jsx(Kt,{title:"Headers (injected)",children:Object.entries(n.injected??{}).map(([f,h])=>s.jsx(pt,{k:f,v:String(h),mono:!0},f))}),n.injectSpec&&Object.keys(n.injectSpec).length>0&&s.jsx(Kt,{title:"Variable injection spec",children:Object.entries(n.injectSpec).map(([f,h])=>s.jsx(pt,{k:f,v:`← {{${h}}}`,mono:!0,accent:"var(--brand)"},f))}),n.requestBody?s.jsx(Kt,{title:"Request body",children:s.jsx("pre",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"monospace",background:"var(--bg-overlay)",border:"1px solid var(--border)",borderRadius:6,padding:10,overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:JSON.stringify(n.requestBody,null,2)})}):s.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"No request body"})]}),i==="response"&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[n.responseHeaders&&Object.keys(n.responseHeaders).length>0&&s.jsx(Kt,{title:"Response headers",children:Object.entries(n.responseHeaders).map(([f,h])=>s.jsx(pt,{k:f,v:String(h),mono:!0},f))}),n.responseBody!==void 0?s.jsx(Kt,{title:`Response body · HTTP ${n.responseStatus??n.status}`,children:s.jsx("pre",{style:{fontSize:10,color:"var(--text-secondary)",fontFamily:"monospace",background:"var(--bg-overlay)",border:"1px solid var(--border)",borderRadius:6,padding:10,overflowX:"auto",whiteSpace:"pre-wrap",wordBreak:"break-all",margin:0},children:typeof n.responseBody=="string"?n.responseBody:JSON.stringify(n.responseBody,null,2)})}):s.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"No response body recorded"})]}),i==="vars"&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[n.captureSpec&&Object.keys(n.captureSpec).length>0&&s.jsx(Kt,{title:"Capture spec (JSONPath)",children:Object.entries(n.captureSpec).map(([f,h])=>s.jsx(pt,{k:f,v:h,mono:!0,accent:"var(--brand)"},f))}),n.captured&&Object.keys(n.captured).length>0?s.jsx(Kt,{title:"Captured values",children:Object.entries(n.captured).map(([f,h])=>s.jsx(pt,{k:f,v:String(h),mono:!0,accent:"#4ade80"},f))}):s.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"No variables captured in this step"})]}),i==="conditions"&&s.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:14},children:[n.conditionResult&&s.jsx(Kt,{title:"Condition Evaluation Result",children:s.jsxs("div",{style:{padding:"8px 10px",borderRadius:6,border:`1px solid ${n.conditionResult.passed?"rgba(74,222,128,0.2)":"rgba(251,146,60,0.2)"}`,background:n.conditionResult.passed?"rgba(74,222,128,0.06)":"rgba(251,146,60,0.06)"},children:[s.jsxs("span",{style:{fontSize:11,fontWeight:600,color:n.conditionResult.passed?"#4ade80":"#fb923c"},children:["◇ Condition ",n.conditionResult.passed?"PASSED":"FAILED"]}),s.jsx("p",{style:{fontSize:10,color:"var(--text-secondary)",marginTop:4,fontFamily:"monospace"},children:n.conditionResult.reason})]})}),n.conditionSpec?s.jsxs(Kt,{title:"Condition Rules",children:[s.jsx(pt,{k:"Logic mode",v:n.conditionSpec.rules.all?"AND (all rules must pass)":"OR (any rule can pass)"}),s.jsx(pt,{k:"Failure action",v:n.conditionSpec.onFail,accent:"#fb923c"}),n.conditionSpec.switchToWorkflow&&s.jsx(pt,{k:"Switch workflow",v:n.conditionSpec.switchToWorkflow,mono:!0,accent:"var(--brand)"}),n.conditionSpec.returnOnComplete!==void 0&&s.jsx(pt,{k:"Return on complete",v:n.conditionSpec.returnOnComplete?"Yes (resumes main workflow)":"No (permanent switch)"}),s.jsxs("div",{style:{marginTop:6},children:[s.jsx("p",{style:{fontSize:9,color:"var(--text-faint)",textTransform:"uppercase",marginBottom:4},children:"Rules list"}),(n.conditionSpec.rules.all??n.conditionSpec.rules.any??[]).map((f,h)=>s.jsxs("div",{style:{fontSize:10,color:"var(--brand)",fontFamily:"monospace",background:"var(--bg-overlay)",padding:"4px 8px",borderRadius:4,marginBottom:3},children:[f.left," ",s.jsx("span",{style:{color:"var(--brand)"},children:f.operator})," ",f.right!==void 0?f.right:""]},h))]})]}):s.jsx("span",{style:{fontSize:11,color:"var(--text-faint)"},children:"No condition configured for this step"})]})]})]})}function Kt({title:n,children:r}){return s.jsxs("div",{children:[s.jsx("p",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.1em",color:"var(--text-faint)",textTransform:"uppercase",marginBottom:8},children:n}),s.jsx("div",{style:{display:"flex",flexDirection:"column",gap:5},children:r})]})}function pt({k:n,v:r,mono:o=!1,accent:i}){return s.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[s.jsx("span",{style:{fontSize:10,color:"var(--text-muted)",minWidth:100,flexShrink:0},children:n}),s.jsx("span",{style:{fontSize:10,color:i??"var(--text-secondary)",fontFamily:o?"monospace":void 0,wordBreak:"break-all"},children:r})]})}function L4({trace:n}){const[r,o]=j.useState(null),i=n.steps.reduce((f,h)=>f+h.durationMs,0)||1,u=j.useCallback(f=>{o(h=>h===f?null:f)},[]);return s.jsxs("div",{style:{display:"flex",flexDirection:"column",height:"100%",minWidth:0},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12,padding:"14px 20px",borderBottom:"1px solid var(--border)",backgroundColor:"var(--bg-elevated)",flexShrink:0},children:[s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.workflowName}),s.jsxs("p",{style:{fontSize:10,color:"var(--text-muted)",marginTop:2,display:"flex",alignItems:"center",gap:6},children:[s.jsx(Gr,{className:"h-3 w-3 inline"}),new Date(n.startedAt).toLocaleString(),n.baseUrl&&s.jsxs(s.Fragment,{children:[" · ",s.jsx("code",{className:"theme-text-faint",children:n.baseUrl})]}),"· ",s.jsx("span",{className:"theme-text-faint",children:n.source==="local-sim"?"Simulated locally":"Real API run"})]})]}),s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:6,flexShrink:0,fontSize:11,fontWeight:600,padding:"4px 12px",borderRadius:20,color:n.phase==="done"&&n.failed===0?"#4ade80":n.phase==="aborted"?"#f87171":"#fbbf24",background:n.phase==="done"&&n.failed===0?"rgba(74,222,128,0.08)":"rgba(248,113,113,0.08)",border:`1px solid ${n.phase==="done"&&n.failed===0?"rgba(74,222,128,0.2)":"rgba(248,113,113,0.2)"}`},children:[n.phase==="done"&&n.failed===0?s.jsx(ut,{className:"h-3.5 w-3.5"}):s.jsx(Ct,{className:"h-3.5 w-3.5"}),n.passed,"/",n.passed+n.failed," passed · ",n.durationMs,"ms"]})]}),s.jsxs("div",{style:{padding:"10px 20px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[s.jsxs("p",{style:{fontSize:9,fontWeight:700,letterSpacing:"0.1em",color:"var(--text-faint)",marginBottom:6,textTransform:"uppercase"},children:["Timeline · ",n.steps.length," steps · ",n.durationMs,"ms total"]}),s.jsx("div",{style:{display:"flex",gap:2,height:8,borderRadius:4,overflow:"hidden"},children:n.steps.map((f,h)=>s.jsx("div",{onClick:()=>u(h),title:`${f.method} ${f.path} — ${f.durationMs}ms`,style:{flex:f.durationMs/i,minWidth:4,background:f.passed?"#22c55e":"#ef4444",cursor:"pointer",opacity:r===h?1:.7,borderRadius:2,transition:"opacity 0.15s"}},h))}),s.jsx("div",{style:{display:"flex",gap:2,marginTop:4},children:n.steps.map((f,h)=>s.jsx("div",{style:{flex:f.durationMs/i,minWidth:4,fontSize:8,color:"var(--text-faint)",overflow:"hidden",cursor:"pointer"},onClick:()=>u(h),children:h+1},h))})]}),s.jsxs("div",{style:{flex:1,display:"flex",minHeight:0},children:[s.jsx("div",{style:{flex:1,minWidth:0,position:"relative"},children:s.jsx(B4,{trace:n,selectedStep:r,onSelectStep:u})}),r!==null&&n.steps[r]&&s.jsx(q4,{step:n.steps[r],onClose:()=>o(null)})]})]})}function Y4({trace:n,selected:r,onClick:o,onDelete:i}){const u=n.phase==="done"&&n.failed===0?"#4ade80":n.phase==="aborted"?"#f87171":"#fbbf24",f=()=>{const h=Date.now()-new Date(n.startedAt).getTime();return h<6e4?`${Math.round(h/1e3)}s ago`:h<36e5?`${Math.round(h/6e4)}m ago`:`${Math.round(h/36e5)}h ago`};return s.jsx("div",{onClick:o,style:{padding:"10px 14px",borderBottom:"1px solid var(--border)",cursor:"pointer",backgroundColor:r?"color-mix(in srgb, var(--brand) 6%, transparent)":"transparent",borderLeft:r?"3px solid var(--brand)":"3px solid transparent",transition:"background 0.1s",position:"relative"},className:"group",children:s.jsxs("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[s.jsx("div",{style:{width:8,height:8,borderRadius:"50%",background:u,flexShrink:0,marginTop:4}}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsx("p",{style:{fontSize:11,fontWeight:500,color:"var(--text-primary)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.workflowName}),s.jsxs("p",{style:{fontSize:9,color:"var(--text-muted)",marginTop:2,display:"flex",alignItems:"center",gap:4},children:[s.jsx(Gr,{className:"h-2.5 w-2.5 inline shrink-0"}),f()," · ",n.steps.length," steps · ",n.durationMs,"ms"]}),s.jsxs("div",{style:{display:"flex",gap:4,marginTop:4,flexWrap:"wrap"},children:[n.passed>0&&s.jsxs("span",{style:{fontSize:9,color:"#4ade80",background:"rgba(74,222,128,0.08)",border:"1px solid rgba(74,222,128,0.2)",borderRadius:4,padding:"1px 5px"},children:[n.passed," ✓"]}),n.failed>0&&s.jsxs("span",{style:{fontSize:9,color:"#f87171",background:"rgba(248,113,113,0.08)",border:"1px solid rgba(248,113,113,0.2)",borderRadius:4,padding:"1px 5px"},children:[n.failed," ✗"]}),s.jsx("span",{style:{fontSize:9,color:"var(--text-faint)",background:"var(--bg-overlay)",border:"1px solid var(--border)",borderRadius:4,padding:"1px 5px"},children:n.source==="local-sim"?"sim":"api"}),n.steps.some(h=>h.conditionSpec||h.conditionResult)&&s.jsxs("span",{style:{fontSize:9,color:"var(--brand)",background:"color-mix(in srgb, var(--brand) 8%, transparent)",border:"1px solid color-mix(in srgb, var(--brand) 20%, transparent)",borderRadius:4,padding:"1px 5px",display:"flex",alignItems:"center",gap:2},children:[s.jsx(ea,{style:{width:8,height:8}})," cond"]})]})]}),s.jsx("button",{onClick:h=>{h.stopPropagation(),i()},style:{opacity:0,transition:"opacity 0.1s",color:"var(--text-faint)",display:"flex",alignItems:"center",padding:2,borderRadius:4},className:"group-hover:opacity-100",title:"Delete trace",children:s.jsx(Yt,{className:"h-3 w-3"})})]})})}function V4(){return s.jsxs("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",gap:12,padding:"40px 20px",textAlign:"center"},children:[s.jsxs("div",{style:{position:"relative",width:52,height:52,display:"flex",alignItems:"center",justifyContent:"center"},children:[s.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"color-mix(in srgb, var(--brand) 10%, transparent)",filter:"blur(8px)"}}),s.jsx("div",{style:{position:"relative",width:52,height:52,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--border)",backgroundColor:"var(--bg-overlay)",color:"var(--brand)"},children:s.jsx(Vr,{className:"h-6 w-6"})})]}),s.jsx("p",{style:{fontSize:12,fontWeight:500,color:"var(--text-secondary)"},children:"No traces yet"}),s.jsx("p",{style:{fontSize:10,color:"var(--text-muted)",maxWidth:200},children:"Run a simulation from the Simulations page to generate a trace."})]})}function G4(){return s.jsxs("div",{style:{display:"flex",flex:1,flexDirection:"column",alignItems:"center",justifyContent:"center",gap:14,textAlign:"center",padding:32},children:[s.jsxs("div",{style:{position:"relative",width:64,height:64,display:"flex",alignItems:"center",justifyContent:"center"},children:[s.jsx("div",{style:{position:"absolute",inset:0,borderRadius:"50%",background:"color-mix(in srgb, var(--brand) 10%, transparent)",filter:"blur(12px)"}}),s.jsx("div",{style:{position:"relative",width:64,height:64,borderRadius:"50%",display:"flex",alignItems:"center",justifyContent:"center",border:"1px solid var(--border)",backgroundColor:"var(--bg-overlay)",color:"var(--brand)"},children:s.jsx(Vi,{className:"h-8 w-8"})})]}),s.jsxs("div",{children:[s.jsx("p",{style:{fontSize:14,fontWeight:600,color:"var(--text-secondary)"},children:"Select a trace"}),s.jsx("p",{style:{fontSize:11,color:"var(--text-muted)",marginTop:4},children:"Pick a run from the list to visualize its execution graph"})]}),s.jsxs("div",{style:{border:"1px solid var(--border)",borderRadius:10,padding:"12px 16px",backgroundColor:"var(--bg-overlay)",maxWidth:340,textAlign:"left"},children:[s.jsx("p",{style:{fontSize:10,fontWeight:600,color:"var(--text-faint)",marginBottom:8,textTransform:"uppercase",letterSpacing:"0.08em"},children:"What you'll see"}),[["HTTP step nodes","Every request in the workflow shown as a graph node with method, path, status, and timing"],["Memory nodes","Variables captured from responses (tokens, IDs, etc.) shown in between steps"],["Branch forks","Conditions that switch workflows peel off into a side branch, then merge back if they resume"],["Execution flow","Arrows colored green/red showing the success/failure path through your workflow"],["Step detail drawer","Click any node to see full request/response bodies, headers, and capture specs"]].map(([n,r])=>s.jsxs("div",{style:{display:"flex",gap:8,marginBottom:8},children:[s.jsx("span",{style:{color:"var(--brand)",flexShrink:0,marginTop:1},children:"→"}),s.jsxs("div",{children:[s.jsx("span",{style:{fontSize:11,fontWeight:500,color:"var(--text-secondary)"},children:n}),s.jsx("p",{style:{fontSize:10,color:"var(--text-muted)",marginTop:1},children:r})]})]},n))]})]})}function X4({initialFilter:n,onNavigate:r}){const[o,i]=j.useState([]),[u,f]=j.useState(!0),[h,g]=j.useState(""),[x,m]=j.useState(null),p=j.useRef(!1),b=j.useCallback(async()=>{f(!0);try{const k=await xx();if(i(k),!p.current&&n?.traceId){const R=k.find(z=>z.id===n.traceId);R&&(m(R),p.current=!0)}else if(!p.current&&n?.workflowName&&k.length>0){const R=k.find(z=>z.workflowName===n.workflowName);R&&(m(R),p.current=!0)}}finally{f(!1)}},[n?.traceId,n?.workflowName]);j.useEffect(()=>{b()},[b]),j.useEffect(()=>{const k=setInterval(()=>{xx().then(R=>{(R.length!==o.length||R.some((z,V)=>z.id!==o[V]?.id))&&i(R)}).catch(()=>{})},5e3);return()=>clearInterval(k)},[o]),j.useEffect(()=>{if(n?.traceId&&o.length>0){const k=o.find(R=>R.id===n.traceId);k&&m(k)}},[n?.traceId,o]);const v=async k=>{await k2(k),x?.id===k&&m(null),i(R=>R.filter(z=>z.id!==k))},N=async()=>{confirm("Delete all traces? This cannot be undone.")&&(await _2(),i([]),m(null))},C=o.filter(k=>!h.trim()||k.workflowName.toLowerCase().includes(h.toLowerCase())||k.steps.some(R=>R.path.toLowerCase().includes(h.toLowerCase())));return s.jsxs("div",{style:{display:"flex",height:"100%"},className:"w-full",children:[s.jsxs("div",{style:{width:280,flexShrink:0,display:"flex",flexDirection:"column",borderRight:"1px solid var(--border)",backgroundColor:"var(--bg-surface)"},children:[s.jsxs("div",{style:{padding:"14px 14px 10px",borderBottom:"1px solid var(--border)",backgroundColor:"var(--bg-elevated)",flexShrink:0},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:10},children:[s.jsxs("div",{children:[s.jsx("p",{style:{fontSize:13,fontWeight:600,color:"var(--text-primary)",lineHeight:1},children:"Traces"}),s.jsx("p",{style:{fontSize:10,color:"var(--text-muted)",marginTop:3},children:u?"Loading…":`${o.length} run${o.length!==1?"s":""} stored`})]}),s.jsxs("div",{style:{display:"flex",gap:6},children:[s.jsx("button",{onClick:b,title:"Refresh",style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:7,border:"1px solid var(--border)",background:"var(--bg-overlay)",color:"var(--text-muted)",cursor:"pointer"},children:s.jsx(na,{className:"h-3.5 w-3.5"})}),o.length>0&&s.jsx("button",{onClick:N,title:"Clear all",style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,borderRadius:7,border:"1px solid rgba(239,68,68,0.25)",background:"rgba(239,68,68,0.06)",color:"#f87171",cursor:"pointer"},children:s.jsx(Yt,{className:"h-3.5 w-3.5"})})]})]}),s.jsxs("div",{style:{position:"relative"},children:[s.jsx(zi,{style:{position:"absolute",left:8,top:"50%",transform:"translateY(-50%)",width:13,height:13,color:"var(--text-faint)",pointerEvents:"none"}}),s.jsx("input",{value:h,onChange:k=>g(k.target.value),placeholder:"Search traces…",style:{width:"100%",paddingLeft:28,paddingRight:h?28:10,paddingTop:6,paddingBottom:6,fontSize:11,border:"1px solid var(--border)",borderRadius:8,backgroundColor:"var(--bg-overlay)",color:"var(--text-secondary)",outline:"none",boxSizing:"border-box"}}),h&&s.jsx("button",{onClick:()=>g(""),style:{position:"absolute",right:8,top:"50%",transform:"translateY(-50%)",color:"var(--text-faint)",display:"flex",background:"none",border:"none",cursor:"pointer",padding:0},children:s.jsx(Tt,{className:"h-3 w-3"})})]})]}),s.jsxs("div",{style:{flex:1,overflowY:"auto"},children:[u&&s.jsx("div",{style:{padding:16,display:"flex",flexDirection:"column",gap:8},children:[1,2,3].map(k=>s.jsx("div",{style:{height:64,borderRadius:8,border:"1px solid var(--border)",backgroundColor:"var(--bg-overlay)",opacity:1-k*.25,animation:"pulse 2s cubic-bezier(0.4,0,0.6,1) infinite"}},k))}),!u&&C.length===0&&s.jsx(V4,{}),!u&&C.map(k=>s.jsx(Y4,{trace:k,selected:x?.id===k.id,onClick:()=>m(k),onDelete:()=>v(k.id)},k.id))]}),r&&s.jsxs("div",{style:{padding:"10px 14px",borderTop:"1px solid var(--border)",display:"flex",gap:10},children:[s.jsxs("button",{onClick:()=>r("simulations"),style:{display:"flex",alignItems:"center",gap:4,fontSize:10,color:"var(--brand)",background:"none",border:"none",cursor:"pointer",padding:0},children:[s.jsx(ea,{className:"h-3 w-3"})," Simulations ",s.jsx(Md,{className:"h-2.5 w-2.5"})]}),s.jsxs("button",{onClick:()=>r("model"),style:{display:"flex",alignItems:"center",gap:4,fontSize:10,color:"var(--brand)",background:"none",border:"none",cursor:"pointer",padding:0},children:[s.jsx(A0,{className:"h-3 w-3"})," Model ",s.jsx(Md,{className:"h-2.5 w-2.5"})]})]})]}),s.jsx("div",{style:{flex:1,minWidth:0,display:"flex",flexDirection:"column",backgroundColor:"var(--bg-base)"},children:x?s.jsx(L4,{trace:x,onNavigate:r}):s.jsx(G4,{})})]})}function Z4(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Events"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Stream of events emitted by the workspace."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}function W4(n){const r=n.split(".").pop()?.toLowerCase()??"";return["ts","tsx","js","jsx","mjs","py","go","rs"].includes(r)?{icon:hv,color:"text-[color:var(--brand)]"}:["json","yaml","yml","toml","env"].includes(r)?{icon:Fd,color:"text-amber-400"}:["sql","prisma","graphql","gql"].includes(r)?{icon:fl,color:"text-emerald-400"}:{icon:xv,color:"theme-text-muted"}}function Q4(n){try{const r=Math.floor((Date.now()-new Date(n).getTime())/1e3);return r<5?"just now":r<60?`${r}s ago`:r<3600?`${Math.floor(r/60)}m ago`:r<86400?`${Math.floor(r/3600)}h ago`:new Date(n).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}catch{return""}}function K4({onNavigate:n}={}){const[r,o]=j.useState(null),[i,u]=j.useState(!0),[f,h]=j.useState(null),[g,x]=j.useState(!1),[m,p]=j.useState(""),[b,v]=j.useState(null),[N,C]=j.useState(!1),k=j.useCallback(async(M=!1)=>{M||u(!0);try{const H=await fetch("/api/changes");if(!H.ok)throw new Error(`HTTP ${H.status}`);o(await H.json()),h(null)}catch(H){h(H.message??"Failed to fetch changes")}finally{M||u(!1)}},[]),R=async()=>{if(!N){C(!0);try{await fetch("/api/changes",{method:"DELETE"}),await k(!0)}catch(M){alert(`Clear failed: ${M.message}`)}finally{C(!1)}}},z=M=>{navigator.clipboard.writeText(M),v(M),setTimeout(()=>v(null),2e3)};j.useEffect(()=>{k();let M=null,H=null;try{M=new EventSource("/api/changes/stream"),M.onopen=()=>x(!0),M.onmessage=Z=>{try{o(JSON.parse(Z.data))}catch{}},M.onerror=()=>{x(!1),H||(H=setInterval(()=>k(!0),2e3))}}catch{H=setInterval(()=>k(!0),2e3)}return()=>{M?.close(),H&&clearInterval(H)}},[k]);const V=j.useMemo(()=>{if(!r?.changes)return[];if(!m)return r.changes;const M=m.toLowerCase();return r.changes.filter(H=>H.filePath.toLowerCase().includes(M))},[r,m]),q=r?.changes?.length??0;return s.jsxs("div",{className:"flex flex-1 flex-col min-h-0 theme-bg-base theme-text-primary",children:[s.jsxs("div",{className:"flex items-center justify-between px-5 py-3.5 border-b theme-border theme-sidebar",children:[s.jsxs("div",{className:"flex items-center gap-2.5",children:[s.jsx(T0,{className:"h-[15px] w-[15px] shrink-0 theme-text-muted",strokeWidth:2}),s.jsx("span",{className:"text-[13.5px] font-medium tracking-tight theme-text-primary",children:"File Changes"}),q>0&&s.jsx("span",{className:"rounded-full px-2 py-0.5 text-[11px] font-medium border theme-border theme-bg-overlay-md theme-text-muted",children:q}),s.jsxs("div",{className:"flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[11px] font-medium border theme-border theme-bg-overlay theme-text-muted",children:[s.jsx("span",{className:`h-1.5 w-1.5 rounded-full ${g?"theme-bg-brand animate-pulse":"bg-[var(--text-faint)]"}`}),g?"Live":"Polling"]})]}),s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsxs("button",{type:"button",onClick:()=>k(!1),disabled:i,className:"flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium transition-colors border theme-border theme-bg-overlay theme-text-muted",children:[s.jsx(na,{className:`h-3 w-3 shrink-0 ${i?"animate-spin":""}`,strokeWidth:2}),"Refresh"]}),s.jsxs("button",{type:"button",onClick:R,disabled:N||q===0,className:"flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-medium transition-colors disabled:opacity-40 border theme-border theme-bg-overlay theme-text-muted",children:[s.jsx(Yt,{className:"h-3 w-3 shrink-0",strokeWidth:2}),N?"Clearing…":"Clear"]})]})]}),s.jsx("div",{className:"px-4 py-2.5 border-b theme-border",children:s.jsxs("div",{className:"relative",children:[s.jsx(zi,{className:"absolute left-2.5 top-1/2 h-3 w-3 -translate-y-1/2 shrink-0 theme-text-faint",strokeWidth:2}),s.jsx("input",{type:"text",placeholder:"Filter by filename or path…",value:m,onChange:M=>p(M.target.value),className:"w-full rounded-lg py-1.5 pl-8 pr-3 text-[12px] focus:outline-none focus:ring-1 focus:ring-[color:var(--brand)]/50 border theme-border theme-bg-overlay theme-text-primary"}),m&&s.jsx("button",{type:"button",onClick:()=>p(""),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-[10px] theme-text-muted",children:"Clear"})]})}),f&&s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 text-[11px] border-b theme-border theme-text-muted",children:[s.jsx(Ct,{className:"h-3.5 w-3.5 shrink-0 text-red-400",strokeWidth:2}),f]}),s.jsx("div",{className:"flex flex-1 flex-col overflow-y-auto",children:i&&!r?s.jsxs("div",{className:"flex items-center justify-center gap-2 p-10 theme-text-muted",children:[s.jsx(na,{className:"h-4 w-4 animate-spin text-[color:var(--brand)]",strokeWidth:2}),s.jsx("span",{className:"text-[12px]",children:"Connecting…"})]}):V.length===0?s.jsxs("div",{className:"flex flex-col items-center justify-center gap-1 p-10 text-center",children:[s.jsx(ut,{className:"h-5 w-5 mb-1 text-[color:var(--brand)]",strokeWidth:2}),s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:q===0?"No pending changes":"No files match filter"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:q===0?"File edits appear here in real-time.":"Try a different search."})]}):V.map(M=>{const{icon:H,color:Z}=W4(M.filePath),X=M.filePath.split("/"),oe=X.pop()??M.filePath,I=X.join("/"),K=b===M.filePath;return s.jsxs("div",{className:"flex items-center gap-3 px-4 py-2.5 transition-colors hover:theme-bg-overlay border-b theme-border",children:[s.jsx(H,{className:`h-[15px] w-[15px] shrink-0 ${Z}`,strokeWidth:1.75}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[s.jsx("span",{className:"truncate text-[12.5px] font-medium theme-text-primary",children:oe}),I&&s.jsxs("span",{className:"truncate text-[11px] theme-text-faint",children:[I,"/"]})]}),s.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[s.jsx("span",{className:"rounded px-1.5 py-0.5 text-[10px] border theme-border theme-bg-overlay theme-text-faint",children:M.eventType}),s.jsx("span",{className:"w-14 text-right text-[11px] theme-text-muted",children:Q4(M.changedAt)}),s.jsx("button",{type:"button",onClick:()=>z(M.filePath),title:"Copy path",className:"flex h-6 w-6 items-center justify-center rounded transition-colors border theme-border theme-bg-overlay theme-text-faint",children:K?s.jsx(ut,{className:"h-3 w-3 text-[color:var(--brand)]",strokeWidth:2}):s.jsx(C0,{className:"h-3 w-3",strokeWidth:2})})]})]},M.filePath)})})]})}function xs({icon:n,label:r,description:o}){return s.jsxs("div",{className:"flex items-start gap-3 pb-4 border-b theme-border",children:[s.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-lg border theme-border theme-bg-overlay",children:s.jsx(n,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[13.5px] font-medium theme-text-primary",children:r}),o&&s.jsx("p",{className:"mt-0.5 text-[11px] theme-text-muted",children:o})]})]})}function lt({label:n,description:r,children:o}){return s.jsxs("div",{className:"flex items-center justify-between gap-4 py-3 border-b theme-border last:border-0",children:[s.jsxs("div",{className:"min-w-0",children:[s.jsx("p",{className:"text-[13px] theme-text-primary",children:n}),r&&s.jsx("p",{className:"text-[11px] theme-text-muted mt-0.5",children:r})]}),s.jsx("div",{className:"shrink-0",children:o})]})}function ln({value:n,onChange:r}){return s.jsx("button",{onClick:()=>r(!n),className:`relative flex h-5 w-9 items-center rounded-full border transition-colors ${n?"bg-[var(--action)] border-[color:var(--brand)]":"theme-bg-overlay-md theme-border"}`,children:s.jsx("span",{className:`absolute h-3.5 w-3.5 rounded-full bg-[color:var(--action-foreground)] shadow transition-transform ${n?"translate-x-4":"translate-x-0.5"}`})})}function J4({value:n,onChange:r,placeholder:o,mono:i=!1,type:u="text"}){return s.jsx("input",{type:u,value:n,onChange:f=>r(f.target.value),placeholder:o,className:`w-56 rounded-lg border theme-border theme-bg-overlay px-3 py-1.5 text-[12px] theme-text-primary outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md placeholder:theme-text-faint transition-colors ${i?"font-mono":""}`})}function bl({value:n,onChange:r,options:o}){return s.jsx("select",{value:n,onChange:i=>r(i.target.value),className:"rounded-lg border theme-border theme-bg-surface px-3 py-1.5 text-[12px] theme-text-primary outline-none focus:border-[color:var(--brand)]/50 transition-colors",children:o.map(i=>s.jsx("option",{value:i,children:i},i))})}function gs({children:n,className:r=""}){return s.jsx("div",{className:`rounded-lg border theme-border theme-bg-overlay p-5 space-y-1 ${r}`,children:n})}function wy({saving:n,onClick:r}){return s.jsxs("button",{onClick:r,disabled:n,className:"flex items-center gap-1.5 rounded-lg bg-[var(--action)] px-3 py-1.5 text-[12px] font-medium text-[color:var(--action-foreground)] hover:bg-[var(--action-hover)] disabled:opacity-50 transition-colors",children:[n?s.jsx(dt,{className:"h-3.5 w-3.5 animate-spin",strokeWidth:2}):s.jsx(Zv,{className:"h-3.5 w-3.5",strokeWidth:2}),n?"Saving…":"Save"]})}const I4=[{id:"general",label:"General",icon:zr},{id:"environments",label:"Environments",icon:jl},{id:"appearance",label:"Appearance",icon:z0},{id:"editor",label:"Editor",icon:Vi},{id:"notifications",label:"Notifications",icon:_0},{id:"api",label:"API & Auth",icon:La},{id:"advanced",label:"Advanced",icon:O0}];function F4({model:n}){const[r,o]=j.useState(n?.project?.name??""),[i,u]=j.useState(n?.project?.language??"TypeScript"),[f,h]=j.useState(n?.project?.framework??"Express"),[g,x]=j.useState(!1),[m,p]=j.useState(!1);j.useEffect(()=>{o(n?.project?.name??""),u(n?.project?.language??"TypeScript"),h(n?.project?.framework??"Express")},[n]);const b=async()=>{x(!0),await new Promise(v=>setTimeout(v,600)),x(!1),p(!0),setTimeout(()=>p(!1),2e3)};return s.jsxs("div",{className:"space-y-5",children:[s.jsx(xs,{icon:zr,label:"General",description:"Project identity and basic configuration"}),s.jsxs(gs,{children:[s.jsx(lt,{label:"Project Name",description:"Display name shown in the dashboard",children:s.jsx(J4,{value:r,onChange:o,placeholder:"My API"})}),s.jsx(lt,{label:"Language",description:"Primary language of your backend",children:s.jsx(bl,{value:i,onChange:u,options:["TypeScript","JavaScript","Python","Go","Rust"]})}),s.jsx(lt,{label:"Framework",description:"HTTP framework used by your server",children:s.jsx(bl,{value:f,onChange:h,options:["Express","Fastify","Hono","Koa","NestJS","Other"]})}),s.jsxs("div",{className:"flex justify-end pt-2 gap-2",children:[m&&s.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-emerald-400",children:[s.jsx(ut,{className:"h-3.5 w-3.5",strokeWidth:2})," Saved"]}),s.jsx(wy,{saving:g,onClick:b})]})]})]})}function P4({model:n}){const[r,o]=j.useState(n?.environments??[{name:"local",baseUrl:"http://localhost:3000"}]),[i,u]=j.useState(!1),[f,h]=j.useState(!1);j.useEffect(()=>{o(n?.environments??[{name:"local",baseUrl:"http://localhost:3000"}])},[n]);const g=()=>o(b=>[...b,{name:"",baseUrl:""}]),x=b=>o(v=>v.filter((N,C)=>C!==b)),m=(b,v,N)=>o(C=>C.map((k,R)=>R===b?{...k,[v]:N}:k)),p=async()=>{u(!0),await new Promise(b=>setTimeout(b,600)),u(!1),h(!0),setTimeout(()=>h(!1),2e3)};return s.jsxs("div",{className:"space-y-5",children:[s.jsx(xs,{icon:jl,label:"Environments",description:"Configure your API base URLs for simulation"}),s.jsxs(gs,{children:[s.jsxs("div",{className:"space-y-2",children:[s.jsxs("div",{className:"flex items-center gap-4 px-1 mb-2",children:[s.jsx("p",{className:"w-24 text-[10px] uppercase tracking-wider theme-text-faint font-semibold",children:"Name"}),s.jsx("p",{className:"flex-1 text-[10px] uppercase tracking-wider theme-text-faint font-semibold",children:"Base URL"})]}),r.map((b,v)=>s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx("input",{value:b.name,onChange:N=>m(v,"name",N.target.value),placeholder:"local",className:"w-24 rounded-lg border theme-border theme-bg-overlay px-3 py-1.5 text-[12px] theme-text-primary outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md placeholder:theme-text-faint transition-colors"}),s.jsx("input",{value:b.baseUrl,onChange:N=>m(v,"baseUrl",N.target.value),placeholder:"http://localhost:3000",className:"flex-1 rounded-lg border theme-border theme-bg-overlay px-3 py-1.5 font-mono text-[12px] theme-text-primary outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md placeholder:theme-text-faint transition-colors"}),s.jsx("button",{onClick:()=>x(v),className:"flex h-7 w-7 items-center justify-center rounded-lg border theme-border theme-bg-overlay theme-text-muted hover:bg-red-500/10 hover:border-red-500/30 hover:text-red-400 transition-colors",children:s.jsx(Tt,{className:"h-3.5 w-3.5",strokeWidth:2})})]},v)),s.jsx("button",{onClick:g,className:"text-[12px] text-[color:var(--brand)] hover:text-[color:var(--brand)] transition-colors mt-1",children:"+ Add environment"})]}),s.jsxs("div",{className:"flex justify-end pt-3 gap-2 border-t theme-border",children:[f&&s.jsxs("span",{className:"flex items-center gap-1 text-[11px] text-emerald-400",children:[s.jsx(ut,{className:"h-3.5 w-3.5",strokeWidth:2})," Saved"]}),s.jsx(wy,{saving:i,onClick:p})]})]}),s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay px-4 py-3 flex items-start gap-2.5",children:[s.jsx(Nv,{className:"h-3.5 w-3.5 text-[color:var(--brand)]/70 shrink-0 mt-0.5",strokeWidth:2}),s.jsxs("p",{className:"text-[11px] theme-text-muted",children:["The"," ",s.jsx("code",{className:"theme-text-primary theme-bg-overlay-md px-1 py-0.5 rounded text-[10px]",children:"local"})," ","environment is used as the default base URL for simulations and endpoint testing."]})]})]})}function eE(){const[n,r]=j.useState("dark"),[o,i]=j.useState("blue"),[u,f]=j.useState("comfortable"),[h,g]=j.useState(!0),x=["blue","violet","emerald","amber","rose"],m={blue:"var(--brand)",violet:"var(--brand)",emerald:"#34d399",amber:"#fbbf24",rose:"#fb7185"};return s.jsxs("div",{className:"space-y-5",children:[s.jsx(xs,{icon:z0,label:"Appearance",description:"Customize the look and feel of the dashboard"}),s.jsxs(gs,{children:[s.jsx(lt,{label:"Theme",description:"Choose your preferred colour scheme",children:s.jsx("div",{className:"flex gap-px overflow-hidden rounded-lg border theme-border",children:["dark","darker"].map(p=>s.jsx("button",{onClick:()=>r(p),className:`px-3 py-1.5 text-[12px] transition-colors capitalize ${n===p?"bg-[var(--action)] text-[color:var(--action-foreground)]":"theme-text-muted hover:theme-text-primary theme-bg-overlay hover:theme-bg-overlay-md"}`,children:p},p))})}),s.jsx(lt,{label:"Accent Colour",description:"Primary highlight colour throughout the UI",children:s.jsx("div",{className:"flex items-center gap-2",children:x.map(p=>s.jsx("button",{onClick:()=>i(p),className:`h-5 w-5 rounded-full border-2 transition-transform ${o===p?"scale-110 theme-border-md":"border-transparent hover:scale-105"}`,style:{background:m[p]}},p))})}),s.jsx(lt,{label:"Density",description:"Controls spacing throughout the layout",children:s.jsx("div",{className:"flex gap-px overflow-hidden rounded-lg border theme-border",children:["comfortable","compact"].map(p=>s.jsx("button",{onClick:()=>f(p),className:`px-3 py-1.5 text-[12px] transition-colors capitalize ${u===p?"bg-[var(--action)] text-[color:var(--action-foreground)]":"theme-text-muted hover:theme-text-primary theme-bg-overlay hover:theme-bg-overlay-md"}`,children:p},p))})}),s.jsx(lt,{label:"Animations",description:"Smooth transitions and micro-animations",children:s.jsx(ln,{value:h,onChange:g})})]})]})}function tE(){const[n,r]=j.useState("11"),[o,i]=j.useState("2"),[u,f]=j.useState(!0),[h,g]=j.useState(!0),[x,m]=j.useState(!0);return s.jsxs("div",{className:"space-y-5",children:[s.jsx(xs,{icon:Vi,label:"Editor",description:"Source viewer and code display preferences"}),s.jsxs(gs,{children:[s.jsx(lt,{label:"Font Size",description:"Monospace font size in the source viewer",children:s.jsx(bl,{value:n,onChange:r,options:["10","11","12","13","14"]})}),s.jsx(lt,{label:"Tab Size",description:"Number of spaces per indentation level",children:s.jsx(bl,{value:o,onChange:i,options:["2","4","8"]})}),s.jsx(lt,{label:"Word Wrap",description:"Wrap long lines in the source viewer",children:s.jsx(ln,{value:u,onChange:f})}),s.jsx(lt,{label:"Line Numbers",description:"Show line numbers in the source viewer gutter",children:s.jsx(ln,{value:h,onChange:g})}),s.jsx(lt,{label:"Highlight Handler Line",description:"Highlight the matched handler line in source view",children:s.jsx(ln,{value:x,onChange:m})})]})]})}function nE(){const[n,r]=j.useState(!0),[o,i]=j.useState(!0),[u,f]=j.useState(!0),[h,g]=j.useState(!1),[x,m]=j.useState(!1);return s.jsxs("div",{className:"space-y-5",children:[s.jsx(xs,{icon:_0,label:"Notifications",description:"Control when and how you're notified"}),s.jsxs(gs,{children:[s.jsx(lt,{label:"Scan complete",description:"Notify when a project scan finishes",children:s.jsx(ln,{value:n,onChange:r})}),s.jsx(lt,{label:"Simulation complete",description:"Notify when a workflow run finishes",children:s.jsx(ln,{value:o,onChange:i})}),s.jsx(lt,{label:"Simulation failure",description:"Notify when a workflow step fails",children:s.jsx(ln,{value:u,onChange:f})}),s.jsx(lt,{label:"Memory updates",description:"Notify on runtime memory changes",children:s.jsx(ln,{value:h,onChange:g})}),s.jsx(lt,{label:"Desktop notifications",description:"Show browser push notifications",children:s.jsx(ln,{value:x,onChange:m})})]})]})}function aE(){const[n,r]=j.useState(""),[o,i]=j.useState("10000"),[u,f]=j.useState(!1),[h,g]=j.useState(!1);return s.jsxs("div",{className:"space-y-5",children:[s.jsx(xs,{icon:La,label:"API & Auth",description:"Default request settings for endpoint simulation"}),s.jsxs(gs,{children:[s.jsx(lt,{label:"Default Bearer Token",description:"Pre-fill bearer token in simulate panels",children:s.jsxs("div",{className:"flex items-center gap-1.5",children:[s.jsx("input",{type:h?"text":"password",value:n,onChange:x=>r(x.target.value),placeholder:"eyJ…",className:"w-48 rounded-lg border theme-border theme-bg-overlay px-3 py-1.5 font-mono text-[12px] theme-text-primary outline-none focus:border-[color:var(--brand)]/50 focus:theme-bg-overlay-md placeholder:text-[color:var(--text-muted)] transition-colors"}),s.jsx("button",{onClick:()=>g(x=>!x),className:"text-[11px] theme-text-muted hover:theme-text transition-colors",children:h?"Hide":"Show"})]})}),s.jsx(lt,{label:"Request Timeout",description:"Milliseconds before a simulated request times out",children:s.jsx(bl,{value:o,onChange:i,options:["5000","10000","15000","30000","60000"]})}),s.jsx(lt,{label:"Auto-retry on 5xx",description:"Automatically retry failed requests once",children:s.jsx(ln,{value:u,onChange:f})})]})]})}function sE({onClearMemory:n}){const[r,o]=j.useState(!1),[i,u]=j.useState(!1),[f,h]=j.useState(!1),[g,x]=j.useState("30"),[m,p]=j.useState(!1),[b,v]=j.useState(!1),N=async()=>{p(!0),await new Promise(C=>setTimeout(C,800)),p(!1),v(!0),setTimeout(()=>v(!1),2e3),n()};return s.jsxs("div",{className:"space-y-5",children:[s.jsx(xs,{icon:O0,label:"Advanced",description:"Developer and diagnostic options"}),s.jsxs(gs,{children:[s.jsx(lt,{label:"Scan on start",description:"Auto-scan project when the dashboard loads",children:s.jsx(ln,{value:r,onChange:o})}),s.jsx(lt,{label:"Auto-refresh model",description:"Periodically reload model.json from disk",children:s.jsx(ln,{value:f,onChange:h})}),f&&s.jsx(lt,{label:"Refresh interval",description:"How often to poll for model changes",children:s.jsx(bl,{value:g,onChange:x,options:["10","30","60","120"]})}),s.jsx(lt,{label:"Debug mode",description:"Verbose logging in the browser console",children:s.jsx(ln,{value:i,onChange:u})})]}),s.jsxs("div",{className:"rounded-lg border border-red-500/20 bg-red-500/[0.03] overflow-hidden",children:[s.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b border-red-500/10",children:[s.jsx(Yt,{className:"h-[15px] w-[15px] text-red-400/60",strokeWidth:2}),s.jsx("span",{className:"text-[11px] font-semibold tracking-wider text-red-400/70",children:"DANGER ZONE"})]}),s.jsxs("div",{className:"p-4 space-y-4",children:[s.jsxs("div",{className:"flex items-center justify-between gap-4",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[13px] theme-text-primary",children:"Clear Runtime Memory"}),s.jsx("p",{className:"text-[11px] theme-text-muted mt-0.5",children:"Delete all stored memory keys and values"})]}),s.jsxs("button",{onClick:N,disabled:m,className:"flex items-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/[0.06] px-3 py-1.5 text-[12px] text-red-400 hover:bg-red-500/10 disabled:opacity-50 transition-colors",children:[m?s.jsx(dt,{className:"h-3.5 w-3.5 animate-spin",strokeWidth:2}):b?s.jsx(ut,{className:"h-3.5 w-3.5",strokeWidth:2}):s.jsx(Yt,{className:"h-3.5 w-3.5",strokeWidth:2}),m?"Clearing…":b?"Cleared":"Clear Memory"]})]}),s.jsxs("div",{className:"flex items-center justify-between gap-4 pt-3 border-t border-red-500/10",children:[s.jsxs("div",{children:[s.jsx("p",{className:"text-[13px] theme-text-primary",children:"Reset Model"}),s.jsxs("p",{className:"text-[11px] theme-text-muted mt-0.5",children:["Delete"," ",s.jsx("code",{className:"theme-text-muted theme-bg-overlay-md px-1 py-0.5 rounded text-[10px]",children:".jetic/model.json"})," ","and start fresh"]})]}),s.jsxs("button",{className:"flex items-center gap-1.5 rounded-lg border border-red-500/30 bg-red-500/[0.06] px-3 py-1.5 text-[12px] text-red-400 hover:bg-red-500/10 transition-colors",children:[s.jsx(Yt,{className:"h-3.5 w-3.5",strokeWidth:2})," Reset Model"]})]})]})]})]})}function lE(){return s.jsxs("div",{className:"rounded-lg border theme-border theme-bg-overlay p-4 flex items-center gap-3",children:[s.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-lg border theme-border theme-bg-overlay-md",children:s.jsx(hs,{className:"h-[15px] w-[15px] text-[color:var(--brand)]",strokeWidth:2})}),s.jsxs("div",{children:[s.jsx("p",{className:"text-[13.5px] font-medium theme-text-primary",children:"Jetic Studio"}),s.jsx("p",{className:"text-[11px] theme-text-muted",children:"v0.1.0 · Local development dashboard"})]}),s.jsxs("div",{className:"ml-auto flex items-center gap-1.5 rounded-full border theme-border theme-bg-overlay px-2.5 py-1",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full theme-bg-brand animate-pulse"}),s.jsx("span",{className:"text-[11px] theme-text-muted font-medium",children:"Running"})]})]})}function rE({icon:n,label:r,active:o,onClick:i}){return s.jsxs("button",{type:"button",onClick:i,className:`relative flex w-full items-center gap-3 rounded-lg px-3 py-1.5 text-left text-[13.5px] transition-colors ${o?"theme-bg-overlay-md theme-text-primary font-medium":"theme-text-muted hover:theme-bg-overlay hover:theme-text-primary"}`,children:[o&&s.jsx("span",{className:"absolute -left-3 top-1/2 h-4 w-[3px] -translate-y-1/2 rounded-full theme-bg-brand"}),s.jsx(n,{className:"h-[15px] w-[15px] shrink-0",strokeWidth:2}),s.jsx("span",{children:r}),o&&s.jsx(vl,{className:"ml-auto h-3.5 w-3.5 opacity-40",strokeWidth:2})]})}function oE(){const[n,r]=j.useState("general"),[o,i]=j.useState(null),[u,f]=j.useState(!0);j.useEffect(()=>{fetch("/api/model").then(g=>g.ok?g.json():null).then(g=>i(g)).catch(()=>{}).finally(()=>f(!1))},[]);const h=()=>{switch(n){case"general":return s.jsx(F4,{model:o});case"environments":return s.jsx(P4,{model:o});case"appearance":return s.jsx(eE,{});case"editor":return s.jsx(tE,{});case"notifications":return s.jsx(nE,{});case"api":return s.jsx(aE,{});case"advanced":return s.jsx(sE,{onClearMemory:()=>{}});default:return null}};return s.jsxs("div",{className:"flex min-h-full w-full flex-col",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium theme-text-primary leading-none",children:"Settings"}),s.jsx("p",{className:"mt-0.5 text-[11px] theme-text-muted",children:"Configure Jetic Studio"})]})}),s.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[s.jsxs("nav",{className:"w-52 shrink-0 border-r theme-border theme-sidebar select-none overflow-y-auto p-3 space-y-0.5",children:[s.jsx("span",{className:"px-3 pb-1.5 pt-1 block text-[11px] font-semibold tracking-wider theme-text-muted",children:"CONFIGURATION"}),s.jsx("div",{className:"flex flex-col gap-0.5",children:I4.map(({id:g,label:x,icon:m})=>s.jsx(rE,{icon:m,label:x,active:n===g,onClick:()=>r(g)},g))}),s.jsx("div",{className:"hidden pt-4 mt-2 border-t theme-border",children:s.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border theme-border theme-bg-overlay px-2.5 py-1 w-fit",children:[s.jsx("span",{className:"h-1.5 w-1.5 rounded-full theme-bg-brand"}),s.jsx("span",{className:"text-[11px] font-medium theme-text-muted",children:"v0.1.0"})]})})]}),s.jsx("div",{className:"flex-1 overflow-y-auto p-6 space-y-5",children:u?s.jsx("div",{className:"space-y-3",children:[1,2,3].map(g=>s.jsx("div",{className:"h-16 animate-pulse rounded-lg border theme-border theme-bg-overlay",style:{opacity:1-g*.25}},g))}):s.jsxs(s.Fragment,{children:[s.jsx(lE,{}),h()]})})]})]})}function iE(){return s.jsxs("div",{className:"flex flex-1 flex-col theme-bg-base theme-text-primary",children:[s.jsx("div",{className:"flex items-center justify-between border-b theme-border px-6 py-5",children:s.jsxs("div",{children:[s.jsx("h1",{className:"text-[15px] font-medium leading-none theme-text-primary",children:"Docs"}),s.jsx("p",{className:"mt-1 text-[11px] theme-text-muted",children:"Guides and references for Jetic Local Studio."})]})}),s.jsx("div",{className:"flex flex-1 items-center justify-center p-6",children:s.jsxs("div",{className:"jetic-card flex w-full max-w-md flex-col items-center gap-2 px-6 py-10 text-center",children:[s.jsx("span",{className:"text-[13px] font-medium theme-text-primary",children:"Under development"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"This page is coming soon."})]})})]})}const cE=["overview","simulations","model","inspect","agents","tools","context","memory","apis","email","oauth","webhooks","traces","events","changes","settings","docs"],uE=5e3;function dE(){const{theme:n}=H0();return s.jsxs("div",{className:"jetic-surface flex h-screen w-full flex-col items-center justify-center gap-7",children:[s.jsx(j2,{size:56,loop:!0,sheen:n==="dark"?"#000":"#fff",className:"theme-text-primary"}),s.jsxs("div",{className:"flex flex-col items-center gap-1.5 text-center",children:[s.jsx("span",{className:"text-[13.5px] font-medium tracking-tight theme-text-primary",children:"Jetic Local Studio is loading…"}),s.jsx("span",{className:"text-[11px] theme-text-muted",children:"Preparing your workspace"})]}),s.jsx("div",{className:"h-[3px] w-40 overflow-hidden rounded-full theme-bg-overlay",children:s.jsx("div",{className:"jetic-loader-bar h-full w-full origin-left rounded-full theme-bg-brand"})})]})}function fE(){const[n,r]=j.useState(!0),[o,i]=j.useState(()=>{const C=localStorage.getItem("active_sidebar_item");return cE.includes(C)?C:"overview"}),[u,f]=j.useState(!1),[h,g]=j.useState(()=>{try{const C=localStorage.getItem("inspected_endpoint");return C?JSON.parse(C):null}catch{return null}}),[x,m]=j.useState(void 0);j.useEffect(()=>{const C=setTimeout(()=>r(!1),uE);return()=>clearTimeout(C)},[]),j.useEffect(()=>{localStorage.setItem("active_sidebar_item",o)},[o]),j.useEffect(()=>{h?localStorage.setItem("inspected_endpoint",JSON.stringify(h)):localStorage.removeItem("inspected_endpoint")},[h]);const p=C=>{C!=="inspect"&&g(null),C!=="traces"&&m(void 0),i(C)},b=C=>{g(C),i("inspect")},v=C=>{m(C),i("traces")},N=()=>{switch(o){case"overview":return s.jsx(px,{onNavigate:p});case"simulations":return s.jsx(G3,{onViewTraces:v});case"model":return s.jsx(a4,{onInspect:b,onViewTraces:v});case"inspect":return s.jsx(o4,{endpoint:h,onBack:()=>p("model")});case"agents":return s.jsx(i4,{});case"tools":return s.jsx(c4,{});case"context":return s.jsx(u4,{});case"memory":return s.jsx(N4,{});case"apis":return s.jsx(w4,{});case"email":return s.jsx(S4,{});case"oauth":return s.jsx(E4,{});case"webhooks":return s.jsx(k4,{});case"traces":return s.jsx(X4,{initialFilter:x,onNavigate:p});case"events":return s.jsx(Z4,{});case"changes":return s.jsx(K4,{onNavigate:p});case"settings":return s.jsx(oE,{});case"docs":return s.jsx(iE,{});default:return s.jsx(px,{})}};return n?s.jsx(dE,{}):s.jsxs("div",{className:"flex h-screen w-full overflow-hidden antialiased [font-feature-settings:'ss01'] font-sans text-xs transition-colors duration-300 theme-bg-base theme-text",children:[s.jsx(g2,{currentPage:o,onNavigate:p,onToggleAssistant:()=>f(!u),isAssistantOpen:u}),s.jsxs("div",{className:"flex min-w-0 flex-1 flex-col relative",children:[s.jsx("div",{className:"flex min-h-0 flex-1 overflow-auto transition-colors duration-300 theme-bg-base",children:N()}),s.jsx(y2,{isOpen:u,onClose:()=>f(!1)}),s.jsx(b2,{onNavigateToChanges:()=>p("changes")})]})]})}const hE=()=>s.jsx(h2,{children:s.jsx(fE,{})});Ub.createRoot(document.getElementById("root")).render(s.jsx(j.StrictMode,{children:s.jsx(hE,{})}));